On Thu, Sep 3, 2020 at 10:36 AM Tom Lane wrote: > > Jesse Zhang writes: > >> Peter Eisentraut writes: > >>> Where did the -Werror come from? > > > If you noticed the full invocation of clang, you'd notice that Werror is > > nowhere on the command line, even though the error message suggests > > otherwise. I think this is a behavior from the new AppleClang, > > Hmph. If you explicitly say -Wno-error, does the error drop back down > to being a warning?
Yeah something like that, this is what works for me: clang -Wno-error=implicit-function-declaration c.c Then it became a warning. Interestingly, it seems that AppleClang incorrectly forces this warning on us: $ clang --verbose c.c | Apple clang version 12.0.0 (clang-1200.0.31.1) | Target: x86_64-apple-darwin20.0.0 | Thread model: posix | InstalledDir: /Library/Developer/CommandLineTools/usr/bin | "/Library/Developer/CommandLineTools/usr/bin/clang" -cc1 -triple x86_64-apple-macosx11.0.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -Werror=implicit-function-declaration -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name c.c -mrelocation-model pic -pic-level 2 -mthread-model posix -mframe-pointer=all -fno-strict-return -masm-verbose -munwind-tables -target-sdk-version=11.0 -target-cpu penryn -dwarf-column-info -debugger-tuning=lldb -target-linker-version 609 -v -resource-dir /Library/Developer/CommandLineTools/usr/lib/clang/12.0.0 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -internal-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/local/include -internal-isystem /Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include -internal-externc-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -internal-externc-isystem /Library/Developer/CommandLineTools/usr/include -Wno-reorder-init-list -Wno-implicit-int-float-conversion -Wno-c99-designator -Wno-final-dtor-non-final-class -Wno-extra-semi-stmt -Wno-misleading-indentation -Wno-quoted-include-in-framework-header -Wno-implicit-fallthrough -Wno-enum-enum-conversion -Wno-enum-float-conversion -fdebug-compilation-dir /tmp -ferror-limit 19 -fmessage-length 193 -stack-protector 1 -fstack-check -mdarwin-stkchk-strong-link -fblocks -fencode-extended-block-signature -fregister-global-dtors-with-atexit -fgnuc-version=4.2.1 -fobjc-runtime=macosx-11.0.0 -fmax-type-align=16 -fdiagnostics-show-option -fcolor-diagnostics -o /var/folders/ts/nxrsmhmd0xb5zdrlqb4jlkbr0000gn/T/c-e6802f.o -x c c.c | clang -cc1 version 12.0.0 (clang-1200.0.31.1) default target x86_64-apple-darwin20.0.0 Notice that -Werror=implicit-function-declaration up there? I spent a few minutes digging in Apple's published fork of LLVM, they've been forcing this error flag for quite a while, but this particular warning-turned-error is guarded by a conditional along the lines of "is this iOS-like" [1][2], so I cannot imagine such a code path is activated (other than something like "goto fail;" from 2014) > > > I've heard reports of the same under the latest Xcode 12 on macOS > > Catalina, but I don't have my hands on such an env. > > The latest thing available to the unwashed masses seems to be > Xcode 11.7 with Yes you're right. Xcode 12 is still beta. > > Smells like an Apple bug from here. Surely they're not expecting > that anyone will appreciate -Werror suddenly being the default. I think you've convinced me that this is an Apple bug indeed. I'll probably just get by with a Wno-error=implicit-function-declaration in my CFLAGS for now. [1] https://github.com/apple/llvm-project/blob/swift-5.3-DEVELOPMENT-SNAPSHOT-2020-08-04-a/clang/lib/Driver/ToolChains/Darwin.cpp#L952-L962 [2] https://opensource.apple.com/source/clang/clang-800.0.42.1/src/tools/clang/lib/Driver/ToolChains.cpp