Reputation: 186
When trying to compile my software in Mac OS Sierra I run into an issue regarding unknown pragmas (See snippet below). According to a colleague, the software is able to compile in Mac OS X Yosemite with the same clang version (4.2.1). The compiling flags used are: -std=c++11 -stdlib=libc++
. Using stdlibc++
is not an option as it does not include std::shared_ptr
.
error: unknown warning group '-Wmaybe-uninitialized', ignored
[-Werror,-Wunknown-pragmas]
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
Here is a print out of g++ --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 8.0.0 (clang-800.0.42.1)
Target: x86_64-apple-darwin16.1.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
Unsure where to take it from here, any input is much appreciated.
Upvotes: 4
Views: 3384
Reputation: 2000
Instead of writing
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
you should do
#if !defined(__has_warning) || __has_warning("-Wmaybe-uninitialized")
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif
Upvotes: 10