I use a C++ library for an iOS app. With Apple LLVM 3.1 compiler configured (default), I get a lot of warnings for this C++ code, most of them saying:
... is a GNU extension
The introduction of clang's user manual says: The Clang driver and language features are intentionally designed to be as compatible with the GNU GCC compiler as reasonably possible, easing migration from GCC to Clang. In most cases, code "just works".
So, is it save to just look for a switch to disable this warnings (btw. how to?) or should I better get this lib rid of all GNU extensions?
You can suppress the warnings using compiler flags. Clang tells you which compiler flag to use for each warning. After a build, choose View > Navigators > Show Log Navigator. Then choose the latest build log from the log navigator. Find a file with a warning and click the disclosure button at the right end of its status line. Xcode will show you the compiler command line and output for that file. Each warning should include the compiler flag that enables the warning. Example:
In my example, the warning flag is -Wpointer-arith
. So the warning can be disabled by -Wno-pointer-arith
. So I could add that flag to the “Other Warning Flags” build setting:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With