This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: cpp problem in 20000417 snapshot
- To: Michael Schwingen <michaels at stochastik dot rwth-aachen dot de>
- Subject: Re: cpp problem in 20000417 snapshot
- From: Zack Weinberg <zack at wolery dot cumb dot org>
- Date: Wed, 3 May 2000 08:45:34 -0700
- Cc: gcc-bugs at gcc dot gnu dot org
- References: <20000503153757.07341@nemesis.stochastik.rwth-aachen.de>
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