This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ patch] accept __null as sentinel


Hi,

On Fri, 29 Apr 2005, Mark Mitchell wrote:

> The documentation for -pedantic says:
> 
> "Issue all the warnings demanded by strict ISO C and ISO C++; reject all
> programs that use forbidden extensions, and some other programs that do not
> follow ISO C and ISO C++."

Yes, -pedantic does fit.

> -Wall is documented as:
> 
> "This enables all the warnings about constructions that some users consider
> questionable, and that are easy to avoid (or modify to prevent the warning),
> even in conjunction with macros."

Like I wrote in my last mail, this is not a definition of -Wall I consider
usefull.  Even if it's in the documentation.  How many users?  How must
they be qualified?  How many users are needed _not_ finding a warning
usefull to remove it from -Wall again?  What exactly is easy to avoid?
The easy way how users would avoid this warning in their C++ code is by 
adding this to their common_app.h:
  #ifdef __GNUC__
  /* GCC is #$%&!!! */
  #undef NULL
  #define NULL (void*)0
  #endif

And voila, we gained nothing.  Users are angry, code is not more portable
(whatever that means in this case), an ugly hack was added, and the other
places using NULL correctly now have an additional cast (per the theory of
Joseph the above addition wouldn't harm, as every use of NULL would be
casted to the correct type anyway).

> So, -Wall would be a better place, or -Wformat=2, as Joseph suggests, if
> we think the warning is too annoying by default.

-Wformat* is about format strings .  I wouldn't like to introduce still
another warning flag, except if it would be some collection flag
containing some more warnings, in the line of what I wrote last mail (i.e.  
portability to outside the GCC+glibc world).


Ciao,
Michael.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]