Compile LDC2 with VS2010 64bit (LDC changes only).

Contains all changes necessary to LDC specific source to compile LDC2 with VS2010. See https://github.com/D-Programming-Language/dmd/pull/516 for necessary changes to DMDFE.
This commit is contained in:
kai
2012-01-11 07:49:21 +01:00
parent 43057c64ec
commit 6726b5da13
9 changed files with 93 additions and 15 deletions

View File

@@ -62,12 +62,35 @@ namespace Logger
else
return 0;
}
#if defined(_MSC_VER)
static inline void
search_and_replace(std::string& str, const std::string& what, const std::string& replacement)
{
assert(!what.empty());
size_t pos = str.find(what);
while (pos != std::string::npos)
{
str.replace(pos, what.size(), replacement);
pos = str.find(what, pos + replacement.size());
}
}
#define WORKAROUND_C99_SPECIFIERS_BUG(f) \
std::string tmp = f; \
search_and_replace(tmp, std::string("%z"), std::string("%I")); \
f = tmp.c_str();
#else
#define WORKAROUND_C99_SPECIFIERS_BUG(f)
#endif
void println(const char* fmt,...)
{
if (_enabled) {
printf("%s", indent_str.c_str());
va_list va;
va_start(va,fmt);
WORKAROUND_C99_SPECIFIERS_BUG(fmt);
vprintf(fmt,va);
va_end(va);
printf("\n");
@@ -79,6 +102,7 @@ namespace Logger
printf("%s", indent_str.c_str());
va_list va;
va_start(va,fmt);
WORKAROUND_C99_SPECIFIERS_BUG(fmt);
vprintf(fmt,va);
va_end(va);
}