This is the mail archive of the gcc@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: [PATCH]: Proof-of-concept for dynamic format checking


Alan Modra <amodra@bigpond.net.au> writes:

> It's a great pity that vfprintf doesn't return its va_list arg.  If it
> did, you could chop the format string into pieces and have vprintf
> process the normal parts, consuming args as it goes.

You can do relatively limited parsing and still identify how printf is
going to use its arguments.  See libiberty/vasprintf.c.  (Although it
admittedly assumes that long == int, and it mishandles %lld.)

I suppose we could write the version of vfprintf you want, and put it
in libiberty.  Assuming it is always OK to pass the address of a
va_list to a function.

Ian


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