From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11671 invoked by alias); 2 Jan 2003 20:42:24 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 11659 invoked from network); 2 Jan 2003 20:42:18 -0000 Received: from unknown (HELO mail-out1.apple.com) (17.254.0.52) by 209.249.29.67 with SMTP; 2 Jan 2003 20:42:18 -0000 Received: from mailgate2.apple.com (A17-129-100-225.apple.com [17.129.100.225]) by mail-out1.apple.com (8.11.3/8.11.3) with ESMTP id h02Kg7w24245 for ; Thu, 2 Jan 2003 12:42:07 -0800 (PST) Received: from scv2.apple.com (scv2.apple.com) by mailgate2.apple.com (Content Technologies SMTPRS 4.2.1) with ESMTP id ; Thu, 2 Jan 2003 12:42:06 -0800 Received: from apple.com (mrs1.apple.com [17.201.24.248]) by scv2.apple.com (8.11.3/8.11.3) with ESMTP id h02Kg6Q13597; Thu, 2 Jan 2003 12:42:06 -0800 (PST) Date: Thu, 02 Jan 2003 20:42:00 -0000 Subject: Re: Change in preprocessor behavior Content-Type: text/plain; delsp=yes; charset=US-ASCII; format=flowed Mime-Version: 1.0 (Apple Message framework v548) Cc: gcc@gcc.gnu.org To: Stephen Lindholm From: Mike Stump In-Reply-To: Message-Id: Content-Transfer-Encoding: 7bit X-SW-Source: 2003-01/txt/msg00065.txt.bz2 On Monday, December 30, 2002, at 02:38 PM, Stephen Lindholm wrote: > 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 }, > }; My experience differs from yours: bash-2.05a$ cat b.cc #define COMMAND(NAME) { #NAME, NAME ## _command } struct command commands[] = { COMMAND (quit), COMMAND (help), }; bash-2.05a$ gcc -v -E b.cc Reading specs from /usr/libexec/gcc/darwin/ppc/3.1/specs Thread model: posix Apple Computer, Inc. GCC version 1175, based on gcc version 3.1 20020420 (prerelease) /usr/libexec/gcc/darwin/ppc/3.1/cpp0 -lang-c++ -D__GNUG__=3 -D__DEPRECATED -D__EXCEPTIONS -D__GXX_ABI_VERSION=100 -v -D__GNUC__=3 -D__GNUC_MINOR__=1 -D__GNUC_PATCHLEVEL__=0 -D__APPLE_CC__=1175 -D__ppc__ -D__POWERPC__ -D__NATURAL_ALIGNMENT__ -D__MACH__ -D__BIG_ENDIAN__ -D__APPLE__ -D__ppc__ -D__POWERPC__ -D__NATURAL_ALIGNMENT__ -D__MACH__ -D__BIG_ENDIAN__ -D__APPLE__ -D__NO_INLINE__ -D__STDC_HOSTED__=1 -D__DYNAMIC__ b.cc GNU CPP version 3.1 20020420 (prerelease) (cpplib) (Darwin/PowerPC) ignoring nonexistent directory "/usr/local/include" ignoring nonexistent directory "/usr/lib/gcc-lib/ppc-darwin/3.1/../../../../ppc-darwin/include" ignoring nonexistent directory "/Local/Library/Frameworks" #include "..." search starts here: #include <...> search starts here: /usr/include/gcc/darwin/3.1/g++-v3 /usr/include/gcc/darwin/3.1/g++-v3/ppc-darwin /usr/include/gcc/darwin/3.1/g++-v3/backward /usr/include/gcc/darwin/3.1 /usr/include End of search list. Framework search starts here: /System/Library/Frameworks /Library/Frameworks End of framework search list. # 1 "b.cc" # 1 "" # 1 "" # 1 "b.cc" struct command commands[] = { { "quit", quit_command }, { "help", help_command }, }; and bash-2.05a$ cpp -v b.cc Reading specs from /usr/libexec/gcc/darwin/ppc/3.1/specs Thread model: posix Apple Computer, Inc. GCC version 1175, based on gcc version 3.1 20020420 (prerelease) /usr/libexec/gcc/darwin/ppc/3.1/cpp0 -lang-c++ -D__DEPRECATED -D__EXCEPTIONS -D__GXX_ABI_VERSION=100 -v -$ -iprefix /usr/libexec/gcc/darwin/ppc/default/../libexec/gcc/darwin/ppc/3.1/ -D__ppc__ -D__POWERPC__ -D__NATURAL_ALIGNMENT__ -D__MACH__ -D__BIG_ENDIAN__ -D__APPLE__ -D__ppc__ -D__POWERPC__ -D__NATURAL_ALIGNMENT__ -D__MACH__ -D__BIG_ENDIAN__ -D__APPLE__ -D__NO_INLINE__ -D__STDC_HOSTED__=1 -D__DYNAMIC__ -D__GNUC__ b.cc GNU CPP version 3.1 20020420 (prerelease) (cpplib) (Darwin/PowerPC) ignoring nonexistent directory "/usr/libexec/gcc/darwin/ppc/default/../libexec/gcc/darwin/ppc/3.1/+-v3" ignoring nonexistent directory "/usr/libexec/gcc/darwin/ppc/default/../libexec/gcc/darwin/ppc/3.1/+- v3/ppc-darwin" ignoring nonexistent directory "/usr/libexec/gcc/darwin/ppc/default/../libexec/gcc/darwin/ppc/3.1/+- v3/backward" ignoring nonexistent directory "/usr/libexec/gcc/darwin/ppc/default/../libexec/gcc/darwin/ppc/3.1/+- v3/.." ignoring nonexistent directory "/usr/local/include" ignoring nonexistent directory "/usr/lib/gcc-lib/ppc-darwin/3.1/../../../../ppc-darwin/include" ignoring nonexistent directory "/Local/Library/Frameworks" #include "..." search starts here: #include <...> search starts here: /usr/include/gcc/darwin/3.1/g++-v3 /usr/include/gcc/darwin/3.1/g++-v3/ppc-darwin /usr/include/gcc/darwin/3.1/g++-v3/backward /usr/include/gcc/darwin/3.1 /usr/include End of search list. Framework search starts here: /System/Library/Frameworks /Library/Frameworks End of framework search list. # 1 "b.cc" # 1 "" # 1 "" # 1 "b.cc" struct command commands[] = { { "quit", quit_command }, { "help", help_command }, }; I cannot explain why. My best guess is that you are not using 1175, or that you didn't use gcc_select to select gcc3. What does gcc_select say when you run it?