]> granicus.if.org Git - gc/commitdiff
Replace _M_AMD64 macro with _M_X64
authorIvan Maidanski <ivmai@mail.ru>
Mon, 22 Jul 2019 06:40:29 +0000 (09:40 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Mon, 22 Jul 2019 06:40:29 +0000 (09:40 +0300)
(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().

extra/msvc_dbg.c
tests/test.c

index 7f6409d486288adbd9601ce557c5ab5627c46eea..66aee1f2152c9d821234bfbf11cfe55eda5f7d24 100644 (file)
@@ -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
index f6b69d2cd728719c5b641f53eb8d6397a89f4c75..3d861a14049189c2b4b8964f131d5ea18bacea7e 100644 (file)
@@ -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);