]> granicus.if.org Git - clang/commitdiff
PR13881: Add -Wzero-length-array for zero length array extension, and move it into...
authorRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 20 Sep 2012 01:02:05 +0000 (01:02 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 20 Sep 2012 01:02:05 +0000 (01:02 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164272 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/DiagnosticGroups.td
include/clang/Basic/DiagnosticSemaKinds.td
test/Misc/warning-flags.c
test/Sema/array-init.c

index bc87e1121bbf3977a76c3e61b46c062522e96ba1..cce2720889118f9799ee459bef454d555530d1b5 100644 (file)
@@ -285,6 +285,7 @@ def VexingParse : DiagGroup<"vexing-parse">;
 def VLA : DiagGroup<"vla">;
 def VolatileRegisterVar : DiagGroup<"volatile-register-var">;
 def Visibility : DiagGroup<"visibility">;
+def ZeroLengthArray : DiagGroup<"zero-length-array">;
 
 // GCC calls -Wdeprecated-writable-strings -Wwrite-strings.
 def GCCWriteStrings : DiagGroup<"write-strings" , [DeprecatedWritableStr]>;
@@ -432,7 +433,7 @@ def C11 : DiagGroup<"c11-extensions">;
 def C99 : DiagGroup<"c99-extensions">;
 
 // A warning group for warnings about GCC extensions.
-def GNU : DiagGroup<"gnu", [GNUDesignator, VLA]>;
+def GNU : DiagGroup<"gnu", [GNUDesignator, VLA, ZeroLengthArray]>;
 // A warning group for warnings about code that clang accepts but gcc doesn't.
 def GccCompat : DiagGroup<"gcc-compat">;
 
index b0261275e06ed32d0e44b745d7bf2a9dd33f8a7d..07a278e5fe7ba5ebab7c0feb7c13146ff73d86b6 100644 (file)
@@ -3286,7 +3286,7 @@ def err_typecheck_invalid_restrict_not_pointer_noarg : Error<
 def err_typecheck_invalid_restrict_invalid_pointee : Error<
   "pointer to function type %0 may not be 'restrict' qualified">;
 def ext_typecheck_zero_array_size : Extension<
-  "zero size arrays are an extension">;
+  "zero size arrays are an extension">, InGroup<ZeroLengthArray>;
 def err_typecheck_zero_array_size : Error<
   "zero-length arrays are not permitted in C++">;
 def warn_typecheck_zero_static_array_size : Warning<
index a1a0d7ed76a11ef2eb76689410ec7dc7353e0132..fb5cd5cc27213617693fc5965a45da5644fbb8f5 100644 (file)
@@ -180,4 +180,4 @@ CHECK-NEXT:   warn_weak_import
 
 The list of warnings in -Wpedantic should NEVER grow.
 
-CHECK: Number in -Wpedantic (not covered by other -W flags): 38
+CHECK: Number in -Wpedantic (not covered by other -W flags): 37
index ad0fc708d75a033b12f449a24c271a48ee6be01a..b3cae60495c7d5762381c0dc73c3f74846fe0084 100644 (file)
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wgnu -Wc11-extensions -verify %s
 // REQUIRES: LP64
 
 extern int foof() = 1; // expected-error{{illegal initializer (only variables can be initialized)}}