Bug 624080 - Avoid weird OSX10.5 compile error in jsclone (r=jorendorff)
authorLuke Wagner <lw@mozilla.com>
Mon, 10 Jan 2011 12:29:50 -0800
changeset 60561 140bc539ca677f315e079eaa99b9f54ee50566ea
parent 60560 cb17d7d6a83197dcc20a747ffed83cc00f6cd64f
child 60562 98dd962dab2515335b5a726dd46560f3eb79c36d
push id18037
push usercleary@mozilla.com
push dateFri, 14 Jan 2011 17:42:55 +0000
treeherdermozilla-central@4e0501a0c5e5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorendorff
bugs624080
milestone2.0b9pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 624080 - Avoid weird OSX10.5 compile error in jsclone (r=jorendorff)
js/src/jsclone.cpp
--- a/js/src/jsclone.cpp
+++ b/js/src/jsclone.cpp
@@ -168,26 +168,36 @@ SCInput::readPair(uint32_t *tagp, uint32
     bool ok = read(&u);
     if (ok) {
         *tagp = uint32_t(u >> 32);
         *datap = uint32_t(u);
     }
     return ok;
 }
 
+/*
+ * The purpose of this never-inlined function is to avoid a strange g++ build
+ * error on OS X 10.5 (see bug 624080).  :-(
+ */
+static JS_NEVER_INLINE double
+CanonicalizeNan(double d)
+{
+    return JS_CANONICALIZE_NAN(d);
+}
+
 bool
 SCInput::readDouble(jsdouble *p)
 {
     union {
         uint64_t u;
         jsdouble d;
     } pun;
     if (!read(&pun.u))
         return false;
-    *p = JS_CANONICALIZE_NAN(pun.d);
+    *p = CanonicalizeNan(pun.d);
     return true;
 }
 
 template <class T>
 bool
 SCInput::readArray(T *p, size_t nelems)
 {
     JS_STATIC_ASSERT(sizeof(uint64_t) % sizeof(T) == 0);
@@ -280,17 +290,17 @@ static inline jsdouble
 ReinterpretPairAsDouble(uint32_t tag, uint32_t data)
 {
     return ReinterpretUInt64AsDouble(PairToUInt64(tag, data));
 }
 
 bool
 SCOutput::writeDouble(jsdouble d)
 {
-    return write(ReinterpretDoubleAsUInt64(JS_CANONICALIZE_NAN(d)));
+    return write(ReinterpretDoubleAsUInt64(CanonicalizeNan(d)));
 }
 
 template <class T>
 bool
 SCOutput::writeArray(const T *p, size_t nelems)
 {
     JS_ASSERT(8 % sizeof(T) == 0);
     JS_ASSERT(sizeof(uint64_t) % sizeof(T) == 0);