This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ patch] accept __null as sentinel
> Fine; then -Wformat=2 is a reasonable place. I agree with Joseph that
> -pedantic is not the right place; that's about failures to conform to
> standards.
>
> > A criteria for usefull warnings _to me_ (I fully realize that's not
> > the opinion of all), is "can it change code harmfully depending on
> > the architecture or circumstances, when compiled on a GNU system".
>
> That's indeed a useful category of warnings, and I'd be happy to have
> a switch for that. But -Wall isn't presently that option; for example,
> -W adds support for warning about falling off a function, which
> clearly can cause problems when compiled on a GNU system. Nor is that
> warning added by -pedantic, as it's not a standards-conformance issue.
I would prefer that at least some form of sentinel checking be done in
plain -Wall/-Wformat, because most people won't know to use a special
flag to get the new sentinel checking, so the vast majority of users
won't see any benefit from this new warning.
How about if the default -Wall/-Wformat behavior check for sentinels
but in the lenient fashion Michael proposes i.e. allowing __null. And
-Wformat=2 (or some extra flag) is more strict, i.e. disallows __null.
That would ensure -Wall would continue to be useful but not complain
about the NULL macro for people confined to GNU systems, while still
providing a way for those interested in porting to systems where NULL
is 0.
Sound okay?
--Kaveh
--
Kaveh R. Ghazi ghazi@caip.rutgers.edu