From: Richard Smith Date: Thu, 20 Sep 2012 01:02:05 +0000 (+0000) Subject: PR13881: Add -Wzero-length-array for zero length array extension, and move it into... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=561e3c68864d11f39a07a6d1711ce08d2739a263;p=clang PR13881: Add -Wzero-length-array for zero length array extension, and move it into -Wgnu. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164272 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/DiagnosticGroups.td b/include/clang/Basic/DiagnosticGroups.td index bc87e1121b..cce2720889 100644 --- a/include/clang/Basic/DiagnosticGroups.td +++ b/include/clang/Basic/DiagnosticGroups.td @@ -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">; diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index b0261275e0..07a278e5fe 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -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; def err_typecheck_zero_array_size : Error< "zero-length arrays are not permitted in C++">; def warn_typecheck_zero_static_array_size : Warning< diff --git a/test/Misc/warning-flags.c b/test/Misc/warning-flags.c index a1a0d7ed76..fb5cd5cc27 100644 --- a/test/Misc/warning-flags.c +++ b/test/Misc/warning-flags.c @@ -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 diff --git a/test/Sema/array-init.c b/test/Sema/array-init.c index ad0fc708d7..b3cae60495 100644 --- a/test/Sema/array-init.c +++ b/test/Sema/array-init.c @@ -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)}}