Changeset 117934 in webkit


Ignore:
Timestamp:
May 22, 2012 1:46:00 AM (12 years ago)
Author:
Simon Hausmann
Message:

GCC 4.7 and C++11 support.
https://bugs.webkit.org/show_bug.cgi?id=86465

Patch by Allan Sandfeld Jensen <allan.jensen@nokia.com> on 2012-05-22
Reviewed by Darin Adler.

Source/WTF:

Detect C++11 mode in GCC 4.7 and set appropiate compiler feature flags.
Turn C++11 override control into a compiler feature flag.
Fix non-clang support of compiler feature CXX_DELETED_FUNCTIONS.

  • wtf/Compiler.h:
  • wtf/Noncopyable.h:

Tools:

Update detection of C++11 mode in GCC.

  • qmake/mkspecs/features/unix/default_post.prf:
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r117919 r117934  
     12012-05-22  Allan Sandfeld Jensen  <allan.jensen@nokia.com>
     2
     3        GCC 4.7 and C++11 support.
     4        https://bugs.webkit.org/show_bug.cgi?id=86465
     5
     6        Reviewed by Darin Adler.
     7
     8        Detect C++11 mode in GCC 4.7 and set appropiate compiler feature flags.
     9        Turn C++11 override control into a compiler feature flag.
     10        Fix non-clang support of compiler feature CXX_DELETED_FUNCTIONS.
     11
     12        * wtf/Compiler.h:
     13        * wtf/Noncopyable.h:
     14
    1152012-05-22  Filip Pizlo  <fpizlo@apple.com>
    216
  • trunk/Source/WTF/wtf/Compiler.h

    r117779 r117934  
    4646#endif
    4747
     48#define CLANG_PRAGMA(PRAGMA) _Pragma(PRAGMA)
     49
    4850/* Specific compiler features */
    4951#define WTF_COMPILER_SUPPORTS_CXX_VARIADIC_TEMPLATES __has_feature(cxx_variadic_templates)
     
    5355#define WTF_COMPILER_SUPPORTS_BLOCKS __has_feature(blocks)
    5456#define WTF_COMPILER_SUPPORTS_C_STATIC_ASSERT __has_extension(c_static_assert)
     57#define WTF_COMPILER_SUPPORTS_CXX_OVERRIDE_CONTROL __has_extension(cxx_override_control)
    5558
    5659#define WTF_COMPILER_SUPPORTS_HAS_TRIVIAL_DESTRUCTOR __has_extension(has_trivial_destructor)
    5760
     61#endif
     62
     63#ifndef CLANG_PRAGMA
     64#define CLANG_PRAGMA(PRAGMA)
    5865#endif
    5966
     
    7481#endif
    7582
     83#if !COMPILER(CLANG)
     84#define WTF_COMPILER_SUPPORTS_CXX_OVERRIDE_CONTROL 1
     85#define WTF_COMPILER_QUIRK_FINAL_IS_CALLED_SEALED 1
     86#endif
     87
    7688#endif
    7789
     
    107119#if COMPILER(GCC) && !COMPILER(CLANG)
    108120#if GCC_VERSION_AT_LEAST(4, 7, 0) && __cplusplus >= 201103L
     121#define WTF_COMPILER_SUPPORTS_CXX_RVALUE_REFERENCES 1
     122#define WTF_COMPILER_SUPPORTS_CXX_DELETED_FUNCTIONS 1
    109123#define WTF_COMPILER_SUPPORTS_CXX_NULLPTR 1
     124#define WTF_COMPILER_SUPPORTS_CXX_OVERRIDE_CONTROL 1
    110125#define WTF_COMPILER_QUIRK_GCC11_GLOBAL_ISINF_ISNAN 1
    111126
     
    221236#endif
    222237
    223 /* OVERRIDE */
    224 
    225 #ifndef OVERRIDE
    226 #if COMPILER(CLANG)
    227 #if __has_extension(cxx_override_control)
     238/* OVERRIDE and FINAL */
     239
     240#if COMPILER_SUPPORTS(CXX_OVERRIDE_CONTROL)
    228241#define OVERRIDE override
    229 #endif
    230 #elif COMPILER(MSVC)
    231 #define OVERRIDE override
    232 #endif
    233 #endif
    234 
    235 #ifndef OVERRIDE
     242
     243#if COMPILER_QUIRK(FINAL_IS_CALLED_SEALED)
     244#define FINAL sealed
     245#else
     246#define FINAL final
     247#endif
     248
     249#else
    236250#define OVERRIDE
    237 #endif
    238 
    239 /* FINAL */
    240 
    241 #ifndef FINAL
    242 #if COMPILER(CLANG)
    243 #if __has_extension(cxx_override_control)
    244 #define FINAL final
    245 #endif
    246 #elif COMPILER(MSVC)
    247 #define FINAL sealed
    248 #endif
    249 #endif
    250 
    251 #ifndef FINAL
    252251#define FINAL
    253252#endif
  • trunk/Source/WTF/wtf/Noncopyable.h

    r111778 r117934  
    2626#if COMPILER_SUPPORTS(CXX_DELETED_FUNCTIONS)
    2727    #define WTF_MAKE_NONCOPYABLE(ClassName) \
    28         _Pragma("clang diagnostic push") \
    29         _Pragma("clang diagnostic ignored \"-Wunknown-pragmas\"") \
    30         _Pragma("clang diagnostic ignored \"-Wc++0x-extensions\"") \
     28        CLANG_PRAGMA("clang diagnostic push") \
     29        CLANG_PRAGMA("clang diagnostic ignored \"-Wunknown-pragmas\"") \
     30        CLANG_PRAGMA("clang diagnostic ignored \"-Wc++0x-extensions\"") \
    3131        private: \
    3232            ClassName(const ClassName&) = delete; \
    3333            ClassName& operator=(const ClassName&) = delete; \
    34         _Pragma("clang diagnostic pop")
     34        CLANG_PRAGMA("clang diagnostic pop")
    3535#else
    3636    #define WTF_MAKE_NONCOPYABLE(ClassName) \
  • trunk/Tools/ChangeLog

    r117920 r117934  
     12012-05-22  Allan Sandfeld Jensen  <allan.jensen@nokia.com>
     2
     3        GCC 4.7 and C++11 support.
     4        https://bugs.webkit.org/show_bug.cgi?id=86465
     5
     6        Reviewed by Darin Adler.
     7
     8        Update detection of C++11 mode in GCC.
     9
     10        * qmake/mkspecs/features/unix/default_post.prf:
     11
    1122012-05-22  Hao Zheng  <zhenghao@chromium.org>
    213
  • trunk/Tools/qmake/mkspecs/features/unix/default_post.prf

    r113848 r117934  
    1717    isEqual(QT_ARCH,x86_64)|isEqual(QT_ARCH,i386): QMAKE_CXXFLAGS += -Werror
    1818    greaterThan(QT_GCC_MAJOR_VERSION, 3):greaterThan(QT_GCC_MINOR_VERSION, 5) {
    19         if (!contains(QMAKE_CXXFLAGS, -std=c++0x) && !contains(QMAKE_CXXFLAGS, -std=gnu++0x)) {
     19        if (!contains(QMAKE_CXXFLAGS, -std=c++0x) && !contains(QMAKE_CXXFLAGS, -std=gnu++0x) && !contains(QMAKE_CXXFLAGS, -std=c++11) && !contains(QMAKE_CXXFLAGS, -std=gnu++11)) {
    2020            # We need to deactivate those warnings because some names conflicts with upcoming c++0x types (e.g.nullptr).
    2121            QMAKE_CFLAGS_WARN_ON += -Wno-c++0x-compat
Note: See TracChangeset for help on using the changeset viewer.