This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Compile failure in builtin-attrs.def
- From: "Zack Weinberg" <zack at codesourcery dot com>
- To: dholland at eecs dot harvard dot edu (David Holland)
- Cc: bug-gcc at gnu dot org
- Date: Tue, 03 Feb 2004 10:35:21 -0800
- Subject: Re: Compile failure in builtin-attrs.def
- References: <20040203174631.A653554CA76@mail.eecs.harvard.edu>
dholland@eecs.harvard.edu (David Holland) writes:
> builtin-attrs.def attempts to do token pasting of symbols of the form
> "1_0".
>
> While (presumably) gcc accepts this, such symbols are not valid
> preprocessing tokens; they're not identifiers, because they begin with
> a digit, and they're not valid numbers either.
This is incorrect. They are not valid numbers, but they *are* valid
"pp-numbers". 1 ## _0 must produce the single token 1_0.
(The definition of a pp-number [C99 6.4.8p2,3]:
A preprocessing number begins with a digit optionally preceded by a
period and may be followed by valid identifier characters[,
periods], and the character sequences e+, e-, E+, E-, p+, p-, P+,
or P-.
Preprocessing number tokens lexically include all floating and
integer constant tokens.
pp-numbers are deliberately intended to have broader syntax than
actual numbers, to make it possible to extend the syntax of numbers in
the future without changing the tokenization rules. They also provide
the useful property that splitting an identifier at any point yields
exactly two tokens, which can be glued back together with ##.)
> The MacOS X compiler quite properly treats the 1_0 as two tokens, 1
> and _0, and emits a space between them when preprocessing. Needless to
> say, this breaks the build.
The MacOS X compiler is buggy. We may want to work around this bug,
but a bug it is. Please report it to Apple.
zw