This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug preprocessor/17299] New: Strange "not give a valid preprocessing token" error with macro substitution
- From: "sestegra at free dot fr" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 2 Sep 2004 20:29:16 -0000
- Subject: [Bug preprocessor/17299] New: Strange "not give a valid preprocessing token" error with macro substitution
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
GCC 3.3.2 raises a strange preproccessing error with following C file (dummy.c)
and fails to compile.
Shown error is "pasting "(" and "B" does not give a valid preprocessing token".
On the other hand, GCC 2.96 only raises a warning (strange too), but it rightly
compiles.
dummy.c
>#define F(N) A##N
>#define X(O,N) F(##O##N)
>
>int X(B,C);
>
>int main(void) {
> X(B,C) = 3.14;
>
> return ABC;
>}
$>gcc-3.3.2 -v -save-temps dummy.c
Reading specs from /usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.3.2/specs
Configured with: ../configure --prefix=/usr --libdir=/usr/lib
--with-slibdir=/lib --mandir=/usr/share/man --infodir=/usr/share/info
--enable-shared --enable-threads=posix --disable-checking --enable-long-long
--enable-__cxa_atexit --enable-clocale=gnu
--enable-languages=c,c++,ada,f77,objc,java,pascal
--host=i586-mandrake-linux-gnu --with-system-zlib
Thread model: posix
gcc version 3.3.2 (Mandrake Linux 10.0 3.3.2-6mdk)
/usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.3.2/cc1 -E -quiet -v -D__GNUC__=3
-D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=2 dummy.c dummy.i
ignoring nonexistent directory "/usr/i586-mandrake-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.3.2/include
/usr/include
End of search list.
dummy.c:4:10: pasting "(" and "B" does not give a valid preprocessing token
dummy.c:7:8: pasting "(" and "B" does not give a valid preprocessing token
dummy.i (GCC 3.3.2)
># 1 "dummy.c"
># 1 "<built-in>"
># 1 "<command line>"
># 1 "dummy.c"
>
>
>
>int ABC;
>
>int main(void) {
> ABC = 3.14;
>
> return ABC;
>}
$>gcc-2.96 -v -save-temps dummy.c
Reading specs from /usr/lib/gcc-lib/i586-mandrake-linux-gnu/2.96/specs
gcc version 2.96 20000731 (Mandrake Linux 9.2 2.96-0.83mdk)
/usr/lib/gcc-lib/i586-mandrake-linux-gnu/2.96/cpp0 -lang-c -v -D__GNUC__=2
-D__GNUC_MINOR__=96 -D__GNUC_PATCHLEVEL__=0 -D__ELF__ -Dunix -Dlinux -D__ELF__
-D__unix__ -D__linux__ -D__unix -D__linux -Asystem(posix) -D__NO_INLINE__
-Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ -D__tune_pentium__
dummy.c dummy.i
GNU CPP version 2.96 20000731 (Mandrake Linux 9.2 2.96-0.83mdk) (cpplib) (i386
Linux/ELF)
ignoring nonexistent directory "/usr/i586-mandrake-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/usr/lib/gcc-lib/i586-mandrake-linux-gnu/2.96/include
/usr/include
End of search list.
dummy.c:4:5: warning: pasting "(" and "B" does not give a valid preprocessing
token
dummy.c:7:3: warning: pasting "(" and "B" does not give a valid preprocessing
token
/usr/lib/gcc-lib/i586-mandrake-linux-gnu/2.96/cc1 dummy.i -quiet -dumpbase
dummy.c -version -o dummy.s
GNU C version 2.96 20000731 (Mandrake Linux 9.2 2.96-0.83mdk)
(i586-mandrake-linux-gnu) compiled by GNU C version 2.96 20000731 (Mandrake
Linux 9.2 2.96-0.83mdk).
as -V -Qy -o dummy.o dummy.s
GNU assembler version 2.14.90.0.7 (i586-mandrake-linux-gnu) using BFD version
2.14.90.0.7 20031029
/usr/lib/gcc-lib/i586-mandrake-linux-gnu/2.96/collect2 -m elf_i386
-dynamic-linker /lib/ld-linux.so.2 /usr/lib/gcc-lib/i586-mandrake-linux-gnu/2.96/../../../crt1.o /usr/lib/gcc-lib/i586-mandrake-linux-gnu/2.96/../../../crti.o /usr/lib/gcc-lib/i586-mandrake-linux-gnu/2.96/crtbegin.o
-L/usr/lib/gcc-lib/i586-mandrake-linux-gnu/2.96
-L/usr/lib/gcc-lib/i586-mandrake-linux-gnu/2.96/../../.. dummy.o -lgcc -lc
-lgcc /usr/lib/gcc-lib/i586-mandrake-linux-gnu/2.96/crtend.o /usr/lib/gcc-lib/i586-mandrake-linux-gnu/2.96/../../../crtn.o
dummy.i (GCC 2.96)
># 4 "dummy.c"
>int ABC;
>
>int main(void) {
> ABC = 3.14;
>
> return ABC;
>}
--
Summary: Strange "not give a valid preprocessing token" error
with macro substitution
Product: gcc
Version: 3.3.2
Status: UNCONFIRMED
Severity: critical
Priority: P2
Component: preprocessor
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: sestegra at free dot fr
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17299