Work around unavailability of std::exception_ptr with some g++ versions.

g++ headers only provide std::exception_ptr when __GCC_ATOMIC_INT_LOCK_FREE is
2, indicating that atomic operations on int are available, so check for this
before setting HAS_EXCEPTION_PTR as in some MinGW builds (TDM gcc 4.7) this
symbol is not defined as 2.

Closes #16634.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78035 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-10-19 12:56:42 +00:00
parent 3b1de0dc8b
commit b8f5856171

View File

@@ -51,8 +51,23 @@
// Do we have a C++ compiler with enough C++11 support for
// std::exception_ptr and functions working with it?
#if __cplusplus >= 201103L
// Any conforming C++11 compiler should have it.
#define HAS_EXCEPTION_PTR
// Any conforming C++11 compiler should have it, but g++ implementation
// of exception handling depends on the availability of the atomic int
// operations apparently, so all known version of g++ with C++11 support
// (4.7..4.9) fail to provide exception_ptr if the symbol below is not
// set to 2 (meaning "always available"), which is notably the case for
// MinGW-w64 without -march=486 switch, see #16634.
#ifdef __GNUC__
// This symbol is always defined in the known g++ version, so
// assume that if it isn't defined, things changed for the better
// and optimistically suppose that exception_ptr is available.
#if !defined(__GCC_ATOMIC_INT_LOCK_FREE) \
|| __GCC_ATOMIC_INT_LOCK_FREE > 1
#define HAS_EXCEPTION_PTR
#endif
#else
#define HAS_EXCEPTION_PTR
#endif
#elif wxCHECK_VISUALC_VERSION(11)
// VC++ supports it since version 10, even though it doesn't define
// __cplusplus to C++11 value, but MSVC 2010 doesn't have a way to test