Skip to content
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

fix: array coverity hits #2988

Merged
merged 7 commits into from
Dec 11, 2024
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
7 changes: 5 additions & 2 deletions cpp/oneapi/dal/array.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,9 @@ class array {
other.reset_data();
}

// Add destructor
~array() = default;

/// Creates a new array instance which owns a memory block of externally-allocated mutable data.
/// The ownership structure is created for a block, the input :literal:`deleter`
/// is assigned to it.
Expand Down Expand Up @@ -400,15 +403,15 @@ class array {
/// @post :expr:`data == other.data`
/// @post :expr:`mutable_data == other.mutable_data`
/// @post :expr:`count == other.count`
array<T> operator=(const array<T>& other) {
array<T>& operator=(const array<T>& other) {
array<T> tmp{ other };
swap(*this, tmp);
return *this;
}

/// Swaps the values of :literal:`data`, :literal:`mutable_data` pointers, :literal:`count`, and
/// pointer to the ownership structure in the array instance and :literal:`other`.
array<T> operator=(array<T>&& other) {
array<T>& operator=(array<T>&& other) {
swap(*this, other);
return *this;
}
Expand Down
11 changes: 11 additions & 0 deletions cpp/oneapi/dal/chunked_array.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,17 @@ class ONEDAL_EXPORT chunked_array : public detail::chunked_array_base {
/// @param array Source array
chunked_array(const chunked_array& array) : chunked_array_base{ array } {}

/// @brief Move assignment
/// @param array Source array
chunked_array& operator=(chunked_array&& array) = default;

/// @brief Copy assignment
/// @param array Source array
chunked_array& operator=(const chunked_array& array) = default;

/// @brief Destructor
~chunked_array() = default;

/// @brief Constructs an empty `chunked_array`
/// with unpopulated chunks
/// @param chunk_count Number of empty chunks in the
Expand Down
4 changes: 4 additions & 0 deletions cpp/oneapi/dal/detail/chunked_array_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ class chunked_array_impl {
return parent.offsets;
}

mutable_accessor(const mutable_accessor&) = delete;

mutable_accessor& operator=(const mutable_accessor&) = delete;

~mutable_accessor() {
parent.update_offsets();
}
Expand Down
2 changes: 2 additions & 0 deletions cpp/oneapi/dal/detail/chunked_array_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ class ONEDAL_EXPORT chunked_array_base : public base {
return *this;
}

~chunked_array_base() = default;

chunked_array_base() {
reset();
}
Expand Down
Loading