[clang] [Clang] strengthen checks for 'main' function to meet [basic.start.main] p3 requirements (PR #101853)
Oleksandr T. via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 6 07:29:52 PDT 2024
================
@@ -990,6 +990,12 @@ def warn_main_redefined : Warning<"variable named 'main' with external linkage "
"has undefined behavior">, InGroup<Main>;
def ext_main_used : Extension<
"referring to 'main' within an expression is a Clang extension">, InGroup<Main>;
+def ext_main_invalid_linkage_specification : ExtWarn<
+ "'main' should not be "
+ "'extern \"%select{C|C++}0\"'">, InGroup<Main>;
+def err_main_invalid_linkage_specification : Error<
+ "'main' should not be "
+ "'extern \"%select{C|C++}0\"'">;
----------------
a-tarasyuk wrote:
@Sirraide Thanks for mentioning about the `.Summary`. I’ll keep it in mind for future fixes. I've added the requested changes.
https://github.com/llvm/llvm-project/pull/101853
More information about the cfe-commits
mailing list