def : DiagGroup<"attributes">;
def : DiagGroup<"bad-function-cast">;
def BoolConversions : DiagGroup<"bool-conversions">;
-def : DiagGroup<"c++-compat">;
+def CXXCompat: DiagGroup<"c++-compat">;
def : DiagGroup<"cast-align">;
def : DiagGroup<"cast-qual">;
def : DiagGroup<"char-align">;
"complex integer types are an extension">;
def ext_thread_before : Extension<"'__thread' before 'static'">;
-def ext_empty_struct_union_enum : Extension<"use of empty %0 extension">;
-
+def ext_empty_struct_union : Extension<"empty %select{struct|union}0 "
+ "(accepted as an extension) has size 0 in C, size 1 in C++">,
+ InGroup<CXXCompat>;
def error_empty_enum : Error<"use of empty enum">;
def err_invalid_sign_spec : Error<"'%0' cannot be signed or unsigned">;
def err_invalid_short_spec : Error<"'short %0' is invalid">;
// Empty structs are an extension in C (C99 6.7.2.1p7), but are allowed in
// C++.
if (Tok.is(tok::r_brace) && !getLang().CPlusPlus)
- Diag(Tok, diag::ext_empty_struct_union_enum)
- << DeclSpec::getSpecifierName((DeclSpec::TST)TagType);
+ Diag(Tok, diag::ext_empty_struct_union)
+ << (TagType == TST_union);
llvm::SmallVector<DeclPtrTy, 32> FieldDecls;
}
// PR2151
-void emptyInit() {struct {} x[] = {6};} //expected-warning{{empty struct extension}} expected-error{{initializer for aggregate with no elements}}
+void emptyInit() {struct {} x[] = {6};} //expected-warning{{empty struct (accepted as an extension) has size 0 in C, size 1 in C++}} \
+// expected-error{{initializer for aggregate with no elements}}
void noNamedInit() {
struct {int:5;} x[] = {6}; //expected-error{{initializer for aggregate with no elements}}
};
static void sppp_ipv6cp_up();
-const struct {} ipcp = { sppp_ipv6cp_up }; //expected-warning{{empty struct extension}} expected-warning{{excess elements in struct initializer}}
+const struct {} ipcp = { sppp_ipv6cp_up }; //expected-warning{{empty struct (accepted as an extension) has size 0 in C, size 1 in C++}} \
+// expected-warning{{excess elements in struct initializer}}
struct _Matrix { union { float m[4][4]; }; }; //expected-warning{{anonymous unions are a GNU extension in C}}
typedef struct _Matrix Matrix;
static int *p2 = (int []){2,x}; // -expected-error {{initializer element is not a compile-time constant}}
static long *p3 = (long []){2,"x"}; // -expected-warning {{incompatible pointer to integer conversion initializing 'long' with an expression of type 'char [2]'}}
-typedef struct { } cache_t; // -expected-warning{{use of empty struct extension}}
+typedef struct { } cache_t; // -expected-warning{{empty struct (accepted as an extension) has size 0 in C, size 1 in C++}}
static cache_t clo_I1_cache = ((cache_t) { } ); // -expected-warning{{use of GNU empty initializer extension}}
typedef struct Test {int a;int b;} Test;