This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [c++] warn if NULL is passed through varargs
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: Michael Matz <matz at suse dot de>
- Cc: Gabriel Dos Reis <gdr at integrable-solutions dot net>, "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>, <gcc-patches at gcc dot gnu dot org>
- Date: 10 Oct 2002 13:56:42 -0300
- Subject: Re: [c++] warn if NULL is passed through varargs
- Organization: GCC Team, Red Hat
- References: <Pine.LNX.4.33.0210101740400.9652-100000@wotan.suse.de>
On Oct 10, 2002, Michael Matz <matz@suse.de> wrote:
> A compiler (or library header) which defines NULL for C (which has to be a
> pointer) to just 0 on such a machine is broken.
grep '#define NULL' /usr/include/*.h reveals a number of programs that
define NULL to 0, at least when NULL isn't previously defined, which
is possible if you #include say <expect.h> or <tcl.h> before
<stddef.h>.
Of course, such mis-definitions wouldn't take any benefit from the
warnings in the first place, since the warning could only possibly
trigger if gcc gets to define NULL the way it can track where it's
used inappropriately.
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist Professional serial bug killer