Title: [117779] trunk/Source/WTF
- Revision
- 117779
- Author
- [email protected]
- Date
- 2012-05-21 07:24:22 -0700 (Mon, 21 May 2012)
Log Message
Colliding isinf/isnan between C99 and C++11 with GCC >=4.6
https://bugs.webkit.org/show_bug.cgi?id=59249
Patch by Allan Sandfeld Jensen <[email protected]> on 2012-05-21
Reviewed by Darin Adler.
Workaround the isinf and isnan conflict in GCC C++11.
* wtf/Compiler.h:
* wtf/MathExtras.h:
(std::wtf_isinf):
(std::wtf_isnan):
Modified Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (117778 => 117779)
--- trunk/Source/WTF/ChangeLog 2012-05-21 13:50:36 UTC (rev 117778)
+++ trunk/Source/WTF/ChangeLog 2012-05-21 14:24:22 UTC (rev 117779)
@@ -1,3 +1,17 @@
+2012-05-21 Allan Sandfeld Jensen <[email protected]>
+
+ Colliding isinf/isnan between C99 and C++11 with GCC >=4.6
+ https://bugs.webkit.org/show_bug.cgi?id=59249
+
+ Reviewed by Darin Adler.
+
+ Workaround the isinf and isnan conflict in GCC C++11.
+
+ * wtf/Compiler.h:
+ * wtf/MathExtras.h:
+ (std::wtf_isinf):
+ (std::wtf_isnan):
+
2012-05-21 Andreas Kling <[email protected]>
REGRESSION(r117501): IconDatabase asserts on startup in synchronousIconForPageURL().
Modified: trunk/Source/WTF/wtf/Compiler.h (117778 => 117779)
--- trunk/Source/WTF/wtf/Compiler.h 2012-05-21 13:50:36 UTC (rev 117778)
+++ trunk/Source/WTF/wtf/Compiler.h 2012-05-21 14:24:22 UTC (rev 117779)
@@ -32,6 +32,9 @@
/* COMPILER_SUPPORTS() - whether the compiler being used to build the project supports the given feature. */
#define COMPILER_SUPPORTS(WTF_COMPILER_FEATURE) (defined WTF_COMPILER_SUPPORTS_##WTF_COMPILER_FEATURE && WTF_COMPILER_SUPPORTS_##WTF_COMPILER_FEATURE)
+/* COMPILER_QUIRK() - whether the compiler being used to build the project requires a given quirk. */
+#define COMPILER_QUIRK(WTF_COMPILER_QUIRK) (defined WTF_COMPILER_QUIRK_##WTF_COMPILER_QUIRK && WTF_COMPILER_QUIRK_##WTF_COMPILER_QUIRK)
+
/* ==== COMPILER() - the compiler being used to build the project ==== */
/* COMPILER(CLANG) - Clang */
@@ -95,15 +98,22 @@
#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
/* Specific compiler features */
-#if !COMPILER(CLANG) && GCC_VERSION_AT_LEAST(4, 6, 0) && defined(__GXX_EXPERIMENTAL_CXX0X__)
+#if COMPILER(GCC) && !COMPILER(CLANG)
+#if GCC_VERSION_AT_LEAST(4, 7, 0) && __cplusplus >= 201103L
+#define WTF_COMPILER_SUPPORTS_CXX_NULLPTR 1
+#define WTF_COMPILER_QUIRK_GCC11_GLOBAL_ISINF_ISNAN 1
+
+#elif GCC_VERSION_AT_LEAST(4, 6, 0) && defined(__GXX_EXPERIMENTAL_CXX0X__)
#define WTF_COMPILER_SUPPORTS_CXX_NULLPTR 1
+#define WTF_COMPILER_QUIRK_GCC11_GLOBAL_ISINF_ISNAN 1
#endif
-#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 */
Modified: trunk/Source/WTF/wtf/MathExtras.h (117778 => 117779)
--- trunk/Source/WTF/wtf/MathExtras.h 2012-05-21 13:50:36 UTC (rev 117778)
+++ trunk/Source/WTF/wtf/MathExtras.h 2012-05-21 14:24:22 UTC (rev 117779)
@@ -279,11 +279,30 @@
#if !COMPILER(MSVC) && !COMPILER(RVCT) && !OS(SOLARIS)
using std::isfinite;
+#if !COMPILER_QUIRK(GCC11_GLOBAL_ISINF_ISNAN)
using std::isinf;
using std::isnan;
+#endif
using std::signbit;
#endif
+#if COMPILER_QUIRK(GCC11_GLOBAL_ISINF_ISNAN)
+// A workaround to avoid conflicting declarations of isinf and isnan when compiling with GCC in C++11 mode.
+namespace std {
+ constexpr bool wtf_isinf(float f) { return std::isinf(f); }
+ constexpr bool wtf_isinf(double d) { return std::isinf(d); }
+ constexpr bool wtf_isnan(float f) { return std::isnan(f); }
+ constexpr bool wtf_isnan(double d) { return std::isnan(d); }
+};
+
+using std::wtf_isinf;
+using std::wtf_isnan;
+
+#define isinf(x) wtf_isinf(x)
+#define isnan(x) wtf_isnan(x)
+#endif
+
+
// decompose 'number' to its sign, exponent, and mantissa components.
// The result is interpreted as:
// (sign ? -1 : 1) * pow(2, exponent) * (mantissa / (1 << 52))
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes