diff options
author | Max Kellermann <max@musicpd.org> | 2017-03-01 16:38:22 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2017-03-01 16:38:22 +0100 |
commit | e22a4fdba4fe06e3595145d75b31a81c3ce22a23 (patch) | |
tree | 0f0cdd63d7742ca2f0221f4574734bcefe934dc1 | |
parent | 29a7b2c5b58e8da1e78b3744cd3388dc2e4a6f88 (diff) |
command/Error: improve libstdc++ 4.9.x detection for std::rethrow_if_nested() workaround
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | src/command/CommandError.cxx | 27 |
2 files changed, 26 insertions, 2 deletions
@@ -1,6 +1,7 @@ ver 0.20.6 (not yet released) * decoder - mpcdec: fix crash (division by zero) after seeking +* workaround for GCC 4.9.4 / libstdc++ bug (build failure) ver 0.20.5 (2017/02/20) * tags diff --git a/src/command/CommandError.cxx b/src/command/CommandError.cxx index 7d8878c61..c52eb86ca 100644 --- a/src/command/CommandError.cxx +++ b/src/command/CommandError.cxx @@ -29,6 +29,29 @@ #include <assert.h> +#define GLIBCXX_490 20140422 +#define GLIBCXX_491 20140716 +#define GLIBCXX_492 20141030 +#define GLIBCXX_492_Debian_9 20141220 +#define GLIBCXX_493 20150626 +#define GLIBCXX_494 20160803 +#define GLIBCXX_49X_NDK_r13b 20150123 + +/* the big mess attempts to detect whether we're compiling with + libstdc++ 4.9.x; __GLIBCXX__ is a date tag and cannot be used to + check the major version; and just checking the compiler version + isn't enough, because somebody could use an old libstdc++ with + clang - SIGH! */ +#if GCC_OLDER_THAN(5,0) || (defined(__GLIBCXX__) && \ + (__GLIBCXX__ == GLIBCXX_490 || __GLIBCXX__ == GLIBCXX_491 || \ + __GLIBCXX__ == GLIBCXX_492 || \ + __GLIBCXX__ == GLIBCXX_492_Debian_9 || \ + __GLIBCXX__ == GLIBCXX_493 || \ + __GLIBCXX__ == GLIBCXX_494 || \ + __GLIBCXX__ == GLIBCXX_49X_NDK_r13b)) +#define GLIBCXX_49X +#endif + gcc_const static enum ack ToAck(PlaylistResult result) @@ -100,13 +123,13 @@ ToAck(std::exception_ptr ep) return ACK_ERROR_SYSTEM; } catch (const std::invalid_argument &e) { return ACK_ERROR_ARG; -#if defined(__GLIBCXX__) && __GLIBCXX__ < 20151204 +#ifdef GLIBCXX_49X } catch (const std::exception &e) { #else } catch (...) { #endif try { -#if defined(__GLIBCXX__) && __GLIBCXX__ < 20151204 +#ifdef GLIBCXX_49X /* workaround for g++ 4.x: no overload for rethrow_exception(exception_ptr) */ std::rethrow_if_nested(e); |