This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Change in preprocessor behavior
- From: Stephen Lindholm <lindholm at CS dot Stanford dot EDU>
- To: gcc at gcc dot gnu dot org
- Date: Mon, 30 Dec 2002 14:38:50 -0800 (PST)
- Subject: Change in preprocessor behavior
The stringize and token-pasting operators seem to no longer work in the
"cpp" phases of compilation, but they worked in "cpp" in early versions of
gcc (2.95.3). I can't find it written that those operations must occur in
phases 1-4, but # and ## are "preprocessing-op-or-punc" and it would seem
that they should therefore be processed in phase 4.
Am I doing something wrong?
Using this example from the cpp info page:
#define COMMAND(NAME) { #NAME, NAME ## _command }
struct command commands[] =
{
COMMAND (quit),
COMMAND (help),
};
I get this as expected on an old version of cpp (2.95.3):
Xenon > cpp test2
# 1 "test2"
struct command commands[] =
{
{ "quit", quit_command } ,
{ "help", help_command } ,
};
and this on a new version of cpp (3.1):
thrush:~% cpp test2
# 1 "test2"
struct command commands[] =
{
{ #quit, quit ## _command },
{ #help, help ## _command },
};