diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-02-18 22:23:55 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-02-18 22:23:55 +0000 |
commit | 1cba5fe1d153da2d2a7bb6c81867d0dbe1b854a3 (patch) | |
tree | 397ca622aa48dae6dd4203a32561544c8c605130 /clang/test/Sema/array-init.c | |
parent | e60ec0abca6c88802d08d58ca88284b0fda9a5f7 (diff) | |
download | bcm5719-llvm-1cba5fe1d153da2d2a7bb6c81867d0dbe1b854a3.tar.gz bcm5719-llvm-1cba5fe1d153da2d2a7bb6c81867d0dbe1b854a3.zip |
Downgrade the "excess elements in initializer" errors to warnings *in
C*. They're required errors in C++.
llvm-svn: 64964
Diffstat (limited to 'clang/test/Sema/array-init.c')
-rw-r--r-- | clang/test/Sema/array-init.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/clang/test/Sema/array-init.c b/clang/test/Sema/array-init.c index 2c835bd54f2..4ee86181afe 100644 --- a/clang/test/Sema/array-init.c +++ b/clang/test/Sema/array-init.c @@ -20,7 +20,7 @@ void func() { int x3[x] = { 1, 2 }; // expected-error{{variable-sized object may not be initialized}} - int x4 = { 1, 2 }; // expected-warning{{braces around scalar initializer}} expected-error{{excess elements in scalar initializer}} + int x4 = { 1, 2 }; // expected-warning{{braces around scalar initializer}} expected-warning{{excess elements in scalar initializer}} int y[4][3] = { { 1, 3, 5 }, @@ -37,7 +37,7 @@ void func() { { 2, 4, 6 }, { 3, 5, 7 }, { 4, 6, 8 }, - { 5 }, // expected-error{{excess elements in array initializer}} + { 5 }, // expected-warning{{excess elements in array initializer}} }; struct threeElements { @@ -53,17 +53,17 @@ void func() { void test() { int y1[3] = { - { 1, 2, 3 } // expected-warning{{braces around scalar initializer}} expected-error{{excess elements in scalar initializer}} + { 1, 2, 3 } // expected-warning{{braces around scalar initializer}} expected-warning{{excess elements in scalar initializer}} }; int y3[4][3] = { { 1, 3, 5 }, { 2, 4, 6 }, { 3, 5, 7 }, { 4, 6, 8 }, - { }, // expected-warning{{use of GNU empty initializer extension}} expected-error{{excess elements in array initializer}} + { }, // expected-warning{{use of GNU empty initializer extension}} expected-warning{{excess elements in array initializer}} }; int y4[4][3] = { - { 1, 3, 5, 2 }, // expected-error{{excess elements in array initializer}} + { 1, 3, 5, 2 }, // expected-warning{{excess elements in array initializer}} { 4, 6 }, { 3, 5, 7 }, { 4, 6, 8 }, @@ -149,7 +149,7 @@ void charArrays() static char const test[] = "test"; int test_sizecheck[(sizeof(test) / sizeof(char)) == 5? 1 : -1]; static char const test2[] = { "weird stuff" }; - static char const test3[] = { "test", "excess stuff" }; // expected-error{{excess elements in char array initializer}} + static char const test3[] = { "test", "excess stuff" }; // expected-warning{{excess elements in char array initializer}} char* cp[] = { "Hello" }; @@ -157,7 +157,7 @@ void charArrays() int l[sizeof(c) == 6 ? 1 : -1]; int i[] = { "Hello "}; // expected-warning{{incompatible pointer to integer conversion initializing 'char [7]', expected 'int'}} - char c2[] = { "Hello", "Good bye" }; //expected-error{{excess elements in char array initializer}} + char c2[] = { "Hello", "Good bye" }; //expected-warning{{excess elements in char array initializer}} int i2[1] = { "Hello" }; //expected-warning{{incompatible pointer to integer conversion initializing 'char [6]', expected 'int'}} char c3[5] = { "Hello" }; @@ -178,7 +178,7 @@ float r2[] = {{8}}; //expected-warning{{braces around scalar initializer}} char r3[][5] = {1,2,3,4,5,6}; int r3_sizecheck[(sizeof(r3) / sizeof(char[5])) == 2? 1 : -1]; char r3_2[sizeof r3 == 10 ? 1 : -1]; -float r4[1][2] = {1,{2},3,4}; //expected-warning{{braces around scalar initializer}} expected-error{{excess elements in array initializer}} +float r4[1][2] = {1,{2},3,4}; //expected-warning{{braces around scalar initializer}} expected-warning{{excess elements in array initializer}} char r5[][5] = {"aa", "bbb", "ccccc"}; char r6[sizeof r5 == 15 ? 1 : -1]; const char r7[] = "zxcv"; @@ -207,7 +207,7 @@ union {char a; int b;} t7[] = {1, 2, 3}; int t8[sizeof t7 == (3*sizeof(int)) ? 1 : -1]; struct bittest{int : 31, a, :21, :12, b;}; -struct bittest bittestvar = {1, 2, 3, 4}; //expected-error{{excess elements in struct initializer}} +struct bittest bittestvar = {1, 2, 3, 4}; //expected-warning{{excess elements in struct initializer}} // Not completely sure what should happen here... int u1 = {}; //expected-warning{{use of GNU empty initializer extension}} expected-error{{scalar initializer cannot be empty}} @@ -242,7 +242,7 @@ struct soft_segment_descriptor gdt_segs[] = { }; static void sppp_ipv6cp_up(); -const struct {} ipcp = { sppp_ipv6cp_up }; //expected-warning{{empty struct extension}} expected-error{{excess elements in struct initializer}} +const struct {} ipcp = { sppp_ipv6cp_up }; //expected-warning{{empty struct extension}} 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; |