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); }