GNOME Bugzilla – Bug 738660
latexila-build-job.c: Non-void function should return a value
Last modified: 2014-10-18 06:06:48 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.
Created attachment 288720 [details] [review] Fix "Non-void function should return a value"
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?
(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.
No, it doesn't work with gcc 4.9.1.
(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
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.
(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.