diff options
author | Scott Mosier <smosier@microsoft.com> | 2015-12-05 00:25:14 +0300 |
---|---|---|
committer | Scott Mosier <smosier@microsoft.com> | 2015-12-05 00:59:05 +0300 |
commit | d50349270f470e6c2dfa56a7ccc7dde3f20af04b (patch) | |
tree | b0927d47d471fd174ae2f95033c492f2a60d06f1 /src/Native | |
parent | 94ce4ec438e10b56f6990fbb4f3ad65c649bcc9b (diff) |
Remove static_check.h, remove unused method on Module class.
Switched all uses of STATIC_ASSERT to static_assert and removed
the static_check.h header, since it wasn't very useful.
Removed orphaned method from Module class.
Diffstat (limited to 'src/Native')
-rw-r--r-- | src/Native/Runtime/DebugEventSource.cpp | 1 | ||||
-rw-r--r-- | src/Native/Runtime/GcStressControl.cpp | 1 | ||||
-rw-r--r-- | src/Native/Runtime/MiscHelpers.cpp | 1 | ||||
-rw-r--r-- | src/Native/Runtime/Profiling.cpp | 1 | ||||
-rw-r--r-- | src/Native/Runtime/RHCodeMan.cpp | 8 | ||||
-rw-r--r-- | src/Native/Runtime/RWLock.cpp | 1 | ||||
-rw-r--r-- | src/Native/Runtime/RuntimeInstance.cpp | 1 | ||||
-rw-r--r-- | src/Native/Runtime/StackFrameIterator.cpp | 1 | ||||
-rw-r--r-- | src/Native/Runtime/allocheap.cpp | 1 | ||||
-rw-r--r-- | src/Native/Runtime/amd64/virtualcallstubcpu.hpp | 4 | ||||
-rw-r--r-- | src/Native/Runtime/arm/VirtualCallStubCPU.hpp | 4 | ||||
-rw-r--r-- | src/Native/Runtime/i386/VirtualCallStubCPU.hpp | 4 | ||||
-rw-r--r-- | src/Native/Runtime/inc/static_check.h | 21 | ||||
-rw-r--r-- | src/Native/Runtime/inc/type_traits.hpp | 5 | ||||
-rw-r--r-- | src/Native/Runtime/module.cpp | 34 | ||||
-rw-r--r-- | src/Native/Runtime/module.h | 2 | ||||
-rw-r--r-- | src/Native/Runtime/threadstore.cpp | 1 |
17 files changed, 14 insertions, 77 deletions
diff --git a/src/Native/Runtime/DebugEventSource.cpp b/src/Native/Runtime/DebugEventSource.cpp index c5c2cbb5c..a97488333 100644 --- a/src/Native/Runtime/DebugEventSource.cpp +++ b/src/Native/Runtime/DebugEventSource.cpp @@ -9,7 +9,6 @@ #include "PalRedhawkCommon.h" #include "PalRedhawk.h" #include "assert.h" -#include "static_check.h" #include "type_traits.hpp" #include "slist.h" #include "holder.h" diff --git a/src/Native/Runtime/GcStressControl.cpp b/src/Native/Runtime/GcStressControl.cpp index 19729d8a5..cc86cbaac 100644 --- a/src/Native/Runtime/GcStressControl.cpp +++ b/src/Native/Runtime/GcStressControl.cpp @@ -13,7 +13,6 @@ #include "PalRedhawkCommon.h" #include "PalRedhawk.h" #include "assert.h" -#include "static_check.h" #include "holder.h" #include "Crst.h" #include "RhConfig.h" diff --git a/src/Native/Runtime/MiscHelpers.cpp b/src/Native/Runtime/MiscHelpers.cpp index a9f79f7e6..a08d113b7 100644 --- a/src/Native/Runtime/MiscHelpers.cpp +++ b/src/Native/Runtime/MiscHelpers.cpp @@ -14,7 +14,6 @@ #include "PalRedhawkCommon.h" #include "PalRedhawk.h" #include "assert.h" -#include "static_check.h" #include "slist.h" #include "holder.h" #include "Crst.h" diff --git a/src/Native/Runtime/Profiling.cpp b/src/Native/Runtime/Profiling.cpp index 11ff90ce4..7b6c1dccb 100644 --- a/src/Native/Runtime/Profiling.cpp +++ b/src/Native/Runtime/Profiling.cpp @@ -9,7 +9,6 @@ #include "PalRedhawkCommon.h" #include "PalRedhawk.h" #include "assert.h" -#include "static_check.h" #include "slist.h" #include "holder.h" #include "Crst.h" diff --git a/src/Native/Runtime/RHCodeMan.cpp b/src/Native/Runtime/RHCodeMan.cpp index 2eebb2c90..afa2ddcb7 100644 --- a/src/Native/Runtime/RHCodeMan.cpp +++ b/src/Native/Runtime/RHCodeMan.cpp @@ -23,7 +23,7 @@ // Ensure that EEMethodInfo fits into the space reserved by MethodInfo -STATIC_ASSERT(sizeof(EEMethodInfo) <= sizeof(MethodInfo)); +static_assert(sizeof(EEMethodInfo) <= sizeof(MethodInfo), "EEMethodInfo does not fit into a MethodInfo"); EEMethodInfo * GetEEMethodInfo(MethodInfo * pMethodInfo) { @@ -903,9 +903,9 @@ PTR_PTR_VOID EECodeManager::GetReturnAddressLocationForHijack(EEMethodInfo * GCRefKind EECodeManager::GetReturnValueKind(EEMethodInfo * pMethodInfo) { - STATIC_ASSERT((GCRefKind)GCInfoHeader::MRK_ReturnsScalar == GCRK_Scalar); - STATIC_ASSERT((GCRefKind)GCInfoHeader::MRK_ReturnsObject == GCRK_Object); - STATIC_ASSERT((GCRefKind)GCInfoHeader::MRK_ReturnsByref == GCRK_Byref); + static_assert((GCRefKind)GCInfoHeader::MRK_ReturnsScalar == GCRK_Scalar, "GCInfoHeader::MRK_ReturnsScalar does not match GCRK_Scalar"); + static_assert((GCRefKind)GCInfoHeader::MRK_ReturnsObject == GCRK_Object, "GCInfoHeader::MRK_ReturnsObject does not match GCRK_Object"); + static_assert((GCRefKind)GCInfoHeader::MRK_ReturnsByref == GCRK_Byref, "GCInfoHeader::MRK_ReturnsByref does not match GCRK_Byref"); GCInfoHeader::MethodReturnKind retKind = pMethodInfo->GetGCInfoHeader()->GetReturnKind(); switch (retKind) diff --git a/src/Native/Runtime/RWLock.cpp b/src/Native/Runtime/RWLock.cpp index 5f755df24..efcb1c1ab 100644 --- a/src/Native/Runtime/RWLock.cpp +++ b/src/Native/Runtime/RWLock.cpp @@ -13,7 +13,6 @@ #include "PalRedhawkCommon.h" #include "PalRedhawk.h" #include "assert.h" -#include "static_check.h" #include "slist.h" #include "gcrhinterface.h" #include "varint.h" diff --git a/src/Native/Runtime/RuntimeInstance.cpp b/src/Native/Runtime/RuntimeInstance.cpp index 91f38176c..ee92a2e67 100644 --- a/src/Native/Runtime/RuntimeInstance.cpp +++ b/src/Native/Runtime/RuntimeInstance.cpp @@ -9,7 +9,6 @@ #include "PalRedhawkCommon.h" #include "PalRedhawk.h" #include "assert.h" -#include "static_check.h" #include "slist.h" #include "holder.h" #include "Crst.h" diff --git a/src/Native/Runtime/StackFrameIterator.cpp b/src/Native/Runtime/StackFrameIterator.cpp index 10acfdce8..141a1425b 100644 --- a/src/Native/Runtime/StackFrameIterator.cpp +++ b/src/Native/Runtime/StackFrameIterator.cpp @@ -19,7 +19,6 @@ #include "holder.h" #include "Crst.h" #include "RWLock.h" -#include "static_check.h" #include "event.h" #include "threadstore.h" #include "stressLog.h" diff --git a/src/Native/Runtime/allocheap.cpp b/src/Native/Runtime/allocheap.cpp index 236bfadd7..44852a5e2 100644 --- a/src/Native/Runtime/allocheap.cpp +++ b/src/Native/Runtime/allocheap.cpp @@ -10,7 +10,6 @@ #include "PalRedhawkCommon.h" #include "PalRedhawk.h" #include "assert.h" -#include "static_check.h" #include "slist.h" #include "holder.h" #include "Crst.h" diff --git a/src/Native/Runtime/amd64/virtualcallstubcpu.hpp b/src/Native/Runtime/amd64/virtualcallstubcpu.hpp index 2fac6b773..b2f65b573 100644 --- a/src/Native/Runtime/amd64/virtualcallstubcpu.hpp +++ b/src/Native/Runtime/amd64/virtualcallstubcpu.hpp @@ -498,7 +498,7 @@ const DispatchStubLongCode dispatchLongTemplate = void DispatchHolder::InitializeStatic() { // Check that _expectedType is aligned in the DispatchHolder - STATIC_ASSERT(((sizeof(DispatchHolder) + offsetof(DispatchStub,_expectedType)) % sizeof(void*)) == 0); + static_assert(((sizeof(DispatchHolder) + offsetof(DispatchStub, _expectedType)) % sizeof(void*)) == 0, "_expectedType is misaligned"); }; void DispatchHolder::Initialize(UInt8 const * implTarget, UInt8 const * failTarget, size_t expectedType, @@ -599,7 +599,7 @@ const ResolveStubCode resolveTemplate = void ResolveHolder::InitializeStatic() { // Check that _itfType is aligned in ResolveHolder - STATIC_ASSERT(((offsetof(ResolveHolder, _stub) + offsetof(ResolveStub, _itfType)) % sizeof(void*)) == 0); + static_assert(((offsetof(ResolveHolder, _stub) + offsetof(ResolveStub, _itfType)) % sizeof(void*)) == 0, "_itfType is misaligned"); }; void ResolveHolder::Initialize( diff --git a/src/Native/Runtime/arm/VirtualCallStubCPU.hpp b/src/Native/Runtime/arm/VirtualCallStubCPU.hpp index 94159cd62..6933a018b 100644 --- a/src/Native/Runtime/arm/VirtualCallStubCPU.hpp +++ b/src/Native/Runtime/arm/VirtualCallStubCPU.hpp @@ -296,7 +296,7 @@ const UInt8 **StubCallSite::ComputeIndirCellAddr(const UInt8 *returnAddr, const void DispatchHolder::InitializeStatic() { // Check that _expectedType is aligned in the DispatchHolder - STATIC_ASSERT(((offsetof(DispatchHolder, _stub) + offsetof(DispatchStub,_expectedType)) % sizeof(void*)) == 0); + static_assert(((offsetof(DispatchHolder, _stub) + offsetof(DispatchStub, _expectedType)) % sizeof(void*)) == 0, "_expectedType is misaligned"); }; //----------------------------------------------------------------------------------------------------------- @@ -390,7 +390,7 @@ DispatchHolder* DispatchHolder::FromDispatchEntryPoint(PTR_Code dispatchEntry) void ResolveHolder::InitializeStatic() { // Check that _itfType is aligned in ResolveHolder - STATIC_ASSERT(((offsetof(ResolveHolder, _stub) + offsetof(ResolveStub, _itfType)) % sizeof(void*)) == 0); + static_assert(((offsetof(ResolveHolder, _stub) + offsetof(ResolveStub, _itfType)) % sizeof(void*)) == 0, "_itfType is misaligned"); }; //----------------------------------------------------------------------------------------------------------- diff --git a/src/Native/Runtime/i386/VirtualCallStubCPU.hpp b/src/Native/Runtime/i386/VirtualCallStubCPU.hpp index 27d3fbe4c..d69b9105e 100644 --- a/src/Native/Runtime/i386/VirtualCallStubCPU.hpp +++ b/src/Native/Runtime/i386/VirtualCallStubCPU.hpp @@ -521,7 +521,7 @@ const DispatchStubCode dispatchTemplate = void DispatchHolder::InitializeStatic() { // Check that _expectedType is aligned in the DispatchHolder - STATIC_ASSERT(((offsetof(DispatchHolder, _stub) + offsetof(DispatchStub,_expectedType)) % sizeof(void*)) == 0); + static_assert(((offsetof(DispatchHolder, _stub) + offsetof(DispatchStub, _expectedType)) % sizeof(void*)) == 0, "_expectedType is misaligned"); }; //----------------------------------------------------------------------------------------------------------- @@ -612,7 +612,7 @@ const ResolveStubCode resolveTemplate = void ResolveHolder::InitializeStatic() { // Check that _itfType is aligned in ResolveHolder - STATIC_ASSERT(((offsetof(ResolveHolder, _stub) + offsetof(ResolveStub, _itfType)) % sizeof(void*)) == 0); + static_assert(((offsetof(ResolveHolder, _stub) + offsetof(ResolveStub, _itfType)) % sizeof(void*)) == 0, "_itfType is misaligned"); }; //----------------------------------------------------------------------------------------------------------- diff --git a/src/Native/Runtime/inc/static_check.h b/src/Native/Runtime/inc/static_check.h deleted file mode 100644 index 714a6a455..000000000 --- a/src/Native/Runtime/inc/static_check.h +++ /dev/null @@ -1,21 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -// -// --------------------------------------------------------------------------- -// static_check.h -// -// Static assertion checking infrastructure -// --------------------------------------------------------------------------- - -#ifndef __STATIC_CHECK_H__ -#define __STATIC_CHECK_H__ - -// -// Static assert. Now uses the built-in compiler "static_assert" function. -// - -#define STATIC_ASSERT_MSG( cond, msg ) static_assert( cond, #msg ) -#define STATIC_ASSERT( cond ) STATIC_ASSERT_MSG(cond, static_assert_failure) - -#endif // __STATIC_CHECK_H__ diff --git a/src/Native/Runtime/inc/type_traits.hpp b/src/Native/Runtime/inc/type_traits.hpp index 72e6de981..8fb81f96d 100644 --- a/src/Native/Runtime/inc/type_traits.hpp +++ b/src/Native/Runtime/inc/type_traits.hpp @@ -11,7 +11,6 @@ #ifndef __TYPE_TRAITS_HPP__ #define __TYPE_TRAITS_HPP__ -#include "static_check.h" #include "CommonTypes.h" namespace type_traits @@ -172,8 +171,8 @@ template<class TBase, class TDerived> struct is_base_of { is_base_of() { - STATIC_ASSERT_MSG((type_traits::is_base_of<TBase, TDerived>::value), - is_base_of_constraint_violation); + static_assert((type_traits::is_base_of<TBase, TDerived>::value), + "is_base_of() constraint violation: TDerived does not derive from TBase"); } }; diff --git a/src/Native/Runtime/module.cpp b/src/Native/Runtime/module.cpp index 1aeca6e68..b9965c52d 100644 --- a/src/Native/Runtime/module.cpp +++ b/src/Native/Runtime/module.cpp @@ -522,37 +522,7 @@ struct EEEHEnumState }; // Ensure that EEEHEnumState fits into the space reserved by EHEnumState -STATIC_ASSERT(sizeof(EEEHEnumState) <= sizeof(EHEnumState)); - -#if 1 // only needed for local-exception model -bool Module::EHEnumInitFromReturnAddress(PTR_VOID ControlPC, PTR_VOID * pMethodStartAddressOut, EHEnumState * pEHEnumStateOut) -{ - ASSERT(ContainsCodeAddress(ControlPC)); - - PTR_UInt8 pbControlPC = dac_cast<PTR_UInt8>(ControlPC); - - UInt32 uMethodIndex; - UInt32 uMethodStartSectionOffset; - - PTR_UInt8 pbTextSectionStart = m_pModuleHeader->RegionPtr[ModuleHeader::TEXT_REGION]; - UInt32 uTextSectionOffset = (UInt32)(pbControlPC - pbTextSectionStart); - - m_MethodList.GetMethodInfo(uTextSectionOffset, &uMethodIndex, &uMethodStartSectionOffset, NULL); - - *pMethodStartAddressOut = pbTextSectionStart + uMethodStartSectionOffset; - - PTR_VOID pEHInfo = m_MethodList.GetEHInfo(uMethodIndex); - if (pEHInfo == NULL) - return false; - - EEEHEnumState * pEnumState = (EEEHEnumState *)pEHEnumStateOut; - pEnumState->pEHInfo = (PTR_UInt8)pEHInfo; - pEnumState->uClause = 0; - pEnumState->nClauses = VarInt::ReadUnsigned(pEnumState->pEHInfo); - - return true; -} -#endif // 1 +static_assert(sizeof(EEEHEnumState) <= sizeof(EHEnumState), "EEEHEnumState does not fit into EHEnumState"); bool Module::EHEnumInit(MethodInfo * pMethodInfo, PTR_VOID * pMethodStartAddressOut, EHEnumState * pEHEnumStateOut) { @@ -1414,7 +1384,7 @@ UInt32 StaticGcDesc::DacSize(TADDR addr) UInt32 GenericInstanceDesc::DacSize(TADDR addr) { - STATIC_ASSERT(offsetof(GenericInstanceDesc, m_Flags) == 0); + static_assert(offsetof(GenericInstanceDesc, m_Flags) == 0, "GenericInstanceDesc::m_Flags is expected to be at offset 0"); GenericInstanceDesc dummyDesc; DacReadAll(addr, &dummyDesc, sizeof(GenericInstanceDesc::OptionalFieldTypes), true); diff --git a/src/Native/Runtime/module.h b/src/Native/Runtime/module.h index 2ffe80e92..942b640a7 100644 --- a/src/Native/Runtime/module.h +++ b/src/Native/Runtime/module.h @@ -120,8 +120,6 @@ public: void UnsynchronizedResetHijackedLoops(); void UnsynchronizedHijackAllLoops(); - bool EHEnumInitFromReturnAddress(PTR_VOID ControlPC, PTR_VOID * pMethodStartAddressOut, EHEnumState * pEHEnumStateOut); - bool EHEnumInit(MethodInfo * pMethodInfo, PTR_VOID * pMethodStartAddressOut, EHEnumState * pEHEnumStateOut); bool EHEnumNext(EHEnumState * pEHEnumState, EHClause * pEHClauseOut); diff --git a/src/Native/Runtime/threadstore.cpp b/src/Native/Runtime/threadstore.cpp index 5106f0f2d..5735e57d2 100644 --- a/src/Native/Runtime/threadstore.cpp +++ b/src/Native/Runtime/threadstore.cpp @@ -9,7 +9,6 @@ #include "PalRedhawkCommon.h" #include "PalRedhawk.h" #include "assert.h" -#include "static_check.h" #include "slist.h" #include "gcrhinterface.h" #include "varint.h" |