aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-decl.c
diff options
context:
space:
mode:
authorJoseph Myers <jsm28@cam.ac.uk>2000-12-01 19:21:44 +0000
committerJoseph Myers <jsm28@gcc.gnu.org>2000-12-01 19:21:44 +0000
commitc7b828331c353fcda3db1fd0ece39ebe4de41236 (patch)
tree1eb1ee47410f38b4ee9fffb0043fd1eff1e75bbc /gcc/c-decl.c
parent21ac293b0e8890b914ede144eb2701a88c5d19f3 (diff)
downloadgcc-c7b828331c353fcda3db1fd0ece39ebe4de41236.zip
gcc-c7b828331c353fcda3db1fd0ece39ebe4de41236.tar.gz
gcc-c7b828331c353fcda3db1fd0ece39ebe4de41236.tar.bz2
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
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r--gcc/c-decl.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 98aae30..1351639 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -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 (!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, complain about arrays of incomplete types. */
+
+ 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)