Changeset 92974 in webkit


Ignore:
Timestamp:
Aug 12, 2011, 10:51:08 AM (14 years ago)
Author:
weinig@apple.com
Message:

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

Reviewed by Anders Carlsson.

Source/JavaScriptCore:

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/JavaScriptGlue:

  • ForwardingHeaders/wtf/Compiler.h: Added.

Source/WebCore:

  • ForwardingHeaders/wtf/Compiler.h: Added.

Tools:

  • DumpRenderTree/ForwardingHeaders/wtf/Compiler.h: Added.
Location:
trunk
Files:
4 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r92911 r92974  
     12011-08-12  Sam Weinig  <sam@webkit.org>
     2
     3        Move compiler specific macros to their own header
     4        https://bugs.webkit.org/show_bug.cgi?id=66119
     5
     6        Reviewed by Anders Carlsson.
     7
     8        * JavaScriptCore.gypi:
     9        * JavaScriptCore.vcproj/WTF/WTF.vcproj:
     10        * JavaScriptCore.xcodeproj/project.pbxproj:
     11        * wtf/CMakeLists.txt:
     12        Add Compiler.h
     13
     14        * wtf/AlwaysInline.h:
     15        Move the contents of this file (which no longer was just about ALWAYS_INLINE) to
     16        Compiler.h.  We can remove this file in a later commit.
     17
     18        * wtf/Compiler.h: Added.
     19        Put all compiler specific checks and features in this file.
     20
     21        * wtf/Platform.h:
     22        Move COMPILER macro and definitions (and the odd WARN_UNUSED_RETURN compiler feature)
     23        to Compiler.h.  Include Compiler.h since it is necessary.
     24
    1252011-08-11  Filip Pizlo  <fpizlo@apple.com>
    226
  • trunk/Source/JavaScriptCore/JavaScriptCore.gypi

    r92536 r92974  
    141141            'wtf/BumpPointerAllocator.h',
    142142            'wtf/ByteArray.h',
     143            'wtf/Compiler.h',
    143144            'wtf/Complex.h',
    144145            'wtf/CrossThreadRefCounted.h',
  • trunk/Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTF.vcproj

    r92254 r92974  
    566566                </File>
    567567                <File
     568                        RelativePath="..\..\wtf\Compiler.h"
     569                        >
     570                </File>
     571                <File
    568572                        RelativePath="..\..\wtf\Complex.h"
    569573                        >
  • trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r92254 r92974  
    571571                BC5F7BBF11823B590052C02C /* ThreadingPrimitives.h in Headers */ = {isa = PBXBuildFile; fileRef = BC5F7BBC11823B590052C02C /* ThreadingPrimitives.h */; settings = {ATTRIBUTES = (Private, ); }; };
    572572                BC5F7BC011823B590052C02C /* ThreadSafeRefCounted.h in Headers */ = {isa = PBXBuildFile; fileRef = BC5F7BBD11823B590052C02C /* ThreadSafeRefCounted.h */; settings = {ATTRIBUTES = (Private, ); }; };
     573                BC66BAE413F492CC00C23FAE /* Compiler.h in Headers */ = {isa = PBXBuildFile; fileRef = BC66BAE213F4928F00C23FAE /* Compiler.h */; settings = {ATTRIBUTES = (Private, ); }; };
    573574                BC6AAAE50E1F426500AD87D8 /* ClassInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = BC6AAAE40E1F426500AD87D8 /* ClassInfo.h */; settings = {ATTRIBUTES = (Private, ); }; };
    574575                BC756FC90E2031B200DE7D12 /* JSGlobalObjectFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = BC756FC70E2031B200DE7D12 /* JSGlobalObjectFunctions.h */; };
     
    12121213                BC5F7BBC11823B590052C02C /* ThreadingPrimitives.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThreadingPrimitives.h; sourceTree = "<group>"; };
    12131214                BC5F7BBD11823B590052C02C /* ThreadSafeRefCounted.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThreadSafeRefCounted.h; sourceTree = "<group>"; };
     1215                BC66BAE213F4928F00C23FAE /* Compiler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Compiler.h; sourceTree = "<group>"; };
    12141216                BC6AAAE40E1F426500AD87D8 /* ClassInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ClassInfo.h; sourceTree = "<group>"; };
    12151217                BC756FC60E2031B200DE7D12 /* JSGlobalObjectFunctions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSGlobalObjectFunctions.cpp; sourceTree = "<group>"; };
     
    16511653                        isa = PBXGroup;
    16521654                        children = (
     1655                                06D358A00DAAD9C4003B174E /* mac */,
     1656                                8656573E115BE35200291F40 /* text */,
     1657                                E195678D09E7CF1200B89D13 /* unicode */,
    16531658                                A1D764511354448B00C5C7C0 /* Alignment.h */,
    1654                                 A7C40C07130B057D00D002A1 /* BlockStack.h */,
    1655                                 5135FAD512D26856003C083B /* Decoder.h */,
    1656                                 5135FAD612D26856003C083B /* Encoder.h */,
    16571659                                93AA4F770957251F0084B3A7 /* AlwaysInline.h */,
    16581660                                938C4F690CA06BC700D9310A /* ASCIICType.h */,
     
    16621664                                E1A596370DE3E1C300C17E37 /* AVLTree.h */,
    16631665                                DD377CBB12072C18006A2517 /* Bitmap.h */,
     1666                                A7C40C07130B057D00D002A1 /* BlockStack.h */,
     1667                                E4D8CE9B12FC42E100BC9F5A /* BloomFilter.h */,
    16641668                                86676D4D11FED55D004B6863 /* BumpPointerAllocator.h */,
    16651669                                A7A1F7AA0F252B3C00E184E2 /* ByteArray.cpp */,
    16661670                                A7A1F7AB0F252B3C00E184E2 /* ByteArray.h */,
     1671                                BC66BAE213F4928F00C23FAE /* Compiler.h */,
    16671672                                FDA15C1612B03028003A583A /* Complex.h */,
    16681673                                0BDFFAD40FC6171000D69EF4 /* CrossThreadRefCounted.h */,
     
    16751680                                0F29479B126E698C00B3ABF5 /* DecimalNumber.cpp */,
    16761681                                862AF4B512239C7B0024E5B8 /* DecimalNumber.h */,
     1682                                5135FAD512D26856003C083B /* Decoder.h */,
    16771683                                5186111D0CC824830081412B /* Deque.h */,
    16781684                                938C4F6B0CA06BCE00D9310A /* DisallowCType.h */,
     
    16821688                                D75AF59512F8CB9500FC0ADF /* DynamicAnnotations.cpp */,
    16831689                                D75AF59612F8CB9500FC0ADF /* DynamicAnnotations.h */,
     1690                                5135FAD612D26856003C083B /* Encoder.h */,
    16841691                                E48E0F2C0F82151700A8CA37 /* FastAllocBase.h */,
    16851692                                65E217B908E7EECC0023E5F6 /* FastMalloc.cpp */,
     
    17001707                                148A1626095D16BB00666D0D /* ListRefPtr.h */,
    17011708                                E1EE79270D6C964500FEA3BA /* Locker.h */,
    1702                                 06D358A00DAAD9C4003B174E /* mac */,
    17031709                                06D358A20DAAD9C4003B174E /* MainThread.cpp */,
    17041710                                06D358A30DAAD9C4003B174E /* MainThread.h */,
     
    17271733                                14B3EF0312BC24DD00D29EFF /* PageBlock.h */,
    17281734                                8690231412092D5C00630AF9 /* PageReservation.h */,
    1729                                 BCFBE695122560E800309E9D /* PassOwnArrayPtr.h */,
    1730                                 44DD48520FAEA85000D6B4EB /* PassOwnPtr.h */,
    1731                                 6580F795094070560082C219 /* PassRefPtr.h */,
    1732                                 651DCA02136A6FAB00F74194 /* PassTraits.h */,
    17331735                                7934BB761361979300CB99A1 /* ParallelJobs.h */,
    17341736                                7934BB771361979300CB99A1 /* ParallelJobsGeneric.cpp */,
     
    17361738                                7934BB791361979300CB99A1 /* ParallelJobsLibdispatch.h */,
    17371739                                7934BB7A1361979300CB99A1 /* ParallelJobsOpenMP.h */,
     1740                                BCFBE695122560E800309E9D /* PassOwnArrayPtr.h */,
     1741                                44DD48520FAEA85000D6B4EB /* PassOwnPtr.h */,
     1742                                6580F795094070560082C219 /* PassRefPtr.h */,
     1743                                651DCA02136A6FAB00F74194 /* PassTraits.h */,
    17381744                                65D6D87E09B5A32E0002E4D7 /* Platform.h */,
    17391745                                A7D649A91015224E009B2E1B /* PossiblyNull.h */,
    1740                                 E4D8CE9B12FC42E100BC9F5A /* BloomFilter.h */,
    17411746                                088FA5B90EF76D4300578E6F /* RandomNumber.cpp */,
    17421747                                088FA5BA0EF76D4300578E6F /* RandomNumber.h */,
     
    17491754                                51F648D60BB4E2CA0033D760 /* RetainPtr.h */,
    17501755                                969A07290ED1CE6900F1F681 /* SegmentedVector.h */,
     1756                                A7C40C08130B057D00D002A1 /* SentinelLinkedList.h */,
    17511757                                76FB9F1012E851960051A2EB /* SHA1.cpp */,
    17521758                                76FB9F0E12E851860051A2EB /* SHA1.h */,
    1753                                 A7C40C08130B057D00D002A1 /* SentinelLinkedList.h */,
    17541759                                A7C40C09130B057D00D002A1 /* SinglyLinkedList.h */,
    17551760                                0BF28A2811A33DC300638F84 /* SizeLimits.cpp */,
     
    17651770                                6541BD7008E80A17002CBEE7 /* TCSystemAlloc.cpp */,
    17661771                                6541BD7108E80A17002CBEE7 /* TCSystemAlloc.h */,
    1767                                 8656573E115BE35200291F40 /* text */,
    17681772                                18BAB52710DADFCD000D945B /* ThreadIdentifierDataPthreads.cpp */,
    17691773                                18BAB52810DADFCD000D945B /* ThreadIdentifierDataPthreads.h */,
     
    17721776                                BC5F7BBC11823B590052C02C /* ThreadingPrimitives.h */,
    17731777                                E1EE793C0D6C9B9200FEA3BA /* ThreadingPthreads.cpp */,
     1778                                0BAC949E1338728400CF135B /* ThreadRestrictionVerifier.h */,
    17741779                                BC5F7BBD11823B590052C02C /* ThreadSafeRefCounted.h */,
    17751780                                E1B7C8BD0DA3A3360074B0DC /* ThreadSpecific.h */,
    1776                                 0BAC949E1338728400CF135B /* ThreadRestrictionVerifier.h */,
    17771781                                0B330C260F38C62300692DE3 /* TypeTraits.cpp */,
    17781782                                0B4D7E620F319AC800AD7E58 /* TypeTraits.h */,
    1779                                 E195678D09E7CF1200B89D13 /* unicode */,
    17801783                                935AF46B09E9D9DB00ACD1D8 /* UnusedParam.h */,
    17811784                                E17FF770112131D200076A19 /* ValueCheck.h */,
     
    25802583                                866739D213BFDE710023D87C /* BigInteger.h in Headers */,
    25812584                                866739D313BFDE710023D87C /* Uint16WithFraction.h in Headers */,
     2585                                BC66BAE413F492CC00C23FAE /* Compiler.h in Headers */,
    25822586                        );
    25832587                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/Source/JavaScriptCore/wtf/AlwaysInline.h

    r75447 r92974  
    1919 */
    2020
     21/* This file is no longer necessary, since all the functionality has been moved to Compiler.h. */
     22
    2123#include "Platform.h"
    22 
    23 #ifndef ALWAYS_INLINE
    24 #if COMPILER(GCC) && defined(NDEBUG) && !COMPILER(MINGW)
    25 #define ALWAYS_INLINE inline __attribute__((__always_inline__))
    26 #elif (COMPILER(MSVC) || COMPILER(RVCT)) && defined(NDEBUG)
    27 #define ALWAYS_INLINE __forceinline
    28 #else
    29 #define ALWAYS_INLINE inline
    30 #endif
    31 #endif
    32 
    33 #ifndef NEVER_INLINE
    34 #if COMPILER(GCC)
    35 #define NEVER_INLINE __attribute__((__noinline__))
    36 #elif COMPILER(RVCT)
    37 #define NEVER_INLINE __declspec(noinline)
    38 #else
    39 #define NEVER_INLINE
    40 #endif
    41 #endif
    42 
    43 #ifndef UNLIKELY
    44 #if COMPILER(GCC) || (RVCT_VERSION_AT_LEAST(3, 0, 0, 0) && defined(__GNUC__))
    45 #define UNLIKELY(x) __builtin_expect((x), 0)
    46 #else
    47 #define UNLIKELY(x) (x)
    48 #endif
    49 #endif
    50 
    51 #ifndef LIKELY
    52 #if COMPILER(GCC) || (RVCT_VERSION_AT_LEAST(3, 0, 0, 0) && defined(__GNUC__))
    53 #define LIKELY(x) __builtin_expect((x), 1)
    54 #else
    55 #define LIKELY(x) (x)
    56 #endif
    57 #endif
    58 
    59 #ifndef NO_RETURN
    60 #if COMPILER(GCC)
    61 #define NO_RETURN __attribute((__noreturn__))
    62 #elif COMPILER(MSVC) || COMPILER(RVCT)
    63 #define NO_RETURN __declspec(noreturn)
    64 #else
    65 #define NO_RETURN
    66 #endif
    67 #endif
    68 
    69 #ifndef NO_RETURN_WITH_VALUE
    70 #if !COMPILER(MSVC)
    71 #define NO_RETURN_WITH_VALUE NO_RETURN
    72 #else
    73 #define NO_RETURN_WITH_VALUE
    74 #endif
    75 #endif
  • trunk/Source/JavaScriptCore/wtf/CMakeLists.txt

    r92254 r92974  
    99    BumpPointerAllocator.h
    1010    ByteArray.h
     11    Compiler.h
    1112    Complex.h
    1213    CrossThreadRefCounted.h
  • trunk/Source/JavaScriptCore/wtf/Platform.h

    r92224 r92974  
    2929#define WTF_Platform_h
    3030
     31/* Include compiler specific macros */
     32#include "Compiler.h"
     33
    3134/* ==== PLATFORM handles OS, operating environment, graphics API, and
    3235   CPU. This macro will be phased out in favor of platform adaptation
     
    3740/* ==== Platform adaptation macros: these describe properties of the target environment. ==== */
    3841
    39 /* COMPILER() - the compiler being used to build the project */
    40 #define COMPILER(WTF_FEATURE) (defined WTF_COMPILER_##WTF_FEATURE  && WTF_COMPILER_##WTF_FEATURE)
    4142/* CPU() - the target CPU architecture */
    4243#define CPU(WTF_FEATURE) (defined WTF_CPU_##WTF_FEATURE  && WTF_CPU_##WTF_FEATURE)
     
    5657
    5758
    58 
    59 /* ==== COMPILER() - the compiler being used to build the project ==== */
    60 
    61 /* COMPILER(MSVC) Microsoft Visual C++ */
    62 /* COMPILER(MSVC7_OR_LOWER) Microsoft Visual C++ 2003 or lower*/
    63 /* COMPILER(MSVC9_OR_LOWER) Microsoft Visual C++ 2008 or lower*/
    64 #if defined(_MSC_VER)
    65 #define WTF_COMPILER_MSVC 1
    66 #if _MSC_VER < 1400
    67 #define WTF_COMPILER_MSVC7_OR_LOWER 1
    68 #elif _MSC_VER < 1600
    69 #define WTF_COMPILER_MSVC9_OR_LOWER 1
    70 #endif
    71 #endif
    72 
    73 /* COMPILER(RVCT)  - ARM RealView Compilation Tools */
    74 /* COMPILER(RVCT4_OR_GREATER) - ARM RealView Compilation Tools 4.0 or greater */
    75 #if defined(__CC_ARM) || defined(__ARMCC__)
    76 #define WTF_COMPILER_RVCT 1
    77 #define RVCT_VERSION_AT_LEAST(major, minor, patch, build) (__ARMCC_VERSION >= (major * 100000 + minor * 10000 + patch * 1000 + build))
    78 #else
    79 /* Define this for !RVCT compilers, just so we can write things like RVCT_VERSION_AT_LEAST(3, 0, 0, 0). */
    80 #define RVCT_VERSION_AT_LEAST(major, minor, patch, build) 0
    81 #endif
    82 
    83 /* COMPILER(GCCE) - GNU Compiler Collection for Embedded */
    84 #if defined(__GCCE__)
    85 #define WTF_COMPILER_GCCE 1
    86 #define GCCE_VERSION (__GCCE__ * 10000 + __GCCE_MINOR__ * 100 + __GCCE_PATCHLEVEL__)
    87 #define GCCE_VERSION_AT_LEAST(major, minor, patch) (GCCE_VERSION >= (major * 10000 + minor * 100 + patch))
    88 #endif
    89 
    90 /* COMPILER(GCC) - GNU Compiler Collection */
    91 /* --gnu option of the RVCT compiler also defines __GNUC__ */
    92 #if defined(__GNUC__) && !COMPILER(RVCT)
    93 #define WTF_COMPILER_GCC 1
    94 #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
    95 #define GCC_VERSION_AT_LEAST(major, minor, patch) (GCC_VERSION >= (major * 10000 + minor * 100 + patch))
    96 #else
    97 /* Define this for !GCC compilers, just so we can write things like GCC_VERSION_AT_LEAST(4, 1, 0). */
    98 #define GCC_VERSION_AT_LEAST(major, minor, patch) 0
    99 #endif
    100 
    101 /* COMPILER(MINGW) - MinGW GCC */
    102 /* COMPILER(MINGW64) - mingw-w64 GCC - only used as additional check to exclude mingw.org specific functions */
    103 #if defined(__MINGW32__)
    104 #define WTF_COMPILER_MINGW 1
    105 #include <_mingw.h> /* private MinGW header */
    106     #if defined(__MINGW64_VERSION_MAJOR) /* best way to check for mingw-w64 vs mingw.org */
    107         #define WTF_COMPILER_MINGW64 1
    108     #endif /* __MINGW64_VERSION_MAJOR */
    109 #endif /* __MINGW32__ */
    110 
    111 /* COMPILER(WINSCW) - CodeWarrior for Symbian emulator */
    112 #if defined(__WINSCW__)
    113 #define WTF_COMPILER_WINSCW 1
    114 /* cross-compiling, it is not really windows */
    115 #undef WIN32
    116 #undef _WIN32
    117 #endif
    118 
    119 /* COMPILER(INTEL) - Intel C++ Compiler */
    120 #if defined(__INTEL_COMPILER)
    121 #define WTF_COMPILER_INTEL 1
    122 #endif
    123 
    124 /* COMPILER(SUNCC) */
    125 #if defined(__SUNPRO_CC) || defined(__SUNPRO_C)
    126 #define WTF_COMPILER_SUNCC 1
    127 #endif
    12859
    12960/* ==== CPU() - the target CPU architecture ==== */
     
    11621093#endif
    11631094
    1164 #if COMPILER(GCC)
    1165 #define WARN_UNUSED_RETURN __attribute__ ((warn_unused_result))
    1166 #else
    1167 #define WARN_UNUSED_RETURN
    1168 #endif
    1169 
    11701095#if !ENABLE(NETSCAPE_PLUGIN_API) || (ENABLE(NETSCAPE_PLUGIN_API) && ((OS(UNIX) && (PLATFORM(QT) || PLATFORM(WX))) || PLATFORM(GTK)))
    11711096#define ENABLE_PLUGIN_PACKAGE_SIMPLE_HASH 1
  • trunk/Source/JavaScriptGlue/ChangeLog

    r92706 r92974  
     12011-08-12  Sam Weinig  <sam@webkit.org>
     2
     3        Move compiler specific macros to their own header
     4        https://bugs.webkit.org/show_bug.cgi?id=66119
     5
     6        Reviewed by Anders Carlsson.
     7
     8        * ForwardingHeaders/wtf/Compiler.h: Added.
     9
    1102011-08-09  Mark Hahnenberg  <mhahnenberg@apple.com>
    211
  • trunk/Source/WebCore/ChangeLog

    r92973 r92974  
     12011-08-12  Sam Weinig  <sam@webkit.org>
     2
     3        Move compiler specific macros to their own header
     4        https://bugs.webkit.org/show_bug.cgi?id=66119
     5
     6        Reviewed by Anders Carlsson.
     7
     8        * ForwardingHeaders/wtf/Compiler.h: Added.
     9
    1102011-08-12  No'am Rosenthal  <noam.rosenthal@nokia.com>
    211
  • trunk/Tools/ChangeLog

    r92972 r92974  
     12011-08-12  Sam Weinig  <sam@webkit.org>
     2
     3        Move compiler specific macros to their own header
     4        https://bugs.webkit.org/show_bug.cgi?id=66119
     5
     6        Reviewed by Anders Carlsson.
     7
     8        * DumpRenderTree/ForwardingHeaders/wtf/Compiler.h: Added.
     9
    1102011-08-11  Dimitri Glazkov  <dglazkov@chromium.org>
    211
Note: See TracChangeset for help on using the changeset viewer.