[webkit-dev] Proposal for a new way to handle porting #ifdefs
George Staikos
staikos at kde.org
Wed May 6 06:44:44 PDT 2009
On 5-May-09, at 10:49 AM, Darin Adler wrote:
> On May 4, 2009, at 7:45 PM, George Staikos wrote:
>
>> 1) In some cases some things apply to more than one OS so we have:
>> #if OS(x) || OS(y) || OS(z) ...
>> I think we should use:
>> #if OS(x,y,z)
>
> How? Macros don’t have overloading with the same macro but
> different numbers of parameters.
Hm I guess variable argument macros are not supported everywhere
we need them. Oh well.
On 5-May-09, at 11:16 AM, Maciej Stachowiak wrote:
>
> On May 4, 2009, at 7:45 PM, George Staikos wrote:
>
>>
>> I really like this and it goes in the direction that I was hoping
>> for as well. Hopefully we can get the WINCE port merged upstream
>> before we make this change. :-)
>>
>> Some comments I have:
>>
>> 1) In some cases some things apply to more than one OS so we have:
>> #if OS(x) || OS(y) || OS(z) ...
>> I think we should use:
>> #if OS(x,y,z)
>
> I think using the "||" operator is more clear, except perhaps in
> cases where there is a well-defined OS family, such as the Unix-
> like family of operating systems, or the Windows family. In that
> case, the OS family should get is own macro.
Well my idea probably won't work anyway given that not enough
compilers we need to support can handle it.
>> 1b) WINCE actually includes plenty of WIN but in some cases does
>> things differently. How to make this distinction without lots of
>> && and ||?
>
> Perhaps we need another basic OS macro besides WINCE and WIN, which
> would refer to only full/desktop versions of Windows. Or maybe WIN
> should mean desktop Windows, and some new macro could represent the
> facilities that are common to Windows and Windows CE. Then it's
> just a matter of using the right ifdefs in the right place.
So something like this (for example) in Platform.h?
#if OS(WINMOBILE)
#define WTF_OS_WINCE 1
#endif
#if OS(WINCE) || OS(WINDESKTOP)
#define WTF_OS_WIN 1
#endif
Then OS(WIN) would mean any Windows flavour, and OS(WINCE) would mean
any flavour of Windows CE.
>> Again, fully support these changes and perhaps some more too.
>> Just give us a bit of time to find the right way to merge the
>> WINCE stuff in first please!
>
> I wouldn't expect us to start changing things next week, but since
> generally I've heard support for these changes, I would expect in a
> month or two at most we'll likely start on deploying them. Most
> likely we will come up with a system that allows gradual migration.
> At some point, we'll likely require new code to use new-style
> macros only and not the old PLATFORM stuff.
Great! Well I'm ready to start packaging things up. Will try to
get the first (and most relevant) parts ready this week.
--
George Staikos
Torch Mobile Inc.
http://www.torchmobile.com/
More information about the webkit-dev
mailing list