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/utilcode | |
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/utilcode')
-rw-r--r-- | src/utilcode/longfilepathwrappers.cpp | 4 | ||||
-rw-r--r-- | src/utilcode/opinfo.cpp | 5 | ||||
-rw-r--r-- | src/utilcode/stacktrace.cpp | 4 |
3 files changed, 4 insertions, 9 deletions
diff --git a/src/utilcode/longfilepathwrappers.cpp b/src/utilcode/longfilepathwrappers.cpp index 9ffbf27cc8..5272d35807 100644 --- a/src/utilcode/longfilepathwrappers.cpp +++ b/src/utilcode/longfilepathwrappers.cpp @@ -19,8 +19,8 @@ private: static const WCHAR VolumeSeparatorChar; #define UNCPATHPREFIX W("\\\\") #endif //FEATURE_PAL - static const WCHAR LongFile::DirectorySeparatorChar; - static const WCHAR LongFile::AltDirectorySeparatorChar; + static const WCHAR DirectorySeparatorChar; + static const WCHAR AltDirectorySeparatorChar; public: static BOOL IsExtended(SString & path); static BOOL IsUNCExtended(SString & path); diff --git a/src/utilcode/opinfo.cpp b/src/utilcode/opinfo.cpp index 9d5ff202ff..60da66047a 100644 --- a/src/utilcode/opinfo.cpp +++ b/src/utilcode/opinfo.cpp @@ -14,13 +14,8 @@ OpInfo::OpInfoData OpInfo::table[] = { -#ifdef _MSC_VER -#define OPDEF(c,s,pop,push,args,type,l,s1,s2,ctrl) \ - { s, args + type, FLOW_ ## ctrl, pop, push, c }, -#else #define OPDEF(c,s,pop,push,args,type,l,s1,s2,ctrl) \ { s, (OPCODE_FORMAT) (args + type), FLOW_ ## ctrl, pop, push, c }, -#endif // Kind of a workaround, get the prefixes (IInternal) to return InlineOpcode instead of InlineNone #define IInternal (InlineOpcode - InlineNone) diff --git a/src/utilcode/stacktrace.cpp b/src/utilcode/stacktrace.cpp index 7bfdb4514a..858fac723e 100644 --- a/src/utilcode/stacktrace.cpp +++ b/src/utilcode/stacktrace.cpp @@ -208,7 +208,7 @@ typedef DWORD (_stdcall *pfnImgHlp_SymGetOptions)( struct IMGHLPFN_LOAD { - LPSTR pszFnName; + LPCSTR pszFnName; LPVOID * ppvfn; }; @@ -520,7 +520,7 @@ DWORD_PTR dwAddr } CHAR rgchUndec[256]; - CHAR * pszSymbol = NULL; + const CHAR * pszSymbol = NULL; // Name field of IMAGEHLP_SYMBOL is dynamically sized. // Pad with space for 255 characters. |