This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH]: Fix warnings about type declarations inside prototypes
- From: Richard Earnshaw <Richard dot Earnshaw at arm dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 29 Apr 2004 14:53:33 +0100
- Subject: [PATCH]: Fix warnings about type declarations inside prototypes
The following code snippet produces the following interesting
diagnostics :-)
void f(enum x {a, b, c} d);
void g(struct y {int a;} z);
en.c:1: warning: 'struct x' declared inside parameter list
en.c:1: warning: its scope is only this definition or declaration, which
is probably not what you want
en.c:2: warning: 'enum y' declared inside parameter list
Opps. Someone got the keywords messed up.
Fixed with:
2004-04-29 Richard Earnshaw <rearnsha@arm.com>
* c-decl.c (get_parm_info): Use the correct tag keywords when
warning about type declarations in prototypes.
Index: c-decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-decl.c,v
retrieving revision 1.495
diff -p -r1.495 c-decl.c
*** c-decl.c 12 Apr 2004 21:25:44 -0000 1.495
--- c-decl.c 29 Apr 2004 13:46:37 -0000
*************** get_parm_info (bool ellipsis)
*** 4798,4806 ****
}
break;
! case ENUMERAL_TYPE: keyword = "struct"; goto tag;
case UNION_TYPE: keyword = "union"; goto tag;
! case RECORD_TYPE: keyword = "enum"; goto tag;
tag:
/* Types may not have tag-names, in which case the type
appears in the bindings list with b->id NULL. */
--- 4798,4806 ----
}
break;
! case ENUMERAL_TYPE: keyword = "enum"; goto tag;
case UNION_TYPE: keyword = "union"; goto tag;
! case RECORD_TYPE: keyword = "struct"; goto tag;
tag:
/* Types may not have tag-names, in which case the type
appears in the bindings list with b->id NULL. */