c/4271: excess warnings

george@palisad.com george@palisad.com
Sat Sep 8 15:06:00 GMT 2001

>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
>Originator:     george@palisad.com
>Release:        3.0.1
solaris 8, x86
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.


#ifdef FOO
#ifdef BAR
#endif BAR
#endif FOO
/* 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",

More information about the Gcc-bugs mailing list