GNOME Bugzilla – Bug 165068
specify gcc printf attributes to spot format string errors
Last modified: 2009-01-18 21:01:11 UTC
This patch adds special gcc attributes that together with -Wformat / -Wall spot format string problems.
Created attachment 36438 [details] [review] libxml2-printf.patch
I'm pretty sure that as-is the patch: - break the source parsing of doc/apibuild.py needed to build the API XML description and generate python bindings, elfgcchack.h, documentation files, etc... see "make rebuild" in the doc subdir - break compilation on Windows since include/libxml/xmlwin32version.h.in has no definition for the new macro I'm also wondering about compiling with old gcc versions. When was __attribute__((__format__(__printf__,fmt,args))) support added to gcc and can this be added to the test ? I'm not too fond of the modifications done on the header files themselves adding the extra info to the C code, okay, but to the header it doesn't look clean to me. I don't think I can apply that patch right now or as-is, there is too much portability troubles/uncertainites with it. Daniel
Don't misunderstand my comment though, I think doing the checking when possible is a great idea, but as-is I can't apply the patch, Daniel
the format string attribute was introduced with gcc 3.3 (on 2003-06-29) The define is already enclosed by ifdef __GNUC__, so perhaps just add: #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2) I cannot really speak wwhat the docu extractor and gccaliashack.h scripts/hack will do here.
While going though 552505 I reexamined this patch and the tweaks needed for apibuild.py and windows header are similar so I ported the patch back to SVN head, this is now all commited, thanks ! Daniel