From: jsm28 Date: Mon, 1 Nov 2004 19:49:55 +0000 (+0000) Subject: PR c/18239 X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=commitdiff_plain;h=702c8527e96702ee4e3d4a3b2d8a7b895a62eb3b PR c/18239 * c-decl.c (get_parm_info): Allow FUNCTION_DECLs to appear amongst parameter declarations. testsuite: * gcc.dg/parm-impl-decl-1.c, gcc.dg/parm-impl-decl-2.c: New tests. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@89956 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 84ca2043451..eacc39352c7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2004-11-01 Joseph S. Myers + + PR c/18239 + * c-decl.c (get_parm_info): Allow FUNCTION_DECLs to appear amongst + parameter declarations. + 2004-11-01 Andreas Krebbel * config/s390/s390.c (regclass_map): Put reg 33 (cc) to CC_REGS group. diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 839b5f3b2ab..ba4249ac37c 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -4855,10 +4855,13 @@ get_parm_info (bool ellipsis) case CONST_DECL: case TYPE_DECL: + case FUNCTION_DECL: /* CONST_DECLs appear here when we have an embedded enum, and TYPE_DECLs appear here when we have an embedded struct or union. No warnings for this - we already warned about the - type itself. */ + type itself. FUNCTION_DECLs appear when there is an implicit + function declaration in the parameter list. */ + TREE_CHAIN (decl) = others; others = decl; /* fall through */ @@ -4875,7 +4878,6 @@ get_parm_info (bool ellipsis) /* Other things that might be encountered. */ case LABEL_DECL: - case FUNCTION_DECL: case VAR_DECL: default: gcc_unreachable (); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3b08af5d047..b4746bcc691 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2004-11-01 Joseph S. Myers + + PR c/18239 + * gcc.dg/parm-impl-decl-1.c, gcc.dg/parm-impl-decl-2.c: New tests. + 2004-11-01 Nathan Sidwell PR c++/18064 diff --git a/gcc/testsuite/gcc.dg/parm-impl-decl-1.c b/gcc/testsuite/gcc.dg/parm-impl-decl-1.c new file mode 100644 index 00000000000..1e45d3b8849 --- /dev/null +++ b/gcc/testsuite/gcc.dg/parm-impl-decl-1.c @@ -0,0 +1,33 @@ +/* Test implicit function declarations and other odd declarations in + function prototypes. Bug 18239. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +/* Implicit function declaration in attribute in definition (testcase + from bug). */ +int +foo (int __attribute__ ((__mode__ (vector_size(8)))) i) /* { dg-warning "warning: '__mode__' attribute ignored" } */ +{ + return (long long) i; +} + +/* Various other cases. */ + +int f (int [sizeof(g())]); +int f1 (int [sizeof(g1())]); + +int g () { return 1; } + +int +h (int (*p)[sizeof(i())]) +{ + int g2 (), g3 (); + return (*p)[0] + g3() + g2(); +} + +int i () { return 2; } + +int f2 (int [sizeof(g2())]); +int f3 (int [sizeof(g3())]); +int g3 () { return 4; } diff --git a/gcc/testsuite/gcc.dg/parm-impl-decl-2.c b/gcc/testsuite/gcc.dg/parm-impl-decl-2.c new file mode 100644 index 00000000000..1f4630047b0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/parm-impl-decl-2.c @@ -0,0 +1,7 @@ +/* Test implicit function declarations and other odd declarations in + function prototypes. Make sure that LABEL_DECLs don't occur. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +int k (int [sizeof &&z]); /* { dg-error "error: label 'z' referenced outside of any function" } */