summaryrefslogtreecommitdiffstats
path: root/gcc/c-typeck.c
diff options
context:
space:
mode:
authorsteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>2005-02-01 00:09:40 +0000
committersteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>2005-02-01 00:09:40 +0000
commitb765c734625d155bc58a4bf8fe51a14f5f9e139e (patch)
tree5108a646eac36fa7b89c3f975f94db1d1aa39c65 /gcc/c-typeck.c
parent557522b91354795ce9b464c91bd554f3b0e70af5 (diff)
downloadppe42-gcc-b765c734625d155bc58a4bf8fe51a14f5f9e139e.tar.gz
ppe42-gcc-b765c734625d155bc58a4bf8fe51a14f5f9e139e.zip
gcc/
PR c/19333 * c-decl.c (start_decl): Do not warn about arrays of elements with an incomplete type here. (grokdeclarator): Do it here by making a pedwarn an error. * c-typeck.c (push_init_level): If there were previous errors with the constructor type, do not warn about braces for initializers. (process_init_element): Likewise for excess initializer elements. testsuite/ PR c/19333 * testsuite/gcc.c-torture/compile/20011130-1.c: Reorder to make the test case valid. * testsuite/gcc.dg/20030815-1.c: Remove invalid tests. * testsuite/gcc.dg/array-7.c: Adjust expected result. * testsuite/gcc.dg/pr18596-3.c: Likewise. * testsuite/gcc.dg/noncompile/20000901-1.c: Likewise. * testsuite/gcc.dg/noncompile/init-2.c: Likewise. * testsuite/gcc.dg/noncompile/init-4.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@94505 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-typeck.c')
-rw-r--r--gcc/c-typeck.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index fed17f24845..54f9714f514 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -4878,7 +4878,8 @@ push_init_level (int implicit)
}
else
{
- warning_init ("braces around scalar initializer");
+ if (constructor_type != error_mark_node)
+ warning_init ("braces around scalar initializer");
constructor_fields = constructor_type;
constructor_unfilled_fields = constructor_type;
}
@@ -6240,7 +6241,8 @@ process_init_element (struct c_expr value)
/* Handle the sole element allowed in a braced initializer
for a scalar variable. */
- else if (constructor_fields == 0)
+ else if (constructor_type != error_mark_node
+ && constructor_fields == 0)
{
pedwarn_init ("excess elements in scalar initializer");
break;
OpenPOWER on IntegriCloud