Common/Network: Resolve -Wexpansion-to-defined warning

Macros that expand to include the standard define macro are undefined.
This is pretty trivial to fix. We can just do the test and then define
the name itself if it's true, rather than making the set of definition
checks the macro itself.
This commit is contained in:
Lioncash 2023-01-30 14:00:19 -05:00
parent 8960f6f07c
commit cdd3e636e1
1 changed files with 8 additions and 4 deletions

View File

@ -550,16 +550,20 @@ void RestoreNetworkErrorState(const NetworkErrorState& state)
const char* DecodeNetworkError(s32 error_code) const char* DecodeNetworkError(s32 error_code)
{ {
thread_local char buffer[1024]; thread_local char buffer[1024];
#define IS_BSD_STRERROR \
defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(ANDROID) || \ #if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(ANDROID) || \
defined(__APPLE__) defined(__APPLE__)
#define IS_BSD_STRERROR
#endif
#ifdef _WIN32 #ifdef _WIN32
FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS | FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS |
FORMAT_MESSAGE_MAX_WIDTH_MASK, FORMAT_MESSAGE_MAX_WIDTH_MASK,
nullptr, error_code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), buffer, nullptr, error_code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), buffer,
sizeof(buffer), nullptr); sizeof(buffer), nullptr);
return buffer; return buffer;
#elif (IS_BSD_STRERROR) || ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !_GNU_SOURCE) #elif defined(IS_BSD_STRERROR) || \
((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !_GNU_SOURCE)
strerror_r(error_code, buffer, sizeof(buffer)); strerror_r(error_code, buffer, sizeof(buffer));
return buffer; return buffer;
#else #else