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 753381 - Return value problem in gom_sorting_add
Return value problem in gom_sorting_add
Status: RESOLVED FIXED
Product: gom
Classification: Other
Component: general
unspecified
Other FreeBSD
: Normal normal
: ---
Assigned To: Gom Maintainers
Gom Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-08-08 12:17 UTC by Ting-Wei Lan
Modified: 2015-08-12 10:35 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gom: Fix return value error in gom_sorting_add (748 bytes, patch)
2015-08-08 12:18 UTC, Ting-Wei Lan
committed Details | Review

Description Ting-Wei Lan 2015-08-08 12:17:52 UTC
Please see the patch. It fixes a return error in gom_sorting_add.
Comment 1 Ting-Wei Lan 2015-08-08 12:18:30 UTC
Created attachment 308937 [details] [review]
gom: Fix return value error in gom_sorting_add
Comment 2 Mathieu Bridon 2015-08-12 08:12:53 UTC
Right, so this is about -Wreturn-type: the void function should not return any value, but we return NULL.

It seems GCC has some special casing for this, as it doesn't complain at all about returning NULL in a void function, even when enabling the warning.

However, clang errors out on this, which means Gom can't be built with clang.

The patch is trivial and obvious, so a +1 from me. (but I'm not a maintainer, so wait for one of them to ACK the patch before pushing it)
Comment 3 Christian Hergert 2015-08-12 08:14:11 UTC
Comment on attachment 308937 [details] [review]
gom: Fix return value error in gom_sorting_add

LGTM
Comment 4 Mathieu Bridon 2015-08-12 08:22:24 UTC
I forgot, to reproduce the problem:

$ export CC=clang
$ ./autogen.sh
$ make

Ting-Wei, it would have been nice if you had explained how to reproduce the problem in details, like I did above and in the previous comment. :)
Comment 5 Ting-Wei Lan 2015-08-12 10:17:40 UTC
Attachment 308937 [details] pushed as d9362b1 - gom: Fix return value error in gom_sorting_add
Comment 6 Ting-Wei Lan 2015-08-12 10:35:59 UTC
(In reply to Mathieu Bridon from comment #2)
> Right, so this is about -Wreturn-type: the void function should not return
> any value, but we return NULL.
> 
> It seems GCC has some special casing for this, as it doesn't complain at all
> about returning NULL in a void function, even when enabling the warning.
> 

This is a GLib problem reported here:
https://bugzilla.gnome.org/show_bug.cgi?id=753310

gmessages.h contains '#pragma GCC system_header', so warnings are ignored by GCC.


(In reply to Mathieu Bridon from comment #4)
> I forgot, to reproduce the problem:
> 
> $ export CC=clang
> $ ./autogen.sh
> $ make
> 
> Ting-Wei, it would have been nice if you had explained how to reproduce the
> problem in details, like I did above and in the previous comment. :)

I have a JHBuild tinderbox running on FreeBSD:
https://wiki.gnome.org/Projects/Jhbuild/FreeBSD

FreeBSD >= 10 uses clang as the system compiler, so it is easy to catch clang build issue on it. If you search for 'void' on the wiki page, you can find that return value error is the most common problem when building GNOME modules on FreeBSD.

The JHBuild tinderbox automatically starts a build job at 3 am everyday. This helps us to catch build issues before releases are made, so packaging can be much easier because most bugs are fixed before releases.