Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I suppress compiler warnings in Xcode 5 caused by a 3rd party framework?

Tags:

xcode

I have a 3rd party framework that I have imported into my project, and it is causing compiler warnings to show up from issues in its header files. I do not want to have to change the 3rd party code, as it will likely change in the near future. I found this post:

Disable warnings in Xcode from frameworks

Which talks about how to turn off warnings on a per-file or per-project basis, but I am not certain how to do this for a framework. This is because the files are technically there but Xcode does not show them in the compiled sources section.

Does anyone know of a way to ignore compiler warnings for an included framework?

like image 953
lehn0058 Avatar asked Oct 29 '13 20:10

lehn0058


People also ask

How do I get rid of warnings in Xcode?

Select your project and select your target and show Build Phases . Search the name of the file in which you want to hide, and you should see it listed in the Compile Sources phase. Double-click in the Compiler Flags column for that file and enter -w to turn off all warnings for that file.

How do I ignore a warning in Swift?

If you want to disable all warnings, you can pass the -suppress-warnings flag (or turn on "Suppress Warnings" under "Swift Compiler - Warning Policies" in Xcode build settings).


1 Answers

We've fixed same problem with a 3rd party framework warnings in header files by including problematic files in our pre-compiled header (.pch) with a proper pragma mark.

i.e.

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmismatched-tags"
#pragma GCC diagnostic ignored "-Wreorder"

#import <ComponentKit/CKComponentViewConfiguration.h>
#import <ComponentKit/CKArrayControllerChangeset.h>
#import <ComponentKit/CKComponentDataSource.h>
#import <ComponentKit/CKComponentBoundsAnimation.h>

#pragma GCC diagnostic pop
like image 183
Michał Kałużny Avatar answered Oct 20 '22 15:10

Michał Kałużny