https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55976
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |diagnostic --- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> --- I thought this should be as simple as adding OPT_Wreturn_type to the relevant warnings in c_finish_return in gcc/c/typeck-c.c But it seems to be more complicated. In C89 mode the "does not" case is actually controlled by -pedantic (and -pedantic-errors) and the "does" case is controlled by -Wreturn-type. In C99 and later modes both diagnostics are controlled by -pedantic. So with current GCC and the default -std=gnu11 you do get two diagnostics: ret.c: In function ‘t’: ret.c:1:20: warning: ‘return’ with a value, in function returning void void t () { return 1; } /* does not error */ ^ ret.c:1:6: note: declared here void t () { return 1; } /* does not error */ ^ ret.c: In function ‘b’: ret.c:2:12: warning: ‘return’ with no value, in function returning non-void int b () { return; } /* does */ ^~~~~~ ret.c:2:5: note: declared here int b () { return; } /* does */ ^ -Werror=return-type doesn't affect either of them, but -pedantic-errors does.