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 702516 - gfileutils: Make -Werror=format-nonliteral happy
gfileutils: Make -Werror=format-nonliteral happy
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2013-06-17 21:55 UTC by Colin Walters
Modified: 2013-09-29 18:37 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gfileutils: Make -Werror=format-nonliteral happy (3.28 KB, patch)
2013-06-17 21:56 UTC, Colin Walters
reviewed Details | Review
now with a more #pragma-tic soution (3.27 KB, patch)
2013-08-17 20:50 UTC, Colin Walters
committed Details | Review
Covers the other 5 files with these errors (3.48 KB, patch)
2013-09-28 23:49 UTC, John Ralls
committed Details | Review

Description Colin Walters 2013-06-17 21:55:25 UTC
I tried to please it by using G_GNUC_FORMAT, but that didn't work, so
let's just fall back to pushing an ignore.
Comment 1 Colin Walters 2013-06-17 21:56:26 UTC
Created attachment 247075 [details] [review]
gfileutils: Make -Werror=format-nonliteral happy

I tried to please it by using G_GNUC_FORMAT, but that didn't work, so
let's just fall back to pushing an ignore.
Comment 2 Colin Walters 2013-06-17 22:04:39 UTC
See also https://bugzilla.gnome.org/show_bug.cgi?id=692130 which is related I think in that if we actually got -Werror=format-security it'd trigger this.
Comment 3 Matthias Clasen 2013-08-17 16:52:43 UTC
Review of attachment 247075 [details] [review]:

I assume it is safe to use _Pragma directly like that, other compilers are supposed to ignore it. But _Pragma is C99 - does it work with all the compilers we care about ?
Comment 4 Dan Winship 2013-08-17 17:00:17 UTC
no. but we can just use #pragma here since it's not in a macro
Comment 5 Colin Walters 2013-08-17 20:50:03 UTC
Created attachment 252071 [details] [review]
now with a more #pragma-tic soution
Comment 6 John Ralls 2013-09-28 23:49:21 UTC
Created attachment 255994 [details] [review]
Covers the other 5 files with these errors 

I've patched the other 5 files.

Apple has released Xcode 5 without llvm-gcc4.2, so there's only Clang, so it's a bit more urgent that we commit these patches.
Comment 7 Colin Walters 2013-09-29 14:11:38 UTC
Review of attachment 255994 [details] [review]:

Hi John,

This looks fine, thanks a lot for writing the patch!  It's unfortunate that CLang applies -Wformat-nonliteral differently from GCC, but I'm glad it at least respects the same diagnostics.  Let's go with this for now, but I suspect this will be a continuing issue because a lot of us GCC-using developers will keep adding patches that may trigger the behavior.
Comment 8 Colin Walters 2013-09-29 14:12:17 UTC
(Can you or someone else review my patch?)
Comment 9 Emmanuele Bassi (:ebassi) 2013-09-29 14:26:46 UTC
Review of attachment 252071 [details] [review]:

seems all right to me.
Comment 10 John Ralls 2013-09-29 18:37:14 UTC
Heh. With gcc-4.2, it bombs with 
/Users/john/Development/gtk-sources/glib-2.38.0/glib/gfileutils.c: In function 'format_error_message':
/Users/john/Development/gtk-sources/glib-2.38.0/glib/gfileutils.c:1019: error: #pragma GCC diagnostic not allowed inside functions
/Users/john/Development/gtk-sources/glib-2.38.0/glib/gfileutils.c:1020: error: #pragma GCC diagnostic not allowed inside functions
/Users/john/Development/gtk-sources/glib-2.38.0/glib/gfileutils.c:1026: error: #pragma GCC diagnostic not allowed inside functions

I fixed that with ab5aa2a and backported everything to glib-2-38.