#define a!

with -ansi -pedantic-errors should not receive an error, although it can
receive a warning.  C99 requires whitespace before the replacement text in
a macro definition, but C90 (as amended by TC1) only requires it
"if the first character of a replacement is not a character required by
subclause 5.2.1", i.e. if it is not a character required to be in the
basic source character set.  C++ appears to follow the pre-TC1 wording
with no requirement for whitespace at all (but in standard C++ with both
conversion of extended characters to UCNs and UCNs in identifiers implemented,
the case of extended characters starting a macro replacement can't arise:
the UCN would lex as part of the macro name as the syntax makes them part
of an identifier, and then give an error if that particular UCN is not
permitted in identifiers; I'm not sure what the proper interim handling for
C++ would be without those features implemented).

This is a regression from 2.95.x, where cccp explicitly checked whether
the character was one of those required by 5.2.1 to determine whether
to issue a warning or a pedwarn, though not an important regression.

-- 
           Summary: missing whitespace after macro name in C90 or C++
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: preprocessor
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jsm28 at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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

Reply via email to