[clang] [Clang] add ext warning for missing return in 'main' for C89 mode (PR #134617)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 7 05:54:02 PDT 2025
================
@@ -1031,6 +1031,8 @@ def err_mainlike_template_decl : Error<"%0 cannot be a template">;
def err_main_returns_nonint : Error<"'main' must return 'int'">;
def ext_main_returns_nonint : ExtWarn<"return type of 'main' is not 'int'">,
InGroup<MainReturnType>;
+def ext_main_no_return : Extension<"non-void 'main' function does not return a value">,
----------------
AaronBallman wrote:
This isn't really explaining much to the user, just describing what the code does. I think better wording might be: `implicit '0' return value from 'main' is a C99 extension`.
https://github.com/llvm/llvm-project/pull/134617
More information about the cfe-commits
mailing list