The attached testcase just produces warning or errors (depending on gcc
version) for func1, func3 and func5:

testwarning.c:5: error: static declaration of ‘func1’ follows non-static
declaration
testwarning.c:3: error: previous declaration of ‘func1’ was here
testwarning.c:25: error: static declaration of ‘func3’ follows non-static
declaration
testwarning.c:23: error: previous declaration of ‘func3’ was here
testwarning.c:46: error: static declaration of ‘func5’ follows non-static
declaration
testwarning.c:43: error: previous declaration of ‘func5’ was here

I'm not sure about any C standard implications here, but now that 'static
follows non-static' is an error in newer gcc, I believe the other way round
deserves at least a warning to. Noticed this while compiling source code with
HP's A.10.32.03 compiler, which warns about all 6 functions on the testcase
like this:
cc: "testwarning.c", line 53: warning 562: Redeclaration of "func6" with a
different storage class specifier: "func6" will have internal linkage.

Hope this helps,
Franz


-- 
           Summary: Inconsistent warning/error with static and non-static
                    declarations
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sirl at gcc dot gnu dot org
 GCC build triplet: i586-suse-linux
  GCC host triplet: i586-suse-linux
GCC target triplet: i586-suse-linux


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

Reply via email to