forked from OSchip/llvm-project
Control warnings about GNU extensions with -Wgnu, which has a subgroup
for GNU designated-initializer syntax (-Wgnu-designator). llvm-svn: 99421
This commit is contained in:
parent
4d87012eb3
commit
b8ddb138a9
|
@ -31,6 +31,7 @@ def : DiagGroup<"char-align">;
|
|||
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 @@ def : DiagGroup<"comments", [Comment]>; // -Wcomments = -Wcomment
|
|||
// 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]>;
|
||||
|
|
|
@ -50,22 +50,26 @@ def ext_enumerator_list_comma : Extension<
|
|||
"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">;
|
||||
|
|
|
@ -68,7 +68,7 @@ def err_designator_into_flexible_array_member : Error<
|
|||
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_declared_as_function : Error<"field %0 declared as a function">;
|
|||
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 warn_typecheck_cond_pointer_integer_mismatch : ExtWarn<
|
|||
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 @@ def err_in_class_initializer_non_constant : Error<
|
|||
|
||||
// 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<
|
||||
|
|
|
@ -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 };
|
Loading…
Reference in New Issue