Warning for unadorned 0 in varargs lists?

Joseph S. Myers jsm@polyomino.org.uk
Mon Aug 23 13:58:00 GMT 2004


On Sun, 22 Aug 2004, Marc Espie wrote:

> That's exactly what the attribute((sentinel)) construct we added in
> OpenBSD does.
> 
> I just haven't had time to port it over to gcc-current, as the
> implementation we use is for gcc 2.95 or gcc 3.3...

There's also the problem of

* avoiding the proliferation of many different attributes to cover the 
different conventions that may be used for this sort of thing; and

* covering the main cases used in real code (note e.g. execle isn't a 
NULL-terminated list, there's one argument after the NULL); and

* at the same time avoiding waiting forever in the hope of a general 
design that will do everything including many cases that are of no use.

(This makes a thorough survey of the conventions used for variadic 
function termination in real code important, to assess what is worth 
including in such an attribute and what possibilities are purely 
theoretical.)

http://gcc.gnu.org/ml/gcc-patches/2002-10/msg00789.html
http://gcc.gnu.org/ml/gcc-patches/2002-10/msg00802.html
http://gcc.gnu.org/ml/gcc-patches/2003-05/msg01571.html

(and subsequent threads)

-- 
Joseph S. Myers               http://www.srcf.ucam.org/~jsm28/gcc/
    jsm@polyomino.org.uk (personal mail)
    jsm28@gcc.gnu.org (Bugzilla assignments and CCs)



More information about the Gcc mailing list