/* red.c */
void foo(void)
{
    extern int x;
    /* use x */
    x = 1;
}

void bar(void)
{
    extern int x;
    /* use x */
    x = 2;
}

gcc -Wredundant-decls -c red.c
red.c: In function 'bar':
red.c:10: warning: redundant redeclaration of 'x'
red.c:3: warning: previous declaration of 'x' was here

The two "extern int x;" declarations are *not* redundant, and removing either
will cause this code to fail to compile.

Also happens with GCC 4.1.2.


-- 
           Summary: -Wredundant-decls does not take scope into account
           Product: gcc
           Version: 4.0.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: paulf at free dot fr


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38050

Reply via email to