c-decl.c (grokdeclarator): If pedantic, warn about arrays with incomplete element type.

* c-decl.c (grokdeclarator): If pedantic, warn about arrays with
	incomplete element type.
	(grokparms): Before checking for incomplete parameter type, check
	the type isn't error_mark_node.

testsuite:
	* gcc.dg/c99-array-nonobj-1.c: No longer XFAIL.

From-SVN: r37920
This commit is contained in:
Joseph Myers 2000-12-01 19:21:44 +00:00 committed by Joseph Myers
parent 21ac293b0e
commit c7b828331c
4 changed files with 20 additions and 15 deletions

View File

@ -1,3 +1,10 @@
2000-12-01 Joseph S. Myers <jsm28@cam.ac.uk>
* c-decl.c (grokdeclarator): If pedantic, warn about arrays with
incomplete element type.
(grokparms): Before checking for incomplete parameter type, check
the type isn't error_mark_node.
2000-12-01 Jakub Jelinek <jakub@redhat.com>
* builtins.c (target_char_cast): New function.

View File

@ -4526,18 +4526,10 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
itype = build_range_type (sizetype, size_zero_node, NULL_TREE);
}
#if 0
/* This had bad results for pointers to arrays, as in
union incomplete (*foo)[4]; */
/* Complain about arrays of incomplete types, except in typedefs. */
/* If pedantic, complain about arrays of incomplete types. */
if (!COMPLETE_TYPE_P (type)
/* Avoid multiple warnings for nested array types. */
&& TREE_CODE (type) != ARRAY_TYPE
&& !(specbits & (1 << (int) RID_TYPEDEF))
&& !C_TYPE_BEING_DEFINED (type))
warning ("array type has incomplete element type");
#endif
if (pedantic && !COMPLETE_TYPE_P (type))
pedwarn ("array type has incomplete element type");
#if 0
/* We shouldn't have a function type here at all!
@ -5055,6 +5047,8 @@ grokparms (parms_info, funcdef_flag)
{
/* Barf if the parameter itself has an incomplete type. */
tree type = TREE_VALUE (typelt);
if (type == error_mark_node)
continue;
if (!COMPLETE_TYPE_P (type))
{
if (funcdef_flag && DECL_NAME (parm) != 0)

View File

@ -1,3 +1,7 @@
2000-12-01 Joseph S. Myers <jsm28@cam.ac.uk>
* gcc.dg/c99-array-nonobj-1.c: No longer XFAIL.
2000-12-01 Jakub Jelinek <jakub@redhat.com>
* gcc.c-torture/execute/string-opt-5.c: Add some memset tests.

View File

@ -9,16 +9,16 @@ typedef void func (void);
struct s;
extern int a[][]; /* { dg-bogus "warning" "warning in place of error" } */
/* { dg-error "array" "\[\]\[\] var" { xfail *-*-* } 11 } */
/* { dg-error "array" "\[\]\[\] var" { target *-*-* } 11 } */
void f (int [][]); /* { dg-bogus "warning" "warning in place of error" } */
/* { dg-error "array" "\[\]\[\] arg" { xfail *-*-* } 14 } */
/* { dg-error "array" "\[\]\[\] arg" { target *-*-* } 14 } */
extern struct s b[]; /* { dg-bogus "warning" "warning in place of error" } */
/* { dg-error "array" "struct \[\] var" { xfail *-*-* } 17 } */
/* { dg-error "array" "struct \[\] var" { target *-*-* } 17 } */
void g (struct s []); /* { dg-bogus "warning" "warning in place of error" } */
/* { dg-error "array" "struct \[\] arg" { xfail *-*-* } 20 } */
/* { dg-error "array" "struct \[\] arg" { target *-*-* } 20 } */
extern func c[]; /* { dg-bogus "warning" "warning in place of error" } */
/* { dg-error "array" "func \[\] var" { target *-*-* } 23 } */