Title: [254572] trunk/Source/WTF
Revision
254572
Author
wei...@apple.com
Date
2020-01-15 09:48:50 -0800 (Wed, 15 Jan 2020)

Log Message

Platform.h is out of control Part 4: Split PLATFORM_* macro definitions out of Platform.h and into a new PlatformLegacy.h
https://bugs.webkit.org/show_bug.cgi?id=206272

Reviewed by Anders Carlsson.

As a another step towards cleaning up Platform.h, split out all the legacy platform
macros into their own file.

* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/Platform.h:
* wtf/PlatformLegacy.h: Copied from Source/WTF/wtf/Platform.h.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (254571 => 254572)


--- trunk/Source/WTF/ChangeLog	2020-01-15 17:18:19 UTC (rev 254571)
+++ trunk/Source/WTF/ChangeLog	2020-01-15 17:48:50 UTC (rev 254572)
@@ -1,5 +1,20 @@
 2020-01-14  Sam Weinig  <wei...@apple.com>
 
+        Platform.h is out of control Part 4: Split PLATFORM_* macro definitions out of Platform.h and into a new PlatformLegacy.h
+        https://bugs.webkit.org/show_bug.cgi?id=206272
+
+        Reviewed by Anders Carlsson.
+
+        As a another step towards cleaning up Platform.h, split out all the legacy platform
+        macros into their own file.
+
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/CMakeLists.txt:
+        * wtf/Platform.h:
+        * wtf/PlatformLegacy.h: Copied from Source/WTF/wtf/Platform.h.
+
+2020-01-14  Sam Weinig  <wei...@apple.com>
+
         Plaform.h helper files should have a consistent naming scheme
         https://bugs.webkit.org/show_bug.cgi?id=206240
 

Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (254571 => 254572)


--- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj	2020-01-15 17:18:19 UTC (rev 254571)
+++ trunk/Source/WTF/WTF.xcodeproj/project.pbxproj	2020-01-15 17:48:50 UTC (rev 254572)
@@ -447,6 +447,7 @@
 		7C42307123CE2D8A006E54D0 /* PlatformEnable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformEnable.h; sourceTree = "<group>"; };
 		7C42307223CE2D8A006E54D0 /* PlatformCPU.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformCPU.h; sourceTree = "<group>"; };
 		7C42307323CE2D8B006E54D0 /* PlatformOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformOS.h; sourceTree = "<group>"; };
+		7C42307423CEB187006E54D0 /* PlatformLegacy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformLegacy.h; sourceTree = "<group>"; };
 		7C9692941F66306E00267A9E /* KeyValuePair.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KeyValuePair.h; sourceTree = "<group>"; };
 		7CBBA07319BB7FDC00BBF025 /* OSObjectPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OSObjectPtr.h; sourceTree = "<group>"; };
 		7CD0D5A71D55322A000CC9E1 /* Variant.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Variant.h; sourceTree = "<group>"; };
@@ -1127,6 +1128,7 @@
 				A876DBD7151816E500DADB95 /* Platform.h */,
 				7C42307223CE2D8A006E54D0 /* PlatformCPU.h */,
 				7C42307123CE2D8A006E54D0 /* PlatformEnable.h */,
+				7C42307423CEB187006E54D0 /* PlatformLegacy.h */,
 				7C42307323CE2D8B006E54D0 /* PlatformOS.h */,
 				FE1E2C41224187C600F6B729 /* PlatformRegisters.cpp */,
 				E3200AB41E9A536D003B59D2 /* PlatformRegisters.h */,

Modified: trunk/Source/WTF/wtf/CMakeLists.txt (254571 => 254572)


--- trunk/Source/WTF/wtf/CMakeLists.txt	2020-01-15 17:18:19 UTC (rev 254571)
+++ trunk/Source/WTF/wtf/CMakeLists.txt	2020-01-15 17:48:50 UTC (rev 254572)
@@ -173,6 +173,7 @@
     Platform.h
     PlatformCPU.h
     PlatformEnable.h
+    PlatformLegacy.h
     PlatformOS.h
     PlatformRegisters.h
     PointerComparison.h

Modified: trunk/Source/WTF/wtf/Platform.h (254571 => 254572)


--- trunk/Source/WTF/wtf/Platform.h	2020-01-15 17:18:19 UTC (rev 254571)
+++ trunk/Source/WTF/wtf/Platform.h	2020-01-15 17:48:50 UTC (rev 254572)
@@ -30,20 +30,20 @@
 /* Include compiler specific macros */
 #include <wtf/Compiler.h>
 
-/* Include CPU specific macros */
+/* ==== Platform adaptation macros: these describe properties of the target environment. ==== */
+
+/* CPU() - the target CPU architecture */
 #include <wtf/PlatformCPU.h>
 
-/* Include underlying operating system specific macros */
+/* OS() - underlying operating system; only to be used for mandated low-level services like
+   virtual memory, not to choose a GUI toolkit */
 #include <wtf/PlatformOS.h>
 
-/* ==== PLATFORM handles OS, operating environment, graphics API, and
+/* PLATFORM() - handles OS, operating environment, graphics API, and
    CPU. This macro will be phased out in favor of platform adaptation
-   macros, policy decision macros, and top-level port definitions. ==== */
-#define PLATFORM(WTF_FEATURE) (defined WTF_PLATFORM_##WTF_FEATURE  && WTF_PLATFORM_##WTF_FEATURE)
+   macros, policy decision macros, and top-level port definitions. */
+#include <wtf/PlatformLegacy.h>
 
-
-/* ==== Platform adaptation macros: these describe properties of the target environment. ==== */
-
 /* HAVE() - specific system features (headers, functions or similar) that are present or not */
 #define HAVE(WTF_FEATURE) (defined HAVE_##WTF_FEATURE  && HAVE_##WTF_FEATURE)
 
@@ -56,6 +56,12 @@
 #define ENABLE(WTF_FEATURE) (defined ENABLE_##WTF_FEATURE  && ENABLE_##WTF_FEATURE)
 
 
+#if PLATFORM(COCOA)
+#if defined __has_include && __has_include(<CoreFoundation/CFPriv.h>)
+#define USE_APPLE_INTERNAL_SDK 1
+#endif
+#endif
+
 /* MIPS requires allocators to use aligned memory */
 #if CPU(MIPS) || CPU(MIPS64)
 #define USE_ARENA_ALLOC_ALIGNMENT_INTEGER 1
@@ -117,61 +123,6 @@
 #include <features.h>
 #endif
 
-/* FIXME: these are all mixes of OS, operating environment and policy choices. */
-/* PLATFORM(GTK) */
-/* PLATFORM(MAC) */
-/* PLATFORM(IOS) */
-/* PLATFORM(IOS_FAMILY) */
-/* PLATFORM(IOS_SIMULATOR) */
-/* PLATFORM(IOS_FAMILY_SIMULATOR) */
-/* PLATFORM(WIN) */
-#if defined(BUILDING_GTK__)
-#define WTF_PLATFORM_GTK 1
-#elif defined(BUILDING_WPE__)
-#define WTF_PLATFORM_WPE 1
-#elif defined(BUILDING_JSCONLY__)
-/* JSCOnly does not provide PLATFORM() macro */
-#elif OS(MAC_OS_X)
-#define WTF_PLATFORM_MAC 1
-#elif OS(IOS_FAMILY)
-#if OS(IOS)
-#define WTF_PLATFORM_IOS 1
-#endif
-#define WTF_PLATFORM_IOS_FAMILY 1
-#if TARGET_OS_SIMULATOR
-#if OS(IOS)
-#define WTF_PLATFORM_IOS_SIMULATOR 1
-#endif
-#define WTF_PLATFORM_IOS_FAMILY_SIMULATOR 1
-#endif
-#if defined(TARGET_OS_MACCATALYST) && TARGET_OS_MACCATALYST
-#define WTF_PLATFORM_MACCATALYST 1
-#endif
-#elif OS(WINDOWS)
-#define WTF_PLATFORM_WIN 1
-#endif
-
-/* PLATFORM(COCOA) */
-#if PLATFORM(MAC) || PLATFORM(IOS_FAMILY)
-#define WTF_PLATFORM_COCOA 1
-#endif
-
-#if PLATFORM(COCOA)
-#if defined __has_include && __has_include(<CoreFoundation/CFPriv.h>)
-#define USE_APPLE_INTERNAL_SDK 1
-#endif
-#endif
-
-/* PLATFORM(APPLETV) */
-#if defined(TARGET_OS_TV) && TARGET_OS_TV
-#define WTF_PLATFORM_APPLETV 1
-#endif
-
-/* PLATFORM(WATCHOS) */
-#if defined(TARGET_OS_WATCH) && TARGET_OS_WATCH
-#define WTF_PLATFORM_WATCHOS 1
-#endif
-
 /* FIXME: ASSERT_ENABLED should defined in different, perhaps its own, file. */
 /* ASSERT_ENABLED should be true if we want the current compilation unit to
    do debug assertion checks unconditionally (e.g. treat a debug ASSERT

Copied: trunk/Source/WTF/wtf/PlatformLegacy.h (from rev 254550, trunk/Source/WTF/wtf/Platform.h) (0 => 254572)


--- trunk/Source/WTF/wtf/PlatformLegacy.h	                        (rev 0)
+++ trunk/Source/WTF/wtf/PlatformLegacy.h	2020-01-15 17:48:50 UTC (rev 254572)
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2006-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2007-2009 Torch Mobile, Inc.
+ * Copyright (C) 2010, 2011 Research In Motion Limited. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+/* PLATFORM() - handles OS, operating environment, graphics API, and
+   CPU. This macro will be phased out in favor of platform adaptation
+   macros, policy decision macros, and top-level port definitions. */
+#define PLATFORM(WTF_FEATURE) (defined WTF_PLATFORM_##WTF_FEATURE && WTF_PLATFORM_##WTF_FEATURE)
+
+
+/* FIXME: these are all mixes of OS, operating environment and policy choices. */
+/* PLATFORM(GTK) */
+/* PLATFORM(MAC) */
+/* PLATFORM(IOS) */
+/* PLATFORM(IOS_FAMILY) */
+/* PLATFORM(IOS_SIMULATOR) */
+/* PLATFORM(IOS_FAMILY_SIMULATOR) */
+/* PLATFORM(WIN) */
+#if defined(BUILDING_GTK__)
+#define WTF_PLATFORM_GTK 1
+#elif defined(BUILDING_WPE__)
+#define WTF_PLATFORM_WPE 1
+#elif defined(BUILDING_JSCONLY__)
+/* JSCOnly does not provide PLATFORM() macro */
+#elif OS(MAC_OS_X)
+#define WTF_PLATFORM_MAC 1
+#elif OS(IOS_FAMILY)
+#if OS(IOS)
+#define WTF_PLATFORM_IOS 1
+#endif
+#define WTF_PLATFORM_IOS_FAMILY 1
+#if TARGET_OS_SIMULATOR
+#if OS(IOS)
+#define WTF_PLATFORM_IOS_SIMULATOR 1
+#endif
+#define WTF_PLATFORM_IOS_FAMILY_SIMULATOR 1
+#endif
+#if defined(TARGET_OS_MACCATALYST) && TARGET_OS_MACCATALYST
+#define WTF_PLATFORM_MACCATALYST 1
+#endif
+#elif OS(WINDOWS)
+#define WTF_PLATFORM_WIN 1
+#endif
+
+/* PLATFORM(COCOA) */
+#if PLATFORM(MAC) || PLATFORM(IOS_FAMILY)
+#define WTF_PLATFORM_COCOA 1
+#endif
+
+/* PLATFORM(APPLETV) */
+#if defined(TARGET_OS_TV) && TARGET_OS_TV
+#define WTF_PLATFORM_APPLETV 1
+#endif
+
+/* PLATFORM(WATCHOS) */
+#if defined(TARGET_OS_WATCH) && TARGET_OS_WATCH
+#define WTF_PLATFORM_WATCHOS 1
+#endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to