From: Ivan Maidanski Date: Mon, 22 Jul 2019 06:40:29 +0000 (+0300) Subject: Replace _M_AMD64 macro with _M_X64 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=85789fea7c6cbb477b36957efe3a185a8cad54f4;p=gc Replace _M_AMD64 macro with _M_X64 (code refactoring) Also, adjust strcat_s usage in msvc_dbg.c. * extra/msvc_dbg.c [_MSC_VER]: Check _M_X64 instead of _M_AMD64. * tests/test.c [CPPCHECK && _MSC_VER] (main): Likewise. * extra/msvc_dbg.c [_M_X64 && _MSC_VER<1200] (GetModuleBase): Use strcat() instead of strcat_s(). --- diff --git a/extra/msvc_dbg.c b/extra/msvc_dbg.c index 7f6409d4..66aee1f2 100644 --- a/extra/msvc_dbg.c +++ b/extra/msvc_dbg.c @@ -20,7 +20,7 @@ THE SOFTWARE. */ -#if !defined(_M_AMD64) && defined(_MSC_VER) +#if !defined(_M_X64) && defined(_MSC_VER) /* X86_64 is currently missing some meachine-dependent code below. */ @@ -90,12 +90,11 @@ static ULONG_ADDR CALLBACK GetModuleBase(HANDLE hProcess, ULONG_ADDR dwAddress) /* article Q189780. */ GetCurrentDirectoryA(sizeof(curDir), curDir); GetModuleFileNameA(NULL, exePath, sizeof(exePath)); -#if defined(_MSC_VER) && _MSC_VER == 1200 - /* use strcat for VC6 */ - strcat(exePath, "\\.."); -#else +#if _MSC_VER > 1200 strcat_s(exePath, sizeof(exePath), "\\.."); -#endif /* _MSC_VER >= 1200 */ +#else /* VC6 or earlier */ + strcat(exePath, "\\.."); +#endif SetCurrentDirectoryA(exePath); #ifdef _DEBUG GetCurrentDirectoryA(sizeof(exePath), exePath); @@ -393,4 +392,4 @@ char** backtrace_symbols(void*const* addresses, int count) extern int GC_quiet; /* ANSI C does not allow translation units to be empty. */ -#endif /* _M_AMD64 */ +#endif diff --git a/tests/test.c b/tests/test.c index f6b69d2c..3d861a14 100644 --- a/tests/test.c +++ b/tests/test.c @@ -1970,7 +1970,7 @@ void GC_CALLBACK warn_proc(char *msg, GC_word p) # if defined(MACOS) && defined(USE_TEMPORARY_MEMORY) UNTESTED(GC_MacTemporaryNewPtr); # endif -# if !defined(_M_AMD64) && defined(_MSC_VER) +# if !defined(_M_X64) && defined(_MSC_VER) UNTESTED(GetFileLineFromStack); UNTESTED(GetModuleNameFromStack); UNTESTED(GetSymbolNameFromStack);