Title: [92974] trunk
Revision
92974
Author
[email protected]
Date
2011-08-12 10:51:08 -0700 (Fri, 12 Aug 2011)

Log Message

Move compiler specific macros to their own header
https://bugs.webkit.org/show_bug.cgi?id=66119

Reviewed by Anders Carlsson.

Source/_javascript_Core: 

* _javascript_Core.gypi:
* _javascript_Core.vcproj/WTF/WTF.vcproj:
* _javascript_Core.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
Add Compiler.h

* wtf/AlwaysInline.h:
Move the contents of this file (which no longer was just about ALWAYS_INLINE) to
Compiler.h.  We can remove this file in a later commit.

* wtf/Compiler.h: Added.
Put all compiler specific checks and features in this file.

* wtf/Platform.h:
Move COMPILER macro and definitions (and the odd WARN_UNUSED_RETURN compiler feature)
to Compiler.h.  Include Compiler.h since it is necessary.

Source/_javascript_Glue: 

* ForwardingHeaders/wtf/Compiler.h: Added.

Source/WebCore: 

* ForwardingHeaders/wtf/Compiler.h: Added.

Tools: 

* DumpRenderTree/ForwardingHeaders/wtf/Compiler.h: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (92973 => 92974)


--- trunk/Source/_javascript_Core/ChangeLog	2011-08-12 17:36:18 UTC (rev 92973)
+++ trunk/Source/_javascript_Core/ChangeLog	2011-08-12 17:51:08 UTC (rev 92974)
@@ -1,3 +1,27 @@
+2011-08-12  Sam Weinig  <[email protected]>
+
+        Move compiler specific macros to their own header
+        https://bugs.webkit.org/show_bug.cgi?id=66119
+
+        Reviewed by Anders Carlsson.
+
+        * _javascript_Core.gypi:
+        * _javascript_Core.vcproj/WTF/WTF.vcproj:
+        * _javascript_Core.xcodeproj/project.pbxproj:
+        * wtf/CMakeLists.txt:
+        Add Compiler.h
+
+        * wtf/AlwaysInline.h:
+        Move the contents of this file (which no longer was just about ALWAYS_INLINE) to
+        Compiler.h.  We can remove this file in a later commit.
+
+        * wtf/Compiler.h: Added.
+        Put all compiler specific checks and features in this file.
+
+        * wtf/Platform.h:
+        Move COMPILER macro and definitions (and the odd WARN_UNUSED_RETURN compiler feature)
+        to Compiler.h.  Include Compiler.h since it is necessary.
+
 2011-08-11  Filip Pizlo  <[email protected]>
 
         DFG JIT-specific structure stub info code offset fields are signed

Modified: trunk/Source/_javascript_Core/_javascript_Core.gypi (92973 => 92974)


--- trunk/Source/_javascript_Core/_javascript_Core.gypi	2011-08-12 17:36:18 UTC (rev 92973)
+++ trunk/Source/_javascript_Core/_javascript_Core.gypi	2011-08-12 17:51:08 UTC (rev 92974)
@@ -140,6 +140,7 @@
             'wtf/BloomFilter.h',
             'wtf/BumpPointerAllocator.h',
             'wtf/ByteArray.h',
+            'wtf/Compiler.h',
             'wtf/Complex.h',
             'wtf/CrossThreadRefCounted.h',
             'wtf/CryptographicallyRandomNumber.h',

Modified: trunk/Source/_javascript_Core/_javascript_Core.vcproj/WTF/WTF.vcproj (92973 => 92974)


--- trunk/Source/_javascript_Core/_javascript_Core.vcproj/WTF/WTF.vcproj	2011-08-12 17:36:18 UTC (rev 92973)
+++ trunk/Source/_javascript_Core/_javascript_Core.vcproj/WTF/WTF.vcproj	2011-08-12 17:51:08 UTC (rev 92974)
@@ -565,6 +565,10 @@
 			>
 		</File>
 		<File
+			RelativePath="..\..\wtf\Compiler.h"
+			>
+		</File>
+		<File
 			RelativePath="..\..\wtf\Complex.h"
 			>
 		</File>

Modified: trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj (92973 => 92974)


--- trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj	2011-08-12 17:36:18 UTC (rev 92973)
+++ trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj	2011-08-12 17:51:08 UTC (rev 92974)
@@ -570,6 +570,7 @@
 		BC5F7BBE11823B590052C02C /* Atomics.h in Headers */ = {isa = PBXBuildFile; fileRef = BC5F7BBB11823B590052C02C /* Atomics.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		BC5F7BBF11823B590052C02C /* ThreadingPrimitives.h in Headers */ = {isa = PBXBuildFile; fileRef = BC5F7BBC11823B590052C02C /* ThreadingPrimitives.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		BC5F7BC011823B590052C02C /* ThreadSafeRefCounted.h in Headers */ = {isa = PBXBuildFile; fileRef = BC5F7BBD11823B590052C02C /* ThreadSafeRefCounted.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		BC66BAE413F492CC00C23FAE /* Compiler.h in Headers */ = {isa = PBXBuildFile; fileRef = BC66BAE213F4928F00C23FAE /* Compiler.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		BC6AAAE50E1F426500AD87D8 /* ClassInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = BC6AAAE40E1F426500AD87D8 /* ClassInfo.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		BC756FC90E2031B200DE7D12 /* JSGlobalObjectFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = BC756FC70E2031B200DE7D12 /* JSGlobalObjectFunctions.h */; };
 		BC87CDB910712AD4000614CF /* JSONObject.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = BC87CDB810712ACA000614CF /* JSONObject.lut.h */; };
@@ -1211,6 +1212,7 @@
 		BC5F7BBB11823B590052C02C /* Atomics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Atomics.h; sourceTree = "<group>"; };
 		BC5F7BBC11823B590052C02C /* ThreadingPrimitives.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThreadingPrimitives.h; sourceTree = "<group>"; };
 		BC5F7BBD11823B590052C02C /* ThreadSafeRefCounted.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThreadSafeRefCounted.h; sourceTree = "<group>"; };
+		BC66BAE213F4928F00C23FAE /* Compiler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Compiler.h; sourceTree = "<group>"; };
 		BC6AAAE40E1F426500AD87D8 /* ClassInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ClassInfo.h; sourceTree = "<group>"; };
 		BC756FC60E2031B200DE7D12 /* JSGlobalObjectFunctions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSGlobalObjectFunctions.cpp; sourceTree = "<group>"; };
 		BC756FC70E2031B200DE7D12 /* JSGlobalObjectFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSGlobalObjectFunctions.h; sourceTree = "<group>"; };
@@ -1650,10 +1652,10 @@
 		65162EF108E6A21C007556CD /* wtf */ = {
 			isa = PBXGroup;
 			children = (
+				06D358A00DAAD9C4003B174E /* mac */,
+				8656573E115BE35200291F40 /* text */,
+				E195678D09E7CF1200B89D13 /* unicode */,
 				A1D764511354448B00C5C7C0 /* Alignment.h */,
-				A7C40C07130B057D00D002A1 /* BlockStack.h */,
-				5135FAD512D26856003C083B /* Decoder.h */,
-				5135FAD612D26856003C083B /* Encoder.h */,
 				93AA4F770957251F0084B3A7 /* AlwaysInline.h */,
 				938C4F690CA06BC700D9310A /* ASCIICType.h */,
 				65E217B808E7EECC0023E5F6 /* Assertions.cpp */,
@@ -1661,9 +1663,12 @@
 				BC5F7BBB11823B590052C02C /* Atomics.h */,
 				E1A596370DE3E1C300C17E37 /* AVLTree.h */,
 				DD377CBB12072C18006A2517 /* Bitmap.h */,
+				A7C40C07130B057D00D002A1 /* BlockStack.h */,
+				E4D8CE9B12FC42E100BC9F5A /* BloomFilter.h */,
 				86676D4D11FED55D004B6863 /* BumpPointerAllocator.h */,
 				A7A1F7AA0F252B3C00E184E2 /* ByteArray.cpp */,
 				A7A1F7AB0F252B3C00E184E2 /* ByteArray.h */,
+				BC66BAE213F4928F00C23FAE /* Compiler.h */,
 				FDA15C1612B03028003A583A /* Complex.h */,
 				0BDFFAD40FC6171000D69EF4 /* CrossThreadRefCounted.h */,
 				97941A7C1302A098004A3447 /* CryptographicallyRandomNumber.cpp */,
@@ -1674,6 +1679,7 @@
 				41359CF50FDD89CB00206180 /* DateMath.h */,
 				0F29479B126E698C00B3ABF5 /* DecimalNumber.cpp */,
 				862AF4B512239C7B0024E5B8 /* DecimalNumber.h */,
+				5135FAD512D26856003C083B /* Decoder.h */,
 				5186111D0CC824830081412B /* Deque.h */,
 				938C4F6B0CA06BCE00D9310A /* DisallowCType.h */,
 				14456A311314657800212CA3 /* DoublyLinkedList.h */,
@@ -1681,6 +1687,7 @@
 				651F6413039D5B5F0078395C /* dtoa.h */,
 				D75AF59512F8CB9500FC0ADF /* DynamicAnnotations.cpp */,
 				D75AF59612F8CB9500FC0ADF /* DynamicAnnotations.h */,
+				5135FAD612D26856003C083B /* Encoder.h */,
 				E48E0F2C0F82151700A8CA37 /* FastAllocBase.h */,
 				65E217B908E7EECC0023E5F6 /* FastMalloc.cpp */,
 				65E217BA08E7EECC0023E5F6 /* FastMalloc.h */,
@@ -1699,7 +1706,6 @@
 				657EB7450B708F540063461B /* ListHashSet.h */,
 				148A1626095D16BB00666D0D /* ListRefPtr.h */,
 				E1EE79270D6C964500FEA3BA /* Locker.h */,
-				06D358A00DAAD9C4003B174E /* mac */,
 				06D358A20DAAD9C4003B174E /* MainThread.cpp */,
 				06D358A30DAAD9C4003B174E /* MainThread.h */,
 				5DBD18AF0C5401A700C15EAE /* MallocZoneSupport.h */,
@@ -1726,18 +1732,17 @@
 				14B3EF0412BC24DD00D29EFF /* PageBlock.cpp */,
 				14B3EF0312BC24DD00D29EFF /* PageBlock.h */,
 				8690231412092D5C00630AF9 /* PageReservation.h */,
-				BCFBE695122560E800309E9D /* PassOwnArrayPtr.h */,
-				44DD48520FAEA85000D6B4EB /* PassOwnPtr.h */,
-				6580F795094070560082C219 /* PassRefPtr.h */,
-				651DCA02136A6FAB00F74194 /* PassTraits.h */,
 				7934BB761361979300CB99A1 /* ParallelJobs.h */,
 				7934BB771361979300CB99A1 /* ParallelJobsGeneric.cpp */,
 				7934BB781361979300CB99A1 /* ParallelJobsGeneric.h */,
 				7934BB791361979300CB99A1 /* ParallelJobsLibdispatch.h */,
 				7934BB7A1361979300CB99A1 /* ParallelJobsOpenMP.h */,
+				BCFBE695122560E800309E9D /* PassOwnArrayPtr.h */,
+				44DD48520FAEA85000D6B4EB /* PassOwnPtr.h */,
+				6580F795094070560082C219 /* PassRefPtr.h */,
+				651DCA02136A6FAB00F74194 /* PassTraits.h */,
 				65D6D87E09B5A32E0002E4D7 /* Platform.h */,
 				A7D649A91015224E009B2E1B /* PossiblyNull.h */,
-				E4D8CE9B12FC42E100BC9F5A /* BloomFilter.h */,
 				088FA5B90EF76D4300578E6F /* RandomNumber.cpp */,
 				088FA5BA0EF76D4300578E6F /* RandomNumber.h */,
 				08E279E80EF83B10007DB523 /* RandomNumberSeed.h */,
@@ -1748,9 +1753,9 @@
 				148A1ECD0D10C23B0069A47C /* RefPtrHashMap.h */,
 				51F648D60BB4E2CA0033D760 /* RetainPtr.h */,
 				969A07290ED1CE6900F1F681 /* SegmentedVector.h */,
+				A7C40C08130B057D00D002A1 /* SentinelLinkedList.h */,
 				76FB9F1012E851960051A2EB /* SHA1.cpp */,
 				76FB9F0E12E851860051A2EB /* SHA1.h */,
-				A7C40C08130B057D00D002A1 /* SentinelLinkedList.h */,
 				A7C40C09130B057D00D002A1 /* SinglyLinkedList.h */,
 				0BF28A2811A33DC300638F84 /* SizeLimits.cpp */,
 				86D87DA512BC4B14008E73A1 /* StackBounds.cpp */,
@@ -1764,19 +1769,17 @@
 				6541BD6F08E80A17002CBEE7 /* TCSpinLock.h */,
 				6541BD7008E80A17002CBEE7 /* TCSystemAlloc.cpp */,
 				6541BD7108E80A17002CBEE7 /* TCSystemAlloc.h */,
-				8656573E115BE35200291F40 /* text */,
 				18BAB52710DADFCD000D945B /* ThreadIdentifierDataPthreads.cpp */,
 				18BAB52810DADFCD000D945B /* ThreadIdentifierDataPthreads.h */,
 				5D6A566A0F05995500266145 /* Threading.cpp */,
 				E1EE79220D6C95CD00FEA3BA /* Threading.h */,
 				BC5F7BBC11823B590052C02C /* ThreadingPrimitives.h */,
 				E1EE793C0D6C9B9200FEA3BA /* ThreadingPthreads.cpp */,
+				0BAC949E1338728400CF135B /* ThreadRestrictionVerifier.h */,
 				BC5F7BBD11823B590052C02C /* ThreadSafeRefCounted.h */,
 				E1B7C8BD0DA3A3360074B0DC /* ThreadSpecific.h */,
-				0BAC949E1338728400CF135B /* ThreadRestrictionVerifier.h */,
 				0B330C260F38C62300692DE3 /* TypeTraits.cpp */,
 				0B4D7E620F319AC800AD7E58 /* TypeTraits.h */,
-				E195678D09E7CF1200B89D13 /* unicode */,
 				935AF46B09E9D9DB00ACD1D8 /* UnusedParam.h */,
 				E17FF770112131D200076A19 /* ValueCheck.h */,
 				6592C316098B7DE10003D4F6 /* Vector.h */,
@@ -2579,6 +2582,7 @@
 				A76F54A313B28AAB00EF2BCE /* JITWriteBarrier.h in Headers */,
 				866739D213BFDE710023D87C /* BigInteger.h in Headers */,
 				866739D313BFDE710023D87C /* Uint16WithFraction.h in Headers */,
+				BC66BAE413F492CC00C23FAE /* Compiler.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

Modified: trunk/Source/_javascript_Core/wtf/AlwaysInline.h (92973 => 92974)


--- trunk/Source/_javascript_Core/wtf/AlwaysInline.h	2011-08-12 17:36:18 UTC (rev 92973)
+++ trunk/Source/_javascript_Core/wtf/AlwaysInline.h	2011-08-12 17:51:08 UTC (rev 92974)
@@ -18,58 +18,6 @@
  *
  */
 
-#include "Platform.h"
+/* This file is no longer necessary, since all the functionality has been moved to Compiler.h. */
 
-#ifndef ALWAYS_INLINE
-#if COMPILER(GCC) && defined(NDEBUG) && !COMPILER(MINGW)
-#define ALWAYS_INLINE inline __attribute__((__always_inline__))
-#elif (COMPILER(MSVC) || COMPILER(RVCT)) && defined(NDEBUG)
-#define ALWAYS_INLINE __forceinline
-#else
-#define ALWAYS_INLINE inline
-#endif
-#endif
-
-#ifndef NEVER_INLINE
-#if COMPILER(GCC)
-#define NEVER_INLINE __attribute__((__noinline__))
-#elif COMPILER(RVCT)
-#define NEVER_INLINE __declspec(noinline)
-#else
-#define NEVER_INLINE
-#endif
-#endif
-
-#ifndef UNLIKELY
-#if COMPILER(GCC) || (RVCT_VERSION_AT_LEAST(3, 0, 0, 0) && defined(__GNUC__))
-#define UNLIKELY(x) __builtin_expect((x), 0)
-#else
-#define UNLIKELY(x) (x)
-#endif
-#endif
-
-#ifndef LIKELY
-#if COMPILER(GCC) || (RVCT_VERSION_AT_LEAST(3, 0, 0, 0) && defined(__GNUC__))
-#define LIKELY(x) __builtin_expect((x), 1)
-#else
-#define LIKELY(x) (x)
-#endif
-#endif
-
-#ifndef NO_RETURN
-#if COMPILER(GCC)
-#define NO_RETURN __attribute((__noreturn__))
-#elif COMPILER(MSVC) || COMPILER(RVCT)
-#define NO_RETURN __declspec(noreturn)
-#else
-#define NO_RETURN
-#endif
-#endif
-
-#ifndef NO_RETURN_WITH_VALUE
-#if !COMPILER(MSVC)
-#define NO_RETURN_WITH_VALUE NO_RETURN
-#else
-#define NO_RETURN_WITH_VALUE
-#endif
-#endif
+#include "Platform.h"

Modified: trunk/Source/_javascript_Core/wtf/CMakeLists.txt (92973 => 92974)


--- trunk/Source/_javascript_Core/wtf/CMakeLists.txt	2011-08-12 17:36:18 UTC (rev 92973)
+++ trunk/Source/_javascript_Core/wtf/CMakeLists.txt	2011-08-12 17:51:08 UTC (rev 92974)
@@ -8,6 +8,7 @@
     Bitmap.h
     BumpPointerAllocator.h
     ByteArray.h
+    Compiler.h
     Complex.h
     CrossThreadRefCounted.h
     CryptographicallyRandomNumber.h

Added: trunk/Source/_javascript_Core/wtf/Compiler.h (0 => 92974)


--- trunk/Source/_javascript_Core/wtf/Compiler.h	                        (rev 0)
+++ trunk/Source/_javascript_Core/wtf/Compiler.h	2011-08-12 17:51:08 UTC (rev 92974)
@@ -0,0 +1,188 @@
+/*
+ * Copyright (C) 2011 Apple Inc. 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. 
+ */
+
+#ifndef WTF_Compiler_h
+#define WTF_Compiler_h
+
+/* COMPILER() - the compiler being used to build the project */
+#define COMPILER(WTF_FEATURE) (defined WTF_COMPILER_##WTF_FEATURE  && WTF_COMPILER_##WTF_FEATURE)
+
+/* ==== COMPILER() - the compiler being used to build the project ==== */
+
+/* COMPILER(MSVC) Microsoft Visual C++ */
+/* COMPILER(MSVC7_OR_LOWER) Microsoft Visual C++ 2003 or lower*/
+/* COMPILER(MSVC9_OR_LOWER) Microsoft Visual C++ 2008 or lower*/
+#if defined(_MSC_VER)
+#define WTF_COMPILER_MSVC 1
+#if _MSC_VER < 1400
+#define WTF_COMPILER_MSVC7_OR_LOWER 1
+#elif _MSC_VER < 1600
+#define WTF_COMPILER_MSVC9_OR_LOWER 1
+#endif
+#endif
+
+/* COMPILER(RVCT)  - ARM RealView Compilation Tools */
+/* COMPILER(RVCT4_OR_GREATER) - ARM RealView Compilation Tools 4.0 or greater */
+#if defined(__CC_ARM) || defined(__ARMCC__)
+#define WTF_COMPILER_RVCT 1
+#define RVCT_VERSION_AT_LEAST(major, minor, patch, build) (__ARMCC_VERSION >= (major * 100000 + minor * 10000 + patch * 1000 + build))
+#else
+/* Define this for !RVCT compilers, just so we can write things like RVCT_VERSION_AT_LEAST(3, 0, 0, 0). */
+#define RVCT_VERSION_AT_LEAST(major, minor, patch, build) 0
+#endif
+
+/* COMPILER(GCCE) - GNU Compiler Collection for Embedded */
+#if defined(__GCCE__)
+#define WTF_COMPILER_GCCE 1
+#define GCCE_VERSION (__GCCE__ * 10000 + __GCCE_MINOR__ * 100 + __GCCE_PATCHLEVEL__)
+#define GCCE_VERSION_AT_LEAST(major, minor, patch) (GCCE_VERSION >= (major * 10000 + minor * 100 + patch))
+#endif
+
+/* COMPILER(GCC) - GNU Compiler Collection */
+/* --gnu option of the RVCT compiler also defines __GNUC__ */
+#if defined(__GNUC__) && !COMPILER(RVCT)
+#define WTF_COMPILER_GCC 1
+#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
+#define GCC_VERSION_AT_LEAST(major, minor, patch) (GCC_VERSION >= (major * 10000 + minor * 100 + patch))
+#else
+/* Define this for !GCC compilers, just so we can write things like GCC_VERSION_AT_LEAST(4, 1, 0). */
+#define GCC_VERSION_AT_LEAST(major, minor, patch) 0
+#endif
+
+/* COMPILER(MINGW) - MinGW GCC */
+/* COMPILER(MINGW64) - mingw-w64 GCC - only used as additional check to exclude mingw.org specific functions */
+#if defined(__MINGW32__)
+#define WTF_COMPILER_MINGW 1
+#include <_mingw.h> /* private MinGW header */
+    #if defined(__MINGW64_VERSION_MAJOR) /* best way to check for mingw-w64 vs mingw.org */
+        #define WTF_COMPILER_MINGW64 1
+    #endif /* __MINGW64_VERSION_MAJOR */
+#endif /* __MINGW32__ */
+
+/* COMPILER(WINSCW) - CodeWarrior for Symbian emulator */
+#if defined(__WINSCW__)
+#define WTF_COMPILER_WINSCW 1
+/* cross-compiling, it is not really windows */
+#undef WIN32
+#undef _WIN32
+#endif
+
+/* COMPILER(INTEL) - Intel C++ Compiler */
+#if defined(__INTEL_COMPILER)
+#define WTF_COMPILER_INTEL 1
+#endif
+
+/* COMPILER(SUNCC) */
+#if defined(__SUNPRO_CC) || defined(__SUNPRO_C)
+#define WTF_COMPILER_SUNCC 1
+#endif
+
+
+/* ==== Comiler features ==== */
+
+
+/* ALWAYS_INLINE */
+
+#ifndef ALWAYS_INLINE
+#if COMPILER(GCC) && defined(NDEBUG) && !COMPILER(MINGW)
+#define ALWAYS_INLINE inline __attribute__((__always_inline__))
+#elif (COMPILER(MSVC) || COMPILER(RVCT)) && defined(NDEBUG)
+#define ALWAYS_INLINE __forceinline
+#else
+#define ALWAYS_INLINE inline
+#endif
+#endif
+
+
+/* NEVER_INLINE */
+
+#ifndef NEVER_INLINE
+#if COMPILER(GCC)
+#define NEVER_INLINE __attribute__((__noinline__))
+#elif COMPILER(RVCT)
+#define NEVER_INLINE __declspec(noinline)
+#else
+#define NEVER_INLINE
+#endif
+#endif
+
+
+/* UNLIKELY */
+
+#ifndef UNLIKELY
+#if COMPILER(GCC) || (RVCT_VERSION_AT_LEAST(3, 0, 0, 0) && defined(__GNUC__))
+#define UNLIKELY(x) __builtin_expect((x), 0)
+#else
+#define UNLIKELY(x) (x)
+#endif
+#endif
+
+
+/* LIKELY */
+
+#ifndef LIKELY
+#if COMPILER(GCC) || (RVCT_VERSION_AT_LEAST(3, 0, 0, 0) && defined(__GNUC__))
+#define LIKELY(x) __builtin_expect((x), 1)
+#else
+#define LIKELY(x) (x)
+#endif
+#endif
+
+
+/* NO_RETURN */
+
+
+#ifndef NO_RETURN
+#if COMPILER(GCC)
+#define NO_RETURN __attribute((__noreturn__))
+#elif COMPILER(MSVC) || COMPILER(RVCT)
+#define NO_RETURN __declspec(noreturn)
+#else
+#define NO_RETURN
+#endif
+#endif
+
+
+/* NO_RETURN_WITH_VALUE */
+
+#ifndef NO_RETURN_WITH_VALUE
+#if !COMPILER(MSVC)
+#define NO_RETURN_WITH_VALUE NO_RETURN
+#else
+#define NO_RETURN_WITH_VALUE
+#endif
+#endif
+
+
+/* WARN_UNUSED_RETURN */
+
+#if COMPILER(GCC)
+#define WARN_UNUSED_RETURN __attribute__ ((warn_unused_result))
+#else
+#define WARN_UNUSED_RETURN
+#endif
+
+
+#endif /* WTF_Compiler_h */

Modified: trunk/Source/_javascript_Core/wtf/Platform.h (92973 => 92974)


--- trunk/Source/_javascript_Core/wtf/Platform.h	2011-08-12 17:36:18 UTC (rev 92973)
+++ trunk/Source/_javascript_Core/wtf/Platform.h	2011-08-12 17:51:08 UTC (rev 92974)
@@ -28,6 +28,9 @@
 #ifndef WTF_Platform_h
 #define WTF_Platform_h
 
+/* Include compiler specific macros */
+#include "Compiler.h"
+
 /* ==== 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. ==== */
@@ -36,8 +39,6 @@
 
 /* ==== Platform adaptation macros: these describe properties of the target environment. ==== */
 
-/* COMPILER() - the compiler being used to build the project */
-#define COMPILER(WTF_FEATURE) (defined WTF_COMPILER_##WTF_FEATURE  && WTF_COMPILER_##WTF_FEATURE)
 /* CPU() - the target CPU architecture */
 #define CPU(WTF_FEATURE) (defined WTF_CPU_##WTF_FEATURE  && WTF_CPU_##WTF_FEATURE)
 /* HAVE() - specific system features (headers, functions or similar) that are present or not */
@@ -56,76 +57,6 @@
 
 
 
-/* ==== COMPILER() - the compiler being used to build the project ==== */
-
-/* COMPILER(MSVC) Microsoft Visual C++ */
-/* COMPILER(MSVC7_OR_LOWER) Microsoft Visual C++ 2003 or lower*/
-/* COMPILER(MSVC9_OR_LOWER) Microsoft Visual C++ 2008 or lower*/
-#if defined(_MSC_VER)
-#define WTF_COMPILER_MSVC 1
-#if _MSC_VER < 1400
-#define WTF_COMPILER_MSVC7_OR_LOWER 1
-#elif _MSC_VER < 1600
-#define WTF_COMPILER_MSVC9_OR_LOWER 1
-#endif
-#endif
-
-/* COMPILER(RVCT)  - ARM RealView Compilation Tools */
-/* COMPILER(RVCT4_OR_GREATER) - ARM RealView Compilation Tools 4.0 or greater */
-#if defined(__CC_ARM) || defined(__ARMCC__)
-#define WTF_COMPILER_RVCT 1
-#define RVCT_VERSION_AT_LEAST(major, minor, patch, build) (__ARMCC_VERSION >= (major * 100000 + minor * 10000 + patch * 1000 + build))
-#else
-/* Define this for !RVCT compilers, just so we can write things like RVCT_VERSION_AT_LEAST(3, 0, 0, 0). */
-#define RVCT_VERSION_AT_LEAST(major, minor, patch, build) 0
-#endif
-
-/* COMPILER(GCCE) - GNU Compiler Collection for Embedded */
-#if defined(__GCCE__)
-#define WTF_COMPILER_GCCE 1
-#define GCCE_VERSION (__GCCE__ * 10000 + __GCCE_MINOR__ * 100 + __GCCE_PATCHLEVEL__)
-#define GCCE_VERSION_AT_LEAST(major, minor, patch) (GCCE_VERSION >= (major * 10000 + minor * 100 + patch))
-#endif
-
-/* COMPILER(GCC) - GNU Compiler Collection */
-/* --gnu option of the RVCT compiler also defines __GNUC__ */
-#if defined(__GNUC__) && !COMPILER(RVCT)
-#define WTF_COMPILER_GCC 1
-#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
-#define GCC_VERSION_AT_LEAST(major, minor, patch) (GCC_VERSION >= (major * 10000 + minor * 100 + patch))
-#else
-/* Define this for !GCC compilers, just so we can write things like GCC_VERSION_AT_LEAST(4, 1, 0). */
-#define GCC_VERSION_AT_LEAST(major, minor, patch) 0
-#endif
-
-/* COMPILER(MINGW) - MinGW GCC */
-/* COMPILER(MINGW64) - mingw-w64 GCC - only used as additional check to exclude mingw.org specific functions */
-#if defined(__MINGW32__)
-#define WTF_COMPILER_MINGW 1
-#include <_mingw.h> /* private MinGW header */
-    #if defined(__MINGW64_VERSION_MAJOR) /* best way to check for mingw-w64 vs mingw.org */
-        #define WTF_COMPILER_MINGW64 1
-    #endif /* __MINGW64_VERSION_MAJOR */
-#endif /* __MINGW32__ */
-
-/* COMPILER(WINSCW) - CodeWarrior for Symbian emulator */
-#if defined(__WINSCW__)
-#define WTF_COMPILER_WINSCW 1
-/* cross-compiling, it is not really windows */
-#undef WIN32
-#undef _WIN32
-#endif
-
-/* COMPILER(INTEL) - Intel C++ Compiler */
-#if defined(__INTEL_COMPILER)
-#define WTF_COMPILER_INTEL 1
-#endif
-
-/* COMPILER(SUNCC) */
-#if defined(__SUNPRO_CC) || defined(__SUNPRO_C)
-#define WTF_COMPILER_SUNCC 1
-#endif
-
 /* ==== CPU() - the target CPU architecture ==== */
 
 /* This also defines CPU(BIG_ENDIAN) or CPU(MIDDLE_ENDIAN) or neither, as appropriate. */
@@ -1161,12 +1092,6 @@
 #define WTF_USE_PROTECTION_SPACE_AUTH_CALLBACK 1
 #endif
 
-#if COMPILER(GCC)
-#define WARN_UNUSED_RETURN __attribute__ ((warn_unused_result))
-#else
-#define WARN_UNUSED_RETURN
-#endif
-
 #if !ENABLE(NETSCAPE_PLUGIN_API) || (ENABLE(NETSCAPE_PLUGIN_API) && ((OS(UNIX) && (PLATFORM(QT) || PLATFORM(WX))) || PLATFORM(GTK)))
 #define ENABLE_PLUGIN_PACKAGE_SIMPLE_HASH 1
 #endif

Modified: trunk/Source/_javascript_Glue/ChangeLog (92973 => 92974)


--- trunk/Source/_javascript_Glue/ChangeLog	2011-08-12 17:36:18 UTC (rev 92973)
+++ trunk/Source/_javascript_Glue/ChangeLog	2011-08-12 17:51:08 UTC (rev 92974)
@@ -1,3 +1,12 @@
+2011-08-12  Sam Weinig  <[email protected]>
+
+        Move compiler specific macros to their own header
+        https://bugs.webkit.org/show_bug.cgi?id=66119
+
+        Reviewed by Anders Carlsson.
+
+        * ForwardingHeaders/wtf/Compiler.h: Added.
+
 2011-08-09  Mark Hahnenberg  <[email protected]>
 
         Add ParentClass typedef in all JSC classes

Added: trunk/Source/_javascript_Glue/ForwardingHeaders/wtf/Compiler.h (0 => 92974)


--- trunk/Source/_javascript_Glue/ForwardingHeaders/wtf/Compiler.h	                        (rev 0)
+++ trunk/Source/_javascript_Glue/ForwardingHeaders/wtf/Compiler.h	2011-08-12 17:51:08 UTC (rev 92974)
@@ -0,0 +1 @@
+#include <_javascript_Core/Compiler.h>

Modified: trunk/Source/WebCore/ChangeLog (92973 => 92974)


--- trunk/Source/WebCore/ChangeLog	2011-08-12 17:36:18 UTC (rev 92973)
+++ trunk/Source/WebCore/ChangeLog	2011-08-12 17:51:08 UTC (rev 92974)
@@ -1,3 +1,12 @@
+2011-08-12  Sam Weinig  <[email protected]>
+
+        Move compiler specific macros to their own header
+        https://bugs.webkit.org/show_bug.cgi?id=66119
+
+        Reviewed by Anders Carlsson.
+
+        * ForwardingHeaders/wtf/Compiler.h: Added.
+
 2011-08-12  No'am Rosenthal  <[email protected]>
 
         [Qt][REGRESSION] composited content doesn't render since r92651

Added: trunk/Source/WebCore/ForwardingHeaders/wtf/Compiler.h (0 => 92974)


--- trunk/Source/WebCore/ForwardingHeaders/wtf/Compiler.h	                        (rev 0)
+++ trunk/Source/WebCore/ForwardingHeaders/wtf/Compiler.h	2011-08-12 17:51:08 UTC (rev 92974)
@@ -0,0 +1,4 @@
+#ifndef WebCore_FWD_Compiler_h
+#define WebCore_FWD_Compiler_h
+#include <_javascript_Core/Compiler.h>
+#endif

Modified: trunk/Tools/ChangeLog (92973 => 92974)


--- trunk/Tools/ChangeLog	2011-08-12 17:36:18 UTC (rev 92973)
+++ trunk/Tools/ChangeLog	2011-08-12 17:51:08 UTC (rev 92974)
@@ -1,3 +1,12 @@
+2011-08-12  Sam Weinig  <[email protected]>
+
+        Move compiler specific macros to their own header
+        https://bugs.webkit.org/show_bug.cgi?id=66119
+
+        Reviewed by Anders Carlsson.
+
+        * DumpRenderTree/ForwardingHeaders/wtf/Compiler.h: Added.
+
 2011-08-11  Dimitri Glazkov  <[email protected]>
 
         Add a way to extend DOM objects in garden-o-matic.

Added: trunk/Tools/DumpRenderTree/ForwardingHeaders/wtf/Compiler.h (0 => 92974)


--- trunk/Tools/DumpRenderTree/ForwardingHeaders/wtf/Compiler.h	                        (rev 0)
+++ trunk/Tools/DumpRenderTree/ForwardingHeaders/wtf/Compiler.h	2011-08-12 17:51:08 UTC (rev 92974)
@@ -0,0 +1 @@
+#include <_javascript_Core/Compiler.h>
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to