[c++] warn if NULL is passed through varargs

Tom Tromey tromey@redhat.com
Wed Oct 9 14:09:00 GMT 2002


>>>>> "Kaveh" == Kaveh R Ghazi <ghazi@caip.rutgers.edu> writes:

Kaveh> I ask because variadic function uses such as:
>> concat (blah, blah, NULL)
Kaveh> are ubiquitous in GCC and there have been no complaints or bug
Kaveh> reports AFAIK.  (There are probably other examples too.)

I understand there are programs in the typical Linux distribution that
use the equivalent of concat (blah, blah, 0).
It would be nice to be able to warn about this on architectures where
sizeof(int) != sizeof(void*).  Likewise it would be nice to get
warnings about a missing trailing `NULL' for functions like execl,
just like we get warnings about printf format/argument mismatches.

Tom



More information about the Gcc-patches mailing list