This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Enable -Wreturn-type by default ?
- From: Sylvestre Ledru <sylvestre at debian dot org>
- To: gcc at gcc dot gnu dot org
- Date: Wed, 13 Nov 2013 17:42:26 +0100
- Subject: Enable -Wreturn-type by default ?
- Authentication-results: sourceware.org; auth=none
Hello,
I would like to propose the activation by default of -Wreturn-type.
The main objective would to provide a warning for such code:
int foo() {
return;
}
For now, it is only enabled when we have -Wall:
$ gcc -c foo.c
$ gcc -Wall -c foo.c
foo.c: In function ‘foo’:
foo.c:2:2: warning: ‘return’ with no value, in function returning
non-void [-Wreturn-type]
I already wrote the patch but at lot of tests need to be updated to pass
with this change.
It is why, before starting updating all of them, I would like to know if
there is a consensus here.
This bug discuss about this:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55189 The idea seems to be
accepted.
Clang is considering that this kind of mistake as an error.
Sylvestre