Support timing with more Clang and libc++ versions (#3669) (#3698)

This commit is contained in:
Krzysztof Bieganski 2022-10-21 01:54:22 +02:00 committed by GitHub
parent b42799f3b5
commit 444a4a760c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -29,30 +29,27 @@
// clang-format off // clang-format off
// Some preprocessor magic to support both Clang and GCC coroutines with both libc++ and libstdc++ // Some preprocessor magic to support both Clang and GCC coroutines with both libc++ and libstdc++
#ifdef __clang__ #if defined _LIBCPP_VERSION // libc++
# if __clang_major__ < 14 # if __clang_major__ > 13 // Clang > 13 warns that coroutine types in std::experimental are deprecated
# ifdef __GLIBCXX__ // Using stdlibc++ # pragma clang diagnostic push
# define __cpp_impl_coroutine 1 // Clang doesn't define this, but it's needed for libstdc++ # pragma clang diagnostic ignored "-Wdeprecated-experimental-coroutine"
# include <coroutine> # endif
namespace std { // Bring coroutine library into std::experimental, as Clang < 14 expects it to be there # include <experimental/coroutine>
namespace experimental { namespace std {
using namespace std; using namespace experimental; // Bring std::experimental into the std namespace
} }
} #else
# else // Using libc++ # if defined __clang__ && defined __GLIBCXX__
# include <experimental/coroutine> // Clang older than 14, coroutines are under experimental # define __cpp_impl_coroutine 1 // Clang doesn't define this, but it's needed for libstdc++
namespace std {
using namespace experimental; // Bring std::experimental into the std namespace
}
# endif
# else // Clang >= 14
# if __GLIBCXX__ // Using stdlibc++
# define __cpp_impl_coroutine 1 // Clang doesn't define this, but it's needed for libstdc++
# endif
# include <coroutine>
# endif # endif
#else // Not Clang
# include <coroutine> # include <coroutine>
# if __clang_major__ < 14
namespace std { // Bring coroutine library into std::experimental, as Clang < 14 expects it to be there
namespace experimental {
using namespace std;
}
}
# endif
#endif #endif
// clang-format on // clang-format on