Skip to content

Commit

Permalink
Bug 1277775 - Replace MOZ_CONSTEXPR{_VAR,_TMPL} with constexpr. r=fro…
Browse files Browse the repository at this point in the history
…ydnj
  • Loading branch information
cpeterso committed Jul 8, 2016
1 parent 5d3ead1 commit 43c2748
Show file tree
Hide file tree
Showing 125 changed files with 1,017 additions and 1,048 deletions.
2 changes: 1 addition & 1 deletion accessible/windows/msaa/IDSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace a11y {
class IDSet
{
public:
MOZ_CONSTEXPR IDSet() : mBitSet(), mIdx(0) {}
constexpr IDSet() : mBitSet(), mIdx(0) {}

/**
* Return a new unique id.
Expand Down
2 changes: 1 addition & 1 deletion devtools/shared/heapsnapshot/HeapSnapshot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1447,7 +1447,7 @@ HeapSnapshot::CreateUniqueCoreDumpFile(ErrorResult& rv,
class DeleteHeapSnapshotTempFileHelperChild
{
public:
MOZ_CONSTEXPR DeleteHeapSnapshotTempFileHelperChild() { }
constexpr DeleteHeapSnapshotTempFileHelperChild() { }

void operator()(PHeapSnapshotTempFileHelperChild* ptr) const {
NS_WARN_IF(!HeapSnapshotTempFileHelperChild::Send__delete__(ptr));
Expand Down
2 changes: 1 addition & 1 deletion dom/animation/AnimationPerformanceWarning.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ struct AnimationPerformanceWarning
// this variable, please include this header file directly.
// This value is the same as the limit of nsStringBundle::FormatString.
// See the implementation of nsStringBundle::FormatString.
static MOZ_CONSTEXPR_VAR uint8_t kMaxParamsForLocalization = 10;
static constexpr uint8_t kMaxParamsForLocalization = 10;

// Indicates why this property could not be animated on the compositor.
Type mType;
Expand Down
2 changes: 1 addition & 1 deletion dom/animation/KeyframeEffect.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ struct Keyframe
}

Maybe<double> mOffset;
static MOZ_CONSTEXPR_VAR double kComputedOffsetNotSet = -1.0;
static constexpr double kComputedOffsetNotSet = -1.0;
double mComputedOffset = kComputedOffsetNotSet;
Maybe<ComputedTimingFunction> mTimingFunction; // Nothing() here means
// "linear"
Expand Down
2 changes: 1 addition & 1 deletion dom/base/WindowNamedPropertiesHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace dom {
class WindowNamedPropertiesHandler : public BaseDOMProxyHandler
{
public:
MOZ_CONSTEXPR WindowNamedPropertiesHandler()
constexpr WindowNamedPropertiesHandler()
: BaseDOMProxyHandler(nullptr, /* hasPrototype = */ true)
{
}
Expand Down
4 changes: 2 additions & 2 deletions dom/base/nsGlobalWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(DialogValueHolder)
class nsOuterWindowProxy : public js::Wrapper
{
public:
MOZ_CONSTEXPR nsOuterWindowProxy() : js::Wrapper(0) { }
constexpr nsOuterWindowProxy() : js::Wrapper(0) { }

virtual bool finalizeInBackground(JS::Value priv) const override {
return false;
Expand Down Expand Up @@ -1139,7 +1139,7 @@ nsOuterWindowProxy::singleton;
class nsChromeOuterWindowProxy : public nsOuterWindowProxy
{
public:
MOZ_CONSTEXPR nsChromeOuterWindowProxy() : nsOuterWindowProxy() { }
constexpr nsChromeOuterWindowProxy() : nsOuterWindowProxy() { }

virtual const char *className(JSContext *cx, JS::Handle<JSObject*> wrapper) const override;

Expand Down
2 changes: 1 addition & 1 deletion dom/base/nsJSEnvironment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1291,7 +1291,7 @@ TimeUntilNow(TimeStamp start)

struct CycleCollectorStats
{
MOZ_CONSTEXPR CycleCollectorStats() :
constexpr CycleCollectorStats() :
mMaxGCDuration(0), mRanSyncForgetSkippable(false), mSuspected(0),
mMaxSkippableDuration(0), mMaxSliceTime(0), mMaxSliceTimeSinceClear(0),
mTotalSliceTime(0), mAnyLockedOut(false), mExtraForgetSkippableCalls(0) {}
Expand Down
12 changes: 6 additions & 6 deletions dom/bindings/BindingUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -2956,21 +2956,21 @@ class GetCCParticipant
{
// Helper for GetCCParticipant for classes that participate in CC.
template<class U>
static MOZ_CONSTEXPR nsCycleCollectionParticipant*
static constexpr nsCycleCollectionParticipant*
GetHelper(int, typename U::NS_CYCLE_COLLECTION_INNERCLASS* dummy=nullptr)
{
return T::NS_CYCLE_COLLECTION_INNERCLASS::GetParticipant();
}
// Helper for GetCCParticipant for classes that don't participate in CC.
template<class U>
static MOZ_CONSTEXPR nsCycleCollectionParticipant*
static constexpr nsCycleCollectionParticipant*
GetHelper(double)
{
return nullptr;
}

public:
static MOZ_CONSTEXPR nsCycleCollectionParticipant*
static constexpr nsCycleCollectionParticipant*
Get()
{
// Passing int() here will try to call the GetHelper that takes an int as
Expand All @@ -2985,7 +2985,7 @@ template<class T>
class GetCCParticipant<T, true>
{
public:
static MOZ_CONSTEXPR nsCycleCollectionParticipant*
static constexpr nsCycleCollectionParticipant*
Get()
{
return nullptr;
Expand Down Expand Up @@ -3022,7 +3022,7 @@ EnumerateGlobal(JSContext* aCx, JS::Handle<JSObject*> aObj);
template <class T>
struct CreateGlobalOptions
{
static MOZ_CONSTEXPR_VAR ProtoAndIfaceCache::Kind ProtoAndIfaceCacheKind =
static constexpr ProtoAndIfaceCache::Kind ProtoAndIfaceCacheKind =
ProtoAndIfaceCache::NonWindowLike;
static void TraceGlobal(JSTracer* aTrc, JSObject* aObj)
{
Expand All @@ -3039,7 +3039,7 @@ struct CreateGlobalOptions
template <>
struct CreateGlobalOptions<nsGlobalWindow>
{
static MOZ_CONSTEXPR_VAR ProtoAndIfaceCache::Kind ProtoAndIfaceCacheKind =
static constexpr ProtoAndIfaceCache::Kind ProtoAndIfaceCacheKind =
ProtoAndIfaceCache::WindowLike;
static void TraceGlobal(JSTracer* aTrc, JSObject* aObj);
static bool PostCreateGlobal(JSContext* aCx, JS::Handle<JSObject*> aGlobal);
Expand Down
2 changes: 1 addition & 1 deletion dom/bindings/Codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -10146,7 +10146,7 @@ def getDecorators(self, declaring):
if self.inline and declaring:
decorators.append('inline')
if self.constexpr and declaring:
decorators.append('MOZ_CONSTEXPR')
decorators.append('constexpr')
if decorators:
return ' '.join(decorators) + ' '
return ''
Expand Down
2 changes: 1 addition & 1 deletion dom/bindings/DOMJSClass.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ struct NativePropertiesN {

const int32_t iteratorAliasMethodIndex;

MOZ_CONSTEXPR const NativePropertiesN<7>* Upcast() const {
constexpr const NativePropertiesN<7>* Upcast() const {
return reinterpret_cast<const NativePropertiesN<7>*>(this);
}

Expand Down
4 changes: 2 additions & 2 deletions dom/bindings/DOMJSProxyHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ template<typename T> struct Prefable;
class BaseDOMProxyHandler : public js::BaseProxyHandler
{
public:
explicit MOZ_CONSTEXPR BaseDOMProxyHandler(const void* aProxyFamily, bool aHasPrototype = false)
explicit constexpr BaseDOMProxyHandler(const void* aProxyFamily, bool aHasPrototype = false)
: js::BaseProxyHandler(aProxyFamily, aHasPrototype)
{}

Expand Down Expand Up @@ -98,7 +98,7 @@ class BaseDOMProxyHandler : public js::BaseProxyHandler
class DOMProxyHandler : public BaseDOMProxyHandler
{
public:
MOZ_CONSTEXPR DOMProxyHandler()
constexpr DOMProxyHandler()
: BaseDOMProxyHandler(&family)
{}

Expand Down
2 changes: 1 addition & 1 deletion dom/cache/DBSchema.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2463,7 +2463,7 @@ Validate(mozIStorageConnection* aConn)
typedef nsresult (*MigrationFunc)(mozIStorageConnection*, bool&);
struct Migration
{
MOZ_CONSTEXPR Migration(int32_t aFromVersion, MigrationFunc aFunc)
constexpr Migration(int32_t aFromVersion, MigrationFunc aFunc)
: mFromVersion(aFromVersion)
, mFunc(aFunc)
{ }
Expand Down
4 changes: 2 additions & 2 deletions dom/cellbroadcast/CellBroadcastMessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ struct StaticEnumConverter
typedef T WebidlEnumType;
typedef uint32_t XpidlEnumType;

static MOZ_CONSTEXPR WebidlEnumType
static constexpr WebidlEnumType
x2w(XpidlEnumType aXpidlEnum) { return static_cast<WebidlEnumType>(aXpidlEnum); }
};

template<class T>
MOZ_CONSTEXPR T
constexpr T
ToWebidlEnum(uint32_t aXpidlEnum) { return EnumConverter<T>::x2w(aXpidlEnum); }

// Declare converters here:
Expand Down
8 changes: 4 additions & 4 deletions dom/events/EventStates.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class EventStates
public:
typedef uint64_t InternalType;

MOZ_CONSTEXPR EventStates()
constexpr EventStates()
: mStates(0)
{
}
Expand All @@ -34,12 +34,12 @@ class EventStates
// In that case, we could be sure that only macros at the end were creating
// EventStates instances with mStates set to something else than 0.
// Unfortunately, this constructor is needed at at least two places now.
explicit MOZ_CONSTEXPR EventStates(InternalType aStates)
explicit constexpr EventStates(InternalType aStates)
: mStates(aStates)
{
}

EventStates MOZ_CONSTEXPR operator|(const EventStates& aEventStates) const
EventStates constexpr operator|(const EventStates& aEventStates) const
{
return EventStates(mStates | aEventStates.mStates);
}
Expand All @@ -53,7 +53,7 @@ class EventStates
// NOTE: calling if (eventStates1 & eventStates2) will not build.
// This might work correctly if operator bool() is defined
// but using HasState, HasAllStates or HasAtLeastOneOfStates is recommended.
EventStates MOZ_CONSTEXPR operator&(const EventStates& aEventStates) const
EventStates constexpr operator&(const EventStates& aEventStates) const
{
return EventStates(mStates & aEventStates.mStates);
}
Expand Down
4 changes: 2 additions & 2 deletions dom/html/HTMLTrackElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ namespace mozilla {
namespace dom {

// Map html attribute string values to TextTrackKind enums.
static MOZ_CONSTEXPR nsAttrValue::EnumTable kKindTable[] = {
static constexpr nsAttrValue::EnumTable kKindTable[] = {
{ "subtitles", static_cast<int16_t>(TextTrackKind::Subtitles) },
{ "captions", static_cast<int16_t>(TextTrackKind::Captions) },
{ "descriptions", static_cast<int16_t>(TextTrackKind::Descriptions) },
Expand All @@ -71,7 +71,7 @@ static MOZ_CONSTEXPR nsAttrValue::EnumTable kKindTable[] = {

// Invalid values are treated as "metadata" in ParseAttribute, but if no value
// at all is specified, it's treated as "subtitles" in GetKind
static MOZ_CONSTEXPR const nsAttrValue::EnumTable* kKindTableInvalidValueDefault = &kKindTable[4];
static constexpr const nsAttrValue::EnumTable* kKindTableInvalidValueDefault = &kKindTable[4];

/** HTMLTrackElement */
HTMLTrackElement::HTMLTrackElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
Expand Down
12 changes: 6 additions & 6 deletions dom/indexedDB/ActorsParent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ const uint32_t kDEBUGTransactionThreadSleepMS = 0;
#endif

template <size_t N>
MOZ_CONSTEXPR size_t
constexpr size_t
LiteralStringLength(const char (&aArr)[N])
{
static_assert(N, "Zero-length string literal?!");
Expand Down Expand Up @@ -2888,11 +2888,11 @@ UpgradeKeyFunction::CopyAndUpgradeKeyBufferInternal(const uint8_t*& aSource,
MOZ_ASSERT(aDestination);
MOZ_ASSERT(aTagOffset <= Key::kMaxArrayCollapse);

static MOZ_CONSTEXPR_VAR uint8_t kOldNumberTag = 0x1;
static MOZ_CONSTEXPR_VAR uint8_t kOldDateTag = 0x2;
static MOZ_CONSTEXPR_VAR uint8_t kOldStringTag = 0x3;
static MOZ_CONSTEXPR_VAR uint8_t kOldArrayTag = 0x4;
static MOZ_CONSTEXPR_VAR uint8_t kOldMaxType = kOldArrayTag;
static constexpr uint8_t kOldNumberTag = 0x1;
static constexpr uint8_t kOldDateTag = 0x2;
static constexpr uint8_t kOldStringTag = 0x3;
static constexpr uint8_t kOldArrayTag = 0x4;
static constexpr uint8_t kOldMaxType = kOldArrayTag;

if (NS_WARN_IF(aRecursionDepth > Key::kMaxRecursionDepth)) {
IDB_REPORT_INTERNAL_ERR();
Expand Down
2 changes: 1 addition & 1 deletion dom/ipc/Blob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ CreateBlobImpl(const nsTArray<uint8_t>& aMemoryData,
RefPtr<BlobImpl> blobImpl;

if (auto length = static_cast<size_t>(aMemoryData.Length())) {
static MOZ_CONSTEXPR_VAR size_t elementSizeMultiplier =
static constexpr size_t elementSizeMultiplier =
sizeof(aMemoryData[0]) / sizeof(char);

if (!aMetadata.mHasRecursed &&
Expand Down
2 changes: 1 addition & 1 deletion dom/smil/SMILBoolType.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class SMILBoolType : public nsISMILType

private:
// Private constructor: prevent instances beyond my singleton.
MOZ_CONSTEXPR SMILBoolType() {}
constexpr SMILBoolType() {}
};

} // namespace mozilla
Expand Down
2 changes: 1 addition & 1 deletion dom/smil/SMILEnumType.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class SMILEnumType : public nsISMILType

private:
// Private constructor: prevent instances beyond my singleton.
MOZ_CONSTEXPR SMILEnumType() {}
constexpr SMILEnumType() {}
};

} // namespace mozilla
Expand Down
2 changes: 1 addition & 1 deletion dom/smil/SMILIntegerType.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class SMILIntegerType : public nsISMILType
}

private:
MOZ_CONSTEXPR SMILIntegerType() {}
constexpr SMILIntegerType() {}
};

} // namespace mozilla
Expand Down
2 changes: 1 addition & 1 deletion dom/smil/SMILStringType.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class SMILStringType : public nsISMILType

private:
// Private constructor: prevent instances beyond my singleton.
MOZ_CONSTEXPR SMILStringType() {}
constexpr SMILStringType() {}
};

} // namespace mozilla
Expand Down
2 changes: 1 addition & 1 deletion dom/smil/nsSMILCSSValueType.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class nsSMILCSSValueType : public nsISMILType

private:
// Private constructor: prevent instances beyond my singleton.
MOZ_CONSTEXPR nsSMILCSSValueType() {}
constexpr nsSMILCSSValueType() {}
};

#endif // NS_SMILCSSVALUETYPE_H_
2 changes: 1 addition & 1 deletion dom/smil/nsSMILFloatType.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class nsSMILFloatType : public nsISMILType

private:
// Private constructor: prevent instances beyond my singleton.
MOZ_CONSTEXPR nsSMILFloatType() {}
constexpr nsSMILFloatType() {}
};

#endif // NS_SMILFLOATTYPE_H_
2 changes: 1 addition & 1 deletion dom/smil/nsSMILNullType.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class nsSMILNullType : public nsISMILType

private:
// Private constructor: prevent instances beyond my singleton.
MOZ_CONSTEXPR nsSMILNullType() {}
constexpr nsSMILNullType() {}
};

#endif // NS_SMILNULLTYPE_H_
2 changes: 1 addition & 1 deletion dom/svg/SVGIntegerPairSMILType.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class SVGIntegerPairSMILType : public nsISMILType

private:
// Private constructor: prevent instances beyond my singleton.
MOZ_CONSTEXPR SVGIntegerPairSMILType() {}
constexpr SVGIntegerPairSMILType() {}
};

} // namespace mozilla
Expand Down
2 changes: 1 addition & 1 deletion dom/svg/SVGLengthListSMILType.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class SVGLengthListSMILType : public nsISMILType

private:
// Private constructor: prevent instances beyond my singleton.
MOZ_CONSTEXPR SVGLengthListSMILType() {}
constexpr SVGLengthListSMILType() {}
};

} // namespace mozilla
Expand Down
2 changes: 1 addition & 1 deletion dom/svg/SVGMotionSMILType.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class SVGMotionSMILType : public nsISMILType

private:
// Private constructor: prevent instances beyond my singleton.
MOZ_CONSTEXPR SVGMotionSMILType() {}
constexpr SVGMotionSMILType() {}
};

} // namespace mozilla
Expand Down
2 changes: 1 addition & 1 deletion dom/svg/SVGNumberListSMILType.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class SVGNumberListSMILType : public nsISMILType

private:
// Private constructor: prevent instances beyond my singleton.
MOZ_CONSTEXPR SVGNumberListSMILType() {}
constexpr SVGNumberListSMILType() {}
};

} // namespace mozilla
Expand Down
2 changes: 1 addition & 1 deletion dom/svg/SVGNumberPairSMILType.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class SVGNumberPairSMILType : public nsISMILType

private:
// Private constructor: prevent instances beyond my singleton.
MOZ_CONSTEXPR SVGNumberPairSMILType() {}
constexpr SVGNumberPairSMILType() {}
};

} // namespace mozilla
Expand Down
2 changes: 1 addition & 1 deletion dom/svg/SVGOrientSMILType.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class SVGOrientSMILType : public nsISMILType

private:
// Private constructor: prevent instances beyond my singleton.
MOZ_CONSTEXPR SVGOrientSMILType() {}
constexpr SVGOrientSMILType() {}
};

} // namespace mozilla
Expand Down
2 changes: 1 addition & 1 deletion dom/svg/SVGPathSegListSMILType.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class SVGPathSegListSMILType : public nsISMILType

private:
// Private constructor: prevent instances beyond my singleton.
MOZ_CONSTEXPR SVGPathSegListSMILType() {}
constexpr SVGPathSegListSMILType() {}
};

} // namespace mozilla
Expand Down
Loading

0 comments on commit 43c2748

Please sign in to comment.