This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Enable -Wreturn-type by default ?


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]