From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Kurshev To: Neil Booth Cc: gcc@gcc.gnu.org Subject: Re: Strange gcc-3.0.1 preprocessor Date: Sun, 14 Oct 2001 10:45:00 -0000 Message-id: <20011014214752.32b3e72f.nickols_k@mail.ru> References: <20011014184939.092bdd3b.nickols_k@mail.ru> <20011014161222.B12430@daikokuya.demon.co.uk> X-SW-Source: 2001-10/msg00815.html Hello, Neil! On Sun, 14 Oct 2001 16:12:22 +0100, you wrote: > Nick Kurshev wrote:- > > > In file included from biewlib/biewlib.h:25, > > from biewlib/bbio.h:21, > > from biewlib/bbio.c:26: > > biewlib/sysdep/_sys_dep.h:30:14: warning: pasting "/" and "__MACHINE__" does not give a valid preprocessing token > > biewlib/sysdep/_sys_dep.h:30:22: biewlib/sysdep/__MACHINE__/__config.h: No such file or directory > > biewlib/sysdep/_sys_dep.h:31:14: warning: pasting "/" and "__MACHINE__" does not give a valid preprocessing token > > biewlib/sysdep/_sys_dep.h:31:22: biewlib/sysdep/__MACHINE__/_inlines.h: No such file or directory > > > > Only one question: Is it a bug or is it a new feature of gcc-3.0.1? > > The warning tells you the problem. Do you know what ## does? > It was only way to build such trick. Else how you will notice compiler to build preprocessor string without space characters? Well, the same code with space characters around __MACHINE__: source: #define _INLINES #define __CONFIG #include __CONFIG #include _INLINES output: biewlib/sysdep/_sys_dep.h:30:22: biewlib/sysdep/ ia32 /__config.h: No such file or directory biewlib/sysdep/_sys_dep.h:31:22: biewlib/sysdep/ ia32 /_inlines.h: No such file or directory > > Any previouse versions of gcc since 2.7.2.1 upto 2.95.3 handle this > > code correctly. > > They are incorrect; from the code it would appear they used to expand > __MACHINE__. That macro should not be expanded, since it is being > operated on by ##. > > I suspect you can get the result you want by losing the ##. Well, other trick: command: gcc -D__MACHINE__='"ia32"' source: #define _INLINES <"biewlib/sysdep/"__MACHINE__"/_inlines.h"> #define __CONFIG <"biewlib/sysdep/"__MACHINE__"/__config.h"> #include __CONFIG #include _INLINES output: biewlib/sysdep/_sys_dep.h:30:22: "biewlib/sysdep/"ia32"/__config.h": No such file or directory biewlib/sysdep/_sys_dep.h:31:22: "biewlib/sysdep/"ia32"/_inlines.h": No such file or directory So I have no solutions with new gcc-3.x branch for now. Need some other trick. >From other point - it's PREPROCESSOR but not C compiler which can concatenate several strings to one. > > Neil. > > Best regards! Nick