This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

gcc 3.0.2 preprocessor token stringization fails


Title: gcc 3.0.2 preprocessor token stringization fails

Hi,

1) This source code shows a preprocessor failure for gcc-3.0.1
and gcc-3.0.2 but works correctly in gcc-2.95.3.  Although I am
using a sun->linux cross compiler, I notice the same failure on
a native linux gcc-3.0.2 compiler as well.

  --begin-source: f.c--
  #define CONCAT2(x,y)        x##y
  #define CONCAT3(x,y,z)      x##y##z

  #define QUOTE(macro)        #macro
  #define QUOTE_MACRO(macro)  QUOTE(macro)

  #define DEFINE_DEBUGGER(defaultLevel, msgPrefix) \
     _DEFINE_DEBUGGER(DEBUG_MODULE_NAME, defaultLevel, msgPrefix)

  #define _DEFINE_DEBUGGER(name, defaultLevel, msgPrefix) \
    static char *CONCAT3(p,name,MsgPrefix) = \
    CONCAT3("<",QUOTE_MACRO(name),"> ");

  #define DEBUG_MODULE_NAME SFTP
  DEFINE_DEBUGGER(9,"SFTP")
  --end-source: f.c--

2) Here is the command line and output,

  $ i686-pc-linux-gnu-gcc -c f.c
  f.c:15:1: warning: pasting ""<"" and "QUOTE_MACRO" does not give a valid preprocessing token
  f.c:15: parse error before "QUOTE_MACRO"
  f.c:15:1: warning: pasting ")" and ""> "" does not give a valid preprocessing token

3) Here is my system information,

  $ uname -a
  SunOS pico 5.7 Generic_106541-15 sun4u sparc SUNW,Ultra-5_10

4) Here is the -v output from my sun->linux gcc-3.0.2 cross compiler,

  $ i686-pc-linux-gnu-gcc -v
  Reading specs from ./../lib/gcc-lib/i686-pc-linux-gnu/3.0.2/specs
  Configured with: ./configure --target=i686-pc-linux-gnu
  --prefix=/home/davidt/gnu/xdev-3.0.2/sparc-sun-solaris2.7 --enable-languages=c,c++
  --enable-shared --enable-threads
  --with-as=/home/davidt/gnu/xdev-3.0.2/sparc-sun-solaris2.7/bin/i686-pc-linux-gnu-as
  --with-ld=/home/davidt/gnu/xdev-3.0.2/sparc-sun-solaris2.7/bin/i686-pc-linux-gnu-ld
  --with-headers=/home/davidt/gnu/usr/include --with-libs=/home/davidt/gnu/usr/lib
  Thread model: posix
  gcc version 3.0.2

5) Notes: This problem does *not* occur with gcc-2.95 or gcc-2.95.3.  It would
appear that gcc 3.x preprocessor token stringization has changed and as a result,
code that previously compiled correctly now provokes compilation errors.

--
David Thompson
david.thompson@efi.com
Electronics For Imaging


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]