summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/20011021-1.c
diff options
context:
space:
mode:
authorzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2001-10-24 20:10:53 +0000
committerzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2001-10-24 20:10:53 +0000
commit521369900202afd3918f5859d3da0e351b1e2a06 (patch)
treec0538b67d74f1cd1505eb648f2f17be9f0ccc09c /gcc/testsuite/gcc.dg/20011021-1.c
parent10159af365137961781f9986bf6e66146277e5f7 (diff)
downloadgcc-521369900202afd3918f5859d3da0e351b1e2a06.tar.gz
* c-common.h (struct c_common_identifier): Remove rid_code field.
(C_RID_CODE): Use ->node.rid_code instead of ->rid_code. * c-typeck.c (constructor_designated): New local flag. (struct constructor_stack): Add "designated" field to match. (start_init): Clear it. (really_start_incremental_init, push_init_level): Push and clear it. (pop_init_level): Pop it. (set_designator): Set it. (pop_init_level): Suppress "missing initializer" warnings if constructor_designated is true. (process_init_element): Suppress warning about union initialization under traditional C, if constructor_designated is true. * intl/loadmsgcat.c (INTTYPE_SIGNED, INTTYPE_MINIMUM, INTTYPE_MAXIMUM): Clone from system.h. (_nl_load_domain): Use them when testing for overflow of size_t. Cast result of sizeof to off_t to compare to st_size value. Move side effects out of conditional for comprehensibility. * testsuite/gcc.dg/20011021-1.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@46472 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/20011021-1.c')
-rw-r--r--gcc/testsuite/gcc.dg/20011021-1.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/20011021-1.c b/gcc/testsuite/gcc.dg/20011021-1.c
new file mode 100644
index 00000000000..821db47c2ed
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/20011021-1.c
@@ -0,0 +1,43 @@
+/* Test for various initializer warnings being suppressed by use of
+ designated initializers. */
+
+/* { dg-do compile } */
+/* { dg-options "-std=c99 -W -Wall -Wtraditional" } */
+
+
+struct t
+{
+ int a;
+ int b;
+ int c;
+};
+
+union u
+{
+ int n;
+ float i;
+};
+
+struct multilevel
+{
+ int x;
+ struct t t;
+ union u u;
+ union u v;
+ char *f;
+};
+
+struct t T0 = { 1 }; /* { dg-warning "(missing|near) init" } */
+struct t T1 = { .a = 1 }; /* { dg-bogus "(missing|near) init" } */
+
+union u U0 = { 1 }; /* { dg-warning "initialization of union" } */
+union u U1 = { .i = 1 }; /* { dg-bogus "initialization of union" } */
+
+struct multilevel M =
+{
+ 12,
+ { .b = 3 }, /* { dg-bogus "(missing|near) init" } */
+ { 4 }, /* { dg-warning "initialization of union" } */
+ { .n = 9 }, /* { dg-bogus "initialization of union" } */
+ /* "string here" */
+}; /* { dg-warning "(missing|near) init" } */