gcc-3.0.3 cpp0 bug?
Graeme Peterson
gp@qnx.com
Fri Jan 25 02:32:00 GMT 2002
Hi, all.
While trying to port/configure/make gcc-3.0.3 for QNX6, I came upon
what looks like a cpp0 bug. We use standard C macros in some
of our system header files, and the xgcc fails when the source
includes any of those headers.
I tested it on Solaris with the 2.95.3 and 3.0.3 packages from
www.sunfreeware.com and came up with the same failure.
Here is my test case. I made a 'foo.h' file with the C macros
as listed below, and put it in /home/gp. foo.h uses the macros
to construct the path of an included header file 'subdir/ffoo.h',
which in this case is an empty file.
The net effect is that I want the macros to expand to:
(empty lines deleted from 2.95.3 foo.s)
# 1 "./foo.h"
# 1 "subdir/ffoo.h" 1
# 10 "./foo.h" 2
2.95.3 works, 3.0.3 fails.
Anyone?
Thanks.
GP
=========foo.h============
/* Two step process because of standard C macro expansion rules */
#define ___SPLICE(x,y) x##y
#define __SPLICE(x,y) ___SPLICE(x,y)
#define _HDR_(hdr) <##hdr##>
#define _HDR_DIR_ subdir
#define _SPLICED_HDR_(hdr) <##__SPLICE(_HDR_DIR_,__SPLICE(/,hdr))##>
#include _SPLICED_HDR_(ffoo.h)
=========end foo.h============
========command lines used ===
/usr/local/lib/gcc-lib/sparc-sun-solaris2.8/2.95.3/cpp0 /home/gp/foo.h -o foo2953.s -v -I/home/gp
/usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.0.3/cpp0 /home/gp/foo.h -o foo303.s -v -I/home/gp
=====end command lines =======
========output===============
USING VERSION 2.95.3 cpp0:
GNU CPP version 2.95.3 20010315 (release) (sparc)
#include "..." search starts here:
#include <...> search starts here:
.
/usr/local/include
/usr/local/lib/gcc-lib/sparc-sun-solaris2.8/2.95.3/../../../../sparc-sun-solaris2.8/include
/usr/local/lib/gcc-lib/sparc-sun-solaris2.8/2.95.3/include
/usr/include
End of search list.
The following default directories have been omitted from the search path:
/usr/local/lib/gcc-lib/sparc-sun-solaris2.8/2.95.3/../../../../include/g++-3
End of omitted list.
USING VERSION 3.0.3 cpp0:
GNU CPP version 3.0.3 (cpplib) (sparc)
#include "..." search starts here:
#include <...> search starts here:
.
/usr/local/include
/usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.0.3/include
/usr/local/sparc-sun-solaris2.8/include
/usr/include
End of search list.
foo.h:10:10: warning: pasting "<" and "__SPLICE" does not give a valid preprocessing token
foo.h:10:10: warning: pasting "/" and "ffoo" does not give a valid preprocessing token
foo.h:10:10: warning: pasting ")" and ">" does not give a valid preprocessing token
foo.h:10:31: __SPLICE(subdir,/ffoo.h): No such file or directory
=============end output==========
------
Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com
More information about the crossgcc
mailing list