From a4199b808fd678f74935d540490eae9dc78a9ffe Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 13 Dec 2016 16:39:58 +0200 Subject: Fix thread safety issue --- butl/config | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 butl/config (limited to 'butl/config') diff --git a/butl/config b/butl/config new file mode 100644 index 0000000..71ebd23 --- /dev/null +++ b/butl/config @@ -0,0 +1,47 @@ +// file : butl/config -*- C++ -*- +// copyright : Copyright (c) 2014-2016 Code Synthesis Ltd +// license : MIT; see accompanying LICENSE file + +#ifndef BUTL_CONFIG +#define BUTL_CONFIG + +#include // _LIBCPP_VERSION, __GLIBCXX__ + +// thread_local +// +// If this macro is undefined then we assume one can use __thread but only +// for values that do not require dynamic (runtime) initialization. +// +// Apparently Apple's Clang "temporarily disabled" C++11 thread_local +// until they can implement a "fast" version, which reportedly happened in +// XCode 8. So for now we will continue using __thread for this target. +// +#ifdef __apple_build_version__ +# if __apple_build_version__ >= 8000000 +# define BUTL_CXX11_THREAD_LOCAL +# endif +#else +# define BUTL_CXX11_THREAD_LOCAL +#endif + +// std::uncaught_exceptions() +// +// VC has it since 1900 which is the lowest version we support. +// +#if defined(_MSC_VER) +# define BUTL_CXX17_UNCAUGHT_EXCEPTIONS +// +// Clang's libc++ seems to have it for a while so we assume it's there (it +// doesn't define a feature test macros). +// +#elif defined(_LIBCPP_VERSION) +# define BUTL_CXX17_UNCAUGHT_EXCEPTIONS +// +// GCC libstdc++ has it since GCC 6 and it defines the feature test macro. +// We will also use this for any other runtime. +// +#elif defined(__cpp_lib_uncaught_exceptions) +# define BUTL_CXX17_UNCAUGHT_EXCEPTIONS +#endif + +#endif // BUTL_CONFIG -- cgit v1.1