Skip to content

Commit 5b0518c

Browse files
Use proper header format/layout
1 parent b97367f commit 5b0518c

File tree

9 files changed

+91
-74
lines changed

9 files changed

+91
-74
lines changed

libcxx/include/__stacktrace/base.h

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@
1111
#define _LIBCPP_STACKTRACE_BASE
1212

1313
#include <__config>
14+
15+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
16+
# pragma GCC system_header
17+
#endif
18+
19+
_LIBCPP_PUSH_MACROS
20+
#include <__undef_macros>
21+
1422
#if _LIBCPP_STD_VER >= 23
1523

1624
# include <__cstddef/byte.h>
@@ -28,13 +36,6 @@
2836
# include <optional>
2937
# include <string>
3038

31-
# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
32-
# pragma GCC system_header
33-
# endif
34-
35-
_LIBCPP_PUSH_MACROS
36-
# include <__undef_macros>
37-
3839
_LIBCPP_BEGIN_NAMESPACE_STD
3940

4041
class _LIBCPP_EXPORTED_FROM_ABI stacktrace_entry;
@@ -128,9 +129,11 @@ struct _LIBCPP_EXPORTED_FROM_ABI builder final {
128129
};
129130

130131
} // namespace __stacktrace
132+
131133
_LIBCPP_END_NAMESPACE_STD
132134

135+
#endif // _LIBCPP_STD_VER >= 23
136+
133137
_LIBCPP_POP_MACROS
134138

135-
#endif // _LIBCPP_STD_VER >= 23
136139
#endif // _LIBCPP_STACKTRACE_BASE

libcxx/include/__stacktrace/basic.h

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,18 @@
77
//
88
//===----------------------------------------------------------------------===//
99

10-
#ifndef _LIBCPP_BASIC_STACKTRACE
11-
#define _LIBCPP_BASIC_STACKTRACE
10+
#ifndef _LIBCPP_STACKTRACE_BASIC
11+
#define _LIBCPP_STACKTRACE_BASIC
1212

1313
#include <__config>
14+
15+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
16+
# pragma GCC system_header
17+
#endif
18+
19+
_LIBCPP_PUSH_MACROS
20+
#include <__undef_macros>
21+
1422
#if _LIBCPP_STD_VER >= 23
1523

1624
# include <__functional/hash.h>
@@ -27,13 +35,6 @@
2735
# include <__stacktrace/entry.h>
2836
# include <__stacktrace/to_string.h>
2937

30-
# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
31-
# pragma GCC system_header
32-
# endif
33-
34-
_LIBCPP_PUSH_MACROS
35-
# include <__undef_macros>
36-
3738
_LIBCPP_BEGIN_NAMESPACE_STD
3839

3940
// (19.6.4)
@@ -244,7 +245,8 @@ using stacktrace = basic_stacktrace<polymorphic_allocator<stacktrace_entry>>;
244245

245246
_LIBCPP_END_NAMESPACE_STD
246247

248+
#endif // _LIBCPP_STD_VER >= 23
249+
247250
_LIBCPP_POP_MACROS
248251

249-
#endif // _LIBCPP_STD_VER >= 23
250-
#endif // _LIBCPP_BASIC_STACKTRACE
252+
#endif // _LIBCPP_STACKTRACE_BASIC

libcxx/include/__stacktrace/entry.h

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

1313
#include <__config>
14+
15+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
16+
# pragma GCC system_header
17+
#endif
18+
19+
_LIBCPP_PUSH_MACROS
20+
#include <__undef_macros>
21+
1422
#if _LIBCPP_STD_VER >= 23
1523

1624
# include <__fwd/format.h>
@@ -22,13 +30,6 @@
2230

2331
# include <__stacktrace/base.h>
2432

25-
# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
26-
# pragma GCC system_header
27-
# endif
28-
29-
_LIBCPP_PUSH_MACROS
30-
# include <__undef_macros>
31-
3233
_LIBCPP_BEGIN_NAMESPACE_STD
3334

3435
class _LIBCPP_EXPORTED_FROM_ABI stacktrace_entry : private __stacktrace::entry_base {
@@ -110,7 +111,8 @@ _LIBCPP_HIDE_FROM_ABI inline stacktrace_entry entry_base::to_stacktrace_entry()
110111

111112
_LIBCPP_END_NAMESPACE_STD
112113

114+
#endif // _LIBCPP_STD_VER >= 23
115+
113116
_LIBCPP_POP_MACROS
114117

115-
#endif // _LIBCPP_STD_VER >= 23
116118
#endif // _LIBCPP_STACKTRACE_ENTRY

libcxx/include/__stacktrace/hash.h

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,18 @@
77
//
88
//===----------------------------------------------------------------------===//
99

10-
#ifndef _LIBCPP_BASIC_STACKTRACE_HASH
11-
#define _LIBCPP_BASIC_STACKTRACE_HASH
10+
#ifndef _LIBCPP_STACKTRACE_HASH
11+
#define _LIBCPP_STACKTRACE_HASH
1212

1313
#include <__config>
14+
15+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
16+
# pragma GCC system_header
17+
#endif
18+
19+
_LIBCPP_PUSH_MACROS
20+
#include <__undef_macros>
21+
1422
#if _LIBCPP_STD_VER >= 23
1523

1624
# include <__functional/hash.h>
@@ -20,13 +28,6 @@
2028
# include <__stacktrace/base.h>
2129
# include <__stacktrace/to_string.h>
2230

23-
# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
24-
# pragma GCC system_header
25-
# endif
26-
27-
_LIBCPP_PUSH_MACROS
28-
# include <__undef_macros>
29-
3031
_LIBCPP_BEGIN_NAMESPACE_STD
3132

3233
// (19.6.6)
@@ -45,7 +46,8 @@ struct _LIBCPP_EXPORTED_FROM_ABI hash<basic_stacktrace<_Allocator>> {
4546

4647
_LIBCPP_END_NAMESPACE_STD
4748

49+
#endif // _LIBCPP_STD_VER >= 23
50+
4851
_LIBCPP_POP_MACROS
4952

50-
#endif // _LIBCPP_STD_VER >= 23
51-
#endif // _LIBCPP_BASIC_STACKTRACE_HASH
53+
#endif // _LIBCPP_STACKTRACE_HASH

libcxx/include/__stacktrace/nonmem.h

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,18 @@
77
//
88
//===----------------------------------------------------------------------===//
99

10-
#ifndef _LIBCPP_BASIC_STACKTRACE_NONMEM
11-
#define _LIBCPP_BASIC_STACKTRACE_NONMEM
10+
#ifndef _LIBCPP_STACKTRACE_NONMEM
11+
#define _LIBCPP_STACKTRACE_NONMEM
1212

1313
#include <__config>
14+
15+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
16+
# pragma GCC system_header
17+
#endif
18+
19+
_LIBCPP_PUSH_MACROS
20+
#include <__undef_macros>
21+
1422
#if _LIBCPP_STD_VER >= 23
1523

1624
# include <__memory/allocator_traits.h>
@@ -21,13 +29,6 @@
2129
# include <__stacktrace/base.h>
2230
# include <__stacktrace/to_string.h>
2331

24-
# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
25-
# pragma GCC system_header
26-
# endif
27-
28-
_LIBCPP_PUSH_MACROS
29-
# include <__undef_macros>
30-
3132
_LIBCPP_BEGIN_NAMESPACE_STD
3233

3334
// (19.6.4.6)
@@ -52,7 +53,8 @@ _LIBCPP_EXPORTED_FROM_ABI inline ostream& operator<<(ostream& __os, const basic_
5253

5354
_LIBCPP_END_NAMESPACE_STD
5455

56+
#endif // _LIBCPP_STD_VER >= 23
57+
5558
_LIBCPP_POP_MACROS
5659

57-
#endif // _LIBCPP_STD_VER >= 23
58-
#endif // _LIBCPP_BASIC_STACKTRACE_NONMEM
60+
#endif // _LIBCPP_STACKTRACE_NONMEM

libcxx/include/__stacktrace/to_string.h

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,19 @@
1111
#define _LIBCPP_STACKTRACE_TO_STRING
1212

1313
#include <__config>
14+
15+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
16+
# pragma GCC system_header
17+
#endif
18+
19+
_LIBCPP_PUSH_MACROS
20+
#include <__undef_macros>
21+
1422
#if _LIBCPP_STD_VER >= 23
1523

1624
# include <__fwd/ostream.h>
1725
# include <string>
1826

19-
# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
20-
# pragma GCC system_header
21-
# endif
22-
23-
_LIBCPP_PUSH_MACROS
24-
# include <__undef_macros>
25-
2627
_LIBCPP_BEGIN_NAMESPACE_STD
2728

2829
template <class _Allocator>
@@ -48,9 +49,11 @@ struct __to_string {
4849
};
4950

5051
} // namespace __stacktrace
52+
5153
_LIBCPP_END_NAMESPACE_STD
5254

55+
#endif // _LIBCPP_STD_VER >= 23
56+
5357
_LIBCPP_POP_MACROS
5458

55-
#endif // _LIBCPP_STD_VER >= 23
5659
#endif // _LIBCPP_STACKTRACE_TO_STRING

libcxx/include/stacktrace

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -164,28 +164,27 @@ namespace std {
164164
165165
*/
166166

167-
#include <__config>
168-
169-
#if _LIBCPP_STD_VER >= 23
167+
#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
168+
# include <__cxx03/__config>
169+
#else
170+
# include <__config>
171+
172+
# if _LIBCPP_STD_VER >= 23
173+
# include <__stacktrace/base.h>
174+
# include <__stacktrace/basic.h>
175+
# include <__stacktrace/entry.h>
176+
# include <__stacktrace/hash.h>
177+
# include <__stacktrace/nonmem.h>
178+
# include <__stacktrace/to_string.h>
179+
# include <compare> // per [stacktrace.syn]
180+
# endif
170181

171-
# include <compare> // according to [stacktrace.syn]
182+
# include <version>
172183

173184
# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
174185
# pragma GCC system_header
175186
# endif
176187

177-
_LIBCPP_PUSH_MACROS
178-
# include <__undef_macros>
179-
180-
# include <__stacktrace/base.h>
181-
# include <__stacktrace/basic.h>
182-
# include <__stacktrace/entry.h>
183-
# include <__stacktrace/hash.h>
184-
# include <__stacktrace/nonmem.h>
185-
# include <__stacktrace/to_string.h>
186-
187-
_LIBCPP_POP_MACROS
188-
189-
#endif // _LIBCPP_STD_VER >= 23
188+
#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
190189

191190
#endif // _LIBCPP_STACKTRACE

libcxx/modules/std/stacktrace.inc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,8 @@ export namespace std {
3333
// [stacktrace.basic.hash], hash support
3434
using std::hash;
3535

36+
// [stacktrace.format], formatting support
37+
using std::formatter;
38+
3639
#endif // _LIBCPP_STD_VER >= 23
3740
} // namespace std

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

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

107107
// clang-format on
108+

0 commit comments

Comments
 (0)