diff options
author | Joseph Myers <jsm@polyomino.org.uk> | 2004-10-10 20:20:35 +0100 |
---|---|---|
committer | Joseph Myers <jsm28@gcc.gnu.org> | 2004-10-10 20:20:35 +0100 |
commit | bba5733fee39b6ce6e73e8637fd2cde9c16ea399 (patch) | |
tree | d764821ea6513c2ad0e0c105e575f0906f409bf6 /gcc/c-decl.c | |
parent | a780ad2f430e6aeb6e2c7b9dca9093ba5e2ff6e9 (diff) | |
download | gcc-bba5733fee39b6ce6e73e8637fd2cde9c16ea399.zip gcc-bba5733fee39b6ce6e73e8637fd2cde9c16ea399.tar.gz gcc-bba5733fee39b6ce6e73e8637fd2cde9c16ea399.tar.bz2 |
re PR c/17881 (Incomplete type warning is issued even for prototypes)
PR c/17881
* c-decl.c (grokparms): Don't warn for parameters of incomplete
type in declarations that are not definitions except for the case
of parameters of void type.
testsuite:
* parm-incomplete-1.c: New test.
From-SVN: r88850
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r-- | gcc/c-decl.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c index f2f9a27..4d6d24b 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -4648,10 +4648,14 @@ grokparms (struct c_arg_info *arg_info, bool funcdef_flag) tree parm, type, typelt; unsigned int parmno; - /* If the arg types are incomplete in a declaration, they must - include undefined tags. These tags can never be defined in - the scope of the declaration, so the types can never be - completed, and no call can be compiled successfully. */ + /* If there is a parameter of incomplete type in a definition, + this is an error. In a declaration this is valid, and a + struct or union type may be completed later, before any calls + or definition of the function. In the case where the tag was + first declared within the parameter list, a warning has + already been given. If a parameter has void type, then + however the function cannot be defined or called, so + warn. */ for (parm = arg_info->parms, typelt = arg_types, parmno = 1; parm; @@ -4675,13 +4679,13 @@ grokparms (struct c_arg_info *arg_info, bool funcdef_flag) TREE_VALUE (typelt) = error_mark_node; TREE_TYPE (parm) = error_mark_node; } - else + else if (VOID_TYPE_P (type)) { if (DECL_NAME (parm)) - warning ("%Jparameter %u (%qD) has incomplete type", + warning ("%Jparameter %u (%qD) has void type", parm, parmno, parm); else - warning ("%Jparameter %u has incomplete type", + warning ("%Jparameter %u has void type", parm, parmno); } } |