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

  • From: Philippe Houdoin <philippe.houdoin@xxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Tue, 21 Aug 2007 16:42:03 +0200

Quoting Ryan Leavengood <leavengood@xxxxxxxxx>:
> 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)

Did you try to simplify this silly macro to this:

#define PLATFORM(WTF_FEATURE) WTF_PLATFORM_##WTF_FEATURE

According to #if preprocessing directive specification, any undefined identifier
will be evaluated as 0.

Which means "#if PLATFORM(DARWIN)" will give "#if WTF_PLATFORM_DARWIN" which,
logically, should be evaluated to zero if such identifier is undefined.

I failed to see why someone defining a macro as an expression will ever needs to
check if an identifier is defined before evaluating its value, as 0 is specified
as the default value for any undefined identifier...

Anyway, maybe it worth a try.

- Philippe

Other related posts: