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 788384 - gtypes: Fix signedness of __builtin_bswap() usage
gtypes: Fix signedness of __builtin_bswap() usage
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2017-09-30 23:30 UTC by Philip Withnall
Modified: 2017-10-02 14:34 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gtypes: Fix signedness of __builtin_bswap() usage (1.47 KB, patch)
2017-09-30 23:30 UTC, Philip Withnall
committed Details | Review

Description Philip Withnall 2017-09-30 23:30:02 UTC
Trivial patch attached.
Comment 1 Philip Withnall 2017-09-30 23:30:07 UTC
Created attachment 360710 [details] [review]
gtypes: Fix signedness of __builtin_bswap() usage

In GUINT64_TO_BE(), for example, when compiling with -Wsign-conversion,
we get a warning due to an implicit cast from (gint64) to (guint64) when
passing the argument to __builtin_bswap64().

According to the GCC documentation, __builtin_bswap64() takes an
unsigned argument:

https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html

Cast the input appropriately.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Comment 2 Philip Withnall 2017-09-30 23:31:19 UTC
Sebastian, since you filed bug #531901 which originally added these builtins, would you mind taking a look at my patch please? I’m unsure if there was a specific reason you originally casted to (gint64) rather than (guint64).
Comment 3 Matthias Clasen 2017-10-02 14:26:49 UTC
Review of attachment 360710 [details] [review]:

ok
Comment 4 Philip Withnall 2017-10-02 14:34:13 UTC
Comment on attachment 360710 [details] [review]
gtypes: Fix signedness of __builtin_bswap() usage

Pushed as 0e888bdf52fd5f94ca6360886fe3085b646a3ec5.

Sebastian, please speak up soon if you see a problem with this!