gsdx: Use char array instead of string for name

"static string str;" causes a SIGILL signal on a "Nehalem" (SSE4.2)
QEMU VM when compiled with GCC 6.1.1.
This commit is contained in:
Jonathan Li 2016-07-23 23:19:30 +01:00
parent 46ba9aa117
commit 7e30d16797
1 changed files with 50 additions and 48 deletions

View File

@ -35,58 +35,60 @@
const char* GSUtil::GetLibName()
{
// TODO: critsec
// The following ifdef mess is courtesy of "static string str;"
// being optimised by GCC to be unusable by older CPUs. Enjoy!
static char name[255];
static string str;
if(str.empty())
{
str = "GSdx";
snprintf(name, sizeof(name), "GSdx "
#ifdef _WIN32
str += format(" %lld", SVN_REV);
if(SVN_MODS) str += "m";
"%lld "
#endif
#ifdef _M_AMD64
str += " 64-bit";
"64-bit "
#endif
list<string> sl;
#ifdef __INTEL_COMPILER
sl.push_back(format("Intel C++ %d.%02d", __INTEL_COMPILER / 100, __INTEL_COMPILER % 100));
"(Intel C++ %d.%02d %s)",
#elif _MSC_VER
sl.push_back(format("MSVC %d.%02d", _MSC_VER / 100, _MSC_VER % 100));
"(MSVC %d.%02d %s)",
#elif __clang__
"(clang %d.%d.%d %s)",
#elif __GNUC__
sl.push_back(format("GCC %d.%d.%d", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__));
"(GCC %d.%d.%d %s)",
#else
"(%s)",
#endif
#ifdef _WIN32
SVN_REV,
#endif
#ifdef __INTEL_COMPILER
__INTEL_COMPILER / 100, __INTEL_COMPILER % 100,
#elif _MSC_VER
_MSC_VER / 100, _MSC_VER % 100,
#elif __clang__
__clang_major__, __clang_minor__, __clang_patchlevel__,
#elif __GNUC__
__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__,
#endif
#if _M_SSE >= 0x501
sl.push_back("AVX2");
"AVX2"
#elif _M_SSE >= 0x500
sl.push_back("AVX");
"AVX"
#elif _M_SSE >= 0x402
sl.push_back("SSE42");
"SSE4.2"
#elif _M_SSE >= 0x401
sl.push_back("SSE41");
"SSE4.1"
#elif _M_SSE >= 0x301
sl.push_back("SSSE3");
"SSSE3"
#elif _M_SSE >= 0x200
sl.push_back("SSE2");
"SSE2"
#elif _M_SSE >= 0x100
sl.push_back("SSE");
"SSE"
#endif
);
for(list<string>::iterator i = sl.begin(); i != sl.end(); )
{
if(i == sl.begin()) str += " (";
str += *i;
str += ++i != sl.end() ? ", " : ")";
}
}
return str.c_str();
return name;
}
static class GSUtilMaps