Closed
Bug 777515
Opened 12 years ago
Closed 11 years ago
Enable gcc -Wzero-as-null-pointer-constant warnings for gcc >= 4.7
Categories
(Firefox Build System :: General, defect)
Firefox Build System
General
Tracking
(Not tracked)
RESOLVED
WONTFIX
People
(Reporter: cpeterson, Unassigned)
References
(Blocks 1 open bug)
Details
gcc 4.7 added a new command-line option -Wzero-as-null-pointer-constant to warn when a literal '0' is used as null pointer constant. It can be useful to facilitate the conversion to nullptr in C++11.
http://gcc.gnu.org/onlinedocs/gcc-4.7.0/gcc/Warning-Options.html
-Wzero-as-null-pointer-constant (C++ and Objective-C++ only)
Warn when a literal '0' is used as null pointer constant. This can be useful to facilitate the conversion to nullptr in C++11.
Updated•12 years ago
|
Component: MFBT → Build Config
Comment 1•12 years ago
|
||
I vote that in the absence of tree-wide FAIL_ON_WARNINGS, the switch be -Werror=zero-as-null-pointer-constant unconditionally, so that we're not fixing warnings that should have been errors.
Comment 2•12 years ago
|
||
Try doesn't run gcc 2.7 yet, does it? So making this fatal (even in directories that opt in to fatal warnings generally) would just break the build for anyone using gcc 2.7. Until we have at least tryservers running gcc 2.7, we need to use -Wnoerror for it even with FAIL_ON_WARNINGS.
Comment 3•12 years ago
|
||
(In reply to :Aryeh Gregor from comment #2)
> Try doesn't run gcc 2.7 yet, does it? So making this fatal (even in
> directories that opt in to fatal warnings generally) would just break the
> build for anyone using gcc 2.7. Until we have at least tryservers running
> gcc 2.7, we need to use -Wnoerror for it even with FAIL_ON_WARNINGS.
I dunno, even our current FAIL_ON_WARNINGS directories have broken things for people using GCC 4.6, and we don't have 4.6 on try. Maybe it's not a big deal either way.
Comment 4•12 years ago
|
||
Well, it might be tenable, but only if someone fixes up the whole tree first. I can guarantee you, based on converting nsnull to nullptr and now nsresult to an enum, that there will be hundreds of places where people use things that happen to equal zero instead of null pointer values, because the compiler will accept it.
Comment 5•12 years ago
|
||
Sounds like we should just enable the warning for now, and hold off to making it fatal until our official builds are on GCC 4.7 or newer.
Reporter | ||
Comment 6•11 years ago
|
||
Firefox for Android is now compiled using gcc 4.7. However, gcc -Wzero-as-null-pointer-constant generates thousands (or tens of thousands if you count warnings from header files like nsCOMPtr and that gcc -Wzero-as-null-pointer-constant warns about using NULL, not just 0). AFAICT none of them are bugs, just style warnings.
Updated•7 years ago
|
Product: Core → Firefox Build System
You need to log in
before you can comment on or make changes to this bug.
Description
•