Skip to content

[libc++][test] Cleanup typos and unnecessary semicolons #73435

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -302,10 +302,10 @@ constexpr bool test() {
// Copying from `bool` to `char` will invoke the optimization, so only check one direction.
test_copy_and_move<char, bool>();

// Copying between different structs with the same represenation (there is no way to guarantee the representation is
// Copying between different structs with the same representation (there is no way to guarantee the representation is
// the same).
test_copy_and_move<S1, S2>();
// Copying between different unions with the same represenation.
// Copying between different unions with the same representation.
test_copy_and_move<U1, U2>();

// Copying from a regular pointer to a void pointer (these are not considered trivially copyable).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// UNSUPPORTED: c++03, c++11, c++14
// UNSUPPORTED: libcpp-has-no-incomplete-pstl

// Having a customization point outside the module doesn't work, so this test is inherintly module-hostile.
// Having a customization point outside the module doesn't work, so this test is inherently module-hostile.
// UNSUPPORTED: clang-modules-build

// Make sure that the customization points get called properly when overloaded
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ int main(int, char**) {
([=] { std::layout_stride::template mapping<std::extents<signed char, D, 10>> m(arg); }()),
"layout_stride::mapping converting ctor: other.required_span_size() must be representable as index_type.");
}
// base offset must be 0 (i.e. mapping(0,...,0)==0) for a strided layout with positiv strides
// base offset must be 0 (i.e. mapping(0,...,0)==0) for a strided layout with positive strides
{
always_convertible_layout::mapping<std::dextents<int, 2>> offset_map(std::dextents<int, 2>{10, 10}, 3);
TEST_LIBCPP_ASSERT_FAILURE(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_NODISCARD_EXT

// Check that <bit> functions aren't marked [[nodiscard]] when
// _LIBCPP_DISBALE_NODISCARD_EXT is defined
// _LIBCPP_DISABLE_NODISCARD_EXT is defined

#include <bit>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//

// Check that format functions aren't marked [[nodiscard]] when
// _LIBCPP_DISBALE_NODISCARD_EXT is defined
// _LIBCPP_DISABLE_NODISCARD_EXT is defined

// UNSUPPORTED: c++03, c++11, c++14, c++17
// UNSUPPORTED: no-filesystem, no-localization, no-tzdb
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//

// Check that format functions aren't marked [[nodiscard]] when
// _LIBCPP_DISBALE_NODISCARD_EXT is defined
// _LIBCPP_DISABLE_NODISCARD_EXT is defined

// TODO FMT This test should not require std::to_chars(floating-point)
// XFAIL: availability-fp_to_chars-missing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//

// Check that PSTL algorithms aren't marked [[nodiscard]] when
// _LIBCPP_DISBALE_NODISCARD_EXT is defined
// _LIBCPP_DISABLE_NODISCARD_EXT is defined

// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_NODISCARD_EXT

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//

// Check that ranges algorithms aren't marked [[nodiscard]] when
// _LIBCPP_DISBALE_NODISCARD_EXT is defined
// _LIBCPP_DISABLE_NODISCARD_EXT is defined

// UNSUPPORTED: c++03, c++11, c++14, c++17

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// void polymorphic_allocator<T>::construct(pair<T1, T2>*, piecewise_construct_t
// tuple<Args1...> x, tuple<Args2...>)

// The stardard specifiers a tranformation to uses-allocator construction as
// The standard specifies a transformation to uses-allocator construction as
// follows:
// - If uses_allocator_v<T1,memory_resource*> is false and
// is_constructible_v<T,Args1...> is true, then xprime is x.
Expand All @@ -36,7 +36,7 @@
//
// The use of "xprime = tuple_cat(..., std::move(x), ...)" causes all of the
// objects in 'x' to be copied into 'xprime'. If 'x' contains any types which
// are stored by value this causes an unessary copy to occur. To prevent this
// are stored by value this causes an unnecessary copy to occur. To prevent this
// libc++ changes this call into
// "xprime = forward_as_tuple(..., std::get<Idx>(std::move(x))..., ...)".
// 'xprime' contains references to the values in 'x' instead of copying them.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ using Overloads = Overload<Types...>;
namespace variant_impl {
template <class ...Types>
using Overloads = std::__variant_detail::_MakeOverloads<Types...>;
} // naamespace variant_impl
} // namespace variant_impl

#ifndef TEST_NS
#error TEST_NS must be defined
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// void polymorphic_allocator<T>::construct(pair<T1, T2>*, piecewise_construct_t
// tuple<Args1...> x, tuple<Args2...>)

// The stardard specifiers a tranformation to uses-allocator construction as
// The standard specifies a transformation to uses-allocator construction as
// follows:
// - If uses_allocator_v<T1,memory_resource*> is false and
// is_constructible_v<T,Args1...> is true, then xprime is x.
Expand All @@ -36,7 +36,7 @@
//
// The use of "xprime = tuple_cat(..., std::move(x), ...)" causes all of the
// objects in 'x' to be copied into 'xprime'. If 'x' contains any types which
// are stored by value this causes an unessary copy to occur. To prevent this
// are stored by value this causes an unnecessary copy to occur. To prevent this
// libc++ changes this call into
// "xprime = forward_as_tuple(..., std::get<Idx>(std::move(x))..., ...)".
// 'xprime' contains references to the values in 'x' instead of copying them.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ static_assert(!HasRemoveIt<PermutableNotForwardIterator>);
static_assert(!HasRemoveIt<PermutableNotSwappable>);
static_assert(!HasRemoveIt<int*, SentinelForNotSemiregular>);
static_assert(!HasRemoveIt<int*, SentinelForNotWeaklyEqualityComparableWith>);
static_assert(!HasRemoveIt<int**>); // not indirect_binary_prediacte
static_assert(!HasRemoveIt<int**>); // not indirect_binary_predicate

template <class Range>
concept HasRemoveR = requires(Range range) { std::ranges::remove(range, 0); };
Expand All @@ -45,7 +45,7 @@ static_assert(!HasRemoveR<PermutableRangeNotForwardIterator>);
static_assert(!HasRemoveR<PermutableRangeNotSwappable>);
static_assert(!HasRemoveR<SentinelForNotSemiregular>);
static_assert(!HasRemoveR<SentinelForNotWeaklyEqualityComparableWith>);
static_assert(!HasRemoveR<UncheckedRange<int**>>); // not indirect_binary_prediacte
static_assert(!HasRemoveR<UncheckedRange<int**>>); // not indirect_binary_predicate

template <int N, int M>
struct Data {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
// ranges::transform(I1 first1, S1 last1, I2 first2, S2 last2, O result,
// F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {});

// The range overloads are tested in ranges.tranform.binary.range.pass.cpp.
// The range overloads are tested in ranges.transform.binary.range.pass.cpp.

#include <algorithm>
#include <array>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
// ranges::transform(R1&& r1, R2&& r2, O result,
// F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {});

// The iterator overloads are tested in ranges.tranform.binary.iterator.pass.cpp.
// The iterator overloads are tested in ranges.transform.binary.iterator.pass.cpp.

#include <algorithm>
#include <array>
Expand All @@ -34,15 +34,15 @@ struct BinaryFunc {
};

template <class Range>
concept HasTranformR = requires(Range r, int* out) { std::ranges::transform(r, r, out, BinaryFunc{}); };

static_assert(HasTranformR<std::array<int, 1>>);
static_assert(!HasTranformR<int>);
static_assert(!HasTranformR<InputRangeNotDerivedFrom>);
static_assert(!HasTranformR<InputRangeNotIndirectlyReadable>);
static_assert(!HasTranformR<InputRangeNotInputOrOutputIterator>);
static_assert(!HasTranformR<InputRangeNotSentinelSemiregular>);
static_assert(!HasTranformR<InputRangeNotSentinelEqualityComparableWith>);
concept HasTransformR = requires(Range r, int* out) { std::ranges::transform(r, r, out, BinaryFunc{}); };

static_assert(HasTransformR<std::array<int, 1>>);
static_assert(!HasTransformR<int>);
static_assert(!HasTransformR<InputRangeNotDerivedFrom>);
static_assert(!HasTransformR<InputRangeNotIndirectlyReadable>);
static_assert(!HasTransformR<InputRangeNotInputOrOutputIterator>);
static_assert(!HasTransformR<InputRangeNotSentinelSemiregular>);
static_assert(!HasTransformR<InputRangeNotSentinelEqualityComparableWith>);

template <class It>
concept HasTransformOut = requires(int* it, int* sent, It out, std::array<int, 2> range) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@
#include "almost_satisfies_types.h"

template <class Range>
concept HasTranformR = requires(Range r, int* out) { std::ranges::transform(r, out, std::identity{}); };

static_assert(HasTranformR<std::array<int, 1>>);
static_assert(!HasTranformR<int>);
static_assert(!HasTranformR<InputRangeNotDerivedFrom>);
static_assert(!HasTranformR<InputRangeNotIndirectlyReadable>);
static_assert(!HasTranformR<InputRangeNotInputOrOutputIterator>);
static_assert(!HasTranformR<InputRangeNotSentinelSemiregular>);
static_assert(!HasTranformR<InputRangeNotSentinelEqualityComparableWith>);
concept HasTransformR = requires(Range r, int* out) { std::ranges::transform(r, out, std::identity{}); };

static_assert(HasTransformR<std::array<int, 1>>);
static_assert(!HasTransformR<int>);
static_assert(!HasTransformR<InputRangeNotDerivedFrom>);
static_assert(!HasTransformR<InputRangeNotIndirectlyReadable>);
static_assert(!HasTransformR<InputRangeNotInputOrOutputIterator>);
static_assert(!HasTransformR<InputRangeNotSentinelSemiregular>);
static_assert(!HasTransformR<InputRangeNotSentinelEqualityComparableWith>);

template <class It, class Sent = It>
concept HasTransformIt =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
// constexpr bool // constexpr after c++17
// equal(Iter1 first1, Iter1 last1, Iter2 first2, Iter2 last2);

// We test the cartesian product, so we somethimes compare differently signed types
// We test the cartesian product, so we sometimes compare differently signed types
// ADDITIONAL_COMPILE_FLAGS: -Wno-sign-compare

#include <algorithm>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ constexpr void test_iterator() {
assert(i == 4);
}

{ // check that an emptry range works
{ // check that an empty range works
int a[] = {};
std::ranges::for_each_n(Iter(a), 0, [](auto&) { assert(false); });
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ constexpr void test_iterators() {
}
}

{ // check that it's partitoned if the predicate is true for all elements
{ // check that it's partitioned if the predicate is true for all elements
{
int a[] = {1, 2, 3, 4};
auto ret = std::ranges::is_partitioned(Iter(a), Sent(Iter(a + 4)), [](int) { return true; });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ test_pointer_sort()

// test_adversarial_quicksort generates a vector with values arranged in such a
// way that they would invoke O(N^2) behavior on any quick sort implementation
// that satisifies certain conditions. Details are available in the following
// that satisfies certain conditions. Details are available in the following
// paper:
// "A Killer Adversary for Quicksort", M. D. McIlroy, Software-Practice &
// Experience Volume 29 Issue 4 April 10, 1999 pp 341-344.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ static_assert(!std::semiregular<has_rvalue_reference_member>);
static_assert(!std::semiregular<has_function_ref_member>);
static_assert(!std::semiregular<deleted_assignment_from_const_rvalue>);

// Not default_initialzable
// Not default_initializable
static_assert(!std::semiregular<std::runtime_error>);
static_assert(
!std::semiregular<std::tuple<std::runtime_error, std::overflow_error> >);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <cassert>

// Flag that makes the copy constructor for CMyClass throw an exception
static bool gCopyConstructorShouldThow = false;
static bool gCopyConstructorShouldThrow = false;

class CMyClass {
public: CMyClass(int tag);
Expand Down Expand Up @@ -51,8 +51,8 @@ CMyClass::CMyClass(const CMyClass& iOther) :
fMagicValue(kStartedConstructionMagicValue), fTag(iOther.fTag)
{
// If requested, throw an exception _before_ setting fMagicValue to kFinishedConstructionMagicValue
if (gCopyConstructorShouldThow) {
throw std::exception();
if (gCopyConstructorShouldThrow) {
throw std::exception();
}
// Signal that the constructor has finished running
fMagicValue = kFinishedConstructionMagicValue;
Expand All @@ -74,14 +74,14 @@ int main(int, char**)
vec.push_back(instance);
std::deque<CMyClass> vec2(vec);

gCopyConstructorShouldThow = true;
gCopyConstructorShouldThrow = true;
try {
vec.push_back(instance);
assert(false);
}
catch (...) {
gCopyConstructorShouldThow = false;
assert(vec==vec2);
gCopyConstructorShouldThrow = false;
assert(vec == vec2);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
#include "test_allocator.h"

// Flag that makes the copy constructor for CMyClass throw an exception
static bool gCopyConstructorShouldThow = false;

static bool gCopyConstructorShouldThrow = false;

class CMyClass {
public: CMyClass(int tag);
Expand Down Expand Up @@ -51,8 +50,8 @@ CMyClass::CMyClass(const CMyClass& iOther) :
fMagicValue(kStartedConstructionMagicValue), fTag(iOther.fTag)
{
// If requested, throw an exception _before_ setting fMagicValue to kFinishedConstructionMagicValue
if (gCopyConstructorShouldThow) {
throw std::exception();
if (gCopyConstructorShouldThrow) {
throw std::exception();
}
// Signal that the constructor has finished running
fMagicValue = kFinishedConstructionMagicValue;
Expand All @@ -74,14 +73,14 @@ int main(int, char**)
vec.push_front(instance);
std::deque<CMyClass> vec2(vec);

gCopyConstructorShouldThow = true;
gCopyConstructorShouldThrow = true;
try {
vec.push_front(instance);
assert(false);
}
catch (...) {
gCopyConstructorShouldThow = false;
assert(vec==vec2);
gCopyConstructorShouldThrow = false;
assert(vec == vec2);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
#include "test_macros.h"

// Flag that makes the copy constructor for CMyClass throw an exception
static bool gCopyConstructorShouldThow = false;

static bool gCopyConstructorShouldThrow = false;

class CMyClass {
public: CMyClass();
Expand Down Expand Up @@ -48,8 +47,8 @@ CMyClass::CMyClass(const CMyClass& /*iOther*/) :
fMagicValue(kStartedConstructionMagicValue)
{
// If requested, throw an exception _before_ setting fMagicValue to kFinishedConstructionMagicValue
if (gCopyConstructorShouldThow) {
throw std::exception();
if (gCopyConstructorShouldThrow) {
throw std::exception();
}
// Signal that the constructor has finished running
fMagicValue = kFinishedConstructionMagicValue;
Expand All @@ -67,7 +66,7 @@ int main(int, char**)

vec.push_front(instance);

gCopyConstructorShouldThow = true;
gCopyConstructorShouldThrow = true;
try {
vec.push_front(instance);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ bool g(int i)
}

struct PredLWG526 {
PredLWG526 (int i) : i_(i) {};
~PredLWG526() { i_ = -32767; }
bool operator() (const PredLWG526 &p) const { return p.i_ == i_; }
PredLWG526(int i) : i_(i) {}
~PredLWG526() { i_ = -32767; }
bool operator()(const PredLWG526& p) const { return p.i_ == i_; }

bool operator==(int i) const { return i == i_;}
int i_;
bool operator==(int i) const { return i == i_; }
int i_;
};

int main(int, char**)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ void do_unique(L &l, Predicate pred, typename L::size_type expected)


struct PredLWG526 {
PredLWG526 (int i) : i_(i) {};
~PredLWG526() { i_ = -32767; }
bool operator() (const PredLWG526 &lhs, const PredLWG526 &rhs) const { return lhs.i_ == rhs.i_; }
PredLWG526(int i) : i_(i) {}
~PredLWG526() { i_ = -32767; }
bool operator()(const PredLWG526& lhs, const PredLWG526& rhs) const { return lhs.i_ == rhs.i_; }

bool operator==(int i) const { return i == i_;}
int i_;
bool operator==(int i) const { return i == i_; }
int i_;
};


Expand Down
Loading