Warning for unadorned 0 in varargs lists?
Joseph S. Myers
jsm@polyomino.org.uk
Mon Aug 23 14:17:00 GMT 2004
On Mon, 23 Aug 2004, Kaveh R. Ghazi wrote:
> I'd like to propose the following design:
>
> __attribute__ ((sentinel [, sentinel_position_from_end [, sentinel_value]]))
I'd suggest a refinement: that the variadic arguments before the sentinel
should be required to have types interchangable with the type of the
sentinel in va_arg. So for a sentinel of type void * they could have
types pointer to void or to character types, or any pointer type unless
-pedantic (as with format warnings for printf %p).
(Such a requirement can't be applied to arguments after the sentinel;
there's no particular reason for them to have types interchangable with
it, and execle doesn't.)
In addition, the sentinel is the first variadic argument with the right
value, and subsequent arguments beyond sentinel_position_from_end of them
would be warned for unless -Wno-format-extra-args.
--
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