diff options
author | Phil Christensen <philc@microsoft.com> | 2016-10-28 02:09:35 -0700 |
---|---|---|
committer | Jan Vorlicek <janvorli@microsoft.com> | 2016-10-28 11:09:35 +0200 |
commit | 8877516062414f770f6c97272c4fad43296202f6 (patch) | |
tree | 4347c3c8b6d8fd191dc71b8826f18798d4cbaee2 /src/ToolBox | |
parent | c4d899414fc9af1a22b9b38748d53b3e6e5eeb2b (diff) | |
download | coreclr-8877516062414f770f6c97272c4fad43296202f6.tar.gz coreclr-8877516062414f770f6c97272c4fad43296202f6.tar.bz2 coreclr-8877516062414f770f6c97272c4fad43296202f6.zip |
C++ conformance. (building with /permissive-) (#7855)
These issues were found when building with the /permissive- flag in the
latest version of MSVC. No tests were added/modified because this does not
change any behavior.
There are a few types of language conformance issues fixed in this:
1) Strict string conversion (this is also covered by the /Zc:strictStrings
flag)
The 'const' is not implicitly dropped by string literals, which means the
following is not allowed:
char str = "const string literal"; //error: cannot convert a 'const char'
to a 'char*'
This fix to to make str 'const char*'. (This can have a domino effect
depending on where str is used)
2) Fully qualified inline declarations members inside class
struct A {
void A::f() { } // Error: illegal qualified name in member declaration,
remove redundant 'A::' to fix
};
3) MSVC by default will allows name lookup in a dependent base. This is
disabled by /permissive-
template <class T> struct B {
void f();
};
template <class T> struct D
: public B<T> //B is a dependent base because its type depends on the type of T in D<T>.
{
//One possible fix is to uncomment the following line. If this
//were a type we should have 'using typename'...
//using B<T>::f;
void g() {
f(); //Error: identifier not found, one possible fix is change it to 'this->f();'
}
};
void h()
{
D<int> d;
d.g();
}
4) Warning 4800 has been removed in version 19.1 (1910) of the compiler.
For backwards compatability, surround the usage of 4800.
This is not related to C++ conformance.
#if _MSC_VER <= 1900
// 'BOOL' forcing value to bool 'true' or 'false'
#pragma warning(disable: 4800)
#endif
Diffstat (limited to 'src/ToolBox')
-rw-r--r-- | src/ToolBox/SOS/Strike/ExpressionNode.cpp | 20 | ||||
-rw-r--r-- | src/ToolBox/SOS/Strike/ExpressionNode.h | 14 | ||||
-rw-r--r-- | src/ToolBox/SOS/Strike/strike.cpp | 2 | ||||
-rw-r--r-- | src/ToolBox/SOS/Strike/vm.cpp | 10 | ||||
-rw-r--r-- | src/ToolBox/superpmi/superpmi-shared/compileresult.h | 2 | ||||
-rw-r--r-- | src/ToolBox/superpmi/superpmi-shared/methodcontext.h | 6 |
6 files changed, 27 insertions, 27 deletions
diff --git a/src/ToolBox/SOS/Strike/ExpressionNode.cpp b/src/ToolBox/SOS/Strike/ExpressionNode.cpp index 6516823aaa..920afbaedc 100644 --- a/src/ToolBox/SOS/Strike/ExpressionNode.cpp +++ b/src/ToolBox/SOS/Strike/ExpressionNode.cpp @@ -129,7 +129,7 @@ VOID ExpressionNode::DFSVisit(ExpressionNodeVisitorCallback pFunc, VOID* pUserDa // Creates a new expression with a given debuggee value and frame -ExpressionNode::ExpressionNode(__in_z WCHAR* pExpression, ICorDebugValue* pValue, ICorDebugILFrame* pFrame) +ExpressionNode::ExpressionNode(__in_z const WCHAR* pExpression, ICorDebugValue* pValue, ICorDebugILFrame* pFrame) { Init(pValue, NULL, pFrame); _snwprintf_s(pAbsoluteExpression, MAX_EXPRESSION, _TRUNCATE, L"%s", pExpression); @@ -137,7 +137,7 @@ ExpressionNode::ExpressionNode(__in_z WCHAR* pExpression, ICorDebugValue* pValue } // Creates a new expression that has an error and no value -ExpressionNode::ExpressionNode(__in_z WCHAR* pExpression, __in_z WCHAR* pErrorMessage) +ExpressionNode::ExpressionNode(__in_z const WCHAR* pExpression, __in_z const WCHAR* pErrorMessage) { Init(NULL, NULL, NULL); _snwprintf_s(pAbsoluteExpression, MAX_EXPRESSION, _TRUNCATE, L"%s", pExpression); @@ -146,7 +146,7 @@ ExpressionNode::ExpressionNode(__in_z WCHAR* pExpression, __in_z WCHAR* pErrorMe } // Creates a new child expression -ExpressionNode::ExpressionNode(__in_z WCHAR* pParentExpression, ChildKind ck, __in_z WCHAR* pRelativeExpression, ICorDebugValue* pValue, ICorDebugType* pType, ICorDebugILFrame* pFrame, UVCP_CONSTANT pDefaultValue, ULONG cchDefaultValue) +ExpressionNode::ExpressionNode(__in_z const WCHAR* pParentExpression, ChildKind ck, __in_z const WCHAR* pRelativeExpression, ICorDebugValue* pValue, ICorDebugType* pType, ICorDebugILFrame* pFrame, UVCP_CONSTANT pDefaultValue, ULONG cchDefaultValue) { Init(pValue, pType, pFrame); if(ck == ChildKind_BaseClass) @@ -1979,7 +1979,7 @@ HRESULT ExpressionNode::GetCanonicalElementTypeForTypeName(__in_z WCHAR* pTypeNa // Searches the debuggee for any ICorDebugType that matches the given fully qualified name // This will search across all AppDomains and Assemblies -HRESULT ExpressionNode::FindTypeByName(__in_z WCHAR* pTypeName, ICorDebugType** ppType) +HRESULT ExpressionNode::FindTypeByName(__in_z const WCHAR* pTypeName, ICorDebugType** ppType) { HRESULT Status = S_OK; ToRelease<ICorDebugAppDomainEnum> pAppDomainEnum; @@ -2001,7 +2001,7 @@ HRESULT ExpressionNode::FindTypeByName(__in_z WCHAR* pTypeName, ICorDebugType** // Searches the debuggee for any ICorDebugType that matches the given fully qualified name // This will search across all Assemblies in the given AppDomain -HRESULT ExpressionNode::FindTypeByName(ICorDebugAppDomain* pAppDomain, __in_z WCHAR* pTypeName, ICorDebugType** ppType) +HRESULT ExpressionNode::FindTypeByName(ICorDebugAppDomain* pAppDomain, __in_z const WCHAR* pTypeName, ICorDebugType** ppType) { HRESULT Status = S_OK; ToRelease<ICorDebugAssemblyEnum> pAssemblyEnum; @@ -2022,7 +2022,7 @@ HRESULT ExpressionNode::FindTypeByName(ICorDebugAppDomain* pAppDomain, __in_z WC } // Searches the assembly for any ICorDebugType that matches the given fully qualified name -HRESULT ExpressionNode::FindTypeByName(ICorDebugAssembly* pAssembly, __in_z WCHAR* pTypeName, ICorDebugType** ppType) +HRESULT ExpressionNode::FindTypeByName(ICorDebugAssembly* pAssembly, __in_z const WCHAR* pTypeName, ICorDebugType** ppType) { HRESULT Status = S_OK; ToRelease<ICorDebugModuleEnum> pModuleEnum; @@ -2043,7 +2043,7 @@ HRESULT ExpressionNode::FindTypeByName(ICorDebugAssembly* pAssembly, __in_z WCHA } // Searches a given module for any ICorDebugType that matches the given fully qualified type name -HRESULT ExpressionNode::FindTypeByName(ICorDebugModule* pModule, __in_z WCHAR* pTypeName, ICorDebugType** ppType) +HRESULT ExpressionNode::FindTypeByName(ICorDebugModule* pModule, __in_z const WCHAR* pTypeName, ICorDebugType** ppType) { HRESULT Status = S_OK; ToRelease<IUnknown> pMDUnknown; @@ -2054,7 +2054,7 @@ HRESULT ExpressionNode::FindTypeByName(ICorDebugModule* pModule, __in_z WCHAR* p // If the name contains a generic argument list, extract the type name from // before the list WCHAR rootName[mdNameLen]; - WCHAR* pRootName = NULL; + const WCHAR* pRootName = NULL; int typeNameLen = (int) _wcslen(pTypeName); int genericParamListStart = (int) _wcscspn(pTypeName, L"<"); if(genericParamListStart != typeNameLen) @@ -2107,11 +2107,11 @@ HRESULT ExpressionNode::FindTypeByName(ICorDebugModule* pModule, __in_z WCHAR* p } typeParams = new ToRelease<ICorDebugType>[countTypeParams]; - WCHAR* pCurName = pTypeName + genericParamListStart+1; + const WCHAR* pCurName = pTypeName + genericParamListStart+1; for(int i = 0; i < countTypeParams; i++) { WCHAR typeParamName[mdNameLen]; - WCHAR* pNextComma = _wcschr(pCurName, L','); + const WCHAR* pNextComma = _wcschr(pCurName, L','); int len = (pNextComma != NULL) ? (int)(pNextComma - pCurName) : (int)_wcslen(pCurName)-1; if(len > mdNameLen) return E_FAIL; diff --git a/src/ToolBox/SOS/Strike/ExpressionNode.h b/src/ToolBox/SOS/Strike/ExpressionNode.h index 507a8a53d3..48cc036729 100644 --- a/src/ToolBox/SOS/Strike/ExpressionNode.h +++ b/src/ToolBox/SOS/Strike/ExpressionNode.h @@ -134,13 +134,13 @@ private: }; // Creates a new expression with a given debuggee value and frame - ExpressionNode(__in_z WCHAR* pExpression, ICorDebugValue* pValue, ICorDebugILFrame* pFrame); + ExpressionNode(__in_z const WCHAR* pExpression, ICorDebugValue* pValue, ICorDebugILFrame* pFrame); // Creates a new expression that has an error and no value - ExpressionNode(__in_z WCHAR* pExpression, __in_z WCHAR* pErrorMessage); + ExpressionNode(__in_z const WCHAR* pExpression, __in_z const WCHAR* pErrorMessage); // Creates a new child expression - ExpressionNode(__in_z WCHAR* pParentExpression, ChildKind ck, __in_z WCHAR* pRelativeExpression, ICorDebugValue* pValue, ICorDebugType* pType, ICorDebugILFrame* pFrame, UVCP_CONSTANT pDefaultValue = NULL, ULONG cchDefaultValue = 0); + ExpressionNode(__in_z const WCHAR* pParentExpression, ChildKind ck, __in_z const WCHAR* pRelativeExpression, ICorDebugValue* pValue, ICorDebugType* pType, ICorDebugILFrame* pFrame, UVCP_CONSTANT pDefaultValue = NULL, ULONG cchDefaultValue = 0); // Common member initialization for the constructors VOID Init(ICorDebugValue* pValue, ICorDebugType* pTypeCast, ICorDebugILFrame* pFrame); @@ -288,17 +288,17 @@ private: // Searches the debuggee for any ICorDebugType that matches the given fully qualified name // This will search across all AppDomains and Assemblies - static HRESULT FindTypeByName(__in_z WCHAR* pTypeName, ICorDebugType** ppType); + static HRESULT FindTypeByName(__in_z const WCHAR* pTypeName, ICorDebugType** ppType); // Searches the debuggee for any ICorDebugType that matches the given fully qualified name // This will search across all Assemblies in the given AppDomain - static HRESULT FindTypeByName(ICorDebugAppDomain* pAppDomain, __in_z WCHAR* pTypeName, ICorDebugType** ppType); + static HRESULT FindTypeByName(ICorDebugAppDomain* pAppDomain, __in_z const WCHAR* pTypeName, ICorDebugType** ppType); // Searches the assembly for any ICorDebugType that matches the given fully qualified name - static HRESULT FindTypeByName(ICorDebugAssembly* pAssembly, __in_z WCHAR* pTypeName, ICorDebugType** ppType); + static HRESULT FindTypeByName(ICorDebugAssembly* pAssembly, __in_z const WCHAR* pTypeName, ICorDebugType** ppType); // Searches a given module for any ICorDebugType that matches the given fully qualified type name - static HRESULT FindTypeByName(ICorDebugModule* pModule, __in_z WCHAR* pTypeName, ICorDebugType** ppType); + static HRESULT FindTypeByName(ICorDebugModule* pModule, __in_z const WCHAR* pTypeName, ICorDebugType** ppType); // Checks whether the given token is or refers to type System.ValueType or System.Enum static HRESULT IsTokenValueTypeOrEnum(mdToken token, IMetaDataImport* pMetadata, BOOL* pResult); diff --git a/src/ToolBox/SOS/Strike/strike.cpp b/src/ToolBox/SOS/Strike/strike.cpp index 731e2f505d..e03e5187a0 100644 --- a/src/ToolBox/SOS/Strike/strike.cpp +++ b/src/ToolBox/SOS/Strike/strike.cpp @@ -9119,7 +9119,7 @@ DECLARE_API (ProcInfo) if (pFntGetProcessTimes && pFntGetProcessTimes (hProcess,&CreationTime,&ExitTime,&KernelTime,&UserTime)) { ExtOut("---------------------------------------\n"); ExtOut("Process Times\n"); - static char *Month[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", + static const char *Month[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; SYSTEMTIME SystemTime; FILETIME LocalFileTime; diff --git a/src/ToolBox/SOS/Strike/vm.cpp b/src/ToolBox/SOS/Strike/vm.cpp index e7e5701fc6..70e9210dbd 100644 --- a/src/ToolBox/SOS/Strike/vm.cpp +++ b/src/ToolBox/SOS/Strike/vm.cpp @@ -82,7 +82,7 @@ typedef struct _VM_STATS typedef struct PROTECT_MASK { DWORD Bit; - PSTR Name; + PCSTR Name; } PROTECT_MASK, *PPROTECT_MASK; @@ -324,7 +324,7 @@ PrintVmStatsHeader( VOID PrintIndividualStat( - ___in __in_z IN PSTR Name, + ___in __in_z IN PCSTR Name, IN PINDIVIDUAL_STAT Stat ) { @@ -379,7 +379,7 @@ PrintIndividualStat( VOID PrintVmStats( - ___in __in_z IN PSTR Name, + ___in __in_z IN PCSTR Name, IN PVM_STATS Stats ) { @@ -443,7 +443,7 @@ VmStateToString( size_t capacity_Buffer ) { - PSTR result; + PCSTR result; CHAR invalidStr[sizeof("12345678")]; switch( State ) @@ -478,7 +478,7 @@ VmTypeToString( size_t capacity_Buffer ) { - PSTR result; + PCSTR result; CHAR invalidStr[sizeof("12345678")]; switch( Type ) diff --git a/src/ToolBox/superpmi/superpmi-shared/compileresult.h b/src/ToolBox/superpmi/superpmi-shared/compileresult.h index 8fc3f7a352..87853f4cd3 100644 --- a/src/ToolBox/superpmi/superpmi-shared/compileresult.h +++ b/src/ToolBox/superpmi/superpmi-shared/compileresult.h @@ -203,7 +203,7 @@ public: void recReportInliningDecision(CORINFO_METHOD_HANDLE inlinerHnd, CORINFO_METHOD_HANDLE inlineeHnd, CorInfoInline inlineResult, const char * reason); void dmpReportInliningDecision(DWORD key, const Agnostic_ReportInliningDecision& value); - CorInfoInline CompileResult::repReportInliningDecision(CORINFO_METHOD_HANDLE inlinerHnd, CORINFO_METHOD_HANDLE inlineeHnd); + CorInfoInline repReportInliningDecision(CORINFO_METHOD_HANDLE inlinerHnd, CORINFO_METHOD_HANDLE inlineeHnd); void recSetEHcount(unsigned cEH); void dmpSetEHcount(DWORD key, DWORD value); diff --git a/src/ToolBox/superpmi/superpmi-shared/methodcontext.h b/src/ToolBox/superpmi/superpmi-shared/methodcontext.h index 5869c85b45..5885e2b7ca 100644 --- a/src/ToolBox/superpmi/superpmi-shared/methodcontext.h +++ b/src/ToolBox/superpmi/superpmi-shared/methodcontext.h @@ -513,9 +513,9 @@ public: void dmpGetMethodName(DLD key, DD value); const char *repGetMethodName(CORINFO_METHOD_HANDLE ftn, const char **moduleName); - void MethodContext::recGetJitFlags(CORJIT_FLAGS *jitFlags, DWORD sizeInBytes, DWORD result); - void MethodContext::dmpGetJitFlags(DWORD key, DD value); - DWORD MethodContext::repGetJitFlags(CORJIT_FLAGS *jitFlags, DWORD sizeInBytes); + void recGetJitFlags(CORJIT_FLAGS *jitFlags, DWORD sizeInBytes, DWORD result); + void dmpGetJitFlags(DWORD key, DD value); + DWORD repGetJitFlags(CORJIT_FLAGS *jitFlags, DWORD sizeInBytes); void recGetJitTimeLogFilename(LPCWSTR tempFileName); void dmpGetJitTimeLogFilename(DWORD key, DWORD value); |