This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Warning for unadorned 0 in varargs lists?
> > __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).
Sure, there's nothing in the syntax that precludes this. Following
the refinement mold, I would suggest we don't require this check as
part of any initial submission. It can be added later.
> 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.
I'm not sure this is desirable, suppose a function similar to execle
accepted a NULL env pointer? Why require the user to specify extra
flags? (I don't feel strongly about this one, it could certainly be
implemented as a refinement also.)
--Kaveh
--
Kaveh R. Ghazi ghazi@caip.rutgers.edu