[Bug c/32692] New: Inconsistent warning/error with static and non-static declarations
sirl at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Mon Jul 9 12:01:00 GMT 2007
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
More information about the Gcc-bugs
mailing list