diff options
| author | Lioncash <mai.iam2048@gmail.com> | 2023-01-30 14:00:19 -0500 |
|---|---|---|
| committer | Lioncash <mai.iam2048@gmail.com> | 2023-01-30 14:20:56 -0500 |
| commit | cdd3e636e1f4b06ca3e2f3c279c420900b4db0b4 (patch) | |
| tree | 217637fdf9c7080bf692fae65c394a8b9ed92eff /Source/Core/Common/Network.cpp | |
| parent | 8960f6f07c07f26767a3ef07c402b8c457b9b621 (diff) | |
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.
Diffstat (limited to 'Source/Core/Common/Network.cpp')
| -rw-r--r-- | Source/Core/Common/Network.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/Source/Core/Common/Network.cpp b/Source/Core/Common/Network.cpp index 0346fe427d..a5e56b74d2 100644 --- a/Source/Core/Common/Network.cpp +++ b/Source/Core/Common/Network.cpp @@ -550,16 +550,20 @@ void RestoreNetworkErrorState(const NetworkErrorState& state) const char* DecodeNetworkError(s32 error_code) { thread_local char buffer[1024]; -#define IS_BSD_STRERROR \ - defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(ANDROID) || \ - defined(__APPLE__) + +#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(ANDROID) || \ + defined(__APPLE__) +#define IS_BSD_STRERROR +#endif + #ifdef _WIN32 FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_MAX_WIDTH_MASK, nullptr, error_code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), buffer, sizeof(buffer), nullptr); 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)); return buffer; #else |
