cpp problem in 20000417 snapshot
Zack Weinberg
zack@wolery.cumb.org
Wed May 3 08:46:00 GMT 2000
On Wed, May 03, 2000 at 03:37:57PM +0200, Michael Schwingen wrote:
> Hello,
>
> I am havibng problems with the cpp in the 20000417 snapshot (older and
> newer snapshots did not compile for sh-coff here, so I could not test
> these).
>
> test.c is:
> -------------------------
> #define _PROJECT "foo"
> #include "./test"_PROJECT".h"
> -------------------------
...
> I believe this is allowed in ANSI, and it definitely worked in 2.95.2 and
> older gcc versions.
I am sorry, C99 section 6.10.2 paragraph 4 explicitly forbids this:
4 A preprocessing directive of the form
# include pp-tokens new-line
(that does not match one of the two previous forms) is
permitted. The preprocessing tokens after include in the
directive are processed just as in normal text. (Each identifier
currently defined as a macro name is replaced by its replacement
list of preprocessing tokens.) The directive resulting after all
replacements shall match one of the two previous forms.*
*Note that adjacent string literals are not concatenated into a
single string literal (see the translation phases in 5.1.1.2);
thus, an expansion that results in two string literals is an
invalid directive.
The "two previous forms" are the usual "..." and <...> syntaxes.
This would be a natural extension, and I see that 2.95 did accept it
(silently, even with -pedantic!) I'll consider restoring it.
Does anyone else have an opinion.
zw
More information about the Gcc-bugs
mailing list