[haiku-development] Re: GCC 2.95 and certain #define macros

  • From: "François Revol" <revol@xxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Sun, 19 Aug 2007 02:19:10 +0200 CEST

> So, my WebKit saga continues. As I implied in my last email, I've
> switched to GCC 2.95 to see if I can use it to compile a
> JavaScriptCore which will work with my BeOS compiled ICU.
>
> Unfortunately it chokes almost immediately because of some macro
> definitions in JavaScriptCore's Platform.h:
>
> #define PLATFORM(WTF_FEATURE) (defined( WTF_PLATFORM_##WTF_FEATURE )
> && WTF_PLATFORM_##WTF_FEATURE)
>

The ## is supposed to be able to concat 2 strings to form an
identifier.
It should work in 2.95 as well.
But this construct looks like it tries to create preprocessor stuff
from a define, while the preprocessor only has a single pass, I wonder
how it can even work with gcc4.

> The above definition (and 3 more like it) doesn't cause errors, but
> using it (or the others) does:
>
> #if PLATFORM(DARWIN)

Of course it preprocesses this into
(defined( WFT_...

and passes this to the compiler which doesn't know what defined is
about.

François.

Other related posts: