Skip to content

Commit d7add33

Browse files
committed
Fix formatting
1 parent 87c8627 commit d7add33

File tree

2 files changed

+38
-33
lines changed

2 files changed

+38
-33
lines changed

libcxx/src/include/overridable_function.h

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -61,56 +61,59 @@
6161
_LIBCPP_BEGIN_NAMESPACE_STD
6262

6363
template <class _Func>
64-
_LIBCPP_HIDE_FROM_ABI constexpr _Func* __overload_of(_Func* f) { return f; }
64+
_LIBCPP_HIDE_FROM_ABI constexpr _Func* __overload_of(_Func* f) {
65+
return f;
66+
}
6567

6668
template <auto _Func>
6769
_LIBCPP_HIDE_FROM_ABI constexpr bool __is_function_overridden();
6870

6971
_LIBCPP_END_NAMESPACE_STD
7072

7173
# define _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION 1
72-
# define _LIBCPP_OVERRIDABLE_FUNCTION(symbol, type, name, arglist) \
73-
extern "C" type symbol##_impl__ arglist; \
74-
__asm__(".globl _" _LIBCPP_TOSTRING(symbol)); \
75-
__asm__(".set _" _LIBCPP_TOSTRING(symbol) ", _" _LIBCPP_TOSTRING(symbol##_impl__)); \
76-
extern __typeof(symbol##_impl__) name __attribute__((weak_import)); \
77-
_LIBCPP_BEGIN_NAMESPACE_STD \
78-
template <> \
79-
constexpr bool __is_function_overridden<__overload_of<type arglist>(name)>() { \
80-
return __overload_of<type arglist>(name) != symbol##_impl__; \
81-
} \
82-
_LIBCPP_END_NAMESPACE_STD \
83-
type symbol##_impl__ arglist
74+
# define _LIBCPP_OVERRIDABLE_FUNCTION(symbol, type, name, arglist) \
75+
extern "C" type symbol##_impl__ arglist; \
76+
__asm__(".globl _" _LIBCPP_TOSTRING(symbol)); \
77+
__asm__(".set _" _LIBCPP_TOSTRING(symbol) ", _" _LIBCPP_TOSTRING(symbol##_impl__)); \
78+
extern __typeof(symbol##_impl__) name __attribute__((weak_import)); \
79+
_LIBCPP_BEGIN_NAMESPACE_STD \
80+
template <> \
81+
constexpr bool __is_function_overridden<__overload_of<type arglist>(name)>() { \
82+
return __overload_of<type arglist>(name) != symbol##_impl__; \
83+
} \
84+
_LIBCPP_END_NAMESPACE_STD \
85+
type symbol##_impl__ arglist
8486

8587
#elif defined(_LIBCPP_OBJECT_FORMAT_ELF)
8688

8789
_LIBCPP_BEGIN_NAMESPACE_STD
8890

8991
template <class _Func>
90-
_LIBCPP_HIDE_FROM_ABI constexpr _Func* __overload_of(_Func* f) { return f; }
92+
_LIBCPP_HIDE_FROM_ABI constexpr _Func* __overload_of(_Func* f) {
93+
return f;
94+
}
9195

9296
template <auto _Func>
9397
_LIBCPP_HIDE_FROM_ABI constexpr bool __is_function_overridden();
9498

9599
_LIBCPP_END_NAMESPACE_STD
96100

97101
# define _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION 1
98-
# define _LIBCPP_OVERRIDABLE_FUNCTION(symbol, type, name, arglist) \
99-
extern "C" type symbol##_impl__ arglist; \
100-
[[gnu::weak, gnu::alias(_LIBCPP_TOSTRING(symbol##_impl__))]] type name arglist; \
101-
_LIBCPP_BEGIN_NAMESPACE_STD \
102-
template <> \
103-
constexpr bool __is_function_overridden<__overload_of<type arglist>(name)>() { \
104-
return __overload_of<type arglist>(name) != symbol##_impl__; \
105-
} \
106-
_LIBCPP_END_NAMESPACE_STD \
107-
type symbol##_impl__ arglist
102+
# define _LIBCPP_OVERRIDABLE_FUNCTION(symbol, type, name, arglist) \
103+
extern "C" type symbol##_impl__ arglist; \
104+
[[gnu::weak, gnu::alias(_LIBCPP_TOSTRING(symbol##_impl__))]] type name arglist; \
105+
_LIBCPP_BEGIN_NAMESPACE_STD \
106+
template <> \
107+
constexpr bool __is_function_overridden<__overload_of<type arglist>(name)>() { \
108+
return __overload_of<type arglist>(name) != symbol##_impl__; \
109+
} \
110+
_LIBCPP_END_NAMESPACE_STD \
111+
type symbol##_impl__ arglist
108112

109113
#else
110114

111115
# define _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION 0
112-
# define _LIBCPP_OVERRIDABLE_FUNCTION(symbol, type, name, arglist) \
113-
_LIBCPP_WEAK type name arglist
116+
# define _LIBCPP_OVERRIDABLE_FUNCTION(symbol, type, name, arglist) _LIBCPP_WEAK type name arglist
114117

115118
#endif
116119

libcxx/src/new.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ static void* operator_new_impl(std::size_t size) {
4343
return p;
4444
}
4545

46-
_LIBCPP_OVERRIDABLE_FUNCTION(_Znmw, void *, operator new, (std::size_t size)) _THROW_BAD_ALLOC {
46+
_LIBCPP_OVERRIDABLE_FUNCTION(_Znmw, void*, operator new, (std::size_t size)) _THROW_BAD_ALLOC {
4747
void* p = operator_new_impl(size);
4848
if (p == nullptr)
4949
__throw_bad_alloc_shim();
@@ -54,7 +54,7 @@ _LIBCPP_WEAK void* operator new(size_t size, const std::nothrow_t&) noexcept {
5454
# ifdef _LIBCPP_HAS_NO_EXCEPTIONS
5555
# if _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION
5656
_LIBCPP_ASSERT_SHIM(
57-
!std::__is_function_overridden<std::__overload_of<void* (std::size_t)>(&operator new)>(),
57+
!std::__is_function_overridden<std::__overload_of<void*(std::size_t)>(&operator new)>(),
5858
"libc++ was configured with exceptions disabled and `operator new(size_t)` has been overridden, "
5959
"but `operator new(size_t, nothrow_t)` has not been overridden. This is problematic because "
6060
"`operator new(size_t, nothrow_t)` must call `operator new(size_t)`, which will terminate in case "
@@ -82,7 +82,7 @@ _LIBCPP_WEAK void* operator new[](size_t size, const std::nothrow_t&) noexcept {
8282
# ifdef _LIBCPP_HAS_NO_EXCEPTIONS
8383
# if _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION
8484
_LIBCPP_ASSERT_SHIM(
85-
!std::__is_function_overridden<std::__overload_of<void* (std::size_t)>(&operator new[])>(),
85+
!std::__is_function_overridden<std::__overload_of<void*(std::size_t)>(&operator new[])>(),
8686
"libc++ was configured with exceptions disabled and `operator new[](size_t)` has been overridden, "
8787
"but `operator new[](size_t, nothrow_t)` has not been overridden. This is problematic because "
8888
"`operator new[](size_t, nothrow_t)` must call `operator new[](size_t)`, which will terminate in case "
@@ -136,7 +136,8 @@ static void* operator_new_aligned_impl(std::size_t size, std::align_val_t alignm
136136
return p;
137137
}
138138

139-
_LIBCPP_OVERRIDABLE_FUNCTION(_ZnwmSt11align_val_t, void*, operator new, (std::size_t size, std::align_val_t alignment)) _THROW_BAD_ALLOC {
139+
_LIBCPP_OVERRIDABLE_FUNCTION(_ZnwmSt11align_val_t, void*, operator new, (std::size_t size, std::align_val_t alignment))
140+
_THROW_BAD_ALLOC {
140141
void* p = operator_new_aligned_impl(size, alignment);
141142
if (p == nullptr)
142143
__throw_bad_alloc_shim();
@@ -147,7 +148,7 @@ _LIBCPP_WEAK void* operator new(size_t size, std::align_val_t alignment, const s
147148
# ifdef _LIBCPP_HAS_NO_EXCEPTIONS
148149
# if _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION
149150
_LIBCPP_ASSERT_SHIM(
150-
!std::__is_function_overridden<std::__overload_of<void* (std::size_t, std::align_val_t)>(&operator new)>(),
151+
!std::__is_function_overridden<std::__overload_of<void*(std::size_t, std::align_val_t)>(&operator new)>(),
151152
"libc++ was configured with exceptions disabled and `operator new(size_t, align_val_t)` has been overridden, "
152153
"but `operator new(size_t, align_val_t, nothrow_t)` has not been overridden. This is problematic because "
153154
"`operator new(size_t, align_val_t, nothrow_t)` must call `operator new(size_t, align_val_t)`, which will "
@@ -167,15 +168,16 @@ _LIBCPP_WEAK void* operator new(size_t size, std::align_val_t alignment, const s
167168
# endif
168169
}
169170

170-
_LIBCPP_OVERRIDABLE_FUNCTION(_ZnamSt11align_val_t, void *, operator new[], (size_t size, std::align_val_t alignment)) _THROW_BAD_ALLOC {
171+
_LIBCPP_OVERRIDABLE_FUNCTION(_ZnamSt11align_val_t, void*, operator new[], (size_t size, std::align_val_t alignment))
172+
_THROW_BAD_ALLOC {
171173
return ::operator new(size, alignment);
172174
}
173175

174176
_LIBCPP_WEAK void* operator new[](size_t size, std::align_val_t alignment, const std::nothrow_t&) noexcept {
175177
# ifdef _LIBCPP_HAS_NO_EXCEPTIONS
176178
# if _LIBCPP_CAN_DETECT_OVERRIDDEN_FUNCTION
177179
_LIBCPP_ASSERT_SHIM(
178-
!std::__is_function_overridden<std::__overload_of<void* (std::size_t, std::align_val_t)>(&operator new[])>(),
180+
!std::__is_function_overridden<std::__overload_of<void*(std::size_t, std::align_val_t)>(&operator new[])>(),
179181
"libc++ was configured with exceptions disabled and `operator new[](size_t, align_val_t)` has been overridden, "
180182
"but `operator new[](size_t, align_val_t, nothrow_t)` has not been overridden. This is problematic because "
181183
"`operator new[](size_t, align_val_t, nothrow_t)` must call `operator new[](size_t, align_val_t)`, which will "

0 commit comments

Comments
 (0)