After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 757979 - MM_ARG_ENABLE_WARNINGS(): Incorrectly fails the check for -Wzero-as-null-pointer-constant supports
MM_ARG_ENABLE_WARNINGS(): Incorrectly fails the check for -Wzero-as-null-poin...
Status: RESOLVED FIXED
Product: mm-common
Classification: Bindings
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: mm-common-maint
mm-common-maint
Depends on:
Blocks:
 
 
Reported: 2015-11-12 10:25 UTC by Murray Cumming
Modified: 2015-11-19 11:39 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch: mm-warnings.m4: Fix MM_ARG_ENABLE_WARNINGS for C++11 (1012 bytes, patch)
2015-11-15 17:59 UTC, Kjell Ahlstedt
none Details | Review

Description Murray Cumming 2015-11-12 10:25:47 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.
Comment 1 Kjell Ahlstedt 2015-11-15 17:59:11 UTC
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
Comment 2 Murray Cumming 2015-11-19 11:39:25 UTC
Thanks. I've pushed that patch to mm-common and reverted the use of the warning in glibmm.