GNOME Bugzilla – Bug 757979
MM_ARG_ENABLE_WARNINGS(): Incorrectly fails the check for -Wzero-as-null-pointer-constant supports
Last modified: 2015-11-19 11:39:25 UTC
The test code used by MM_ARG_ENABLE_WARNINGS() uses 0 for comparison with argv, which fails with -Wzero-as-null-pointer-constant, so this macro cannot check if -Wzero-as-null-pointer-constant is available. For instance, I see this in config.log: conftest.cpp:44:51: warning: zero as null pointer constant [-Wzero-as-null-pointer-constant] int main(int argc, char** argv) { return (argv != 0) ? argc : 0; } ^ We could just use nullptr, but then MM_ARG_ENABLE_WARNINGS would only work with --std=c++11 or c++14.
Created attachment 315633 [details] [review] patch: mm-warnings.m4: Fix MM_ARG_ENABLE_WARNINGS for C++11 The comment before the test program says that the only requirement is that it shall not cause compilation problems. This patch fixes that even without modifying the program's exit code, if it is executed (which it is not). With this modification of mm-common 'make clean && make && make check' runs OK in libsigc++. The same commands in glibmm show several uses of 0 as a null pointer in glibmm files and, what's more problematic, in glib header files. The -Wzero-as-null-pointer-constant option will generate compilation warnings from all files that include glib.h
Thanks. I've pushed that patch to mm-common and reverted the use of the warning in glibmm.