[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
Tue Apr 8 09:30:28 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<"implicit '0' return value from 'main' is a C99 extension">,
+    InGroup<MainReturnType>;
----------------
AaronBallman wrote:

```suggestion
def ext_main_no_return : Extension<
  "implicit '0' return value from 'main' is a C99 extension">, 
  InGroup<MainReturnType>;
```

https://github.com/llvm/llvm-project/pull/134617


More information about the cfe-commits mailing list