Skip to content

Commit 0e8887d

Browse files
Exclude stacktrace headers if C++ < 23
1 parent f83afe7 commit 0e8887d

File tree

7 files changed

+94
-77
lines changed

7 files changed

+94
-77
lines changed

libcxx/include/__stacktrace/base.h

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,33 @@
77
//
88
//===----------------------------------------------------------------------===//
99

10-
#ifndef _LIBCPP_STACKTRACE_BUILDER
11-
#define _LIBCPP_STACKTRACE_BUILDER
10+
#ifndef _LIBCPP_STACKTRACE_BASE
11+
#define _LIBCPP_STACKTRACE_BASE
1212

1313
#include <__config>
14-
#include <__cstddef/byte.h>
15-
#include <__cstddef/size_t.h>
16-
#include <__functional/function.h>
17-
#include <__fwd/format.h>
18-
#include <__fwd/ostream.h>
19-
#include <__memory/allocator.h>
20-
#include <__memory/allocator_traits.h>
21-
#include <__new/allocate.h>
22-
#include <__vector/vector.h>
23-
#include <cstddef>
24-
#include <cstdint>
25-
#include <list>
26-
#include <optional>
27-
#include <string>
28-
29-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
30-
# pragma GCC system_header
31-
#endif
14+
#if _LIBCPP_STD_VER >= 23
15+
16+
# include <__cstddef/byte.h>
17+
# include <__cstddef/size_t.h>
18+
# include <__functional/function.h>
19+
# include <__fwd/format.h>
20+
# include <__fwd/ostream.h>
21+
# include <__memory/allocator.h>
22+
# include <__memory/allocator_traits.h>
23+
# include <__new/allocate.h>
24+
# include <__vector/vector.h>
25+
# include <cstddef>
26+
# include <cstdint>
27+
# include <list>
28+
# include <optional>
29+
# include <string>
30+
31+
# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
32+
# pragma GCC system_header
33+
# endif
3234

3335
_LIBCPP_PUSH_MACROS
34-
#include <__undef_macros>
36+
# include <__undef_macros>
3537

3638
_LIBCPP_BEGIN_NAMESPACE_STD
3739

@@ -130,4 +132,5 @@ _LIBCPP_END_NAMESPACE_STD
130132

131133
_LIBCPP_POP_MACROS
132134

133-
#endif // _LIBCPP_STACKTRACE_BUILDER
135+
#endif // _LIBCPP_STD_VER >= 23
136+
#endif // _LIBCPP_STACKTRACE_BASE

libcxx/include/__stacktrace/basic.h

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,28 @@
1111
#define _LIBCPP_BASIC_STACKTRACE
1212

1313
#include <__config>
14-
#include <__functional/hash.h>
15-
#include <__fwd/format.h>
16-
#include <__iterator/iterator.h>
17-
#include <__iterator/reverse_iterator.h>
18-
#include <__memory/allocator_traits.h>
19-
#include <__memory_resource/polymorphic_allocator.h>
20-
#include <__type_traits/is_nothrow_constructible.h>
21-
#include <__vector/vector.h>
22-
#include <utility>
23-
24-
#include <__stacktrace/base.h>
25-
#include <__stacktrace/entry.h>
26-
#include <__stacktrace/to_string.h>
27-
28-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
29-
# pragma GCC system_header
30-
#endif
14+
#if _LIBCPP_STD_VER >= 23
15+
16+
# include <__functional/hash.h>
17+
# include <__fwd/format.h>
18+
# include <__iterator/iterator.h>
19+
# include <__iterator/reverse_iterator.h>
20+
# include <__memory/allocator_traits.h>
21+
# include <__memory_resource/polymorphic_allocator.h>
22+
# include <__type_traits/is_nothrow_constructible.h>
23+
# include <__vector/vector.h>
24+
# include <utility>
25+
26+
# include <__stacktrace/base.h>
27+
# include <__stacktrace/entry.h>
28+
# include <__stacktrace/to_string.h>
29+
30+
# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
31+
# pragma GCC system_header
32+
# endif
3133

3234
_LIBCPP_PUSH_MACROS
33-
#include <__undef_macros>
35+
# include <__undef_macros>
3436

3537
_LIBCPP_BEGIN_NAMESPACE_STD
3638

@@ -244,4 +246,5 @@ _LIBCPP_END_NAMESPACE_STD
244246

245247
_LIBCPP_POP_MACROS
246248

249+
#endif // _LIBCPP_STD_VER >= 23
247250
#endif // _LIBCPP_BASIC_STACKTRACE

libcxx/include/__stacktrace/entry.h

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,23 @@
1111
#define _LIBCPP_STACKTRACE_ENTRY
1212

1313
#include <__config>
14-
#include <__fwd/format.h>
15-
#include <__fwd/ostream.h>
16-
#include <cstddef>
17-
#include <cstdint>
18-
#include <optional>
19-
#include <string>
14+
#if _LIBCPP_STD_VER >= 23
2015

21-
#include <__stacktrace/base.h>
16+
# include <__fwd/format.h>
17+
# include <__fwd/ostream.h>
18+
# include <cstddef>
19+
# include <cstdint>
20+
# include <optional>
21+
# include <string>
2222

23-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
24-
# pragma GCC system_header
25-
#endif
23+
# include <__stacktrace/base.h>
24+
25+
# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
26+
# pragma GCC system_header
27+
# endif
2628

2729
_LIBCPP_PUSH_MACROS
28-
#include <__undef_macros>
30+
# include <__undef_macros>
2931

3032
_LIBCPP_BEGIN_NAMESPACE_STD
3133

@@ -110,4 +112,5 @@ _LIBCPP_END_NAMESPACE_STD
110112

111113
_LIBCPP_POP_MACROS
112114

115+
#endif // _LIBCPP_STD_VER >= 23
113116
#endif // _LIBCPP_STACKTRACE_ENTRY

libcxx/include/__stacktrace/hash.h

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,21 @@
1111
#define _LIBCPP_BASIC_STACKTRACE_HASH
1212

1313
#include <__config>
14-
#include <__functional/hash.h>
15-
#include <cstddef>
16-
#include <cstdint>
14+
#if _LIBCPP_STD_VER >= 23
1715

18-
#include <__stacktrace/base.h>
19-
#include <__stacktrace/to_string.h>
16+
# include <__functional/hash.h>
17+
# include <cstddef>
18+
# include <cstdint>
2019

21-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
22-
# pragma GCC system_header
23-
#endif
20+
# include <__stacktrace/base.h>
21+
# include <__stacktrace/to_string.h>
22+
23+
# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
24+
# pragma GCC system_header
25+
# endif
2426

2527
_LIBCPP_PUSH_MACROS
26-
#include <__undef_macros>
28+
# include <__undef_macros>
2729

2830
_LIBCPP_BEGIN_NAMESPACE_STD
2931

@@ -45,4 +47,5 @@ _LIBCPP_END_NAMESPACE_STD
4547

4648
_LIBCPP_POP_MACROS
4749

50+
#endif // _LIBCPP_STD_VER >= 23
4851
#endif // _LIBCPP_BASIC_STACKTRACE_HASH

libcxx/include/__stacktrace/nonmem.h

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,22 @@
1111
#define _LIBCPP_BASIC_STACKTRACE_NONMEM
1212

1313
#include <__config>
14-
#include <__memory/allocator_traits.h>
15-
#include <__utility/swap.h>
16-
#include <__vector/vector.h>
17-
#include <string>
14+
#if _LIBCPP_STD_VER >= 23
1815

19-
#include <__stacktrace/base.h>
20-
#include <__stacktrace/to_string.h>
16+
# include <__memory/allocator_traits.h>
17+
# include <__utility/swap.h>
18+
# include <__vector/vector.h>
19+
# include <string>
2120

22-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
23-
# pragma GCC system_header
24-
#endif
21+
# include <__stacktrace/base.h>
22+
# include <__stacktrace/to_string.h>
23+
24+
# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
25+
# pragma GCC system_header
26+
# endif
2527

2628
_LIBCPP_PUSH_MACROS
27-
#include <__undef_macros>
29+
# include <__undef_macros>
2830

2931
_LIBCPP_BEGIN_NAMESPACE_STD
3032

@@ -52,4 +54,5 @@ _LIBCPP_END_NAMESPACE_STD
5254

5355
_LIBCPP_POP_MACROS
5456

57+
#endif // _LIBCPP_STD_VER >= 23
5558
#endif // _LIBCPP_BASIC_STACKTRACE_NONMEM

libcxx/include/__stacktrace/to_string.h

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,17 @@
1111
#define _LIBCPP_STACKTRACE_TO_STRING
1212

1313
#include <__config>
14-
#include <__fwd/ostream.h>
15-
#include <string>
14+
#if _LIBCPP_STD_VER >= 23
1615

17-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
18-
# pragma GCC system_header
19-
#endif
16+
# include <__fwd/ostream.h>
17+
# include <string>
18+
19+
# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
20+
# pragma GCC system_header
21+
# endif
2022

2123
_LIBCPP_PUSH_MACROS
22-
#include <__undef_macros>
24+
# include <__undef_macros>
2325

2426
_LIBCPP_BEGIN_NAMESPACE_STD
2527

@@ -50,4 +52,5 @@ _LIBCPP_END_NAMESPACE_STD
5052

5153
_LIBCPP_POP_MACROS
5254

55+
#endif // _LIBCPP_STD_VER >= 23
5356
#endif // _LIBCPP_STACKTRACE_TO_STRING

libcxx/test/std/language.support/support.limits/support.limits.general/stacktrace.version.compile.pass.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,4 +105,3 @@
105105
#endif // TEST_STD_VER > 23
106106

107107
// clang-format on
108-

0 commit comments

Comments
 (0)