This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patch: fix regression in 4.0

At Mon, 13 Dec 2004 13:13:39 -0800,
Dale Johannesen wrote:
> As discussed on gcc list, this accepts
>     int use() { int foo(); }   /* implicit int */
>    void foo() {}
> or
>    extern void foo();
> with a warning instead of an error, as earlier versions did.
> Testing in progress, OK if it passes?
> Please refer to test case.  The first patch line causes case 8 to
> get a type mismatch error, not a warning (of course it got another
> error later).  The rest causes cases 9 and 10 to be accepted as in
> earlier compilers.

Your diff is incorrectly generated and your mailer mangled it.  Please
regenerate it using cvs diff -[cu]p (either -c or -u is acceptable)
and resend as an attachment so it doesn't get mangled.  (You appear to
be using - give the file a .txt extension so the attachment
is assigned the proper MIME type.)

> Case 5 still  behaves differently; it is a warning not an error as in 
> earlier
> compilers.  This is due to Zack's code
>        /* Permit void foo (...) to match int foo (...) if the latter is
>           the definition and implicit int was used.  See
>           c-torture/compile/920625-2.c.  */
> However, the example in 920625-2.c is not quite the same, it is
>     int use() { extern void foo(); }
>     foo() {}
> I would not expect that example to get into this code at all, since
> the declarations are not visible in the same scope.  But accepting
> that mismatch here means accepting case 5 as well.

We compare the two decls of foo() in 920625-2.c despite their not
being visible in the same scope.  There is a mostly-accurate comment
explaining why, in c-decl.c, above the definition of struct c_scope.

Case 5 appears to be

> extern void foo5(); /* { dg-warning "previous declaration" } */
> foo5() {} /* { dg-warning "conflicting types" } */

and I think it's okay for that to be just a warning.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]