public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: mpitt@software.plasmon.com
To: gcc-gnats@gcc.gnu.org
Subject: preprocessor/8900: Warning for code on same line as #endif needs -pedantic
Date: Wed, 11 Dec 2002 07:46:00 -0000	[thread overview]
Message-ID: <20021211154345.29878.qmail@sources.redhat.com> (raw)


>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:


             reply	other threads:[~2002-12-11 15:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-11  7:46 mpitt [this message]
2002-12-11  9:53 neil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20021211154345.29878.qmail@sources.redhat.com \
    --to=mpitt@software.plasmon.com \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).