Bug 108007 - Stop defining PLATFORM(MAC) when building for PLATFORM(IOS) and PLATFORM(IOS_SIMULATOR)
Summary: Stop defining PLATFORM(MAC) when building for PLATFORM(IOS) and PLATFORM(IOS_...
Status: RESOLVED DUPLICATE of bug 128952
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-26 10:49 PST by David Kilzer (:ddkilzer)
Modified: 2014-03-15 10:35 PDT (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Kilzer (:ddkilzer) 2013-01-26 10:49:09 PST
We should stop defining PLATFORM(MAC) when building for PLATFORM(IOS) and PLATFORM(IOS_SIMULATOR) for the following reasons:

- Require contributors to be explicit about whether code supports both Mac and iOS.
- Make it explicit about which code supports iOS (so searching for "PLATFORM(IOS)" is meaningful).
- Make Mac-only code use "PLATFORM(MAC)" instead of "PLATFORM(MAC) && !PLATFORM(IOS)".
- Make it obvious when an ENABLE() or USE() macro should replace "PLATFORM(MAC) || PLATFORM(IOS)".
- Make the case in the future for a PLATFORM(_FOO_) macro that represents "PLATFORM(MAC) || PLATFORM(IOS)".
Comment 1 David Kilzer (:ddkilzer) 2013-01-26 11:16:44 PST
Looking at making a patch for this, I wonder if this would be a better change:

- Stop defining PLATFORM(MAC) when building for PLATFORM(IOS) and PLATFORM(IOS_SIMULATOR).
- Rename OS(DARWIN) to OS(APPLE).
- Replace "PLATFORM(MAC) || PLATFORM(IOS)" with OS(APPLE) (unless a better ENABLE() or USE() macro applies).

I know OS(DARWIN) is supped to represent the kernel or low-level parts of the operating system, but I think it works both to represent the kernel as well as the UI-level parts of the operating system.  And it's defined when __APPLE__ is defined.

I was originally going to add a PLATFORM(APPLE) macro along side OS(DARWIN), but it didn't seem to make sense to use "OS(DARWIN)" when "OS(APPLE)" is more generally useful.
Comment 2 David Kilzer (:ddkilzer) 2013-01-26 11:17:52 PST
(In reply to comment #1)
> I was originally going to add a PLATFORM(APPLE) macro along side OS(DARWIN), but it didn't seem to make sense to use "OS(DARWIN)" when "OS(APPLE)" is more generally useful.

And both Mac OS X and iOS are Apple operating systems!
Comment 3 Laszlo Gombos 2013-01-26 11:38:28 PST
David, FYI - I changed Platform.h to follow the direction you set (without introducing the new defines) as part of bug 105735.
Comment 4 Maciej Stachowiak 2013-01-26 22:41:38 PST
I think it makes sense to have a single macro that means PLATFORM(MAC) || PLATFORM(IOS) (effectively). But it should not be an OS() macro - those are supposed to be for low-level system things - cases where different top-level ports might build on the same underlying OS. So if we make a shared one, it should probably be a PLATFORM() macro, not OS(). Another idea besides PLATFORM(APPLE) might be PLATFORM(COCOA) (to the extent that Cocoa Touch is a form of Cocoa).
Comment 5 Maciej Stachowiak 2013-01-26 22:42:20 PST
BTW, I forgot to mention, but I agree with this basic idea of splitting MAC and IOS.
Comment 6 David Kilzer (:ddkilzer) 2013-01-28 12:00:46 PST
Another reason to stop defining PLATFORM(MAC) when building iOS:
<http://trac.webkit.org/changeset/140988>
Comment 7 David Kilzer (:ddkilzer) 2014-03-15 07:47:01 PDT
I think Dan Bernstein fixed this already.  Is there anything left to do here?
Comment 8 mitz 2014-03-15 09:13:56 PDT
(In reply to comment #7)
> I think Dan Bernstein fixed this already.  Is there anything left to do here?

Yes, this was fixed as bug 128952. I didn’t know that this earlier bug existed when I filed that one.
Comment 9 David Kilzer (:ddkilzer) 2014-03-15 10:35:20 PDT

*** This bug has been marked as a duplicate of bug 128952 ***