[Bug c/53232] No warning for main() without a return statement with -std=c99

vincent-gcc at vinc17 dot net gcc-bugzilla@gcc.gnu.org
Fri Jan 20 15:10:47 GMT 2023


--- Comment #18 from Vincent Lefèvre <vincent-gcc at vinc17 dot net> ---
(In reply to Jakub Jelinek from comment #17)
> Yeah, but warnings with high false positivity rates at least shouldn't be in
> -Wall.

Well, there already is -Wunused, which is included in -Wall (such warnings may
typically be emitted due to #if and also in temporary code when debugging), and
-Wsign-compare in C++.

Anyway, there is a first issue: the warning is inexistent, even with -Wextra.
There is a second issue: the warning is not emitted with -Wreturn-type when
there is a call to main(). Solving these two issues alone would not yield a
high false positivity rate with -Wall. (That said, I think that developers
should be encouraged to have an explicit "return" for main(); in particular,
this is really easy to do and improves the code readability, specially knowing
the difference of behavior with other languages, such as shell scripts and

More information about the Gcc-bugs mailing list