Skip to content

Commit

Permalink
apacheGH-41112: [C++] Clean up unused parameter warnings (apache#41111)
Browse files Browse the repository at this point in the history
Noticed these when compiling the nanoarrow test suite with -Wextra
* GitHub Issue: apache#41112

### Rationale for this change

Helps clean up build warnings when compiling with -Wextra

### What changes are included in this PR?

Used Arrow macros to mark some parameters as unused

### Are these changes tested?

N/A - just ensured program compiles cleanly

### Are there any user-facing changes?

No

Authored-by: Will Ayd <[email protected]>
Signed-off-by: Felipe Oliveira Carvalho <[email protected]>
  • Loading branch information
WillAyd authored Apr 18, 2024
1 parent 144c5ef commit 933ee7e
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 11 deletions.
5 changes: 3 additions & 2 deletions cpp/src/arrow/array/builder_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,9 @@ class ARROW_EXPORT ArrayBuilder {
/// \brief Append a range of values from an array.
///
/// The given array must be the same type as the builder.
virtual Status AppendArraySlice(const ArraySpan& array, int64_t offset,
int64_t length) {
virtual Status AppendArraySlice([[maybe_unused]] const ArraySpan& array,
[[maybe_unused]] int64_t offset,
[[maybe_unused]] int64_t length) {
return Status::NotImplemented("AppendArraySlice for builder for ", *type());
}

Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/array/builder_nested.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ class ARROW_EXPORT VarLengthListLikeBuilder : public ArrayBuilder {
/// \brief Append dimensions for a single list slot.
///
/// ListViewBuilder overrides this to also append the size.
virtual void UnsafeAppendDimensions(int64_t offset, int64_t size) {
virtual void UnsafeAppendDimensions(int64_t offset, [[maybe_unused]] int64_t size) {
offsets_builder_.UnsafeAppend(static_cast<offset_type>(offset));
}

Expand Down
5 changes: 3 additions & 2 deletions cpp/src/arrow/array/builder_primitive.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ namespace arrow {
class ARROW_EXPORT NullBuilder : public ArrayBuilder {
public:
explicit NullBuilder(MemoryPool* pool = default_memory_pool(),
int64_t alignment = kDefaultBufferAlignment)
[[maybe_unused]] int64_t alignment = kDefaultBufferAlignment)
: ArrayBuilder(pool) {}
explicit NullBuilder(const std::shared_ptr<DataType>& type,

explicit NullBuilder([[maybe_unused]] const std::shared_ptr<DataType>& type,
MemoryPool* pool = default_memory_pool(),
int64_t alignment = kDefaultBufferAlignment)
: NullBuilder(pool, alignment) {}
Expand Down
8 changes: 5 additions & 3 deletions cpp/src/arrow/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ class ARROW_EXPORT Device : public std::enable_shared_from_this<Device>,
/// This should create the appropriate stream type for the device,
/// derived from Device::Stream to allow for stream ordered events
/// and memory allocations.
virtual Result<std::shared_ptr<Stream>> MakeStream(unsigned int flags) {
virtual Result<std::shared_ptr<Stream>> MakeStream(
[[maybe_unused]] unsigned int flags) {
return NULLPTR;
}

Expand All @@ -149,8 +150,9 @@ class ARROW_EXPORT Device : public std::enable_shared_from_this<Device>,
/// @param release_fn a function to call during destruction, `nullptr` or
/// a no-op function can be passed to indicate ownership is maintained
/// externally
virtual Result<std::shared_ptr<Stream>> WrapStream(void* device_stream,
Stream::release_fn_t release_fn) {
virtual Result<std::shared_ptr<Stream>> WrapStream(
[[maybe_unused]] void* device_stream,
[[maybe_unused]] Stream::release_fn_t release_fn) {
return NULLPTR;
}

Expand Down
12 changes: 9 additions & 3 deletions cpp/src/arrow/type.h
Original file line number Diff line number Diff line change
Expand Up @@ -1723,7 +1723,9 @@ class ARROW_EXPORT MonthIntervalType : public IntervalType {

MonthIntervalType() : IntervalType(type_id) {}

std::string ToString(bool show_metadata = false) const override { return name(); }
std::string ToString([[maybe_unused]] bool show_metadata = false) const override {
return name();
}
std::string name() const override { return "month_interval"; }
};

Expand Down Expand Up @@ -1759,7 +1761,9 @@ class ARROW_EXPORT DayTimeIntervalType : public IntervalType {

int bit_width() const override { return static_cast<int>(sizeof(c_type) * CHAR_BIT); }

std::string ToString(bool show_metadata = false) const override { return name(); }
std::string ToString([[maybe_unused]] bool show_metadata = false) const override {
return name();
}
std::string name() const override { return "day_time_interval"; }
};

Expand Down Expand Up @@ -1799,7 +1803,9 @@ class ARROW_EXPORT MonthDayNanoIntervalType : public IntervalType {

int bit_width() const override { return static_cast<int>(sizeof(c_type) * CHAR_BIT); }

std::string ToString(bool show_metadata = false) const override { return name(); }
std::string ToString([[maybe_unused]] bool show_metadata = false) const override {
return name();
}
std::string name() const override { return "month_day_nano_interval"; }
};

Expand Down

0 comments on commit 933ee7e

Please sign in to comment.