This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] __attribute__((variadic("terminator", VAL)))?


On Mon, 14 Oct 2002, Gwenole Beauchesne wrote:

> Since I am fed up of grepping gnome2 sources et al. for incorrect variadic
> function terminations, I wanted to know a means to hint gcc and could not
> find any yet. What I would like is some attribute telling what is the
> expected terminator like.

You should be working together with Tom Tromey (see
<http://gcc.gnu.org/ml/gcc-patches/2002-10/msg00789.html>) on a single
more general patch.

> static const int it = 0;
> extern void f4(int t, ...) __attribute__((variadic("terminator", it)));

I don't believe this usage should be accepted in C, where const variables
are not constant expressions.  General specification of type and value of
terminator may be useful, but it should be a constant expression.  (But 
see the request in my followup to the previous message for some analysis 
of what types of termination etc. are actually used in real code.)

(Note also that char * and void * are compatible for passing to va_arg, as
are signed and unsigned versions of a type if the value is representable
in both, so the feature should allow such variations.)

-- 
Joseph S. Myers
jsm28@cam.ac.uk


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]