https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91187
Harald van Dijk <harald at gigawatt dot nl> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |harald at gigawatt dot nl --- Comment #3 from Harald van Dijk <harald at gigawatt dot nl> --- If the header files can be modified, there is no need to put any pragmas in there, the header files can just be modified to not use a literal 0. If the header files cannot be modified, the -isystem command-line option also causes included files to be treated as system headers where warnings are suppressed. If there is going to be some other way to suppress -Wzero-as-null-pointer-constant, it should not simply depend on extern "C". The problem here isn't that it's in an extern "C" block, it's that it's in a header you cannot change, and you propose using the presence of an extern "C" block to detect that. The problem with that is that it will also suppress the warning for extern "C" blocks that you can change. (Of course, in headers meant to be compatible with C, you cannot use nullptr, but you do not need to: you can include <stddef.h> and use NULL, which will not trigger this warning.)