On 14 November 2013 11:31, Dodji Seketeli wrote: > > For C, I am not sure about, but I'd find it useful to have that warning > enabled there too, so I guess I'd like to hear why the warning wasn't > enabled there by default there as well.
A return statement with no operand is always wrong, but -Wreturn-type also warns about this, which is valid: int f(int c) { if (c) return 0; function_that_never_returns(); } The noreturn attribute is not portable, and can't necessarily be added to library functions not controlled by the user. So maybe it makes sense to split -Wreturn-type to separately handle "return with no value in function returning non-void" and "control reaches end of non-void function".