Tested x86_64-linux, committed to trunk and the 4.9 branch.
commit 6e201632e6b99a8381ec973ae77a9b4e1db255d7 Author: Jonathan Wakely <jwak...@redhat.com> Date: Mon Dec 8 16:02:48 2014 +0000
PR libstdc++/64203 * include/std/shared_mutex: Fix preprocessor conditions. * testsuite/experimental/feat-cxx14.cc: Check conditions. diff --git a/libstdc++-v3/include/std/shared_mutex b/libstdc++-v3/include/std/shared_mutex index 6405f10..c193eb2 100644 --- a/libstdc++-v3/include/std/shared_mutex +++ b/libstdc++-v3/include/std/shared_mutex @@ -36,10 +36,8 @@ #else #include <bits/c++config.h> -#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) -# include <mutex> -# include <condition_variable> -#endif +#include <mutex> +#include <condition_variable> #include <bits/functexcept.h> namespace std _GLIBCXX_VISIBILITY(default) @@ -51,7 +49,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION * @{ */ -#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) +#ifdef _GLIBCXX_USE_C99_STDINT_TR1 +#ifdef _GLIBCXX_HAS_GTHREADS #define __cpp_lib_shared_timed_mutex 201402 @@ -254,7 +253,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } } }; -#endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1 +#endif // _GLIBCXX_HAS_GTHREADS /// shared_lock template<typename _Mutex> @@ -393,6 +392,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION swap(shared_lock<_Mutex>& __x, shared_lock<_Mutex>& __y) noexcept { __x.swap(__y); } +#endif // _GLIBCXX_USE_C99_STDINT_TR1 + // @} group mutexes _GLIBCXX_END_NAMESPACE_VERSION } // namespace diff --git a/libstdc++-v3/testsuite/experimental/feat-cxx14.cc b/libstdc++-v3/testsuite/experimental/feat-cxx14.cc index 1c590dd..2cc31ca 100644 --- a/libstdc++-v3/testsuite/experimental/feat-cxx14.cc +++ b/libstdc++-v3/testsuite/experimental/feat-cxx14.cc @@ -106,10 +106,12 @@ # error "<shared_mutex>" #endif -#ifndef __cpp_lib_shared_timed_mutex -# error "__cpp_lib_shared_timed_mutex" -#elif __cpp_lib_shared_timed_mutex != 201402 -# error "__cpp_lib_shared_timed_mutex != 201402" +#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) +# ifndef __cpp_lib_shared_timed_mutex +# error "__cpp_lib_shared_timed_mutex" +# elif __cpp_lib_shared_timed_mutex != 201402 +# error "__cpp_lib_shared_timed_mutex != 201402" +# endif #endif #ifndef __cpp_lib_is_final