-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Missing '-Wreturn-type' warning for 'main' having no return statement in C89 mode #21650
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@llvm/issue-subscribers-c Author: Masaki Moriguchi (a.k.a. Michel Morin) (morinmorin)
| | |
| --- | --- |
| Bugzilla Link | [21276](https://llvm.org/bz21276) |
| Version | unspecified |
| OS | All |
Extended DescriptionClang does not emit "control reaches end of non-void function [-Wreturn-type]" warning for 'main' having no return statement in C89 mode (-std=c89, gnu89). Clang adds implicit-return-zero in C89 mode. But, since the C89 standard does not require it, wouldn't it be better to emit warning? |
Agreed, this should be given a diagnostic under |
Hi! This issue may be a good introductory issue for people new to working on LLVM. If you would like to work on this issue, your first steps are:
If you have any further questions about this issue, don't hesitate to ask via a comment in the thread below. |
@llvm/issue-subscribers-good-first-issue Author: Masaki Moriguchi (a.k.a. Michel Morin) (morinmorin)
| | |
| --- | --- |
| Bugzilla Link | [21276](https://llvm.org/bz21276) |
| Version | unspecified |
| OS | All |
Extended DescriptionClang does not emit "control reaches end of non-void function [-Wreturn-type]" warning for 'main' having no return statement in C89 mode (-std=c89, gnu89). Clang adds implicit-return-zero in C89 mode. But, since the C89 standard does not require it, wouldn't it be better to emit warning? |
…vm#134617) Fixes llvm#21650 --- Clang currently inserts an implicit `return 0;` in `main()` when compiling in `C89` mode, even though the `C89` standard doesn't require this behavior. This patch changes that behavior by emitting a warning instead of silently inserting the implicit return under `-pedantic`.
Extended Description
Clang does not emit "control reaches end of non-void function [-Wreturn-type]" warning for 'main' having no return statement in C89 mode (-std=c89, gnu89).
Clang adds implicit-return-zero in C89 mode. But, since the C89 standard does not require it, wouldn't it be better to emit warning?
The text was updated successfully, but these errors were encountered: