What should -Wmissing-noreturn do with "int main(){exit(0);}" ?
Kaveh R. Ghazi
ghazi@caip.rutgers.edu
Thu Aug 12 12:02:00 GMT 1999
The flag -Wmissing-noreturn produces a warning when given code
like this:
> int main() { exit(0); }
foo.c: In function `main':
foo.c:1: warning: function might be possible candidate for attribute `noreturn'
The diagnostic is technically correct, but perhaps it should do
something different here. I see two alternatives.
1. Ignore function `main' for the purpose of the noreturn warning.
2. When function main is noreturn, change the warning to suggest
changing `exit(0)' to `return 0' in function `main'.
I lean towards doing #1.
Comments?
--Kaveh
--
Kaveh R. Ghazi Engagement Manager / Project Services
ghazi@caip.rutgers.edu Qwest Internet Solutions
More information about the Gcc
mailing list