[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

GitOrigin-RevId: d430330788c646afcb2c32c8f24c63210b518a32
diff --git a/include/barrier b/include/barrier
index 987ff0a..ba9e8ea 100644
--- a/include/barrier
+++ b/include/barrier
@@ -58,6 +58,9 @@
 # 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 @@
 
 #endif // _LIBCPP_STD_VER >= 14
 
+_LIBCPP_POP_MACROS
+
 #endif //_LIBCPP_BARRIER
diff --git a/include/experimental/simd b/include/experimental/simd
index 39ac35e..41f8f79 100644
--- a/include/experimental/simd
+++ b/include/experimental/simd
@@ -659,6 +659,9 @@
 #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 @@
 
 _LIBCPP_END_NAMESPACE_EXPERIMENTAL_SIMD
 
+_LIBCPP_POP_MACROS
+
 #endif /* _LIBCPP_EXPERIMENTAL_SIMD */
diff --git a/include/latch b/include/latch
index 67fca97..b338f09 100644
--- a/include/latch
+++ b/include/latch
@@ -50,6 +50,9 @@
 # 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 @@
 
 #endif // _LIBCPP_STD_VER >= 14
 
+_LIBCPP_POP_MACROS
+
 #endif //_LIBCPP_LATCH
diff --git a/include/semaphore b/include/semaphore
index 8f63162..0943606 100644
--- a/include/semaphore
+++ b/include/semaphore
@@ -49,7 +49,6 @@
 #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 @@
 # 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 @@
 
 #endif // _LIBCPP_STD_VER >= 14
 
+_LIBCPP_POP_MACROS
+
 #endif //_LIBCPP_SEMAPHORE
diff --git a/test/libcxx/double_include.sh.cpp b/test/libcxx/double_include.sh.cpp
index ba571e1..39851cc 100644
--- a/test/libcxx/double_include.sh.cpp
+++ b/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/test/libcxx/min_max_macros.compile.pass.cpp b/test/libcxx/min_max_macros.compile.pass.cpp
index 7c1956b..da7e857 100644
--- a/test/libcxx/min_max_macros.compile.pass.cpp
+++ b/test/libcxx/min_max_macros.compile.pass.cpp
@@ -33,6 +33,12 @@
 #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();
 #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();
 #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();
 #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 @@
 #endif
 #include <new>
 TEST_MACROS();
+#include <numbers>
+TEST_MACROS();
 #include <numeric>
 TEST_MACROS();
 #include <optional>
@@ -149,6 +169,10 @@
 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();
 #include <vector>
 TEST_MACROS();
+#include <version>
+TEST_MACROS();
 #include <wchar.h>
 TEST_MACROS();
 #include <wctype.h>
@@ -251,6 +277,10 @@
 #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();
 #include <experimental/set>
 TEST_MACROS();
+#include <experimental/simd>
+TEST_MACROS();
 #include <experimental/string>
 TEST_MACROS();
 #include <experimental/type_traits>
diff --git a/test/libcxx/no_assert_include.compile.pass.cpp b/test/libcxx/no_assert_include.compile.pass.cpp
index 9ad87e0..71842dc 100644
--- a/test/libcxx/no_assert_include.compile.pass.cpp
+++ b/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/test/std/thread/thread.semaphore/timed.pass.cpp b/test/std/thread/thread.semaphore/timed.pass.cpp
index 281e3b4..a0f4ee0 100644
--- a/test/std/thread/thread.semaphore/timed.pass.cpp
+++ b/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/test/std/thread/thread.semaphore/try_acquire.pass.cpp b/test/std/thread/thread.semaphore/try_acquire.pass.cpp
index 9b387c9..1835db0 100644
--- a/test/std/thread/thread.semaphore/try_acquire.pass.cpp
+++ b/test/std/thread/thread.semaphore/try_acquire.pass.cpp
@@ -22,6 +22,7 @@
 
 // <semaphore>
 
+#include <cassert>
 #include <semaphore>
 #include <thread>