Skip to content

Commit cff3446

Browse files
committed
Pretty clang-format find/version check messages
Let's make these more consistent with the messages for `find_package(Python)` and the assembler. If nothing else, showing the path to the found clang-format may help folks who are finding the wrong version. Remove extraneous `element_type` from `ContiguousIterator` And while we're here, use `value_type` and `difference_type` where appropriate so we can easily see which `int` is which. Remove unused include from `P2163R3_invoke_r` This test doesn't need `is_permissive.hpp` after microsoft#4914. Simplify `construct_at` constraint Investigate a couple of libc++ failures Add some missing `#endif` comments These were incorrectly removed by microsoft#4944.
1 parent ab20dbd commit cff3446

File tree

9 files changed

+27
-33
lines changed

9 files changed

+27
-33
lines changed

stl/inc/xutility

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,8 +435,8 @@ struct _Get_rebind_alias<_Ty, _Other, void_t<typename _Ty::template rebind<_Othe
435435

436436
#if _HAS_CXX20
437437
_EXPORT_STD template <class _Ty, class... _Types>
438-
requires requires(_Ty* _Location, _Types&&... _Args) {
439-
::new (static_cast<void*>(_Location)) _Ty(_STD forward<_Types>(_Args)...); // per LWG-3888
438+
requires requires(void* _VoidPtr, _Types&&... _Args) {
439+
::new (_VoidPtr) _Ty(_STD forward<_Types>(_Args)...); // per LWG-3888
440440
}
441441
constexpr _Ty* construct_at(_Ty* const _Location, _Types&&... _Args) noexcept(
442442
noexcept(::new(static_cast<void*>(_Location)) _Ty(_STD forward<_Types>(_Args)...))) /* strengthened */ {

tests/libcxx/expected_results.txt

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -576,15 +576,17 @@ std/input.output/filesystems/class.path/range_concept_conformance.compile.pass.c
576576
# This test is bogus according to the wording that was ultimately accepted for C++23.
577577
std/strings/basic.string/string.capacity/resize_and_overwrite.pass.cpp FAIL
578578

579-
# contiguous_iterator requires to_address() which calls operator->(), but this bogus test uses an iterator that lacks operator->().
579+
# libc++ speculatively implements the proposed resolution for LWG-4058.
580580
std/iterators/iterator.requirements/iterator.concepts/iterator.concept.random.access/contiguous_iterator.compile.pass.cpp FAIL
581-
582-
# Bogus test expects to_address() to SFINAE away for int.
583581
std/utilities/memory/pointer.conversion/to_address_without_pointer_traits.pass.cpp FAIL
584582

585583
# We disagree about whether various chrono types should be optimized, and the test is clearly wrong about vector<bool>::reference.
586584
std/utilities/format/format.formatter/format.formatter.locking/enable_nonlocking_formatter_optimization.compile.pass.cpp FAIL
587585

586+
# `increasing_allocator` calls `std::allocator::deallocate` with the wrong size
587+
std/containers/sequences/vector.bool/shrink_to_fit.pass.cpp FAIL
588+
std/containers/sequences/vector/vector.capacity/shrink_to_fit.pass.cpp FAIL
589+
588590

589591
# *** LIKELY STL BUGS ***
590592
# Not analyzed, likely STL bugs. Various assertions.
@@ -1221,12 +1223,6 @@ std/time/time.zone/time.zone.zonedtime/time.zone.zonedtime.nonmembers/ostream.pa
12211223
# Not analyzed. static_assert(testComplexity()) is failing.
12221224
std/algorithms/alg.sorting/alg.set.operations/set.intersection/set_intersection_complexity.pass.cpp FAIL
12231225

1224-
# Not analyzed.
1225-
# MSVC constexpr error: failure was caused by unexpected deallocation count
1226-
# Clang assertion: _CrtIsValidHeapPointer(block)
1227-
std/containers/sequences/vector.bool/shrink_to_fit.pass.cpp FAIL
1228-
std/containers/sequences/vector/vector.capacity/shrink_to_fit.pass.cpp FAIL
1229-
12301226
# Not analyzed.
12311227
# MSVC truncation warnings.
12321228
# Clang assertion: std::hermite(n, +inf) == inf

tests/std/tests/GH_003663_cast_contiguous_iterator_difference_type/test.compile.pass.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,22 @@ class ContiguousIterator {
88
public:
99
using value_type = int;
1010
using difference_type = int;
11-
using element_type = int;
1211
using iterator_category = std::contiguous_iterator_tag;
13-
int* operator->() const;
14-
int& operator*() const;
15-
int& operator[](int) const;
12+
13+
value_type* operator->() const;
14+
value_type& operator*() const;
15+
value_type& operator[](difference_type) const;
1616
ContiguousIterator& operator++();
1717
ContiguousIterator operator++(int);
1818
ContiguousIterator& operator--();
1919
ContiguousIterator operator--(int);
20-
ContiguousIterator& operator+=(int);
21-
ContiguousIterator& operator-=(int);
20+
ContiguousIterator& operator+=(difference_type);
21+
ContiguousIterator& operator-=(difference_type);
2222
friend auto operator<=>(ContiguousIterator, ContiguousIterator) = default;
23-
friend int operator-(ContiguousIterator, ContiguousIterator);
24-
friend ContiguousIterator operator+(ContiguousIterator, int);
25-
friend ContiguousIterator operator-(ContiguousIterator, int);
26-
friend ContiguousIterator operator+(int, ContiguousIterator);
23+
friend difference_type operator-(ContiguousIterator, ContiguousIterator);
24+
friend ContiguousIterator operator+(ContiguousIterator, difference_type);
25+
friend ContiguousIterator operator-(ContiguousIterator, difference_type);
26+
friend ContiguousIterator operator+(difference_type, ContiguousIterator);
2727
};
2828

2929
static_assert(std::contiguous_iterator<ContiguousIterator>);

tests/std/tests/P1206R7_ranges_to_mappish/test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ struct mappish_instantiator {
162162
assert(c6.get_allocator().state == 13);
163163
assert(ranges::is_permutation(c6, expected, any_pair_eq));
164164
}
165-
#endif
165+
#endif // ^^^ no workaround ^^^
166166
{
167167
std::same_as<T> auto c7 = R{some_pairs} | ranges::to<C>(Alloc{13});
168168
assert(c7.get_allocator().state == 13);

tests/std/tests/P1206R7_ranges_to_misc/test.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ constexpr bool test_reservable() {
6262
assert(r.cap_ == ranges::size(some_ints));
6363
assert(r.reserved_ == ranges::size(some_ints));
6464
}
65-
#endif
65+
#endif // ^^^ no workaround ^^^
6666

6767
return true;
6868
}
@@ -100,7 +100,7 @@ constexpr bool test_common_constructible() {
100100
assert(c1.last_ == ranges::end(some_ints));
101101
assert(c1.args_ == 3);
102102
}
103-
#endif
103+
#endif // ^^^ no workaround ^^^
104104

105105
// Verify that more than one argument can be passed after the range:
106106
{
@@ -116,7 +116,7 @@ constexpr bool test_common_constructible() {
116116
assert(c3.last_ == ranges::end(some_ints));
117117
assert(c3.args_ == 4);
118118
}
119-
#endif
119+
#endif // ^^^ no workaround ^^^
120120

121121
return true;
122122
}
@@ -315,7 +315,7 @@ constexpr void test_lwg4016_per_kind() {
315315
std::same_as<V> auto vec = std::views::empty<int> | ranges::to<V>(std::size_t{42}, std::allocator<int>{});
316316
assert(ranges::equal(vec, std::views::repeat(0, 42)));
317317
}
318-
#endif
318+
#endif // ^^^ no workaround ^^^
319319
{
320320
std::same_as<V> auto vec = ranges::to<V>(std::views::iota(0, 42), std::initializer_list<int>{-3, -2, -1});
321321
assert(ranges::equal(vec, std::views::iota(-3, 42)));

tests/std/tests/P1206R7_ranges_to_sequence/test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ struct sequence_instantiator {
151151
assert(c6.get_allocator().state == 13);
152152
assert(ranges::equal(c6, meow));
153153
}
154-
#endif
154+
#endif // ^^^ no workaround ^^^
155155
{
156156
std::same_as<T> auto c7 = R{meow} | ranges::to<C>(Alloc{13});
157157
assert(c7.get_allocator().state == 13);

tests/std/tests/P1206R7_ranges_to_settish/test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ struct settish_instantiator {
156156
assert(c6.get_allocator().state == 13);
157157
assert(ranges::is_permutation(c6, expected));
158158
}
159-
#endif
159+
#endif // ^^^ no workaround ^^^
160160
{
161161
std::same_as<T> auto c7 = R{some_ints} | ranges::to<C>(Alloc{13});
162162
assert(c7.get_allocator().state == 13);

tests/std/tests/P2136R3_invoke_r/test.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
#include <string>
77
#include <type_traits>
88

9-
#include <is_permissive.hpp>
10-
119
using namespace std;
1210

1311
constexpr int square(int n) {

tools/format/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ execute_process(
2020
if(clang_format_version MATCHES "clang-format version ([0-9]+\.[0-9]+\.[0-9]+)")
2121
set(expected_version "17.0.3")
2222
if(CMAKE_MATCH_1 VERSION_LESS expected_version)
23-
message(FATAL_ERROR "Found clang-format ${CMAKE_MATCH_1}, older than expected ${expected_version}.")
23+
message(FATAL_ERROR "Found clang-format: ${CLANG_FORMAT} (\"${CMAKE_MATCH_1}\", older than expected version \"${expected_version}\")")
2424
elseif(CMAKE_MATCH_1 VERSION_EQUAL expected_version)
25-
message(STATUS "Found clang-format ${CMAKE_MATCH_1}.")
25+
message(STATUS "Found clang-format: ${CLANG_FORMAT} (found expected version \"${CMAKE_MATCH_1}\")")
2626
elseif(CMAKE_MATCH_1 VERSION_GREATER expected_version)
27-
message(WARNING "Found clang-format ${CMAKE_MATCH_1}, newer than expected ${expected_version}.")
27+
message(WARNING "Found clang-format: ${CLANG_FORMAT} (\"${CMAKE_MATCH_1}\", newer than expected version \"${expected_version}\")")
2828
endif()
2929
else()
3030
message(FATAL_ERROR "Unexpected `clang-format --version` output: '${clang_format_version}'")

0 commit comments

Comments
 (0)