diff options
author | theraven <theraven@FreeBSD.org> | 2013-07-10 16:28:24 +0000 |
---|---|---|
committer | theraven <theraven@FreeBSD.org> | 2013-07-10 16:28:24 +0000 |
commit | 214e4f8fe625ad54aac3b215909e0b994a5768ec (patch) | |
tree | f757844d307e5ebbf92ab857f2376cceb7807147 /contrib/libc++/include/future | |
parent | c660176671bf640bee3fd09dbfa32ad187a9b942 (diff) | |
download | FreeBSD-src-214e4f8fe625ad54aac3b215909e0b994a5768ec.zip FreeBSD-src-214e4f8fe625ad54aac3b215909e0b994a5768ec.tar.gz |
Import new libcxxrt / libc++. This brings some bug fixes, including a potential race condition for static initialisers.
Diffstat (limited to 'contrib/libc++/include/future')
-rw-r--r-- | contrib/libc++/include/future | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/contrib/libc++/include/future b/contrib/libc++/include/future index 3d7bb6c..dae1a4b 100644 --- a/contrib/libc++/include/future +++ b/contrib/libc++/include/future @@ -403,6 +403,72 @@ _LIBCPP_DECLARE_STRONG_ENUM(launch) }; _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(launch) +#ifndef _LIBCPP_HAS_NO_STRONG_ENUMS + +#ifdef _LIBCXX_UNDERLYING_TYPE +typedef underlying_type<launch>::type __launch_underlying_type; +#else +typedef int __launch_underlying_type; +#endif + +inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR +launch +operator&(launch __x, launch __y) +{ + return static_cast<launch>(static_cast<__launch_underlying_type>(__x) & + static_cast<__launch_underlying_type>(__y)); +} + +inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR +launch +operator|(launch __x, launch __y) +{ + return static_cast<launch>(static_cast<__launch_underlying_type>(__x) | + static_cast<__launch_underlying_type>(__y)); +} + +inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR +launch +operator^(launch __x, launch __y) +{ + return static_cast<launch>(static_cast<__launch_underlying_type>(__x) ^ + static_cast<__launch_underlying_type>(__y)); +} + +inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR +launch +operator~(launch __x) +{ + return static_cast<launch>(~static_cast<__launch_underlying_type>(__x) & 3); +} + +inline _LIBCPP_INLINE_VISIBILITY +launch& +operator&=(launch& __x, launch __y) +{ + __x = __x & __y; return __x; +} + +inline _LIBCPP_INLINE_VISIBILITY +launch& +operator|=(launch& __x, launch __y) +{ + __x = __x | __y; return __x; +} + +inline _LIBCPP_INLINE_VISIBILITY +launch& +operator^=(launch& __x, launch __y) +{ + __x = __x ^ __y; return __x; +} + +#endif // !_LIBCPP_HAS_NO_STRONG_ENUMS + //enum class future_status _LIBCPP_DECLARE_STRONG_ENUM(future_status) { |