Fedor Sergeev <Fedor.Sergeev at sun.com> wrote:
> > It would be nice to have a way to tell the compiler and/or lint that a
> > given function has printf/scanf behavior with some exceptions, and allow
> > the implementor to specify how specifiers and modifiers work for that
> > function.
>
> One of the biggest issues here would be to figure out proper user interface.
> Is there any gcc extension that does something useful for this matter?
> I dont remember one right away.
I would like to see an extensible warning infrastructure in the kompiler.
What GCC does doesn't really help. I usually get warnings like these:
==> COMPILING "cmdline.o"
cmdline.c: In function `getcmdchar':
cmdline.c:81: warning: zero-length printf format string
cmdline.c:88: warning: unknown conversion type character `r' in format
cmdline.c:88: warning: too many arguments for format
cmdline.c:104: warning: unknown conversion type character `r' in format
cmdline.c:104: warning: int format, pointer arg (arg 3)
cmdline.c:104: warning: too many arguments for format
cmdline.c: In function `_getcmdline':
cmdline.c:199: warning: zero-length printf format string
cmdline.c:201: warning: unknown conversion type character `r' in format
cmdline.c:201: warning: too many arguments for format
This is a result of having %r (recursive printf) since nearly 30 years
in my private printf() implementation.
I would need to be able to tell the cheker code, that %r takes a format
string _and_ a va_list type argument.
J?rg
--
EMail:joerg at schily.isdn.cs.tu-berlin.de (home) J?rg Schilling D-13353 Berlin
js at cs.tu-berlin.de (uni)
joerg.schilling at fokus.fraunhofer.de (work) Blog:
http://schily.blogspot.com/
URL: http://cdrecord.berlios.de/private/ ftp://ftp.berlios.de/pub/schily