[cfe-commits] r99421 - in /cfe/trunk: include/clang/Basic/DiagnosticGroups.td include/clang/Basic/DiagnosticParseKinds.td include/clang/Basic/DiagnosticSemaKinds.td test/Sema/warn-gnu-designators.c
Douglas Gregor
dgregor at apple.com
Wed Mar 24 13:42:51 PDT 2010
Author: dgregor
Date: Wed Mar 24 15:42:51 2010
New Revision: 99421
URL: http://llvm.org/viewvc/llvm-project?rev=99421&view=rev
Log:
Control warnings about GNU extensions with -Wgnu, which has a subgroup
for GNU designated-initializer syntax (-Wgnu-designator).
Added:
cfe/trunk/test/Sema/warn-gnu-designators.c
Modified:
cfe/trunk/include/clang/Basic/DiagnosticGroups.td
cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticGroups.td?rev=99421&r1=99420&r2=99421&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticGroups.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td Wed Mar 24 15:42:51 2010
@@ -31,6 +31,7 @@
def Comment : DiagGroup<"comment">;
def : DiagGroup<"ctor-dtor-privacy">;
def : DiagGroup<"declaration-after-statement">;
+def GNUDesignator : DiagGroup<"gnu-designator">;
def Deprecated : DiagGroup<"deprecated">;
def : DiagGroup<"disabled-optimization">;
def : DiagGroup<"discard-qual">;
@@ -185,3 +186,6 @@
// but which aren't on by default in GCC.
def NonGCC : DiagGroup<"non-gcc",
[SignCompare, Conversion, LiteralRange]>;
+
+// A warning group for warnings about GCC extensions.
+def GNU : DiagGroup<"gnu", [GNUDesignator]>;
Modified: cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td?rev=99421&r1=99420&r2=99421&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td Wed Mar 24 15:42:51 2010
@@ -50,22 +50,26 @@
"feature">;
def ext_gnu_indirect_goto : Extension<
- "use of GNU indirect-goto extension">;
+ "use of GNU indirect-goto extension">, InGroup<GNU>;
def ext_gnu_address_of_label : Extension<
- "use of GNU address-of-label extension">;
+ "use of GNU address-of-label extension">, InGroup<GNU>;
def ext_gnu_statement_expr : Extension<
- "use of GNU statement expression extension">;
+ "use of GNU statement expression extension">, InGroup<GNU>;
def ext_gnu_conditional_expr : Extension<
- "use of GNU ?: expression extension, eliding middle term">;
+ "use of GNU ?: expression extension, eliding middle term">, InGroup<GNU>;
def ext_gnu_empty_initializer : Extension<
- "use of GNU empty initializer extension">;
-def ext_gnu_array_range : Extension<"use of GNU array range extension">;
+ "use of GNU empty initializer extension">, InGroup<GNU>;
+def ext_gnu_array_range : Extension<"use of GNU array range extension">,
+ InGroup<GNUDesignator>;
def ext_gnu_missing_equal_designator : ExtWarn<
- "use of GNU 'missing =' extension in designator">;
+ "use of GNU 'missing =' extension in designator">,
+ InGroup<GNUDesignator>;
def err_expected_equal_designator : Error<"expected '=' or another designator">;
def ext_gnu_old_style_field_designator : ExtWarn<
- "use of GNU old-style field designator extension">;
-def ext_gnu_case_range : Extension<"use of GNU case range extension">;
+ "use of GNU old-style field designator extension">,
+ InGroup<GNUDesignator>;
+def ext_gnu_case_range : Extension<"use of GNU case range extension">,
+ InGroup<GNU>;
// Generic errors.
def err_parse_error : Error<"parse error">;
Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=99421&r1=99420&r2=99421&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Wed Mar 24 15:42:51 2010
@@ -68,7 +68,7 @@
def note_flexible_array_member : Note<
"initialized flexible array member %0 is here">;
def ext_flexible_array_init : Extension<
- "flexible array initialization is a GNU extension">;
+ "flexible array initialization is a GNU extension">, InGroup<GNU>;
// Declarations.
def ext_vla : Extension<
@@ -1672,7 +1672,7 @@
def err_field_incomplete : Error<"field has incomplete type %0">;
def ext_variable_sized_type_in_struct : ExtWarn<
"field %0 with variable sized type %1 not at the end of a struct or class is"
- " a GNU extension">;
+ " a GNU extension">, InGroup<GNU>;
def err_flexible_array_empty_struct : Error<
"flexible array %0 not allowed in otherwise empty struct">;
@@ -2330,7 +2330,8 @@
def err_typecheck_choose_expr_requires_constant : Error<
"'__builtin_choose_expr' requires a constant expression">;
def ext_typecheck_expression_not_constant_but_accepted : Extension<
- "expression is not a constant, but is accepted as one by GNU extensions">;
+ "expression is not a constant, but is accepted as one by GNU extensions">,
+ InGroup<GNU>;
def warn_unused_expr : Warning<"expression result unused">,
InGroup<UnusedValue>;
def warn_unused_property_expr : Warning<
@@ -2422,9 +2423,9 @@
// C++ anonymous unions and GNU anonymous structs/unions
def ext_anonymous_union : Extension<
- "anonymous unions are a GNU extension in C">;
+ "anonymous unions are a GNU extension in C">, InGroup<GNU>;
def ext_anonymous_struct : Extension<
- "anonymous structs are a GNU extension">;
+ "anonymous structs are a GNU extension">, InGroup<GNU>;
def err_anonymous_union_not_static : Error<
"anonymous unions at namespace or global scope must be declared 'static'">;
def err_anonymous_union_with_storage_spec : Error<
Added: cfe/trunk/test/Sema/warn-gnu-designators.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/warn-gnu-designators.c?rev=99421&view=auto
==============================================================================
--- cfe/trunk/test/Sema/warn-gnu-designators.c (added)
+++ cfe/trunk/test/Sema/warn-gnu-designators.c Wed Mar 24 15:42:51 2010
@@ -0,0 +1,2 @@
+// RUN: %clang_cc1 -Wno-gnu-designator -verify %s
+struct { int x, y, z[12] } value = { x:17, .z [3 ... 5] = 7 };
More information about the cfe-commits
mailing list