Remove constant expressions from /dom.

master
Fedor 2020-10-02 10:34:35 +03:00
parent 3da4381dae
commit f4231994a9
32 changed files with 53 additions and 54 deletions

View File

@ -38,8 +38,6 @@ struct AnimationPerformanceWarning
std::initializer_list<int32_t> aParams)
: mType(aType)
{
// FIXME: Once std::initializer_list::size() become a constexpr function,
// we should use static_assert here.
MOZ_ASSERT(aParams.size() <= kMaxParamsForLocalization,
"The length of parameters should be less than "
"kMaxParamsForLocalization");
@ -49,11 +47,11 @@ struct AnimationPerformanceWarning
// Maximum number of parameters passed to
// nsContentUtils::FormatLocalizedString to localize warning messages.
//
// NOTE: This constexpr can't be forward declared, so if you want to use
// NOTE: This can't be forward declared, so if you want to use
// 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 constexpr uint8_t kMaxParamsForLocalization = 10;
static const uint8_t kMaxParamsForLocalization = 10;
// Indicates why this property could not be animated on the compositor.
Type mType;

View File

@ -15,7 +15,7 @@ namespace dom {
class WindowNamedPropertiesHandler : public BaseDOMProxyHandler
{
public:
constexpr WindowNamedPropertiesHandler()
WindowNamedPropertiesHandler()
: BaseDOMProxyHandler(nullptr, /* hasPrototype = */ true)
{
}

View File

@ -268,7 +268,7 @@ public:
// EnumTable can be initialized either with an int16_t value
// or a value of an enumeration type that can fit within an int16_t.
constexpr EnumTable(const char* aTag, int16_t aValue)
EnumTable(const char* aTag, int16_t aValue)
: tag(aTag)
, value(aValue)
{
@ -276,7 +276,7 @@ public:
template<typename T,
typename = typename std::enable_if<std::is_enum<T>::value>::type>
constexpr EnumTable(const char* aTag, T aValue)
EnumTable(const char* aTag, T aValue)
: tag(aTag)
, value(static_cast<int16_t>(aValue))
{

View File

@ -956,7 +956,7 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(DialogValueHolder)
class nsOuterWindowProxy : public js::Wrapper
{
public:
constexpr nsOuterWindowProxy() : js::Wrapper(0) { }
nsOuterWindowProxy() : js::Wrapper(0) { }
virtual bool finalizeInBackground(const JS::Value& priv) const override {
return false;
@ -1407,7 +1407,7 @@ nsOuterWindowProxy::singleton;
class nsChromeOuterWindowProxy : public nsOuterWindowProxy
{
public:
constexpr nsChromeOuterWindowProxy() : nsOuterWindowProxy() { }
nsChromeOuterWindowProxy() : nsOuterWindowProxy() { }
virtual const char *className(JSContext *cx, JS::Handle<JSObject*> wrapper) const override;

View File

@ -1161,7 +1161,7 @@ TimeUntilNow(TimeStamp start)
struct CycleCollectorStats
{
constexpr CycleCollectorStats() :
CycleCollectorStats() :
mMaxGCDuration(0), mRanSyncForgetSkippable(false), mSuspected(0),
mMaxSkippableDuration(0), mMaxSliceTime(0), mMaxSliceTimeSinceClear(0),
mTotalSliceTime(0), mAnyLockedOut(false), mExtraForgetSkippableCalls(0),

View File

@ -3073,21 +3073,21 @@ class GetCCParticipant
{
// Helper for GetCCParticipant for classes that participate in CC.
template<class U>
static constexpr nsCycleCollectionParticipant*
static 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 constexpr nsCycleCollectionParticipant*
static nsCycleCollectionParticipant*
GetHelper(double)
{
return nullptr;
}
public:
static constexpr nsCycleCollectionParticipant*
static nsCycleCollectionParticipant*
Get()
{
// Passing int() here will try to call the GetHelper that takes an int as
@ -3102,7 +3102,7 @@ template<class T>
class GetCCParticipant<T, true>
{
public:
static constexpr nsCycleCollectionParticipant*
static nsCycleCollectionParticipant*
Get()
{
return nullptr;
@ -3125,7 +3125,7 @@ EnumerateGlobal(JSContext* aCx, JS::Handle<JSObject*> aObj);
template <class T>
struct CreateGlobalOptions
{
static constexpr ProtoAndIfaceCache::Kind ProtoAndIfaceCacheKind =
static const ProtoAndIfaceCache::Kind ProtoAndIfaceCacheKind =
ProtoAndIfaceCache::NonWindowLike;
static void TraceGlobal(JSTracer* aTrc, JSObject* aObj)
{
@ -3142,7 +3142,7 @@ struct CreateGlobalOptions
template <>
struct CreateGlobalOptions<nsGlobalWindow>
{
static constexpr ProtoAndIfaceCache::Kind ProtoAndIfaceCacheKind =
static const ProtoAndIfaceCache::Kind ProtoAndIfaceCacheKind =
ProtoAndIfaceCache::WindowLike;
static void TraceGlobal(JSTracer* aTrc, JSObject* aObj);
static bool PostCreateGlobal(JSContext* aCx, JS::Handle<JSObject*> aGlobal);

View File

@ -210,7 +210,7 @@ struct NativePropertiesN {
const int32_t iteratorAliasMethodIndex;
constexpr const NativePropertiesN<7>* Upcast() const {
const NativePropertiesN<7>* Upcast() const {
return reinterpret_cast<const NativePropertiesN<7>*>(this);
}

View File

@ -2460,7 +2460,7 @@ Validate(mozIStorageConnection* aConn)
typedef nsresult (*MigrationFunc)(mozIStorageConnection*, bool&);
struct Migration
{
constexpr Migration(int32_t aFromVersion, MigrationFunc aFunc)
Migration(int32_t aFromVersion, MigrationFunc aFunc)
: mFromVersion(aFromVersion)
, mFunc(aFunc)
{ }

View File

@ -27,7 +27,7 @@ public:
typedef uint64_t InternalType;
typedef uint8_t ServoType;
constexpr EventStates()
EventStates()
: mStates(0)
{
}
@ -37,12 +37,12 @@ public:
// 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 constexpr EventStates(InternalType aStates)
explicit EventStates(InternalType aStates)
: mStates(aStates)
{
}
EventStates constexpr operator|(const EventStates& aEventStates) const
EventStates operator|(const EventStates& aEventStates) const
{
return EventStates(mStates | aEventStates.mStates);
}
@ -56,7 +56,7 @@ public:
// 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 constexpr operator&(const EventStates& aEventStates) const
EventStates operator&(const EventStates& aEventStates) const
{
return EventStates(mStates & aEventStates.mStates);
}

View File

@ -1455,7 +1455,7 @@ HeapSnapshot::CreateUniqueCoreDumpFile(ErrorResult& rv,
class DeleteHeapSnapshotTempFileHelperChild
{
public:
constexpr DeleteHeapSnapshotTempFileHelperChild() { }
DeleteHeapSnapshotTempFileHelperChild() { }
void operator()(PHeapSnapshotTempFileHelperChild* ptr) const {
Unused << NS_WARN_IF(!HeapSnapshotTempFileHelperChild::Send__delete__(ptr));

View File

@ -57,7 +57,7 @@ namespace mozilla {
namespace dom {
// Map html attribute string values to TextTrackKind enums.
static constexpr nsAttrValue::EnumTable kKindTable[] = {
static nsAttrValue::EnumTable kKindTable[] = {
{ "subtitles", static_cast<int16_t>(TextTrackKind::Subtitles) },
{ "captions", static_cast<int16_t>(TextTrackKind::Captions) },
{ "descriptions", static_cast<int16_t>(TextTrackKind::Descriptions) },
@ -68,7 +68,7 @@ static 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 constexpr const nsAttrValue::EnumTable* kKindTableInvalidValueDefault = &kKindTable[4];
static const nsAttrValue::EnumTable* kKindTableInvalidValueDefault = &kKindTable[4];
class WindowDestroyObserver final : public nsIObserver
{

View File

@ -270,7 +270,7 @@ const uint32_t kDEBUGTransactionThreadSleepMS = 0;
#endif
template <size_t N>
constexpr size_t
size_t
LiteralStringLength(const char (&aArr)[N])
{
static_assert(N, "Zero-length string literal?!");
@ -2905,11 +2905,11 @@ UpgradeKeyFunction::CopyAndUpgradeKeyBufferInternal(const uint8_t*& aSource,
MOZ_ASSERT(aDestination);
MOZ_ASSERT(aTagOffset <= Key::kMaxArrayCollapse);
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;
static uint8_t kOldNumberTag = 0x1;
static uint8_t kOldDateTag = 0x2;
static uint8_t kOldStringTag = 0x3;
static uint8_t kOldArrayTag = 0x4;
static uint8_t kOldMaxType = kOldArrayTag;
if (NS_WARN_IF(aRecursionDepth > Key::kMaxRecursionDepth)) {
IDB_REPORT_INTERNAL_ERR();

View File

@ -277,7 +277,7 @@ protected:
};
struct BlockOwner {
constexpr BlockOwner() {}
BlockOwner() {}
// The stream that owns this block, or null if the block is free.
MediaCacheStream* mStream = nullptr;

View File

@ -49,10 +49,10 @@ public:
void SetCDMProxy(CDMProxy* aProxy);
#endif
static constexpr int kYUV400 = 0;
static constexpr int kYUV420 = 1;
static constexpr int kYUV422 = 2;
static constexpr int kYUV444 = 3;
static const int kYUV400 = 0;
static const int kYUV420 = 1;
static const int kYUV422 = 2;
static const int kYUV444 = 3;
private:
virtual ~PDMFactory();

View File

@ -42,7 +42,7 @@ protected:
private:
// Private constructor: prevent instances beyond my singleton.
constexpr SMILBoolType() {}
SMILBoolType() {}
};
} // namespace mozilla

View File

@ -43,7 +43,7 @@ protected:
private:
// Private constructor: prevent instances beyond my singleton.
constexpr SMILEnumType() {}
SMILEnumType() {}
};
} // namespace mozilla

View File

@ -38,7 +38,8 @@ public:
}
private:
constexpr SMILIntegerType() {}
// Private constructor: prevent instances beyond my singleton.
SMILIntegerType() {}
};
} // namespace mozilla

View File

@ -43,7 +43,7 @@ protected:
private:
// Private constructor: prevent instances beyond my singleton.
constexpr SMILStringType() {}
SMILStringType() {}
};
} // namespace mozilla

View File

@ -110,7 +110,7 @@ public:
private:
// Private constructor: prevent instances beyond my singleton.
constexpr nsSMILCSSValueType() {}
nsSMILCSSValueType() {}
};
#endif // NS_SMILCSSVALUETYPE_H_

View File

@ -41,7 +41,7 @@ protected:
private:
// Private constructor: prevent instances beyond my singleton.
constexpr nsSMILFloatType() {}
nsSMILFloatType() {}
};
#endif // NS_SMILFLOATTYPE_H_

View File

@ -44,7 +44,7 @@ protected:
private:
// Private constructor: prevent instances beyond my singleton.
constexpr nsSMILNullType() {}
nsSMILNullType() {}
};
#endif // NS_SMILNULLTYPE_H_

View File

@ -45,7 +45,7 @@ protected:
private:
// Private constructor: prevent instances beyond my singleton.
constexpr SVGIntegerPairSMILType() {}
SVGIntegerPairSMILType() {}
};
} // namespace mozilla

View File

@ -93,7 +93,7 @@ protected:
private:
// Private constructor: prevent instances beyond my singleton.
constexpr SVGLengthListSMILType() {}
SVGLengthListSMILType() {}
};
} // namespace mozilla

View File

@ -78,7 +78,7 @@ public:
private:
// Private constructor: prevent instances beyond my singleton.
constexpr SVGMotionSMILType() {}
SVGMotionSMILType() {}
};
} // namespace mozilla

View File

@ -47,7 +47,7 @@ protected:
private:
// Private constructor: prevent instances beyond my singleton.
constexpr SVGNumberListSMILType() {}
SVGNumberListSMILType() {}
};
} // namespace mozilla

View File

@ -40,7 +40,7 @@ protected:
private:
// Private constructor: prevent instances beyond my singleton.
constexpr SVGNumberPairSMILType() {}
SVGNumberPairSMILType() {}
};
} // namespace mozilla

View File

@ -60,7 +60,7 @@ protected:
private:
// Private constructor: prevent instances beyond my singleton.
constexpr SVGOrientSMILType() {}
SVGOrientSMILType() {}
};
} // namespace mozilla

View File

@ -51,7 +51,7 @@ protected:
private:
// Private constructor: prevent instances beyond my singleton.
constexpr SVGPathSegListSMILType() {}
SVGPathSegListSMILType() {}
};
} // namespace mozilla

View File

@ -47,7 +47,7 @@ protected:
private:
// Private constructor: prevent instances beyond my singleton.
constexpr SVGPointListSMILType() {}
SVGPointListSMILType() {}
};
} // namespace mozilla

View File

@ -123,7 +123,7 @@ public:
private:
// Private constructor: prevent instances beyond my singleton.
constexpr SVGTransformListSMILType() {}
SVGTransformListSMILType() {}
};
} // end namespace mozilla

View File

@ -40,7 +40,7 @@ protected:
private:
// Private constructor: prevent instances beyond my singleton.
constexpr SVGViewBoxSMILType() {}
SVGViewBoxSMILType() {}
};
} // namespace mozilla

View File

@ -124,7 +124,7 @@ struct BarrierMethods<nsXBLMaybeCompiled<UncompiledT>>
template <class T>
struct IsHeapConstructibleType<nsXBLMaybeCompiled<T>>
{ // Yes, this is the exception to the rule. Sorry.
static constexpr bool value = true;
static const bool value = true;
};
template <class UncompiledT>