[clang] [clang] support Wold-style-declaration (PR #78837)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 20 12:01:00 PST 2024


================
@@ -88,6 +88,8 @@ def err_param_redefinition : Error<"redefinition of parameter %0">;
 def warn_method_param_redefinition : Warning<"redefinition of method parameter %0">;
 def warn_method_param_declaration : Warning<"redeclaration of method parameter %0">,
   InGroup<DuplicateArgDecl>, DefaultIgnore;
+def warn_old_style_declaration: Warning <"'%0' is not at beginning of declaration">,
+  InGroup<OldStyleDeclaration>, DefaultIgnore;
----------------
AaronBallman wrote:

We don't typically add new diagnostics that are off by default (though this one is in `-Wextra` so it has a chance of being enabled by users). I actually wonder if we want to enable this by default; the standard makes this an obsolescent feature (see C23 6.11.5p1) and so having an on-by-default warning actually helps alert users to potential future code breakage.

My intuition is that this would not be an overly chatty diagnostic to enable by default; do you have access to a large corpus of C code you could try to compile with your patch?

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


More information about the cfe-commits mailing list