Bug 1479777 - Reduce clang-cl warnings from mozglue/misc/interceptor/. r=aklotz

--HG--
extra : source : 8b3d7161cbc7e582c79b3b28f961972af104a4f8
extra : intermediate-source : d434b3e9de5d973b031d685cfd7a2e8f8f3f8303
This commit is contained in:
Masatoshi Kimura 2018-07-31 22:03:43 +09:00
Родитель 5dcd952f20
Коммит 8b236812bd
5 изменённых файлов: 18 добавлений и 9 удалений

Просмотреть файл

@ -25,7 +25,7 @@ protected:
} }
ReadOnlyTargetFunction<MMPolicyT> ReadOnlyTargetFunction<MMPolicyT>
ResolveRedirectedAddress(const void* aOriginalFunction) ResolveRedirectedAddress(FARPROC aOriginalFunction)
{ {
ReadOnlyTargetFunction<MMPolicyT> origFn(mVMPolicy, aOriginalFunction); ReadOnlyTargetFunction<MMPolicyT> origFn(mVMPolicy, aOriginalFunction);
// If function entry is jmp rel8 stub to the internal implementation, we // If function entry is jmp rel8 stub to the internal implementation, we

Просмотреть файл

@ -401,7 +401,7 @@ protected:
{ {
*aOutTramp = nullptr; *aOutTramp = nullptr;
Trampoline<MMPolicyT> tramp(mVMPolicy.GetNextTrampoline()); Trampoline<MMPolicyT> tramp(this->mVMPolicy.GetNextTrampoline());
if (!tramp) { if (!tramp) {
return; return;
} }

Просмотреть файл

@ -12,6 +12,7 @@
#include "mozilla/Maybe.h" #include "mozilla/Maybe.h"
#include "mozilla/Tuple.h" #include "mozilla/Tuple.h"
#include "mozilla/Types.h" #include "mozilla/Types.h"
#include "mozilla/Unused.h"
#include "mozilla/Vector.h" #include "mozilla/Vector.h"
#include <memory> #include <memory>
@ -475,7 +476,7 @@ public:
: mMMPolicy(aOther.mMMPolicy) : mMMPolicy(aOther.mMMPolicy)
, mBase(aOther.mBase) , mBase(aOther.mBase)
{ {
mLocalBytes.appendAll(aOther.mLocalBytes); Unused << mLocalBytes.appendAll(aOther.mLocalBytes);
} }
ReadOnlyTargetBytes(const ReadOnlyTargetBytes& aOther, ReadOnlyTargetBytes(const ReadOnlyTargetBytes& aOther,
@ -487,7 +488,7 @@ public:
return; return;
} }
mLocalBytes.append(aOther.mLocalBytes.begin() + aOffsetFromOther, Unused << mLocalBytes.append(aOther.mLocalBytes.begin() + aOffsetFromOther,
aOther.mLocalBytes.end()); aOther.mLocalBytes.end());
} }
@ -677,6 +678,13 @@ public:
{ {
} }
ReadOnlyTargetFunction(const MMPolicy& aMMPolicy, FARPROC aFunc)
: mTargetBytes(TargetBytesPtr<MMPolicy>::Make(aMMPolicy,
reinterpret_cast<const void*>(aFunc)))
, mOffset(0)
{
}
ReadOnlyTargetFunction(const MMPolicy& aMMPolicy, uintptr_t aFunc) ReadOnlyTargetFunction(const MMPolicy& aMMPolicy, uintptr_t aFunc)
: mTargetBytes(TargetBytesPtr<MMPolicy>::Make(aMMPolicy, : mTargetBytes(TargetBytesPtr<MMPolicy>::Make(aMMPolicy,
reinterpret_cast<const void*>(aFunc))) reinterpret_cast<const void*>(aFunc)))
@ -814,7 +822,7 @@ private:
static auto Result(const MMPolicy& aPolicy, T* aValue) static auto Result(const MMPolicy& aPolicy, T* aValue)
{ {
ReadOnlyTargetFunction<MMPolicy> ptr(aPolicy, aValue); ReadOnlyTargetFunction<MMPolicy> ptr(aPolicy, aValue);
return ptr.ChasePointer<T>(); return ptr.template ChasePointer<T>();
} }
}; };
@ -824,7 +832,7 @@ public:
auto ChasePointer() auto ChasePointer()
{ {
mTargetBytes->EnsureLimit(mOffset + sizeof(T)); mTargetBytes->EnsureLimit(mOffset + sizeof(T));
const typename RemoveCV<T>::Type result = *reinterpret_cast<const RemoveCV<T>::Type*>(mTargetBytes->GetLocalBytes() + mOffset); const typename RemoveCV<T>::Type result = *reinterpret_cast<const typename RemoveCV<T>::Type*>(mTargetBytes->GetLocalBytes() + mOffset);
return ChasePointerHelper<typename RemoveCV<T>::Type>::Result(mTargetBytes->GetMMPolicy(), result); return ChasePointerHelper<typename RemoveCV<T>::Type>::Result(mTargetBytes->GetMMPolicy(), result);
} }

Просмотреть файл

@ -106,6 +106,7 @@ public:
::InitializeCriticalSectionEx(&sCS, 4000, flags); ::InitializeCriticalSectionEx(&sCS, 4000, flags);
return true; return true;
}(); }();
Unused << isAlloc;
} }
explicit operator bool() const explicit operator bool() const

Просмотреть файл

@ -168,11 +168,11 @@ private:
struct MOZ_RAII InitOnceContext final struct MOZ_RAII InitOnceContext final
{ {
InitOnceContext(ThisType* aHook, InterceptorT* aInterceptor, InitOnceContext(ThisType* aHook, InterceptorT* aInterceptor,
const char* aName, void* aHookDest, bool aForceDetour) const char* aName, FuncPtrT aHookDest, bool aForceDetour)
: mHook(aHook) : mHook(aHook)
, mInterceptor(aInterceptor) , mInterceptor(aInterceptor)
, mName(aName) , mName(aName)
, mHookDest(aHookDest) , mHookDest(reinterpret_cast<void*>(aHookDest))
, mForceDetour(aForceDetour) , mForceDetour(aForceDetour)
{ {
} }