Skip to content

Commit 385cc25

Browse files
committed
[libc++] Ensure that all public C++ headers include <__assert>
This patch changes the requirement for getting the declaration of the assertion handler from including <__assert> to including any public C++ header of the library. Note that C compatibility headers are excluded because we don't implement all the C headers ourselves -- some of them are taken straight from the C library, like assert.h. It also adds a generated test to check it. Furthermore, this new generated test is designed in a way that will make it possible to replace almost all the existing test-generation scripts with this system in upcoming patches. Differential Revision: https://reviews.llvm.org/D122506
1 parent 3fda0ed commit 385cc25

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+1049
-35
lines changed

libcxx/docs/UsingLibcxx.rst

Lines changed: 1 addition & 1 deletion

libcxx/include/algorithm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -733,6 +733,7 @@ template <class BidirectionalIterator, class Compare>
733733
734734
*/
735735

736+
#include <__assert> // all public C++ headers provide the assertion handler
736737
#include <__bits>
737738
#include <__config>
738739
#include <__debug>

libcxx/include/any

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ namespace std {
8080
8181
*/
8282

83+
#include <__assert> // all public C++ headers provide the assertion handler
8384
#include <__availability>
8485
#include <__config>
8586
#include <__utility/forward.h>

libcxx/include/array

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ template <size_t I, class T, size_t N> const T&& get(const array<T, N>&&) noexce
112112
#include <__algorithm/fill_n.h>
113113
#include <__algorithm/lexicographical_compare.h>
114114
#include <__algorithm/swap_ranges.h>
115-
#include <__assert>
115+
#include <__assert> // all public C++ headers provide the assertion handler
116116
#include <__config>
117117
#include <__tuple>
118118
#include <__utility/integer_sequence.h>

libcxx/include/atomic

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,7 @@ template <class T>
518518
519519
*/
520520

521+
#include <__assert> // all public C++ headers provide the assertion handler
521522
#include <__availability>
522523
#include <__chrono/duration.h>
523524
#include <__config>

libcxx/include/barrier

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ namespace std
4545
4646
*/
4747

48+
#include <__assert> // all public C++ headers provide the assertion handler
4849
#include <__availability>
4950
#include <__config>
5051
#include <__thread/timed_backoff_policy.h>

libcxx/include/bit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ namespace std {
6161
6262
*/
6363

64-
#include <__assert>
64+
#include <__assert> // all public C++ headers provide the assertion handler
6565
#include <__bit/bit_cast.h>
6666
#include <__bit/byteswap.h>
6767
#include <__bits> // __libcpp_clz

libcxx/include/bitset

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ template <size_t N> struct hash<std::bitset<N>>;
113113
*/
114114

115115
#include <__algorithm/fill.h>
116+
#include <__assert> // all public C++ headers provide the assertion handler
116117
#include <__bit_reference>
117118
#include <__config>
118119
#include <__functional/unary_function.h>

libcxx/include/cassert

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Macros:
1616
1717
*/
1818

19+
#include <__assert> // all public C++ headers provide the assertion handler
1920
#include <__config>
2021
#include <assert.h>
2122

libcxx/include/ccomplex

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,11 @@
1717
1818
*/
1919

20+
#include <__assert> // all public C++ headers provide the assertion handler
2021
#include <complex>
2122

2223
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2324
# pragma GCC system_header
2425
#endif
2526

26-
// hh 080623 Created
27-
2827
#endif // _LIBCPP_CCOMPLEX

0 commit comments

Comments
 (0)