This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
preprocessor/8900: Warning for code on same line as #endif needs -pedantic
- From: mpitt at software dot plasmon dot com
- To: gcc-gnats at gcc dot gnu dot org
- Date: 11 Dec 2002 15:43:45 -0000
- Subject: preprocessor/8900: Warning for code on same line as #endif needs -pedantic
- Reply-to: mpitt at software dot plasmon dot com
>Number: 8900
>Category: preprocessor
>Synopsis: Warning for code on same line as #endif needs -pedantic
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: unassigned
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Wed Dec 11 07:46:02 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: Mike Pitt <mpitt@software.plasmon.com>
>Release: 2.95.2 and 2.95.4
>Organization:
>Environment:
FreeBSD and Debian GNU/Linux
(FreeBSD: gcc version 2.95.2 19991024 (release))
(Linux: gcc version 2.95.4 20011002 (Debian prerelease))
>Description:
A mistake by a developer led to some code being on the same line as an #endif conditional.
gcc rightly ignored this line of code, but despite our warning levels did not shout at us. This was a problem as the code being ignored released a lock. When we found the problem we investigated what level would be needed to get a warning and found...
leo:~/deleteme:22$ gcc -Wall yabt.c -o yabt
leo:~/deleteme:23$ gcc -Wall -ansi yabt.c -o yabt
leo:~/deleteme:24$ gcc -Wall -ansi -pedantic yabt.c -o yabt
yabt.c:9: warning: text following `#endif' violates ANSI standard
yabt.c:13: warning: text following `#endif' violates ANSI standard
It seems there is no warning level lower than pedantic to show this, it would be nice if there were.
Attached sample (erroneous) C code to demonstrate problem.
The code that had the bug in has ...
-Wall -Wno-unused -Wno-switch Wpointer-arith -Wredundant-decls -Wnested-externs -Winline -W -Werror
turned on.
>How-To-Repeat:
Compile yabt.c with various warnings.
Only get warned of ignored code with -pedantic
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: