--- a/accessible/src/base/RoleAsserts.cpp
+++ b/accessible/src/base/RoleAsserts.cpp
@@ -7,13 +7,13 @@
#include "nsIAccessibleRole.h"
#include "Role.h"
#include "mozilla/Assertions.h"
using namespace mozilla::a11y;
#define ROLE(geckoRole, stringRole, atkRole, macRole, msaaRole, ia2Role, nameRule) \
- MOZ_STATIC_ASSERT(static_cast<uint32_t>(roles::geckoRole) \
- == static_cast<uint32_t>(nsIAccessibleRole::ROLE_ ## geckoRole), \
- "internal and xpcom roles differ!");
+ static_assert(static_cast<uint32_t>(roles::geckoRole) \
+ == static_cast<uint32_t>(nsIAccessibleRole::ROLE_ ## geckoRole), \
+ "internal and xpcom roles differ!");
#include "RoleMap.h"
#undef ROLE
--- a/accessible/src/generic/Accessible.cpp
+++ b/accessible/src/generic/Accessible.cpp
@@ -3348,24 +3348,24 @@ Accessible::GetLevelInternal()
}
return level;
}
void
Accessible::StaticAsserts() const
{
- MOZ_STATIC_ASSERT(eLastChildrenFlag <= (2 << kChildrenFlagsBits) - 1,
- "Accessible::mChildrenFlags was oversized by eLastChildrenFlag!");
- MOZ_STATIC_ASSERT(eLastStateFlag <= (2 << kStateFlagsBits) - 1,
- "Accessible::mStateFlags was oversized by eLastStateFlag!");
- MOZ_STATIC_ASSERT(eLastAccType <= (2 << kTypeBits) - 1,
- "Accessible::mType was oversized by eLastAccType!");
- MOZ_STATIC_ASSERT(eLastAccGenericType <= (2 << kGenericTypesBits) - 1,
- "Accessible::mGenericType was oversized by eLastAccGenericType!");
+ static_assert(eLastChildrenFlag <= (2 << kChildrenFlagsBits) - 1,
+ "Accessible::mChildrenFlags was oversized by eLastChildrenFlag!");
+ static_assert(eLastStateFlag <= (2 << kStateFlagsBits) - 1,
+ "Accessible::mStateFlags was oversized by eLastStateFlag!");
+ static_assert(eLastAccType <= (2 << kTypeBits) - 1,
+ "Accessible::mType was oversized by eLastAccType!");
+ static_assert(eLastAccGenericType <= (2 << kGenericTypesBits) - 1,
+ "Accessible::mGenericType was oversized by eLastAccGenericType!");
}
////////////////////////////////////////////////////////////////////////////////
// KeyBinding class
void
KeyBinding::ToPlatformFormat(nsAString& aValue) const
--- a/accessible/src/windows/msaa/AccessibleWrap.cpp
+++ b/accessible/src/windows/msaa/AccessibleWrap.cpp
@@ -1612,18 +1612,18 @@ AccessibleWrap::HandleAccEvent(AccEvent*
// when running in metro mode. This confuses input focus tracking
// in metro's UIA implementation.
if (XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Metro) {
return NS_OK;
}
uint32_t eventType = aEvent->GetEventType();
- MOZ_STATIC_ASSERT(sizeof(gWinEventMap)/sizeof(gWinEventMap[0]) == nsIAccessibleEvent::EVENT_LAST_ENTRY,
- "MSAA event map skewed");
+ static_assert(sizeof(gWinEventMap)/sizeof(gWinEventMap[0]) == nsIAccessibleEvent::EVENT_LAST_ENTRY,
+ "MSAA event map skewed");
NS_ENSURE_TRUE(eventType > 0 && eventType < ArrayLength(gWinEventMap), NS_ERROR_FAILURE);
uint32_t winEvent = gWinEventMap[eventType];
if (!winEvent)
return NS_OK;
// Means we're not active.
--- a/caps/src/nsScriptSecurityManager.cpp
+++ b/caps/src/nsScriptSecurityManager.cpp
@@ -2317,19 +2317,19 @@ nsScriptSecurityManager::Observe(nsISupp
nsScriptSecurityManager::nsScriptSecurityManager(void)
: mOriginToPolicyMap(nullptr),
mDefaultPolicy(nullptr),
mCapabilities(nullptr),
mPrefInitialized(false),
mIsJavaScriptEnabled(false),
mPolicyPrefsChanged(true)
{
- MOZ_STATIC_ASSERT(sizeof(intptr_t) == sizeof(void*),
- "intptr_t and void* have different lengths on this platform. "
- "This may cause a security failure with the SecurityLevel union.");
+ static_assert(sizeof(intptr_t) == sizeof(void*),
+ "intptr_t and void* have different lengths on this platform. "
+ "This may cause a security failure with the SecurityLevel union.");
}
nsresult nsScriptSecurityManager::Init()
{
JSContext* cx = GetSafeJSContext();
if (!cx) return NS_ERROR_FAILURE; // this can happen of xpt loading fails
::JS_BeginRequest(cx);
--- a/content/base/src/nsMixedContentBlocker.cpp
+++ b/content/base/src/nsMixedContentBlocker.cpp
@@ -232,19 +232,19 @@ nsMixedContentBlocker::ShouldLoad(uint32
// TYPE_XMLHTTPREQUEST: XHR requires either same origin or CORS, so most
// mixed-content XHR will already be blocked by that check. This will also
// block HTTPS-to-HTTP XHR with CORS. The same security concerns mentioned
// above for WebSockets apply to XHR, and XHR should have the same security
// properties as WebSockets w.r.t. mixed content. XHR's handling of redirects
// amplifies these concerns.
- MOZ_STATIC_ASSERT(TYPE_DATAREQUEST == TYPE_XMLHTTPREQUEST,
- "TYPE_DATAREQUEST is not a synonym for "
- "TYPE_XMLHTTPREQUEST");
+ static_assert(TYPE_DATAREQUEST == TYPE_XMLHTTPREQUEST,
+ "TYPE_DATAREQUEST is not a synonym for "
+ "TYPE_XMLHTTPREQUEST");
switch (aContentType) {
// The top-level document cannot be mixed content by definition
case TYPE_DOCUMENT:
*aDecision = ACCEPT;
return NS_OK;
// Creating insecure websocket connections in a secure page is blocked already
// in the websocket constructor. We don't need to check the blocking here
--- a/content/base/src/nsXMLHttpRequest.cpp
+++ b/content/base/src/nsXMLHttpRequest.cpp
@@ -860,17 +860,17 @@ NS_IMETHODIMP nsXMLHttpRequest::GetRespo
return NS_OK;
}
#ifdef DEBUG
void
nsXMLHttpRequest::StaticAssertions()
{
#define ASSERT_ENUM_EQUAL(_lc, _uc) \
- MOZ_STATIC_ASSERT(\
+ static_assert(\
static_cast<int>(XMLHttpRequestResponseType::_lc) \
== XML_HTTP_RESPONSE_TYPE_ ## _uc, \
#_uc " should match")
ASSERT_ENUM_EQUAL(_empty, DEFAULT);
ASSERT_ENUM_EQUAL(Arraybuffer, ARRAYBUFFER);
ASSERT_ENUM_EQUAL(Blob, BLOB);
ASSERT_ENUM_EQUAL(Document, DOCUMENT);
--- a/content/canvas/compiledtest/TestWebGLElementArrayCache.cpp
+++ b/content/canvas/compiledtest/TestWebGLElementArrayCache.cpp
@@ -123,18 +123,18 @@ void CheckSanity()
VERIFY( c.Validate(type, numElems - 10, 10, numElems - 10));
VERIFY(!c.Validate(type, numElems - 11, 10, numElems - 10));
}
template<typename T>
void CheckUintOverflow()
{
// This test is only for integer types smaller than uint32_t
- MOZ_STATIC_ASSERT(sizeof(T) < sizeof(uint32_t), "This test is only for integer types \
- smaller than uint32_t");
+ static_assert(sizeof(T) < sizeof(uint32_t), "This test is only for integer types \
+ smaller than uint32_t");
const size_t numElems = 64; // should be significantly larger than tree leaf size to
// ensure we exercise some nontrivial tree-walking
T data[numElems];
size_t numBytes = numElems * sizeof(T);
MOZ_ASSERT(numBytes == sizeof(data));
GLenum type = GLType<T>();
--- a/content/media/AudioSampleFormat.h
+++ b/content/media/AudioSampleFormat.h
@@ -152,18 +152,18 @@ ScaleAudioSamples(short* aBuffer, int aC
aBuffer[i] = short((int32_t(aBuffer[i]) * volume) >> 16);
}
}
inline const void*
AddAudioSampleOffset(const void* aBase, AudioSampleFormat aFormat,
int32_t aOffset)
{
- MOZ_STATIC_ASSERT(AUDIO_FORMAT_S16 == 0, "Bad constant");
- MOZ_STATIC_ASSERT(AUDIO_FORMAT_FLOAT32 == 1, "Bad constant");
+ static_assert(AUDIO_FORMAT_S16 == 0, "Bad constant");
+ static_assert(AUDIO_FORMAT_FLOAT32 == 1, "Bad constant");
NS_ASSERTION(aFormat == AUDIO_FORMAT_S16 || aFormat == AUDIO_FORMAT_FLOAT32,
"Unknown format");
return static_cast<const uint8_t*>(aBase) + (aFormat + 1)*2*aOffset;
}
} // namespace mozilla
--- a/content/media/webaudio/WebAudioUtils.h
+++ b/content/media/webaudio/WebAudioUtils.h
@@ -179,20 +179,20 @@ struct WebAudioUtils {
* passed to this function is not a NaN. This function will abort if
* it sees a NaN.
*/
template <typename IntType, typename FloatType>
static IntType TruncateFloatToInt(FloatType f)
{
using namespace std;
- MOZ_STATIC_ASSERT((mozilla::IsIntegral<IntType>::value == true),
- "IntType must be an integral type");
- MOZ_STATIC_ASSERT((mozilla::IsFloatingPoint<FloatType>::value == true),
- "FloatType must be a floating point type");
+ static_assert(mozilla::IsIntegral<IntType>::value == true,
+ "IntType must be an integral type");
+ static_assert(mozilla::IsFloatingPoint<FloatType>::value == true,
+ "FloatType must be a floating point type");
if (f != f) {
// It is the responsibility of the caller to deal with NaN values.
// If we ever get to this point, we have a serious bug to fix.
NS_RUNTIMEABORT("We should never see a NaN here");
}
if (f > FloatType(numeric_limits<IntType>::max())) {
--- a/content/media/webaudio/compiledtest/TestAudioEventTimeline.cpp
+++ b/content/media/webaudio/compiledtest/TestAudioEventTimeline.cpp
@@ -135,17 +135,17 @@ void TestSpecExample()
is(timeline.GetValueAtTime(0.65), (0.75f * powf(0.05f / 0.75f, 0.5f)), "Correct value");
is(timeline.GetValueAtTime(0.7), -1.0f, "Correct value");
is(timeline.GetValueAtTime(0.9), 0.0f, "Correct value");
is(timeline.GetValueAtTime(1.0), 1.0f, "Correct value");
}
void TestInvalidEvents()
{
- MOZ_STATIC_ASSERT(numeric_limits<float>::has_quiet_NaN, "Platform must have a quiet NaN");
+ static_assert(numeric_limits<float>::has_quiet_NaN, "Platform must have a quiet NaN");
const float NaN = numeric_limits<float>::quiet_NaN();
const float Infinity = numeric_limits<float>::infinity();
Timeline timeline(10.0f);
float curve[] = { -1.0f, 0.0f, 1.0f };
float badCurve1[] = { -1.0f, NaN, 1.0f };
float badCurve2[] = { -1.0f, Infinity, 1.0f };
float badCurve3[] = { -1.0f, -Infinity, 1.0f };
--- a/content/svg/content/src/SVGFEMorphologyElement.cpp
+++ b/content/svg/content/src/SVGFEMorphologyElement.cpp
@@ -151,19 +151,19 @@ static void
DoMorphology(nsSVGFilterInstance* instance,
uint8_t* sourceData,
uint8_t* targetData,
int32_t stride,
const nsIntRect& rect,
int32_t rx,
int32_t ry)
{
- MOZ_STATIC_ASSERT(Operator == SVG_OPERATOR_ERODE ||
- Operator == SVG_OPERATOR_DILATE,
- "unexpected morphology operator");
+ static_assert(Operator == SVG_OPERATOR_ERODE ||
+ Operator == SVG_OPERATOR_DILATE,
+ "unexpected morphology operator");
volatile uint8_t extrema[4]; // RGBA magnitude of extrema
// Scan the kernel for each pixel to determine max/min RGBA values.
for (int32_t y = rect.y; y < rect.YMost(); y++) {
int32_t startY = std::max(0, y - ry);
// We need to read pixels not just in 'rect', which is limited to
// the dirty part of our filter primitive subregion, but all pixels in
--- a/dom/audiochannel/AudioChannelAgent.cpp
+++ b/dom/audiochannel/AudioChannelAgent.cpp
@@ -56,31 +56,31 @@ AudioChannelAgent::InitWithWeakCallback(
nsresult
AudioChannelAgent::InitInternal(int32_t aChannelType,
nsIAudioChannelAgentCallback *aCallback,
bool aUseWeakRef)
{
// We syncd the enum of channel type between nsIAudioChannelAgent.idl and
// AudioChannelCommon.h the same.
- MOZ_STATIC_ASSERT(static_cast<AudioChannelType>(AUDIO_AGENT_CHANNEL_NORMAL) ==
- AUDIO_CHANNEL_NORMAL &&
- static_cast<AudioChannelType>(AUDIO_AGENT_CHANNEL_CONTENT) ==
- AUDIO_CHANNEL_CONTENT &&
- static_cast<AudioChannelType>(AUDIO_AGENT_CHANNEL_NOTIFICATION) ==
- AUDIO_CHANNEL_NOTIFICATION &&
- static_cast<AudioChannelType>(AUDIO_AGENT_CHANNEL_ALARM) ==
- AUDIO_CHANNEL_ALARM &&
- static_cast<AudioChannelType>(AUDIO_AGENT_CHANNEL_TELEPHONY) ==
- AUDIO_CHANNEL_TELEPHONY &&
- static_cast<AudioChannelType>(AUDIO_AGENT_CHANNEL_RINGER) ==
- AUDIO_CHANNEL_RINGER &&
- static_cast<AudioChannelType>(AUDIO_AGENT_CHANNEL_PUBLICNOTIFICATION) ==
- AUDIO_CHANNEL_PUBLICNOTIFICATION,
- "Enum of channel on nsIAudioChannelAgent.idl should be the same with AudioChannelCommon.h");
+ static_assert(static_cast<AudioChannelType>(AUDIO_AGENT_CHANNEL_NORMAL) ==
+ AUDIO_CHANNEL_NORMAL &&
+ static_cast<AudioChannelType>(AUDIO_AGENT_CHANNEL_CONTENT) ==
+ AUDIO_CHANNEL_CONTENT &&
+ static_cast<AudioChannelType>(AUDIO_AGENT_CHANNEL_NOTIFICATION) ==
+ AUDIO_CHANNEL_NOTIFICATION &&
+ static_cast<AudioChannelType>(AUDIO_AGENT_CHANNEL_ALARM) ==
+ AUDIO_CHANNEL_ALARM &&
+ static_cast<AudioChannelType>(AUDIO_AGENT_CHANNEL_TELEPHONY) ==
+ AUDIO_CHANNEL_TELEPHONY &&
+ static_cast<AudioChannelType>(AUDIO_AGENT_CHANNEL_RINGER) ==
+ AUDIO_CHANNEL_RINGER &&
+ static_cast<AudioChannelType>(AUDIO_AGENT_CHANNEL_PUBLICNOTIFICATION) ==
+ AUDIO_CHANNEL_PUBLICNOTIFICATION,
+ "Enum of channel on nsIAudioChannelAgent.idl should be the same with AudioChannelCommon.h");
if (mAudioChannelType != AUDIO_AGENT_CHANNEL_ERROR ||
aChannelType > AUDIO_AGENT_CHANNEL_PUBLICNOTIFICATION ||
aChannelType < AUDIO_AGENT_CHANNEL_NORMAL) {
return NS_ERROR_FAILURE;
}
mAudioChannelType = aChannelType;
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -1215,19 +1215,19 @@ nsDOMClassInfo::RegisterExternalClasses(
nsDOMTouchEvent::PrefEnabled())
#endif // MOZ_B2G
nsresult
nsDOMClassInfo::Init()
{
/* Errors that can trigger early returns are done first,
otherwise nsDOMClassInfo is left in a half inited state. */
- MOZ_STATIC_ASSERT(sizeof(uintptr_t) == sizeof(void*),
- "BAD! You'll need to adjust the size of uintptr_t to the "
- "size of a pointer on your platform.");
+ static_assert(sizeof(uintptr_t) == sizeof(void*),
+ "BAD! You'll need to adjust the size of uintptr_t to the "
+ "size of a pointer on your platform.");
NS_ENSURE_TRUE(!sIsInitialized, NS_ERROR_ALREADY_INITIALIZED);
nsScriptNameSpaceManager *nameSpaceManager = nsJSRuntime::GetNameSpaceManager();
NS_ENSURE_TRUE(nameSpaceManager, NS_ERROR_NOT_INITIALIZED);
nsresult rv = CallGetService(nsIXPConnect::GetCID(), &sXPConnect);
NS_ENSURE_SUCCESS(rv, rv);
@@ -1681,19 +1681,19 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(XULCheckboxElement, nsIDOMXULCheckboxElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMXULCheckboxElement)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(XULPopupElement, nsIDOMXULPopupElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMXULPopupElement)
DOM_CLASSINFO_MAP_END
- MOZ_STATIC_ASSERT(MOZ_ARRAY_LENGTH(sClassInfoData) == eDOMClassInfoIDCount,
- "The number of items in sClassInfoData doesn't match the "
- "number of nsIDOMClassInfo ID's, this is bad! Fix it!");
+ static_assert(MOZ_ARRAY_LENGTH(sClassInfoData) == eDOMClassInfoIDCount,
+ "The number of items in sClassInfoData doesn't match the "
+ "number of nsIDOMClassInfo ID's, this is bad! Fix it!");
#ifdef DEBUG
for (size_t i = 0; i < eDOMClassInfoIDCount; i++) {
if (!sClassInfoData[i].u.mConstructorFptr ||
sClassInfoData[i].mDebugID != i) {
MOZ_CRASH("Class info data out of sync, you forgot to update "
"nsDOMClassInfo.h and nsDOMClassInfo.cpp! Fix this, "
"mozilla will not work without this fixed!");
--- a/dom/bindings/BindingUtils.cpp
+++ b/dom/bindings/BindingUtils.cpp
@@ -1980,23 +1980,23 @@ ConvertJSValueToByteString(JSContext* cx
// Conversion from Javascript string to ByteString is only valid if all
// characters < 256.
for (size_t i = 0; i < length; i++) {
if (chars[i] > 255) {
// The largest unsigned 64 bit number (18,446,744,073,709,551,615) has
// 20 digits, plus one more for the null terminator.
char index[21];
- MOZ_STATIC_ASSERT(sizeof(size_t) <= 8, "index array too small");
+ static_assert(sizeof(size_t) <= 8, "index array too small");
PR_snprintf(index, sizeof(index), "%d", i);
// A jschar is 16 bits long. The biggest unsigned 16 bit
// number (65,535) has 5 digits, plus one more for the null
// terminator.
char badChar[6];
- MOZ_STATIC_ASSERT(sizeof(jschar) <= 2, "badChar array too small");
+ static_assert(sizeof(jschar) <= 2, "badChar array too small");
PR_snprintf(badChar, sizeof(badChar), "%d", chars[i]);
ThrowErrorMessage(cx, MSG_INVALID_BYTESTRING, index, badChar);
return false;
}
}
if (length >= UINT32_MAX) {
return false;
--- a/dom/bindings/BindingUtils.h
+++ b/dom/bindings/BindingUtils.h
@@ -126,19 +126,19 @@ IsDOMIfaceAndProtoClass(const JSClass* c
}
inline bool
IsDOMIfaceAndProtoClass(const js::Class* clasp)
{
return IsDOMIfaceAndProtoClass(Jsvalify(clasp));
}
-MOZ_STATIC_ASSERT(DOM_OBJECT_SLOT == js::PROXY_PRIVATE_SLOT,
- "js::PROXY_PRIVATE_SLOT doesn't match DOM_OBJECT_SLOT. "
- "Expect bad things");
+static_assert(DOM_OBJECT_SLOT == js::PROXY_PRIVATE_SLOT,
+ "js::PROXY_PRIVATE_SLOT doesn't match DOM_OBJECT_SLOT. "
+ "Expect bad things");
template <class T>
inline T*
UnwrapDOMObject(JSObject* obj)
{
MOZ_ASSERT(IsDOMClass(js::GetObjectClass(obj)) || IsDOMProxy(obj),
"Don't pass non-DOM objects to this function");
JS::Value val = js::GetReservedSlot(obj, DOM_OBJECT_SLOT);
@@ -264,19 +264,19 @@ UnwrapObject(JSContext* cx, JSObject* ob
{
return UnwrapObject<static_cast<prototypes::ID>(
PrototypeIDMap<T>::PrototypeID), T>(cx, obj, value);
}
// The items in the protoAndIfaceArray are indexed by the prototypes::id::ID and
// constructors::id::ID enums, in that order. The end of the prototype objects
// should be the start of the interface objects.
-MOZ_STATIC_ASSERT((size_t)constructors::id::_ID_Start ==
- (size_t)prototypes::id::_ID_Count,
- "Overlapping or discontiguous indexes.");
+static_assert((size_t)constructors::id::_ID_Start ==
+ (size_t)prototypes::id::_ID_Count,
+ "Overlapping or discontiguous indexes.");
const size_t kProtoAndIfaceCacheCount = constructors::id::_ID_Count;
inline void
AllocateProtoAndIfaceCache(JSObject* obj)
{
MOZ_ASSERT(js::GetObjectClass(obj)->flags & JSCLASS_DOM_GLOBAL);
MOZ_ASSERT(js::GetReservedSlot(obj, DOM_PROTOTYPE_SLOT).isUndefined());
@@ -1522,27 +1522,27 @@ private:
// A class to use for our static asserts to ensure our object layout
// matches that of nsDependentString.
class DependentStringAsserter;
friend class DependentStringAsserter;
class DepedentStringAsserter : public nsDependentString {
public:
static void StaticAsserts() {
- MOZ_STATIC_ASSERT(sizeof(FakeDependentString) == sizeof(nsDependentString),
- "Must have right object size");
- MOZ_STATIC_ASSERT(offsetof(FakeDependentString, mData) ==
- offsetof(DepedentStringAsserter, mData),
- "Offset of mData should match");
- MOZ_STATIC_ASSERT(offsetof(FakeDependentString, mLength) ==
- offsetof(DepedentStringAsserter, mLength),
- "Offset of mLength should match");
- MOZ_STATIC_ASSERT(offsetof(FakeDependentString, mFlags) ==
- offsetof(DepedentStringAsserter, mFlags),
- "Offset of mFlags should match");
+ static_assert(sizeof(FakeDependentString) == sizeof(nsDependentString),
+ "Must have right object size");
+ static_assert(offsetof(FakeDependentString, mData) ==
+ offsetof(DepedentStringAsserter, mData),
+ "Offset of mData should match");
+ static_assert(offsetof(FakeDependentString, mLength) ==
+ offsetof(DepedentStringAsserter, mLength),
+ "Offset of mLength should match");
+ static_assert(offsetof(FakeDependentString, mFlags) ==
+ offsetof(DepedentStringAsserter, mFlags),
+ "Offset of mFlags should match");
}
};
};
enum StringificationBehavior {
eStringify,
eEmpty,
eNull
--- a/dom/bindings/DOMJSClass.h
+++ b/dom/bindings/DOMJSClass.h
@@ -45,19 +45,19 @@ class nsCycleCollectionParticipant;
// DOM_INTERFACE_SLOTS_BASE + number of named constructors.
#define DOM_INTERFACE_SLOTS_BASE (DOM_XRAY_EXPANDO_SLOT + 1)
// Interface prototype objects store a number of reserved slots equal to
// DOM_INTERFACE_PROTO_SLOTS_BASE or DOM_INTERFACE_PROTO_SLOTS_BASE + 1 if a
// slot for the unforgeable holder is needed.
#define DOM_INTERFACE_PROTO_SLOTS_BASE (DOM_XRAY_EXPANDO_SLOT + 1)
-MOZ_STATIC_ASSERT(DOM_PROTO_INSTANCE_CLASS_SLOT != DOM_XRAY_EXPANDO_SLOT,
- "Interface prototype object use both of these, so they must "
- "not be the same slot.");
+static_assert(DOM_PROTO_INSTANCE_CLASS_SLOT != DOM_XRAY_EXPANDO_SLOT,
+ "Interface prototype object use both of these, so they must "
+ "not be the same slot.");
namespace mozilla {
namespace dom {
typedef bool
(* ResolveOwnProperty)(JSContext* cx, JS::Handle<JSObject*> wrapper,
JS::Handle<JSObject*> obj, JS::Handle<jsid> id,
JSPropertyDescriptor* desc, unsigned flags);
--- a/dom/bindings/PrimitiveConversions.h
+++ b/dom/bindings/PrimitiveConversions.h
@@ -219,18 +219,18 @@ struct PrimitiveConversionTraits_ToCheck
return Enforce(cx, intermediate, retval);
}
};
template<typename T>
inline bool
PrimitiveConversionTraits_EnforceRange(JSContext* cx, const double& d, T* retval)
{
- MOZ_STATIC_ASSERT(std::numeric_limits<T>::is_integer,
- "This can only be applied to integers!");
+ static_assert(std::numeric_limits<T>::is_integer,
+ "This can only be applied to integers!");
if (!mozilla::IsFinite(d)) {
return ThrowErrorMessage(cx, MSG_ENFORCE_RANGE_NON_FINITE, TypeName<T>::value());
}
bool neg = (d < 0);
double rounded = floor(neg ? -d : d);
rounded = neg ? -rounded : rounded;
@@ -247,18 +247,18 @@ template<typename T>
struct PrimitiveConversionTraits<T, eEnforceRange> :
public PrimitiveConversionTraits_ToCheckedIntHelper<T, PrimitiveConversionTraits_EnforceRange<T> > {
};
template<typename T>
inline bool
PrimitiveConversionTraits_Clamp(JSContext* cx, const double& d, T* retval)
{
- MOZ_STATIC_ASSERT(std::numeric_limits<T>::is_integer,
- "This can only be applied to integers!");
+ static_assert(std::numeric_limits<T>::is_integer,
+ "This can only be applied to integers!");
if (mozilla::IsNaN(d)) {
*retval = 0;
return true;
}
if (d >= PrimitiveConversionTraits_Limits<T>::max()) {
*retval = PrimitiveConversionTraits_Limits<T>::max();
return true;
--- a/dom/bluetooth/linux/BluetoothDBusService.cpp
+++ b/dom/bluetooth/linux/BluetoothDBusService.cpp
@@ -790,17 +790,17 @@ GetDevicePropertiesCallback(DBusMessage*
static DBusCallback sBluetoothDBusPropCallbacks[] =
{
GetManagerPropertiesCallback,
GetAdapterPropertiesCallback,
GetDevicePropertiesCallback
};
-MOZ_STATIC_ASSERT(
+static_assert(
sizeof(sBluetoothDBusPropCallbacks) == sizeof(sBluetoothDBusIfaces),
"DBus Property callback array and DBus interface array must be same size");
static void
ParsePropertyChange(DBusMessage* aMsg, BluetoothValue& aValue,
nsAString& aErrorStr, Properties* aPropertyTypes,
const int aPropertyTypeLen)
{
--- a/dom/indexedDB/IDBCursor.cpp
+++ b/dom/indexedDB/IDBCursor.cpp
@@ -27,19 +27,19 @@
#include "ipc/IndexedDBChild.h"
#include "ipc/IndexedDBParent.h"
#include "IndexedDatabaseInlines.h"
USING_INDEXEDDB_NAMESPACE
using namespace mozilla::dom::indexedDB::ipc;
-MOZ_STATIC_ASSERT(sizeof(size_t) >= sizeof(IDBCursor::Direction),
- "Relying on conversion between size_t and "
- "IDBCursor::Direction");
+static_assert(sizeof(size_t) >= sizeof(IDBCursor::Direction),
+ "Relying on conversion between size_t and "
+ "IDBCursor::Direction");
namespace {
class CursorHelper : public AsyncConnectionHelper
{
public:
CursorHelper(IDBCursor* aCursor)
: AsyncConnectionHelper(aCursor->Transaction(), aCursor->Request()),
--- a/dom/indexedDB/IDBObjectStore.cpp
+++ b/dom/indexedDB/IDBObjectStore.cpp
@@ -1326,18 +1326,18 @@ StructuredCloneReadString(JSStructuredCl
return true;
}
// static
bool
IDBObjectStore::ReadFileHandle(JSStructuredCloneReader* aReader,
FileHandleData* aRetval)
{
- MOZ_STATIC_ASSERT(SCTAG_DOM_FILEHANDLE == 0xFFFF8004,
- "Update me!");
+ static_assert(SCTAG_DOM_FILEHANDLE == 0xFFFF8004,
+ "Update me!");
MOZ_ASSERT(aReader && aRetval);
nsCString type;
if (!StructuredCloneReadString(aReader, type)) {
return false;
}
CopyUTF8toUTF16(type, aRetval->type);
@@ -1351,20 +1351,20 @@ IDBObjectStore::ReadFileHandle(JSStructu
}
// static
bool
IDBObjectStore::ReadBlobOrFile(JSStructuredCloneReader* aReader,
uint32_t aTag,
BlobOrFileData* aRetval)
{
- MOZ_STATIC_ASSERT(SCTAG_DOM_BLOB == 0xFFFF8001 &&
- SCTAG_DOM_FILE_WITHOUT_LASTMODIFIEDDATE == 0xFFFF8002 &&
- SCTAG_DOM_FILE == 0xFFFF8005,
- "Update me!");
+ static_assert(SCTAG_DOM_BLOB == 0xFFFF8001 &&
+ SCTAG_DOM_FILE_WITHOUT_LASTMODIFIEDDATE == 0xFFFF8002 &&
+ SCTAG_DOM_FILE == 0xFFFF8005,
+ "Update me!");
MOZ_ASSERT(aReader && aRetval);
MOZ_ASSERT(aTag == SCTAG_DOM_FILE ||
aTag == SCTAG_DOM_FILE_WITHOUT_LASTMODIFIEDDATE ||
aTag == SCTAG_DOM_BLOB);
aRetval->tag = aTag;
// If it's not a FileHandle, it's a Blob or a File.
@@ -1412,22 +1412,22 @@ JSObject*
IDBObjectStore::StructuredCloneReadCallback(JSContext* aCx,
JSStructuredCloneReader* aReader,
uint32_t aTag,
uint32_t aData,
void* aClosure)
{
// We need to statically assert that our tag values are what we expect
// so that if people accidentally change them they notice.
- MOZ_STATIC_ASSERT(SCTAG_DOM_BLOB == 0xFFFF8001 &&
- SCTAG_DOM_FILE_WITHOUT_LASTMODIFIEDDATE == 0xFFFF8002 &&
- SCTAG_DOM_FILEHANDLE == 0xFFFF8004 &&
- SCTAG_DOM_FILE == 0xFFFF8005,
- "You changed our structured clone tag values and just ate "
- "everyone's IndexedDB data. I hope you are happy.");
+ static_assert(SCTAG_DOM_BLOB == 0xFFFF8001 &&
+ SCTAG_DOM_FILE_WITHOUT_LASTMODIFIEDDATE == 0xFFFF8002 &&
+ SCTAG_DOM_FILEHANDLE == 0xFFFF8004 &&
+ SCTAG_DOM_FILE == 0xFFFF8005,
+ "You changed our structured clone tag values and just ate "
+ "everyone's IndexedDB data. I hope you are happy.");
if (aTag == SCTAG_DOM_FILE_WITHOUT_LASTMODIFIEDDATE ||
aTag == SCTAG_DOM_FILEHANDLE ||
aTag == SCTAG_DOM_BLOB ||
aTag == SCTAG_DOM_FILE) {
StructuredCloneReadInfo* cloneReadInfo =
reinterpret_cast<StructuredCloneReadInfo*>(aClosure);
--- a/dom/indexedDB/Key.cpp
+++ b/dom/indexedDB/Key.cpp
@@ -101,18 +101,18 @@ const int MaxArrayCollapse = 3;
const int MaxRecursionDepth = 256;
nsresult
Key::EncodeJSValInternal(JSContext* aCx, const jsval aVal,
uint8_t aTypeOffset, uint16_t aRecursionDepth)
{
NS_ENSURE_TRUE(aRecursionDepth < MaxRecursionDepth, NS_ERROR_DOM_INDEXEDDB_DATA_ERR);
- MOZ_STATIC_ASSERT(eMaxType * MaxArrayCollapse < 256,
- "Unable to encode jsvals.");
+ static_assert(eMaxType * MaxArrayCollapse < 256,
+ "Unable to encode jsvals.");
if (JSVAL_IS_STRING(aVal)) {
nsDependentJSString str;
if (!str.init(aCx, aVal)) {
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
}
EncodeString(str, aTypeOffset);
return NS_OK;
--- a/dom/indexedDB/OpenDatabaseHelper.cpp
+++ b/dom/indexedDB/OpenDatabaseHelper.cpp
@@ -29,33 +29,33 @@ using namespace mozilla;
using namespace mozilla::dom;
USING_INDEXEDDB_NAMESPACE
USING_QUOTA_NAMESPACE
namespace {
// If JS_STRUCTURED_CLONE_VERSION changes then we need to update our major
// schema version.
-MOZ_STATIC_ASSERT(JS_STRUCTURED_CLONE_VERSION == 2,
- "Need to update the major schema version.");
+static_assert(JS_STRUCTURED_CLONE_VERSION == 2,
+ "Need to update the major schema version.");
// Major schema version. Bump for almost everything.
const uint32_t kMajorSchemaVersion = 14;
// Minor schema version. Should almost always be 0 (maybe bump on release
// branches if we have to).
const uint32_t kMinorSchemaVersion = 0;
// The schema version we store in the SQLite database is a (signed) 32-bit
// integer. The major version is left-shifted 4 bits so the max value is
// 0xFFFFFFF. The minor version occupies the lower 4 bits and its max is 0xF.
-MOZ_STATIC_ASSERT(kMajorSchemaVersion <= 0xFFFFFFF,
- "Major version needs to fit in 28 bits.");
-MOZ_STATIC_ASSERT(kMinorSchemaVersion <= 0xF,
- "Minor version needs to fit in 4 bits.");
+static_assert(kMajorSchemaVersion <= 0xFFFFFFF,
+ "Major version needs to fit in 28 bits.");
+static_assert(kMinorSchemaVersion <= 0xF,
+ "Minor version needs to fit in 4 bits.");
inline
int32_t
MakeSchemaVersion(uint32_t aMajorSchemaVersion,
uint32_t aMinorSchemaVersion)
{
return int32_t((aMajorSchemaVersion << 4) + aMinorSchemaVersion);
}
@@ -1976,18 +1976,18 @@ OpenDatabaseHelper::CreateDatabaseConnec
rv = stmt->BindStringByName(NS_LITERAL_CSTRING("name"), aName);
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
rv = stmt->Execute();
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
}
else {
// This logic needs to change next time we change the schema!
- MOZ_STATIC_ASSERT(kSQLiteSchemaVersion == int32_t((14 << 4) + 0),
- "Need upgrade code from schema version increase.");
+ static_assert(kSQLiteSchemaVersion == int32_t((14 << 4) + 0),
+ "Need upgrade code from schema version increase.");
while (schemaVersion != kSQLiteSchemaVersion) {
if (schemaVersion == 4) {
rv = UpgradeSchemaFrom4To5(connection);
}
else if (schemaVersion == 5) {
rv = UpgradeSchemaFrom5To6(connection);
}
--- a/dom/ipc/Blob.cpp
+++ b/dom/ipc/Blob.cpp
@@ -359,18 +359,18 @@ private:
}
};
template <ActorFlavorEnum ActorFlavor>
inline
already_AddRefed<nsIDOMBlob>
GetBlobFromParams(const SlicedBlobConstructorParams& aParams)
{
- MOZ_STATIC_ASSERT(ActorFlavor == mozilla::dom::ipc::Parent,
- "No other flavor is supported here!");
+ static_assert(ActorFlavor == mozilla::dom::ipc::Parent,
+ "No other flavor is supported here!");
BlobParent* actor =
const_cast<BlobParent*>(
static_cast<const BlobParent*>(aParams.sourceParent()));
MOZ_ASSERT(actor);
return actor->GetBlob();
}
--- a/dom/plugins/base/nsPluginTags.cpp
+++ b/dom/plugins/base/nsPluginTags.cpp
@@ -378,19 +378,19 @@ nsPluginTag::GetPluginState()
uint32_t enabledState = nsIPluginTag::STATE_DISABLED;
GetEnabledState(&enabledState);
return (PluginState)enabledState;
}
void
nsPluginTag::SetPluginState(PluginState state)
{
- MOZ_STATIC_ASSERT((uint32_t)nsPluginTag::ePluginState_Disabled == nsIPluginTag::STATE_DISABLED, "nsPluginTag::ePluginState_Disabled must match nsIPluginTag::STATE_DISABLED");
- MOZ_STATIC_ASSERT((uint32_t)nsPluginTag::ePluginState_Clicktoplay == nsIPluginTag::STATE_CLICKTOPLAY, "nsPluginTag::ePluginState_Clicktoplay must match nsIPluginTag::STATE_CLICKTOPLAY");
- MOZ_STATIC_ASSERT((uint32_t)nsPluginTag::ePluginState_Enabled == nsIPluginTag::STATE_ENABLED, "nsPluginTag::ePluginState_Enabled must match nsIPluginTag::STATE_ENABLED");
+ static_assert((uint32_t)nsPluginTag::ePluginState_Disabled == nsIPluginTag::STATE_DISABLED, "nsPluginTag::ePluginState_Disabled must match nsIPluginTag::STATE_DISABLED");
+ static_assert((uint32_t)nsPluginTag::ePluginState_Clicktoplay == nsIPluginTag::STATE_CLICKTOPLAY, "nsPluginTag::ePluginState_Clicktoplay must match nsIPluginTag::STATE_CLICKTOPLAY");
+ static_assert((uint32_t)nsPluginTag::ePluginState_Enabled == nsIPluginTag::STATE_ENABLED, "nsPluginTag::ePluginState_Enabled must match nsIPluginTag::STATE_ENABLED");
SetEnabledState((uint32_t)state);
}
NS_IMETHODIMP
nsPluginTag::GetMimeTypes(uint32_t* aCount, PRUnichar*** aResults)
{
uint32_t count = mMimeTypes.Length();
*aResults = static_cast<PRUnichar**>
--- a/dom/quota/QuotaManager.cpp
+++ b/dom/quota/QuotaManager.cpp
@@ -478,18 +478,18 @@ QuotaManager::Init()
NS_WARNING("Unable to respond to quota pref changes!");
gStorageQuotaMB = DEFAULT_QUOTA_MB;
}
mOriginInfos.Init();
mCheckQuotaHelpers.Init();
mLiveStorages.Init();
- MOZ_STATIC_ASSERT(Client::IDB == 0 && Client::TYPE_MAX == 1,
- "Fix the registration!");
+ static_assert(Client::IDB == 0 && Client::TYPE_MAX == 1,
+ "Fix the registration!");
NS_ASSERTION(mClients.Capacity() == Client::TYPE_MAX,
"Should be using an auto array with correct capacity!");
// Register IndexedDB
mClients.AppendElement(new indexedDB::Client());
return NS_OK;
--- a/dom/src/storage/DOMStorageDBThread.cpp
+++ b/dom/src/storage/DOMStorageDBThread.cpp
@@ -672,17 +672,17 @@ DOMStorageDBThread::UnscheduleFlush()
PRIntervalTime
DOMStorageDBThread::TimeUntilFlush()
{
if (mFlushImmediately) {
return 0; // Do it now regardless the timeout.
}
- MOZ_STATIC_ASSERT(PR_INTERVAL_NO_TIMEOUT != 0,
+ static_assert(PR_INTERVAL_NO_TIMEOUT != 0,
"PR_INTERVAL_NO_TIMEOUT must be non-zero");
if (!mDirtyEpoch) {
return PR_INTERVAL_NO_TIMEOUT; // No pending task...
}
static const PRIntervalTime kMaxAge = PR_MillisecondsToInterval(FLUSHING_INTERVAL_MS);
--- a/dom/workers/RuntimeService.cpp
+++ b/dom/workers/RuntimeService.cpp
@@ -62,18 +62,18 @@ using mozilla::Preferences;
#define WORKER_STACK_SIZE 256 * sizeof(size_t) * 1024
// Half the size of the actual C stack, to be safe.
#define WORKER_CONTEXT_NATIVE_STACK_LIMIT 128 * sizeof(size_t) * 1024
// The maximum number of threads to use for workers, overridable via pref.
#define MAX_WORKERS_PER_DOMAIN 10
-MOZ_STATIC_ASSERT(MAX_WORKERS_PER_DOMAIN >= 1,
- "We should allow at least one worker per domain.");
+static_assert(MAX_WORKERS_PER_DOMAIN >= 1,
+ "We should allow at least one worker per domain.");
// The default number of seconds that close handlers will be allowed to run for
// content workers.
#define MAX_SCRIPT_RUN_TIME_SEC 10
// The number of seconds that idle threads can hang around before being killed.
#define IDLE_THREAD_TIMEOUT_SEC 30
@@ -151,18 +151,18 @@ const char* gStringChars[] = {
"WorkerEvent",
"WorkerMessageEvent",
"WorkerErrorEvent"
// XXX Don't care about ProgressEvent since it should never leak to the main
// thread.
};
-MOZ_STATIC_ASSERT(NS_ARRAY_LENGTH(gStringChars) == ID_COUNT,
- "gStringChars should have the right length.");
+static_assert(NS_ARRAY_LENGTH(gStringChars) == ID_COUNT,
+ "gStringChars should have the right length.");
class LiteralRebindingCString : public nsDependentCString
{
public:
template<int N>
void RebindLiteral(const char (&aStr)[N])
{
Rebind(aStr, N-1);
--- a/gfx/2d/convolver.h
+++ b/gfx/2d/convolver.h
@@ -69,18 +69,18 @@ class ConvolutionFilter1D {
}
static unsigned char FixedToChar(Fixed x) {
return static_cast<unsigned char>(x >> kShiftBits);
}
static float FixedToFloat(Fixed x) {
// The cast relies on Fixed being a short, implying that on
// the platforms we care about all (16) bits will fit into
// the mantissa of a (32-bit) float.
- MOZ_STATIC_ASSERT(sizeof(Fixed) == 2,
- "fixed type should fit in float mantissa");
+ static_assert(sizeof(Fixed) == 2,
+ "fixed type should fit in float mantissa");
float raw = static_cast<float>(x);
return ldexpf(raw, -kShiftBits);
}
// Returns the maximum pixel span of a filter.
int max_filter() const { return max_filter_; }
// Returns the number of filters in this filter. This is the dimension of the
--- a/gfx/layers/ipc/ShadowLayerUtils.h
+++ b/gfx/layers/ipc/ShadowLayerUtils.h
@@ -53,18 +53,18 @@ struct ParamTraits<mozilla::layers::Surf
template<>
struct ParamTraits<mozilla::gl::GLContext::SharedTextureShareType>
{
typedef mozilla::gl::GLContext::SharedTextureShareType paramType;
static void Write(Message* msg, const paramType& param)
{
- MOZ_STATIC_ASSERT(sizeof(paramType) <= sizeof(int32_t),
- "TextureShareType assumes to be int32_t");
+ static_assert(sizeof(paramType) <= sizeof(int32_t),
+ "TextureShareType assumes to be int32_t");
WriteParam(msg, int32_t(param));
}
static bool Read(const Message* msg, void** iter, paramType* result)
{
int32_t type;
if (!ReadParam(msg, iter, &type))
return false;
--- a/ipc/chromium/src/base/pickle.cc
+++ b/ipc/chromium/src/base/pickle.cc
@@ -11,18 +11,18 @@
#include <stdlib.h>
#include <limits>
#include <string>
#include <algorithm>
//------------------------------------------------------------------------------
-MOZ_STATIC_ASSERT(MOZ_ALIGNOF(Pickle::memberAlignmentType) >= MOZ_ALIGNOF(uint32_t),
- "Insufficient alignment");
+static_assert(MOZ_ALIGNOF(Pickle::memberAlignmentType) >= MOZ_ALIGNOF(uint32_t),
+ "Insufficient alignment");
// static
const int Pickle::kPayloadUnit = 64;
// We mark a read only pickle with a special capacity_.
static const uint32_t kCapacityReadOnly = (uint32_t) -1;
static const char kBytePaddingMarker = char(0xbf);
@@ -56,18 +56,18 @@ template<typename T>
struct Copier<T, sizeof(uint64_t), false>
{
static void Copy(T* dest, void** iter) {
#if MOZ_LITTLE_ENDIAN
static const int loIndex = 0, hiIndex = 1;
#else
static const int loIndex = 1, hiIndex = 0;
#endif
- MOZ_STATIC_ASSERT(MOZ_ALIGNOF(uint32_t*) == MOZ_ALIGNOF(void*),
- "Pointers have different alignments");
+ static_assert(MOZ_ALIGNOF(uint32_t*) == MOZ_ALIGNOF(void*),
+ "Pointers have different alignments");
uint32_t* src = *reinterpret_cast<uint32_t**>(iter);
uint32_t* uint32dest = reinterpret_cast<uint32_t*>(dest);
uint32dest[loIndex] = src[loIndex];
uint32dest[hiIndex] = src[hiIndex];
}
};
#endif
@@ -76,25 +76,25 @@ struct Copier<T, size, true>
{
static void Copy(T* dest, void** iter) {
// The reinterpret_cast is only safe if two conditions hold:
// (1) If the alignment of T* is the same as void*;
// (2) The alignment of the data in *iter is at least as
// big as MOZ_ALIGNOF(T).
// Check the first condition, as the second condition is already
// known to be true, or we wouldn't be here.
- MOZ_STATIC_ASSERT(MOZ_ALIGNOF(T*) == MOZ_ALIGNOF(void*),
- "Pointers have different alignments");
+ static_assert(MOZ_ALIGNOF(T*) == MOZ_ALIGNOF(void*),
+ "Pointers have different alignments");
*dest = *(*reinterpret_cast<T**>(iter));
}
};
template<typename T>
void CopyFromIter(T* dest, void** iter) {
- MOZ_STATIC_ASSERT(mozilla::IsPod<T>::value, "Copied type must be a POD type");
+ static_assert(mozilla::IsPod<T>::value, "Copied type must be a POD type");
Copier<T, sizeof(T), (MOZ_ALIGNOF(T) <= sizeof(Pickle::memberAlignmentType))>::Copy(dest, iter);
}
} // anonymous namespace
// Payload is sizeof(Pickle::memberAlignmentType) aligned.
Pickle::Pickle()
--- a/ipc/chromium/src/base/pickle.h
+++ b/ipc/chromium/src/base/pickle.h
@@ -246,17 +246,17 @@ class Pickle {
// A realloc() failure will cause a Resize failure... and caller should check
// the return result for true (i.e., successful resizing).
bool Resize(uint32_t new_capacity);
// Round 'bytes' up to the next multiple of 'alignment'. 'alignment' must be
// a power of 2.
template<uint32_t alignment> struct ConstantAligner {
static uint32_t align(int bytes) {
- MOZ_STATIC_ASSERT((alignment & (alignment - 1)) == 0,
+ static_assert((alignment & (alignment - 1)) == 0,
"alignment must be a power of two");
return (bytes + (alignment - 1)) & ~static_cast<uint32_t>(alignment - 1);
}
};
static uint32_t AlignInt(int bytes) {
return ConstantAligner<sizeof(memberAlignmentType)>::align(bytes);
}
--- a/js/public/RootingAPI.h
+++ b/js/public/RootingAPI.h
@@ -183,18 +183,18 @@ struct JS_PUBLIC_API(NullPtr)
* Requirements for type T:
* - Must be one of: Value, jsid, JSObject*, JSString*, JSScript*
*/
template <typename T>
class Heap : public js::HeapBase<T>
{
public:
Heap() {
- MOZ_STATIC_ASSERT(sizeof(T) == sizeof(Heap<T>),
- "Heap<T> must be binary compatible with T.");
+ static_assert(sizeof(T) == sizeof(Heap<T>),
+ "Heap<T> must be binary compatible with T.");
init(js::GCMethods<T>::initial());
}
explicit Heap(T p) { init(p); }
explicit Heap(const Heap<T> &p) { init(p.ptr); }
~Heap() {
if (js::GCMethods<T>::needsPostBarrier(ptr))
relocate();
@@ -296,18 +296,18 @@ AssertGCThingMustBeTenured(JSObject *obj
* - It is however valid for a Heap<T> to refer to a tenured thing.
* - It is not possible to store flag bits in a Heap<T>.
*/
template <typename T>
class TenuredHeap : public js::HeapBase<T>
{
public:
TenuredHeap() : bits(0) {
- MOZ_STATIC_ASSERT(sizeof(T) == sizeof(TenuredHeap<T>),
- "TenuredHeap<T> must be binary compatible with T.");
+ static_assert(sizeof(T) == sizeof(TenuredHeap<T>),
+ "TenuredHeap<T> must be binary compatible with T.");
}
explicit TenuredHeap(T p) : bits(0) { setPtr(p); }
explicit TenuredHeap(const TenuredHeap<T> &p) : bits(0) { setPtr(p.ptr); }
bool operator==(const TenuredHeap<T> &other) { return bits == other.bits; }
bool operator!=(const TenuredHeap<T> &other) { return bits != other.bits; }
void setPtr(T newPtr) {
@@ -380,32 +380,32 @@ class MOZ_NONHEAP_CLASS Handle : public
friend class MutableHandle<T>;
public:
/* Creates a handle from a handle of a type convertible to T. */
template <typename S>
Handle(Handle<S> handle,
typename mozilla::EnableIf<mozilla::IsConvertible<S, T>::value, int>::Type dummy = 0)
{
- MOZ_STATIC_ASSERT(sizeof(Handle<T>) == sizeof(T *),
- "Handle must be binary compatible with T*.");
+ static_assert(sizeof(Handle<T>) == sizeof(T *),
+ "Handle must be binary compatible with T*.");
ptr = reinterpret_cast<const T *>(handle.address());
}
/* Create a handle for a NULL pointer. */
Handle(js::NullPtr) {
- MOZ_STATIC_ASSERT(mozilla::IsPointer<T>::value,
- "js::NullPtr overload not valid for non-pointer types");
+ static_assert(mozilla::IsPointer<T>::value,
+ "js::NullPtr overload not valid for non-pointer types");
ptr = reinterpret_cast<const T *>(&js::NullPtr::constNullValue);
}
/* Create a handle for a NULL pointer. */
Handle(JS::NullPtr) {
- MOZ_STATIC_ASSERT(mozilla::IsPointer<T>::value,
- "JS::NullPtr overload not valid for non-pointer types");
+ static_assert(mozilla::IsPointer<T>::value,
+ "JS::NullPtr overload not valid for non-pointer types");
ptr = reinterpret_cast<const T *>(&JS::NullPtr::constNullValue);
}
Handle(MutableHandle<T> handle) {
ptr = handle.address();
}
/*
@@ -1029,18 +1029,18 @@ Handle<T>::Handle(MutableHandle<S> &root
{
ptr = reinterpret_cast<const T *>(root.address());
}
template <typename T>
inline
MutableHandle<T>::MutableHandle(Rooted<T> *root)
{
- MOZ_STATIC_ASSERT(sizeof(MutableHandle<T>) == sizeof(T *),
- "MutableHandle must be binary compatible with T*.");
+ static_assert(sizeof(MutableHandle<T>) == sizeof(T *),
+ "MutableHandle must be binary compatible with T*.");
ptr = root->address();
}
} /* namespace JS */
namespace js {
/*
--- a/js/public/Utility.h
+++ b/js/public/Utility.h
@@ -57,17 +57,17 @@ namespace js {}
#if defined(DEBUG)
# define JS_DIAGNOSTICS_ASSERT(expr) MOZ_ASSERT(expr)
#elif defined(JS_CRASH_DIAGNOSTICS)
# define JS_DIAGNOSTICS_ASSERT(expr) do { if (!(expr)) MOZ_CRASH(); } while(0)
#else
# define JS_DIAGNOSTICS_ASSERT(expr) ((void) 0)
#endif
-#define JS_STATIC_ASSERT(cond) MOZ_STATIC_ASSERT(cond, "JS_STATIC_ASSERT")
+#define JS_STATIC_ASSERT(cond) static_assert(cond, "JS_STATIC_ASSERT")
#define JS_STATIC_ASSERT_IF(cond, expr) MOZ_STATIC_ASSERT_IF(cond, expr, "JS_STATIC_ASSERT_IF")
extern MOZ_NORETURN JS_PUBLIC_API(void)
JS_Assert(const char *s, const char *file, int ln);
/*
* Abort the process in a non-graceful manner. This will cause a core file,
* call to the debugger or other moral equivalent as well as causing the
--- a/js/public/Value.h
+++ b/js/public/Value.h
@@ -1640,37 +1640,37 @@ inline Anchor<Value>::~Anchor()
bits = JSVAL_TO_IMPL(hold).asBits;
}
#endif
#ifdef DEBUG
namespace detail {
struct ValueAlignmentTester { char c; JS::Value v; };
-MOZ_STATIC_ASSERT(sizeof(ValueAlignmentTester) == 16,
- "JS::Value must be 16-byte-aligned");
+static_assert(sizeof(ValueAlignmentTester) == 16,
+ "JS::Value must be 16-byte-aligned");
struct LayoutAlignmentTester { char c; jsval_layout l; };
-MOZ_STATIC_ASSERT(sizeof(LayoutAlignmentTester) == 16,
- "jsval_layout must be 16-byte-aligned");
+static_assert(sizeof(LayoutAlignmentTester) == 16,
+ "jsval_layout must be 16-byte-aligned");
} // namespace detail
#endif /* DEBUG */
} // namespace JS
/*
* JS::Value and jsval are the same type; jsval is the old name, kept around
* for backwards compatibility along with all the JSVAL_* operations below.
* jsval_layout is an implementation detail and should not be used externally.
*/
typedef JS::Value jsval;
-MOZ_STATIC_ASSERT(sizeof(jsval_layout) == sizeof(JS::Value),
- "jsval_layout and JS::Value must have identical layouts");
+static_assert(sizeof(jsval_layout) == sizeof(JS::Value),
+ "jsval_layout and JS::Value must have identical layouts");
/************************************************************************/
static inline JSBool
JSVAL_IS_NULL(jsval v)
{
return JSVAL_IS_NULL_IMPL(JSVAL_TO_IMPL(v));
}
--- a/js/src/assembler/wtf/Assertions.h
+++ b/js/src/assembler/wtf/Assertions.h
@@ -41,11 +41,11 @@
#define ASSERT(assertion) MOZ_ASSERT(assertion)
#endif
#define ASSERT_UNUSED(variable, assertion) do { \
(void)variable; \
ASSERT(assertion); \
} while (0)
#define ASSERT_NOT_REACHED() MOZ_ASSUME_UNREACHABLE()
#define CRASH() MOZ_CRASH()
-#define COMPILE_ASSERT(exp, name) MOZ_STATIC_ASSERT(exp, #name)
+#define COMPILE_ASSERT(exp, name) static_assert(exp, #name)
#endif /* assembler_wtf_Assertions_h */
--- a/js/src/ds/LifoAlloc.h
+++ b/js/src/ds/LifoAlloc.h
@@ -27,19 +27,19 @@ namespace js {
namespace detail {
static const size_t LIFO_ALLOC_ALIGN = 8;
JS_ALWAYS_INLINE
char *
AlignPtr(void *orig)
{
- MOZ_STATIC_ASSERT(mozilla::tl::FloorLog2<LIFO_ALLOC_ALIGN>::value ==
- mozilla::tl::CeilingLog2<LIFO_ALLOC_ALIGN>::value,
- "LIFO_ALLOC_ALIGN must be a power of two");
+ static_assert(mozilla::tl::FloorLog2<LIFO_ALLOC_ALIGN>::value ==
+ mozilla::tl::CeilingLog2<LIFO_ALLOC_ALIGN>::value,
+ "LIFO_ALLOC_ALIGN must be a power of two");
char *result = (char *) ((uintptr_t(orig) + (LIFO_ALLOC_ALIGN - 1)) & (~LIFO_ALLOC_ALIGN + 1));
JS_ASSERT(uintptr_t(result) % LIFO_ALLOC_ALIGN == 0);
return result;
}
// Header for a chunk of memory wrangled by the LifoAlloc.
class BumpChunk
--- a/js/src/frontend/BytecodeEmitter.cpp
+++ b/js/src/frontend/BytecodeEmitter.cpp
@@ -5453,18 +5453,18 @@ EmitObject(ExclusiveContext *cx, Bytecod
/*
* The object survived and has a predictable shape: update the original
* bytecode.
*/
ObjectBox *objbox = bce->parser->newObjectBox(obj);
if (!objbox)
return false;
unsigned index = bce->objectList.add(objbox);
- MOZ_STATIC_ASSERT(JSOP_NEWINIT_LENGTH == JSOP_NEWOBJECT_LENGTH,
- "newinit and newobject must have equal length to edit in-place");
+ static_assert(JSOP_NEWINIT_LENGTH == JSOP_NEWOBJECT_LENGTH,
+ "newinit and newobject must have equal length to edit in-place");
EMIT_UINT32_IN_PLACE(offset, JSOP_NEWOBJECT, uint32_t(index));
}
return true;
}
static bool
EmitArray(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn)
--- a/js/src/jsfun.h
+++ b/js/src/jsfun.h
@@ -47,18 +47,18 @@ class JSFunction : public JSObject
/* Derived Flags values for convenience: */
NATIVE_FUN = 0,
INTERPRETED_LAMBDA = INTERPRETED | LAMBDA,
INTERPRETED_LAMBDA_ARROW = INTERPRETED | LAMBDA | ARROW
};
static void staticAsserts() {
JS_STATIC_ASSERT(INTERPRETED == JS_FUNCTION_INTERPRETED_BIT);
- MOZ_STATIC_ASSERT(sizeof(JSFunction) == sizeof(js::shadow::Function),
- "shadow interface must match actual interface");
+ static_assert(sizeof(JSFunction) == sizeof(js::shadow::Function),
+ "shadow interface must match actual interface");
}
uint16_t nargs; /* maximum number of specified arguments,
reflected as f.length/f.arity */
uint16_t flags; /* bitfield composed of the above Flags enum */
union U {
class Native {
friend class JSFunction;
--- a/js/src/jsobj.h
+++ b/js/src/jsobj.h
@@ -1013,22 +1013,22 @@ class JSObject : public js::ObjectImpl
static inline js::ThingRootKind rootKind() { return js::THING_ROOT_OBJECT; }
#ifdef DEBUG
void dump();
#endif
private:
static void staticAsserts() {
- MOZ_STATIC_ASSERT(sizeof(JSObject) == sizeof(js::shadow::Object),
- "shadow interface must match actual interface");
- MOZ_STATIC_ASSERT(sizeof(JSObject) == sizeof(js::ObjectImpl),
- "JSObject itself must not have any fields");
- MOZ_STATIC_ASSERT(sizeof(JSObject) % sizeof(js::Value) == 0,
- "fixed slots after an object must be aligned");
+ static_assert(sizeof(JSObject) == sizeof(js::shadow::Object),
+ "shadow interface must match actual interface");
+ static_assert(sizeof(JSObject) == sizeof(js::ObjectImpl),
+ "JSObject itself must not have any fields");
+ static_assert(sizeof(JSObject) % sizeof(js::Value) == 0,
+ "fixed slots after an object must be aligned");
}
JSObject() MOZ_DELETE;
JSObject(const JSObject &other) MOZ_DELETE;
void operator=(const JSObject &other) MOZ_DELETE;
};
/*
--- a/js/src/vm/NumericConversions.h
+++ b/js/src/vm/NumericConversions.h
@@ -33,18 +33,18 @@ namespace detail {
* The algorithm below is inspired by that found in
* <http://trac.webkit.org/changeset/67825/trunk/JavaScriptCore/runtime/JSValue.cpp>
* but has been generalized to all integer widths.
*/
template<typename ResultType>
inline ResultType
ToUintWidth(double d)
{
- MOZ_STATIC_ASSERT(mozilla::IsUnsigned<ResultType>::value,
- "ResultType must be an unsigned type");
+ static_assert(mozilla::IsUnsigned<ResultType>::value,
+ "ResultType must be an unsigned type");
uint64_t bits = mozilla::BitwiseCast<uint64_t>(d);
// Extract the exponent component. (Be careful here! It's not technically
// the exponent in NaN, infinities, and subnormals.)
int_fast16_t exp =
int_fast16_t((bits & mozilla::DoubleExponentBits) >> mozilla::DoubleExponentShift) -
int_fast16_t(mozilla::DoubleExponentBias);
@@ -64,18 +64,18 @@ ToUintWidth(double d)
// floor(abs(d)) == 0 mod 2**32.) Return 0 in all these cases.
const size_t ResultWidth = CHAR_BIT * sizeof(ResultType);
if (exponent >= mozilla::DoubleExponentShift + ResultWidth)
return 0;
// The significand contains the bits that will determine the final result.
// Shift those bits left or right, according to the exponent, to their
// locations in the unsigned binary representation of floor(abs(d)).
- MOZ_STATIC_ASSERT(sizeof(ResultType) <= sizeof(uint64_t),
- "Left-shifting below would lose upper bits");
+ static_assert(sizeof(ResultType) <= sizeof(uint64_t),
+ "Left-shifting below would lose upper bits");
ResultType result = (exponent > mozilla::DoubleExponentShift)
? ResultType(bits << (exponent - mozilla::DoubleExponentShift))
: ResultType(bits >> (mozilla::DoubleExponentShift - exponent));
// Two further complications remain. First, |result| may contain bogus
// sign/exponent bits. Second, IEEE-754 numbers' significands (excluding
// subnormals, but we already handled those) have an implicit leading 1
// which may affect the final result.
@@ -108,18 +108,18 @@ ToUintWidth(double d)
// Compute the congruent value in the signed range.
return (bits & mozilla::DoubleSignBit) ? ~result + 1 : result;
}
template<typename ResultType>
inline ResultType
ToIntWidth(double d)
{
- MOZ_STATIC_ASSERT(mozilla::IsSigned<ResultType>::value,
- "ResultType must be a signed type");
+ static_assert(mozilla::IsSigned<ResultType>::value,
+ "ResultType must be a signed type");
const ResultType MaxValue = (1ULL << (CHAR_BIT * sizeof(ResultType) - 1)) - 1;
const ResultType MinValue = -MaxValue - 1;
typedef typename mozilla::MakeUnsigned<ResultType>::Type UnsignedResult;
UnsignedResult u = ToUintWidth<UnsignedResult>(d);
if (u <= UnsignedResult(MaxValue))
return static_cast<ResultType>(u);
--- a/js/src/vm/ObjectImpl.h
+++ b/js/src/vm/ObjectImpl.h
@@ -452,18 +452,18 @@ class ElementsHeader
} sparse;
class {
friend class ArrayBufferElementsHeader;
JSObject * views;
} buffer;
};
void staticAsserts() {
- MOZ_STATIC_ASSERT(sizeof(ElementsHeader) == ValuesPerHeader * sizeof(Value),
- "Elements size and values-per-Elements mismatch");
+ static_assert(sizeof(ElementsHeader) == ValuesPerHeader * sizeof(Value),
+ "Elements size and values-per-Elements mismatch");
}
public:
ElementsKind kind() const {
MOZ_ASSERT(type <= ArrayBufferElements);
return ElementsKind(type);
}
@@ -633,18 +633,18 @@ struct uint8_clamped {
return *this;
}
operator uint8_t() const {
return val;
}
void staticAsserts() {
- MOZ_STATIC_ASSERT(sizeof(uint8_clamped) == 1,
- "uint8_clamped must be layout-compatible with uint8_t");
+ static_assert(sizeof(uint8_clamped) == 1,
+ "uint8_clamped must be layout-compatible with uint8_t");
}
};
/* Note that we can't use std::numeric_limits here due to uint8_clamped. */
template<typename T> inline const bool TypeIsFloatingPoint() { return false; }
template<> inline const bool TypeIsFloatingPoint<float>() { return true; }
template<> inline const bool TypeIsFloatingPoint<double>() { return true; }
@@ -1067,18 +1067,18 @@ class ObjectElements
/* Number of allocated slots. */
uint32_t capacity;
/* 'length' property of array objects, unused for other objects. */
uint32_t length;
void staticAsserts() {
- MOZ_STATIC_ASSERT(sizeof(ObjectElements) == VALUES_PER_HEADER * sizeof(Value),
- "Elements size and values-per-Elements mismatch");
+ static_assert(sizeof(ObjectElements) == VALUES_PER_HEADER * sizeof(Value),
+ "Elements size and values-per-Elements mismatch");
}
bool shouldConvertDoubleElements() const {
return flags & CONVERT_DOUBLE_ELEMENTS;
}
void setShouldConvertDoubleElements() {
flags |= CONVERT_DOUBLE_ELEMENTS;
}
@@ -1206,29 +1206,29 @@ class ObjectImpl : public gc::Cell
HeapSlot *elements; /* Slots for object elements. */
friend bool
ArraySetLength(JSContext *cx, Handle<ArrayObject*> obj, HandleId id, unsigned attrs,
HandleValue value, bool setterIsStrict);
private:
static void staticAsserts() {
- MOZ_STATIC_ASSERT(sizeof(ObjectImpl) == sizeof(shadow::Object),
- "shadow interface must match actual implementation");
- MOZ_STATIC_ASSERT(sizeof(ObjectImpl) % sizeof(Value) == 0,
- "fixed slots after an object must be aligned");
+ static_assert(sizeof(ObjectImpl) == sizeof(shadow::Object),
+ "shadow interface must match actual implementation");
+ static_assert(sizeof(ObjectImpl) % sizeof(Value) == 0,
+ "fixed slots after an object must be aligned");
- MOZ_STATIC_ASSERT(offsetof(ObjectImpl, shape_) == offsetof(shadow::Object, shape),
- "shadow shape must match actual shape");
- MOZ_STATIC_ASSERT(offsetof(ObjectImpl, type_) == offsetof(shadow::Object, type),
- "shadow type must match actual type");
- MOZ_STATIC_ASSERT(offsetof(ObjectImpl, slots) == offsetof(shadow::Object, slots),
- "shadow slots must match actual slots");
- MOZ_STATIC_ASSERT(offsetof(ObjectImpl, elements) == offsetof(shadow::Object, _1),
- "shadow placeholder must match actual elements");
+ static_assert(offsetof(ObjectImpl, shape_) == offsetof(shadow::Object, shape),
+ "shadow shape must match actual shape");
+ static_assert(offsetof(ObjectImpl, type_) == offsetof(shadow::Object, type),
+ "shadow type must match actual type");
+ static_assert(offsetof(ObjectImpl, slots) == offsetof(shadow::Object, slots),
+ "shadow slots must match actual slots");
+ static_assert(offsetof(ObjectImpl, elements) == offsetof(shadow::Object, _1),
+ "shadow placeholder must match actual elements");
}
JSObject * asObjectPtr() { return reinterpret_cast<JSObject *>(this); }
const JSObject * asObjectPtr() const { return reinterpret_cast<const JSObject *>(this); }
friend inline Value ObjectValue(ObjectImpl &obj);
/* These functions are public, and they should remain public. */
@@ -1618,19 +1618,19 @@ class ObjectImpl : public gc::Cell
}
ElementsHeader & elementsHeader() const {
NEW_OBJECT_REPRESENTATION_ONLY();
return *ElementsHeader::fromElements(elements);
}
inline HeapSlot *fixedElements() const {
- MOZ_STATIC_ASSERT(2 * sizeof(Value) == sizeof(ObjectElements),
- "when elements are stored inline, the first two "
- "slots will hold the ObjectElements header");
+ static_assert(2 * sizeof(Value) == sizeof(ObjectElements),
+ "when elements are stored inline, the first two "
+ "slots will hold the ObjectElements header");
return &fixedSlots()[2];
}
void setFixedElements() { this->elements = fixedElements(); }
inline bool hasDynamicElements() const {
/*
* Note: for objects with zero fixed slots this could potentially give
--- a/layout/base/FramePropertyTable.cpp
+++ b/layout/base/FramePropertyTable.cpp
@@ -36,18 +36,18 @@ FramePropertyTable::Set(nsIFrame* aFrame
entry->mProp.DestroyValueFor(aFrame);
entry->mProp.mValue = aValue;
return;
}
// We need to expand the single current entry to an array
PropertyValue current = entry->mProp;
entry->mProp.mProperty = nullptr;
- MOZ_STATIC_ASSERT(sizeof(nsTArray<PropertyValue>) <= sizeof(void *),
- "Property array must fit entirely within entry->mProp.mValue");
+ static_assert(sizeof(nsTArray<PropertyValue>) <= sizeof(void *),
+ "Property array must fit entirely within entry->mProp.mValue");
new (&entry->mProp.mValue) nsTArray<PropertyValue>(4);
entry->mProp.ToArray()->AppendElement(current);
}
nsTArray<PropertyValue>* array = entry->mProp.ToArray();
nsTArray<PropertyValue>::index_type index =
array->IndexOf(aProperty, 0, PropertyComparator());
if (index != nsTArray<PropertyValue>::NoIndex) {
--- a/layout/base/RestyleManager.cpp
+++ b/layout/base/RestyleManager.cpp
@@ -514,20 +514,20 @@ FrameHasPositionedPlaceholderDescendants
}
}
return false;
}
static bool
NeedToReframeForAddingOrRemovingTransform(nsIFrame* aFrame)
{
- MOZ_STATIC_ASSERT(0 <= NS_STYLE_POSITION_ABSOLUTE &&
- NS_STYLE_POSITION_ABSOLUTE < 32, "Style constant out of range");
- MOZ_STATIC_ASSERT(0 <= NS_STYLE_POSITION_FIXED &&
- NS_STYLE_POSITION_FIXED < 32, "Style constant out of range");
+ static_assert(0 <= NS_STYLE_POSITION_ABSOLUTE &&
+ NS_STYLE_POSITION_ABSOLUTE < 32, "Style constant out of range");
+ static_assert(0 <= NS_STYLE_POSITION_FIXED &&
+ NS_STYLE_POSITION_FIXED < 32, "Style constant out of range");
uint32_t positionMask;
// Don't call aFrame->IsPositioned here, since that returns true if
// the frame already has a transform, and we want to ignore that here
if (aFrame->IsAbsolutelyPositioned() ||
aFrame->IsRelativelyPositioned()) {
// This frame is a container for abs-pos descendants whether or not it
// has a transform.
--- a/layout/base/nsAutoLayoutPhase.cpp
+++ b/layout/base/nsAutoLayoutPhase.cpp
@@ -1,15 +1,15 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef DEBUG
-MOZ_STATIC_ASSERT(false, "This should not be compiled in !DEBUG");
+static_assert(false, "This should not be compiled in !DEBUG");
#endif // DEBUG
#include "nsAutoLayoutPhase.h"
#include "nsPresContext.h"
#include "nsContentUtils.h"
nsAutoLayoutPhase::nsAutoLayoutPhase(nsPresContext* aPresContext,
nsLayoutPhase aPhase)
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -9026,17 +9026,17 @@ nsCSSFrameConstructor::ProcessChildren(n
PendingBinding* aPendingBinding,
nsIFrame* aPossiblyLeafFrame)
{
NS_PRECONDITION(aFrame, "Must have parent frame here");
NS_PRECONDITION(aFrame->GetContentInsertionFrame() == aFrame,
"Parent frame in ProcessChildren should be its own "
"content insertion frame");
const uint32_t kMaxDepth = 2 * MAX_REFLOW_DEPTH;
- MOZ_STATIC_ASSERT(kMaxDepth <= UINT16_MAX, "mCurrentDepth type is too narrow");
+ static_assert(kMaxDepth <= UINT16_MAX, "mCurrentDepth type is too narrow");
AutoRestore<uint16_t> savedDepth(mCurrentDepth);
if (mCurrentDepth != UINT16_MAX) {
++mCurrentDepth;
}
if (!aPossiblyLeafFrame) {
aPossiblyLeafFrame = aFrame;
}
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -533,18 +533,18 @@ nsPresContext::GetFontPrefsForLang(nsIAt
&prefs->mDefaultVariableFont,
&prefs->mDefaultFixedFont,
&prefs->mDefaultSerifFont,
&prefs->mDefaultSansSerifFont,
&prefs->mDefaultMonospaceFont,
&prefs->mDefaultCursiveFont,
&prefs->mDefaultFantasyFont
};
- MOZ_STATIC_ASSERT(NS_ARRAY_LENGTH(fontTypes) == eDefaultFont_COUNT,
- "FontTypes array count is not correct");
+ static_assert(NS_ARRAY_LENGTH(fontTypes) == eDefaultFont_COUNT,
+ "FontTypes array count is not correct");
// Get attributes specific to each generic font. We do not get the user's
// generic-font-name-to-specific-family-name preferences because its the
// generic name that should be fed into the cascade. It is up to the GFX
// code to look up the font prefs to convert generic names to specific
// family names as necessary.
nsAutoCString generic_dot_langGroup;
for (uint32_t eType = 0; eType < ArrayLength(fontTypes); ++eType) {
--- a/layout/build/nsLayoutModule.cpp
+++ b/layout/build/nsLayoutModule.cpp
@@ -391,19 +391,19 @@ static bool gInitialized = false;
nsresult
Initialize()
{
if (gInitialized) {
NS_RUNTIMEABORT("Recursive layout module initialization");
return NS_ERROR_FAILURE;
}
- MOZ_STATIC_ASSERT(sizeof(uintptr_t) == sizeof(void*),
- "Eeek! You'll need to adjust the size of uintptr_t to the "
- "size of a pointer on your platform.");
+ static_assert(sizeof(uintptr_t) == sizeof(void*),
+ "Eeek! You'll need to adjust the size of uintptr_t to the "
+ "size of a pointer on your platform.");
gInitialized = true;
nsresult rv;
rv = xpcModuleCtor();
if (NS_FAILED(rv))
return rv;
--- a/layout/generic/nsImageFrame.cpp
+++ b/layout/generic/nsImageFrame.cpp
@@ -880,17 +880,17 @@ nsImageFrame::Reflow(nsPresContext*
if (!imageOK || !haveSize) {
nsRect altFeedbackSize(0, 0,
nsPresContext::CSSPixelsToAppUnits(ICON_SIZE+2*(ICON_PADDING+ALT_BORDER_WIDTH)),
nsPresContext::CSSPixelsToAppUnits(ICON_SIZE+2*(ICON_PADDING+ALT_BORDER_WIDTH)));
// We include the altFeedbackSize in our visual overflow, but not in our
// scrollable overflow, since it doesn't really need to be scrolled to
// outside the image.
- MOZ_STATIC_ASSERT(eOverflowType_LENGTH == 2, "Unknown overflow types?");
+ static_assert(eOverflowType_LENGTH == 2, "Unknown overflow types?");
nsRect& visualOverflow = aMetrics.VisualOverflow();
visualOverflow.UnionRect(visualOverflow, altFeedbackSize);
}
FinishAndStoreOverflow(&aMetrics);
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
("exit nsImageFrame::Reflow: size=%d,%d",
aMetrics.width, aMetrics.height));
--- a/layout/generic/nsLineBox.cpp
+++ b/layout/generic/nsLineBox.cpp
@@ -39,19 +39,19 @@ nsLineBox::nsLineBox(nsIFrame* aFrame, i
NS_ASSERTION(!aIsBlock || aCount == 1, "Blocks must have exactly one child");
nsIFrame* f = aFrame;
for (int32_t n = aCount; n > 0; f = f->GetNextSibling(), --n) {
NS_ASSERTION(aIsBlock == f->IsBlockOutside(),
"wrong kind of child frame");
}
#endif
- MOZ_STATIC_ASSERT(NS_STYLE_CLEAR_LAST_VALUE <= 15,
- "FlagBits needs more bits to store the full range of "
- "break type ('clear') values");
+ static_assert(NS_STYLE_CLEAR_LAST_VALUE <= 15,
+ "FlagBits needs more bits to store the full range of "
+ "break type ('clear') values");
#if NS_STYLE_CLEAR_NONE > 0
mFlags.mBreakType = NS_STYLE_CLEAR_NONE;
#endif
mChildCount = aCount;
MarkDirty();
mFlags.mBlock = aIsBlock;
}
--- a/layout/generic/nsQueryFrame.h
+++ b/layout/generic/nsQueryFrame.h
@@ -19,26 +19,26 @@
#define NS_DECL_QUERYFRAME \
virtual void* QueryFrame(FrameIID id);
#define NS_QUERYFRAME_HEAD(class) \
void* class::QueryFrame(FrameIID id) { switch (id) {
#define NS_QUERYFRAME_ENTRY(class) \
case class::kFrameIID: { \
- MOZ_STATIC_ASSERT((mozilla::IsSame<class, class::Has_NS_DECL_QUERYFRAME_TARGET>::value), \
- #class " must declare itself as a queryframe target"); \
+ static_assert(mozilla::IsSame<class, class::Has_NS_DECL_QUERYFRAME_TARGET>::value, \
+ #class " must declare itself as a queryframe target"); \
return static_cast<class*>(this); \
}
#define NS_QUERYFRAME_ENTRY_CONDITIONAL(class, condition) \
case class::kFrameIID: \
if (condition) { \
- MOZ_STATIC_ASSERT((mozilla::IsSame<class, class::Has_NS_DECL_QUERYFRAME_TARGET>::value), \
- #class " must declare itself as a queryframe target"); \
+ static_assert(mozilla::IsSame<class, class::Has_NS_DECL_QUERYFRAME_TARGET>::value, \
+ #class " must declare itself as a queryframe target"); \
return static_cast<class*>(this); \
} \
break;
#define NS_QUERYFRAME_TAIL_INHERITING(class) \
default: break; \
} \
return class::QueryFrame(id); \
@@ -76,18 +76,18 @@ public:
class do_QueryFrame
{
public:
do_QueryFrame(nsQueryFrame *s) : mRawPtr(s) { }
template<class Dest>
operator Dest*() {
- MOZ_STATIC_ASSERT((mozilla::IsSame<Dest, typename Dest::Has_NS_DECL_QUERYFRAME_TARGET>::value),
- "Dest must declare itself as a queryframe target");
+ static_assert(mozilla::IsSame<Dest, typename Dest::Has_NS_DECL_QUERYFRAME_TARGET>::value,
+ "Dest must declare itself as a queryframe target");
if (!mRawPtr)
return nullptr;
return reinterpret_cast<Dest*>(mRawPtr->QueryFrame(Dest::kFrameIID));
}
private:
nsQueryFrame *mRawPtr;
--- a/layout/inspector/src/inDOMUtils.cpp
+++ b/layout/inspector/src/inDOMUtils.cpp
@@ -749,19 +749,19 @@ GetStatesForPseudoClass(const nsAString&
#undef CSS_STATE_PSEUDO_CLASS
#undef CSS_PSEUDO_CLASS
// Add more entries for our fake values to make sure we can't
// index out of bounds into this array no matter what.
nsEventStates(),
nsEventStates()
};
- MOZ_STATIC_ASSERT(NS_ARRAY_LENGTH(sPseudoClassStates) ==
- nsCSSPseudoClasses::ePseudoClass_NotPseudoClass + 1,
- "Length of PseudoClassStates array is incorrect");
+ static_assert(NS_ARRAY_LENGTH(sPseudoClassStates) ==
+ nsCSSPseudoClasses::ePseudoClass_NotPseudoClass + 1,
+ "Length of PseudoClassStates array is incorrect");
nsCOMPtr<nsIAtom> atom = do_GetAtom(aStatePseudo);
// Ignore :moz-any-link so we don't give the element simultaneous
// visited and unvisited style state
if (nsCSSPseudoClasses::GetPseudoType(atom) ==
nsCSSPseudoClasses::ePseudoClass_mozAnyLink) {
return nsEventStates();
--- a/layout/style/Declaration.cpp
+++ b/layout/style/Declaration.cpp
@@ -15,18 +15,18 @@
#include "nsPrintfCString.h"
#include "mozilla/Preferences.h"
namespace mozilla {
namespace css {
// check that we can fit all the CSS properties into a uint16_t
// for the mOrder array
-MOZ_STATIC_ASSERT(eCSSProperty_COUNT_no_shorthands - 1 <= UINT16_MAX,
- "CSS longhand property numbers no longer fit in a uint16_t");
+static_assert(eCSSProperty_COUNT_no_shorthands - 1 <= UINT16_MAX,
+ "CSS longhand property numbers no longer fit in a uint16_t");
Declaration::Declaration()
: mImmutable(false)
{
MOZ_COUNT_CTOR(mozilla::css::Declaration);
}
Declaration::Declaration(const Declaration& aCopy)
@@ -476,23 +476,23 @@ Declaration::GetValue(nsCSSProperty aPro
if (clip->mValue.GetIntValue() != NS_STYLE_BG_CLIP_BORDER ||
origin->mValue.GetIntValue() != NS_STYLE_BG_ORIGIN_PADDING) {
MOZ_ASSERT(nsCSSProps::kKeywordTableTable[
eCSSProperty_background_origin] ==
nsCSSProps::kBackgroundOriginKTable);
MOZ_ASSERT(nsCSSProps::kKeywordTableTable[
eCSSProperty_background_clip] ==
nsCSSProps::kBackgroundOriginKTable);
- MOZ_STATIC_ASSERT(NS_STYLE_BG_CLIP_BORDER ==
- NS_STYLE_BG_ORIGIN_BORDER &&
- NS_STYLE_BG_CLIP_PADDING ==
- NS_STYLE_BG_ORIGIN_PADDING &&
- NS_STYLE_BG_CLIP_CONTENT ==
- NS_STYLE_BG_ORIGIN_CONTENT,
- "bg-clip and bg-origin style constants must agree");
+ static_assert(NS_STYLE_BG_CLIP_BORDER ==
+ NS_STYLE_BG_ORIGIN_BORDER &&
+ NS_STYLE_BG_CLIP_PADDING ==
+ NS_STYLE_BG_ORIGIN_PADDING &&
+ NS_STYLE_BG_CLIP_CONTENT ==
+ NS_STYLE_BG_ORIGIN_CONTENT,
+ "bg-clip and bg-origin style constants must agree");
aValue.Append(PRUnichar(' '));
origin->mValue.AppendToString(eCSSProperty_background_origin, aValue);
if (clip->mValue != origin->mValue) {
aValue.Append(PRUnichar(' '));
clip->mValue.AppendToString(eCSSProperty_background_clip, aValue);
}
}
--- a/layout/style/StyleRule.cpp
+++ b/layout/style/StyleRule.cpp
@@ -297,18 +297,18 @@ nsCSSSelector::nsCSSSelector(void)
mAttrList(nullptr),
mNegations(nullptr),
mNext(nullptr),
mNameSpace(kNameSpaceID_Unknown),
mOperator(0),
mPseudoType(nsCSSPseudoElements::ePseudo_NotPseudoElement)
{
MOZ_COUNT_CTOR(nsCSSSelector);
- MOZ_STATIC_ASSERT(nsCSSPseudoElements::ePseudo_MAX < INT16_MAX,
- "nsCSSPseudoElements::Type values overflow mPseudoType");
+ static_assert(nsCSSPseudoElements::ePseudo_MAX < INT16_MAX,
+ "nsCSSPseudoElements::Type values overflow mPseudoType");
}
nsCSSSelector*
nsCSSSelector::Clone(bool aDeepNext, bool aDeepNegations) const
{
nsCSSSelector *result = new nsCSSSelector();
if (!result)
return nullptr;
--- a/layout/style/nsAnimationManager.cpp
+++ b/layout/style/nsAnimationManager.cpp
@@ -662,20 +662,20 @@ public:
PercentageHashKey(const PercentageHashKey& toCopy) : mValue(toCopy.mValue) { }
~PercentageHashKey() { }
KeyType GetKey() const { return mValue; }
bool KeyEquals(KeyTypePointer aKey) const { return *aKey == mValue; }
static KeyTypePointer KeyToPointer(KeyType aKey) { return &aKey; }
static PLDHashNumber HashKey(KeyTypePointer aKey) {
- MOZ_STATIC_ASSERT(sizeof(PLDHashNumber) == sizeof(uint32_t),
- "this hash function assumes PLDHashNumber is uint32_t");
- MOZ_STATIC_ASSERT(PLDHashNumber(-1) > PLDHashNumber(0),
- "this hash function assumes PLDHashNumber is uint32_t");
+ static_assert(sizeof(PLDHashNumber) == sizeof(uint32_t),
+ "this hash function assumes PLDHashNumber is uint32_t");
+ static_assert(PLDHashNumber(-1) > PLDHashNumber(0),
+ "this hash function assumes PLDHashNumber is uint32_t");
float key = *aKey;
NS_ABORT_IF_FALSE(0.0f <= key && key <= 1.0f, "out of range");
return PLDHashNumber(key * UINT32_MAX);
}
enum { ALLOW_MEMMOVE = true };
private:
const float mValue;
--- a/layout/style/nsCSSDataBlock.h
+++ b/layout/style/nsCSSDataBlock.h
@@ -155,27 +155,27 @@ private:
void SetNumPropsToZero() {
mNumProps = 0;
}
};
// Make sure the values and properties are aligned appropriately. (These
// assertions are stronger than necessary to keep them simple.)
-MOZ_STATIC_ASSERT(sizeof(nsCSSCompressedDataBlock) == 8,
- "nsCSSCompressedDataBlock's size has changed");
-MOZ_STATIC_ASSERT(NS_ALIGNMENT_OF(nsCSSValue) == 4 || NS_ALIGNMENT_OF(nsCSSValue) == 8,
- "nsCSSValue doesn't align with nsCSSCompressedDataBlock");
-MOZ_STATIC_ASSERT(NS_ALIGNMENT_OF(nsCSSCompressedDataBlock::CompressedCSSProperty) == 2,
- "CompressedCSSProperty doesn't align with nsCSSValue");
+static_assert(sizeof(nsCSSCompressedDataBlock) == 8,
+ "nsCSSCompressedDataBlock's size has changed");
+static_assert(NS_ALIGNMENT_OF(nsCSSValue) == 4 || NS_ALIGNMENT_OF(nsCSSValue) == 8,
+ "nsCSSValue doesn't align with nsCSSCompressedDataBlock");
+static_assert(NS_ALIGNMENT_OF(nsCSSCompressedDataBlock::CompressedCSSProperty) == 2,
+ "CompressedCSSProperty doesn't align with nsCSSValue");
// Make sure that sizeof(CompressedCSSProperty) is big enough.
-MOZ_STATIC_ASSERT(eCSSProperty_COUNT_no_shorthands <=
- nsCSSCompressedDataBlock::MaxCompressedCSSProperty,
- "nsCSSProperty doesn't fit in StoredSizeOfCSSProperty");
+static_assert(eCSSProperty_COUNT_no_shorthands <=
+ nsCSSCompressedDataBlock::MaxCompressedCSSProperty,
+ "nsCSSProperty doesn't fit in StoredSizeOfCSSProperty");
class nsCSSExpandedDataBlock {
friend class nsCSSCompressedDataBlock;
public:
nsCSSExpandedDataBlock();
~nsCSSExpandedDataBlock();
--- a/layout/style/nsCSSParser.cpp
+++ b/layout/style/nsCSSParser.cpp
@@ -6952,23 +6952,23 @@ CSSParserImpl::ParseBackgroundItem(CSSPa
// 'background-clip' and 'background-origin' use the same keyword table
MOZ_ASSERT(nsCSSProps::kKeywordTableTable[
eCSSProperty_background_origin] ==
nsCSSProps::kBackgroundOriginKTable);
MOZ_ASSERT(nsCSSProps::kKeywordTableTable[
eCSSProperty_background_clip] ==
nsCSSProps::kBackgroundOriginKTable);
- MOZ_STATIC_ASSERT(NS_STYLE_BG_CLIP_BORDER ==
- NS_STYLE_BG_ORIGIN_BORDER &&
- NS_STYLE_BG_CLIP_PADDING ==
- NS_STYLE_BG_ORIGIN_PADDING &&
- NS_STYLE_BG_CLIP_CONTENT ==
- NS_STYLE_BG_ORIGIN_CONTENT,
- "bg-clip and bg-origin style constants must agree");
+ static_assert(NS_STYLE_BG_CLIP_BORDER ==
+ NS_STYLE_BG_ORIGIN_BORDER &&
+ NS_STYLE_BG_CLIP_PADDING ==
+ NS_STYLE_BG_ORIGIN_PADDING &&
+ NS_STYLE_BG_CLIP_CONTENT ==
+ NS_STYLE_BG_ORIGIN_CONTENT,
+ "bg-clip and bg-origin style constants must agree");
if (!ParseSingleValueProperty(aState.mClip->mValue,
eCSSProperty_background_clip)) {
// When exactly one <box> value is set, it is used for both
// 'background-origin' and 'background-clip'.
// See assertions above showing these values are compatible.
aState.mClip->mValue = aState.mOrigin->mValue;
}
@@ -9526,23 +9526,23 @@ CSSParserImpl::ParseTextDecoration()
enum {
eDecorationNone = NS_STYLE_TEXT_DECORATION_LINE_NONE,
eDecorationUnderline = NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE,
eDecorationOverline = NS_STYLE_TEXT_DECORATION_LINE_OVERLINE,
eDecorationLineThrough = NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH,
eDecorationBlink = NS_STYLE_TEXT_DECORATION_LINE_BLINK,
eDecorationPrefAnchors = NS_STYLE_TEXT_DECORATION_LINE_PREF_ANCHORS
};
- MOZ_STATIC_ASSERT((eDecorationNone ^ eDecorationUnderline ^
- eDecorationOverline ^ eDecorationLineThrough ^
- eDecorationBlink ^ eDecorationPrefAnchors) ==
- (eDecorationNone | eDecorationUnderline |
- eDecorationOverline | eDecorationLineThrough |
- eDecorationBlink | eDecorationPrefAnchors),
- "text decoration constants need to be bitmasks");
+ static_assert((eDecorationNone ^ eDecorationUnderline ^
+ eDecorationOverline ^ eDecorationLineThrough ^
+ eDecorationBlink ^ eDecorationPrefAnchors) ==
+ (eDecorationNone | eDecorationUnderline |
+ eDecorationOverline | eDecorationLineThrough |
+ eDecorationBlink | eDecorationPrefAnchors),
+ "text decoration constants need to be bitmasks");
static const int32_t kTextDecorationKTable[] = {
eCSSKeyword_none, eDecorationNone,
eCSSKeyword_underline, eDecorationUnderline,
eCSSKeyword_overline, eDecorationOverline,
eCSSKeyword_line_through, eDecorationLineThrough,
eCSSKeyword_blink, eDecorationBlink,
eCSSKeyword__moz_anchor_decoration, eDecorationPrefAnchors,
@@ -10769,44 +10769,44 @@ CSSParserImpl::ParseMarker()
}
}
return false;
}
bool
CSSParserImpl::ParsePaintOrder()
{
- MOZ_STATIC_ASSERT
+ static_assert
((1 << NS_STYLE_PAINT_ORDER_BITWIDTH) > NS_STYLE_PAINT_ORDER_LAST_VALUE,
"bitfield width insufficient for paint-order constants");
static const int32_t kPaintOrderKTable[] = {
eCSSKeyword_normal, NS_STYLE_PAINT_ORDER_NORMAL,
eCSSKeyword_fill, NS_STYLE_PAINT_ORDER_FILL,
eCSSKeyword_stroke, NS_STYLE_PAINT_ORDER_STROKE,
eCSSKeyword_markers, NS_STYLE_PAINT_ORDER_MARKERS,
eCSSKeyword_UNKNOWN,-1
};
- MOZ_STATIC_ASSERT(NS_ARRAY_LENGTH(kPaintOrderKTable) ==
- 2 * (NS_STYLE_PAINT_ORDER_LAST_VALUE + 2),
- "missing paint-order values in kPaintOrderKTable");
+ static_assert(NS_ARRAY_LENGTH(kPaintOrderKTable) ==
+ 2 * (NS_STYLE_PAINT_ORDER_LAST_VALUE + 2),
+ "missing paint-order values in kPaintOrderKTable");
nsCSSValue value;
if (!ParseVariant(value, VARIANT_HK, kPaintOrderKTable)) {
return false;
}
uint32_t seen = 0;
uint32_t order = 0;
uint32_t position = 0;
// Ensure that even cast to a signed int32_t when stored in CSSValue,
// we have enough space for the entire paint-order value.
- MOZ_STATIC_ASSERT
+ static_assert
(NS_STYLE_PAINT_ORDER_BITWIDTH * NS_STYLE_PAINT_ORDER_LAST_VALUE < 32,
"seen and order not big enough");
if (value.GetUnit() == eCSSUnit_Enumerated) {
uint32_t component = static_cast<uint32_t>(value.GetIntValue());
if (component != NS_STYLE_PAINT_ORDER_NORMAL) {
bool parsedOK = true;
for (;;) {
@@ -10840,18 +10840,18 @@ CSSParserImpl::ParsePaintOrder()
if (!(seen & (1 << component))) {
order |= (component << position);
position += NS_STYLE_PAINT_ORDER_BITWIDTH;
}
}
}
}
- MOZ_STATIC_ASSERT(NS_STYLE_PAINT_ORDER_NORMAL == 0,
- "unexpected value for NS_STYLE_PAINT_ORDER_NORMAL");
+ static_assert(NS_STYLE_PAINT_ORDER_NORMAL == 0,
+ "unexpected value for NS_STYLE_PAINT_ORDER_NORMAL");
value.SetIntValue(static_cast<int32_t>(order), eCSSUnit_Enumerated);
}
if (!ExpectEndProperty()) {
return false;
}
AppendValue(eCSSProperty_paint_order, value);
--- a/layout/style/nsCSSProps.cpp
+++ b/layout/style/nsCSSProps.cpp
@@ -351,18 +351,18 @@ nsCSSProps::LookupProperty(const nsACStr
EnabledState aEnabled)
{
NS_ABORT_IF_FALSE(gPropertyTable, "no lookup table, needs addref");
nsCSSProperty res = nsCSSProperty(gPropertyTable->Lookup(aProperty));
// Check eCSSAliasCount against 0 to make it easy for the
// compiler to optimize away the 0-aliases case.
if (eCSSAliasCount != 0 && res >= eCSSProperty_COUNT) {
- MOZ_STATIC_ASSERT(eCSSProperty_UNKNOWN < eCSSProperty_COUNT,
- "assuming eCSSProperty_UNKNOWN doesn't hit this code");
+ static_assert(eCSSProperty_UNKNOWN < eCSSProperty_COUNT,
+ "assuming eCSSProperty_UNKNOWN doesn't hit this code");
if (IsEnabled(res) || aEnabled == eAny) {
res = gAliases[res - eCSSProperty_COUNT];
NS_ABORT_IF_FALSE(0 <= res && res < eCSSProperty_COUNT,
"aliases must not point to other aliases");
} else {
res = eCSSProperty_UNKNOWN;
}
}
@@ -378,18 +378,18 @@ nsCSSProps::LookupProperty(const nsAStri
// This is faster than converting and calling
// LookupProperty(nsACString&). The table will do its own
// converting and avoid a PromiseFlatCString() call.
NS_ABORT_IF_FALSE(gPropertyTable, "no lookup table, needs addref");
nsCSSProperty res = nsCSSProperty(gPropertyTable->Lookup(aProperty));
// Check eCSSAliasCount against 0 to make it easy for the
// compiler to optimize away the 0-aliases case.
if (eCSSAliasCount != 0 && res >= eCSSProperty_COUNT) {
- MOZ_STATIC_ASSERT(eCSSProperty_UNKNOWN < eCSSProperty_COUNT,
- "assuming eCSSProperty_UNKNOWN doesn't hit this code");
+ static_assert(eCSSProperty_UNKNOWN < eCSSProperty_COUNT,
+ "assuming eCSSProperty_UNKNOWN doesn't hit this code");
if (IsEnabled(res) || aEnabled == eAny) {
res = gAliases[res - eCSSProperty_COUNT];
NS_ABORT_IF_FALSE(0 <= res && res < eCSSProperty_COUNT,
"aliases must not point to other aliases");
} else {
res = eCSSProperty_UNKNOWN;
}
}
@@ -642,20 +642,20 @@ const int32_t nsCSSProps::kBackgroundAtt
const int32_t nsCSSProps::kBackgroundInlinePolicyKTable[] = {
eCSSKeyword_each_box, NS_STYLE_BG_INLINE_POLICY_EACH_BOX,
eCSSKeyword_continuous, NS_STYLE_BG_INLINE_POLICY_CONTINUOUS,
eCSSKeyword_bounding_box, NS_STYLE_BG_INLINE_POLICY_BOUNDING_BOX,
eCSSKeyword_UNKNOWN,-1
};
-MOZ_STATIC_ASSERT(NS_STYLE_BG_CLIP_BORDER == NS_STYLE_BG_ORIGIN_BORDER &&
- NS_STYLE_BG_CLIP_PADDING == NS_STYLE_BG_ORIGIN_PADDING &&
- NS_STYLE_BG_CLIP_CONTENT == NS_STYLE_BG_ORIGIN_CONTENT,
- "bg-clip and bg-origin style constants must agree");
+static_assert(NS_STYLE_BG_CLIP_BORDER == NS_STYLE_BG_ORIGIN_BORDER &&
+ NS_STYLE_BG_CLIP_PADDING == NS_STYLE_BG_ORIGIN_PADDING &&
+ NS_STYLE_BG_CLIP_CONTENT == NS_STYLE_BG_ORIGIN_CONTENT,
+ "bg-clip and bg-origin style constants must agree");
const int32_t nsCSSProps::kBackgroundOriginKTable[] = {
eCSSKeyword_border_box, NS_STYLE_BG_ORIGIN_BORDER,
eCSSKeyword_padding_box, NS_STYLE_BG_ORIGIN_PADDING,
eCSSKeyword_content_box, NS_STYLE_BG_ORIGIN_CONTENT,
eCSSKeyword_UNKNOWN,-1
};
// Note: Don't change this table unless you update
@@ -1949,19 +1949,19 @@ static const nsCSSProperty gBorderBottom
// nsCSSDeclaration.cpp outputs the subproperties in this order.
// It also depends on the color being third.
eCSSProperty_border_bottom_width,
eCSSProperty_border_bottom_style,
eCSSProperty_border_bottom_color,
eCSSProperty_UNKNOWN
};
-MOZ_STATIC_ASSERT(NS_SIDE_TOP == 0 && NS_SIDE_RIGHT == 1 &&
- NS_SIDE_BOTTOM == 2 && NS_SIDE_LEFT == 3,
- "box side constants not top/right/bottom/left == 0/1/2/3");
+static_assert(NS_SIDE_TOP == 0 && NS_SIDE_RIGHT == 1 &&
+ NS_SIDE_BOTTOM == 2 && NS_SIDE_LEFT == 3,
+ "box side constants not top/right/bottom/left == 0/1/2/3");
static const nsCSSProperty gBorderColorSubpropTable[] = {
// Code relies on these being in top-right-bottom-left order.
// Code relies on these matching the NS_SIDE_* constants.
eCSSProperty_border_top_color,
eCSSProperty_border_right_color_value,
eCSSProperty_border_bottom_color,
eCSSProperty_border_left_color_value,
// extras:
--- a/layout/style/nsCSSProps.h
+++ b/layout/style/nsCSSProps.h
@@ -154,19 +154,19 @@
#define CSS_PROPERTY_PARSE_INACCESSIBLE (1<<9)
#define CSS_PROPERTY_PARSE_FUNCTION (2<<9)
#define CSS_PROPERTY_PARSE_VALUE (3<<9)
#define CSS_PROPERTY_PARSE_VALUE_LIST (4<<9)
// See CSSParserImpl::ParseSingleValueProperty and comment above
// CSS_PROPERTY_PARSE_FUNCTION (which is different).
#define CSS_PROPERTY_VALUE_PARSER_FUNCTION (1<<12)
-MOZ_STATIC_ASSERT((CSS_PROPERTY_PARSE_PROPERTY_MASK &
- CSS_PROPERTY_VALUE_PARSER_FUNCTION) == 0,
- "didn't leave enough room for the parse property constants");
+static_assert((CSS_PROPERTY_PARSE_PROPERTY_MASK &
+ CSS_PROPERTY_VALUE_PARSER_FUNCTION) == 0,
+ "didn't leave enough room for the parse property constants");
#define CSS_PROPERTY_VALUE_RESTRICTION_MASK (3<<13)
// The parser (in particular, CSSParserImpl::ParseSingleValueProperty)
// should enforce that the value of this property must be 0 or larger.
#define CSS_PROPERTY_VALUE_NONNEGATIVE (1<<13)
// The parser (in particular, CSSParserImpl::ParseSingleValueProperty)
// should enforce that the value of this property must be 1 or larger.
#define CSS_PROPERTY_VALUE_AT_LEAST_ONE (2<<13)
--- a/layout/style/nsCSSRuleProcessor.cpp
+++ b/layout/style/nsCSSRuleProcessor.cpp
@@ -1614,20 +1614,20 @@ static const nsEventStates sPseudoClassS
#include "nsCSSPseudoClassList.h"
#undef CSS_STATE_PSEUDO_CLASS
#undef CSS_PSEUDO_CLASS
// Add more entries for our fake values to make sure we can't
// index out of bounds into this array no matter what.
nsEventStates(),
nsEventStates()
};
-MOZ_STATIC_ASSERT(NS_ARRAY_LENGTH(sPseudoClassStates) ==
- nsCSSPseudoClasses::ePseudoClass_NotPseudoClass + 1,
- "ePseudoClass_NotPseudoClass is no longer at the end of"
- "sPseudoClassStates");
+static_assert(NS_ARRAY_LENGTH(sPseudoClassStates) ==
+ nsCSSPseudoClasses::ePseudoClass_NotPseudoClass + 1,
+ "ePseudoClass_NotPseudoClass is no longer at the end of"
+ "sPseudoClassStates");
// |aDependence| has two functions:
// * when non-null, it indicates that we're processing a negation,
// which is done only when SelectorMatches calls itself recursively
// * what it points to should be set to true whenever a test is skipped
// because of aNodeMatchContent.mStateMask
static bool SelectorMatches(Element* aElement,
nsCSSSelector* aSelector,
--- a/layout/style/nsCSSScanner.cpp
+++ b/layout/style/nsCSSScanner.cpp
@@ -71,18 +71,18 @@ static const uint8_t gLexTable[] = {
// h i j k l m n o
SUIJ, SUIJ, SUIJ, SUIJ, SUIJ, SUIJ, SUIJ, SUIJ,
// p q r s t u v w
SUIJ, SUIJ, SUIJ, SUIJ, SUIJ, SUIJ, SUIJ, SUIJ,
// x y z { | } ~ 7F
SUIJ, SUIJ, SUIJ, SU, SU, SU, SU, S,
};
-MOZ_STATIC_ASSERT(MOZ_ARRAY_LENGTH(gLexTable) == 128,
- "gLexTable expected to cover all 128 ASCII characters");
+static_assert(MOZ_ARRAY_LENGTH(gLexTable) == 128,
+ "gLexTable expected to cover all 128 ASCII characters");
#undef I
#undef J
#undef U
#undef S
#undef X
#undef SH
#undef SU
--- a/layout/style/nsCSSValue.cpp
+++ b/layout/style/nsCSSValue.cpp
@@ -858,17 +858,17 @@ nsCSSValue::AppendToString(nsCSSProperty
nsStyleUtil::AppendBitmaskCSSValue(aProperty, intValue,
NS_STYLE_PAGE_MARKS_CROP,
NS_STYLE_PAGE_MARKS_REGISTER,
aResult);
}
break;
case eCSSProperty_paint_order:
- MOZ_STATIC_ASSERT
+ static_assert
(NS_STYLE_PAINT_ORDER_BITWIDTH * NS_STYLE_PAINT_ORDER_LAST_VALUE <= 8,
"SVGStyleStruct::mPaintOrder and the following cast not big enough");
nsStyleUtil::AppendPaintOrderValue(static_cast<uint8_t>(GetIntValue()),
aResult);
break;
case eCSSProperty_font_synthesis:
nsStyleUtil::AppendBitmaskCSSValue(aProperty, intValue,
@@ -1528,19 +1528,19 @@ nsCSSRect_heap::SizeOfIncludingThis(mozi
size_t n = aMallocSizeOf(this);
n += mTop .SizeOfExcludingThis(aMallocSizeOf);
n += mRight .SizeOfExcludingThis(aMallocSizeOf);
n += mBottom.SizeOfExcludingThis(aMallocSizeOf);
n += mLeft .SizeOfExcludingThis(aMallocSizeOf);
return n;
}
-MOZ_STATIC_ASSERT(NS_SIDE_TOP == 0 && NS_SIDE_RIGHT == 1 &&
- NS_SIDE_BOTTOM == 2 && NS_SIDE_LEFT == 3,
- "box side constants not top/right/bottom/left == 0/1/2/3");
+static_assert(NS_SIDE_TOP == 0 && NS_SIDE_RIGHT == 1 &&
+ NS_SIDE_BOTTOM == 2 && NS_SIDE_LEFT == 3,
+ "box side constants not top/right/bottom/left == 0/1/2/3");
/* static */ const nsCSSRect::side_type nsCSSRect::sides[4] = {
&nsCSSRect::mTop,
&nsCSSRect::mRight,
&nsCSSRect::mBottom,
&nsCSSRect::mLeft,
};
@@ -1928,19 +1928,19 @@ nsCSSCornerSizes::~nsCSSCornerSizes()
void
nsCSSCornerSizes::Reset()
{
NS_FOR_CSS_FULL_CORNERS(corner) {
this->GetCorner(corner).Reset();
}
}
-MOZ_STATIC_ASSERT(NS_CORNER_TOP_LEFT == 0 && NS_CORNER_TOP_RIGHT == 1 &&
- NS_CORNER_BOTTOM_RIGHT == 2 && NS_CORNER_BOTTOM_LEFT == 3,
- "box corner constants not tl/tr/br/bl == 0/1/2/3");
+static_assert(NS_CORNER_TOP_LEFT == 0 && NS_CORNER_TOP_RIGHT == 1 &&
+ NS_CORNER_BOTTOM_RIGHT == 2 && NS_CORNER_BOTTOM_LEFT == 3,
+ "box corner constants not tl/tr/br/bl == 0/1/2/3");
/* static */ const nsCSSCornerSizes::corner_type
nsCSSCornerSizes::corners[4] = {
&nsCSSCornerSizes::mTopLeft,
&nsCSSCornerSizes::mTopRight,
&nsCSSCornerSizes::mBottomRight,
&nsCSSCornerSizes::mBottomLeft,
};
--- a/layout/style/nsComputedDOMStyle.cpp
+++ b/layout/style/nsComputedDOMStyle.cpp
@@ -2953,18 +2953,18 @@ nsComputedDOMStyle::DoGetDirection()
{
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
val->SetIdent(
nsCSSProps::ValueToKeywordEnum(StyleVisibility()->mDirection,
nsCSSProps::kDirectionKTable));
return val;
}
-MOZ_STATIC_ASSERT(NS_STYLE_UNICODE_BIDI_NORMAL == 0,
- "unicode-bidi style constants not as expected");
+static_assert(NS_STYLE_UNICODE_BIDI_NORMAL == 0,
+ "unicode-bidi style constants not as expected");
CSSValue*
nsComputedDOMStyle::DoGetUnicodeBidi()
{
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
val->SetIdent(
nsCSSProps::ValueToKeywordEnum(StyleTextReset()->mUnicodeBidi,
nsCSSProps::kUnicodeBidiKTable));
@@ -3729,19 +3729,19 @@ nsComputedDOMStyle::GetAbsoluteOffset(mo
break;
}
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
val->SetAppUnits(offset);
return val;
}
-MOZ_STATIC_ASSERT(NS_SIDE_TOP == 0 && NS_SIDE_RIGHT == 1 &&
- NS_SIDE_BOTTOM == 2 && NS_SIDE_LEFT == 3,
- "box side constants not as expected for NS_OPPOSITE_SIDE");
+static_assert(NS_SIDE_TOP == 0 && NS_SIDE_RIGHT == 1 &&
+ NS_SIDE_BOTTOM == 2 && NS_SIDE_LEFT == 3,
+ "box side constants not as expected for NS_OPPOSITE_SIDE");
#define NS_OPPOSITE_SIDE(s_) mozilla::css::Side(((s_) + 2) & 3)
CSSValue*
nsComputedDOMStyle::GetRelativeOffset(mozilla::css::Side aSide)
{
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
const nsStylePosition* positionData = StylePosition();
--- a/layout/style/nsRuleData.cpp
+++ b/layout/style/nsRuleData.cpp
@@ -9,22 +9,22 @@
#include <stdint.h>
inline size_t
nsRuleData::GetPoisonOffset()
{
// Fill in mValueOffsets such that mValueStorage + mValueOffsets[i]
// will yield the frame poison value for all uninitialized value
// offsets.
- MOZ_STATIC_ASSERT(sizeof(uintptr_t) == sizeof(size_t),
- "expect uintptr_t and size_t to be the same size");
- MOZ_STATIC_ASSERT(uintptr_t(-1) > uintptr_t(0),
- "expect uintptr_t to be unsigned");
- MOZ_STATIC_ASSERT(size_t(-1) > size_t(0),
- "expect size_t to be unsigned");
+ static_assert(sizeof(uintptr_t) == sizeof(size_t),
+ "expect uintptr_t and size_t to be the same size");
+ static_assert(uintptr_t(-1) > uintptr_t(0),
+ "expect uintptr_t to be unsigned");
+ static_assert(size_t(-1) > size_t(0),
+ "expect size_t to be unsigned");
uintptr_t framePoisonValue = mozPoisonValue();
return size_t(framePoisonValue - uintptr_t(mValueStorage)) /
sizeof(nsCSSValue);
}
nsRuleData::nsRuleData(uint32_t aSIDs, nsCSSValue* aValueStorage,
nsPresContext* aContext, nsStyleContext* aStyleContext)
: mSIDs(aSIDs),
--- a/layout/style/nsRuleNode.cpp
+++ b/layout/style/nsRuleNode.cpp
@@ -3077,17 +3077,17 @@ nsRuleNode::SetFont(nsPresContext* aPres
aFont->mExplicitLanguage = true;
}
const nsFont* defaultVariableFont =
aPresContext->GetDefaultFont(kPresContext_DefaultVariableFont_ID,
aFont->mLanguage);
// -moz-system-font: enum (never inherit!)
- MOZ_STATIC_ASSERT(
+ static_assert(
NS_STYLE_FONT_CAPTION == LookAndFeel::eFont_Caption &&
NS_STYLE_FONT_ICON == LookAndFeel::eFont_Icon &&
NS_STYLE_FONT_MENU == LookAndFeel::eFont_Menu &&
NS_STYLE_FONT_MESSAGE_BOX == LookAndFeel::eFont_MessageBox &&
NS_STYLE_FONT_SMALL_CAPTION == LookAndFeel::eFont_SmallCaption &&
NS_STYLE_FONT_STATUS_BAR == LookAndFeel::eFont_StatusBar &&
NS_STYLE_FONT_WINDOW == LookAndFeel::eFont_Window &&
NS_STYLE_FONT_DOCUMENT == LookAndFeel::eFont_Document &&
@@ -5544,21 +5544,21 @@ struct BackgroundItemComputer<nsCSSValue
for (const BackgroundSizeAxis *axis = gBGSizeAxes,
*axis_end = ArrayEnd(gBGSizeAxes);
axis < axis_end; ++axis) {
const nsCSSValue &specified = aSpecifiedValue->*(axis->specified);
if (eCSSUnit_Auto == specified.GetUnit()) {
size.*(axis->type) = nsStyleBackground::Size::eAuto;
}
else if (eCSSUnit_Enumerated == specified.GetUnit()) {
- MOZ_STATIC_ASSERT(nsStyleBackground::Size::eContain ==
- NS_STYLE_BG_SIZE_CONTAIN &&
- nsStyleBackground::Size::eCover ==
- NS_STYLE_BG_SIZE_COVER,
- "background size constants out of sync");
+ static_assert(nsStyleBackground::Size::eContain ==
+ NS_STYLE_BG_SIZE_CONTAIN &&
+ nsStyleBackground::Size::eCover ==
+ NS_STYLE_BG_SIZE_COVER,
+ "background size constants out of sync");
NS_ABORT_IF_FALSE(specified.GetIntValue() == NS_STYLE_BG_SIZE_CONTAIN ||
specified.GetIntValue() == NS_STYLE_BG_SIZE_COVER,
"invalid enumerated value for size coordinate");
size.*(axis->type) = specified.GetIntValue();
}
else if (eCSSUnit_Null == specified.GetUnit()) {
NS_ABORT_IF_FALSE(axis == gBGSizeAxes + 1,
"null allowed only as height value, and only "
@@ -7530,17 +7530,17 @@ nsRuleNode::ComputeSVGData(void* aStartS
// paint-order: enum (bit field), inherit, initial
const nsCSSValue* paintOrderValue = aRuleData->ValueForPaintOrder();
switch (paintOrderValue->GetUnit()) {
case eCSSUnit_Null:
break;
case eCSSUnit_Enumerated:
- MOZ_STATIC_ASSERT
+ static_assert
(NS_STYLE_PAINT_ORDER_BITWIDTH * NS_STYLE_PAINT_ORDER_LAST_VALUE <= 8,
"SVGStyleStruct::mPaintOrder not big enough");
svg->mPaintOrder = static_cast<uint8_t>(paintOrderValue->GetIntValue());
break;
case eCSSUnit_Inherit:
canStoreInRuleTree = false;
svg->mPaintOrder = parentSVG->mPaintOrder;
--- a/layout/style/nsStyleAnimation.cpp
+++ b/layout/style/nsStyleAnimation.cpp
@@ -2819,19 +2819,19 @@ nsStyleAnimation::ExtractComputedValue(n
aComputedValue.SetAndAdoptCSSValueListValue(result.forget(),
eUnit_Dasharray);
break;
}
case eCSSProperty_font_stretch: {
int16_t stretch =
static_cast<const nsStyleFont*>(styleStruct)->mFont.stretch;
- MOZ_STATIC_ASSERT(NS_STYLE_FONT_STRETCH_ULTRA_CONDENSED == -4 &&
- NS_STYLE_FONT_STRETCH_ULTRA_EXPANDED == 4,
- "font stretch constants not as expected");
+ static_assert(NS_STYLE_FONT_STRETCH_ULTRA_CONDENSED == -4 &&
+ NS_STYLE_FONT_STRETCH_ULTRA_EXPANDED == 4,
+ "font stretch constants not as expected");
if (stretch < NS_STYLE_FONT_STRETCH_ULTRA_CONDENSED ||
stretch > NS_STYLE_FONT_STRETCH_ULTRA_EXPANDED) {
return false;
}
aComputedValue.SetIntValue(stretch, eUnit_Enumerated);
return true;
}
@@ -3044,33 +3044,33 @@ nsStyleAnimation::ExtractComputedValue(n
return true;
case eStyleAnimType_Coord:
return StyleCoordToValue(*static_cast<const nsStyleCoord*>(
StyleDataAtOffset(styleStruct, ssOffset)), aComputedValue);
case eStyleAnimType_Sides_Top:
case eStyleAnimType_Sides_Right:
case eStyleAnimType_Sides_Bottom:
case eStyleAnimType_Sides_Left: {
- MOZ_STATIC_ASSERT(
+ static_assert(
NS_SIDE_TOP == eStyleAnimType_Sides_Top -eStyleAnimType_Sides_Top &&
NS_SIDE_RIGHT == eStyleAnimType_Sides_Right -eStyleAnimType_Sides_Top &&
NS_SIDE_BOTTOM == eStyleAnimType_Sides_Bottom-eStyleAnimType_Sides_Top &&
NS_SIDE_LEFT == eStyleAnimType_Sides_Left -eStyleAnimType_Sides_Top,
"box side constants out of sync with animation side constants");
const nsStyleCoord &coord = static_cast<const nsStyleSides*>(
StyleDataAtOffset(styleStruct, ssOffset))->
Get(mozilla::css::Side(animType - eStyleAnimType_Sides_Top));
return StyleCoordToValue(coord, aComputedValue);
}
case eStyleAnimType_Corner_TopLeft:
case eStyleAnimType_Corner_TopRight:
case eStyleAnimType_Corner_BottomRight:
case eStyleAnimType_Corner_BottomLeft: {
- MOZ_STATIC_ASSERT(
+ static_assert(
NS_CORNER_TOP_LEFT == eStyleAnimType_Corner_TopLeft -
eStyleAnimType_Corner_TopLeft &&
NS_CORNER_TOP_RIGHT == eStyleAnimType_Corner_TopRight -
eStyleAnimType_Corner_TopLeft &&
NS_CORNER_BOTTOM_RIGHT == eStyleAnimType_Corner_BottomRight -
eStyleAnimType_Corner_TopLeft &&
NS_CORNER_BOTTOM_LEFT == eStyleAnimType_Corner_BottomLeft -
eStyleAnimType_Corner_TopLeft,
--- a/layout/style/nsStyleContext.cpp
+++ b/layout/style/nsStyleContext.cpp
@@ -43,19 +43,19 @@ nsStyleContext::nsStyleContext(nsStyleCo
mRuleNode(aRuleNode),
mAllocations(nullptr),
mCachedResetData(nullptr),
mBits(((uint32_t)aPseudoType) << NS_STYLE_CONTEXT_TYPE_SHIFT),
mRefCnt(0)
{
// This check has to be done "backward", because if it were written the
// more natural way it wouldn't fail even when it needed to.
- MOZ_STATIC_ASSERT((UINT32_MAX >> NS_STYLE_CONTEXT_TYPE_SHIFT) >=
- nsCSSPseudoElements::ePseudo_MAX,
- "pseudo element bits no longer fit in a uint32_t");
+ static_assert((UINT32_MAX >> NS_STYLE_CONTEXT_TYPE_SHIFT) >=
+ nsCSSPseudoElements::ePseudo_MAX,
+ "pseudo element bits no longer fit in a uint32_t");
MOZ_ASSERT(aRuleNode);
mNextSibling = this;
mPrevSibling = this;
if (mParent) {
mParent->AddRef();
mParent->AddChild(this);
#ifdef DEBUG
--- a/layout/style/nsStyleCoord.cpp
+++ b/layout/style/nsStyleCoord.cpp
@@ -243,85 +243,85 @@ nsStyleCorners::operator==(const nsStyle
void nsStyleCorners::Reset()
{
memset(this, 0x00, sizeof(nsStyleCorners));
}
// Validation of NS_SIDE_IS_VERTICAL and NS_HALF_CORNER_IS_X.
#define CASE(side, result) \
- MOZ_STATIC_ASSERT(NS_SIDE_IS_VERTICAL(side) == result, \
- "NS_SIDE_IS_VERTICAL is wrong")
+ static_assert(NS_SIDE_IS_VERTICAL(side) == result, \
+ "NS_SIDE_IS_VERTICAL is wrong")
CASE(NS_SIDE_TOP, false);
CASE(NS_SIDE_RIGHT, true);
CASE(NS_SIDE_BOTTOM, false);
CASE(NS_SIDE_LEFT, true);
#undef CASE
#define CASE(corner, result) \
- MOZ_STATIC_ASSERT(NS_HALF_CORNER_IS_X(corner) == result, \
- "NS_HALF_CORNER_IS_X is wrong")
+ static_assert(NS_HALF_CORNER_IS_X(corner) == result, \
+ "NS_HALF_CORNER_IS_X is wrong")
CASE(NS_CORNER_TOP_LEFT_X, true);
CASE(NS_CORNER_TOP_LEFT_Y, false);
CASE(NS_CORNER_TOP_RIGHT_X, true);
CASE(NS_CORNER_TOP_RIGHT_Y, false);
CASE(NS_CORNER_BOTTOM_RIGHT_X, true);
CASE(NS_CORNER_BOTTOM_RIGHT_Y, false);
CASE(NS_CORNER_BOTTOM_LEFT_X, true);
CASE(NS_CORNER_BOTTOM_LEFT_Y, false);
#undef CASE
// Validation of NS_HALF_TO_FULL_CORNER.
#define CASE(corner, result) \
- MOZ_STATIC_ASSERT(NS_HALF_TO_FULL_CORNER(corner) == result, \
- "NS_HALF_TO_FULL_CORNER is wrong")
+ static_assert(NS_HALF_TO_FULL_CORNER(corner) == result, \
+ "NS_HALF_TO_FULL_CORNER is wrong")
CASE(NS_CORNER_TOP_LEFT_X, NS_CORNER_TOP_LEFT);
CASE(NS_CORNER_TOP_LEFT_Y, NS_CORNER_TOP_LEFT);
CASE(NS_CORNER_TOP_RIGHT_X, NS_CORNER_TOP_RIGHT);
CASE(NS_CORNER_TOP_RIGHT_Y, NS_CORNER_TOP_RIGHT);
CASE(NS_CORNER_BOTTOM_RIGHT_X, NS_CORNER_BOTTOM_RIGHT);
CASE(NS_CORNER_BOTTOM_RIGHT_Y, NS_CORNER_BOTTOM_RIGHT);
CASE(NS_CORNER_BOTTOM_LEFT_X, NS_CORNER_BOTTOM_LEFT);
CASE(NS_CORNER_BOTTOM_LEFT_Y, NS_CORNER_BOTTOM_LEFT);
#undef CASE
// Validation of NS_FULL_TO_HALF_CORNER.
#define CASE(corner, vert, result) \
- MOZ_STATIC_ASSERT(NS_FULL_TO_HALF_CORNER(corner, vert) == result, \
- "NS_FULL_TO_HALF_CORNER is wrong")
+ static_assert(NS_FULL_TO_HALF_CORNER(corner, vert) == result, \
+ "NS_FULL_TO_HALF_CORNER is wrong")
CASE(NS_CORNER_TOP_LEFT, false, NS_CORNER_TOP_LEFT_X);
CASE(NS_CORNER_TOP_LEFT, true, NS_CORNER_TOP_LEFT_Y);
CASE(NS_CORNER_TOP_RIGHT, false, NS_CORNER_TOP_RIGHT_X);
CASE(NS_CORNER_TOP_RIGHT, true, NS_CORNER_TOP_RIGHT_Y);
CASE(NS_CORNER_BOTTOM_RIGHT, false, NS_CORNER_BOTTOM_RIGHT_X);
CASE(NS_CORNER_BOTTOM_RIGHT, true, NS_CORNER_BOTTOM_RIGHT_Y);
CASE(NS_CORNER_BOTTOM_LEFT, false, NS_CORNER_BOTTOM_LEFT_X);
CASE(NS_CORNER_BOTTOM_LEFT, true, NS_CORNER_BOTTOM_LEFT_Y);
#undef CASE
// Validation of NS_SIDE_TO_{FULL,HALF}_CORNER.
#define CASE(side, second, result) \
- MOZ_STATIC_ASSERT(NS_SIDE_TO_FULL_CORNER(side, second) == result, \
- "NS_SIDE_TO_FULL_CORNER is wrong")
+ static_assert(NS_SIDE_TO_FULL_CORNER(side, second) == result, \
+ "NS_SIDE_TO_FULL_CORNER is wrong")
CASE(NS_SIDE_TOP, false, NS_CORNER_TOP_LEFT);
CASE(NS_SIDE_TOP, true, NS_CORNER_TOP_RIGHT);
CASE(NS_SIDE_RIGHT, false, NS_CORNER_TOP_RIGHT);
CASE(NS_SIDE_RIGHT, true, NS_CORNER_BOTTOM_RIGHT);
CASE(NS_SIDE_BOTTOM, false, NS_CORNER_BOTTOM_RIGHT);
CASE(NS_SIDE_BOTTOM, true, NS_CORNER_BOTTOM_LEFT);
CASE(NS_SIDE_LEFT, false, NS_CORNER_BOTTOM_LEFT);
CASE(NS_SIDE_LEFT, true, NS_CORNER_TOP_LEFT);
#undef CASE
#define CASE(side, second, parallel, result) \
- MOZ_STATIC_ASSERT(NS_SIDE_TO_HALF_CORNER(side, second, parallel) == result, \
- "NS_SIDE_TO_HALF_CORNER is wrong")
+ static_assert(NS_SIDE_TO_HALF_CORNER(side, second, parallel) == result, \
+ "NS_SIDE_TO_HALF_CORNER is wrong")
CASE(NS_SIDE_TOP, false, true, NS_CORNER_TOP_LEFT_X);
CASE(NS_SIDE_TOP, false, false, NS_CORNER_TOP_LEFT_Y);
CASE(NS_SIDE_TOP, true, true, NS_CORNER_TOP_RIGHT_X);
CASE(NS_SIDE_TOP, true, false, NS_CORNER_TOP_RIGHT_Y);
CASE(NS_SIDE_RIGHT, false, false, NS_CORNER_TOP_RIGHT_X);
CASE(NS_SIDE_RIGHT, false, true, NS_CORNER_TOP_RIGHT_Y);
CASE(NS_SIDE_RIGHT, true, false, NS_CORNER_BOTTOM_RIGHT_X);
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -24,19 +24,19 @@
#include "nsLayoutUtils.h"
#include "imgIRequest.h"
#include "imgIContainer.h"
#include "mozilla/Likely.h"
#include <algorithm>
-MOZ_STATIC_ASSERT((((1 << nsStyleStructID_Length) - 1) &
- ~(NS_STYLE_INHERIT_MASK)) == 0,
- "Not enough bits in NS_STYLE_INHERIT_MASK");
+static_assert((((1 << nsStyleStructID_Length) - 1) &
+ ~(NS_STYLE_INHERIT_MASK)) == 0,
+ "Not enough bits in NS_STYLE_INHERIT_MASK");
inline bool IsFixedUnit(const nsStyleCoord& aCoord, bool aEnumOK)
{
return aCoord.ConvertsToLength() ||
(aEnumOK && aCoord.GetUnit() == eStyleUnit_Enumerated);
}
static bool EqualURIs(nsIURI *aURI1, nsIURI *aURI2)
@@ -2096,22 +2096,22 @@ void nsTimingFunction::AssignFromKeyword
mType = StepEnd;
mSteps = 1;
return;
default:
mType = Function;
break;
}
- MOZ_STATIC_ASSERT(NS_STYLE_TRANSITION_TIMING_FUNCTION_EASE == 0 &&
- NS_STYLE_TRANSITION_TIMING_FUNCTION_LINEAR == 1 &&
- NS_STYLE_TRANSITION_TIMING_FUNCTION_EASE_IN == 2 &&
- NS_STYLE_TRANSITION_TIMING_FUNCTION_EASE_OUT == 3 &&
- NS_STYLE_TRANSITION_TIMING_FUNCTION_EASE_IN_OUT == 4,
- "transition timing function constants not as expected");
+ static_assert(NS_STYLE_TRANSITION_TIMING_FUNCTION_EASE == 0 &&
+ NS_STYLE_TRANSITION_TIMING_FUNCTION_LINEAR == 1 &&
+ NS_STYLE_TRANSITION_TIMING_FUNCTION_EASE_IN == 2 &&
+ NS_STYLE_TRANSITION_TIMING_FUNCTION_EASE_OUT == 3 &&
+ NS_STYLE_TRANSITION_TIMING_FUNCTION_EASE_IN_OUT == 4,
+ "transition timing function constants not as expected");
static const float timingFunctionValues[5][4] = {
{ 0.25f, 0.10f, 0.25f, 1.00f }, // ease
{ 0.00f, 0.00f, 1.00f, 1.00f }, // linear
{ 0.42f, 0.00f, 1.00f, 1.00f }, // ease-in
{ 0.00f, 0.00f, 0.58f, 1.00f }, // ease-out
{ 0.42f, 0.00f, 0.58f, 1.00f } // ease-in-out
};
--- a/layout/style/nsStyleUtil.cpp
+++ b/layout/style/nsStyleUtil.cpp
@@ -155,28 +155,28 @@ nsStyleUtil::AppendBitmaskCSSValue(nsCSS
}
NS_ABORT_IF_FALSE(aMaskedValue == 0, "unexpected bit remaining in bitfield");
}
/* static */ void
nsStyleUtil::AppendPaintOrderValue(uint8_t aValue,
nsAString& aResult)
{
- MOZ_STATIC_ASSERT
+ static_assert
(NS_STYLE_PAINT_ORDER_BITWIDTH * NS_STYLE_PAINT_ORDER_LAST_VALUE <= 8,
"SVGStyleStruct::mPaintOrder and local variables not big enough");
if (aValue == NS_STYLE_PAINT_ORDER_NORMAL) {
aResult.AppendLiteral("normal");
return;
}
// Append the minimal value necessary for the given paint order.
- MOZ_STATIC_ASSERT(NS_STYLE_PAINT_ORDER_LAST_VALUE == 3,
- "paint-order values added; check serialization");
+ static_assert(NS_STYLE_PAINT_ORDER_LAST_VALUE == 3,
+ "paint-order values added; check serialization");
// The following relies on the default order being the order of the
// constant values.
const uint8_t MASK = (1 << NS_STYLE_PAINT_ORDER_BITWIDTH) - 1;
uint32_t lastPositionToSerialize = 0;
for (uint32_t position = NS_STYLE_PAINT_ORDER_LAST_VALUE - 1;
--- a/layout/tables/nsCellMap.cpp
+++ b/layout/tables/nsCellMap.cpp
@@ -32,18 +32,18 @@ SetDamageArea(int32_t aXOrigin,
// Empty static array used for SafeElementAt() calls on mRows.
static nsCellMap::CellDataArray * sEmptyRow;
// CellData
CellData::CellData(nsTableCellFrame* aOrigCell)
{
MOZ_COUNT_CTOR(CellData);
- MOZ_STATIC_ASSERT(sizeof(mOrigCell) == sizeof(mBits),
- "mOrigCell and mBits must be the same size");
+ static_assert(sizeof(mOrigCell) == sizeof(mBits),
+ "mOrigCell and mBits must be the same size");
mOrigCell = aOrigCell;
}
CellData::~CellData()
{
MOZ_COUNT_DTOR(CellData);
}
--- a/memory/mozalloc/mozalloc_oom.cpp
+++ b/memory/mozalloc/mozalloc_oom.cpp
@@ -32,18 +32,18 @@ mozalloc_handle_oom(size_t size)
// NB: this is handle_oom() stage 1, which simply aborts on OOM.
// we might proceed to a stage 2 in which an attempt is made to
// reclaim memory
if (gAbortHandler)
gAbortHandler(size);
- MOZ_STATIC_ASSERT(OOM_MSG_FIRST_DIGIT_OFFSET > 0,
- "Loop below will never terminate (i can't go below 0)");
+ static_assert(OOM_MSG_FIRST_DIGIT_OFFSET > 0,
+ "Loop below will never terminate (i can't go below 0)");
// Insert size into the diagnostic message using only primitive operations
for (i = OOM_MSG_LAST_DIGIT_OFFSET;
size && i >= OOM_MSG_FIRST_DIGIT_OFFSET; i--) {
oomMsg[i] = hex[size % 16];
size /= 16;
}
--- a/mfbt/Atomics.h
+++ b/mfbt/Atomics.h
@@ -701,18 +701,18 @@ struct CastHelper<PrimType, T*>
};
template<typename T>
struct IntrinsicBase
{
typedef T ValueType;
typedef PrimitiveIntrinsics<sizeof(T)> Primitives;
typedef typename Primitives::Type PrimType;
- MOZ_STATIC_ASSERT(sizeof(PrimType) == sizeof(T),
- "Selection of PrimitiveIntrinsics was wrong");
+ static_assert(sizeof(PrimType) == sizeof(T),
+ "Selection of PrimitiveIntrinsics was wrong");
typedef CastHelper<PrimType, T> Cast;
};
template<typename T, MemoryOrdering Order>
struct IntrinsicMemoryOps : public IntrinsicBase<T>
{
static ValueType load(const ValueType& ptr) {
Barrier<Order>::beforeLoad();
@@ -893,20 +893,20 @@ class AtomicBase
* deliberate design choice that enables static atomic variables to be declared
* without introducing extra static constructors.
*/
template<typename T, MemoryOrdering Order = SequentiallyConsistent>
class Atomic : public detail::AtomicBase<T, Order>
{
// We only support 32-bit types on 32-bit Windows, which constrains our
// implementation elsewhere. But we support pointer-sized types everywhere.
- MOZ_STATIC_ASSERT(sizeof(T) == 4 || (sizeof(uintptr_t) == 8 && sizeof(T) == 8),
- "mozilla/Atomics.h only supports 32-bit and pointer-sized types");
+ static_assert(sizeof(T) == 4 || (sizeof(uintptr_t) == 8 && sizeof(T) == 8),
+ "mozilla/Atomics.h only supports 32-bit and pointer-sized types");
// Regardless of the OS, we only support integral types here.
- MOZ_STATIC_ASSERT(IsIntegral<T>::value, "can only have integral atomic variables");
+ static_assert(IsIntegral<T>::value, "can only have integral atomic variables");
typedef typename detail::AtomicBase<T, Order> Base;
public:
Atomic() : detail::AtomicBase<T, Order>() {}
Atomic(T aInit) : detail::AtomicBase<T, Order>(aInit) {}
T operator+=(T delta) { return Base::Intrinsics::add(Base::mValue, delta) + delta; }
--- a/mfbt/BloomFilter.h
+++ b/mfbt/BloomFilter.h
@@ -101,17 +101,17 @@ class BloomFilter
* KeySize of 12 gives false positive rates on the order of 0.25-4%.
*
* Similarly, using a KeySize of 10 would lead to a 4% false
* positive rate for N == 100 and to quite bad false positive
* rates for larger N.
*/
public:
BloomFilter() {
- MOZ_STATIC_ASSERT(KeySize <= keyShift, "KeySize too big");
+ static_assert(KeySize <= keyShift, "KeySize too big");
// Should we have a custom operator new using calloc instead and
// require that we're allocated via the operator?
clear();
}
/*
* Clear the filter. This should be done before reusing it, because
--- a/mfbt/Casting.h
+++ b/mfbt/Casting.h
@@ -22,18 +22,18 @@ namespace mozilla {
* |To| and |From| must be types of the same size; be careful of cross-platform
* size differences, or this might fail to compile on some but not all
* platforms.
*/
template<typename To, typename From>
inline To
BitwiseCast(const From from)
{
- MOZ_STATIC_ASSERT(sizeof(From) == sizeof(To),
- "To and From must have the same size");
+ static_assert(sizeof(From) == sizeof(To),
+ "To and From must have the same size");
union {
From from;
To to;
} u;
u.from = from;
return u.to;
}
--- a/mfbt/Char16.h
+++ b/mfbt/Char16.h
@@ -45,13 +45,13 @@
* Therefore, in order for |MOZ_UTF16(FOO)| to work as expected (which is to
* expand |FOO| before doing whatever |MOZ_UTF16| needs to do to it) a helper
* macro, |MOZ_UTF16_HELPER| needs to be inserted in between to allow the macro
* argument to expand. See "3.10.6 Separate Expansion of Macro Arguments" of the
* CPP manual for a more accurate and precise explanation.
*/
#define MOZ_UTF16(s) MOZ_UTF16_HELPER(s)
-MOZ_STATIC_ASSERT(sizeof(char16_t) == 2, "Is char16_t type 16 bits?");
-MOZ_STATIC_ASSERT(sizeof(MOZ_UTF16('A')) == 2, "Is char literal 16 bits?");
-MOZ_STATIC_ASSERT(sizeof(MOZ_UTF16("")[0]) == 2, "Is string char 16 bits?");
+static_assert(sizeof(char16_t) == 2, "Is char16_t type 16 bits?");
+static_assert(sizeof(MOZ_UTF16('A')) == 2, "Is char literal 16 bits?");
+static_assert(sizeof(MOZ_UTF16("")[0]) == 2, "Is string char 16 bits?");
#endif /* mozilla_Char16_h */
--- a/mfbt/CheckedInt.h
+++ b/mfbt/CheckedInt.h
@@ -13,17 +13,16 @@
#define MOZ_CHECKEDINT_USE_MFBT
#include <stdint.h>
#ifdef MOZ_CHECKEDINT_USE_MFBT
# include "mozilla/Assertions.h"
#else
# include <cassert>
-# define MOZ_STATIC_ASSERT(cond, reason) assert((cond) && reason)
# define MOZ_ASSERT(cond, reason) assert((cond) && reason)
# define MOZ_DELETE
#endif
#include <climits>
#include <cstddef>
namespace mozilla {
@@ -595,19 +594,19 @@ class CheckedInt
{
protected:
T mValue;
bool mIsValid;
template<typename U>
CheckedInt(U value, bool isValid) : mValue(value), mIsValid(isValid)
{
- MOZ_STATIC_ASSERT(detail::IsSupported<T>::value &&
- detail::IsSupported<U>::value,
- "This type is not supported by CheckedInt");
+ static_assert(detail::IsSupported<T>::value &&
+ detail::IsSupported<U>::value,
+ "This type is not supported by CheckedInt");
}
friend struct detail::NegateImpl<T>;
public:
/**
* Constructs a checked integer with given @a value. The checked integer is
* initialized as valid or invalid depending on whether the @a value
@@ -619,37 +618,37 @@ class CheckedInt
* documentation for class CheckedInt, this constructor checks that its
* argument is valid.
*/
template<typename U>
CheckedInt(U value)
: mValue(T(value)),
mIsValid(detail::IsInRange<T>(value))
{
- MOZ_STATIC_ASSERT(detail::IsSupported<T>::value &&
- detail::IsSupported<U>::value,
- "This type is not supported by CheckedInt");
+ static_assert(detail::IsSupported<T>::value &&
+ detail::IsSupported<U>::value,
+ "This type is not supported by CheckedInt");
}
template<typename U>
friend class CheckedInt;
template<typename U>
CheckedInt<U> toChecked() const
{
CheckedInt<U> ret(mValue);
ret.mIsValid = ret.mIsValid && mIsValid;
return ret;
}
/** Constructs a valid checked integer with initial value 0 */
CheckedInt() : mValue(0), mIsValid(true)
{
- MOZ_STATIC_ASSERT(detail::IsSupported<T>::value,
- "This type is not supported by CheckedInt");
+ static_assert(detail::IsSupported<T>::value,
+ "This type is not supported by CheckedInt");
}
/** @returns the actual value */
T value() const
{
MOZ_ASSERT(mIsValid, "Invalid checked integer (division by zero or integer overflow)");
return mValue;
}
@@ -812,19 +811,19 @@ struct CastToCheckedIntImpl<T, CheckedIn
};
} // namespace detail
template<typename T, typename U>
inline typename detail::CastToCheckedIntImpl<T, U>::ReturnType
castToCheckedInt(U u)
{
- MOZ_STATIC_ASSERT(detail::IsSupported<T>::value &&
- detail::IsSupported<U>::value,
- "This type is not supported by CheckedInt");
+ static_assert(detail::IsSupported<T>::value &&
+ detail::IsSupported<U>::value,
+ "This type is not supported by CheckedInt");
return detail::CastToCheckedIntImpl<T, U>::run(u);
}
#define MOZ_CHECKEDINT_CONVENIENCE_BINARY_OPERATORS(OP, COMPOUND_OP) \
template<typename T> \
template<typename U> \
CheckedInt<T>& CheckedInt<T>::operator COMPOUND_OP(U rhs) \
{ \
--- a/mfbt/FloatingPoint.h
+++ b/mfbt/FloatingPoint.h
@@ -33,35 +33,35 @@ namespace mozilla {
*/
/*
* These implementations all assume |double| is a 64-bit double format number
* type, compatible with the IEEE-754 standard. C/C++ don't require this to be
* the case. But we required this in implementations of these algorithms that
* preceded this header, so we shouldn't break anything if we continue doing so.
*/
-MOZ_STATIC_ASSERT(sizeof(double) == sizeof(uint64_t), "double must be 64 bits");
+static_assert(sizeof(double) == sizeof(uint64_t), "double must be 64 bits");
const unsigned DoubleExponentBias = 1023;
const unsigned DoubleExponentShift = 52;
const uint64_t DoubleSignBit = 0x8000000000000000ULL;
const uint64_t DoubleExponentBits = 0x7ff0000000000000ULL;
const uint64_t DoubleSignificandBits = 0x000fffffffffffffULL;
-MOZ_STATIC_ASSERT((DoubleSignBit & DoubleExponentBits) == 0,
- "sign bit doesn't overlap exponent bits");
-MOZ_STATIC_ASSERT((DoubleSignBit & DoubleSignificandBits) == 0,
- "sign bit doesn't overlap significand bits");
-MOZ_STATIC_ASSERT((DoubleExponentBits & DoubleSignificandBits) == 0,
- "exponent bits don't overlap significand bits");
+static_assert((DoubleSignBit & DoubleExponentBits) == 0,
+ "sign bit doesn't overlap exponent bits");
+static_assert((DoubleSignBit & DoubleSignificandBits) == 0,
+ "sign bit doesn't overlap significand bits");
+static_assert((DoubleExponentBits & DoubleSignificandBits) == 0,
+ "exponent bits don't overlap significand bits");
-MOZ_STATIC_ASSERT((DoubleSignBit | DoubleExponentBits | DoubleSignificandBits) ==
- ~uint64_t(0),
- "all bits accounted for");
+static_assert((DoubleSignBit | DoubleExponentBits | DoubleSignificandBits) ==
+ ~uint64_t(0),
+ "all bits accounted for");
/** Determines whether a double is NaN. */
static MOZ_ALWAYS_INLINE bool
IsNaN(double d)
{
/*
* A double is NaN if all exponent bits are 1 and the significand contains at
* least one non-zero bit.
--- a/mfbt/HashFunctions.h
+++ b/mfbt/HashFunctions.h
@@ -170,18 +170,18 @@ MOZ_WARN_UNUSED_RESULT
inline uint32_t
AddToHash(uint32_t hash, A* a)
{
/*
* You might think this function should just take a void*. But then we'd only
* catch data pointers and couldn't handle function pointers.
*/
- MOZ_STATIC_ASSERT(sizeof(a) == sizeof(uintptr_t),
- "Strange pointer!");
+ static_assert(sizeof(a) == sizeof(uintptr_t),
+ "Strange pointer!");
return detail::AddUintptrToHash<sizeof(uintptr_t)>(hash, uintptr_t(a));
}
template<>
MOZ_WARN_UNUSED_RESULT
inline uint32_t
AddToHash(uint32_t hash, uintptr_t a)
--- a/mfbt/Poison.cpp
+++ b/mfbt/Poison.cpp
@@ -137,18 +137,18 @@ GetDesiredRegionSize()
{
return sysconf(_SC_PAGESIZE);
}
#define RESERVE_FAILED MAP_FAILED
#endif // system dependencies
-MOZ_STATIC_ASSERT(sizeof(uintptr_t) == 4 || sizeof(uintptr_t) == 8, "");
-MOZ_STATIC_ASSERT(sizeof(uintptr_t) == sizeof(void *), "");
+static_assert(sizeof(uintptr_t) == 4 || sizeof(uintptr_t) == 8, "");
+static_assert(sizeof(uintptr_t) == sizeof(void *), "");
static uintptr_t
ReservePoisonArea(uintptr_t rgnsize)
{
if (sizeof(uintptr_t) == 8) {
// Use the hardware-inaccessible region.
// We have to avoid 64-bit constants and shifts by 32 bits, since this
// code is compiled in 32-bit mode, although it is never executed there.
--- a/mfbt/RefPtr.h
+++ b/mfbt/RefPtr.h
@@ -98,32 +98,32 @@ class RefCounted
}
template<typename T>
class RefCounted : public detail::RefCounted<T, detail::NonAtomicRefCount>
{
public:
~RefCounted() {
- MOZ_STATIC_ASSERT((IsBaseOf<RefCounted, T>::value),
- "T must derive from RefCounted<T>");
+ static_assert(IsBaseOf<RefCounted, T>::value,
+ "T must derive from RefCounted<T>");
}
};
/**
* AtomicRefCounted<T> is like RefCounted<T>, with an atomically updated
* reference counter.
*/
template<typename T>
class AtomicRefCounted : public detail::RefCounted<T, detail::AtomicRefCount>
{
public:
~AtomicRefCounted() {
- MOZ_STATIC_ASSERT((IsBaseOf<AtomicRefCounted, T>::value),
- "T must derive from AtomicRefCounted<T>");
+ static_assert(IsBaseOf<AtomicRefCounted, T>::value,
+ "T must derive from AtomicRefCounted<T>");
}
};
/**
* RefPtr points to a refcounted thing that has AddRef and Release
* methods to increase/decrease the refcount, respectively. After a
* RefPtr<T> is assigned a T*, the T* can be used through the RefPtr
* as if it were a T*.
--- a/mfbt/ThreadLocal.h
+++ b/mfbt/ThreadLocal.h
@@ -95,19 +95,19 @@ class ThreadLocal
key_t key;
bool inited;
};
template<typename T>
inline bool
ThreadLocal<T>::init()
{
- MOZ_STATIC_ASSERT(sizeof(T) <= sizeof(void*),
- "mozilla::ThreadLocal can't be used for types larger than "
- "a pointer");
+ static_assert(sizeof(T) <= sizeof(void*),
+ "mozilla::ThreadLocal can't be used for types larger than "
+ "a pointer");
MOZ_ASSERT(!initialized());
#ifdef XP_WIN
key = TlsAlloc();
inited = key != 0xFFFFFFFFUL; // TLS_OUT_OF_INDEXES
#else
inited = !pthread_key_create(&key, nullptr);
#endif
return inited;
--- a/mfbt/Util.h
+++ b/mfbt/Util.h
@@ -319,17 +319,17 @@ ArrayEnd(T (&arr)[N])
}
} /* namespace mozilla */
#endif /* __cplusplus */
/*
* MOZ_ARRAY_LENGTH() is an alternative to mozilla::ArrayLength() for C files
- * that can't use C++ template functions and for MOZ_STATIC_ASSERT() calls that
+ * that can't use C++ template functions and for static_assert() calls that
* can't call ArrayLength() when it is not a C++11 constexpr function.
*/
#ifdef MOZ_HAVE_CXX11_CONSTEXPR
# define MOZ_ARRAY_LENGTH(array) mozilla::ArrayLength(array)
#else
# define MOZ_ARRAY_LENGTH(array) (sizeof(array)/sizeof((array)[0]))
#endif
--- a/mfbt/Vector.h
+++ b/mfbt/Vector.h
@@ -1116,18 +1116,18 @@ VectorBase<T, N, AP, TV>::sizeOfIncludin
{
return mallocSizeOf(this) + sizeOfExcludingThis(mallocSizeOf);
}
template<typename T, size_t N, class AP, class TV>
inline void
VectorBase<T, N, AP, TV>::swap(TV& other)
{
- MOZ_STATIC_ASSERT(N == 0,
- "still need to implement this for N != 0");
+ static_assert(N == 0,
+ "still need to implement this for N != 0");
// This only works when inline storage is always empty.
if (!usingInlineStorage() && other.usingInlineStorage()) {
other.mBegin = mBegin;
mBegin = inlineStorage();
} else if (usingInlineStorage() && !other.usingInlineStorage()) {
mBegin = other.mBegin;
other.mBegin = other.inlineStorage();
--- a/mfbt/WeakPtr.h
+++ b/mfbt/WeakPtr.h
@@ -103,18 +103,18 @@ class SupportsWeakPtrBase
WeakPtrBase<T, WeakReference> asWeakPtr() {
if (!weakRef)
weakRef = new WeakReference(static_cast<T*>(this));
return WeakPtrBase<T, WeakReference>(weakRef);
}
protected:
~SupportsWeakPtrBase() {
- MOZ_STATIC_ASSERT((IsBaseOf<SupportsWeakPtrBase<T, WeakReference>, T>::value),
- "T must derive from SupportsWeakPtrBase<T, WeakReference>");
+ static_assert(IsBaseOf<SupportsWeakPtrBase<T, WeakReference>, T>::value,
+ "T must derive from SupportsWeakPtrBase<T, WeakReference>");
if (weakRef)
weakRef->detach();
}
private:
friend class WeakPtrBase<T, WeakReference>;
RefPtr<WeakReference> weakRef;
--- a/mfbt/tests/TestSHA1.cpp
+++ b/mfbt/tests/TestSHA1.cpp
@@ -188,17 +188,17 @@ main()
SHA1Sum::Hash hash;
sum.update(reinterpret_cast<const uint8_t*>(testV), sizeof(testV));
sum.finish(hash);
static const uint8_t expected[20] =
{ 0xc8, 0xf2, 0x09, 0x59, 0x4e, 0x64, 0x40, 0xaa, 0x7b, 0xf7, 0xb8, 0xe0,
0xfa, 0x44, 0xb2, 0x31, 0x95, 0xad, 0x94, 0x81 };
- MOZ_STATIC_ASSERT(sizeof(expected) == sizeof(SHA1Sum::Hash),
- "expected-data size should be the same as the actual hash "
- "size");
+ static_assert(sizeof(expected) == sizeof(SHA1Sum::Hash),
+ "expected-data size should be the same as the actual hash "
+ "size");
for (size_t i = 0; i < SHA1Sum::HashSize; i++)
MOZ_ASSERT(hash[i] == expected[i]);
return 0;
}
--- a/mfbt/tests/TestTypeTraits.cpp
+++ b/mfbt/tests/TestTypeTraits.cpp
@@ -9,64 +9,64 @@
using mozilla::IsBaseOf;
using mozilla::IsConvertible;
using mozilla::IsSame;
using mozilla::IsSigned;
using mozilla::IsUnsigned;
using mozilla::MakeSigned;
using mozilla::MakeUnsigned;
-MOZ_STATIC_ASSERT(!IsSigned<bool>::value, "bool shouldn't be signed");
-MOZ_STATIC_ASSERT(IsUnsigned<bool>::value, "bool should be unsigned");
+static_assert(!IsSigned<bool>::value, "bool shouldn't be signed");
+static_assert(IsUnsigned<bool>::value, "bool should be unsigned");
-MOZ_STATIC_ASSERT(!IsSigned<const bool>::value, "const bool shouldn't be signed");
-MOZ_STATIC_ASSERT(IsUnsigned<const bool>::value, "const bool should be unsigned");
+static_assert(!IsSigned<const bool>::value, "const bool shouldn't be signed");
+static_assert(IsUnsigned<const bool>::value, "const bool should be unsigned");
-MOZ_STATIC_ASSERT(!IsSigned<volatile bool>::value, "volatile bool shouldn't be signed");
-MOZ_STATIC_ASSERT(IsUnsigned<volatile bool>::value, "volatile bool should be unsigned");
+static_assert(!IsSigned<volatile bool>::value, "volatile bool shouldn't be signed");
+static_assert(IsUnsigned<volatile bool>::value, "volatile bool should be unsigned");
-MOZ_STATIC_ASSERT(!IsSigned<unsigned char>::value, "unsigned char shouldn't be signed");
-MOZ_STATIC_ASSERT(IsUnsigned<unsigned char>::value, "unsigned char should be unsigned");
-MOZ_STATIC_ASSERT(IsSigned<signed char>::value, "signed char should be signed");
-MOZ_STATIC_ASSERT(!IsUnsigned<signed char>::value, "signed char shouldn't be unsigned");
+static_assert(!IsSigned<unsigned char>::value, "unsigned char shouldn't be signed");
+static_assert(IsUnsigned<unsigned char>::value, "unsigned char should be unsigned");
+static_assert(IsSigned<signed char>::value, "signed char should be signed");
+static_assert(!IsUnsigned<signed char>::value, "signed char shouldn't be unsigned");
-MOZ_STATIC_ASSERT(!IsSigned<unsigned short>::value, "unsigned short shouldn't be signed");
-MOZ_STATIC_ASSERT(IsUnsigned<unsigned short>::value, "unsigned short should be unsigned");
-MOZ_STATIC_ASSERT(IsSigned<short>::value, "short should be signed");
-MOZ_STATIC_ASSERT(!IsUnsigned<short>::value, "short shouldn't be unsigned");
+static_assert(!IsSigned<unsigned short>::value, "unsigned short shouldn't be signed");
+static_assert(IsUnsigned<unsigned short>::value, "unsigned short should be unsigned");
+static_assert(IsSigned<short>::value, "short should be signed");
+static_assert(!IsUnsigned<short>::value, "short shouldn't be unsigned");
-MOZ_STATIC_ASSERT(!IsSigned<unsigned int>::value, "unsigned int shouldn't be signed");
-MOZ_STATIC_ASSERT(IsUnsigned<unsigned int>::value, "unsigned int should be unsigned");
-MOZ_STATIC_ASSERT(IsSigned<int>::value, "int should be signed");
-MOZ_STATIC_ASSERT(!IsUnsigned<int>::value, "int shouldn't be unsigned");
+static_assert(!IsSigned<unsigned int>::value, "unsigned int shouldn't be signed");
+static_assert(IsUnsigned<unsigned int>::value, "unsigned int should be unsigned");
+static_assert(IsSigned<int>::value, "int should be signed");
+static_assert(!IsUnsigned<int>::value, "int shouldn't be unsigned");
-MOZ_STATIC_ASSERT(!IsSigned<unsigned long>::value, "unsigned long shouldn't be signed");
-MOZ_STATIC_ASSERT(IsUnsigned<unsigned long>::value, "unsigned long should be unsigned");
-MOZ_STATIC_ASSERT(IsSigned<long>::value, "long should be signed");
-MOZ_STATIC_ASSERT(!IsUnsigned<long>::value, "long shouldn't be unsigned");
+static_assert(!IsSigned<unsigned long>::value, "unsigned long shouldn't be signed");
+static_assert(IsUnsigned<unsigned long>::value, "unsigned long should be unsigned");
+static_assert(IsSigned<long>::value, "long should be signed");
+static_assert(!IsUnsigned<long>::value, "long shouldn't be unsigned");
-MOZ_STATIC_ASSERT(IsSigned<float>::value, "float should be signed");
-MOZ_STATIC_ASSERT(!IsUnsigned<float>::value, "float shouldn't be unsigned");
+static_assert(IsSigned<float>::value, "float should be signed");
+static_assert(!IsUnsigned<float>::value, "float shouldn't be unsigned");
-MOZ_STATIC_ASSERT(IsSigned<const float>::value, "const float should be signed");
-MOZ_STATIC_ASSERT(!IsUnsigned<const float>::value, "const float shouldn't be unsigned");
+static_assert(IsSigned<const float>::value, "const float should be signed");
+static_assert(!IsUnsigned<const float>::value, "const float shouldn't be unsigned");
-MOZ_STATIC_ASSERT(IsSigned<double>::value, "double should be signed");
-MOZ_STATIC_ASSERT(!IsUnsigned<double>::value, "double shouldn't be unsigned");
+static_assert(IsSigned<double>::value, "double should be signed");
+static_assert(!IsUnsigned<double>::value, "double shouldn't be unsigned");
-MOZ_STATIC_ASSERT(IsSigned<volatile double>::value, "volatile double should be signed");
-MOZ_STATIC_ASSERT(!IsUnsigned<volatile double>::value, "volatile double shouldn't be unsigned");
+static_assert(IsSigned<volatile double>::value, "volatile double should be signed");
+static_assert(!IsUnsigned<volatile double>::value, "volatile double shouldn't be unsigned");
-MOZ_STATIC_ASSERT(IsSigned<long double>::value, "long double should be signed");
-MOZ_STATIC_ASSERT(!IsUnsigned<long double>::value, "long double shouldn't be unsigned");
+static_assert(IsSigned<long double>::value, "long double should be signed");
+static_assert(!IsUnsigned<long double>::value, "long double shouldn't be unsigned");
-MOZ_STATIC_ASSERT(IsSigned<const volatile long double>::value,
- "const volatile long double should be signed");
-MOZ_STATIC_ASSERT(!IsUnsigned<const volatile long double>::value,
- "const volatile long double shouldn't be unsigned");
+static_assert(IsSigned<const volatile long double>::value,
+ "const volatile long double should be signed");
+static_assert(!IsUnsigned<const volatile long double>::value,
+ "const volatile long double shouldn't be unsigned");
namespace CPlusPlus11IsBaseOf {
// Adapted from C++11 § 20.9.6.
struct B {};
struct B1 : B {};
struct B2 : B {};
struct D : private B1, private B2 {};
@@ -148,66 +148,66 @@ TestIsConvertible()
// These cases seem to require C++11 support to properly implement them, so
// for now just disable them.
//MOZ_ASSERT((!IsConvertible<C*, A*>::value),
// "C* shouldn't convert to A* (private inheritance)");
//MOZ_ASSERT((!IsConvertible<C, A>::value),
// "C doesn't convert to A (private inheritance)");
}
-MOZ_STATIC_ASSERT((IsSame<MakeSigned<const unsigned char>::Type, const signed char>::value),
- "const unsigned char won't signify correctly");
-MOZ_STATIC_ASSERT((IsSame<MakeSigned<volatile unsigned short>::Type, volatile signed short>::value),
- "volatile unsigned short won't signify correctly");
-MOZ_STATIC_ASSERT((IsSame<MakeSigned<const volatile unsigned int>::Type, const volatile signed int>::value),
- "const volatile unsigned int won't signify correctly");
-MOZ_STATIC_ASSERT((IsSame<MakeSigned<unsigned long>::Type, signed long>::value),
- "unsigned long won't signify correctly");
-MOZ_STATIC_ASSERT((IsSame<MakeSigned<const signed char>::Type, const signed char>::value),
- "const signed char won't signify correctly");
+static_assert(IsSame<MakeSigned<const unsigned char>::Type, const signed char>::value,
+ "const unsigned char won't signify correctly");
+static_assert(IsSame<MakeSigned<volatile unsigned short>::Type, volatile signed short>::value,
+ "volatile unsigned short won't signify correctly");
+static_assert(IsSame<MakeSigned<const volatile unsigned int>::Type, const volatile signed int>::value,
+ "const volatile unsigned int won't signify correctly");
+static_assert(IsSame<MakeSigned<unsigned long>::Type, signed long>::value,
+ "unsigned long won't signify correctly");
+static_assert(IsSame<MakeSigned<const signed char>::Type, const signed char>::value,
+ "const signed char won't signify correctly");
-MOZ_STATIC_ASSERT((IsSame<MakeSigned<volatile signed short>::Type, volatile signed short>::value),
- "volatile signed short won't signify correctly");
-MOZ_STATIC_ASSERT((IsSame<MakeSigned<const volatile signed int>::Type, const volatile signed int>::value),
- "const volatile signed int won't signify correctly");
-MOZ_STATIC_ASSERT((IsSame<MakeSigned<signed long>::Type, signed long>::value),
- "signed long won't signify correctly");
+static_assert(IsSame<MakeSigned<volatile signed short>::Type, volatile signed short>::value,
+ "volatile signed short won't signify correctly");
+static_assert(IsSame<MakeSigned<const volatile signed int>::Type, const volatile signed int>::value,
+ "const volatile signed int won't signify correctly");
+static_assert(IsSame<MakeSigned<signed long>::Type, signed long>::value,
+ "signed long won't signify correctly");
-MOZ_STATIC_ASSERT((IsSame<MakeSigned<char>::Type, signed char>::value),
- "char won't signify correctly");
-MOZ_STATIC_ASSERT((IsSame<MakeSigned<volatile char>::Type, volatile signed char>::value),
- "volatile char won't signify correctly");
-MOZ_STATIC_ASSERT((IsSame<MakeSigned<const char>::Type, const signed char>::value),
- "const char won't signify correctly");
+static_assert(IsSame<MakeSigned<char>::Type, signed char>::value,
+ "char won't signify correctly");
+static_assert(IsSame<MakeSigned<volatile char>::Type, volatile signed char>::value,
+ "volatile char won't signify correctly");
+static_assert(IsSame<MakeSigned<const char>::Type, const signed char>::value,
+ "const char won't signify correctly");
-MOZ_STATIC_ASSERT((IsSame<MakeUnsigned<const signed char>::Type, const unsigned char>::value),
- "const signed char won't unsignify correctly");
-MOZ_STATIC_ASSERT((IsSame<MakeUnsigned<volatile signed short>::Type, volatile unsigned short>::value),
- "volatile signed short won't unsignify correctly");
-MOZ_STATIC_ASSERT((IsSame<MakeUnsigned<const volatile signed int>::Type, const volatile unsigned int>::value),
- "const volatile signed int won't unsignify correctly");
-MOZ_STATIC_ASSERT((IsSame<MakeUnsigned<signed long>::Type, unsigned long>::value),
- "signed long won't unsignify correctly");
+static_assert(IsSame<MakeUnsigned<const signed char>::Type, const unsigned char>::value,
+ "const signed char won't unsignify correctly");
+static_assert(IsSame<MakeUnsigned<volatile signed short>::Type, volatile unsigned short>::value,
+ "volatile signed short won't unsignify correctly");
+static_assert(IsSame<MakeUnsigned<const volatile signed int>::Type, const volatile unsigned int>::value,
+ "const volatile signed int won't unsignify correctly");
+static_assert(IsSame<MakeUnsigned<signed long>::Type, unsigned long>::value,
+ "signed long won't unsignify correctly");
-MOZ_STATIC_ASSERT((IsSame<MakeUnsigned<const unsigned char>::Type, const unsigned char>::value),
- "const unsigned char won't unsignify correctly");
+static_assert(IsSame<MakeUnsigned<const unsigned char>::Type, const unsigned char>::value,
+ "const unsigned char won't unsignify correctly");
-MOZ_STATIC_ASSERT((IsSame<MakeUnsigned<volatile unsigned short>::Type, volatile unsigned short>::value),
- "volatile unsigned short won't unsignify correctly");
-MOZ_STATIC_ASSERT((IsSame<MakeUnsigned<const volatile unsigned int>::Type, const volatile unsigned int>::value),
- "const volatile unsigned int won't unsignify correctly");
-MOZ_STATIC_ASSERT((IsSame<MakeUnsigned<unsigned long>::Type, unsigned long>::value),
- "signed long won't unsignify correctly");
+static_assert(IsSame<MakeUnsigned<volatile unsigned short>::Type, volatile unsigned short>::value,
+ "volatile unsigned short won't unsignify correctly");
+static_assert(IsSame<MakeUnsigned<const volatile unsigned int>::Type, const volatile unsigned int>::value,
+ "const volatile unsigned int won't unsignify correctly");
+static_assert(IsSame<MakeUnsigned<unsigned long>::Type, unsigned long>::value,
+ "signed long won't unsignify correctly");
-MOZ_STATIC_ASSERT((IsSame<MakeUnsigned<char>::Type, unsigned char>::value),
- "char won't unsignify correctly");
-MOZ_STATIC_ASSERT((IsSame<MakeUnsigned<volatile char>::Type, volatile unsigned char>::value),
- "volatile char won't unsignify correctly");
-MOZ_STATIC_ASSERT((IsSame<MakeUnsigned<const char>::Type, const unsigned char>::value),
- "const char won't unsignify correctly");
+static_assert(IsSame<MakeUnsigned<char>::Type, unsigned char>::value,
+ "char won't unsignify correctly");
+static_assert(IsSame<MakeUnsigned<volatile char>::Type, volatile unsigned char>::value,
+ "volatile char won't unsignify correctly");
+static_assert(IsSame<MakeUnsigned<const char>::Type, const unsigned char>::value,
+ "const char won't unsignify correctly");
int
main()
{
CPlusPlus11IsBaseOf::StandardIsBaseOfTests();
TestIsBaseOf();
TestIsConvertible();
}
--- a/mozglue/linker/SeekableZStream.h
+++ b/mozglue/linker/SeekableZStream.h
@@ -47,18 +47,18 @@ struct SeekableZStreamHeader: public Zip
/* windowBits value used when deflating */
signed char windowBits;
/* Filter Id */
unsigned char filter;
};
#pragma pack()
-MOZ_STATIC_ASSERT(sizeof(SeekableZStreamHeader) == 5 * 4,
- "SeekableZStreamHeader should be 5 32-bits words");
+static_assert(sizeof(SeekableZStreamHeader) == 5 * 4,
+ "SeekableZStreamHeader should be 5 32-bits words");
/**
* Helper class used to decompress Seekable ZStreams.
*/
class SeekableZStream {
public:
/* Initialize from the given buffer. Returns whether initialization
* succeeded (true) or failed (false). */
--- a/netwerk/dns/nsEffectiveTLDService.cpp
+++ b/netwerk/dns/nsEffectiveTLDService.cpp
@@ -41,18 +41,18 @@ const union nsDomainEntry::etld_strings
};
// Dummy function to statically ensure that our indices don't overflow
// the storage provided for them.
void
nsDomainEntry::FuncForStaticAsserts(void)
{
#define ETLD_ENTRY(name, ex, wild) \
- MOZ_STATIC_ASSERT(ETLD_ENTRY_OFFSET(name) < (1 << ETLD_ENTRY_N_INDEX_BITS), \
- "invalid strtab index");
+ static_assert(ETLD_ENTRY_OFFSET(name) < (1 << ETLD_ENTRY_N_INDEX_BITS), \
+ "invalid strtab index");
#include "etld_data.inc"
#undef ETLD_ENTRY
}
#undef ETLD_ENTRY_OFFSET
#undef ETLD_STR_NUM
#undef ETLD_STR_NUM1
--- a/netwerk/protocol/http/SpdySession3.cpp
+++ b/netwerk/protocol/http/SpdySession3.cpp
@@ -553,17 +553,17 @@ SpdySession3::EnsureBuffer(nsAutoArrayPt
return;
// Leave a little slop on the new allocation - add 2KB to
// what we need and then round the result up to a 4KB (page)
// boundary.
objSize = (newSize + 2048 + 4095) & ~4095;
- MOZ_STATIC_ASSERT(sizeof(T) == 1, "sizeof(T) must be 1");
+ static_assert(sizeof(T) == 1, "sizeof(T) must be 1");
nsAutoArrayPtr<T> tmp(new T[objSize]);
memcpy(tmp, buf, preserve);
buf = tmp;
}
// Instantiate supported templates explicitly.
template void
SpdySession3::EnsureBuffer(nsAutoArrayPtr<char> &buf,
--- a/security/manager/ssl/src/CryptoTask.h
+++ b/security/manager/ssl/src/CryptoTask.h
@@ -32,18 +32,18 @@ namespace mozilla {
*/
class CryptoTask : public nsRunnable,
public nsNSSShutDownObject
{
public:
template <size_t LEN>
nsresult Dispatch(const char (&taskThreadName)[LEN])
{
- MOZ_STATIC_ASSERT(LEN <= 15,
- "Thread name must be no more than 15 characters");
+ static_assert(LEN <= 15,
+ "Thread name must be no more than 15 characters");
return Dispatch(nsDependentCString(taskThreadName));
}
protected:
CryptoTask()
: mRv(NS_ERROR_NOT_INITIALIZED),
mReleasedNSSResources(false)
{
--- a/security/manager/ssl/src/JARSignatureVerification.cpp
+++ b/security/manager/ssl/src/JARSignatureVerification.cpp
@@ -87,17 +87,17 @@ FindAndLoadOneEntry(nsIZipReader * zip,
// still crazily huge) to avoid OOM. The uncompressed length of an entry can be
// hundreds of times larger than the compressed version, especially if
// someone has speifically crafted the entry to cause OOM or to consume
// massive amounts of disk space.
//
// Also, keep in mind bug 164695 and that we must leave room for
// null-terminating the buffer.
static const uint32_t MAX_LENGTH = 1024 * 1024;
- MOZ_STATIC_ASSERT(MAX_LENGTH < UINT32_MAX, "MAX_LENGTH < UINT32_MAX");
+ static_assert(MAX_LENGTH < UINT32_MAX, "MAX_LENGTH < UINT32_MAX");
NS_ENSURE_TRUE(len64 < MAX_LENGTH, NS_ERROR_FILE_CORRUPTED);
NS_ENSURE_TRUE(len64 < UINT32_MAX, NS_ERROR_FILE_CORRUPTED); // bug 164695
SECITEM_AllocItem(buf, static_cast<uint32_t>(len64 + 1));
// buf.len == len64 + 1. We attempt to read len64 + 1 bytes instead of len64,
// so that we can check whether the metadata in the ZIP for the entry is
// incorrect.
uint32_t bytesRead;
--- a/security/manager/ssl/src/nsNSSComponent.cpp
+++ b/security/manager/ssl/src/nsNSSComponent.cpp
@@ -1053,21 +1053,21 @@ static void configureMD5(bool enabled)
nsresult
nsNSSComponent::InitializeNSS(bool showWarningBox)
{
// Can be called both during init and profile change.
// Needs mutex protection.
PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsNSSComponent::InitializeNSS\n"));
- MOZ_STATIC_ASSERT(nsINSSErrorsService::NSS_SEC_ERROR_BASE == SEC_ERROR_BASE &&
- nsINSSErrorsService::NSS_SEC_ERROR_LIMIT == SEC_ERROR_LIMIT &&
- nsINSSErrorsService::NSS_SSL_ERROR_BASE == SSL_ERROR_BASE &&
- nsINSSErrorsService::NSS_SSL_ERROR_LIMIT == SSL_ERROR_LIMIT,
- "You must update the values in nsINSSErrorsService.idl");
+ static_assert(nsINSSErrorsService::NSS_SEC_ERROR_BASE == SEC_ERROR_BASE &&
+ nsINSSErrorsService::NSS_SEC_ERROR_LIMIT == SEC_ERROR_LIMIT &&
+ nsINSSErrorsService::NSS_SSL_ERROR_BASE == SSL_ERROR_BASE &&
+ nsINSSErrorsService::NSS_SSL_ERROR_LIMIT == SSL_ERROR_LIMIT,
+ "You must update the values in nsINSSErrorsService.idl");
// variables used for flow control within this function
enum { problem_none, problem_no_rw, problem_no_security_at_all }
which_nss_problem = problem_none;
{
MutexAutoLock lock(mutex);
--- a/toolkit/identity/IdentityCryptoService.cpp
+++ b/toolkit/identity/IdentityCryptoService.cpp
@@ -450,19 +450,19 @@ GenerateDSAKeyPair(PK11SlotInfo * slot,
0x10,0xB9,0x6A,0xFB,0x17,0xC7,0xA0,0x32,0x59,0x32,0x9E,0x48,
0x29,0xB0,0xD0,0x3B,0xBC,0x78,0x96,0xB1,0x5B,0x4A,0xDE,0x53,
0xE1,0x30,0x85,0x8C,0xC3,0x4D,0x96,0x26,0x9A,0xA8,0x90,0x41,
0xF4,0x09,0x13,0x6C,0x72,0x42,0xA3,0x88,0x95,0xC9,0xD5,0xBC,
0xCA,0xD4,0xF3,0x89,0xAF,0x1D,0x7A,0x4B,0xD1,0x39,0x8B,0xD0,
0x72,0xDF,0xFA,0x89,0x62,0x33,0x39,0x7A
};
- MOZ_STATIC_ASSERT(MOZ_ARRAY_LENGTH(P) == 1024 / CHAR_BIT, "bad DSA P");
- MOZ_STATIC_ASSERT(MOZ_ARRAY_LENGTH(Q) == 160 / CHAR_BIT, "bad DSA Q");
- MOZ_STATIC_ASSERT(MOZ_ARRAY_LENGTH(G) == 1024 / CHAR_BIT, "bad DSA G");
+ static_assert(MOZ_ARRAY_LENGTH(P) == 1024 / CHAR_BIT, "bad DSA P");
+ static_assert(MOZ_ARRAY_LENGTH(Q) == 160 / CHAR_BIT, "bad DSA Q");
+ static_assert(MOZ_ARRAY_LENGTH(G) == 1024 / CHAR_BIT, "bad DSA G");
PQGParams pqgParams = {
NULL /*arena*/,
{ siBuffer, P, static_cast<unsigned int>(mozilla::ArrayLength(P)) },
{ siBuffer, Q, static_cast<unsigned int>(mozilla::ArrayLength(Q)) },
{ siBuffer, G, static_cast<unsigned int>(mozilla::ArrayLength(G)) }
};
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -752,28 +752,28 @@ nsXULAppInfo::GetWidgetToolkit(nsACStrin
aResult.AssignLiteral(MOZ_WIDGET_TOOLKIT);
return NS_OK;
}
// Ensure that the GeckoProcessType enum, defined in xpcom/build/nsXULAppAPI.h,
// is synchronized with the const unsigned longs defined in
// xpcom/system/nsIXULRuntime.idl.
#define SYNC_ENUMS(a,b) \
- MOZ_STATIC_ASSERT(nsIXULRuntime::PROCESS_TYPE_ ## a == \
- static_cast<int>(GeckoProcessType_ ## b), \
- "GeckoProcessType in nsXULAppAPI.h not synchronized with nsIXULRuntime.idl");
+ static_assert(nsIXULRuntime::PROCESS_TYPE_ ## a == \
+ static_cast<int>(GeckoProcessType_ ## b), \
+ "GeckoProcessType in nsXULAppAPI.h not synchronized with nsIXULRuntime.idl");
SYNC_ENUMS(DEFAULT, Default)
SYNC_ENUMS(PLUGIN, Plugin)
SYNC_ENUMS(CONTENT, Content)
SYNC_ENUMS(IPDLUNITTEST, IPDLUnitTest)
// .. and ensure that that is all of them:
-MOZ_STATIC_ASSERT(GeckoProcessType_IPDLUnitTest + 1 == GeckoProcessType_End,
- "Did not find the final GeckoProcessType");
+static_assert(GeckoProcessType_IPDLUnitTest + 1 == GeckoProcessType_End,
+ "Did not find the final GeckoProcessType");
NS_IMETHODIMP
nsXULAppInfo::GetProcessType(uint32_t* aResult)
{
NS_ENSURE_ARG_POINTER(aResult);
*aResult = XRE_GetProcessType();
return NS_OK;
}
--- a/tools/profiler/UnwinderThread2.cpp
+++ b/tools/profiler/UnwinderThread2.cpp
@@ -212,20 +212,20 @@ utb__addEntry(/*MODIFIED*/UnwinderThread
//// END externally visible functions
//////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////
//// BEGIN type UnwindThreadBuffer
-MOZ_STATIC_ASSERT(sizeof(uint32_t) == 4, "uint32_t size incorrect");
-MOZ_STATIC_ASSERT(sizeof(uint64_t) == 8, "uint64_t size incorrect");
-MOZ_STATIC_ASSERT(sizeof(uintptr_t) == sizeof(void*),
- "uintptr_t size incorrect");
+static_assert(sizeof(uint32_t) == 4, "uint32_t size incorrect");
+static_assert(sizeof(uint64_t) == 8, "uint64_t size incorrect");
+static_assert(sizeof(uintptr_t) == sizeof(void*),
+ "uintptr_t size incorrect");
typedef
struct {
uint64_t rsp;
uint64_t rbp;
uint64_t rip;
}
AMD64Regs;
--- a/widget/gonk/nsAppShell.cpp
+++ b/widget/gonk/nsAppShell.cpp
@@ -396,28 +396,28 @@ private:
mozilla::Mutex mQueueLock;
std::queue<UserInputData> mEventQueue;
};
// GeckoInputReaderPolicy
void
GeckoInputReaderPolicy::setDisplayInfo()
{
- MOZ_STATIC_ASSERT(nsIScreen::ROTATION_0_DEG ==
- DISPLAY_ORIENTATION_0,
- "Orientation enums not matched!");
- MOZ_STATIC_ASSERT(nsIScreen::ROTATION_90_DEG ==
- DISPLAY_ORIENTATION_90,
- "Orientation enums not matched!");
- MOZ_STATIC_ASSERT(nsIScreen::ROTATION_180_DEG ==
- DISPLAY_ORIENTATION_180,
- "Orientation enums not matched!");
- MOZ_STATIC_ASSERT(nsIScreen::ROTATION_270_DEG ==
- DISPLAY_ORIENTATION_270,
- "Orientation enums not matched!");
+ static_assert(nsIScreen::ROTATION_0_DEG ==
+ DISPLAY_ORIENTATION_0,
+ "Orientation enums not matched!");
+ static_assert(nsIScreen::ROTATION_90_DEG ==
+ DISPLAY_ORIENTATION_90,
+ "Orientation enums not matched!");
+ static_assert(nsIScreen::ROTATION_180_DEG ==
+ DISPLAY_ORIENTATION_180,
+ "Orientation enums not matched!");
+ static_assert(nsIScreen::ROTATION_270_DEG ==
+ DISPLAY_ORIENTATION_270,
+ "Orientation enums not matched!");
mConfig.setDisplayInfo(0, false, gScreenBounds.width, gScreenBounds.height, nsScreenGonk::GetRotation());
}
void GeckoInputReaderPolicy::getReaderConfiguration(InputReaderConfiguration* outConfig)
{
*outConfig = mConfig;
}
--- a/widget/nsGUIEvent.h
+++ b/widget/nsGUIEvent.h
@@ -589,17 +589,17 @@ public:
SetRawFlags(rawFlags);
}
private:
typedef uint32_t RawFlags;
inline void SetRawFlags(RawFlags aRawFlags)
{
- MOZ_STATIC_ASSERT(sizeof(BaseEventFlags) <= sizeof(RawFlags),
+ static_assert(sizeof(BaseEventFlags) <= sizeof(RawFlags),
"mozilla::widget::EventFlags must not be bigger than the RawFlags");
memcpy(this, &aRawFlags, sizeof(BaseEventFlags));
}
inline RawFlags GetRawFlags() const
{
RawFlags result = 0;
memcpy(&result, this, sizeof(BaseEventFlags));
return result;
--- a/xpcom/base/MapsMemoryReporter.cpp
+++ b/xpcom/base/MapsMemoryReporter.cpp
@@ -259,20 +259,20 @@ nsresult
MapsReporter::ParseMapping(
FILE *aFile,
nsIMemoryMultiReporterCallback *aCb,
nsISupports *aClosure,
CategoriesSeen *aCategoriesSeen)
{
// We need to use native types in order to get good warnings from fscanf, so
// let's make sure that the native types have the sizes we expect.
- MOZ_STATIC_ASSERT(sizeof(long long) == sizeof(int64_t),
- "size of (long long) is expected to match (int64_t)");
- MOZ_STATIC_ASSERT(sizeof(int) == sizeof(int32_t),
- "size of (int) is expected to match (int32_t)");
+ static_assert(sizeof(long long) == sizeof(int64_t),
+ "size of (long long) is expected to match (int64_t)");
+ static_assert(sizeof(int) == sizeof(int32_t),
+ "size of (int) is expected to match (int32_t)");
// Don't bail if FindLibxul fails. We can still gather meaningful stats
// here.
FindLibxul();
// The first line of an entry in /proc/self/smaps looks just like an entry
// in /proc/maps:
//
@@ -460,18 +460,18 @@ nsresult
MapsReporter::ParseMapBody(
FILE *aFile,
const nsACString &aName,
const nsACString &aDescription,
nsIMemoryMultiReporterCallback *aCb,
nsISupports *aClosure,
CategoriesSeen *aCategoriesSeen)
{
- MOZ_STATIC_ASSERT(sizeof(long long) == sizeof(int64_t),
- "size of (long long) is expected to match (int64_t)");
+ static_assert(sizeof(long long) == sizeof(int64_t),
+ "size of (long long) is expected to match (int64_t)");
const int argCount = 2;
char desc[1025];
unsigned long long size;
if (fscanf(aFile, "%1024[a-zA-Z_]: %llu kB\n",
desc, &size) != argCount) {
return NS_ERROR_FAILURE;
--- a/xpcom/base/nsCycleCollector.cpp
+++ b/xpcom/base/nsCycleCollector.cpp
@@ -669,17 +669,17 @@ private:
// - On 32-bit platforms sizeof(nsPurpleBufferEntry) is 12, so mEntries
// is 16,380 bytes, which leaves 4 bytes for mNext.
// - On 64-bit platforms sizeof(nsPurpleBufferEntry) is 24, so mEntries
// is 32,544 bytes, which leaves 8 bytes for mNext.
nsPurpleBufferEntry mEntries[1365];
Block() : mNext(nullptr) {
// Ensure Block is the right size (see above).
- MOZ_STATIC_ASSERT(
+ static_assert(
sizeof(Block) == 16384 || // 32-bit
sizeof(Block) == 32768, // 64-bit
"ill-sized nsPurpleBuffer::Block"
);
}
template <class PurpleVisitor>
void VisitEntries(nsPurpleBuffer &aBuffer, PurpleVisitor &aVisitor)
--- a/xpcom/base/nsErrorAsserts.cpp
+++ b/xpcom/base/nsErrorAsserts.cpp
@@ -1,10 +1,10 @@
#include "mozilla/Assertions.h"
#include "nsError.h"
// No reason to pull in Assertions.h for every single file that includes
// nsError.h, so let's put this in its own .cpp file instead of in the .h.
-MOZ_STATIC_ASSERT(((nsresult)0) < ((nsresult)-1),
- "nsresult must be an unsigned type");
-MOZ_STATIC_ASSERT(sizeof(nsresult) == sizeof(uint32_t),
- "nsresult must be 32 bits");
+static_assert(((nsresult)0) < ((nsresult)-1),
+ "nsresult must be an unsigned type");
+static_assert(sizeof(nsresult) == sizeof(uint32_t),
+ "nsresult must be 32 bits");
--- a/xpcom/build/nsXULAppAPI.h
+++ b/xpcom/build/nsXULAppAPI.h
@@ -362,20 +362,20 @@ static const char* const kGeckoProcessTy
"default",
"plugin",
"tab",
"ipdlunittest"
};
// Oddly, NS_ARRAY_LENGTH causes an internal compiler error with MSVC10, so
// compute the length manually.
-MOZ_STATIC_ASSERT(sizeof(kGeckoProcessTypeString) /
- sizeof(kGeckoProcessTypeString[0]) ==
- GeckoProcessType_End,
- "Array length mismatch");
+static_assert(sizeof(kGeckoProcessTypeString) /
+ sizeof(kGeckoProcessTypeString[0]) ==
+ GeckoProcessType_End,
+ "Array length mismatch");
XRE_API(const char*,
XRE_ChildProcessTypeToString, (GeckoProcessType aProcessType))
XRE_API(GeckoProcessType,
XRE_StringToChildProcessType, (const char* aProcessTypeString))
#if defined(MOZ_CRASHREPORTER)
--- a/xpcom/ds/nsAtomTable.cpp
+++ b/xpcom/ds/nsAtomTable.cpp
@@ -525,27 +525,27 @@ GetAtomHashEntry(const PRUnichar* aStrin
HandleOOM();
}
return e;
}
class CheckStaticAtomSizes
{
CheckStaticAtomSizes() {
- MOZ_STATIC_ASSERT((sizeof(nsFakeStringBuffer<1>().mRefCnt) ==
- sizeof(nsStringBuffer().mRefCount)) &&
- (sizeof(nsFakeStringBuffer<1>().mSize) ==
- sizeof(nsStringBuffer().mStorageSize)) &&
- (offsetof(nsFakeStringBuffer<1>, mRefCnt) ==
- offsetof(nsStringBuffer, mRefCount)) &&
- (offsetof(nsFakeStringBuffer<1>, mSize) ==
- offsetof(nsStringBuffer, mStorageSize)) &&
- (offsetof(nsFakeStringBuffer<1>, mStringData) ==
- sizeof(nsStringBuffer)),
- "mocked-up strings' representations should be compatible");
+ static_assert((sizeof(nsFakeStringBuffer<1>().mRefCnt) ==
+ sizeof(nsStringBuffer().mRefCount)) &&
+ (sizeof(nsFakeStringBuffer<1>().mSize) ==
+ sizeof(nsStringBuffer().mStorageSize)) &&
+ (offsetof(nsFakeStringBuffer<1>, mRefCnt) ==
+ offsetof(nsStringBuffer, mRefCount)) &&
+ (offsetof(nsFakeStringBuffer<1>, mSize) ==
+ offsetof(nsStringBuffer, mStorageSize)) &&
+ (offsetof(nsFakeStringBuffer<1>, mStringData) ==
+ sizeof(nsStringBuffer)),
+ "mocked-up strings' representations should be compatible");
}
};
nsresult
RegisterStaticAtoms(const nsStaticAtom* aAtoms, uint32_t aAtomCount)
{
// this does three things:
// 1) wraps each static atom in a wrapper, if necessary
--- a/xpcom/ds/nsExpirationTracker.h
+++ b/xpcom/ds/nsExpirationTracker.h
@@ -75,18 +75,18 @@ template <class T, uint32_t K> class nsE
* @param aTimerPeriod the timer period in milliseconds. The guarantees
* provided by the tracker are defined in terms of this period. If the
* period is zero, then we don't use a timer and rely on someone calling
* AgeOneGeneration explicitly.
*/
nsExpirationTracker(uint32_t aTimerPeriod)
: mTimerPeriod(aTimerPeriod), mNewestGeneration(0),
mInAgeOneGeneration(false) {
- MOZ_STATIC_ASSERT(K >= 2 && K <= nsExpirationState::NOT_TRACKED,
- "Unsupported number of generations (must be 2 <= K <= 15)");
+ static_assert(K >= 2 && K <= nsExpirationState::NOT_TRACKED,
+ "Unsupported number of generations (must be 2 <= K <= 15)");
mObserver = new ExpirationTrackerObserver();
mObserver->Init(this);
}
~nsExpirationTracker() {
if (mTimer) {
mTimer->Cancel();
}
mObserver->Destroy();
--- a/xpcom/glue/nsCOMPtr.h
+++ b/xpcom/glue/nsCOMPtr.h
@@ -569,18 +569,18 @@ class nsCOMPtr MOZ_FINAL
}
template<typename U>
nsCOMPtr( const already_AddRefed<U>& aSmartPtr )
: NSCAP_CTOR_BASE(static_cast<T*>(aSmartPtr.mRawPtr))
// construct from |dont_AddRef(expr)|
{
// But make sure that U actually inherits from T
- MOZ_STATIC_ASSERT((mozilla::IsBaseOf<T, U>::value),
- "U is not a subclass of T");
+ static_assert(mozilla::IsBaseOf<T, U>::value,
+ "U is not a subclass of T");
NSCAP_LOG_ASSIGNMENT(this, static_cast<T*>(aSmartPtr.mRawPtr));
NSCAP_ASSERT_NO_QUERY_NEEDED();
}
nsCOMPtr( const nsQueryInterface qi )
: NSCAP_CTOR_BASE(0)
// construct from |do_QueryInterface(expr)|
{
@@ -659,18 +659,18 @@ class nsCOMPtr MOZ_FINAL
}
template<typename U>
nsCOMPtr<T>&
operator=( const already_AddRefed<U>& rhs )
// assign from |dont_AddRef(expr)|
{
// Make sure that U actually inherits from T
- MOZ_STATIC_ASSERT((mozilla::IsBaseOf<T, U>::value),
- "U is not a subclass of T");
+ static_assert(mozilla::IsBaseOf<T, U>::value,
+ "U is not a subclass of T");
assign_assuming_AddRef(static_cast<T*>(rhs.mRawPtr));
NSCAP_ASSERT_NO_QUERY_NEEDED();
return *this;
}
nsCOMPtr<T>&
operator=( const nsQueryInterface rhs )
// assign from |do_QueryInterface(expr)|
--- a/xpcom/glue/nsStringAPI.h
+++ b/xpcom/glue/nsStringAPI.h
@@ -1076,36 +1076,36 @@ private:
*
* NOTE: HAVE_CPP_2BYTE_WCHAR_T may be automatically defined for some platforms
* in nscore.h. On other platforms, it may be defined in xpcom-config.h.
* Under GCC, this define should only be set if compiling with -fshort-wchar.
*/
#if defined(HAVE_CPP_CHAR16_T) || defined(HAVE_CPP_2BYTE_WCHAR_T)
#if defined(HAVE_CPP_CHAR16_T)
- MOZ_STATIC_ASSERT(sizeof(char16_t) == 2, "size of char16_t must be 2");
+ static_assert(sizeof(char16_t) == 2, "size of char16_t must be 2");
#define NS_LL(s) u##s
#else
- MOZ_STATIC_ASSERT(sizeof(wchar_t) == 2, "size of wchar_t must be 2");
+ static_assert(sizeof(wchar_t) == 2, "size of wchar_t must be 2");
#define NS_LL(s) L##s
#endif
#define NS_MULTILINE_LITERAL_STRING(s) nsDependentString(reinterpret_cast<const nsAString::char_type*>(s), uint32_t((sizeof(s)/2)-1))
#define NS_MULTILINE_LITERAL_STRING_INIT(n,s) n(reinterpret_cast<const nsAString::char_type*>(s), uint32_t((sizeof(s)/2)-1))
#define NS_NAMED_MULTILINE_LITERAL_STRING(n,s) const nsDependentString n(reinterpret_cast<const nsAString::char_type*>(s), uint32_t((sizeof(s)/2)-1))
typedef nsDependentString nsLiteralString;
#else
#define NS_LL(s) s
#define NS_MULTILINE_LITERAL_STRING(s) NS_ConvertASCIItoUTF16(s, uint32_t(sizeof(s)-1))
#define NS_MULTILINE_LITERAL_STRING_INIT(n,s) n(s, uint32_t(sizeof(s)-1))
#define NS_NAMED_MULTILINE_LITERAL_STRING(n,s) const NS_ConvertASCIItoUTF16 n(s, uint32_t(sizeof(s)-1))
typedef NS_ConvertASCIItoUTF16 nsLiteralString;
#endif
/* Check that PRUnichar is unsigned */
-MOZ_STATIC_ASSERT(PRUnichar(-1) > PRUnichar(0), "PRUnichar is by definition an unsigned type");
+static_assert(PRUnichar(-1) > PRUnichar(0), "PRUnichar is by definition an unsigned type");
/*
* Macro arguments used in concatenation or stringification won't be expanded.
* Therefore, in order for |NS_L(FOO)| to work as expected (which is to expand
* |FOO| before doing whatever |NS_L| needs to do to it) a helper macro needs
* to be inserted in between to allow the macro argument to expand.
* See "3.10.6 Separate Expansion of Macro Arguments" of the CPP manual for a
* more accurate and precise explanation.
--- a/xpcom/glue/nsTArray-inl.h
+++ b/xpcom/glue/nsTArray-inl.h
@@ -27,22 +27,22 @@ const nsTArrayHeader* nsTArray_base<Allo
// Assuming |this| points to an nsAutoArray, we want to get a pointer to
// mAutoBuf. So just cast |this| to nsAutoArray* and read &mAutoBuf!
const void* autoBuf = &reinterpret_cast<const nsAutoArrayBase<nsTArray<uint32_t>, 1>*>(this)->mAutoBuf;
// If we're on a 32-bit system and elemAlign is 8, we need to adjust our
// pointer to take into account the extra alignment in the auto array.
- MOZ_STATIC_ASSERT(sizeof(void*) != 4 ||
- (MOZ_ALIGNOF(mozilla::AlignedElem<8>) == 8 &&
- sizeof(nsAutoTArray<mozilla::AlignedElem<8>, 1>) ==
- sizeof(void*) + sizeof(nsTArrayHeader) +
- 4 + sizeof(mozilla::AlignedElem<8>)),
- "auto array padding wasn't what we expected");
+ static_assert(sizeof(void*) != 4 ||
+ (MOZ_ALIGNOF(mozilla::AlignedElem<8>) == 8 &&
+ sizeof(nsAutoTArray<mozilla::AlignedElem<8>, 1>) ==
+ sizeof(void*) + sizeof(nsTArrayHeader) +
+ 4 + sizeof(mozilla::AlignedElem<8>)),
+ "auto array padding wasn't what we expected");
// We don't support alignments greater than 8 bytes.
NS_ABORT_IF_FALSE(elemAlign <= 4 || elemAlign == 8, "unsupported alignment.");
if (sizeof(void*) == 4 && elemAlign == 8) {
autoBuf = reinterpret_cast<const char*>(autoBuf) + 4;
}
return reinterpret_cast<const Header*>(autoBuf);
@@ -78,18 +78,18 @@ bool nsTArray_base<Alloc, Copy>::UsesAut
// GetAutoArrayBuffer(8) will always point inside the auto array object,
// even if it doesn't point at the beginning of the header.
//
// Note that this means that we can't store elements with alignment 16 in an
// nsTArray, because GetAutoArrayBuffer(16) could lie outside the memory
// owned by this nsAutoTArray. We statically assert that elem_type's
// alignment is 8 bytes or less in nsAutoArrayBase.
- MOZ_STATIC_ASSERT(sizeof(nsTArrayHeader) > 4,
- "see comment above");
+ static_assert(sizeof(nsTArrayHeader) > 4,
+ "see comment above");
#ifdef DEBUG
ptrdiff_t diff = reinterpret_cast<const char*>(GetAutoArrayBuffer(8)) -
reinterpret_cast<const char*>(GetAutoArrayBuffer(4));
NS_ABORT_IF_FALSE(diff >= 0 && diff <= 4, "GetAutoArrayBuffer doesn't do what we expect.");
#endif
return mHdr == GetAutoArrayBuffer(4) || mHdr == GetAutoArrayBuffer(8);
--- a/xpcom/glue/nsTArray.h
+++ b/xpcom/glue/nsTArray.h
@@ -686,18 +686,18 @@ struct nsTArray_TypedBase : public nsTAr
// The static_cast is necessary to obtain the correct address for the derived
// class since we are a base class used in multiple inheritance.
//
template <class E, class Derived>
struct nsTArray_TypedBase<JS::Heap<E>, Derived>
: public nsTArray_SafeElementAtHelper<JS::Heap<E>, Derived>
{
operator const nsTArray<E>& () {
- MOZ_STATIC_ASSERT(sizeof(E) == sizeof(JS::Heap<E>),
- "JS::Heap<E> must be binary compatible with E.");
+ static_assert(sizeof(E) == sizeof(JS::Heap<E>),
+ "JS::Heap<E> must be binary compatible with E.");
Derived* self = static_cast<Derived*>(this);
return *reinterpret_cast<nsTArray<E> *>(self);
}
operator const FallibleTArray<E>& () {
Derived* self = static_cast<Derived*>(this);
return *reinterpret_cast<FallibleTArray<E> *>(self);
}
@@ -1688,19 +1688,19 @@ protected:
private:
// nsTArray_base casts itself as an nsAutoArrayBase in order to get a pointer
// to mAutoBuf.
template<class Allocator, class Copier>
friend class nsTArray_base;
void Init() {
- MOZ_STATIC_ASSERT(MOZ_ALIGNOF(elem_type) <= 8,
- "can't handle alignments greater than 8, "
- "see nsTArray_base::UsesAutoArrayBuffer()");
+ static_assert(MOZ_ALIGNOF(elem_type) <= 8,
+ "can't handle alignments greater than 8, "
+ "see nsTArray_base::UsesAutoArrayBuffer()");
// Temporary work around for VS2012 RC compiler crash
Header** phdr = base_type::PtrToHdr();
*phdr = reinterpret_cast<Header*>(&mAutoBuf);
(*phdr)->mLength = 0;
(*phdr)->mCapacity = N;
(*phdr)->mIsAutoArray = 1;
MOZ_ASSERT(base_type::GetAutoArrayBuffer(MOZ_ALIGNOF(elem_type)) ==
@@ -1778,17 +1778,17 @@ public:
// because any type may be placed into an array, and there's no padding between
// elements of an array.) The compiler pads the end of the structure to
// enforce this rule.
//
// If we used nsAutoTArray<uint32_t, 1> below, this assertion would fail on a
// 64-bit system, where the compiler inserts 4 bytes of padding at the end of
// the auto array to make its size a multiple of alignof(void*) == 8 bytes.
-MOZ_STATIC_ASSERT(sizeof(nsAutoTArray<uint32_t, 2>) ==
- sizeof(void*) + sizeof(nsTArrayHeader) + sizeof(uint32_t) * 2,
- "nsAutoTArray shouldn't contain any extra padding, "
- "see the comment");
+static_assert(sizeof(nsAutoTArray<uint32_t, 2>) ==
+ sizeof(void*) + sizeof(nsTArrayHeader) + sizeof(uint32_t) * 2,
+ "nsAutoTArray shouldn't contain any extra padding, "
+ "see the comment");
// Definitions of nsTArray_Impl methods
#include "nsTArray-inl.h"
#endif // nsTArray_h__
--- a/xpcom/glue/nsThreadUtils.h
+++ b/xpcom/glue/nsThreadUtils.h
@@ -32,18 +32,18 @@ NS_SetThreadName(nsIThread *thread, cons
/**
* Static length version of the above function checking length of the
* name at compile time.
*/
template <size_t LEN>
inline NS_COM_GLUE void
NS_SetThreadName(nsIThread *thread, const char (&name)[LEN])
{
- MOZ_STATIC_ASSERT(LEN <= 16,
- "Thread name must be no more than 16 characters");
+ static_assert(LEN <= 16,
+ "Thread name must be no more than 16 characters");
NS_SetThreadName(thread, nsDependentCString(name));
}
/**
* Create a new thread, and optionally provide an initial event for the thread.
*
* @param result
* The resulting nsIThread object.
--- a/xpcom/string/public/nsString.h
+++ b/xpcom/string/public/nsString.h
@@ -43,21 +43,21 @@
#include "nsTString.h"
#include "string-template-undef.h"
// declare nsCString, et. al.
#include "string-template-def-char.h"
#include "nsTString.h"
#include "string-template-undef.h"
-MOZ_STATIC_ASSERT(sizeof(PRUnichar) == 2, "size of PRUnichar must be 2");
-MOZ_STATIC_ASSERT(sizeof(nsString::char_type) == 2,
- "size of nsString::char_type must be 2");
-MOZ_STATIC_ASSERT(sizeof(nsCString::char_type) == 1,
- "size of nsCString::char_type must be 1");
+static_assert(sizeof(PRUnichar) == 2, "size of PRUnichar must be 2");
+static_assert(sizeof(nsString::char_type) == 2,
+ "size of nsString::char_type must be 2");
+static_assert(sizeof(nsCString::char_type) == 1,
+ "size of nsCString::char_type must be 1");
/**
* A helper class that converts a UTF-16 string to ASCII in a lossy manner
*/
class NS_LossyConvertUTF16toASCII : public nsAutoCString
{
public:
explicit
--- a/xpcom/string/src/nsSubstring.cpp
+++ b/xpcom/string/src/nsSubstring.cpp
@@ -316,10 +316,10 @@ nsStringBuffer::SizeOfIncludingThisEvenI
#include "string-template-undef.h"
// Check that internal and external strings have the same size.
// See https://bugzilla.mozilla.org/show_bug.cgi?id=430581
#include "prlog.h"
#include "nsXPCOMStrings.h"
-MOZ_STATIC_ASSERT(sizeof(nsStringContainer_base) == sizeof(nsSubstring),
- "internal and external strings must have the same size");
+static_assert(sizeof(nsStringContainer_base) == sizeof(nsSubstring),
+ "internal and external strings must have the same size");
--- a/xpcom/threads/nsMemoryPressure.cpp
+++ b/xpcom/threads/nsMemoryPressure.cpp
@@ -8,18 +8,18 @@
#include "mozilla/Assertions.h"
#include "mozilla/Atomics.h"
#include "nsThreadUtils.h"
using namespace mozilla;
static Atomic<int32_t, Relaxed> sMemoryPressurePending;
-MOZ_STATIC_ASSERT(MemPressure_None == 0,
- "Bad static initialization with the default constructor.");
+static_assert(MemPressure_None == 0,
+ "Bad static initialization with the default constructor.");
MemoryPressureState
NS_GetPendingMemoryPressure()
{
int32_t value = sMemoryPressurePending.exchange(MemPressure_None);
return MemoryPressureState(value);
}