Bug 895322 - Part 1: Replace the usages of MOZ_STATIC_ASSERT with C++11 static_assert; r=Waldo

This patch was mostly generated by running the following scripts on the codebase, with some
manual changes made afterwards:

# static_assert.sh
#!/bin/bash
# Command to convert an NSPR integer type to the equivalent standard integer type

function convert() {
echo "Converting $1 to $2..."
find . ! -wholename "*nsprpub*" \
       ! -wholename "*security/nss*" \
       ! -wholename "*/.hg*" \
       ! -wholename "obj-ff-dbg*" \
       ! -name nsXPCOMCID.h \
       ! -name prtypes.h \
         -type f \
      \( -iname "*.cpp" \
         -o -iname "*.h" \
         -o -iname "*.cc" \
         -o -iname "*.mm" \) | \
    xargs -n 1 `dirname $0`/assert_replacer.py #sed -i -e "s/\b$1\b/$2/g"
}

convert MOZ_STATIC_ASSERT static_assert
hg rev --no-backup mfbt/Assertions.h \
                   media/webrtc/signaling/src/sipcc/core/includes/ccapi.h \
                   modules/libmar/src/mar_private.h \
                   modules/libmar/src/mar.h


# assert_replacer.py
#!/usr/bin/python

import sys
import re

pattern = re.compile(r"\bMOZ_STATIC_ASSERT\b")

def replaceInPlace(fname):
  print fname
  f = open(fname, "rw+")
  lines = f.readlines()
  for i in range(0, len(lines)):
    while True:
      index = re.search(pattern, lines[i])
      if index != None:
        index = index.start()
        lines[i] = lines[i][0:index] + "static_assert" + lines[i][index+len("MOZ_STATIC_ASSERT"):]
        for j in range(i + 1, len(lines)):
          if lines[j].find("                 ", index) == index:
            lines[j] = lines[j][0:index] + lines[j][index+4:]
          else:
            break
      else:
        break
  f.seek(0, 0)
  f.truncate()
  f.write("".join(lines))
  f.close()

argc = len(sys.argv)
for i in range(1, argc):
  replaceInPlace(sys.argv[i])

--HG--
extra : rebase_source : 4b4a4047d82f2c205b9fad8d56dfc3f1afc0b045
This commit is contained in:
Ehsan Akhgari 2013-07-18 13:59:53 -04:00
parent 97899ea185
commit 5ee21d6d3f
111 changed files with 573 additions and 574 deletions

View File

@ -12,7 +12,7 @@
using namespace mozilla::a11y;
#define ROLE(geckoRole, stringRole, atkRole, macRole, msaaRole, ia2Role, nameRule) \
MOZ_STATIC_ASSERT(static_cast<uint32_t>(roles::geckoRole) \
static_assert(static_cast<uint32_t>(roles::geckoRole) \
== static_cast<uint32_t>(nsIAccessibleRole::ROLE_ ## geckoRole), \
"internal and xpcom roles differ!");
#include "RoleMap.h"

View File

@ -3353,13 +3353,13 @@ Accessible::GetLevelInternal()
void
Accessible::StaticAsserts() const
{
MOZ_STATIC_ASSERT(eLastChildrenFlag <= (2 << kChildrenFlagsBits) - 1,
static_assert(eLastChildrenFlag <= (2 << kChildrenFlagsBits) - 1,
"Accessible::mChildrenFlags was oversized by eLastChildrenFlag!");
MOZ_STATIC_ASSERT(eLastStateFlag <= (2 << kStateFlagsBits) - 1,
static_assert(eLastStateFlag <= (2 << kStateFlagsBits) - 1,
"Accessible::mStateFlags was oversized by eLastStateFlag!");
MOZ_STATIC_ASSERT(eLastAccType <= (2 << kTypeBits) - 1,
static_assert(eLastAccType <= (2 << kTypeBits) - 1,
"Accessible::mType was oversized by eLastAccType!");
MOZ_STATIC_ASSERT(eLastAccGenericType <= (2 << kGenericTypesBits) - 1,
static_assert(eLastAccGenericType <= (2 << kGenericTypesBits) - 1,
"Accessible::mGenericType was oversized by eLastAccGenericType!");
}

View File

@ -1617,7 +1617,7 @@ AccessibleWrap::HandleAccEvent(AccEvent* aEvent)
uint32_t eventType = aEvent->GetEventType();
MOZ_STATIC_ASSERT(sizeof(gWinEventMap)/sizeof(gWinEventMap[0]) == nsIAccessibleEvent::EVENT_LAST_ENTRY,
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);

View File

@ -2322,7 +2322,7 @@ nsScriptSecurityManager::nsScriptSecurityManager(void)
mIsJavaScriptEnabled(false),
mPolicyPrefsChanged(true)
{
MOZ_STATIC_ASSERT(sizeof(intptr_t) == sizeof(void*),
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.");
}

View File

@ -237,7 +237,7 @@ nsMixedContentBlocker::ShouldLoad(uint32_t aContentType,
// amplifies these concerns.
MOZ_STATIC_ASSERT(TYPE_DATAREQUEST == TYPE_XMLHTTPREQUEST,
static_assert(TYPE_DATAREQUEST == TYPE_XMLHTTPREQUEST,
"TYPE_DATAREQUEST is not a synonym for "
"TYPE_XMLHTTPREQUEST");

View File

@ -865,7 +865,7 @@ 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")

View File

@ -128,7 +128,7 @@ 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 \
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

View File

@ -157,8 +157,8 @@ 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");

View File

@ -184,9 +184,9 @@ struct WebAudioUtils {
{
using namespace std;
MOZ_STATIC_ASSERT((mozilla::IsIntegral<IntType>::value == true),
static_assert(mozilla::IsIntegral<IntType>::value == true,
"IntType must be an integral type");
MOZ_STATIC_ASSERT((mozilla::IsFloatingPoint<FloatType>::value == true),
static_assert(mozilla::IsFloatingPoint<FloatType>::value == true,
"FloatType must be a floating point type");
if (f != f) {

View File

@ -140,7 +140,7 @@ void TestSpecExample()
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);

View File

@ -156,7 +156,7 @@ DoMorphology(nsSVGFilterInstance* instance,
int32_t rx,
int32_t ry)
{
MOZ_STATIC_ASSERT(Operator == SVG_OPERATOR_ERODE ||
static_assert(Operator == SVG_OPERATOR_ERODE ||
Operator == SVG_OPERATOR_DILATE,
"unexpected morphology operator");

View File

@ -61,7 +61,7 @@ AudioChannelAgent::InitInternal(int32_t aChannelType,
{
// 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) ==
static_assert(static_cast<AudioChannelType>(AUDIO_AGENT_CHANNEL_NORMAL) ==
AUDIO_CHANNEL_NORMAL &&
static_cast<AudioChannelType>(AUDIO_AGENT_CHANNEL_CONTENT) ==
AUDIO_CHANNEL_CONTENT &&

View File

@ -1220,7 +1220,7 @@ 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*),
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.");
@ -1686,7 +1686,7 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_ENTRY(nsIDOMXULPopupElement)
DOM_CLASSINFO_MAP_END
MOZ_STATIC_ASSERT(MOZ_ARRAY_LENGTH(sClassInfoData) == eDOMClassInfoIDCount,
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!");

View File

@ -1985,13 +1985,13 @@ ConvertJSValueToByteString(JSContext* cx, JS::Handle<JS::Value> v,
// 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;

View File

@ -131,7 +131,7 @@ IsDOMIfaceAndProtoClass(const js::Class* clasp)
return IsDOMIfaceAndProtoClass(Jsvalify(clasp));
}
MOZ_STATIC_ASSERT(DOM_OBJECT_SLOT == js::PROXY_PRIVATE_SLOT,
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>
@ -269,7 +269,7 @@ UnwrapObject(JSContext* cx, JSObject* obj, U& 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 ==
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;
@ -1527,15 +1527,15 @@ private:
class DepedentStringAsserter : public nsDependentString {
public:
static void StaticAsserts() {
MOZ_STATIC_ASSERT(sizeof(FakeDependentString) == sizeof(nsDependentString),
static_assert(sizeof(FakeDependentString) == sizeof(nsDependentString),
"Must have right object size");
MOZ_STATIC_ASSERT(offsetof(FakeDependentString, mData) ==
static_assert(offsetof(FakeDependentString, mData) ==
offsetof(DepedentStringAsserter, mData),
"Offset of mData should match");
MOZ_STATIC_ASSERT(offsetof(FakeDependentString, mLength) ==
static_assert(offsetof(FakeDependentString, mLength) ==
offsetof(DepedentStringAsserter, mLength),
"Offset of mLength should match");
MOZ_STATIC_ASSERT(offsetof(FakeDependentString, mFlags) ==
static_assert(offsetof(FakeDependentString, mFlags) ==
offsetof(DepedentStringAsserter, mFlags),
"Offset of mFlags should match");
}

View File

@ -50,7 +50,7 @@ class nsCycleCollectionParticipant;
// 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,
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.");

View File

@ -224,7 +224,7 @@ template<typename T>
inline bool
PrimitiveConversionTraits_EnforceRange(JSContext* cx, const double& d, T* retval)
{
MOZ_STATIC_ASSERT(std::numeric_limits<T>::is_integer,
static_assert(std::numeric_limits<T>::is_integer,
"This can only be applied to integers!");
if (!mozilla::IsFinite(d)) {
@ -252,7 +252,7 @@ template<typename T>
inline bool
PrimitiveConversionTraits_Clamp(JSContext* cx, const double& d, T* retval)
{
MOZ_STATIC_ASSERT(std::numeric_limits<T>::is_integer,
static_assert(std::numeric_limits<T>::is_integer,
"This can only be applied to integers!");
if (mozilla::IsNaN(d)) {

View File

@ -795,7 +795,7 @@ static DBusCallback sBluetoothDBusPropCallbacks[] =
GetDevicePropertiesCallback
};
MOZ_STATIC_ASSERT(
static_assert(
sizeof(sBluetoothDBusPropCallbacks) == sizeof(sBluetoothDBusIfaces),
"DBus Property callback array and DBus interface array must be same size");

View File

@ -32,7 +32,7 @@
USING_INDEXEDDB_NAMESPACE
using namespace mozilla::dom::indexedDB::ipc;
MOZ_STATIC_ASSERT(sizeof(size_t) >= sizeof(IDBCursor::Direction),
static_assert(sizeof(size_t) >= sizeof(IDBCursor::Direction),
"Relying on conversion between size_t and "
"IDBCursor::Direction");

View File

@ -1331,7 +1331,7 @@ bool
IDBObjectStore::ReadFileHandle(JSStructuredCloneReader* aReader,
FileHandleData* aRetval)
{
MOZ_STATIC_ASSERT(SCTAG_DOM_FILEHANDLE == 0xFFFF8004,
static_assert(SCTAG_DOM_FILEHANDLE == 0xFFFF8004,
"Update me!");
MOZ_ASSERT(aReader && aRetval);
@ -1356,7 +1356,7 @@ IDBObjectStore::ReadBlobOrFile(JSStructuredCloneReader* aReader,
uint32_t aTag,
BlobOrFileData* aRetval)
{
MOZ_STATIC_ASSERT(SCTAG_DOM_BLOB == 0xFFFF8001 &&
static_assert(SCTAG_DOM_BLOB == 0xFFFF8001 &&
SCTAG_DOM_FILE_WITHOUT_LASTMODIFIEDDATE == 0xFFFF8002 &&
SCTAG_DOM_FILE == 0xFFFF8005,
"Update me!");
@ -1417,7 +1417,7 @@ IDBObjectStore::StructuredCloneReadCallback(JSContext* aCx,
{
// 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 &&
static_assert(SCTAG_DOM_BLOB == 0xFFFF8001 &&
SCTAG_DOM_FILE_WITHOUT_LASTMODIFIEDDATE == 0xFFFF8002 &&
SCTAG_DOM_FILEHANDLE == 0xFFFF8004 &&
SCTAG_DOM_FILE == 0xFFFF8005,

View File

@ -106,7 +106,7 @@ Key::EncodeJSValInternal(JSContext* aCx, const jsval aVal,
{
NS_ENSURE_TRUE(aRecursionDepth < MaxRecursionDepth, NS_ERROR_DOM_INDEXEDDB_DATA_ERR);
MOZ_STATIC_ASSERT(eMaxType * MaxArrayCollapse < 256,
static_assert(eMaxType * MaxArrayCollapse < 256,
"Unable to encode jsvals.");
if (JSVAL_IS_STRING(aVal)) {

View File

@ -34,7 +34,7 @@ namespace {
// If JS_STRUCTURED_CLONE_VERSION changes then we need to update our major
// schema version.
MOZ_STATIC_ASSERT(JS_STRUCTURED_CLONE_VERSION == 2,
static_assert(JS_STRUCTURED_CLONE_VERSION == 2,
"Need to update the major schema version.");
// Major schema version. Bump for almost everything.
@ -47,9 +47,9 @@ 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,
static_assert(kMajorSchemaVersion <= 0xFFFFFFF,
"Major version needs to fit in 28 bits.");
MOZ_STATIC_ASSERT(kMinorSchemaVersion <= 0xF,
static_assert(kMinorSchemaVersion <= 0xF,
"Minor version needs to fit in 4 bits.");
inline
@ -1981,7 +1981,7 @@ OpenDatabaseHelper::CreateDatabaseConnection(
}
else {
// This logic needs to change next time we change the schema!
MOZ_STATIC_ASSERT(kSQLiteSchemaVersion == int32_t((14 << 4) + 0),
static_assert(kSQLiteSchemaVersion == int32_t((14 << 4) + 0),
"Need upgrade code from schema version increase.");
while (schemaVersion != kSQLiteSchemaVersion) {

View File

@ -364,7 +364,7 @@ inline
already_AddRefed<nsIDOMBlob>
GetBlobFromParams(const SlicedBlobConstructorParams& aParams)
{
MOZ_STATIC_ASSERT(ActorFlavor == mozilla::dom::ipc::Parent,
static_assert(ActorFlavor == mozilla::dom::ipc::Parent,
"No other flavor is supported here!");
BlobParent* actor =

View File

@ -383,9 +383,9 @@ nsPluginTag::GetPluginState()
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);
}

View File

@ -483,7 +483,7 @@ QuotaManager::Init()
mCheckQuotaHelpers.Init();
mLiveStorages.Init();
MOZ_STATIC_ASSERT(Client::IDB == 0 && Client::TYPE_MAX == 1,
static_assert(Client::IDB == 0 && Client::TYPE_MAX == 1,
"Fix the registration!");
NS_ASSERTION(mClients.Capacity() == Client::TYPE_MAX,

View File

@ -677,7 +677,7 @@ DOMStorageDBThread::TimeUntilFlush()
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) {

View File

@ -67,7 +67,7 @@ using mozilla::Preferences;
// 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,
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
@ -156,7 +156,7 @@ const char* gStringChars[] = {
// thread.
};
MOZ_STATIC_ASSERT(NS_ARRAY_LENGTH(gStringChars) == ID_COUNT,
static_assert(NS_ARRAY_LENGTH(gStringChars) == ID_COUNT,
"gStringChars should have the right length.");
class LiteralRebindingCString : public nsDependentCString

View File

@ -74,7 +74,7 @@ class ConvolutionFilter1D {
// 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,
static_assert(sizeof(Fixed) == 2,
"fixed type should fit in float mantissa");
float raw = static_cast<float>(x);
return ldexpf(raw, -kShiftBits);

View File

@ -58,7 +58,7 @@ struct ParamTraits<mozilla::gl::GLContext::SharedTextureShareType>
static void Write(Message* msg, const paramType& param)
{
MOZ_STATIC_ASSERT(sizeof(paramType) <= sizeof(int32_t),
static_assert(sizeof(paramType) <= sizeof(int32_t),
"TextureShareType assumes to be int32_t");
WriteParam(msg, int32_t(param));
}

View File

@ -16,7 +16,7 @@
//------------------------------------------------------------------------------
MOZ_STATIC_ASSERT(MOZ_ALIGNOF(Pickle::memberAlignmentType) >= MOZ_ALIGNOF(uint32_t),
static_assert(MOZ_ALIGNOF(Pickle::memberAlignmentType) >= MOZ_ALIGNOF(uint32_t),
"Insufficient alignment");
// static
@ -61,7 +61,7 @@ struct Copier<T, sizeof(uint64_t), false>
#else
static const int loIndex = 1, hiIndex = 0;
#endif
MOZ_STATIC_ASSERT(MOZ_ALIGNOF(uint32_t*) == MOZ_ALIGNOF(void*),
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);
@ -81,7 +81,7 @@ struct Copier<T, size, true>
// 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*),
static_assert(MOZ_ALIGNOF(T*) == MOZ_ALIGNOF(void*),
"Pointers have different alignments");
*dest = *(*reinterpret_cast<T**>(iter));
}
@ -89,7 +89,7 @@ struct Copier<T, size, true>
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);
}

View File

@ -251,7 +251,7 @@ class Pickle {
// 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);
}

View File

@ -188,7 +188,7 @@ class Heap : public js::HeapBase<T>
{
public:
Heap() {
MOZ_STATIC_ASSERT(sizeof(T) == sizeof(Heap<T>),
static_assert(sizeof(T) == sizeof(Heap<T>),
"Heap<T> must be binary compatible with T.");
init(js::GCMethods<T>::initial());
}
@ -301,7 +301,7 @@ class TenuredHeap : public js::HeapBase<T>
{
public:
TenuredHeap() : bits(0) {
MOZ_STATIC_ASSERT(sizeof(T) == sizeof(TenuredHeap<T>),
static_assert(sizeof(T) == sizeof(TenuredHeap<T>),
"TenuredHeap<T> must be binary compatible with T.");
}
explicit TenuredHeap(T p) : bits(0) { setPtr(p); }
@ -385,21 +385,21 @@ class MOZ_NONHEAP_CLASS Handle : public js::HandleBase<T>
Handle(Handle<S> handle,
typename mozilla::EnableIf<mozilla::IsConvertible<S, T>::value, int>::Type dummy = 0)
{
MOZ_STATIC_ASSERT(sizeof(Handle<T>) == sizeof(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,
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,
static_assert(mozilla::IsPointer<T>::value,
"JS::NullPtr overload not valid for non-pointer types");
ptr = reinterpret_cast<const T *>(&JS::NullPtr::constNullValue);
}
@ -1034,7 +1034,7 @@ template <typename T>
inline
MutableHandle<T>::MutableHandle(Rooted<T> *root)
{
MOZ_STATIC_ASSERT(sizeof(MutableHandle<T>) == sizeof(T *),
static_assert(sizeof(MutableHandle<T>) == sizeof(T *),
"MutableHandle must be binary compatible with T*.");
ptr = root->address();
}

View File

@ -62,7 +62,7 @@ namespace js {}
# 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)

View File

@ -1645,11 +1645,11 @@ inline Anchor<Value>::~Anchor()
namespace detail {
struct ValueAlignmentTester { char c; JS::Value v; };
MOZ_STATIC_ASSERT(sizeof(ValueAlignmentTester) == 16,
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,
static_assert(sizeof(LayoutAlignmentTester) == 16,
"jsval_layout must be 16-byte-aligned");
} // namespace detail
@ -1664,7 +1664,7 @@ MOZ_STATIC_ASSERT(sizeof(LayoutAlignmentTester) == 16,
*/
typedef JS::Value jsval;
MOZ_STATIC_ASSERT(sizeof(jsval_layout) == sizeof(JS::Value),
static_assert(sizeof(jsval_layout) == sizeof(JS::Value),
"jsval_layout and JS::Value must have identical layouts");
/************************************************************************/

View File

@ -46,6 +46,6 @@
} 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 */

View File

@ -32,7 +32,7 @@ JS_ALWAYS_INLINE
char *
AlignPtr(void *orig)
{
MOZ_STATIC_ASSERT(mozilla::tl::FloorLog2<LIFO_ALLOC_ALIGN>::value ==
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");

View File

@ -5458,7 +5458,7 @@ EmitObject(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn)
if (!objbox)
return false;
unsigned index = bce->objectList.add(objbox);
MOZ_STATIC_ASSERT(JSOP_NEWINIT_LENGTH == JSOP_NEWOBJECT_LENGTH,
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));
}

View File

@ -52,7 +52,7 @@ class JSFunction : public JSObject
static void staticAsserts() {
JS_STATIC_ASSERT(INTERPRETED == JS_FUNCTION_INTERPRETED_BIT);
MOZ_STATIC_ASSERT(sizeof(JSFunction) == sizeof(js::shadow::Function),
static_assert(sizeof(JSFunction) == sizeof(js::shadow::Function),
"shadow interface must match actual interface");
}

View File

@ -1018,11 +1018,11 @@ class JSObject : public js::ObjectImpl
private:
static void staticAsserts() {
MOZ_STATIC_ASSERT(sizeof(JSObject) == sizeof(js::shadow::Object),
static_assert(sizeof(JSObject) == sizeof(js::shadow::Object),
"shadow interface must match actual interface");
MOZ_STATIC_ASSERT(sizeof(JSObject) == sizeof(js::ObjectImpl),
static_assert(sizeof(JSObject) == sizeof(js::ObjectImpl),
"JSObject itself must not have any fields");
MOZ_STATIC_ASSERT(sizeof(JSObject) % sizeof(js::Value) == 0,
static_assert(sizeof(JSObject) % sizeof(js::Value) == 0,
"fixed slots after an object must be aligned");
}

View File

@ -38,7 +38,7 @@ template<typename ResultType>
inline ResultType
ToUintWidth(double d)
{
MOZ_STATIC_ASSERT(mozilla::IsUnsigned<ResultType>::value,
static_assert(mozilla::IsUnsigned<ResultType>::value,
"ResultType must be an unsigned type");
uint64_t bits = mozilla::BitwiseCast<uint64_t>(d);
@ -69,7 +69,7 @@ ToUintWidth(double d)
// 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),
static_assert(sizeof(ResultType) <= sizeof(uint64_t),
"Left-shifting below would lose upper bits");
ResultType result = (exponent > mozilla::DoubleExponentShift)
? ResultType(bits << (exponent - mozilla::DoubleExponentShift))
@ -113,7 +113,7 @@ template<typename ResultType>
inline ResultType
ToIntWidth(double d)
{
MOZ_STATIC_ASSERT(mozilla::IsSigned<ResultType>::value,
static_assert(mozilla::IsSigned<ResultType>::value,
"ResultType must be a signed type");
const ResultType MaxValue = (1ULL << (CHAR_BIT * sizeof(ResultType) - 1)) - 1;

View File

@ -457,7 +457,7 @@ class ElementsHeader
};
void staticAsserts() {
MOZ_STATIC_ASSERT(sizeof(ElementsHeader) == ValuesPerHeader * sizeof(Value),
static_assert(sizeof(ElementsHeader) == ValuesPerHeader * sizeof(Value),
"Elements size and values-per-Elements mismatch");
}
@ -638,7 +638,7 @@ struct uint8_clamped {
}
void staticAsserts() {
MOZ_STATIC_ASSERT(sizeof(uint8_clamped) == 1,
static_assert(sizeof(uint8_clamped) == 1,
"uint8_clamped must be layout-compatible with uint8_t");
}
};
@ -1072,7 +1072,7 @@ class ObjectElements
uint32_t length;
void staticAsserts() {
MOZ_STATIC_ASSERT(sizeof(ObjectElements) == VALUES_PER_HEADER * sizeof(Value),
static_assert(sizeof(ObjectElements) == VALUES_PER_HEADER * sizeof(Value),
"Elements size and values-per-Elements mismatch");
}
@ -1211,18 +1211,18 @@ class ObjectImpl : public gc::Cell
private:
static void staticAsserts() {
MOZ_STATIC_ASSERT(sizeof(ObjectImpl) == sizeof(shadow::Object),
static_assert(sizeof(ObjectImpl) == sizeof(shadow::Object),
"shadow interface must match actual implementation");
MOZ_STATIC_ASSERT(sizeof(ObjectImpl) % sizeof(Value) == 0,
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),
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),
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),
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),
static_assert(offsetof(ObjectImpl, elements) == offsetof(shadow::Object, _1),
"shadow placeholder must match actual elements");
}
@ -1623,7 +1623,7 @@ class ObjectImpl : public gc::Cell
}
inline HeapSlot *fixedElements() const {
MOZ_STATIC_ASSERT(2 * sizeof(Value) == sizeof(ObjectElements),
static_assert(2 * sizeof(Value) == sizeof(ObjectElements),
"when elements are stored inline, the first two "
"slots will hold the ObjectElements header");
return &fixedSlots()[2];

View File

@ -41,7 +41,7 @@ FramePropertyTable::Set(nsIFrame* aFrame, const FramePropertyDescriptor* aProper
// 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 *),
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);

View File

@ -519,9 +519,9 @@ FrameHasPositionedPlaceholderDescendants(nsIFrame* aFrame, uint32_t aPositionMas
static bool
NeedToReframeForAddingOrRemovingTransform(nsIFrame* aFrame)
{
MOZ_STATIC_ASSERT(0 <= NS_STYLE_POSITION_ABSOLUTE &&
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 &&
static_assert(0 <= NS_STYLE_POSITION_FIXED &&
NS_STYLE_POSITION_FIXED < 32, "Style constant out of range");
uint32_t positionMask;

View File

@ -4,7 +4,7 @@
* 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"

View File

@ -9031,7 +9031,7 @@ nsCSSFrameConstructor::ProcessChildren(nsFrameConstructorState& aState,
"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;

View File

@ -538,7 +538,7 @@ nsPresContext::GetFontPrefsForLang(nsIAtom *aLanguage) const
&prefs->mDefaultCursiveFont,
&prefs->mDefaultFantasyFont
};
MOZ_STATIC_ASSERT(NS_ARRAY_LENGTH(fontTypes) == eDefaultFont_COUNT,
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

View File

@ -396,7 +396,7 @@ Initialize()
return NS_ERROR_FAILURE;
}
MOZ_STATIC_ASSERT(sizeof(uintptr_t) == sizeof(void*),
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.");

View File

@ -885,7 +885,7 @@ nsImageFrame::Reflow(nsPresContext* aPresContext,
// 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);
}

View File

@ -44,7 +44,7 @@ nsLineBox::nsLineBox(nsIFrame* aFrame, int32_t aCount, bool aIsBlock)
}
#endif
MOZ_STATIC_ASSERT(NS_STYLE_CLEAR_LAST_VALUE <= 15,
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

View File

@ -24,7 +24,7 @@
#define NS_QUERYFRAME_ENTRY(class) \
case class::kFrameIID: { \
MOZ_STATIC_ASSERT((mozilla::IsSame<class, class::Has_NS_DECL_QUERYFRAME_TARGET>::value), \
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); \
}
@ -32,7 +32,7 @@
#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), \
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); \
} \
@ -81,7 +81,7 @@ public:
template<class Dest>
operator Dest*() {
MOZ_STATIC_ASSERT((mozilla::IsSame<Dest, typename Dest::Has_NS_DECL_QUERYFRAME_TARGET>::value),
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;

View File

@ -754,7 +754,7 @@ GetStatesForPseudoClass(const nsAString& aStatePseudo)
nsEventStates(),
nsEventStates()
};
MOZ_STATIC_ASSERT(NS_ARRAY_LENGTH(sPseudoClassStates) ==
static_assert(NS_ARRAY_LENGTH(sPseudoClassStates) ==
nsCSSPseudoClasses::ePseudoClass_NotPseudoClass + 1,
"Length of PseudoClassStates array is incorrect");

View File

@ -20,7 +20,7 @@ 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,
static_assert(eCSSProperty_COUNT_no_shorthands - 1 <= UINT16_MAX,
"CSS longhand property numbers no longer fit in a uint16_t");
Declaration::Declaration()
@ -481,7 +481,7 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue) const
MOZ_ASSERT(nsCSSProps::kKeywordTableTable[
eCSSProperty_background_clip] ==
nsCSSProps::kBackgroundOriginKTable);
MOZ_STATIC_ASSERT(NS_STYLE_BG_CLIP_BORDER ==
static_assert(NS_STYLE_BG_CLIP_BORDER ==
NS_STYLE_BG_ORIGIN_BORDER &&
NS_STYLE_BG_CLIP_PADDING ==
NS_STYLE_BG_ORIGIN_PADDING &&

View File

@ -302,7 +302,7 @@ nsCSSSelector::nsCSSSelector(void)
mPseudoType(nsCSSPseudoElements::ePseudo_NotPseudoElement)
{
MOZ_COUNT_CTOR(nsCSSSelector);
MOZ_STATIC_ASSERT(nsCSSPseudoElements::ePseudo_MAX < INT16_MAX,
static_assert(nsCSSPseudoElements::ePseudo_MAX < INT16_MAX,
"nsCSSPseudoElements::Type values overflow mPseudoType");
}

View File

@ -667,9 +667,9 @@ public:
static KeyTypePointer KeyToPointer(KeyType aKey) { return &aKey; }
static PLDHashNumber HashKey(KeyTypePointer aKey) {
MOZ_STATIC_ASSERT(sizeof(PLDHashNumber) == sizeof(uint32_t),
static_assert(sizeof(PLDHashNumber) == sizeof(uint32_t),
"this hash function assumes PLDHashNumber is uint32_t");
MOZ_STATIC_ASSERT(PLDHashNumber(-1) > PLDHashNumber(0),
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");

View File

@ -160,15 +160,15 @@ private:
// 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,
static_assert(sizeof(nsCSSCompressedDataBlock) == 8,
"nsCSSCompressedDataBlock's size has changed");
MOZ_STATIC_ASSERT(NS_ALIGNMENT_OF(nsCSSValue) == 4 || NS_ALIGNMENT_OF(nsCSSValue) == 8,
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,
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 <=
static_assert(eCSSProperty_COUNT_no_shorthands <=
nsCSSCompressedDataBlock::MaxCompressedCSSProperty,
"nsCSSProperty doesn't fit in StoredSizeOfCSSProperty");

View File

@ -6957,7 +6957,7 @@ CSSParserImpl::ParseBackgroundItem(CSSParserImpl::BackgroundParseState& aState)
MOZ_ASSERT(nsCSSProps::kKeywordTableTable[
eCSSProperty_background_clip] ==
nsCSSProps::kBackgroundOriginKTable);
MOZ_STATIC_ASSERT(NS_STYLE_BG_CLIP_BORDER ==
static_assert(NS_STYLE_BG_CLIP_BORDER ==
NS_STYLE_BG_ORIGIN_BORDER &&
NS_STYLE_BG_CLIP_PADDING ==
NS_STYLE_BG_ORIGIN_PADDING &&
@ -9531,7 +9531,7 @@ CSSParserImpl::ParseTextDecoration()
eDecorationBlink = NS_STYLE_TEXT_DECORATION_LINE_BLINK,
eDecorationPrefAnchors = NS_STYLE_TEXT_DECORATION_LINE_PREF_ANCHORS
};
MOZ_STATIC_ASSERT((eDecorationNone ^ eDecorationUnderline ^
static_assert((eDecorationNone ^ eDecorationUnderline ^
eDecorationOverline ^ eDecorationLineThrough ^
eDecorationBlink ^ eDecorationPrefAnchors) ==
(eDecorationNone | eDecorationUnderline |
@ -10774,7 +10774,7 @@ CSSParserImpl::ParseMarker()
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");
@ -10786,7 +10786,7 @@ CSSParserImpl::ParsePaintOrder()
eCSSKeyword_UNKNOWN,-1
};
MOZ_STATIC_ASSERT(NS_ARRAY_LENGTH(kPaintOrderKTable) ==
static_assert(NS_ARRAY_LENGTH(kPaintOrderKTable) ==
2 * (NS_STYLE_PAINT_ORDER_LAST_VALUE + 2),
"missing paint-order values in kPaintOrderKTable");
@ -10801,7 +10801,7 @@ CSSParserImpl::ParsePaintOrder()
// 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");
@ -10845,7 +10845,7 @@ CSSParserImpl::ParsePaintOrder()
}
}
MOZ_STATIC_ASSERT(NS_STYLE_PAINT_ORDER_NORMAL == 0,
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);
}

View File

@ -356,7 +356,7 @@ nsCSSProps::LookupProperty(const nsACString& 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,
static_assert(eCSSProperty_UNKNOWN < eCSSProperty_COUNT,
"assuming eCSSProperty_UNKNOWN doesn't hit this code");
if (IsEnabled(res) || aEnabled == eAny) {
res = gAliases[res - eCSSProperty_COUNT];
@ -383,7 +383,7 @@ nsCSSProps::LookupProperty(const nsAString& aProperty, EnabledState aEnabled)
// 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,
static_assert(eCSSProperty_UNKNOWN < eCSSProperty_COUNT,
"assuming eCSSProperty_UNKNOWN doesn't hit this code");
if (IsEnabled(res) || aEnabled == eAny) {
res = gAliases[res - eCSSProperty_COUNT];
@ -647,7 +647,7 @@ const int32_t nsCSSProps::kBackgroundInlinePolicyKTable[] = {
eCSSKeyword_UNKNOWN,-1
};
MOZ_STATIC_ASSERT(NS_STYLE_BG_CLIP_BORDER == NS_STYLE_BG_ORIGIN_BORDER &&
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");
@ -1954,7 +1954,7 @@ static const nsCSSProperty gBorderBottomSubpropTable[] = {
eCSSProperty_UNKNOWN
};
MOZ_STATIC_ASSERT(NS_SIDE_TOP == 0 && NS_SIDE_RIGHT == 1 &&
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[] = {

View File

@ -159,7 +159,7 @@
// 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 &
static_assert((CSS_PROPERTY_PARSE_PROPERTY_MASK &
CSS_PROPERTY_VALUE_PARSER_FUNCTION) == 0,
"didn't leave enough room for the parse property constants");

View File

@ -1619,7 +1619,7 @@ static const nsEventStates sPseudoClassStates[] = {
nsEventStates(),
nsEventStates()
};
MOZ_STATIC_ASSERT(NS_ARRAY_LENGTH(sPseudoClassStates) ==
static_assert(NS_ARRAY_LENGTH(sPseudoClassStates) ==
nsCSSPseudoClasses::ePseudoClass_NotPseudoClass + 1,
"ePseudoClass_NotPseudoClass is no longer at the end of"
"sPseudoClassStates");

View File

@ -76,7 +76,7 @@ static const uint8_t gLexTable[] = {
SUIJ, SUIJ, SUIJ, SU, SU, SU, SU, S,
};
MOZ_STATIC_ASSERT(MOZ_ARRAY_LENGTH(gLexTable) == 128,
static_assert(MOZ_ARRAY_LENGTH(gLexTable) == 128,
"gLexTable expected to cover all 128 ASCII characters");
#undef I

View File

@ -863,7 +863,7 @@ nsCSSValue::AppendToString(nsCSSProperty aProperty, nsAString& aResult) const
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()),
@ -1533,7 +1533,7 @@ nsCSSRect_heap::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
return n;
}
MOZ_STATIC_ASSERT(NS_SIDE_TOP == 0 && NS_SIDE_RIGHT == 1 &&
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");
@ -1933,7 +1933,7 @@ nsCSSCornerSizes::Reset()
}
}
MOZ_STATIC_ASSERT(NS_CORNER_TOP_LEFT == 0 && NS_CORNER_TOP_RIGHT == 1 &&
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");

View File

@ -2958,7 +2958,7 @@ nsComputedDOMStyle::DoGetDirection()
return val;
}
MOZ_STATIC_ASSERT(NS_STYLE_UNICODE_BIDI_NORMAL == 0,
static_assert(NS_STYLE_UNICODE_BIDI_NORMAL == 0,
"unicode-bidi style constants not as expected");
CSSValue*
@ -3734,7 +3734,7 @@ nsComputedDOMStyle::GetAbsoluteOffset(mozilla::css::Side aSide)
return val;
}
MOZ_STATIC_ASSERT(NS_SIDE_TOP == 0 && NS_SIDE_RIGHT == 1 &&
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)

View File

@ -14,11 +14,11 @@ 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),
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),
static_assert(uintptr_t(-1) > uintptr_t(0),
"expect uintptr_t to be unsigned");
MOZ_STATIC_ASSERT(size_t(-1) > size_t(0),
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)) /

View File

@ -3082,7 +3082,7 @@ nsRuleNode::SetFont(nsPresContext* aPresContext, nsStyleContext* aContext,
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 &&
@ -5549,7 +5549,7 @@ struct BackgroundItemComputer<nsCSSValuePairList, nsStyleBackground::Size>
size.*(axis->type) = nsStyleBackground::Size::eAuto;
}
else if (eCSSUnit_Enumerated == specified.GetUnit()) {
MOZ_STATIC_ASSERT(nsStyleBackground::Size::eContain ==
static_assert(nsStyleBackground::Size::eContain ==
NS_STYLE_BG_SIZE_CONTAIN &&
nsStyleBackground::Size::eCover ==
NS_STYLE_BG_SIZE_COVER,
@ -7535,7 +7535,7 @@ nsRuleNode::ComputeSVGData(void* aStartStruct,
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());

View File

@ -2824,7 +2824,7 @@ nsStyleAnimation::ExtractComputedValue(nsCSSProperty aProperty,
case eCSSProperty_font_stretch: {
int16_t stretch =
static_cast<const nsStyleFont*>(styleStruct)->mFont.stretch;
MOZ_STATIC_ASSERT(NS_STYLE_FONT_STRETCH_ULTRA_CONDENSED == -4 &&
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 ||
@ -3049,7 +3049,7 @@ nsStyleAnimation::ExtractComputedValue(nsCSSProperty aProperty,
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 &&
@ -3065,7 +3065,7 @@ nsStyleAnimation::ExtractComputedValue(nsCSSProperty aProperty,
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 -

View File

@ -48,7 +48,7 @@ nsStyleContext::nsStyleContext(nsStyleContext* aParent,
{
// 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) >=
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);

View File

@ -248,7 +248,7 @@ void nsStyleCorners::Reset()
// 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, \
static_assert(NS_SIDE_IS_VERTICAL(side) == result, \
"NS_SIDE_IS_VERTICAL is wrong")
CASE(NS_SIDE_TOP, false);
CASE(NS_SIDE_RIGHT, true);
@ -257,7 +257,7 @@ CASE(NS_SIDE_LEFT, true);
#undef CASE
#define CASE(corner, result) \
MOZ_STATIC_ASSERT(NS_HALF_CORNER_IS_X(corner) == result, \
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);
@ -271,7 +271,7 @@ CASE(NS_CORNER_BOTTOM_LEFT_Y, false);
// Validation of NS_HALF_TO_FULL_CORNER.
#define CASE(corner, result) \
MOZ_STATIC_ASSERT(NS_HALF_TO_FULL_CORNER(corner) == result, \
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);
@ -285,7 +285,7 @@ CASE(NS_CORNER_BOTTOM_LEFT_Y, NS_CORNER_BOTTOM_LEFT);
// Validation of NS_FULL_TO_HALF_CORNER.
#define CASE(corner, vert, result) \
MOZ_STATIC_ASSERT(NS_FULL_TO_HALF_CORNER(corner, vert) == result, \
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);
@ -299,7 +299,7 @@ CASE(NS_CORNER_BOTTOM_LEFT, true, NS_CORNER_BOTTOM_LEFT_Y);
// Validation of NS_SIDE_TO_{FULL,HALF}_CORNER.
#define CASE(side, second, result) \
MOZ_STATIC_ASSERT(NS_SIDE_TO_FULL_CORNER(side, second) == result, \
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);
@ -315,7 +315,7 @@ 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, \
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);

View File

@ -29,7 +29,7 @@
#include "mozilla/Likely.h"
#include <algorithm>
MOZ_STATIC_ASSERT((((1 << nsStyleStructID_Length) - 1) &
static_assert((((1 << nsStyleStructID_Length) - 1) &
~(NS_STYLE_INHERIT_MASK)) == 0,
"Not enough bits in NS_STYLE_INHERIT_MASK");
@ -2101,7 +2101,7 @@ void nsTimingFunction::AssignFromKeyword(int32_t aTimingFunctionType)
break;
}
MOZ_STATIC_ASSERT(NS_STYLE_TRANSITION_TIMING_FUNCTION_EASE == 0 &&
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 &&

View File

@ -160,7 +160,7 @@ nsStyleUtil::AppendBitmaskCSSValue(nsCSSProperty aProperty,
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");
@ -170,7 +170,7 @@ nsStyleUtil::AppendPaintOrderValue(uint8_t aValue,
}
// Append the minimal value necessary for the given paint order.
MOZ_STATIC_ASSERT(NS_STYLE_PAINT_ORDER_LAST_VALUE == 3,
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

View File

@ -37,7 +37,7 @@ static nsCellMap::CellDataArray * sEmptyRow;
CellData::CellData(nsTableCellFrame* aOrigCell)
{
MOZ_COUNT_CTOR(CellData);
MOZ_STATIC_ASSERT(sizeof(mOrigCell) == sizeof(mBits),
static_assert(sizeof(mOrigCell) == sizeof(mBits),
"mOrigCell and mBits must be the same size");
mOrigCell = aOrigCell;
}

View File

@ -37,7 +37,7 @@ mozalloc_handle_oom(size_t size)
if (gAbortHandler)
gAbortHandler(size);
MOZ_STATIC_ASSERT(OOM_MSG_FIRST_DIGIT_OFFSET > 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

View File

@ -706,7 +706,7 @@ struct IntrinsicBase
typedef T ValueType;
typedef PrimitiveIntrinsics<sizeof(T)> Primitives;
typedef typename Primitives::Type PrimType;
MOZ_STATIC_ASSERT(sizeof(PrimType) == sizeof(T),
static_assert(sizeof(PrimType) == sizeof(T),
"Selection of PrimitiveIntrinsics was wrong");
typedef CastHelper<PrimType, T> Cast;
};
@ -898,10 +898,10 @@ 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),
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;

View File

@ -106,7 +106,7 @@ class BloomFilter
*/
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?

View File

@ -27,7 +27,7 @@ template<typename To, typename From>
inline To
BitwiseCast(const From from)
{
MOZ_STATIC_ASSERT(sizeof(From) == sizeof(To),
static_assert(sizeof(From) == sizeof(To),
"To and From must have the same size");
union {
From from;

View File

@ -50,8 +50,8 @@
*/
#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 */

View File

@ -18,7 +18,6 @@
# 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
@ -600,7 +599,7 @@ class CheckedInt
template<typename U>
CheckedInt(U value, bool isValid) : mValue(value), mIsValid(isValid)
{
MOZ_STATIC_ASSERT(detail::IsSupported<T>::value &&
static_assert(detail::IsSupported<T>::value &&
detail::IsSupported<U>::value,
"This type is not supported by CheckedInt");
}
@ -624,7 +623,7 @@ class CheckedInt
: mValue(T(value)),
mIsValid(detail::IsInRange<T>(value))
{
MOZ_STATIC_ASSERT(detail::IsSupported<T>::value &&
static_assert(detail::IsSupported<T>::value &&
detail::IsSupported<U>::value,
"This type is not supported by CheckedInt");
}
@ -643,7 +642,7 @@ class CheckedInt
/** Constructs a valid checked integer with initial value 0 */
CheckedInt() : mValue(0), mIsValid(true)
{
MOZ_STATIC_ASSERT(detail::IsSupported<T>::value,
static_assert(detail::IsSupported<T>::value,
"This type is not supported by CheckedInt");
}
@ -817,7 +816,7 @@ template<typename T, typename U>
inline typename detail::CastToCheckedIntImpl<T, U>::ReturnType
castToCheckedInt(U u)
{
MOZ_STATIC_ASSERT(detail::IsSupported<T>::value &&
static_assert(detail::IsSupported<T>::value &&
detail::IsSupported<U>::value,
"This type is not supported by CheckedInt");
return detail::CastToCheckedIntImpl<T, U>::run(u);

View File

@ -38,7 +38,7 @@ namespace mozilla {
* 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;
@ -47,14 +47,14 @@ const uint64_t DoubleSignBit = 0x8000000000000000ULL;
const uint64_t DoubleExponentBits = 0x7ff0000000000000ULL;
const uint64_t DoubleSignificandBits = 0x000fffffffffffffULL;
MOZ_STATIC_ASSERT((DoubleSignBit & DoubleExponentBits) == 0,
static_assert((DoubleSignBit & DoubleExponentBits) == 0,
"sign bit doesn't overlap exponent bits");
MOZ_STATIC_ASSERT((DoubleSignBit & DoubleSignificandBits) == 0,
static_assert((DoubleSignBit & DoubleSignificandBits) == 0,
"sign bit doesn't overlap significand bits");
MOZ_STATIC_ASSERT((DoubleExponentBits & DoubleSignificandBits) == 0,
static_assert((DoubleExponentBits & DoubleSignificandBits) == 0,
"exponent bits don't overlap significand bits");
MOZ_STATIC_ASSERT((DoubleSignBit | DoubleExponentBits | DoubleSignificandBits) ==
static_assert((DoubleSignBit | DoubleExponentBits | DoubleSignificandBits) ==
~uint64_t(0),
"all bits accounted for");

View File

@ -175,7 +175,7 @@ AddToHash(uint32_t hash, A* a)
* catch data pointers and couldn't handle function pointers.
*/
MOZ_STATIC_ASSERT(sizeof(a) == sizeof(uintptr_t),
static_assert(sizeof(a) == sizeof(uintptr_t),
"Strange pointer!");
return detail::AddUintptrToHash<sizeof(uintptr_t)>(hash, uintptr_t(a));

View File

@ -142,8 +142,8 @@ GetDesiredRegionSize()
#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)

View File

@ -103,7 +103,7 @@ class RefCounted : public detail::RefCounted<T, detail::NonAtomicRefCount>
{
public:
~RefCounted() {
MOZ_STATIC_ASSERT((IsBaseOf<RefCounted, T>::value),
static_assert(IsBaseOf<RefCounted, T>::value,
"T must derive from RefCounted<T>");
}
};
@ -117,7 +117,7 @@ class AtomicRefCounted : public detail::RefCounted<T, detail::AtomicRefCount>
{
public:
~AtomicRefCounted() {
MOZ_STATIC_ASSERT((IsBaseOf<AtomicRefCounted, T>::value),
static_assert(IsBaseOf<AtomicRefCounted, T>::value,
"T must derive from AtomicRefCounted<T>");
}
};

View File

@ -100,7 +100,7 @@ template<typename T>
inline bool
ThreadLocal<T>::init()
{
MOZ_STATIC_ASSERT(sizeof(T) <= sizeof(void*),
static_assert(sizeof(T) <= sizeof(void*),
"mozilla::ThreadLocal can't be used for types larger than "
"a pointer");
MOZ_ASSERT(!initialized());

View File

@ -324,7 +324,7 @@ ArrayEnd(T (&arr)[N])
/*
* 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

View File

@ -1121,7 +1121,7 @@ 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,
static_assert(N == 0,
"still need to implement this for N != 0");
// This only works when inline storage is always empty.

View File

@ -108,7 +108,7 @@ class SupportsWeakPtrBase
protected:
~SupportsWeakPtrBase() {
MOZ_STATIC_ASSERT((IsBaseOf<SupportsWeakPtrBase<T, WeakReference>, T>::value),
static_assert(IsBaseOf<SupportsWeakPtrBase<T, WeakReference>, T>::value,
"T must derive from SupportsWeakPtrBase<T, WeakReference>");
if (weakRef)
weakRef->detach();

View File

@ -193,7 +193,7 @@ main()
{ 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),
static_assert(sizeof(expected) == sizeof(SHA1Sum::Hash),
"expected-data size should be the same as the actual hash "
"size");

View File

@ -14,53 +14,53 @@ 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,
static_assert(IsSigned<const volatile long double>::value,
"const volatile long double should be signed");
MOZ_STATIC_ASSERT(!IsUnsigned<const volatile long double>::value,
static_assert(!IsUnsigned<const volatile long double>::value,
"const volatile long double shouldn't be unsigned");
namespace CPlusPlus11IsBaseOf {
@ -153,55 +153,55 @@ TestIsConvertible()
// "C doesn't convert to A (private inheritance)");
}
MOZ_STATIC_ASSERT((IsSame<MakeSigned<const unsigned char>::Type, const signed char>::value),
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),
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),
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),
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),
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),
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),
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),
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),
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),
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),
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),
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),
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),
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),
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),
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),
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),
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),
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),
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),
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),
static_assert(IsSame<MakeUnsigned<const char>::Type, const unsigned char>::value,
"const char won't unsignify correctly");
int

View File

@ -52,7 +52,7 @@ struct SeekableZStreamHeader: public Zip::SignedEntity<SeekableZStreamHeader>
};
#pragma pack()
MOZ_STATIC_ASSERT(sizeof(SeekableZStreamHeader) == 5 * 4,
static_assert(sizeof(SeekableZStreamHeader) == 5 * 4,
"SeekableZStreamHeader should be 5 32-bits words");
/**

View File

@ -46,7 +46,7 @@ void
nsDomainEntry::FuncForStaticAsserts(void)
{
#define ETLD_ENTRY(name, ex, wild) \
MOZ_STATIC_ASSERT(ETLD_ENTRY_OFFSET(name) < (1 << ETLD_ENTRY_N_INDEX_BITS), \
static_assert(ETLD_ENTRY_OFFSET(name) < (1 << ETLD_ENTRY_N_INDEX_BITS), \
"invalid strtab index");
#include "etld_data.inc"
#undef ETLD_ENTRY

View File

@ -558,7 +558,7 @@ SpdySession3::EnsureBuffer(nsAutoArrayPtr<T> &buf,
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;

View File

@ -37,7 +37,7 @@ public:
template <size_t LEN>
nsresult Dispatch(const char (&taskThreadName)[LEN])
{
MOZ_STATIC_ASSERT(LEN <= 15,
static_assert(LEN <= 15,
"Thread name must be no more than 15 characters");
return Dispatch(nsDependentCString(taskThreadName));
}

View File

@ -92,7 +92,7 @@ FindAndLoadOneEntry(nsIZipReader * zip,
// 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));

View File

@ -1058,7 +1058,7 @@ nsNSSComponent::InitializeNSS(bool showWarningBox)
PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsNSSComponent::InitializeNSS\n"));
MOZ_STATIC_ASSERT(nsINSSErrorsService::NSS_SEC_ERROR_BASE == SEC_ERROR_BASE &&
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,

View File

@ -455,9 +455,9 @@ GenerateDSAKeyPair(PK11SlotInfo * slot,
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*/,

View File

@ -757,7 +757,7 @@ nsXULAppInfo::GetWidgetToolkit(nsACString& aResult)
// 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_assert(nsIXULRuntime::PROCESS_TYPE_ ## a == \
static_cast<int>(GeckoProcessType_ ## b), \
"GeckoProcessType in nsXULAppAPI.h not synchronized with nsIXULRuntime.idl");
@ -767,7 +767,7 @@ SYNC_ENUMS(CONTENT, Content)
SYNC_ENUMS(IPDLUNITTEST, IPDLUnitTest)
// .. and ensure that that is all of them:
MOZ_STATIC_ASSERT(GeckoProcessType_IPDLUnitTest + 1 == GeckoProcessType_End,
static_assert(GeckoProcessType_IPDLUnitTest + 1 == GeckoProcessType_End,
"Did not find the final GeckoProcessType");
NS_IMETHODIMP

View File

@ -217,9 +217,9 @@ utb__addEntry(/*MODIFIED*/UnwinderThreadBuffer* utb, ProfileEntry ent)
//////////////////////////////////////////////////////////
//// 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*),
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

View File

@ -401,16 +401,16 @@ private:
void
GeckoInputReaderPolicy::setDisplayInfo()
{
MOZ_STATIC_ASSERT(nsIScreen::ROTATION_0_DEG ==
static_assert(nsIScreen::ROTATION_0_DEG ==
DISPLAY_ORIENTATION_0,
"Orientation enums not matched!");
MOZ_STATIC_ASSERT(nsIScreen::ROTATION_90_DEG ==
static_assert(nsIScreen::ROTATION_90_DEG ==
DISPLAY_ORIENTATION_90,
"Orientation enums not matched!");
MOZ_STATIC_ASSERT(nsIScreen::ROTATION_180_DEG ==
static_assert(nsIScreen::ROTATION_180_DEG ==
DISPLAY_ORIENTATION_180,
"Orientation enums not matched!");
MOZ_STATIC_ASSERT(nsIScreen::ROTATION_270_DEG ==
static_assert(nsIScreen::ROTATION_270_DEG ==
DISPLAY_ORIENTATION_270,
"Orientation enums not matched!");

View File

@ -594,7 +594,7 @@ private:
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));
}

View File

@ -264,9 +264,9 @@ MapsReporter::ParseMapping(
{
// 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),
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),
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
@ -465,7 +465,7 @@ MapsReporter::ParseMapBody(
nsISupports *aClosure,
CategoriesSeen *aCategoriesSeen)
{
MOZ_STATIC_ASSERT(sizeof(long long) == sizeof(int64_t),
static_assert(sizeof(long long) == sizeof(int64_t),
"size of (long long) is expected to match (int64_t)");
const int argCount = 2;

View File

@ -674,7 +674,7 @@ private:
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"

View File

@ -4,7 +4,7 @@
// 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),
static_assert(((nsresult)0) < ((nsresult)-1),
"nsresult must be an unsigned type");
MOZ_STATIC_ASSERT(sizeof(nsresult) == sizeof(uint32_t),
static_assert(sizeof(nsresult) == sizeof(uint32_t),
"nsresult must be 32 bits");

Some files were not shown because too many files have changed in this diff Show More