This is the mail archive of the gcc-bugs@gcc.gnu.org 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]

[Bug c/38047] New: -Wredundant-decls does not take scope into account


/* 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=38047


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