Changeset 40678 in webkit for trunk/JavaScriptCore


Ignore:
Timestamp:
Feb 5, 2009, 2:07:35 PM (16 years ago)
Author:
[email protected]
Message:

2009-02-05 David Levin <[email protected]>

Reviewed by Darin Adler.

Bug 23713: COMPILE_ASSERTS should be moved out of TypeTraits.h and into .cpp file
<https://bugs.webkit.org/show_bug.cgi?id=23713>

  • wtf/HashTraits.h: Remove unnecessary header file that I missed when moving out the type traits form this file.
  • wtf/TypeTraits.cpp: Added. (WTF::):
  • wtf/TypeTraits.h: Moved the compile asserts into TypeTraits.cpp file.
Location:
trunk/JavaScriptCore
Files:
1 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r40663 r40678  
     12009-02-05  David Levin  <[email protected]>
     2
     3        Reviewed by Darin Adler.
     4
     5        Bug 23713: COMPILE_ASSERTS should be moved out of TypeTraits.h and into .cpp file
     6        <https://bugs.webkit.org/show_bug.cgi?id=23713>
     7
     8        * GNUmakefile.am:
     9        * JavaScriptCore.pri:
     10        * JavaScriptCore.scons:
     11        * JavaScriptCore.vcproj/WTF/WTF.vcproj:
     12        * JavaScriptCore.xcodeproj/project.pbxproj:
     13        * JavaScriptCoreSources.bkl:
     14
     15        * wtf/HashTraits.h:
     16        Remove unnecessary header file that I missed when moving out the type traits form this file.
     17
     18        * wtf/TypeTraits.cpp: Added.
     19        (WTF::):
     20        * wtf/TypeTraits.h:
     21        Moved the compile asserts into TypeTraits.cpp file.
     22
    1232009-02-04  Gavin Barraclough  <[email protected]>
    224
  • trunk/JavaScriptCore/GNUmakefile.am

    r40399 r40678  
    248248        JavaScriptCore/wtf/ThreadingGtk.cpp \
    249249        JavaScriptCore/wtf/ThreadingPthreads.cpp \
     250        JavaScriptCore/wtf/TypeTraits.cpp \
    250251        JavaScriptCore/wtf/TypeTraits.h \
    251252        JavaScriptCore/wtf/UnusedParam.h \
  • trunk/JavaScriptCore/JavaScriptCore.pri

    r40332 r40678  
    5252    wtf/RandomNumber.cpp \
    5353    wtf/RefCountedLeakCounter.cpp \
     54    wtf/TypeTraits.cpp \
    5455    wtf/unicode/CollatorDefault.cpp \
    5556    wtf/unicode/icu/CollatorICU.cpp \
  • trunk/JavaScriptCore/JavaScriptCore.scons

    r40332 r40678  
    150150    'wtf/RefCountedLeakCounter.cpp',
    151151    'wtf/Threading.cpp',
     152    'wtf/TypeTraits.cpp',
    152153    'wtf/dtoa.cpp',
    153154]
  • trunk/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTF.vcproj

    r40399 r40678  
    460460                </File>
    461461                <File
     462                        RelativePath="..\..\wtf\TypeTraits.cpp"
     463                        >
     464                </File>
     465                <File
    462466                        RelativePath="..\..\wtf\TypeTraits.h"
    463467                        >
  • trunk/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r40660 r40678  
    4141                08E279E90EF83B10007DB523 /* RandomNumberSeed.h in Headers */ = {isa = PBXBuildFile; fileRef = 08E279E80EF83B10007DB523 /* RandomNumberSeed.h */; };
    4242                0B1F921D0F1753500036468E /* PtrAndFlags.h in Headers */ = {isa = PBXBuildFile; fileRef = 0B1F921B0F17502D0036468E /* PtrAndFlags.h */; settings = {ATTRIBUTES = (Private, ); }; };
     43                0B330C270F38C62300692DE3 /* TypeTraits.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0B330C260F38C62300692DE3 /* TypeTraits.cpp */; };
    4344                0B4D7E630F319AC800AD7E58 /* TypeTraits.h in Headers */ = {isa = PBXBuildFile; fileRef = 0B4D7E620F319AC800AD7E58 /* TypeTraits.h */; settings = {ATTRIBUTES = (Private, ); }; };
    4445                140B7D1D0DC69AF7009C42B8 /* JSActivation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14DA818F0D99FD2000B0A4FB /* JSActivation.cpp */; };
     
    431432                08E279E80EF83B10007DB523 /* RandomNumberSeed.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RandomNumberSeed.h; sourceTree = "<group>"; };
    432433                0B1F921B0F17502D0036468E /* PtrAndFlags.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PtrAndFlags.h; sourceTree = "<group>"; };
     434                0B330C260F38C62300692DE3 /* TypeTraits.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TypeTraits.cpp; sourceTree = "<group>"; };
    433435                0B4D7E620F319AC800AD7E58 /* TypeTraits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TypeTraits.h; sourceTree = "<group>"; };
    434436                140D17D60E8AD4A9000CD17D /* JSBasePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSBasePrivate.h; sourceTree = "<group>"; };
     
    10931095                        isa = PBXGroup;
    10941096                        children = (
     1097                                0B330C260F38C62300692DE3 /* TypeTraits.cpp */,
    10951098                                06D358A00DAAD9C4003B174E /* mac */,
    10961099                                E195678D09E7CF1200B89D13 /* unicode */,
     
    20802083                                A7A1F7AC0F252B3C00E184E2 /* ByteArray.cpp in Sources */,
    20812084                                BC3135650F302FA3003DFD3A /* DebuggerActivation.cpp in Sources */,
     2085                                0B330C270F38C62300692DE3 /* TypeTraits.cpp in Sources */,
    20822086                        );
    20832087                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/JavaScriptCore/JavaScriptCoreSources.bkl

    r40332 r40678  
    170170        wtf/Threading.cpp
    171171        wtf/ThreadingNone.cpp
     172        wtf/TypeTraits.cpp
    172173        wtf/wx/MainThreadWx.cpp
    173174        wtf/unicode/CollatorDefault.cpp
  • trunk/JavaScriptCore/wtf/HashTraits.h

    r40399 r40678  
    2222#define WTF_HashTraits_h
    2323
    24 #include "Assertions.h"
    2524#include "HashFunctions.h"
    2625#include "TypeTraits.h"
  • trunk/JavaScriptCore/wtf/TypeTraits.h

    r40418 r40678  
    2323#define TypeTraits_h
    2424
    25 #include "Assertions.h"
    26 
    2725namespace WTF {
    2826
     
    4038    //   RemoveConstVolatile<T>::Type
    4139    //
    42     //   Each is followed by COMPILE_ASSERT's which illustrate their usage and what they do.
     40    //   COMPILE_ASSERT's in TypeTraits.cpp illustrate their usage and what they do.
    4341
    4442    template<typename T> struct IsInteger           { static const bool value = false; };
     
    5957#endif
    6058
    61     COMPILE_ASSERT(IsInteger<bool>::value, WTF_IsInteger_bool_true);
    62     COMPILE_ASSERT(IsInteger<char>::value, WTF_IsInteger_char_true);
    63     COMPILE_ASSERT(IsInteger<signed char>::value, WTF_IsInteger_signed_char_true);
    64     COMPILE_ASSERT(IsInteger<unsigned char>::value, WTF_IsInteger_unsigned_char_true);
    65     COMPILE_ASSERT(IsInteger<short>::value, WTF_IsInteger_short_true);
    66     COMPILE_ASSERT(IsInteger<unsigned short>::value, WTF_IsInteger_unsigned_short_true);
    67     COMPILE_ASSERT(IsInteger<int>::value, WTF_IsInteger_int_true);
    68     COMPILE_ASSERT(IsInteger<unsigned int>::value, WTF_IsInteger_unsigned_int_true);
    69     COMPILE_ASSERT(IsInteger<long>::value, WTF_IsInteger_long_true);
    70     COMPILE_ASSERT(IsInteger<unsigned long>::value, WTF_IsInteger_unsigned_long_true);
    71     COMPILE_ASSERT(IsInteger<long long>::value, WTF_IsInteger_long_long_true);
    72     COMPILE_ASSERT(IsInteger<unsigned long long>::value, WTF_IsInteger_unsigned_long_long_true);
    73 #if !COMPILER(MSVC) || defined(_NATIVE_WCHAR_T_DEFINED)
    74     COMPILE_ASSERT(IsInteger<wchar_t>::value, WTF_IsInteger_wchar_t_true);
    75 #endif
    76     COMPILE_ASSERT(!IsInteger<char*>::value, WTF_IsInteger_char_pointer_false);
    77     COMPILE_ASSERT(!IsInteger<const char*>::value, WTF_IsInteger_const_char_pointer_false);
    78     COMPILE_ASSERT(!IsInteger<volatile char*>::value, WTF_IsInteger_volatile_char_pointer_false);
    79     COMPILE_ASSERT(!IsInteger<double>::value, WTF_IsInteger_double_false);
    80     COMPILE_ASSERT(!IsInteger<float>::value, WTF_IsInteger_float_false);
    81 
    8259    // IsPod is misnamed as it doesn't cover all plain old data (pod) types.
    8360    // Specifically, it doesn't allow for enums or for structs.
     
    8764    template <> struct IsPod<long double>        { static const bool value = true; };
    8865    template <typename P> struct IsPod<P*>       { static const bool value = true; };
    89 
    90     COMPILE_ASSERT(IsPod<bool>::value, WTF_IsPod_bool_true);
    91     COMPILE_ASSERT(IsPod<char>::value, WTF_IsPod_char_true);
    92     COMPILE_ASSERT(IsPod<signed char>::value, WTF_IsPod_signed_char_true);
    93     COMPILE_ASSERT(IsPod<unsigned char>::value, WTF_IsPod_unsigned_char_true);
    94     COMPILE_ASSERT(IsPod<short>::value, WTF_IsPod_short_true);
    95     COMPILE_ASSERT(IsPod<unsigned short>::value, WTF_IsPod_unsigned_short_true);
    96     COMPILE_ASSERT(IsPod<int>::value, WTF_IsPod_int_true);
    97     COMPILE_ASSERT(IsPod<unsigned int>::value, WTF_IsPod_unsigned_int_true);
    98     COMPILE_ASSERT(IsPod<long>::value, WTF_IsPod_long_true);
    99     COMPILE_ASSERT(IsPod<unsigned long>::value, WTF_IsPod_unsigned_long_true);
    100     COMPILE_ASSERT(IsPod<long long>::value, WTF_IsPod_long_long_true);
    101     COMPILE_ASSERT(IsPod<unsigned long long>::value, WTF_IsPod_unsigned_long_long_true);
    102 #if !COMPILER(MSVC) || defined(_NATIVE_WCHAR_T_DEFINED)
    103     COMPILE_ASSERT(IsPod<wchar_t>::value, WTF_IsPod_wchar_t_true);
    104 #endif
    105     COMPILE_ASSERT(IsPod<char*>::value, WTF_IsPod_char_pointer_true);
    106     COMPILE_ASSERT(IsPod<const char*>::value, WTF_IsPod_const_char_pointer_true);
    107     COMPILE_ASSERT(IsPod<volatile char*>::value, WTF_IsPod_volatile_char_pointer_true);
    108     COMPILE_ASSERT(IsPod<double>::value, WTF_IsPod_double_true);
    109     COMPILE_ASSERT(IsPod<long double>::value, WTF_IsPod_long_double_true);
    110     COMPILE_ASSERT(IsPod<float>::value, WTF_IsPod_float_true);
    111     COMPILE_ASSERT(!IsPod<IsPod<bool> >::value, WTF_IsPod_struct_false);
    11266
    11367    template<typename T> class IsConvertibleToInteger {
     
    13791    };
    13892
    139     enum IsConvertibleToIntegerCheck { };
    140     COMPILE_ASSERT(IsConvertibleToInteger<IsConvertibleToIntegerCheck>::value, WTF_IsConvertibleToInteger_enum_true);
    141     COMPILE_ASSERT(IsConvertibleToInteger<bool>::value, WTF_IsConvertibleToInteger_bool_true);
    142     COMPILE_ASSERT(IsConvertibleToInteger<char>::value, WTF_IsConvertibleToInteger_char_true);
    143     COMPILE_ASSERT(IsConvertibleToInteger<signed char>::value, WTF_IsConvertibleToInteger_signed_char_true);
    144     COMPILE_ASSERT(IsConvertibleToInteger<unsigned char>::value, WTF_IsConvertibleToInteger_unsigned_char_true);
    145     COMPILE_ASSERT(IsConvertibleToInteger<short>::value, WTF_IsConvertibleToInteger_short_true);
    146     COMPILE_ASSERT(IsConvertibleToInteger<unsigned short>::value, WTF_IsConvertibleToInteger_unsigned_short_true);
    147     COMPILE_ASSERT(IsConvertibleToInteger<int>::value, WTF_IsConvertibleToInteger_int_true);
    148     COMPILE_ASSERT(IsConvertibleToInteger<unsigned int>::value, WTF_IsConvertibleToInteger_unsigned_int_true);
    149     COMPILE_ASSERT(IsConvertibleToInteger<long>::value, WTF_IsConvertibleToInteger_long_true);
    150     COMPILE_ASSERT(IsConvertibleToInteger<unsigned long>::value, WTF_IsConvertibleToInteger_unsigned_long_true);
    151     COMPILE_ASSERT(IsConvertibleToInteger<long long>::value, WTF_IsConvertibleToInteger_long_long_true);
    152     COMPILE_ASSERT(IsConvertibleToInteger<unsigned long long>::value, WTF_IsConvertibleToInteger_unsigned_long_long_true);
    153 #if !COMPILER(MSVC) || defined(_NATIVE_WCHAR_T_DEFINED)
    154     COMPILE_ASSERT(IsConvertibleToInteger<wchar_t>::value, WTF_IsConvertibleToInteger_wchar_t_true);
    155 #endif
    156     COMPILE_ASSERT(IsConvertibleToInteger<double>::value, WTF_IsConvertibleToInteger_double_true);
    157     COMPILE_ASSERT(IsConvertibleToInteger<long double>::value, WTF_IsConvertibleToInteger_long_double_true);
    158     COMPILE_ASSERT(IsConvertibleToInteger<float>::value, WTF_IsConvertibleToInteger_float_true);
    159     COMPILE_ASSERT(!IsConvertibleToInteger<char*>::value, WTF_IsConvertibleToInteger_char_pointer_false);
    160     COMPILE_ASSERT(!IsConvertibleToInteger<const char*>::value, WTF_IsConvertibleToInteger_const_char_pointer_false);
    161     COMPILE_ASSERT(!IsConvertibleToInteger<volatile char*>::value, WTF_IsConvertibleToInteger_volatile_char_pointer_false);
    162     COMPILE_ASSERT(!IsConvertibleToInteger<IsConvertibleToInteger<bool> >::value, WTF_IsConvertibleToInteger_struct_false);
    163 
    16493    template <typename T, typename U> struct IsSameType {
    16594        static const bool value = false;
     
    16998        static const bool value = true;
    17099    };
    171 
    172     COMPILE_ASSERT((IsSameType<bool, bool>::value), WTF_IsSameType_bool_true);
    173     COMPILE_ASSERT((IsSameType<int*, int*>::value), WTF_IsSameType_int_pointer_true);
    174     COMPILE_ASSERT((!IsSameType<int, int*>::value), WTF_IsSameType_int_int_pointer_false);
    175     COMPILE_ASSERT((!IsSameType<bool, const bool>::value), WTF_IsSameType_const_change_false);
    176     COMPILE_ASSERT((!IsSameType<bool, volatile bool>::value), WTF_IsSameType_volatile_change_false);
    177100
    178101    template <typename T> struct RemoveConst {
     
    184107    };
    185108
    186     COMPILE_ASSERT((IsSameType<bool, RemoveConst<const bool>::Type>::value), WTF_test_RemoveConst_const_bool);
    187     COMPILE_ASSERT((!IsSameType<bool, RemoveConst<volatile bool>::Type>::value), WTF_test_RemoveConst_volatile_bool);
    188 
    189109    template <typename T> struct RemoveVolatile {
    190110        typedef T Type;
     
    195115    };
    196116
    197     COMPILE_ASSERT((IsSameType<bool, RemoveVolatile<bool>::Type>::value), WTF_test_RemoveVolatile_bool);
    198     COMPILE_ASSERT((!IsSameType<bool, RemoveVolatile<const bool>::Type>::value), WTF_test_RemoveVolatile_const_bool);
    199     COMPILE_ASSERT((IsSameType<bool, RemoveVolatile<volatile bool>::Type>::value), WTF_test_RemoveVolatile_volatile_bool);
    200 
    201117    template <typename T> struct RemoveConstVolatile {
    202118        typedef typename RemoveVolatile<typename RemoveConst<T>::Type>::Type Type;
    203119    };
    204 
    205     COMPILE_ASSERT((IsSameType<bool, RemoveConstVolatile<bool>::Type>::value), WTF_test_RemoveConstVolatile_bool);
    206     COMPILE_ASSERT((IsSameType<bool, RemoveConstVolatile<const bool>::Type>::value), WTF_test_RemoveConstVolatile_const_bool);
    207     COMPILE_ASSERT((IsSameType<bool, RemoveConstVolatile<volatile bool>::Type>::value), WTF_test_RemoveConstVolatile_volatile_bool);
    208     COMPILE_ASSERT((IsSameType<bool, RemoveConstVolatile<const volatile bool>::Type>::value), WTF_test_RemoveConstVolatile_const_volatile_bool);
    209120
    210121    template <typename T> struct RemovePointer {
     
    216127    };
    217128
    218     COMPILE_ASSERT((IsSameType<int, RemovePointer<int>::Type>::value), WTF_Test_RemovePointer_int);
    219     COMPILE_ASSERT((IsSameType<int, RemovePointer<int*>::Type>::value), WTF_Test_RemovePointer_int_pointer);
    220     COMPILE_ASSERT((!IsSameType<int, RemovePointer<int**>::Type>::value), WTF_Test_RemovePointer_int_pointer_pointer);
    221 
    222129} // namespace WTF
    223130
Note: See TracChangeset for help on using the changeset viewer.