================
@@ -169,6 +169,12 @@ def ext_c2y_generic_with_type_arg : Extension<
 def warn_c2y_compat_generic_with_type_arg : Warning<
   "passing a type argument as the first operand to '_Generic' is incompatible "
   "with C standards before C2y">, InGroup<CPre2yCompat>, DefaultIgnore;
+def warn_c2y_compat_init_statement : Warning<
+  "%select{if|switch}0 initialization statements are incompatible with "
+  "C standards before C2y">, DefaultIgnore, InGroup<CPre2yCompat>;
+def ext_c2y_init_statement : ExtWarn<
----------------
AaronBallman wrote:

We're consistently inconsistent but I think the general rule of thumb boils 
down to the chance of the user *accidentally* using the extension. e.g., it's 
pretty easy to accidentally produce a VLA so we warn about it by default in C++ 
(but not GNU) mode: https://godbolt.org/z/1d7Eve146 but it's pretty hard to 
accidentally use a _Generic selection expression and so we don't diagnose by 
default: https://godbolt.org/z/v81f7438v

I think it's pretty hard to accidentally use an if declaration, particularly 
because it won't show up in shared header files all that often, that's why I 
was thinking we wouldn't want to warn by default. WDYT?

https://github.com/llvm/llvm-project/pull/198244
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to