Bug 1430703 - Fix some too-loose static assertions r=cduan
authorPaul Bone <pbone@mozilla.com>
Wed, 13 Dec 2017 11:31:39 +1100
changeset 453943 abf83566cc101a7abc5c180b9e491b753023ca38
parent 453942 4efc37f978d2817177068b0df224fcdc3abebeee
child 453944 7eaf34a4efa6768d94a9b7c4ceeabbde1e6910eb
push id1648
push usermtabara@mozilla.com
push dateThu, 01 Mar 2018 12:45:47 +0000
treeherdermozilla-release@cbb9688c2eeb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscduan
bugs1430703
milestone59.0a1
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 1430703 - Fix some too-loose static assertions r=cduan
js/public/TraceKind.h
--- a/js/public/TraceKind.h
+++ b/js/public/TraceKind.h
@@ -59,21 +59,26 @@ enum class TraceKind
     // The following kinds do not have an exposed C++ idiom.
     BaseShape = 0x0F,
     JitCode = 0x1F,
     LazyScript = 0x2F,
     Scope = 0x3F,
     RegExpShared = 0x4F
 };
 const static uintptr_t OutOfLineTraceKindMask = 0x07;
-static_assert(uintptr_t(JS::TraceKind::BaseShape) & OutOfLineTraceKindMask, "mask bits are set");
-static_assert(uintptr_t(JS::TraceKind::JitCode) & OutOfLineTraceKindMask, "mask bits are set");
-static_assert(uintptr_t(JS::TraceKind::LazyScript) & OutOfLineTraceKindMask, "mask bits are set");
-static_assert(uintptr_t(JS::TraceKind::Scope) & OutOfLineTraceKindMask, "mask bits are set");
-static_assert(uintptr_t(JS::TraceKind::RegExpShared) & OutOfLineTraceKindMask, "mask bits are set");
+
+#define ASSERT_TRACE_KIND(tk) \
+    static_assert((uintptr_t(tk) & OutOfLineTraceKindMask) == OutOfLineTraceKindMask, \
+        "mask bits are set")
+ASSERT_TRACE_KIND(JS::TraceKind::BaseShape);
+ASSERT_TRACE_KIND(JS::TraceKind::JitCode);
+ASSERT_TRACE_KIND(JS::TraceKind::LazyScript);
+ASSERT_TRACE_KIND(JS::TraceKind::Scope);
+ASSERT_TRACE_KIND(JS::TraceKind::RegExpShared);
+#undef ASSERT_TRACE_KIND
 
 // When this header is imported inside SpiderMonkey, the class definitions are
 // available and we can query those definitions to find the correct kind
 // directly from the class hierarchy.
 template <typename T>
 struct MapTypeToTraceKind {
     static const JS::TraceKind kind = T::TraceKind;
 };