summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/array-init.c
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-07-29 14:29:34 +0000
committerDouglas Gregor <dgregor@apple.com>2010-07-29 14:29:34 +0000
commitda2955ed744e1f753546f0a1d4d6b51931e63084 (patch)
tree6fb7d786fa5426d97c32f483a2258eeed6426151 /clang/test/Sema/array-init.c
parent07035e6a00f85c699d595d48da1f1e44874ca9d1 (diff)
downloadbcm5719-llvm-da2955ed744e1f753546f0a1d4d6b51931e63084.tar.gz
bcm5719-llvm-da2955ed744e1f753546f0a1d4d6b51931e63084.zip
Reword the empty struct/union warning in C to note that such structs and unions have size 0 in C, size 1 in C++. Put this warning under -Wc++-compat.
llvm-svn: 109748
Diffstat (limited to 'clang/test/Sema/array-init.c')
-rw-r--r--clang/test/Sema/array-init.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/test/Sema/array-init.c b/clang/test/Sema/array-init.c
index f93b0878fd3..c042943516d 100644
--- a/clang/test/Sema/array-init.c
+++ b/clang/test/Sema/array-init.c
@@ -218,7 +218,8 @@ void varArray() {
}
// 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}}
@@ -241,7 +242,8 @@ struct soft_segment_descriptor gdt_segs[] = {
};
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;
OpenPOWER on IntegriCloud