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 744263 - Fix format specifier for __LINE__ in G_OBJECT_WARN_INVALID_PSPEC
Fix format specifier for __LINE__ in G_OBJECT_WARN_INVALID_PSPEC
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gobject
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2015-02-10 12:30 UTC by David King
Modified: 2015-02-26 12:23 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
proposed patch (1.27 KB, patch)
2015-02-10 12:31 UTC, David King
committed Details | Review

Description David King 2015-02-10 12:30:54 UTC
GCC 5.0, with its new -Wformat-signedness, warns about the sign being different between a type and the format string in printf-format messages, leading to compiler warnings with G_OBJECT_WARN_INVALID_PSPEC. In other uses of __LINE__ inside GLib, %d is used, and GCC seems to expect a format specifier of %d as well: https://gcc.gnu.org/onlinedocs/cpp/Standard-Predefined-Macros.html

The warning can be triggered when compiling code which uses G_OBJECT_WARN_INVALID_PSPEC (or G_OBJECT_WARN_INVALID_PROPERTY_ID, which I tested in Yelp) with -Wformat=2.
Comment 1 David King 2015-02-10 12:31:57 UTC
Created attachment 296495 [details] [review]
proposed patch
Comment 2 Matthias Clasen 2015-02-26 11:23:25 UTC
Review of attachment 296495 [details] [review]:

sure
Comment 3 Rico Tzschichholz 2015-02-26 11:35:38 UTC
commit d36f6a9633f18cbf14e8a52add66b40d8eb6a4da
Author: David King <dking@redhat.com>
Date:   Mon Feb 9 11:23:58 2015 +0000

    gobject.h: Use correct format specifier for __LINE__
    
    GCC 5.0, with its new -Wformat-signedness, warns about the sign being
    different between a type and the format string in printf-format
    messages, leading to compiler warnings with G_OBJECT_WARN_INVALID_PSPEC.
    In other uses of __LINE__ inside GLib, %d is used, and GCC seems to
    expect a format specifier of %d as well:
    https://gcc.gnu.org/onlinedocs/cpp/Standard-Predefined-Macros.html
    
    https://bugzilla.gnome.org/show_bug.cgi?id=744263
Comment 4 David King 2015-02-26 12:22:57 UTC
Review of attachment 296495 [details] [review]:

On master as d36f6a9633f18cbf14e8a52add66b40d8eb6a4da.