[libcxx-commits] [libcxx] [libc++] Add #if 0 block to all the top-level headers (PR #119234)
via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Dec 9 09:36:39 PST 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff ce7771902dc50d900de639d499a60486b83f70e0 0fb8ef704b60a1d4f3511102b8ef5de08c1484b7 --extensions ,h -- libcxx/include/algorithm libcxx/include/any libcxx/include/array libcxx/include/atomic libcxx/include/barrier libcxx/include/bit libcxx/include/bitset libcxx/include/cassert libcxx/include/ccomplex libcxx/include/cctype libcxx/include/cerrno libcxx/include/cfenv libcxx/include/cfloat libcxx/include/charconv libcxx/include/chrono libcxx/include/cinttypes libcxx/include/ciso646 libcxx/include/climits libcxx/include/clocale libcxx/include/cmath libcxx/include/codecvt libcxx/include/compare libcxx/include/complex libcxx/include/complex.h libcxx/include/concepts libcxx/include/condition_variable libcxx/include/coroutine libcxx/include/csetjmp libcxx/include/csignal libcxx/include/cstdalign libcxx/include/cstdarg libcxx/include/cstdbool libcxx/include/cstddef libcxx/include/cstdint libcxx/include/cstdio libcxx/include/cstdlib libcxx/include/cstring libcxx/include/ctgmath libcxx/include/ctime libcxx/include/ctype.h libcxx/include/cuchar libcxx/include/cwchar libcxx/include/cwctype libcxx/include/deque libcxx/include/errno.h libcxx/include/exception libcxx/include/execution libcxx/include/expected libcxx/include/fenv.h libcxx/include/filesystem libcxx/include/flat_map libcxx/include/float.h libcxx/include/format libcxx/include/forward_list libcxx/include/fstream libcxx/include/functional libcxx/include/future libcxx/include/initializer_list libcxx/include/inttypes.h libcxx/include/iomanip libcxx/include/ios libcxx/include/iosfwd libcxx/include/iostream libcxx/include/istream libcxx/include/iterator libcxx/include/latch libcxx/include/limits libcxx/include/list libcxx/include/locale libcxx/include/map libcxx/include/math.h libcxx/include/mdspan libcxx/include/memory libcxx/include/memory_resource libcxx/include/mutex libcxx/include/new libcxx/include/numbers libcxx/include/numeric libcxx/include/optional libcxx/include/ostream libcxx/include/print libcxx/include/queue libcxx/include/random libcxx/include/ranges libcxx/include/ratio libcxx/include/regex libcxx/include/scoped_allocator libcxx/include/semaphore libcxx/include/set libcxx/include/shared_mutex libcxx/include/source_location libcxx/include/span libcxx/include/sstream libcxx/include/stack libcxx/include/stdatomic.h libcxx/include/stdbool.h libcxx/include/stddef.h libcxx/include/stdexcept libcxx/include/stdio.h libcxx/include/stdlib.h libcxx/include/stop_token libcxx/include/streambuf libcxx/include/string libcxx/include/string.h libcxx/include/string_view libcxx/include/strstream libcxx/include/syncstream libcxx/include/system_error libcxx/include/tgmath.h libcxx/include/thread libcxx/include/tuple libcxx/include/type_traits libcxx/include/typeindex libcxx/include/typeinfo libcxx/include/uchar.h libcxx/include/unordered_map libcxx/include/unordered_set libcxx/include/utility libcxx/include/valarray libcxx/include/variant libcxx/include/vector libcxx/include/wchar.h libcxx/include/wctype.h
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/libcxx/include/codecvt b/libcxx/include/codecvt
index 13a942849e..73f01f7bdc 100644
--- a/libcxx/include/codecvt
+++ b/libcxx/include/codecvt
@@ -439,8 +439,7 @@ class _LIBCPP_TEMPLATE_VIS
_LIBCPP_DEPRECATED_IN_CXX17 codecvt_utf16 : public __codecvt_utf16<_Elem, _Mode & little_endian> {
public:
_LIBCPP_HIDE_FROM_ABI explicit codecvt_utf16(size_t __refs = 0)
- : __codecvt_utf16 < _Elem,
- _Mode & little_endian > (__refs, _Maxcode, _Mode) {}
+ : __codecvt_utf16< _Elem, _Mode & little_endian >(__refs, _Maxcode, _Mode) {}
_LIBCPP_HIDE_FROM_ABI ~codecvt_utf16() {}
};
diff --git a/libcxx/include/condition_variable b/libcxx/include/condition_variable
index 51ebaa4a5c..f351f13b71 100644
--- a/libcxx/include/condition_variable
+++ b/libcxx/include/condition_variable
@@ -194,16 +194,12 @@ public:
inline condition_variable_any::condition_variable_any() : __mut_(make_shared<mutex>()) {}
inline void condition_variable_any::notify_one() _NOEXCEPT {
- {
- lock_guard<mutex> __lx(*__mut_);
- }
+ { lock_guard<mutex> __lx(*__mut_); }
__cv_.notify_one();
}
inline void condition_variable_any::notify_all() _NOEXCEPT {
- {
- lock_guard<mutex> __lx(*__mut_);
- }
+ { lock_guard<mutex> __lx(*__mut_); }
__cv_.notify_all();
}
diff --git a/libcxx/include/cwchar b/libcxx/include/cwchar
index 8a9ee27111..f97d9c4343 100644
--- a/libcxx/include/cwchar
+++ b/libcxx/include/cwchar
@@ -229,7 +229,7 @@ __constexpr_wmemcmp(const wchar_t* __lhs, const wchar_t* __rhs, size_t __count)
template <class _Tp, class _Up>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp* __constexpr_wmemchr(_Tp* __str, _Up __value, size_t __count) {
- static_assert(sizeof(_Tp) == sizeof(wchar_t) && _LIBCPP_ALIGNOF(_Tp) >= _LIBCPP_ALIGNOF(wchar_t) &&
+ static_assert(sizeof(_Tp) == sizeof(wchar_t)&& _LIBCPP_ALIGNOF(_Tp) >= _LIBCPP_ALIGNOF(wchar_t) &&
__libcpp_is_trivially_equality_comparable<_Tp, _Tp>::value,
"Calling wmemchr on non-trivially equality comparable types is unsafe.");
diff --git a/libcxx/include/map b/libcxx/include/map
index 967ca31b40..4e964d2265 100644
--- a/libcxx/include/map
+++ b/libcxx/include/map
@@ -1481,8 +1481,9 @@ template <class _Key,
class _Allocator = allocator<pair<const _Key, _Tp>>,
class = enable_if_t<!__is_allocator<_Compare>::value, void>,
class = enable_if_t<__is_allocator<_Allocator>::value, void>>
-map(initializer_list<pair<_Key, _Tp>>, _Compare = _Compare(), _Allocator = _Allocator())
- -> map<remove_const_t<_Key>, _Tp, _Compare, _Allocator>;
+map(initializer_list<pair<_Key, _Tp>>,
+ _Compare = _Compare(),
+ _Allocator = _Allocator()) -> map<remove_const_t<_Key>, _Tp, _Compare, _Allocator>;
template <class _InputIterator,
class _Allocator,
@@ -1501,8 +1502,8 @@ map(from_range_t, _Range&&, _Allocator)
# endif
template <class _Key, class _Tp, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value, void>>
-map(initializer_list<pair<_Key, _Tp>>, _Allocator)
- -> map<remove_const_t<_Key>, _Tp, less<remove_const_t<_Key>>, _Allocator>;
+map(initializer_list<pair<_Key, _Tp>>,
+ _Allocator) -> map<remove_const_t<_Key>, _Tp, less<remove_const_t<_Key>>, _Allocator>;
# endif
# ifndef _LIBCPP_CXX03_LANG
@@ -2067,8 +2068,9 @@ template <class _Key,
class _Allocator = allocator<pair<const _Key, _Tp>>,
class = enable_if_t<!__is_allocator<_Compare>::value, void>,
class = enable_if_t<__is_allocator<_Allocator>::value, void>>
-multimap(initializer_list<pair<_Key, _Tp>>, _Compare = _Compare(), _Allocator = _Allocator())
- -> multimap<remove_const_t<_Key>, _Tp, _Compare, _Allocator>;
+multimap(initializer_list<pair<_Key, _Tp>>,
+ _Compare = _Compare(),
+ _Allocator = _Allocator()) -> multimap<remove_const_t<_Key>, _Tp, _Compare, _Allocator>;
template <class _InputIterator,
class _Allocator,
@@ -2087,8 +2089,8 @@ multimap(from_range_t, _Range&&, _Allocator)
# endif
template <class _Key, class _Tp, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value, void>>
-multimap(initializer_list<pair<_Key, _Tp>>, _Allocator)
- -> multimap<remove_const_t<_Key>, _Tp, less<remove_const_t<_Key>>, _Allocator>;
+multimap(initializer_list<pair<_Key, _Tp>>,
+ _Allocator) -> multimap<remove_const_t<_Key>, _Tp, less<remove_const_t<_Key>>, _Allocator>;
# endif
# ifndef _LIBCPP_CXX03_LANG
diff --git a/libcxx/include/queue b/libcxx/include/queue
index 6b15fb0ab3..bebea92fc7 100644
--- a/libcxx/include/queue
+++ b/libcxx/include/queue
@@ -451,12 +451,14 @@ template <class _InputIterator,
class _Alloc,
__enable_if_t<__has_input_iterator_category<_InputIterator>::value, int> = 0,
__enable_if_t<__is_allocator<_Alloc>::value, int> = 0>
-queue(_InputIterator, _InputIterator, _Alloc)
- -> queue<__iter_value_type<_InputIterator>, deque<__iter_value_type<_InputIterator>, _Alloc>>;
+queue(_InputIterator,
+ _InputIterator,
+ _Alloc) -> queue<__iter_value_type<_InputIterator>, deque<__iter_value_type<_InputIterator>, _Alloc>>;
template <ranges::input_range _Range, class _Alloc, __enable_if_t<__is_allocator<_Alloc>::value, int> = 0>
-queue(from_range_t, _Range&&, _Alloc)
- -> queue<ranges::range_value_t<_Range>, deque<ranges::range_value_t<_Range>, _Alloc>>;
+queue(from_range_t,
+ _Range&&,
+ _Alloc) -> queue<ranges::range_value_t<_Range>, deque<ranges::range_value_t<_Range>, _Alloc>>;
# endif
template <class _Tp, class _Container>
diff --git a/libcxx/include/set b/libcxx/include/set
index 7d8451dd5c..c4b0b018f2 100644
--- a/libcxx/include/set
+++ b/libcxx/include/set
@@ -934,13 +934,15 @@ template <class _InputIterator,
class _Allocator,
class = enable_if_t<__has_input_iterator_category<_InputIterator>::value, void>,
class = enable_if_t<__is_allocator<_Allocator>::value, void>>
-set(_InputIterator, _InputIterator, _Allocator)
- -> set<__iter_value_type<_InputIterator>, less<__iter_value_type<_InputIterator>>, _Allocator>;
+set(_InputIterator,
+ _InputIterator,
+ _Allocator) -> set<__iter_value_type<_InputIterator>, less<__iter_value_type<_InputIterator>>, _Allocator>;
# if _LIBCPP_STD_VER >= 23
template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value, void>>
-set(from_range_t, _Range&&, _Allocator)
- -> set<ranges::range_value_t<_Range>, less<ranges::range_value_t<_Range>>, _Allocator>;
+set(from_range_t,
+ _Range&&,
+ _Allocator) -> set<ranges::range_value_t<_Range>, less<ranges::range_value_t<_Range>>, _Allocator>;
# endif
template <class _Key, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value, void>>
@@ -1391,8 +1393,9 @@ template <class _Key,
class _Allocator = allocator<_Key>,
class = enable_if_t<__is_allocator<_Allocator>::value, void>,
class = enable_if_t<!__is_allocator<_Compare>::value, void>>
-multiset(initializer_list<_Key>, _Compare = _Compare(), _Allocator = _Allocator())
- -> multiset<_Key, _Compare, _Allocator>;
+multiset(initializer_list<_Key>,
+ _Compare = _Compare(),
+ _Allocator = _Allocator()) -> multiset<_Key, _Compare, _Allocator>;
template <class _InputIterator,
class _Allocator,
@@ -1403,8 +1406,9 @@ multiset(_InputIterator, _InputIterator, _Allocator)
# if _LIBCPP_STD_VER >= 23
template <ranges::input_range _Range, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value, void>>
-multiset(from_range_t, _Range&&, _Allocator)
- -> multiset<ranges::range_value_t<_Range>, less<ranges::range_value_t<_Range>>, _Allocator>;
+multiset(from_range_t,
+ _Range&&,
+ _Allocator) -> multiset<ranges::range_value_t<_Range>, less<ranges::range_value_t<_Range>>, _Allocator>;
# endif
template <class _Key, class _Allocator, class = enable_if_t<__is_allocator<_Allocator>::value, void>>
diff --git a/libcxx/include/span b/libcxx/include/span
index 061a13b7e4..c1417d5ebf 100644
--- a/libcxx/include/span
+++ b/libcxx/include/span
@@ -329,8 +329,8 @@ public:
}
template <size_t _Offset, size_t _Count = dynamic_extent>
- _LIBCPP_HIDE_FROM_ABI constexpr auto subspan() const noexcept
- -> span<element_type, _Count != dynamic_extent ? _Count : _Extent - _Offset> {
+ _LIBCPP_HIDE_FROM_ABI constexpr auto
+ subspan() const noexcept -> span<element_type, _Count != dynamic_extent ? _Count : _Extent - _Offset> {
static_assert(_Offset <= _Extent, "span<T, N>::subspan<Offset, Count>(): Offset out of range");
static_assert(_Count == dynamic_extent || _Count <= _Extent - _Offset,
"span<T, N>::subspan<Offset, Count>(): Offset + Count out of range");
diff --git a/libcxx/include/stack b/libcxx/include/stack
index 9b3dcf2141..da3dcf0216 100644
--- a/libcxx/include/stack
+++ b/libcxx/include/stack
@@ -306,12 +306,14 @@ template <class _InputIterator,
class _Alloc,
__enable_if_t<__has_input_iterator_category<_InputIterator>::value, int> = 0,
__enable_if_t<__is_allocator<_Alloc>::value, int> = 0>
-stack(_InputIterator, _InputIterator, _Alloc)
- -> stack<__iter_value_type<_InputIterator>, deque<__iter_value_type<_InputIterator>, _Alloc>>;
+stack(_InputIterator,
+ _InputIterator,
+ _Alloc) -> stack<__iter_value_type<_InputIterator>, deque<__iter_value_type<_InputIterator>, _Alloc>>;
template <ranges::input_range _Range, class _Alloc, __enable_if_t<__is_allocator<_Alloc>::value, int> = 0>
-stack(from_range_t, _Range&&, _Alloc)
- -> stack<ranges::range_value_t<_Range>, deque<ranges::range_value_t<_Range>, _Alloc>>;
+stack(from_range_t,
+ _Range&&,
+ _Alloc) -> stack<ranges::range_value_t<_Range>, deque<ranges::range_value_t<_Range>, _Alloc>>;
# endif
diff --git a/libcxx/include/string b/libcxx/include/string
index f28965d429..17bf4b3b98 100644
--- a/libcxx/include/string
+++ b/libcxx/include/string
@@ -1047,7 +1047,7 @@ public:
// Turning off ASan instrumentation for variable initialization with _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS
// does not work consistently during initialization of __r_, so we instead unpoison __str's memory manually first.
// __str's memory needs to be unpoisoned only in the case where it's a short string.
- : __rep_([](basic_string& __s) -> decltype(__s.__rep_) && {
+ : __rep_([](basic_string& __s) -> decltype(__s.__rep_)&& {
if (!__s.__is_long())
__s.__annotate_delete();
return std::move(__s.__rep_);
@@ -2312,8 +2312,8 @@ template <class _CharT,
class _Traits,
class _Allocator = allocator<_CharT>,
class = enable_if_t<__is_allocator<_Allocator>::value> >
-explicit basic_string(basic_string_view<_CharT, _Traits>, const _Allocator& = _Allocator())
- -> basic_string<_CharT, _Traits, _Allocator>;
+explicit basic_string(basic_string_view<_CharT, _Traits>,
+ const _Allocator& = _Allocator()) -> basic_string<_CharT, _Traits, _Allocator>;
template <class _CharT,
class _Traits,
diff --git a/libcxx/include/unordered_map b/libcxx/include/unordered_map
index fce64e190b..5d5979b28f 100644
--- a/libcxx/include/unordered_map
+++ b/libcxx/include/unordered_map
@@ -2257,12 +2257,12 @@ template <class _Key,
class = enable_if_t<!is_integral<_Hash>::value>,
class = enable_if_t<!__is_allocator<_Pred>::value>,
class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_multimap(initializer_list<pair<_Key, _Tp>>,
- typename allocator_traits<_Allocator>::size_type = 0,
- _Hash = _Hash(),
- _Pred = _Pred(),
- _Allocator = _Allocator())
- -> unordered_multimap<remove_const_t<_Key>, _Tp, _Hash, _Pred, _Allocator>;
+unordered_multimap(
+ initializer_list<pair<_Key, _Tp>>,
+ typename allocator_traits<_Allocator>::size_type = 0,
+ _Hash = _Hash(),
+ _Pred = _Pred(),
+ _Allocator = _Allocator()) -> unordered_multimap<remove_const_t<_Key>, _Tp, _Hash, _Pred, _Allocator>;
template <class _InputIterator,
class _Allocator,
diff --git a/libcxx/include/unordered_set b/libcxx/include/unordered_set
index 06d6f32868..6f243e0235 100644
--- a/libcxx/include/unordered_set
+++ b/libcxx/include/unordered_set
@@ -940,13 +940,13 @@ template <ranges::input_range _Range,
class = enable_if_t<!is_integral<_Hash>::value>,
class = enable_if_t<!__is_allocator<_Pred>::value>,
class = enable_if_t<__is_allocator<_Allocator>::value>>
-unordered_set(from_range_t,
- _Range&&,
- typename allocator_traits<_Allocator>::size_type = 0,
- _Hash = _Hash(),
- _Pred = _Pred(),
- _Allocator = _Allocator())
- -> unordered_set<ranges::range_value_t<_Range>, _Hash, _Pred, _Allocator>; // C++23
+unordered_set(
+ from_range_t,
+ _Range&&,
+ typename allocator_traits<_Allocator>::size_type = 0,
+ _Hash = _Hash(),
+ _Pred = _Pred(),
+ _Allocator = _Allocator()) -> unordered_set<ranges::range_value_t<_Range>, _Hash, _Pred, _Allocator>; // C++23
# endif
template <class _Tp,
diff --git a/libcxx/include/variant b/libcxx/include/variant
index 1e66daad1d..9006e7ca35 100644
--- a/libcxx/include/variant
+++ b/libcxx/include/variant
@@ -851,7 +851,8 @@ _LIBCPP_VARIANT_MOVE_CONSTRUCTOR(
_LIBCPP_VARIANT_MOVE_CONSTRUCTOR(
_Trait::_Available,
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __move_constructor(__move_constructor&& __that) noexcept(
- __all<is_nothrow_move_constructible_v<_Types>...>::value) : __move_constructor(__valueless_t{}) {
+ __all<is_nothrow_move_constructible_v<_Types>...>::value)
+ : __move_constructor(__valueless_t{}) {
this->__generic_construct(*this, std::move(__that));
} _LIBCPP_EAT_SEMICOLON);
@@ -887,9 +888,8 @@ _LIBCPP_VARIANT_COPY_CONSTRUCTOR(
_LIBCPP_VARIANT_COPY_CONSTRUCTOR(
_Trait::_Available,
- _LIBCPP_HIDE_FROM_ABI
- _LIBCPP_CONSTEXPR_SINCE_CXX20 __copy_constructor(const __copy_constructor& __that) : __copy_constructor(
- __valueless_t{}) { this->__generic_construct(*this, __that); } _LIBCPP_EAT_SEMICOLON);
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __copy_constructor(const __copy_constructor& __that)
+ : __copy_constructor(__valueless_t{}) { this->__generic_construct(*this, __that); } _LIBCPP_EAT_SEMICOLON);
_LIBCPP_VARIANT_COPY_CONSTRUCTOR(
_Trait::_Unavailable,
@@ -1580,8 +1580,8 @@ visit(_Visitor&& __visitor, _Vs&&... __vs) {
template <class... _Types>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 auto
-swap(variant<_Types...>& __lhs, variant<_Types...>& __rhs) noexcept(noexcept(__lhs.swap(__rhs)))
- -> decltype(__lhs.swap(__rhs)) {
+swap(variant<_Types...>& __lhs,
+ variant<_Types...>& __rhs) noexcept(noexcept(__lhs.swap(__rhs))) -> decltype(__lhs.swap(__rhs)) {
return __lhs.swap(__rhs);
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/119234
More information about the libcxx-commits
mailing list