[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
This commit is contained in:
Arthur O'Dwyer 2020-12-02 18:55:01 -05:00
parent 5d208d5054
commit d430330788
9 changed files with 75 additions and 5 deletions

View File

@ -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

View File

@ -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 */

View File

@ -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

View File

@ -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

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -25,6 +25,7 @@
#include <semaphore>
#include <thread>
#include <chrono>
#include <cassert>
#include "make_test_thread.h"
#include "test_macros.h"

View File

@ -22,6 +22,7 @@
// <semaphore>
#include <cassert>
#include <semaphore>
#include <thread>