This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug preprocessor/28022] New: Incorrect pedwarn for , expression in #if in c99 mode


This testcase:

#if 1 , 0
#endif

Should not warn with -std=c99 -pedantic.  It currently does due to an inverted
conditional.  This (cpplib/expr.c:1376):

    default: /* case CPP_COMMA: */
      if (CPP_PEDANTIC (pfile) && (!CPP_OPTION (pfile, c99)
                                   || !pfile->state.skip_eval))
        cpp_error (pfile, CPP_DL_PEDWARN,
                   "comma operator in operand of #if");

should be:

      if (CPP_PEDANTIC (pfile) && !(CPP_OPTION (pfile, c99)
                                   || pfile->state.skip_eval))

-Chris


-- 
           Summary: Incorrect pedwarn for , expression in #if in c99 mode
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sabre at nondot dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28022


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]