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 738660 - latexila-build-job.c: Non-void function should return a value
latexila-build-job.c: Non-void function should return a value
Status: RESOLVED FIXED
Product: gnome-latex
Classification: Other
Component: general
unspecified
Other FreeBSD
: Normal normal
: unspecified
Assigned To: LaTeXila maintainer(s)
LaTeXila maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2014-10-17 06:43 UTC by Ting-Wei Lan
Modified: 2014-10-18 06:06 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix "Non-void function should return a value" (907 bytes, patch)
2014-10-17 06:45 UTC, Ting-Wei Lan
none Details | Review

Description Ting-Wei Lan 2014-10-17 06:43:09 UTC
In src/liblatexila/latexila-build-job.c, the function latexila_build_job_run_finish uses g_return_if_fail, which should be replaced by g_return_val_if_fail.
Comment 1 Ting-Wei Lan 2014-10-17 06:45:22 UTC
Created attachment 288720 [details] [review]
Fix "Non-void function should return a value"
Comment 2 Sébastien Wilmet 2014-10-17 09:34:44 UTC
Thanks, the commit is pushed:
https://git.gnome.org/browse/latexila/commit/?id=a8142168d4fe33331eeaf52843e80572e951954a

I think Clang reports this kind of error, but do you know if it is possible to have the error also with GCC?
Comment 3 Ting-Wei Lan 2014-10-17 10:17:09 UTC
(In reply to comment #2)
> I think Clang reports this kind of error, but do you know if it is possible to
> have the error also with GCC?

Does -Werror=return-type work? I hope we can put it in gnome-common.
Comment 4 Sébastien Wilmet 2014-10-17 10:48:28 UTC
No, it doesn't work with gcc 4.9.1.
Comment 5 Ting-Wei Lan 2014-10-17 13:30:24 UTC
(In reply to comment #4)
> No, it doesn't work with gcc 4.9.1.

I saw this with gcc 4.8.3.

latexila-build-job.c:676:171: error: 'return' with no value, in function returning non-void [-Werror=return-type]
cc1: some warnings being treated as errors
Comment 6 Sébastien Wilmet 2014-10-17 16:03:51 UTC
When compiling with

$ make V=1

I get the following flags for GCC. But I don't get the error/warning.

-Wall -Wstrict-prototypes -Wnested-externs -Werror=missing-prototypes -Werror=implicit-function-declaration -Werror=pointer-arith -Werror=init-self -Werror=format=2 -Werror=missing-include-dirs -O0 -g -fprofile-arcs -ftest-coverage -g -O2 -pthread

-Wreturn-type is normally included by -Wall. Adding -Wreturn-type to my CFLAGS doesn't help.

My distro is Fedora 21.
Comment 7 Ting-Wei Lan 2014-10-18 06:06:48 UTC
(In reply to comment #6)
> When compiling with
> 
> $ make V=1
> 
> I get the following flags for GCC. But I don't get the error/warning.
> 
> -Wall -Wstrict-prototypes -Wnested-externs -Werror=missing-prototypes
> -Werror=implicit-function-declaration -Werror=pointer-arith -Werror=init-self
> -Werror=format=2 -Werror=missing-include-dirs -O0 -g -fprofile-arcs
> -ftest-coverage -g -O2 -pthread
> 
> -Wreturn-type is normally included by -Wall. Adding -Wreturn-type to my CFLAGS
> doesn't help.
The flags I used to compiling latexila:
-Wall -Wstrict-prototypes -Wnested-externs -Werror=missing-prototypes -Werror=implicit-function-declaration -Werror=pointer-arith -Werror=init-self -Werror=format-security -Werror=format=2 -Werror=missing-include-dirs -I../../src/evince -Wall -g -O0 -pthread

There is an warning:
latexila-build-job.c: In function 'latexila_build_job_run_finish':
latexila-build-job.c:676:171: warning: 'return' with no value, in function returning non-void [-Wreturn-type]

> 
> My distro is Fedora 21.
I test it using gcc 4.8.3 on Fedora 20, but this bug is discovered by using the default compiler on FreeBSD 10.1, which is clang 3.4.1.