From 9824a3a1f8df9c71493e353f49a5b630695753ee Mon Sep 17 00:00:00 2001 From: kai Date: Fri, 15 Jun 2012 12:13:27 +0200 Subject: [PATCH] 2nd attempt to compile ldmd with MSVC. This reverts the previous commits and reduces MSVC odditites to a single place. --- driver/ldmd.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/driver/ldmd.cpp b/driver/ldmd.cpp index 6a9f5994..c827ec47 100644 --- a/driver/ldmd.cpp +++ b/driver/ldmd.cpp @@ -50,9 +50,6 @@ #include #include #include -#if defined(_MSC_VER) -#include -#endif #include "llvm/Support/FileSystem.h" #include "llvm/Support/Program.h" #include "llvm/Support/SystemUtils.h" @@ -62,10 +59,6 @@ # include #endif -#if defined(_MSC_VER) -#define snprintf _snprintf -#endif - namespace ls = llvm::sys; // We reuse DMD's response file parsing routine for maximum compatibilty - it @@ -114,7 +107,11 @@ char* concat(const char* a, const char* b) char* concat(const char* a, int b) { char bStr[14]; +#if defined(_MSC_VER) + _snprintf_s(bStr, _countof(bStr), sizeof(bStr), "%d", b); +#else snprintf(bStr, sizeof(bStr), "%d", b); +#endif return concat(a, bStr); }