Bug 1519636 - Initial reformat of C/C++ code with clang-format version 12.0.0. r=sylvestre

clang-format version 12.0.0 (taskcluster-KEgO7qdgQ8uaewA6NkRnRA)

Differential Revision: https://phabricator.services.mozilla.com/D114211
This commit is contained in:
Andi-Bogdan Postelnicu
2021-05-10 07:15:07 +00:00
parent fc12bef7c8
commit f4dd222589
37 changed files with 229 additions and 189 deletions

View File

@@ -250,8 +250,8 @@ Maybe<int> LauncherMain(int& argc, wchar_t* argv[],
// Make sure that the launcher process itself has image load policies set // Make sure that the launcher process itself has image load policies set
if (IsWin10AnniversaryUpdateOrLater()) { if (IsWin10AnniversaryUpdateOrLater()) {
static const StaticDynamicallyLinkedFunctionPtr<decltype( static const StaticDynamicallyLinkedFunctionPtr<
&SetProcessMitigationPolicy)> decltype(&SetProcessMitigationPolicy)>
pSetProcessMitigationPolicy(L"kernel32.dll", pSetProcessMitigationPolicy(L"kernel32.dll",
"SetProcessMitigationPolicy"); "SetProcessMitigationPolicy");
if (pSetProcessMitigationPolicy) { if (pSetProcessMitigationPolicy) {

View File

@@ -450,15 +450,16 @@ struct FullObjectStoreMetadata {
typedef nsTHashMap<nsUint64HashKey, SafeRefPtr<FullObjectStoreMetadata>> typedef nsTHashMap<nsUint64HashKey, SafeRefPtr<FullObjectStoreMetadata>>
ObjectStoreTable; ObjectStoreTable;
static_assert(
std::is_same_v<IndexOrObjectStoreId,
std::remove_cv_t<std::remove_reference_t<
decltype(std::declval<const ObjectStoreGetParams&>()
.objectStoreId())>>>);
static_assert( static_assert(
std::is_same_v< std::is_same_v<
IndexOrObjectStoreId, IndexOrObjectStoreId,
std::remove_cv_t<std::remove_reference_t<decltype( std::remove_cv_t<std::remove_reference_t<
std::declval<const ObjectStoreGetParams&>().objectStoreId())>>>); decltype(std::declval<const IndexGetParams&>().objectStoreId())>>>);
static_assert(std::is_same_v<
IndexOrObjectStoreId,
std::remove_cv_t<std::remove_reference_t<decltype(
std::declval<const IndexGetParams&>().objectStoreId())>>>);
struct FullDatabaseMetadata final : AtomicSafeRefCounted<FullDatabaseMetadata> { struct FullDatabaseMetadata final : AtomicSafeRefCounted<FullDatabaseMetadata> {
DatabaseMetadata mCommonMetadata; DatabaseMetadata mCommonMetadata;
@@ -20691,8 +20692,8 @@ CursorOpBaseHelperBase<CursorType>::PopulateResponseFromStatement(
// inconsistent state. // inconsistent state.
if (aInitializeResponse) { if (aInitializeResponse) {
mOp.mResponse = std::remove_reference_t<decltype( mOp.mResponse = std::remove_reference_t<
populateResponseHelper.GetTypedResponse(&mOp.mResponse))>(); decltype(populateResponseHelper.GetTypedResponse(&mOp.mResponse))>();
} }
auto& responses = populateResponseHelper.GetTypedResponse(&mOp.mResponse); auto& responses = populateResponseHelper.GetTypedResponse(&mOp.mResponse);

View File

@@ -37,10 +37,12 @@ class MediaBlockCacheBase {
public: public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaBlockCacheBase) NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaBlockCacheBase)
static_assert(MediaCacheStream::BLOCK_SIZE < static_assert(
static_cast<std::remove_const<decltype( MediaCacheStream::BLOCK_SIZE <
MediaCacheStream::BLOCK_SIZE)>::type>(INT32_MAX), static_cast<
"MediaCacheStream::BLOCK_SIZE should fit in 31 bits"); std::remove_const<decltype(MediaCacheStream::BLOCK_SIZE)>::type>(
INT32_MAX),
"MediaCacheStream::BLOCK_SIZE should fit in 31 bits");
static const int32_t BLOCK_SIZE = MediaCacheStream::BLOCK_SIZE; static const int32_t BLOCK_SIZE = MediaCacheStream::BLOCK_SIZE;
protected: protected:

View File

@@ -112,13 +112,13 @@ FFmpegLibWrapper::LinkResult FFmpegLibWrapper::Link() {
#func))) { \ #func))) { \
} \ } \
} else { \ } else { \
func = (decltype(func)) nullptr; \ func = (decltype(func))nullptr; \
} }
#define AV_FUNC_OPTION(func, ver) \ #define AV_FUNC_OPTION(func, ver) \
AV_FUNC_OPTION_SILENT(func, ver) \ AV_FUNC_OPTION_SILENT(func, ver) \
if ((ver)&version && (func) == (decltype(func)) nullptr) { \ if ((ver)&version && (func) == (decltype(func))nullptr) { \
FFMPEG_LOG("Couldn't load function " #func); \ FFMPEG_LOG("Couldn't load function " #func); \
} }
#define AV_FUNC(func, ver) \ #define AV_FUNC(func, ver) \
@@ -179,7 +179,7 @@ FFmpegLibWrapper::LinkResult FFmpegLibWrapper::Link() {
#ifdef MOZ_WAYLAND #ifdef MOZ_WAYLAND
# define VA_FUNC_OPTION_SILENT(func) \ # define VA_FUNC_OPTION_SILENT(func) \
if (!(func = (decltype(func))PR_FindSymbol(mVALib, #func))) { \ if (!(func = (decltype(func))PR_FindSymbol(mVALib, #func))) { \
func = (decltype(func)) nullptr; \ func = (decltype(func))nullptr; \
} }
// mVALib is optional and may not be present. // mVALib is optional and may not be present.

View File

@@ -85,10 +85,10 @@ template <typename T, CheckingSupport = T::SupportsChecking::value>
class CheckedUnsafePtrBase; class CheckedUnsafePtrBase;
template <typename T, typename U, typename S = std::nullptr_t> template <typename T, typename U, typename S = std::nullptr_t>
using EnableIfCompatible = using EnableIfCompatible = std::enable_if_t<
std::enable_if_t<std::is_base_of<T, std::remove_reference_t<decltype( std::is_base_of<
*std::declval<U>())>>::value, T, std::remove_reference_t<decltype(*std::declval<U>())>>::value,
S>; S>;
template <typename T> template <typename T>
class CheckedUnsafePtrBase<T, CheckingSupport::Enabled> class CheckedUnsafePtrBase<T, CheckingSupport::Enabled>

View File

@@ -24,19 +24,17 @@ static HMODULE gWinWebAuthnModule = 0;
static decltype(WebAuthNIsUserVerifyingPlatformAuthenticatorAvailable)* static decltype(WebAuthNIsUserVerifyingPlatformAuthenticatorAvailable)*
gWinWebauthnIsUVPAA = nullptr; gWinWebauthnIsUVPAA = nullptr;
static decltype( static decltype(WebAuthNAuthenticatorMakeCredential)*
WebAuthNAuthenticatorMakeCredential)* gWinWebauthnMakeCredential = nullptr; gWinWebauthnMakeCredential = nullptr;
static decltype( static decltype(WebAuthNFreeCredentialAttestation)*
WebAuthNFreeCredentialAttestation)* gWinWebauthnFreeCredentialAttestation = gWinWebauthnFreeCredentialAttestation = nullptr;
nullptr;
static decltype(WebAuthNAuthenticatorGetAssertion)* gWinWebauthnGetAssertion = static decltype(WebAuthNAuthenticatorGetAssertion)* gWinWebauthnGetAssertion =
nullptr; nullptr;
static decltype(WebAuthNFreeAssertion)* gWinWebauthnFreeAssertion = nullptr; static decltype(WebAuthNFreeAssertion)* gWinWebauthnFreeAssertion = nullptr;
static decltype(WebAuthNGetCancellationId)* gWinWebauthnGetCancellationId = static decltype(WebAuthNGetCancellationId)* gWinWebauthnGetCancellationId =
nullptr; nullptr;
static decltype( static decltype(WebAuthNCancelCurrentOperation)*
WebAuthNCancelCurrentOperation)* gWinWebauthnCancelCurrentOperation = gWinWebauthnCancelCurrentOperation = nullptr;
nullptr;
static decltype(WebAuthNGetErrorName)* gWinWebauthnGetErrorName = nullptr; static decltype(WebAuthNGetErrorName)* gWinWebauthnGetErrorName = nullptr;
static decltype(WebAuthNGetApiVersionNumber)* gWinWebauthnGetApiVersionNumber = static decltype(WebAuthNGetApiVersionNumber)* gWinWebauthnGetApiVersionNumber =
nullptr; nullptr;
@@ -57,8 +55,8 @@ WinWebAuthnManager::WinWebAuthnManager() {
gWinWebAuthnModule = LoadLibrarySystem32(L"webauthn.dll"); gWinWebAuthnModule = LoadLibrarySystem32(L"webauthn.dll");
if (gWinWebAuthnModule) { if (gWinWebAuthnModule) {
gWinWebauthnIsUVPAA = reinterpret_cast<decltype( gWinWebauthnIsUVPAA = reinterpret_cast<
WebAuthNIsUserVerifyingPlatformAuthenticatorAvailable)*>( decltype(WebAuthNIsUserVerifyingPlatformAuthenticatorAvailable)*>(
GetProcAddress( GetProcAddress(
gWinWebAuthnModule, gWinWebAuthnModule,
"WebAuthNIsUserVerifyingPlatformAuthenticatorAvailable")); "WebAuthNIsUserVerifyingPlatformAuthenticatorAvailable"));

View File

@@ -993,8 +993,9 @@ already_AddRefed<Promise> ServiceWorkerGlobalScope::SkipWaiting(
} }
if (ServiceWorkerParentInterceptEnabled()) { if (ServiceWorkerParentInterceptEnabled()) {
using MozPromiseType = decltype( using MozPromiseType =
mWorkerPrivate->SetServiceWorkerSkipWaitingFlag())::element_type; decltype(mWorkerPrivate
->SetServiceWorkerSkipWaitingFlag())::element_type;
auto holder = MakeRefPtr<DOMMozPromiseRequestHolder<MozPromiseType>>(this); auto holder = MakeRefPtr<DOMMozPromiseRequestHolder<MozPromiseType>>(this);
mWorkerPrivate->SetServiceWorkerSkipWaitingFlag() mWorkerPrivate->SetServiceWorkerSkipWaitingFlag()

View File

@@ -352,13 +352,15 @@ bool OSVRSession::InitState(mozilla::gfx::VRSystemState& aSystemState) {
state.eightCC = GFX_VR_EIGHTCC('O', 'S', 'V', 'R', ' ', ' ', ' ', ' '); state.eightCC = GFX_VR_EIGHTCC('O', 'S', 'V', 'R', ' ', ' ', ' ', ' ');
state.isConnected = true; state.isConnected = true;
state.isMounted = false; state.isMounted = false;
state.capabilityFlags = (VRDisplayCapabilityFlags)( state.capabilityFlags =
(int)VRDisplayCapabilityFlags::Cap_None | (VRDisplayCapabilityFlags)((int)VRDisplayCapabilityFlags::Cap_None |
(int)VRDisplayCapabilityFlags::Cap_Orientation | (int)
(int)VRDisplayCapabilityFlags::Cap_Position | VRDisplayCapabilityFlags::Cap_Orientation |
(int)VRDisplayCapabilityFlags::Cap_External | (int)VRDisplayCapabilityFlags::Cap_Position |
(int)VRDisplayCapabilityFlags::Cap_Present | (int)VRDisplayCapabilityFlags::Cap_External |
(int)VRDisplayCapabilityFlags::Cap_ImmersiveVR); (int)VRDisplayCapabilityFlags::Cap_Present |
(int)
VRDisplayCapabilityFlags::Cap_ImmersiveVR);
state.blendMode = VRDisplayBlendMode::Opaque; state.blendMode = VRDisplayBlendMode::Opaque;
state.reportsDroppedFrames = false; state.reportsDroppedFrames = false;
@@ -412,9 +414,10 @@ bool OSVRSession::InitState(mozilla::gfx::VRSystemState& aSystemState) {
// default to an identity quaternion // default to an identity quaternion
VRHMDSensorState& sensorState = aSystemState.sensorState; VRHMDSensorState& sensorState = aSystemState.sensorState;
sensorState.flags = (VRDisplayCapabilityFlags)( sensorState.flags =
(int)VRDisplayCapabilityFlags::Cap_Orientation | (VRDisplayCapabilityFlags)((int)
(int)VRDisplayCapabilityFlags::Cap_Position); VRDisplayCapabilityFlags::Cap_Orientation |
(int)VRDisplayCapabilityFlags::Cap_Position);
sensorState.pose.orientation[3] = 1.0f; // Default to an identity quaternion sensorState.pose.orientation[3] = 1.0f; // Default to an identity quaternion
return true; return true;

View File

@@ -1064,9 +1064,10 @@ bool OculusSession::InitState(VRSystemState& aSystemState) {
UpdateEyeParameters(aSystemState); UpdateEyeParameters(aSystemState);
VRHMDSensorState& sensorState = aSystemState.sensorState; VRHMDSensorState& sensorState = aSystemState.sensorState;
sensorState.flags = (VRDisplayCapabilityFlags)( sensorState.flags =
(int)VRDisplayCapabilityFlags::Cap_Orientation | (VRDisplayCapabilityFlags)((int)
(int)VRDisplayCapabilityFlags::Cap_Position); VRDisplayCapabilityFlags::Cap_Orientation |
(int)VRDisplayCapabilityFlags::Cap_Position);
sensorState.pose.orientation[3] = 1.0f; // Default to an identity quaternion sensorState.pose.orientation[3] = 1.0f; // Default to an identity quaternion
return true; return true;

View File

@@ -713,14 +713,17 @@ bool OpenVRSession::InitState(VRSystemState& aSystemState) {
state.isConnected = state.isConnected =
mVRSystem->IsTrackedDeviceConnected(::vr::k_unTrackedDeviceIndex_Hmd); mVRSystem->IsTrackedDeviceConnected(::vr::k_unTrackedDeviceIndex_Hmd);
state.isMounted = false; state.isMounted = false;
state.capabilityFlags = (VRDisplayCapabilityFlags)( state.capabilityFlags =
(int)VRDisplayCapabilityFlags::Cap_None | (VRDisplayCapabilityFlags)((int)VRDisplayCapabilityFlags::Cap_None |
(int)VRDisplayCapabilityFlags::Cap_Orientation | (int)
(int)VRDisplayCapabilityFlags::Cap_Position | VRDisplayCapabilityFlags::Cap_Orientation |
(int)VRDisplayCapabilityFlags::Cap_External | (int)VRDisplayCapabilityFlags::Cap_Position |
(int)VRDisplayCapabilityFlags::Cap_Present | (int)VRDisplayCapabilityFlags::Cap_External |
(int)VRDisplayCapabilityFlags::Cap_StageParameters | (int)VRDisplayCapabilityFlags::Cap_Present |
(int)VRDisplayCapabilityFlags::Cap_ImmersiveVR); (int)VRDisplayCapabilityFlags::
Cap_StageParameters |
(int)
VRDisplayCapabilityFlags::Cap_ImmersiveVR);
state.blendMode = VRDisplayBlendMode::Opaque; state.blendMode = VRDisplayBlendMode::Opaque;
state.reportsDroppedFrames = true; state.reportsDroppedFrames = true;
@@ -729,9 +732,10 @@ bool OpenVRSession::InitState(VRSystemState& aSystemState) {
::vr::k_unTrackedDeviceIndex_Hmd, ::vr::Prop_ContainsProximitySensor_Bool, ::vr::k_unTrackedDeviceIndex_Hmd, ::vr::Prop_ContainsProximitySensor_Bool,
&err); &err);
if (err == ::vr::TrackedProp_Success && bHasProximitySensor) { if (err == ::vr::TrackedProp_Success && bHasProximitySensor) {
state.capabilityFlags = (VRDisplayCapabilityFlags)( state.capabilityFlags =
(int)state.capabilityFlags | (VRDisplayCapabilityFlags)((int)state.capabilityFlags |
(int)VRDisplayCapabilityFlags::Cap_MountDetection); (int)VRDisplayCapabilityFlags::
Cap_MountDetection);
} }
uint32_t w, h; uint32_t w, h;
@@ -747,9 +751,10 @@ bool OpenVRSession::InitState(VRSystemState& aSystemState) {
UpdateEyeParameters(aSystemState); UpdateEyeParameters(aSystemState);
VRHMDSensorState& sensorState = aSystemState.sensorState; VRHMDSensorState& sensorState = aSystemState.sensorState;
sensorState.flags = (VRDisplayCapabilityFlags)( sensorState.flags =
(int)VRDisplayCapabilityFlags::Cap_Orientation | (VRDisplayCapabilityFlags)((int)
(int)VRDisplayCapabilityFlags::Cap_Position); VRDisplayCapabilityFlags::Cap_Orientation |
(int)VRDisplayCapabilityFlags::Cap_Position);
sensorState.pose.orientation[3] = 1.0f; // Default to an identity quaternion sensorState.pose.orientation[3] = 1.0f; // Default to an identity quaternion
return true; return true;
@@ -878,9 +883,10 @@ void OpenVRSession::UpdateHeadsetPose(VRSystemState& aState) {
gfx::Quaternion rot; gfx::Quaternion rot;
rot.SetFromRotationMatrix(m); rot.SetFromRotationMatrix(m);
aState.sensorState.flags = (VRDisplayCapabilityFlags)( aState.sensorState.flags =
(int)aState.sensorState.flags | (VRDisplayCapabilityFlags)((int)aState.sensorState.flags |
(int)VRDisplayCapabilityFlags::Cap_Orientation); (int)VRDisplayCapabilityFlags::
Cap_Orientation);
aState.sensorState.pose.orientation[0] = rot.x; aState.sensorState.pose.orientation[0] = rot.x;
aState.sensorState.pose.orientation[1] = rot.y; aState.sensorState.pose.orientation[1] = rot.y;
aState.sensorState.pose.orientation[2] = rot.z; aState.sensorState.pose.orientation[2] = rot.z;

View File

@@ -135,8 +135,8 @@ void AgileReference::AssignInternal(IUnknown* aObject) {
* If that API is not available, we fall back to using the Global Interface * If that API is not available, we fall back to using the Global Interface
* Table. * Table.
*/ */
static const StaticDynamicallyLinkedFunctionPtr<decltype( static const StaticDynamicallyLinkedFunctionPtr<
&::RoGetAgileReference)> decltype(&::RoGetAgileReference)>
pRoGetAgileReference(L"ole32.dll", "RoGetAgileReference"); pRoGetAgileReference(L"ole32.dll", "RoGetAgileReference");
MOZ_ASSERT(aObject); MOZ_ASSERT(aObject);

View File

@@ -33,8 +33,8 @@ struct InvokeMemberFunction {
mozilla::Tuple<std::decay_t<Args>...> args; mozilla::Tuple<std::decay_t<Args>...> args;
template <class This, size_t... Indices> template <class This, size_t... Indices>
auto matchInternal(This* obj, std::index_sequence<Indices...>) -> decltype( auto matchInternal(This* obj, std::index_sequence<Indices...>) -> decltype((
((*obj).*(MemberFunction<This>::get()))(mozilla::Get<Indices>(args)...)) { (*obj).*(MemberFunction<This>::get()))(mozilla::Get<Indices>(args)...)) {
return ((*obj).* return ((*obj).*
(MemberFunction<This>::get()))(mozilla::Get<Indices>(args)...); (MemberFunction<This>::get()))(mozilla::Get<Indices>(args)...);
} }

View File

@@ -323,8 +323,9 @@ static nscolor ExtractColor(const ComputedStyle& aStyle,
#define STYLE_FIELD(struct_, field_) aField == &struct_::field_ || #define STYLE_FIELD(struct_, field_) aField == &struct_::field_ ||
#define STYLE_STRUCT(name_, fields_) \ #define STYLE_STRUCT(name_, fields_) \
template <> \ template <> \
nscolor ComputedStyle::GetVisitedDependentColor(decltype( \ nscolor ComputedStyle::GetVisitedDependentColor( \
nsStyle##name_::MOZ_ARG_1 fields_) nsStyle##name_::*aField) const { \ decltype(nsStyle##name_::MOZ_ARG_1 fields_) nsStyle##name_::*aField) \
const { \
MOZ_ASSERT(MOZ_FOR_EACH(STYLE_FIELD, (nsStyle##name_, ), fields_) false, \ MOZ_ASSERT(MOZ_FOR_EACH(STYLE_FIELD, (nsStyle##name_, ), fields_) false, \
"Getting visited-dependent color for a field in nsStyle" #name_ \ "Getting visited-dependent color for a field in nsStyle" #name_ \
" which is not listed in nsCSSVisitedDependentPropList.h"); \ " which is not listed in nsCSSVisitedDependentPropList.h"); \

View File

@@ -717,7 +717,7 @@
# define MOZ_STATIC_CLASS __attribute__((annotate("moz_global_class"))) # define MOZ_STATIC_CLASS __attribute__((annotate("moz_global_class")))
# define MOZ_STATIC_LOCAL_CLASS \ # define MOZ_STATIC_LOCAL_CLASS \
__attribute__((annotate("moz_static_local_class"))) \ __attribute__((annotate("moz_static_local_class"))) \
__attribute__((annotate("moz_trivial_dtor"))) __attribute__((annotate("moz_trivial_dtor")))
# define MOZ_STACK_CLASS __attribute__((annotate("moz_stack_class"))) # define MOZ_STACK_CLASS __attribute__((annotate("moz_stack_class")))
# define MOZ_NONHEAP_CLASS __attribute__((annotate("moz_nonheap_class"))) # define MOZ_NONHEAP_CLASS __attribute__((annotate("moz_nonheap_class")))
# define MOZ_HEAP_CLASS __attribute__((annotate("moz_heap_class"))) # define MOZ_HEAP_CLASS __attribute__((annotate("moz_heap_class")))
@@ -757,8 +757,8 @@
# define MOZ_NO_DANGLING_ON_TEMPORARIES \ # define MOZ_NO_DANGLING_ON_TEMPORARIES \
__attribute__((annotate("moz_no_dangling_on_temporaries"))) __attribute__((annotate("moz_no_dangling_on_temporaries")))
# define MOZ_INHERIT_TYPE_ANNOTATIONS_FROM_TEMPLATE_ARGS \ # define MOZ_INHERIT_TYPE_ANNOTATIONS_FROM_TEMPLATE_ARGS \
__attribute__( \ __attribute__(( \
(annotate("moz_inherit_type_annotations_from_template_args"))) annotate("moz_inherit_type_annotations_from_template_args")))
# define MOZ_NON_AUTOABLE __attribute__((annotate("moz_non_autoable"))) # define MOZ_NON_AUTOABLE __attribute__((annotate("moz_non_autoable")))
# define MOZ_INIT_OUTSIDE_CTOR # define MOZ_INIT_OUTSIDE_CTOR
# define MOZ_IS_CLASS_INIT # define MOZ_IS_CLASS_INIT
@@ -781,7 +781,7 @@
_Pragma("clang diagnostic push") \ _Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Wgcc-compat\"") \ _Pragma("clang diagnostic ignored \"-Wgcc-compat\"") \
__attribute__((annotate("moz_heap_allocator"))) \ __attribute__((annotate("moz_heap_allocator"))) \
_Pragma("clang diagnostic pop") _Pragma("clang diagnostic pop")
# else # else
# define MOZ_HEAP_ALLOCATOR __attribute__((annotate("moz_heap_allocator"))) # define MOZ_HEAP_ALLOCATOR __attribute__((annotate("moz_heap_allocator")))
# endif # endif

View File

@@ -100,11 +100,12 @@ struct outparam_as_reference<T*> {
template <typename R, template <typename> typename RArg, typename Func, template <typename R, template <typename> typename RArg, typename Func,
typename... Args> typename... Args>
using to_result_retval_t = decltype( using to_result_retval_t =
std::declval<Func&>()(std::declval<Args&&>()..., decltype(std::declval<Func&>()(
std::declval<typename RArg<decltype( std::declval<Args&&>()...,
ResultRefAsParam(std::declval<R&>()))>::type>()), std::declval<typename RArg<decltype(ResultRefAsParam(
Result<R, nsresult>(Err(NS_ERROR_FAILURE))); std::declval<R&>()))>::type>()),
Result<R, nsresult>(Err(NS_ERROR_FAILURE)));
// There are two ToResultInvokeSelector overloads, which cover the cases of a) a // There are two ToResultInvokeSelector overloads, which cover the cases of a) a
// pointer-typed output parameter, and b) a reference-typed output parameter, // pointer-typed output parameter, and b) a reference-typed output parameter,

View File

@@ -256,9 +256,9 @@ struct VariantImplementation<Tag, N, T, Ts...> {
static decltype(auto) match(Matcher&& aMatcher, ConcreteVariant&& aV) { static decltype(auto) match(Matcher&& aMatcher, ConcreteVariant&& aV) {
if (aV.template is<N>()) { if (aV.template is<N>()) {
if constexpr (std::is_invocable_v<Matcher, Tag, if constexpr (std::is_invocable_v<Matcher, Tag,
decltype( decltype(std::forward<ConcreteVariant>(
std::forward<ConcreteVariant>(aV) aV)
.template as<N>())>) { .template as<N>())>) {
return std::forward<Matcher>(aMatcher)( return std::forward<Matcher>(aMatcher)(
Tag(N), std::forward<ConcreteVariant>(aV).template as<N>()); Tag(N), std::forward<ConcreteVariant>(aV).template as<N>());
} else { } else {
@@ -284,9 +284,9 @@ struct VariantImplementation<Tag, N, T, Ts...> {
static decltype(auto) matchN(ConcreteVariant&& aV, Mi&& aMi, Ms&&... aMs) { static decltype(auto) matchN(ConcreteVariant&& aV, Mi&& aMi, Ms&&... aMs) {
if (aV.template is<N>()) { if (aV.template is<N>()) {
if constexpr (std::is_invocable_v<Mi, Tag, if constexpr (std::is_invocable_v<Mi, Tag,
decltype( decltype(std::forward<ConcreteVariant>(
std::forward<ConcreteVariant>(aV) aV)
.template as<N>())>) { .template as<N>())>) {
static_assert( static_assert(
std::is_same_v< std::is_same_v<
decltype(std::forward<Mi>(aMi)( decltype(std::forward<Mi>(aMi)(

View File

@@ -923,11 +923,10 @@ struct ProfileBufferEntryReader::Deserializer<BlocksRingBuffer> {
writer.WriteFromReader(aER, end - start); writer.WriteFromReader(aER, end - start);
MOZ_ASSERT(writer.RemainingBytes() == 0); MOZ_ASSERT(writer.RemainingBytes() == 0);
// Finally copy stats. // Finally copy stats.
aBuffer.mMaybeUnderlyingBuffer->mPushedBlockCount = aER.ReadObject<decltype( aBuffer.mMaybeUnderlyingBuffer->mPushedBlockCount = aER.ReadObject<
aBuffer.mMaybeUnderlyingBuffer->mPushedBlockCount)>(); decltype(aBuffer.mMaybeUnderlyingBuffer->mPushedBlockCount)>();
aBuffer.mMaybeUnderlyingBuffer->mClearedBlockCount = aBuffer.mMaybeUnderlyingBuffer->mClearedBlockCount = aER.ReadObject<
aER.ReadObject<decltype( decltype(aBuffer.mMaybeUnderlyingBuffer->mClearedBlockCount)>();
aBuffer.mMaybeUnderlyingBuffer->mClearedBlockCount)>();
} }
// We cannot output a BlocksRingBuffer object (not copyable), use `ReadInto()` // We cannot output a BlocksRingBuffer object (not copyable), use `ReadInto()`

View File

@@ -53,8 +53,8 @@ struct CertContextDeleter {
struct CATAdminContextDeleter { struct CATAdminContextDeleter {
typedef HCATADMIN pointer; typedef HCATADMIN pointer;
void operator()(pointer aCtx) { void operator()(pointer aCtx) {
static const mozilla::StaticDynamicallyLinkedFunctionPtr<decltype( static const mozilla::StaticDynamicallyLinkedFunctionPtr<
&::CryptCATAdminReleaseContext)> decltype(&::CryptCATAdminReleaseContext)>
pCryptCATAdminReleaseContext(L"wintrust.dll", pCryptCATAdminReleaseContext(L"wintrust.dll",
"CryptCATAdminReleaseContext"); "CryptCATAdminReleaseContext");
@@ -207,8 +207,8 @@ bool SignedBinary::VerifySignature(const wchar_t* aFilePath) {
// Windows 7 also exports the CryptCATAdminAcquireContext2 API, but it does // Windows 7 also exports the CryptCATAdminAcquireContext2 API, but it does
// *not* sign its binaries with SHA-256, so we use the old API in that case. // *not* sign its binaries with SHA-256, so we use the old API in that case.
if (mozilla::IsWin8OrLater()) { if (mozilla::IsWin8OrLater()) {
static const mozilla::StaticDynamicallyLinkedFunctionPtr<decltype( static const mozilla::StaticDynamicallyLinkedFunctionPtr<
&::CryptCATAdminAcquireContext2)> decltype(&::CryptCATAdminAcquireContext2)>
pCryptCATAdminAcquireContext2(L"wintrust.dll", pCryptCATAdminAcquireContext2(L"wintrust.dll",
"CryptCATAdminAcquireContext2"); "CryptCATAdminAcquireContext2");
if (!pCryptCATAdminAcquireContext2) { if (!pCryptCATAdminAcquireContext2) {
@@ -225,8 +225,8 @@ bool SignedBinary::VerifySignature(const wchar_t* aFilePath) {
return false; return false;
} }
} else { } else {
static const mozilla::StaticDynamicallyLinkedFunctionPtr<decltype( static const mozilla::StaticDynamicallyLinkedFunctionPtr<
&::CryptCATAdminAcquireContext)> decltype(&::CryptCATAdminAcquireContext)>
pCryptCATAdminAcquireContext(L"wintrust.dll", pCryptCATAdminAcquireContext(L"wintrust.dll",
"CryptCATAdminAcquireContext"); "CryptCATAdminAcquireContext");
@@ -252,8 +252,8 @@ bool SignedBinary::VerifySignature(const wchar_t* aFilePath) {
DWORD hashLen = 0; DWORD hashLen = 0;
mozilla::UniquePtr<BYTE[]> hashBuf; mozilla::UniquePtr<BYTE[]> hashBuf;
static const mozilla::StaticDynamicallyLinkedFunctionPtr<decltype( static const mozilla::StaticDynamicallyLinkedFunctionPtr<
&::CryptCATAdminCalcHashFromFileHandle2)> decltype(&::CryptCATAdminCalcHashFromFileHandle2)>
pCryptCATAdminCalcHashFromFileHandle2( pCryptCATAdminCalcHashFromFileHandle2(
L"wintrust.dll", "CryptCATAdminCalcHashFromFileHandle2"); L"wintrust.dll", "CryptCATAdminCalcHashFromFileHandle2");
if (pCryptCATAdminCalcHashFromFileHandle2) { if (pCryptCATAdminCalcHashFromFileHandle2) {
@@ -270,8 +270,8 @@ bool SignedBinary::VerifySignature(const wchar_t* aFilePath) {
return false; return false;
} }
} else { } else {
static const mozilla::StaticDynamicallyLinkedFunctionPtr<decltype( static const mozilla::StaticDynamicallyLinkedFunctionPtr<
&::CryptCATAdminCalcHashFromFileHandle)> decltype(&::CryptCATAdminCalcHashFromFileHandle)>
pCryptCATAdminCalcHashFromFileHandle( pCryptCATAdminCalcHashFromFileHandle(
L"wintrust.dll", "CryptCATAdminCalcHashFromFileHandle"); L"wintrust.dll", "CryptCATAdminCalcHashFromFileHandle");
@@ -295,16 +295,16 @@ bool SignedBinary::VerifySignature(const wchar_t* aFilePath) {
// Now that we've hashed the file, query the catalog system to see if any // Now that we've hashed the file, query the catalog system to see if any
// catalogs reference a binary with our hash. // catalogs reference a binary with our hash.
static const mozilla::StaticDynamicallyLinkedFunctionPtr<decltype( static const mozilla::StaticDynamicallyLinkedFunctionPtr<
&::CryptCATAdminEnumCatalogFromHash)> decltype(&::CryptCATAdminEnumCatalogFromHash)>
pCryptCATAdminEnumCatalogFromHash(L"wintrust.dll", pCryptCATAdminEnumCatalogFromHash(L"wintrust.dll",
"CryptCATAdminEnumCatalogFromHash"); "CryptCATAdminEnumCatalogFromHash");
if (!pCryptCATAdminEnumCatalogFromHash) { if (!pCryptCATAdminEnumCatalogFromHash) {
return false; return false;
} }
static const mozilla::StaticDynamicallyLinkedFunctionPtr<decltype( static const mozilla::StaticDynamicallyLinkedFunctionPtr<
&::CryptCATAdminReleaseCatalogContext)> decltype(&::CryptCATAdminReleaseCatalogContext)>
pCryptCATAdminReleaseCatalogContext(L"wintrust.dll", pCryptCATAdminReleaseCatalogContext(L"wintrust.dll",
"CryptCATAdminReleaseCatalogContext"); "CryptCATAdminReleaseCatalogContext");
if (!pCryptCATAdminReleaseCatalogContext) { if (!pCryptCATAdminReleaseCatalogContext) {
@@ -326,8 +326,8 @@ bool SignedBinary::VerifySignature(const wchar_t* aFilePath) {
// We found a catalog! Now query for the path to the catalog file. // We found a catalog! Now query for the path to the catalog file.
static const mozilla::StaticDynamicallyLinkedFunctionPtr<decltype( static const mozilla::StaticDynamicallyLinkedFunctionPtr<
&::CryptCATCatalogInfoFromContext)> decltype(&::CryptCATCatalogInfoFromContext)>
pCryptCATCatalogInfoFromContext(L"wintrust.dll", pCryptCATCatalogInfoFromContext(L"wintrust.dll",
"CryptCATCatalogInfoFromContext"); "CryptCATCatalogInfoFromContext");
if (!pCryptCATCatalogInfoFromContext) { if (!pCryptCATCatalogInfoFromContext) {

View File

@@ -70,8 +70,8 @@ typedef NTSTATUS(NTAPI* LdrLoadDll_func)(PWCHAR filePath, PULONG flags,
static WindowsDllInterceptor::FuncHookType<LdrLoadDll_func> stub_LdrLoadDll; static WindowsDllInterceptor::FuncHookType<LdrLoadDll_func> stub_LdrLoadDll;
#ifdef _M_AMD64 #ifdef _M_AMD64
typedef decltype( typedef decltype(RtlInstallFunctionTableCallback)*
RtlInstallFunctionTableCallback)* RtlInstallFunctionTableCallback_func; RtlInstallFunctionTableCallback_func;
static WindowsDllInterceptor::FuncHookType<RtlInstallFunctionTableCallback_func> static WindowsDllInterceptor::FuncHookType<RtlInstallFunctionTableCallback_func>
stub_RtlInstallFunctionTableCallback; stub_RtlInstallFunctionTableCallback;

View File

@@ -47,8 +47,8 @@ void FallbackLoaderAPI::NotifyEndDllLoad(void* aContext, NTSTATUS aLoadNtStatus,
nt::AllocatedUnicodeString FallbackLoaderAPI::GetSectionName( nt::AllocatedUnicodeString FallbackLoaderAPI::GetSectionName(
void* aSectionAddr) { void* aSectionAddr) {
static const StaticDynamicallyLinkedFunctionPtr<decltype( static const StaticDynamicallyLinkedFunctionPtr<
&::NtQueryVirtualMemory)> decltype(&::NtQueryVirtualMemory)>
pNtQueryVirtualMemory(L"ntdll.dll", "NtQueryVirtualMemory"); pNtQueryVirtualMemory(L"ntdll.dll", "NtQueryVirtualMemory");
MOZ_ASSERT(pNtQueryVirtualMemory); MOZ_ASSERT(pNtQueryVirtualMemory);

View File

@@ -38,8 +38,8 @@ NTSTATUS NTAPI NtMapViewOfSection(
NTSTATUS NTAPI NtUnmapViewOfSection(HANDLE aProcess, PVOID aBaseAddress); NTSTATUS NTAPI NtUnmapViewOfSection(HANDLE aProcess, PVOID aBaseAddress);
static DWORD GetWin32ErrorCode(NTSTATUS aNtStatus) { static DWORD GetWin32ErrorCode(NTSTATUS aNtStatus) {
static const mozilla::StaticDynamicallyLinkedFunctionPtr<decltype( static const mozilla::StaticDynamicallyLinkedFunctionPtr<
&RtlNtStatusToDosError)> decltype(&RtlNtStatusToDosError)>
pRtlNtStatusToDosError(L"ntdll.dll", "RtlNtStatusToDosError"); pRtlNtStatusToDosError(L"ntdll.dll", "RtlNtStatusToDosError");
MOZ_ASSERT(!!pRtlNtStatusToDosError); MOZ_ASSERT(!!pRtlNtStatusToDosError);
@@ -107,8 +107,8 @@ MFBT_API bool UnmapRemoteViewOfFile(HANDLE aProcess, PVOID aBaseAddress) {
return !!pUnmapViewOfFile2(aProcess, aBaseAddress, 0); return !!pUnmapViewOfFile2(aProcess, aBaseAddress, 0);
} }
static const StaticDynamicallyLinkedFunctionPtr<decltype( static const StaticDynamicallyLinkedFunctionPtr<
&NtUnmapViewOfSection)> decltype(&NtUnmapViewOfSection)>
pNtUnmapViewOfSection(L"ntdll.dll", "NtUnmapViewOfSection"); pNtUnmapViewOfSection(L"ntdll.dll", "NtUnmapViewOfSection");
MOZ_ASSERT(!!pNtUnmapViewOfSection); MOZ_ASSERT(!!pNtUnmapViewOfSection);

View File

@@ -19,8 +19,8 @@ namespace mozilla {
static decltype(&::GetProcessMitigationPolicy) static decltype(&::GetProcessMitigationPolicy)
FetchGetProcessMitigationPolicyFunc() { FetchGetProcessMitigationPolicyFunc() {
static const StaticDynamicallyLinkedFunctionPtr<decltype( static const StaticDynamicallyLinkedFunctionPtr<
&::GetProcessMitigationPolicy)> decltype(&::GetProcessMitigationPolicy)>
pGetProcessMitigationPolicy(L"kernel32.dll", pGetProcessMitigationPolicy(L"kernel32.dll",
"GetProcessMitigationPolicy"); "GetProcessMitigationPolicy");
return pGetProcessMitigationPolicy; return pGetProcessMitigationPolicy;

View File

@@ -543,8 +543,8 @@ class MOZ_TRIVIAL_CTOR_DTOR MMPolicyInProcess
auto reserveWithinRangeFn = auto reserveWithinRangeFn =
[](HANDLE aProcess, uint32_t aSize, const uint8_t* aRangeMin, [](HANDLE aProcess, uint32_t aSize, const uint8_t* aRangeMin,
const uint8_t* aRangeMaxExcl) -> Maybe<PVOID> { const uint8_t* aRangeMaxExcl) -> Maybe<PVOID> {
static const StaticDynamicallyLinkedFunctionPtr<decltype( static const StaticDynamicallyLinkedFunctionPtr<
&::VirtualAlloc2)> decltype(&::VirtualAlloc2)>
pVirtualAlloc2(L"kernelbase.dll", "VirtualAlloc2"); pVirtualAlloc2(L"kernelbase.dll", "VirtualAlloc2");
if (!pVirtualAlloc2) { if (!pVirtualAlloc2) {
return Nothing(); return Nothing();
@@ -880,8 +880,8 @@ class MMPolicyOutOfProcess : public MMPolicyBase {
[mapping = mMapping](HANDLE aProcess, uint32_t aSize, [mapping = mMapping](HANDLE aProcess, uint32_t aSize,
const uint8_t* aRangeMin, const uint8_t* aRangeMin,
const uint8_t* aRangeMaxExcl) -> Maybe<PVOID> { const uint8_t* aRangeMaxExcl) -> Maybe<PVOID> {
static const StaticDynamicallyLinkedFunctionPtr<decltype( static const StaticDynamicallyLinkedFunctionPtr<
&::MapViewOfFile3)> decltype(&::MapViewOfFile3)>
pMapViewOfFile3(L"kernelbase.dll", "MapViewOfFile3"); pMapViewOfFile3(L"kernelbase.dll", "MapViewOfFile3");
if (!pMapViewOfFile3) { if (!pMapViewOfFile3) {
return Nothing(); return Nothing();

View File

@@ -16,8 +16,8 @@ using std::wstring;
extern "C" __declspec(dllexport) int ReturnResult() { return 2; } extern "C" __declspec(dllexport) int ReturnResult() { return 2; }
static mozilla::CrossProcessDllInterceptor::FuncHookType<decltype( static mozilla::CrossProcessDllInterceptor::FuncHookType<
&ReturnResult)> decltype(&ReturnResult)>
gOrigReturnResult; gOrigReturnResult;
static int ReturnResultHook() { static int ReturnResultHook() {

View File

@@ -69,8 +69,8 @@ extern "C" int wmain(int argc, wchar_t* argv[]) {
return 1; return 1;
} }
static const mozilla::StaticDynamicallyLinkedFunctionPtr<decltype( static const mozilla::StaticDynamicallyLinkedFunctionPtr<
&::GetSystemMetrics)> decltype(&::GetSystemMetrics)>
pRealGetSystemMetrics(L"user32.dll", "GetSystemMetrics"); pRealGetSystemMetrics(L"user32.dll", "GetSystemMetrics");
if (!pRealGetSystemMetrics) { if (!pRealGetSystemMetrics) {
PRINT_FAIL("Failed resolving real GetSystemMetrics pointer"); PRINT_FAIL("Failed resolving real GetSystemMetrics pointer");

View File

@@ -100,20 +100,25 @@ nsresult WinWifiScanner::GetAccessPointsFromWLAN(
InterfaceScanCallbackData cbData(interface_list->dwNumberOfItems); InterfaceScanCallbackData cbData(interface_list->dwNumberOfItems);
DWORD wlanNotifySource; DWORD wlanNotifySource;
if (ERROR_SUCCESS != (*mWlanLibrary->GetWlanRegisterNotificationPtr())( if (ERROR_SUCCESS !=
mWlanLibrary->GetWLANHandle(), (*mWlanLibrary
WLAN_NOTIFICATION_SOURCE_ACM, TRUE, ->GetWlanRegisterNotificationPtr())(mWlanLibrary->GetWLANHandle(),
(WLAN_NOTIFICATION_CALLBACK)OnScanComplete, &cbData, WLAN_NOTIFICATION_SOURCE_ACM,
NULL, &wlanNotifySource)) { TRUE,
(WLAN_NOTIFICATION_CALLBACK)
OnScanComplete,
&cbData, NULL,
&wlanNotifySource)) {
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
// Go through the list of interfaces and call `WlanScan` on each // Go through the list of interfaces and call `WlanScan` on each
for (unsigned int i = 0; i < interface_list->dwNumberOfItems; ++i) { for (unsigned int i = 0; i < interface_list->dwNumberOfItems; ++i) {
if (ERROR_SUCCESS != (*mWlanLibrary->GetWlanScanPtr())( if (ERROR_SUCCESS !=
mWlanLibrary->GetWLANHandle(), (*mWlanLibrary->GetWlanScanPtr())(mWlanLibrary->GetWLANHandle(),
&interface_list->InterfaceInfo[i].InterfaceGuid, &interface_list->InterfaceInfo[i]
NULL, NULL, NULL)) { .InterfaceGuid,
NULL, NULL, NULL)) {
cbData.OnInterfaceScanComplete(); cbData.OnInterfaceScanComplete();
} }
} }
@@ -133,14 +138,17 @@ nsresult WinWifiScanner::GetAccessPointsFromWLAN(
// Go through the list of interfaces and get the data for each. // Go through the list of interfaces and get the data for each.
for (uint32_t i = 0; i < interface_list->dwNumberOfItems; ++i) { for (uint32_t i = 0; i < interface_list->dwNumberOfItems; ++i) {
WLAN_BSS_LIST* bss_list; WLAN_BSS_LIST* bss_list;
if (ERROR_SUCCESS != (*mWlanLibrary->GetWlanGetNetworkBssListPtr())( if (ERROR_SUCCESS !=
mWlanLibrary->GetWLANHandle(), (*mWlanLibrary
&interface_list->InterfaceInfo[i].InterfaceGuid, ->GetWlanGetNetworkBssListPtr())(mWlanLibrary->GetWLANHandle(),
nullptr, // Use all SSIDs. &interface_list->InterfaceInfo[i]
DOT11_BSS_TYPE_UNUSED, .InterfaceGuid,
false, // bSecurityEnabled - unused nullptr, // Use all SSIDs.
nullptr, // reserved DOT11_BSS_TYPE_UNUSED,
&bss_list)) { false, // bSecurityEnabled -
// unused
nullptr, // reserved
&bss_list)) {
continue; continue;
} }

View File

@@ -56,8 +56,8 @@ static void SetQueryKeyInt64(const nsCString& aValue,
Int64QuerySetter setter); Int64QuerySetter setter);
// options setters // options setters
typedef decltype( typedef decltype(&nsINavHistoryQueryOptions::SetExpandQueries)
&nsINavHistoryQueryOptions::SetExpandQueries) BoolOptionsSetter; BoolOptionsSetter;
typedef decltype(&nsINavHistoryQueryOptions::SetMaxResults) Uint32OptionsSetter; typedef decltype(&nsINavHistoryQueryOptions::SetMaxResults) Uint32OptionsSetter;
typedef decltype(&nsINavHistoryQueryOptions::SetResultType) Uint16OptionsSetter; typedef decltype(&nsINavHistoryQueryOptions::SetResultType) Uint16OptionsSetter;
static void SetOptionsKeyBool(const nsCString& aValue, static void SetOptionsKeyBool(const nsCString& aValue,

View File

@@ -248,8 +248,9 @@ static int BuildImportTable(PMEMORYMODULE module) {
if (directory->Size > 0) { if (directory->Size > 0) {
PIMAGE_IMPORT_DESCRIPTOR importDesc = PIMAGE_IMPORT_DESCRIPTOR importDesc =
(PIMAGE_IMPORT_DESCRIPTOR)(codeBase + directory->VirtualAddress); (PIMAGE_IMPORT_DESCRIPTOR)(codeBase + directory->VirtualAddress);
PIMAGE_IMPORT_DESCRIPTOR importEnd = (PIMAGE_IMPORT_DESCRIPTOR)( PIMAGE_IMPORT_DESCRIPTOR importEnd =
codeBase + directory->VirtualAddress + directory->Size); (PIMAGE_IMPORT_DESCRIPTOR)(codeBase + directory->VirtualAddress +
directory->Size);
for (; importDesc < importEnd && importDesc->Name; importDesc++) { for (; importDesc < importEnd && importDesc->Name; importDesc++) {
POINTER_TYPE* thunkRef; POINTER_TYPE* thunkRef;

View File

@@ -313,8 +313,8 @@ void TryInitGnome() {
_gnome_program_init_fn gnome_program_init = _gnome_program_init_fn gnome_program_init =
(_gnome_program_init_fn)(dlsym(gnomeLib, "gnome_program_init")); (_gnome_program_init_fn)(dlsym(gnomeLib, "gnome_program_init"));
_libgnomeui_module_info_get_fn libgnomeui_module_info_get = _libgnomeui_module_info_get_fn libgnomeui_module_info_get =
(_libgnomeui_module_info_get_fn)( (_libgnomeui_module_info_get_fn)(dlsym(gnomeuiLib,
dlsym(gnomeuiLib, "libgnomeui_module_info_get")); "libgnomeui_module_info_get"));
if (gnome_program_init && libgnomeui_module_info_get) { if (gnome_program_init && libgnomeui_module_info_get) {
gnome_program_init("crashreporter", "1.0", libgnomeui_module_info_get(), gnome_program_init("crashreporter", "1.0", libgnomeui_module_info_get(),

View File

@@ -58,8 +58,8 @@ typedef struct _FILE_ID_INFO {
#if defined(_X86_) #if defined(_X86_)
# define SAFECALL_URLMON_FUNC(FuncName, ...) \ # define SAFECALL_URLMON_FUNC(FuncName, ...) \
do { \ do { \
static const mozilla::StaticDynamicallyLinkedFunctionPtr<decltype( \ static const mozilla::StaticDynamicallyLinkedFunctionPtr< \
&::FuncName)> \ decltype(&::FuncName)> \
func(L"urlmon.dll", #FuncName); \ func(L"urlmon.dll", #FuncName); \
hr = \ hr = \
func ? func(__VA_ARGS__) : HRESULT_FROM_WIN32(ERROR_PROC_NOT_FOUND); \ func ? func(__VA_ARGS__) : HRESULT_FROM_WIN32(ERROR_PROC_NOT_FOUND); \
@@ -186,8 +186,8 @@ class WindowsError final {
} }
static DWORD NtStatusToWin32Error(NTSTATUS aNtStatus) { static DWORD NtStatusToWin32Error(NTSTATUS aNtStatus) {
static const StaticDynamicallyLinkedFunctionPtr<decltype( static const StaticDynamicallyLinkedFunctionPtr<
&RtlNtStatusToDosError)> decltype(&RtlNtStatusToDosError)>
pRtlNtStatusToDosError(L"ntdll.dll", "RtlNtStatusToDosError"); pRtlNtStatusToDosError(L"ntdll.dll", "RtlNtStatusToDosError");
MOZ_ASSERT(!!pRtlNtStatusToDosError); MOZ_ASSERT(!!pRtlNtStatusToDosError);

View File

@@ -107,9 +107,10 @@ AsyncColorChooser::Run() {
mozilla::AutoRestore<AsyncColorChooser*> restoreColorChooser(gColorChooser); mozilla::AutoRestore<AsyncColorChooser*> restoreColorChooser(gColorChooser);
gColorChooser = this; gColorChooser = this;
AutoDestroyTmpWindow adtw((HWND)( AutoDestroyTmpWindow adtw(
mParentWidget.get() ? mParentWidget->GetNativeData(NS_NATIVE_TMP_WINDOW) (HWND)(mParentWidget.get()
: nullptr)); ? mParentWidget->GetNativeData(NS_NATIVE_TMP_WINDOW)
: nullptr));
CHOOSECOLOR options; CHOOSECOLOR options;
options.lStructSize = sizeof(options); options.lStructSize = sizeof(options);

View File

@@ -158,9 +158,10 @@ bool nsFilePicker::ShowFolderPicker(const nsString& aInitialDir) {
} }
} }
AutoDestroyTmpWindow adtw((HWND)( AutoDestroyTmpWindow adtw(
mParentWidget.get() ? mParentWidget->GetNativeData(NS_NATIVE_TMP_WINDOW) (HWND)(mParentWidget.get()
: nullptr)); ? mParentWidget->GetNativeData(NS_NATIVE_TMP_WINDOW)
: nullptr));
// display // display
mozilla::BackgroundHangMonitor().NotifyWait(); mozilla::BackgroundHangMonitor().NotifyWait();
@@ -320,9 +321,10 @@ bool nsFilePicker::ShowFilePicker(const nsString& aInitialDir) {
// display // display
{ {
AutoDestroyTmpWindow adtw((HWND)( AutoDestroyTmpWindow adtw(
mParentWidget.get() ? mParentWidget->GetNativeData(NS_NATIVE_TMP_WINDOW) (HWND)(mParentWidget.get()
: nullptr)); ? mParentWidget->GetNativeData(NS_NATIVE_TMP_WINDOW)
: nullptr));
AutoWidgetPickerState awps(mParentWidget); AutoWidgetPickerState awps(mParentWidget);
mozilla::BackgroundHangMonitor().NotifyWait(); mozilla::BackgroundHangMonitor().NotifyWait();

View File

@@ -959,8 +959,8 @@ nsresult nsSystemInfo::Init() {
} }
# endif // __MINGW32__ # endif // __MINGW32__
mozilla::DynamicallyLinkedFunctionPtr<decltype( mozilla::DynamicallyLinkedFunctionPtr<
&IsUserCetAvailableInEnvironment)> decltype(&IsUserCetAvailableInEnvironment)>
isUserCetAvailable(L"api-ms-win-core-sysinfo-l1-2-6.dll", isUserCetAvailable(L"api-ms-win-core-sysinfo-l1-2-6.dll",
"IsUserCetAvailableInEnvironment"); "IsUserCetAvailableInEnvironment");
bool hasUserCET = isUserCetAvailable && bool hasUserCET = isUserCetAvailable &&

View File

@@ -228,51 +228,64 @@ class MasterList {
if (aOp & mozilla::IOInterposeObserver::OpCreateOrOpen) { if (aOp & mozilla::IOInterposeObserver::OpCreateOrOpen) {
VectorRemove(newLists->mCreateObservers, aObserver); VectorRemove(newLists->mCreateObservers, aObserver);
if (newLists->mCreateObservers.empty()) { if (newLists->mCreateObservers.empty()) {
mObservedOperations = (mozilla::IOInterposeObserver::Operation)( mObservedOperations =
mObservedOperations & (mozilla::IOInterposeObserver::
~mozilla::IOInterposeObserver::OpCreateOrOpen); Operation)(mObservedOperations &
~mozilla::IOInterposeObserver::OpCreateOrOpen);
} }
} }
if (aOp & mozilla::IOInterposeObserver::OpRead) { if (aOp & mozilla::IOInterposeObserver::OpRead) {
VectorRemove(newLists->mReadObservers, aObserver); VectorRemove(newLists->mReadObservers, aObserver);
if (newLists->mReadObservers.empty()) { if (newLists->mReadObservers.empty()) {
mObservedOperations = (mozilla::IOInterposeObserver::Operation)( mObservedOperations =
mObservedOperations & ~mozilla::IOInterposeObserver::OpRead); (mozilla::IOInterposeObserver::
Operation)(mObservedOperations &
~mozilla::IOInterposeObserver::OpRead);
} }
} }
if (aOp & mozilla::IOInterposeObserver::OpWrite) { if (aOp & mozilla::IOInterposeObserver::OpWrite) {
VectorRemove(newLists->mWriteObservers, aObserver); VectorRemove(newLists->mWriteObservers, aObserver);
if (newLists->mWriteObservers.empty()) { if (newLists->mWriteObservers.empty()) {
mObservedOperations = (mozilla::IOInterposeObserver::Operation)( mObservedOperations =
mObservedOperations & ~mozilla::IOInterposeObserver::OpWrite); (mozilla::IOInterposeObserver::
Operation)(mObservedOperations &
~mozilla::IOInterposeObserver::OpWrite);
} }
} }
if (aOp & mozilla::IOInterposeObserver::OpFSync) { if (aOp & mozilla::IOInterposeObserver::OpFSync) {
VectorRemove(newLists->mFSyncObservers, aObserver); VectorRemove(newLists->mFSyncObservers, aObserver);
if (newLists->mFSyncObservers.empty()) { if (newLists->mFSyncObservers.empty()) {
mObservedOperations = (mozilla::IOInterposeObserver::Operation)( mObservedOperations =
mObservedOperations & ~mozilla::IOInterposeObserver::OpFSync); (mozilla::IOInterposeObserver::
Operation)(mObservedOperations &
~mozilla::IOInterposeObserver::OpFSync);
} }
} }
if (aOp & mozilla::IOInterposeObserver::OpStat) { if (aOp & mozilla::IOInterposeObserver::OpStat) {
VectorRemove(newLists->mStatObservers, aObserver); VectorRemove(newLists->mStatObservers, aObserver);
if (newLists->mStatObservers.empty()) { if (newLists->mStatObservers.empty()) {
mObservedOperations = (mozilla::IOInterposeObserver::Operation)( mObservedOperations =
mObservedOperations & ~mozilla::IOInterposeObserver::OpStat); (mozilla::IOInterposeObserver::
Operation)(mObservedOperations &
~mozilla::IOInterposeObserver::OpStat);
} }
} }
if (aOp & mozilla::IOInterposeObserver::OpClose) { if (aOp & mozilla::IOInterposeObserver::OpClose) {
VectorRemove(newLists->mCloseObservers, aObserver); VectorRemove(newLists->mCloseObservers, aObserver);
if (newLists->mCloseObservers.empty()) { if (newLists->mCloseObservers.empty()) {
mObservedOperations = (mozilla::IOInterposeObserver::Operation)( mObservedOperations =
mObservedOperations & ~mozilla::IOInterposeObserver::OpClose); (mozilla::IOInterposeObserver::
Operation)(mObservedOperations &
~mozilla::IOInterposeObserver::OpClose);
} }
} }
if (aOp & mozilla::IOInterposeObserver::OpNextStage) { if (aOp & mozilla::IOInterposeObserver::OpNextStage) {
VectorRemove(newLists->mStageObservers, aObserver); VectorRemove(newLists->mStageObservers, aObserver);
if (newLists->mStageObservers.empty()) { if (newLists->mStageObservers.empty()) {
mObservedOperations = (mozilla::IOInterposeObserver::Operation)( mObservedOperations =
mObservedOperations & ~mozilla::IOInterposeObserver::OpNextStage); (mozilla::IOInterposeObserver::
Operation)(mObservedOperations &
~mozilla::IOInterposeObserver::OpNextStage);
} }
} }
mObserverLists = newLists; mObserverLists = newLists;

View File

@@ -870,11 +870,11 @@ TEST(TArray, RemoveLastElements_One)
ASSERT_EQ((nsTArray<int>{1, 2, 3}), array); ASSERT_EQ((nsTArray<int>{1, 2, 3}), array);
} }
static_assert(std::is_copy_assignable<decltype( static_assert(std::is_copy_assignable<decltype(MakeBackInserter(
MakeBackInserter(std::declval<nsTArray<int>&>()))>::value, std::declval<nsTArray<int>&>()))>::value,
"output iteraror must be copy-assignable"); "output iteraror must be copy-assignable");
static_assert(std::is_copy_constructible<decltype( static_assert(std::is_copy_constructible<decltype(MakeBackInserter(
MakeBackInserter(std::declval<nsTArray<int>&>()))>::value, std::declval<nsTArray<int>&>()))>::value,
"output iterator must be copy-constructible"); "output iterator must be copy-constructible");
TEST(TArray, MakeBackInserter) TEST(TArray, MakeBackInserter)

View File

@@ -1004,8 +1004,8 @@ class MozPromise : public MozPromiseBase {
} }
template <typename... Ts> template <typename... Ts>
auto Then(Ts&&... aArgs) -> decltype( auto Then(Ts&&... aArgs) -> decltype(std::declval<PromiseType>().Then(
std::declval<PromiseType>().Then(std::forward<Ts>(aArgs)...)) { std::forward<Ts>(aArgs)...)) {
return static_cast<RefPtr<PromiseType>>(*this)->Then( return static_cast<RefPtr<PromiseType>>(*this)->Then(
std::forward<Ts>(aArgs)...); std::forward<Ts>(aArgs)...);
} }

View File

@@ -637,8 +637,9 @@ already_AddRefed<mozilla::CancelableRunnable> NS_NewCancelableRunnableFunction(
const char* aName, Function&& aFunc) { const char* aName, Function&& aFunc) {
class FuncCancelableRunnable final : public mozilla::CancelableRunnable { class FuncCancelableRunnable final : public mozilla::CancelableRunnable {
public: public:
static_assert(std::is_void_v<decltype( static_assert(
std::declval<std::remove_reference_t<Function>>()())>); std::is_void_v<
decltype(std::declval<std::remove_reference_t<Function>>()())>);
NS_INLINE_DECL_REFCOUNTING_INHERITED(FuncCancelableRunnable, NS_INLINE_DECL_REFCOUNTING_INHERITED(FuncCancelableRunnable,
CancelableRunnable) CancelableRunnable)
@@ -1111,8 +1112,9 @@ struct ParameterStorage
}; };
template <class T> template <class T>
static auto HasSetDeadlineTest(int) -> SFINAE1True<decltype( static auto HasSetDeadlineTest(int)
std::declval<T>().SetDeadline(std::declval<mozilla::TimeStamp>()))>; -> SFINAE1True<decltype(std::declval<T>().SetDeadline(
std::declval<mozilla::TimeStamp>()))>;
template <class T> template <class T>
static auto HasSetDeadlineTest(long) -> std::false_type; static auto HasSetDeadlineTest(long) -> std::false_type;