Author: Arthur O'Dwyer Date: 2020-12-03T15:01:38-05:00 New Revision: d430330788c646afcb2c32c8f24c63210b518a32
URL: https://github.com/llvm/llvm-project/commit/d430330788c646afcb2c32c8f24c63210b518a32 DIFF: https://github.com/llvm/llvm-project/commit/d430330788c646afcb2c32c8f24c63210b518a32.diff LOG: [libc++] Update and normalize the "all the headers" tests. Some C++20 headers weren't added properly to all three of these test files. Add them, and take the time to normalize the formatting so that diff <(grep '#include' foo.cpp) <(grep '#include' bar.cpp) shows no diffs (except that `no_assert_include` deliberately excludes `<cassert>`). - Add macro guards to <{barrier,latch,semaphore}>. - Add macro guards to <experimental/simd>. - Remove an include of <cassert> from <semaphore>. - Instead, include <cassert> in the semaphore tests. Differential Revision: https://reviews.llvm.org/D92525 Added: Modified: libcxx/include/barrier libcxx/include/experimental/simd libcxx/include/latch libcxx/include/semaphore libcxx/test/libcxx/double_include.sh.cpp libcxx/test/libcxx/min_max_macros.compile.pass.cpp libcxx/test/libcxx/no_assert_include.compile.pass.cpp libcxx/test/std/thread/thread.semaphore/timed.pass.cpp libcxx/test/std/thread/thread.semaphore/try_acquire.pass.cpp Removed: ################################################################################ diff --git a/libcxx/include/barrier b/libcxx/include/barrier index 987ff0aa5c1d..ba9e8ea9bb84 100644 --- a/libcxx/include/barrier +++ b/libcxx/include/barrier @@ -58,6 +58,9 @@ namespace std # error <barrier> is not supported on this single threaded system #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 14 _LIBCPP_BEGIN_NAMESPACE_STD @@ -320,4 +323,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 14 +_LIBCPP_POP_MACROS + #endif //_LIBCPP_BARRIER diff --git a/libcxx/include/experimental/simd b/libcxx/include/experimental/simd index 39ac35e4eb0a..41f8f799a0b0 100644 --- a/libcxx/include/experimental/simd +++ b/libcxx/include/experimental/simd @@ -659,6 +659,9 @@ public: #pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_SIMD #if _LIBCPP_STD_VER >= 17 @@ -1566,4 +1569,6 @@ public: _LIBCPP_END_NAMESPACE_EXPERIMENTAL_SIMD +_LIBCPP_POP_MACROS + #endif /* _LIBCPP_EXPERIMENTAL_SIMD */ diff --git a/libcxx/include/latch b/libcxx/include/latch index 67fca97ac778..b338f091316c 100644 --- a/libcxx/include/latch +++ b/libcxx/include/latch @@ -50,6 +50,9 @@ namespace std # error <latch> is not supported on this single threaded system #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 14 _LIBCPP_BEGIN_NAMESPACE_STD @@ -102,4 +105,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 14 +_LIBCPP_POP_MACROS + #endif //_LIBCPP_LATCH diff --git a/libcxx/include/semaphore b/libcxx/include/semaphore index 8f6316273bff..0943606e93d2 100644 --- a/libcxx/include/semaphore +++ b/libcxx/include/semaphore @@ -49,7 +49,6 @@ using binary_semaphore = counting_semaphore<1>; #include <__availability> #include <__threading_support> #include <atomic> -#include <cassert> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header @@ -59,6 +58,9 @@ using binary_semaphore = counting_semaphore<1>; # error <semaphore> is not supported on this single threaded system #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #if _LIBCPP_STD_VER >= 14 _LIBCPP_BEGIN_NAMESPACE_STD @@ -233,4 +235,6 @@ _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER >= 14 +_LIBCPP_POP_MACROS + #endif //_LIBCPP_SEMAPHORE diff --git a/libcxx/test/libcxx/double_include.sh.cpp b/libcxx/test/libcxx/double_include.sh.cpp index ba571e1d6283..39851cc379d4 100644 --- a/libcxx/test/libcxx/double_include.sh.cpp +++ b/libcxx/test/libcxx/double_include.sh.cpp @@ -30,9 +30,9 @@ #include <array> #ifndef _LIBCPP_HAS_NO_THREADS #include <atomic> -#include <latch> +#endif +#ifndef _LIBCPP_HAS_NO_THREADS #include <barrier> -#include <semaphore> #endif #include <bit> #include <bitset> @@ -83,6 +83,9 @@ #include <inttypes.h> #include <iosfwd> #include <iterator> +#ifndef _LIBCPP_HAS_NO_THREADS +#include <latch> +#endif #include <limits> #include <limits.h> #include <list> @@ -100,6 +103,9 @@ #include <random> #include <ratio> #include <scoped_allocator> +#ifndef _LIBCPP_HAS_NO_THREADS +#include <semaphore> +#endif #include <set> #include <setjmp.h> #ifndef _LIBCPP_HAS_NO_THREADS @@ -170,8 +176,8 @@ #include <experimental/map> #include <experimental/memory_resource> #include <experimental/propagate_const> -#include <experimental/simd> #include <experimental/set> +#include <experimental/simd> #include <experimental/string> #include <experimental/type_traits> #include <experimental/unordered_map> diff --git a/libcxx/test/libcxx/min_max_macros.compile.pass.cpp b/libcxx/test/libcxx/min_max_macros.compile.pass.cpp index 7c1956b7476f..da7e857fc6ff 100644 --- a/libcxx/test/libcxx/min_max_macros.compile.pass.cpp +++ b/libcxx/test/libcxx/min_max_macros.compile.pass.cpp @@ -33,6 +33,12 @@ TEST_MACROS(); #include <atomic> TEST_MACROS(); #endif +#ifndef _LIBCPP_HAS_NO_THREADS +#include <barrier> +TEST_MACROS(); +#endif +#include <bit> +TEST_MACROS(); #include <bitset> TEST_MACROS(); #include <cassert> @@ -59,10 +65,14 @@ TEST_MACROS(); TEST_MACROS(); #include <cmath> TEST_MACROS(); +#include <compare> +TEST_MACROS(); #include <complex> TEST_MACROS(); #include <complex.h> TEST_MACROS(); +#include <concepts> +TEST_MACROS(); #include <condition_variable> TEST_MACROS(); #include <csetjmp> @@ -99,6 +109,10 @@ TEST_MACROS(); TEST_MACROS(); #include <exception> TEST_MACROS(); +#include <execution> +TEST_MACROS(); +#include <fenv.h> +TEST_MACROS(); #include <filesystem> TEST_MACROS(); #include <float.h> @@ -119,6 +133,10 @@ TEST_MACROS(); TEST_MACROS(); #include <iterator> TEST_MACROS(); +#ifndef _LIBCPP_HAS_NO_THREADS +#include <latch> +TEST_MACROS(); +#endif #include <limits> TEST_MACROS(); #include <limits.h> @@ -137,6 +155,8 @@ TEST_MACROS(); #endif #include <new> TEST_MACROS(); +#include <numbers> +TEST_MACROS(); #include <numeric> TEST_MACROS(); #include <optional> @@ -149,6 +169,10 @@ TEST_MACROS(); TEST_MACROS(); #include <scoped_allocator> TEST_MACROS(); +#ifndef _LIBCPP_HAS_NO_THREADS +#include <semaphore> +TEST_MACROS(); +#endif #include <set> TEST_MACROS(); #include <setjmp.h> @@ -207,6 +231,8 @@ TEST_MACROS(); TEST_MACROS(); #include <vector> TEST_MACROS(); +#include <version> +TEST_MACROS(); #include <wchar.h> TEST_MACROS(); #include <wctype.h> @@ -251,6 +277,10 @@ TEST_MACROS(); #if __cplusplus >= 201103L #include <experimental/algorithm> TEST_MACROS(); +#if defined(__cpp_coroutines) +#include <experimental/coroutine> +TEST_MACROS(); +#endif #include <experimental/deque> TEST_MACROS(); #include <experimental/filesystem> @@ -271,6 +301,8 @@ TEST_MACROS(); TEST_MACROS(); #include <experimental/set> TEST_MACROS(); +#include <experimental/simd> +TEST_MACROS(); #include <experimental/string> TEST_MACROS(); #include <experimental/type_traits> diff --git a/libcxx/test/libcxx/no_assert_include.compile.pass.cpp b/libcxx/test/libcxx/no_assert_include.compile.pass.cpp index 9ad87e0184ae..71842dcc5038 100644 --- a/libcxx/test/libcxx/no_assert_include.compile.pass.cpp +++ b/libcxx/test/libcxx/no_assert_include.compile.pass.cpp @@ -25,6 +25,9 @@ #ifndef _LIBCPP_HAS_NO_THREADS #include <atomic> #endif +#ifndef _LIBCPP_HAS_NO_THREADS +#include <barrier> +#endif #include <bit> #include <bitset> #include <ccomplex> @@ -41,6 +44,7 @@ #include <compare> #include <complex> #include <complex.h> +#include <concepts> #include <condition_variable> #include <csetjmp> #include <csignal> @@ -72,6 +76,9 @@ #include <inttypes.h> #include <iosfwd> #include <iterator> +#ifndef _LIBCPP_HAS_NO_THREADS +#include <latch> +#endif #include <limits> #include <limits.h> #include <list> @@ -82,12 +89,16 @@ #include <mutex> #endif #include <new> +#include <numbers> #include <numeric> #include <optional> #include <queue> #include <random> #include <ratio> #include <scoped_allocator> +#ifndef _LIBCPP_HAS_NO_THREADS +#include <semaphore> +#endif #include <set> #include <setjmp.h> #ifndef _LIBCPP_HAS_NO_THREADS @@ -158,8 +169,8 @@ #include <experimental/map> #include <experimental/memory_resource> #include <experimental/propagate_const> -#include <experimental/simd> #include <experimental/set> +#include <experimental/simd> #include <experimental/string> #include <experimental/type_traits> #include <experimental/unordered_map> diff --git a/libcxx/test/std/thread/thread.semaphore/timed.pass.cpp b/libcxx/test/std/thread/thread.semaphore/timed.pass.cpp index 281e3b47ccef..a0f4ee036e59 100644 --- a/libcxx/test/std/thread/thread.semaphore/timed.pass.cpp +++ b/libcxx/test/std/thread/thread.semaphore/timed.pass.cpp @@ -25,6 +25,7 @@ #include <semaphore> #include <thread> #include <chrono> +#include <cassert> #include "make_test_thread.h" #include "test_macros.h" diff --git a/libcxx/test/std/thread/thread.semaphore/try_acquire.pass.cpp b/libcxx/test/std/thread/thread.semaphore/try_acquire.pass.cpp index 9b387c95e3af..1835db05e18e 100644 --- a/libcxx/test/std/thread/thread.semaphore/try_acquire.pass.cpp +++ b/libcxx/test/std/thread/thread.semaphore/try_acquire.pass.cpp @@ -22,6 +22,7 @@ // <semaphore> +#include <cassert> #include <semaphore> #include <thread> _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits