Skip to content
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
1 change: 0 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ Checks:
- 'modernize-*'
- '-modernize-use-integer-sign-comparison'
- '-modernize-use-nodiscard'
- '-modernize-use-equals-default'
- '-modernize-return-braced-init-list'
- '-modernize-use-auto'
# END REMOVE ME
Expand Down
2 changes: 1 addition & 1 deletion c/parallel/test/test_radix_sort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ struct TestParameters
static constexpr bool m_descending = descending;
static constexpr bool m_overwrite_okay = overwrite_okay;

constexpr TestParameters() {}
constexpr TestParameters() = default;
Comment thread
Jacobfaib marked this conversation as resolved.

bool is_descending() const
{
Expand Down
2 changes: 1 addition & 1 deletion c/parallel/test/test_segmented_sort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ struct TestParameters
static constexpr bool m_descending = descending;
static constexpr bool m_overwrite_okay = overwrite_okay;

constexpr TestParameters() {}
constexpr TestParameters() = default;

constexpr bool is_descending() const
{
Expand Down
4 changes: 2 additions & 2 deletions c2h/include/c2h/checked_allocator.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public:
using other = checked_cuda_allocator<U>;
};

_CCCL_HOST_DEVICE checked_cuda_allocator() {}
checked_cuda_allocator() = default;

_CCCL_HOST_DEVICE checked_cuda_allocator(const checked_cuda_allocator& other)
: base(other)
Expand All @@ -173,7 +173,7 @@ public:

checked_cuda_allocator& operator=(const checked_cuda_allocator&) = default;

_CCCL_HOST_DEVICE ~checked_cuda_allocator() {}
~checked_cuda_allocator() = default;
};

struct checked_host_memory_resource final : public THRUST_NS_QUALIFIER::mr::new_delete_resource_base
Expand Down
3 changes: 2 additions & 1 deletion cub/cub/block/block_load_to_shared.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,8 @@ private:
class token_impl
{
friend struct BlockLoadToShared;
_CCCL_DEVICE_API _CCCL_FORCEINLINE token_impl() {} // ctor must have a body to avoid token_impl{} to compile
_CCCL_DEVICE_API _CCCL_FORCEINLINE token_impl() {} // NOLINT(modernize-use-equals-default) ctor must have a body to
// avoid token_impl{} to compile

// NOLINTBEGIN(modernize-use-equals-delete)
token_impl(const token_impl&) = delete;
Expand Down
6 changes: 3 additions & 3 deletions cub/cub/thread/thread_operators.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ struct ScanBySegmentOp
ScanOpT op;

/// Constructor
_CCCL_HOST_DEVICE _CCCL_FORCEINLINE ScanBySegmentOp() {}
_CCCL_FORCEINLINE ScanBySegmentOp() = default;

/// Constructor
_CCCL_HOST_DEVICE _CCCL_FORCEINLINE ScanBySegmentOp(ScanOpT op)
Expand Down Expand Up @@ -301,7 +301,7 @@ struct ReduceBySegmentOp
ReductionOpT op;

/// Constructor
_CCCL_HOST_DEVICE _CCCL_FORCEINLINE ReduceBySegmentOp() {}
_CCCL_FORCEINLINE ReduceBySegmentOp() = default;

/// Constructor
_CCCL_HOST_DEVICE _CCCL_FORCEINLINE ReduceBySegmentOp(ReductionOpT op)
Expand Down Expand Up @@ -362,7 +362,7 @@ struct ReduceByKeyOp
ReductionOpT op;

/// Constructor
_CCCL_HOST_DEVICE _CCCL_FORCEINLINE ReduceByKeyOp() {}
_CCCL_FORCEINLINE ReduceByKeyOp() = default;

/// Constructor
_CCCL_HOST_DEVICE _CCCL_FORCEINLINE ReduceByKeyOp(ReductionOpT op)
Expand Down
2 changes: 1 addition & 1 deletion cub/cub/util_type.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ struct KeyValuePair
Value value; ///< Item value

/// Constructor
_CCCL_HOST_DEVICE _CCCL_FORCEINLINE KeyValuePair() {}
_CCCL_FORCEINLINE KeyValuePair() = default;
Comment thread
Jacobfaib marked this conversation as resolved.

/// Constructor
_CCCL_HOST_DEVICE _CCCL_FORCEINLINE KeyValuePair(Key const& key, Value const& value)
Expand Down
2 changes: 1 addition & 1 deletion cub/test/catch2_test_device_scan_iterators.cu
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ class custom_accumulator_t
{}

public:
__host__ __device__ custom_accumulator_t() {}
custom_accumulator_t() = default;

__host__ __device__ custom_accumulator_t(const custom_accumulator_t& in)
: m_val(in.is_valid() * in.get())
Expand Down
2 changes: 2 additions & 0 deletions cub/test/catch2_test_device_transform.cu
Original file line number Diff line number Diff line change
Expand Up @@ -521,10 +521,12 @@ struct non_trivial
: data(data)
{}

// NOLINTNEXTLINE(modernize-use-equals-default)
__host__ __device__ non_trivial(const non_trivial& nt)
: data(nt.data)
{}

// NOLINTNEXTLINE(modernize-use-equals-default)
__host__ __device__ auto operator=(const non_trivial& nt) -> non_trivial&
{
data = nt.data;
Expand Down
5 changes: 4 additions & 1 deletion cudax/test/execution/common/utility.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,16 @@ struct potentially_throwing

_CCCL_HOST_DEVICE potentially_throwing(potentially_throwing&&) noexcept(false) {}

_CCCL_HOST_DEVICE potentially_throwing(const potentially_throwing&) noexcept(false) {}
_CCCL_HOST_DEVICE
potentially_throwing(const potentially_throwing&) noexcept(false) // NOLINT(modernize-use-equals-default)
{}

_CCCL_HOST_DEVICE potentially_throwing& operator=(potentially_throwing&&) noexcept(false)
{
return *this;
}

// NOLINTNEXTLINE(modernize-use-equals-default)
_CCCL_HOST_DEVICE potentially_throwing& operator=(const potentially_throwing&) noexcept(false)
{
return *this;
Expand Down
4 changes: 3 additions & 1 deletion libcudacxx/include/cuda/__stream/launch_transform.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ struct _CCCL_TYPE_VISIBILITY_DEFAULT __launch_transform_t
struct __optional_with_a_destructor : ::cuda::std::optional<_Tp>
{
using ::cuda::std::optional<_Tp>::optional;
~__optional_with_a_destructor() {}
// Use of explicit destructor is intentional. Without it, the argument may have a trivial
// destructor and hence would be performed by the callee.
~__optional_with_a_destructor() {} // NOLINT(modernize-use-equals-default)

template <class _Fn>
_CCCL_API inline _CCCL_CONSTEXPR_CXX20 _Tp& __emplace_from_fn(_Fn&& __fn)
Expand Down
4 changes: 3 additions & 1 deletion libcudacxx/include/cuda/std/__optional/optional.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@ class optional : private __optional_move_assign_base<_Tp>
static_assert(!is_array_v<value_type>, "instantiation of optional with an array type is ill-formed");

public:
_CCCL_API constexpr optional() noexcept {}
// Use of {} vs = default is deliberate. = default may value-initialize, while {} is
// guaranteed to do absolutely nothing.
_CCCL_API constexpr optional() noexcept {} // NOLINT(modernize-use-equals-default)
_CCCL_HIDE_FROM_ABI constexpr optional(const optional&) = default;
_CCCL_HIDE_FROM_ABI constexpr optional(optional&&) = default;
_CCCL_API constexpr optional(nullopt_t) noexcept {}
Expand Down
4 changes: 3 additions & 1 deletion libcudacxx/include/cuda/std/__optional/optional_ref.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ class optional<_Tp&>
public:
using value_type = __raw_type&;

_CCCL_API constexpr optional() noexcept {}
// Use of {} vs = default is deliberate. = default may value-initialize, while {} is
// guaranteed to do absolutely nothing.
_CCCL_API constexpr optional() noexcept {} // NOLINT(modernize-use-equals-default)
_CCCL_HIDE_FROM_ABI constexpr optional(const optional&) noexcept = default;
_CCCL_HIDE_FROM_ABI constexpr optional(optional&&) noexcept = default;
_CCCL_API constexpr optional(nullopt_t) noexcept {}
Expand Down
19 changes: 15 additions & 4 deletions libcudacxx/include/cuda/std/__tuple_dir/tuple_leaf.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,11 @@ class __tuple_leaf<_Ip, _Hp, __tuple_leaf_specialization::__default>
#endif // !_CCCL_BUILTIN_REFERENCE_CONSTRUCTS_FROM_TEMPORARY

public:
// The compiler-generated constructor would not value-initialize trivial types, but the
// standard requires that we do.
_CCCL_EXEC_CHECK_DISABLE
_CCCL_API constexpr __tuple_leaf() noexcept(is_nothrow_default_constructible_v<_Hp>)
_CCCL_API constexpr __tuple_leaf() // NOLINT(modernize-use-equals-default)
noexcept(is_nothrow_default_constructible_v<_Hp>)
: __value_()
{}

Expand Down Expand Up @@ -227,14 +230,19 @@ class __tuple_leaf<_Ip, _Hp, __tuple_leaf_specialization::__synthesize_assignmen
_CCCL_EXEC_CHECK_DISABLE
__tuple_leaf(__tuple_leaf&& __t) = default;

// Do not use = default here. The value type may be a reference, in which case the defaulted
// assignment constructor is implicitly deleted (a quirk in the C++ spec meant).
_CCCL_EXEC_CHECK_DISABLE
_CCCL_API constexpr __tuple_leaf& operator=(const __tuple_leaf& __t) noexcept
_CCCL_API constexpr __tuple_leaf& operator=(const __tuple_leaf& __t) noexcept // NOLINT(modernize-use-equals-default)
{
__value_ = __t.__value_;
return *this;
}

// Do not use = default here. The value type may be a reference, in which case the defaulted
// assignment constructor is implicitly deleted (a quirk in the C++ spec meant).
_CCCL_EXEC_CHECK_DISABLE
_CCCL_API constexpr __tuple_leaf& operator=(__tuple_leaf&& __t) noexcept
_CCCL_API constexpr __tuple_leaf& operator=(__tuple_leaf&& __t) noexcept // NOLINT(modernize-use-equals-default)
{
__value_ = ::cuda::std::move(__t.__value_);
return *this;
Expand Down Expand Up @@ -267,8 +275,11 @@ template <size_t _Ip, class _Hp>
class __tuple_leaf<_Ip, _Hp, __tuple_leaf_specialization::__empty_non_final> : private remove_const_t<_Hp>
{
public:
// The compiler-generated constructor would not value-initialize trivial types, but the
// standard requires that we do.
_CCCL_EXEC_CHECK_DISABLE
_CCCL_API constexpr __tuple_leaf() noexcept(is_nothrow_default_constructible_v<_Hp>)
_CCCL_API constexpr __tuple_leaf() // NOLINT(modernize-use-equals-default)
noexcept(is_nothrow_default_constructible_v<_Hp>)
: _Hp()
{}

Expand Down
4 changes: 1 addition & 3 deletions libcudacxx/include/cuda/std/__utility/typeid.h
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,7 @@ struct __type_info_ref_ : __type_info
: __type_info(__other)
{}

_CCCL_API constexpr __type_info_ref_(__type_info_ref_ const& __other) noexcept
: __type_info(__other)
{}
_CCCL_HIDE_FROM_ABI constexpr __type_info_ref_(__type_info_ref_ const& __other) noexcept = default;
};

[[nodiscard]] _CCCL_API constexpr __type_info_ref_ __type_info_ptr_::operator*() const noexcept
Expand Down
10 changes: 2 additions & 8 deletions libcudacxx/test/support/test_iterators.h
Original file line number Diff line number Diff line change
Expand Up @@ -983,13 +983,7 @@ struct NonThrowingIterator
, current_(rhs.current_)
{}

TEST_FUNC NonThrowingIterator& operator=(const NonThrowingIterator& rhs) noexcept
{
begin_ = rhs.begin_;
end_ = rhs.end_;
current_ = rhs.current_;
return *this;
}
NonThrowingIterator& operator=(const NonThrowingIterator& rhs) noexcept = default;

TEST_FUNC reference operator*() const noexcept
{
Expand Down Expand Up @@ -2066,7 +2060,7 @@ class advance_only_iterator
using pointer = int*;
using reference = int&;

TEST_FUNC constexpr advance_only_iterator() {}
constexpr advance_only_iterator() = default;
TEST_FUNC constexpr advance_only_iterator(int* iter)
: iter_(iter)
{}
Expand Down
2 changes: 2 additions & 0 deletions thrust/benchmarks/bench/copy/basic.cu
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,13 @@ struct non_trivial
{}

// the user-defined copy constructor prevents the type from being trivially copyable
// NOLINTNEXTLINE(modernize-use-equals-default)
_CCCL_HOST_DEVICE non_trivial(const non_trivial& nt)
: a(nt.a)
, b(nt.b)
{}

// NOLINTNEXTLINE(modernize-use-equals-default)
_CCCL_HOST_DEVICE non_trivial& operator=(const non_trivial& nt)
{
a = nt.a;
Expand Down
1 change: 1 addition & 0 deletions thrust/benchmarks/bench/uninitialized_copy/basic.cu
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ struct no_copy
{}

// the user-defined copy constructor prevents the type from being trivially copyable
// NOLINTNEXTLINE(modernize-use-equals-default)
_CCCL_HOST_DEVICE no_copy(const no_copy& nt)
: a(nt.a)
{}
Expand Down
2 changes: 1 addition & 1 deletion thrust/examples/bounding_box.cu
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ struct point2d
struct bbox
{
// construct an empty box
__host__ __device__ bbox() {}
bbox() = default;

// construct a box from a single point
__host__ __device__ bbox(const point2d& point)
Expand Down
2 changes: 1 addition & 1 deletion thrust/examples/cuda/range_view.cu
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public:
: first(first)
, last(last)
{}
__host__ __device__ ~range_view() {}
~range_view() = default;

__host__ __device__ difference_type size() const
{
Expand Down
2 changes: 1 addition & 1 deletion thrust/examples/include/timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ struct timer
restart();
}

~timer() {}
~timer() = default;

void restart()
{
Expand Down
4 changes: 2 additions & 2 deletions thrust/examples/uninitialized_vector.cu
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ struct uninitialized_allocator : thrust::device_allocator<T>
// marked __host__ __device__, but the current Thrust device_allocator
// can only be constructed and destroyed on the host; therefore, we
// define these as host only
__host__ uninitialized_allocator() {}
__host__ uninitialized_allocator() {} // NOLINT(modernize-use-equals-default)
__host__ uninitialized_allocator(const uninitialized_allocator& other)
: thrust::device_allocator<T>(other)
{}
__host__ ~uninitialized_allocator() {}
__host__ ~uninitialized_allocator() {} // NOLINT(modernize-use-equals-default)

uninitialized_allocator& operator=(const uninitialized_allocator&) = default;

Expand Down
12 changes: 6 additions & 6 deletions thrust/testing/allocator.cu
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
template <typename T>
struct my_allocator_with_custom_construct1 : thrust::device_malloc_allocator<T>
{
_CCCL_HOST_DEVICE my_allocator_with_custom_construct1() {}
my_allocator_with_custom_construct1() = default;

_CCCL_HOST_DEVICE void construct(T* p)
{
Expand All @@ -43,7 +43,7 @@ DECLARE_VARIABLE_UNITTEST(TestAllocatorCustomDefaultConstruct);
template <typename T>
struct my_allocator_with_custom_construct2 : thrust::device_malloc_allocator<T>
{
_CCCL_HOST_DEVICE my_allocator_with_custom_construct2() {}
my_allocator_with_custom_construct2() = default;

template <typename Arg>
_CCCL_HOST_DEVICE void construct(T* p, const Arg&)
Expand Down Expand Up @@ -80,13 +80,13 @@ struct my_allocator_with_custom_destroy

static bool g_state;

_CCCL_HOST my_allocator_with_custom_destroy() {}
_CCCL_HOST my_allocator_with_custom_destroy() {} // NOLINT(modernize-use-equals-default)

_CCCL_HOST my_allocator_with_custom_destroy(const my_allocator_with_custom_destroy& other)
: use_me_to_alloc(other.use_me_to_alloc)
{}

_CCCL_HOST ~my_allocator_with_custom_destroy() {}
_CCCL_HOST ~my_allocator_with_custom_destroy() {} // NOLINT(modernize-use-equals-default)

_CCCL_HOST_DEVICE void destroy(T*) noexcept
{
Expand Down Expand Up @@ -149,13 +149,13 @@ struct my_minimal_allocator
using reference = T&;
using const_reference = const T&;

_CCCL_HOST my_minimal_allocator() {}
_CCCL_HOST my_minimal_allocator() {} // NOLINT(modernize-use-equals-default)

_CCCL_HOST my_minimal_allocator(const my_minimal_allocator& other)
: use_me_to_alloc(other.use_me_to_alloc)
{}

_CCCL_HOST ~my_minimal_allocator() {}
_CCCL_HOST ~my_minimal_allocator() {} // NOLINT(modernize-use-equals-default)

value_type* allocate(std::ptrdiff_t n)
{
Expand Down
2 changes: 1 addition & 1 deletion thrust/testing/cuda/generate.cu
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ struct return_value
{
T val;

return_value() {}
return_value() = default;
return_value(T v)
: val(v)
{}
Expand Down
2 changes: 1 addition & 1 deletion thrust/testing/generate.cu
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ struct return_value
{
T val;

return_value() {}
return_value() = default;
return_value(T v)
: val(v)
{}
Expand Down
2 changes: 1 addition & 1 deletion thrust/testing/mr_pool.cu
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct tracked_pointer
: ptr(ptr)
{}

_CCCL_HOST_DEVICE ~tracked_pointer() {}
~tracked_pointer() = default;

template <typename U>
operator tracked_pointer<U>() const
Expand Down
4 changes: 2 additions & 2 deletions thrust/testing/out_of_memory_recovery.cu
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

struct non_trivial
{
_CCCL_HOST_DEVICE non_trivial() {}
_CCCL_HOST_DEVICE ~non_trivial() {}
_CCCL_HOST_DEVICE non_trivial() {} // NOLINT(modernize-use-equals-default)
_CCCL_HOST_DEVICE ~non_trivial() {} // NOLINT(modernize-use-equals-default)
};

void test_out_of_memory_recovery()
Expand Down
Loading
Loading