GNOME Bugzilla – Bug 749652
compilation errors with gcc 4.8
Last modified: 2017-11-28 14:17:39 UTC
/builds/glib2/glib-2.44.1/gio/gdbusauthmechanismsha1.c: In function 'ensure_keyring_directory': /builds/glib2/glib-2.44.1/gio/gdbusauthmechanismsha1.c:275:28: error: format '%o' expects argument of type 'unsigned int', but argument 6 has type 'long unsigned int' [-Werror=format=] statbuf.st_mode & 0777); ^ CC libgio_2_0_la-gdbusmessage.lo /builds/glib2/glib-2.44.1/gio/gdbusmessage.c: In function 'g_dbus_message_print': /builds/glib2/glib-2.44.1/gio/gdbusmessage.c:3475:43: error: format '%d' expects argument of type 'int', but argument 4 has type 'major_t' [-Werror=format=] major (statbuf.st_dev), minor (statbuf.st_dev)); ^ /builds/glib2/glib-2.44.1/gio/gdbusmessage.c:3475:43: error: format '%d' expects argument of type 'int', but argument 5 has type 'minor_t' [-Werror=format=] /builds/glib2/glib-2.44.1/gio/gdbusmessage.c:3477:43: error: format '%o' expects argument of type 'unsigned int', but argument 4 has type 'mode_t' [-Werror=format=] statbuf.st_mode); ^ /builds/glib2/glib-2.44.1/gio/gdbusmessage.c:3485:43: error: format '%d' expects argument of type 'int', but argument 4 has type 'major_t' [-Werror=format=] major (statbuf.st_rdev), minor (statbuf.st_rdev)); ^ /builds/glib2/glib-2.44.1/gio/gdbusmessage.c:3485:43: error: format '%d' expects argument of type 'int', but argument 5 has type 'minor_t' [-Werror=format=] cc1: some warnings being treated as errors
Created attachment 363930 [details] [review] gio: Add some casts for printf() formatting statbufs on Solaris Apparently Solaris defines statbuf fields as long when Linux doesn’t, in some cases. Cast down to the type expected by the printf() format placeholder. Signed-off-by: Philip Withnall <withnall@endlessm.com>
Review of attachment 363930 [details] [review]: Every time I see a cast to (gint), I get a vague twitch in my left eye.
Attachment 363930 [details] pushed as e644bfa - gio: Add some casts for printf() formatting statbufs on Solaris