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]
Other format: [Raw text]

include preprocess bug?


HI! I've noticed a difference between gcc 2.95.4 and gcc >= 2.96. I'm not
sure if it is a bug so therefore i use the mail system. When i compile the
following code, i get different results. (Test0.h indeed does not exist)
(mailto:sbmpost at science dot uva dot nl)

bug.cpp
-------------
#include <stdio.h>
#define NR "0"
#include "Test" NR ".h"

gcc 2.95.4
-------------
bug.cpp:3: Test0.h: No Such file or directory

gcc >= 2.96
-------------
bug.cpp:3:17: warning: extra tokens at end of #include directive
bug.cpp:3:24: Test: No such file or directory

`workaround'
-------------
#include <stdio.h>
#define xconcat(arg1,arg2) concat(arg1,arg2)
#define concat(arg1,arg2) arg1 ## arg2.h
#define xstr(s) str(s)
#define str(s) #s

#define NR 0
#include xstr(xconcat(Test,NR))


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