public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c/4271: excess warnings
@ 2001-09-08 15:06 george
0 siblings, 0 replies; 3+ messages in thread
From: george @ 2001-09-08 15:06 UTC (permalink / raw)
To: gcc-gnats
>Number: 4271
>Category: c
>Synopsis: excess warnings
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Sep 08 15:06:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: george@palisad.com
>Release: 3.0.1
>Organization:
>Environment:
solaris 8, x86
>Description:
Warning messages about extra characters after #endif
are annoying and unnecessarily clog up log files.
This happens very frequently as an aid to help identify
closing nested ifdefs. There is probably a way to
turn these messages off, but what used to be clean under
older versions of gcc is no longer clean, and other
potentially useful messages might be obscured.
>How-To-Repeat:
#ifdef FOO
#ifdef BAR
...
#endif BAR
#endif FOO
>Fix:
/* Ensure there are no stray tokens at the end of a directive. */
static void
check_eol (pfile)
cpp_reader *pfile;
{
if (!pfile->state.next_bol)
{
cpp_token token;
_cpp_lex_token (pfile, &token);
if (token.type != CPP_EOF) {
/*
* do not warn on extra stuff after #endif statements,
* this occurs too frequently, is of no consequence
* bogus warnings like this make it harder to identify real warnings
*/
if(strcmp(pfile->directive->name, "endif"))
cpp_pedwarn (pfile, "extra tokens at end of #%s directive",
pfile->directive->name);
}
}
}
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: c/4271: excess warnings
@ 2001-09-08 16:13 neil
0 siblings, 0 replies; 3+ messages in thread
From: neil @ 2001-09-08 16:13 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, george, nobody
Synopsis: excess warnings
State-Changed-From-To: open->closed
State-Changed-By: neil
State-Changed-When: Sat Sep 8 16:13:02 2001
State-Changed-Why:
If you don't like the warnings, then place your extra characters in a comment.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=4271&database=gcc
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: c/4271: excess warnings
@ 2001-09-08 15:36 Zack Weinberg
0 siblings, 0 replies; 3+ messages in thread
From: Zack Weinberg @ 2001-09-08 15:36 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR c/4271; it has been noted by GNATS.
From: Zack Weinberg <zack@codesourcery.com>
To: george@palisad.com
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: c/4271: excess warnings
Date: Sat, 8 Sep 2001 15:31:45 -0700
On Sat, Sep 08, 2001 at 09:56:42PM -0000, george@palisad.com wrote:
> Warning messages about extra characters after #endif
> are annoying and unnecessarily clog up log files.
> This happens very frequently as an aid to help identify
> closing nested ifdefs.
These warning messages are required by the C standard.
There is currently no way to turn the warning off. If you wish to
submit a patch which adds a suitable command line switch, I will
accept it. It will remain on by default.
You should change your code to use comments after #endif or #else
instead of bare tags.
zw
perl -pi~ -e 's/^(\s*#\s*(?:else|endif))(\s+)(.+)$/$1$2\/* $3 *\//' *.c
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2001-09-08 16:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-09-08 15:06 c/4271: excess warnings george
2001-09-08 15:36 Zack Weinberg
2001-09-08 16:13 neil
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).