WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
16124
Add printf format attribute to several functions to fix some GCC warnings
https://bugs.webkit.org/show_bug.cgi?id=16124
Summary
Add printf format attribute to several functions to fix some GCC warnings
Laszlo Gombos
Reported
2007-11-24 18:38:54 PST
GCC has an extension to specify type check for format strings. See
http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html#Function-Attributes
for details. This syntax is already used in PlatformString.h and in DeprecatedString.h in WebCore. This fix get rid of the following GCC warning XMLTokenizer.cpp:881: warning: function might be possible candidate for ‘printf’ format attribute
Attachments
Fix attached.
(2.65 KB, patch)
2007-11-24 18:39 PST
,
Laszlo Gombos
mjs
: review-
Details
Formatted Diff
Diff
Revised patch
(3.66 KB, patch)
2007-11-24 20:41 PST
,
Laszlo Gombos
mrowe
: review-
Details
Formatted Diff
Diff
2nd revised patch
(3.31 KB, patch)
2007-11-24 21:21 PST
,
Laszlo Gombos
sam
: review-
Details
Formatted Diff
Diff
3rd revised patch
(3.62 KB, patch)
2007-11-25 08:06 PST
,
Laszlo Gombos
sam
: review+
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Laszlo Gombos
Comment 1
2007-11-24 18:39:45 PST
Created
attachment 17493
[details]
Fix attached.
Maciej Stachowiak
Comment 2
2007-11-24 19:08:31 PST
Comment on
attachment 17493
[details]
Fix attached. Substance of the change looks good. A few comments on style: 1) We usually use #if COMPILER(GCC) rather than #if __GNUC__ 2) It might be a good idea to make a macro that's defined to either the right attribtue or nothing depending on the compiler, to avoid sprinking the code with compiler #ifdefs. Please make those adjustments (feel free to also fix existing uses of the printf attribute). r- for now, will gladly re-review with those fixes.
Sam Weinig
Comment 3
2007-11-24 19:28:10 PST
You can actually use the new WTF_ATTRIBUTE_PRINTF defined in wtf/Assertions.h for this.
Laszlo Gombos
Comment 4
2007-11-24 20:41:38 PST
Created
attachment 17497
[details]
Revised patch Maciej, could not agree more. Sam, thanks for the tip. Revised patch attached.
Mark Rowe (bdash)
Comment 5
2007-11-24 20:54:51 PST
Comment on
attachment 17497
[details]
Revised patch The attributes on warningHandler, fatalErrorHandler and friends should probably go on the functions themselves rather than forward-declaring them such as you have. Why does handleError need the attribute? It does not appear to be used with a format string.
Laszlo Gombos
Comment 6
2007-11-24 21:21:44 PST
Created
attachment 17498
[details]
2nd revised patch Mark, you're right about handleError(), I took it out from the patch. The format attribute can only be used in function declaration, that is why warningHandler() and friends needs to be forward-declared.
Mark Rowe (bdash)
Comment 7
2007-11-24 23:04:58 PST
(In reply to
comment #6
)
> Created an attachment (id=17498) [edit] > 2nd revised patch > > Mark, you're right about handleError(), I took it out from the patch. > > The format attribute can only be used in function declaration, that is why > warningHandler() and friends needs to be forward-declared.
I don't believe that is the case. See <
http://trac.webkit.org/projects/webkit/browser/trunk/JavaScriptCore/wtf/Assertions.cpp?rev=27947#L50
>, for instance.
Sam Weinig
Comment 8
2007-11-25 03:58:16 PST
Comment on
attachment 17498
[details]
2nd revised patch r- based on marks comments
Laszlo Gombos
Comment 9
2007-11-25 08:06:50 PST
Created
attachment 17506
[details]
3rd revised patch Mark, you're right, it compiles with GCC 4.1 - I checked. Revised patch attached.
Sam Weinig
Comment 10
2007-11-25 11:18:06 PST
Comment on
attachment 17506
[details]
3rd revised patch r=me
Mark Rowe (bdash)
Comment 11
2007-11-25 18:13:19 PST
Landed in
r28028
. Thanks for being patient with the review process!
Lucas Forschler
Comment 12
2019-02-06 09:02:44 PST
Mass moving XML DOM bugs to the "DOM" Component.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug