diff --git a/layout/generic/nsQueryFrame.h b/layout/generic/nsQueryFrame.h index 5eb8e1186450..326b29266c96 100644 --- a/layout/generic/nsQueryFrame.h +++ b/layout/generic/nsQueryFrame.h @@ -25,23 +25,22 @@ #define NS_QUERYFRAME_HEAD(class) \ void* class ::QueryFrame(FrameIID id) const { \ switch (id) { -#define NS_QUERYFRAME_ENTRY(class) \ - case class ::kFrameIID: { \ - static_assert( \ - mozilla::IsSame::value, \ - #class " must declare itself as a queryframe target"); \ - return const_cast(static_cast(this)); \ +#define NS_QUERYFRAME_ENTRY(class) \ + case class ::kFrameIID: { \ + static_assert( \ + std::is_same_v, \ + #class " must declare itself as a queryframe target"); \ + return const_cast(static_cast(this)); \ } -#define NS_QUERYFRAME_ENTRY_CONDITIONAL(class, condition) \ - case class ::kFrameIID: \ - if (condition) { \ - static_assert( \ - mozilla::IsSame::value, \ - #class " must declare itself as a queryframe target"); \ - return const_cast(static_cast(this)); \ - } \ +#define NS_QUERYFRAME_ENTRY_CONDITIONAL(class, condition) \ + case class ::kFrameIID: \ + if (condition) { \ + static_assert( \ + std::is_same_v, \ + #class " must declare itself as a queryframe target"); \ + return const_cast(static_cast(this)); \ + } \ break; #define NS_QUERYFRAME_TAIL_INHERITING(class) \ @@ -99,10 +98,9 @@ class do_QueryFrameHelper { template operator Dest*() { - static_assert( - mozilla::IsSame, - typename Dest::Has_NS_DECL_QUERYFRAME_TARGET>::value, - "Dest must declare itself as a queryframe target"); + static_assert(std::is_same_v, + typename Dest::Has_NS_DECL_QUERYFRAME_TARGET>, + "Dest must declare itself as a queryframe target"); if (!mRawPtr) { return nullptr; } diff --git a/mfbt/TypeTraits.h b/mfbt/TypeTraits.h index 8bd5ad2b7d94..de4c93cba073 100644 --- a/mfbt/TypeTraits.h +++ b/mfbt/TypeTraits.h @@ -102,26 +102,6 @@ struct IsDestructibleImpl : public DoIsDestructibleImpl { template struct IsDestructible : public detail::IsDestructibleImpl::Type {}; -/* 20.9.5 Type property queries [meta.unary.prop.query] */ - -/* 20.9.6 Relationships between types [meta.rel] */ - -/** - * IsSame tests whether two types are the same type. - * - * mozilla::IsSame::value is true; - * mozilla::IsSame::value is true; - * mozilla::IsSame::value is false; - * mozilla::IsSame::value is true; - * mozilla::IsSame::value is false; - * mozilla::IsSame::value is true. - */ -template -struct IsSame : std::false_type {}; - -template -struct IsSame : std::true_type {}; - } /* namespace mozilla */ #endif /* mozilla_TypeTraits_h */ diff --git a/mfbt/tests/TestTypeTraits.cpp b/mfbt/tests/TestTypeTraits.cpp index 9e811a6a05c5..4e945c7a8aed 100644 --- a/mfbt/tests/TestTypeTraits.cpp +++ b/mfbt/tests/TestTypeTraits.cpp @@ -4,11 +4,12 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include + #include "mozilla/Assertions.h" #include "mozilla/TypeTraits.h" using mozilla::IsDestructible; -using mozilla::IsSame; class PublicDestructible { public: @@ -35,9 +36,9 @@ static_assert(IsDestructible::value, * actual type sizes seen at compile time. */ #if defined(ANDROID) && !defined(__LP64__) -static_assert(mozilla::IsSame::value, +static_assert(std::is_same_v, "emulated PRI[di]PTR definitions will be wrong"); -static_assert(mozilla::IsSame::value, +static_assert(std::is_same_v, "emulated PRI[ouxX]PTR definitions will be wrong"); #endif diff --git a/mozglue/baseprofiler/core/ProfileBufferEntry.cpp b/mozglue/baseprofiler/core/ProfileBufferEntry.cpp index d7191bcf779f..abbb06cee189 100644 --- a/mozglue/baseprofiler/core/ProfileBufferEntry.cpp +++ b/mozglue/baseprofiler/core/ProfileBufferEntry.cpp @@ -19,6 +19,7 @@ # include "mozilla/StackWalk.h" # include +# include namespace mozilla { namespace baseprofiler { @@ -152,7 +153,7 @@ class MOZ_RAII AutoArraySchemaWriter { template void IntElement(uint32_t aIndex, T aValue) { - static_assert(!IsSame::value, + static_assert(!std::is_same_v, "Narrowing uint64 -> int64 conversion not allowed"); FillUpTo(aIndex); mJSONWriter.IntElement(static_cast(aValue)); diff --git a/tools/profiler/core/ProfileBufferEntry.cpp b/tools/profiler/core/ProfileBufferEntry.cpp index 2cb6b15cd14f..975152a7cc4b 100644 --- a/tools/profiler/core/ProfileBufferEntry.cpp +++ b/tools/profiler/core/ProfileBufferEntry.cpp @@ -20,6 +20,7 @@ #include "ProfilerCodeAddressService.h" #include +#include using namespace mozilla; @@ -161,7 +162,7 @@ class MOZ_RAII AutoArraySchemaWriter { template void IntElement(uint32_t aIndex, T aValue) { - static_assert(!IsSame::value, + static_assert(!std::is_same_v, "Narrowing uint64 -> int64 conversion not allowed"); FillUpTo(aIndex); mJSONWriter.IntElement(static_cast(aValue)); diff --git a/tools/profiler/core/platform.cpp b/tools/profiler/core/platform.cpp index e9421e648f84..630716a07e38 100644 --- a/tools/profiler/core/platform.cpp +++ b/tools/profiler/core/platform.cpp @@ -84,6 +84,7 @@ #include #include #include +#include #ifdef MOZ_TASK_TRACER # include "GeckoTaskTracer.h" @@ -2790,8 +2791,8 @@ class SamplerThread { // It may be tempting for a future maintainer to change aCallbacks into an // rvalue reference; this will remind them not to do that! static_assert( - IsSame>::value, + std::is_same_v>, "We need to capture the list by-value, to implicitly destroy it"); }