Changeset 117779 in webkit
- Timestamp:
- May 21, 2012 7:24:22 AM (12 years ago)
- Location:
- trunk/Source/WTF
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r117744 r117779 1 2012-05-21 Allan Sandfeld Jensen <allan.jensen@nokia.com> 2 3 Colliding isinf/isnan between C99 and C++11 with GCC >=4.6 4 https://bugs.webkit.org/show_bug.cgi?id=59249 5 6 Reviewed by Darin Adler. 7 8 Workaround the isinf and isnan conflict in GCC C++11. 9 10 * wtf/Compiler.h: 11 * wtf/MathExtras.h: 12 (std::wtf_isinf): 13 (std::wtf_isnan): 14 1 15 2012-05-21 Andreas Kling <kling@webkit.org> 2 16 -
trunk/Source/WTF/wtf/Compiler.h
r116951 r117779 33 33 #define COMPILER_SUPPORTS(WTF_COMPILER_FEATURE) (defined WTF_COMPILER_SUPPORTS_##WTF_COMPILER_FEATURE && WTF_COMPILER_SUPPORTS_##WTF_COMPILER_FEATURE) 34 34 35 /* COMPILER_QUIRK() - whether the compiler being used to build the project requires a given quirk. */ 36 #define COMPILER_QUIRK(WTF_COMPILER_QUIRK) (defined WTF_COMPILER_QUIRK_##WTF_COMPILER_QUIRK && WTF_COMPILER_QUIRK_##WTF_COMPILER_QUIRK) 37 35 38 /* ==== COMPILER() - the compiler being used to build the project ==== */ 36 39 … … 96 99 #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) 97 100 #define GCC_VERSION_AT_LEAST(major, minor, patch) (GCC_VERSION >= (major * 10000 + minor * 100 + patch)) 98 99 /* Specific compiler features */100 #if !COMPILER(CLANG) && GCC_VERSION_AT_LEAST(4, 6, 0) && defined(__GXX_EXPERIMENTAL_CXX0X__)101 #define WTF_COMPILER_SUPPORTS_CXX_NULLPTR 1102 #endif103 104 101 #else 105 102 /* Define this for !GCC compilers, just so we can write things like GCC_VERSION_AT_LEAST(4, 1, 0). */ 106 103 #define GCC_VERSION_AT_LEAST(major, minor, patch) 0 104 #endif 105 106 /* Specific compiler features */ 107 #if COMPILER(GCC) && !COMPILER(CLANG) 108 #if GCC_VERSION_AT_LEAST(4, 7, 0) && __cplusplus >= 201103L 109 #define WTF_COMPILER_SUPPORTS_CXX_NULLPTR 1 110 #define WTF_COMPILER_QUIRK_GCC11_GLOBAL_ISINF_ISNAN 1 111 112 #elif GCC_VERSION_AT_LEAST(4, 6, 0) && defined(__GXX_EXPERIMENTAL_CXX0X__) 113 #define WTF_COMPILER_SUPPORTS_CXX_NULLPTR 1 114 #define WTF_COMPILER_QUIRK_GCC11_GLOBAL_ISINF_ISNAN 1 115 #endif 116 107 117 #endif 108 118 -
trunk/Source/WTF/wtf/MathExtras.h
r111778 r117779 280 280 #if !COMPILER(MSVC) && !COMPILER(RVCT) && !OS(SOLARIS) 281 281 using std::isfinite; 282 #if !COMPILER_QUIRK(GCC11_GLOBAL_ISINF_ISNAN) 282 283 using std::isinf; 283 284 using std::isnan; 285 #endif 284 286 using std::signbit; 285 287 #endif 288 289 #if COMPILER_QUIRK(GCC11_GLOBAL_ISINF_ISNAN) 290 // A workaround to avoid conflicting declarations of isinf and isnan when compiling with GCC in C++11 mode. 291 namespace std { 292 constexpr bool wtf_isinf(float f) { return std::isinf(f); } 293 constexpr bool wtf_isinf(double d) { return std::isinf(d); } 294 constexpr bool wtf_isnan(float f) { return std::isnan(f); } 295 constexpr bool wtf_isnan(double d) { return std::isnan(d); } 296 }; 297 298 using std::wtf_isinf; 299 using std::wtf_isnan; 300 301 #define isinf(x) wtf_isinf(x) 302 #define isnan(x) wtf_isnan(x) 303 #endif 304 286 305 287 306 // decompose 'number' to its sign, exponent, and mantissa components.
Note: See TracChangeset
for help on using the changeset viewer.