This is an automated email from the ASF dual-hosted git repository.

felipecrv pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/main by this push:
     new 3087c94169 GH-39387: [C++] Fix compile warning (#39389)
3087c94169 is described below

commit 3087c941699ea8485de619b8a36d98322fe20aa0
Author: shibei <[email protected]>
AuthorDate: Tue Jan 2 09:23:56 2024 +0800

    GH-39387: [C++] Fix compile warning (#39389)
    
    
    
    ### Rationale for this change
    
    Fix compile warning:
    ```bash
    In file included from /workspace/arrow/cpp/src/arrow/array/array_base.h:26:
    /workspace/arrow/cpp/src/arrow/array/data.h:452:19: warning: unused 
variable 'buffer_length' [-Wunused-variable]
        const int64_t buffer_length = buffers[i].size / 
static_cast<int64_t>(sizeof(T));
                      ^
    /workspace/arrow/cpp/src/arrow/array/data.h:467:19: warning: unused 
variable 'buffer_length' [-Wunused-variable]
        const int64_t buffer_length = buffers[i].size / 
static_cast<int64_t>(sizeof(T));
                      ^
    2 warnings generated.
    ```
    
    ### What changes are included in this PR?
    
    ### Are these changes tested?
    
    ### Are there any user-facing changes?
    
    * Closes: #39387
    
    Authored-by: shibei <[email protected]>
    Signed-off-by: Felipe Oliveira Carvalho <[email protected]>
---
 cpp/src/arrow/array/data.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/cpp/src/arrow/array/data.h b/cpp/src/arrow/array/data.h
index f29f164d19..edd443adc4 100644
--- a/cpp/src/arrow/array/data.h
+++ b/cpp/src/arrow/array/data.h
@@ -451,6 +451,7 @@ struct ARROW_EXPORT ArraySpan {
   util::span<const T> GetSpan(int i, int64_t length) const {
     const int64_t buffer_length = buffers[i].size / 
static_cast<int64_t>(sizeof(T));
     assert(i > 0 && length + offset <= buffer_length);
+    ARROW_UNUSED(buffer_length);
     return util::span<const T>(buffers[i].data_as<T>() + this->offset, length);
   }
 
@@ -466,6 +467,7 @@ struct ARROW_EXPORT ArraySpan {
   util::span<T> GetSpan(int i, int64_t length) {
     const int64_t buffer_length = buffers[i].size / 
static_cast<int64_t>(sizeof(T));
     assert(i > 0 && length + offset <= buffer_length);
+    ARROW_UNUSED(buffer_length);
     return util::span<T>(buffers[i].mutable_data_as<T>() + this->offset, 
length);
   }
 

Reply via email to