After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 165068 - specify gcc printf attributes to spot format string errors
specify gcc printf attributes to spot format string errors
Status: RESOLVED FIXED
Product: libxml2
Classification: Platform
Component: general
2.6.17
Other All
: Normal enhancement
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2005-01-24 10:12 UTC by Marcus Meissner
Modified: 2009-01-18 21:01 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
libxml2-printf.patch (16.56 KB, patch)
2005-01-24 10:12 UTC, Marcus Meissner
needs-work Details | Review

Description Marcus Meissner 2005-01-24 10:12:35 UTC
This patch adds special gcc attributes that 
together with -Wformat / -Wall spot format string problems.
Comment 1 Marcus Meissner 2005-01-24 10:12:53 UTC
Created attachment 36438 [details] [review]
libxml2-printf.patch
Comment 2 Daniel Veillard 2005-01-24 10:41:05 UTC
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
Comment 3 Daniel Veillard 2005-01-24 12:30:46 UTC
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
Comment 4 Marcus Meissner 2005-01-24 12:35:27 UTC
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. 
Comment 5 Daniel Veillard 2009-01-18 21:01:11 UTC
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