You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "WillAyd (via GitHub)" <gi...@apache.org> on 2024/04/09 23:10:15 UTC

[PR] MINOR: [C++] Clean up unused parameter warnings [arrow]

WillAyd opened a new pull request, #41111:
URL: https://github.com/apache/arrow/pull/41111

   Noticed these when compiling the nanoarrow test suite with -Wextra


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-41112: [C++] Clean up unused parameter warnings [arrow]

Posted by "kou (via GitHub)" <gi...@apache.org>.
kou commented on code in PR #41111:
URL: https://github.com/apache/arrow/pull/41111#discussion_r1558561042


##########
cpp/src/arrow/array/builder_base.h:
##########
@@ -177,6 +177,9 @@ class ARROW_EXPORT ArrayBuilder {
   /// The given array must be the same type as the builder.
   virtual Status AppendArraySlice(const ArraySpan& array, int64_t offset,
                                   int64_t length) {
+    ARROW_UNUSED(array);
+    ARROW_UNUSED(offset);
+    ARROW_UNUSED(length);

Review Comment:
   How about using `ARROW_ARG_UNUSED()` instead?
   
   ```suggestion
     virtual Status AppendArraySlice(const ArraySpan& ARROW_ARG_UNUSED(array), int64_t ARROW_ARG_UNUSED(offset),
                                     int64_t ARROW_ARG_UNUSED(length)) {
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-41112: [C++] Clean up unused parameter warnings [arrow]

Posted by "WillAyd (via GitHub)" <gi...@apache.org>.
WillAyd commented on PR #41111:
URL: https://github.com/apache/arrow/pull/41111#issuecomment-2069234103

   Unfortunate...so I guess back to the macros?
   
   Unless I am reading this wrong I am surprised by that lack of support - this says gcc 7 started support for maybe_unused?
   
   https://en.cppreference.com/w/cpp/compiler_support/17


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-41112: [C++] Clean up unused parameter warnings [arrow]

Posted by "WillAyd (via GitHub)" <gi...@apache.org>.
WillAyd commented on PR #41111:
URL: https://github.com/apache/arrow/pull/41111#issuecomment-2057488772

   Its a fair question. It looks like gcc adds -Wunused-parameter only when both Wextra and Wall are enabled. 
   
   I have no strong opinion either way - if we think this is too much noise in the code then I don't think its the end of the world for downstream libraries to have to ignore this warning


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-41112: [C++] Clean up unused parameter warnings [arrow]

Posted by "kou (via GitHub)" <gi...@apache.org>.
kou commented on code in PR #41111:
URL: https://github.com/apache/arrow/pull/41111#discussion_r1558834380


##########
cpp/src/arrow/array/builder_base.h:
##########
@@ -177,6 +177,9 @@ class ARROW_EXPORT ArrayBuilder {
   /// The given array must be the same type as the builder.
   virtual Status AppendArraySlice(const ArraySpan& array, int64_t offset,
                                   int64_t length) {
+    ARROW_UNUSED(array);
+    ARROW_UNUSED(offset);
+    ARROW_UNUSED(length);

Review Comment:
   I think that we can use `[[maybe_unused]]`.
   Could you open a new issue for this? Let's discuss this on the issue.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-41112: [C++] Clean up unused parameter warnings [arrow]

Posted by "felipecrv (via GitHub)" <gi...@apache.org>.
felipecrv merged PR #41111:
URL: https://github.com/apache/arrow/pull/41111


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-41112: [C++] Clean up unused parameter warnings [arrow]

Posted by "jonkeane (via GitHub)" <gi...@apache.org>.
jonkeane commented on PR #41111:
URL: https://github.com/apache/arrow/pull/41111#issuecomment-2080719545

   Thanks for catching and raising that, Kou! 
   
   I came here to say that I found similar failures in some of our extended tests for the R implementation (which relies on the C++) implementation and for historical reasons is tested across a bunch of operating systems, including some that while old are still not yet EOL. 
   
   Which is causing out nightly builds for test-r-rstudio-r-base-4.1-opensuse153 and test-r-rstudio-r-base-4.2-centos7-devtoolset-8 as well as our r-binary packaging to fail.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-41112: [C++] Clean up unused parameter warnings [arrow]

Posted by "jonkeane (via GitHub)" <gi...@apache.org>.
jonkeane commented on PR #41111:
URL: https://github.com/apache/arrow/pull/41111#issuecomment-2081230928

   Will do! I also ran one of them on his PR too and it was good there.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-41112: [C++] Clean up unused parameter warnings [arrow]

Posted by "pitrou (via GitHub)" <gi...@apache.org>.
pitrou commented on PR #41111:
URL: https://github.com/apache/arrow/pull/41111#issuecomment-2061400572

   @felipecrv This happens in the Arrow headers, so changing our own build flags wouldn't change anything here, AFAICT.
   
   That said, if other people think these warnings do need to be fixed, then why not.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-41112: [C++] Clean up unused parameter warnings [arrow]

Posted by "pitrou (via GitHub)" <gi...@apache.org>.
pitrou commented on PR #41111:
URL: https://github.com/apache/arrow/pull/41111#issuecomment-2057058605

   Hmm, is this necessary? This is making the source code more annoying to read without any tangible benefit.
   
   (we would be bound to add such annotations everywhere a stub function implementation returns `NotImplementedError`, AFAIU)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-41112: [C++] Clean up unused parameter warnings [arrow]

Posted by "WillAyd (via GitHub)" <gi...@apache.org>.
WillAyd commented on code in PR #41111:
URL: https://github.com/apache/arrow/pull/41111#discussion_r1558565563


##########
cpp/src/arrow/util/decimal.h:
##########
@@ -80,7 +80,7 @@ class ARROW_EXPORT Decimal128 : public BasicDecimal128 {
     std::pair<Decimal128, Decimal128> result;
     auto dstatus = BasicDecimal128::Divide(divisor, &result.first, &result.second);
     ARROW_RETURN_NOT_OK(ToArrowStatus(dstatus));
-    return std::move(result);
+    return result;

Review Comment:
   Ah yes sorry about that. Was working off of one branch to try and get a clean nanoarrow build so this slipped in. Will revert



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-41112: [C++] Clean up unused parameter warnings [arrow]

Posted by "kou (via GitHub)" <gi...@apache.org>.
kou commented on PR #41111:
URL: https://github.com/apache/arrow/pull/41111#issuecomment-2081180498

   I've merged WillAyd's fix. Could you try it on your PR?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-41112: [C++] Clean up unused parameter warnings [arrow]

Posted by "felipecrv (via GitHub)" <gi...@apache.org>.
felipecrv commented on PR #41111:
URL: https://github.com/apache/arrow/pull/41111#issuecomment-2057502310

   > Hmm, is this necessary? This is making the source code more annoying to read without any tangible benefit.
   > 
   > (we would be bound to add such annotations everywhere a stub function implementation returns `NotImplementedError`, AFAIU)
   
   Then we should add `-Wno-unused-parameter` to the builds. Otherwise people that use GCC will keep sending these PRs @pitrou.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINOR: [C++] Clean up unused parameter warnings [arrow]

Posted by "kou (via GitHub)" <gi...@apache.org>.
kou commented on code in PR #41111:
URL: https://github.com/apache/arrow/pull/41111#discussion_r1558553188


##########
cpp/src/arrow/util/decimal.h:
##########
@@ -80,7 +80,7 @@ class ARROW_EXPORT Decimal128 : public BasicDecimal128 {
     std::pair<Decimal128, Decimal128> result;
     auto dstatus = BasicDecimal128::Divide(divisor, &result.first, &result.second);
     ARROW_RETURN_NOT_OK(ToArrowStatus(dstatus));
-    return std::move(result);
+    return result;

Review Comment:
   Please don't mix unrelated changes.
   These changes are for https://github.com/apache/arrow/pull/41107 , right?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-41112: [C++] Clean up unused parameter warnings [arrow]

Posted by "kou (via GitHub)" <gi...@apache.org>.
kou commented on PR #41111:
URL: https://github.com/apache/arrow/pull/41111#issuecomment-2071208511

   It seems that `[[maybe_unused]]` in constructor arguments is only unsupported:
   
   ```console
   $ docker run -it --rm almalinux:8
   $ dnf install -y gcc-c++ vim
   $ vim a.cc
   $ cat a.cc
   class A {
     explicit A([[maybe_unused]] int x) {}
     void a([[maybe_unused]] int x) {}
   };
   int main([[maybe_unused]] int argc, [[maybe_unused]] char **argv) {
     return 0;
   }
   $ LANG=C g++ -std=c++17 a.cc
   a.cc:2:14: error: expected unqualified-id before '[' token
      explicit A([[maybe_unused]] int x) {}
                 ^
   a.cc:2:14: error: expected ')' before '[' token
      explicit A([[maybe_unused]] int x) {}
                ~^
                 )
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINOR: [C++] Clean up unused parameter warnings [arrow]

Posted by "WillAyd (via GitHub)" <gi...@apache.org>.
WillAyd commented on PR #41111:
URL: https://github.com/apache/arrow/pull/41111#issuecomment-2046242817

   Good to know and not a problem at all. See https://github.com/apache/arrow/issues/41112


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINOR: [C++] Clean up unused parameter warnings [arrow]

Posted by "felipecrv (via GitHub)" <gi...@apache.org>.
felipecrv commented on PR #41111:
URL: https://github.com/apache/arrow/pull/41111#issuecomment-2046227067

   I hate to be the one bringing boring news, but if a change touches code it can't be considered `MINOR: `, so please create an issue. The change looks great! Thank you for using `ARROW_UNUSED` instead of simply removing the parameter names from the function definitions.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-41112: [C++] Clean up unused parameter warnings [arrow]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #41111:
URL: https://github.com/apache/arrow/pull/41111#issuecomment-2046257514

   :warning: GitHub issue #41112 **has been automatically assigned in GitHub** to PR creator.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-41112: [C++] Clean up unused parameter warnings [arrow]

Posted by "conbench-apache-arrow[bot] (via GitHub)" <gi...@apache.org>.
conbench-apache-arrow[bot] commented on PR #41111:
URL: https://github.com/apache/arrow/pull/41111#issuecomment-2065323994

   After merging your PR, Conbench analyzed the 7 benchmarking runs that have been run so far on merge-commit 933ee7e7398a43780248ff8eacff6118142f14d2.
   
   There were 5 benchmark results indicating a performance regression:
   
   - Commit Run on `ursa-i9-9960x` at [2024-04-18 20:10:10Z](https://conbench.ursa.dev/compare/runs/b8baf938651f4dbea797386add09763f...76456360a6624cc381914761ee3fd9eb/)
     - [`tpch` (R) with engine=arrow, format=parquet, language=R, memory_map=False, query_id=TPCH-01, scale_factor=1](https://conbench.ursa.dev/compare/benchmarks/0662122d2e3c707580003026a5bcb7d7...06621772a4a276da80007dfb84902443)
     - [`tpch` (R) with engine=arrow, format=native, language=R, memory_map=False, query_id=TPCH-02, scale_factor=1](https://conbench.ursa.dev/compare/benchmarks/06621230ffde770f8000c311ce0ebd4a...0662177797357c098000ef9be4e6eb0e)
   - and 3 more (see the report linked below)
   
   The [full Conbench report](https://github.com/apache/arrow/runs/23998086410) has more details. It also includes information about 6 possible false positives for unstable benchmarks that are known to sometimes produce them.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-41112: [C++] Clean up unused parameter warnings [arrow]

Posted by "pitrou (via GitHub)" <gi...@apache.org>.
pitrou commented on code in PR #41111:
URL: https://github.com/apache/arrow/pull/41111#discussion_r1565934445


##########
cpp/src/arrow/array/builder_base.h:
##########
@@ -177,6 +177,9 @@ class ARROW_EXPORT ArrayBuilder {
   /// The given array must be the same type as the builder.
   virtual Status AppendArraySlice(const ArraySpan& array, int64_t offset,
                                   int64_t length) {
+    ARROW_UNUSED(array);
+    ARROW_UNUSED(offset);
+    ARROW_UNUSED(length);

Review Comment:
   Can you just try to use `[[maybe_unused]]` in this PR?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-41112: [C++] Clean up unused parameter warnings [arrow]

Posted by "felipecrv (via GitHub)" <gi...@apache.org>.
felipecrv commented on PR #41111:
URL: https://github.com/apache/arrow/pull/41111#issuecomment-2071132534

   > Unfortunate...so I guess back to the macros?
   
   Yes, please. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-41112: [C++] Clean up unused parameter warnings [arrow]

Posted by "kou (via GitHub)" <gi...@apache.org>.
kou commented on PR #41111:
URL: https://github.com/apache/arrow/pull/41111#issuecomment-2068485191

   Hmm.
   It seems that `[[maybe_unused]]` doesn't work g++ 8.5.0:
   
   https://github.com/ursacomputing/crossbow/actions/runs/8772764647/job/24072078525#step:6:167
   
   ```text
   -- The CXX compiler identification is GNU 8.5.0
   ```
   
   https://github.com/ursacomputing/crossbow/actions/runs/8772764647/job/24072078525#step:6:1075
   
   ```text
   FAILED: src/arrow/CMakeFiles/arrow_array.dir/array/array_run_end.cc.o 
   /usr/bin/c++ -DARROW_HAVE_RUNTIME_AVX2 -DARROW_HAVE_RUNTIME_AVX512 -DARROW_HAVE_RUNTIME_BMI2 -DARROW_HAVE_RUNTIME_SSE4_2 -DARROW_HAVE_SSE4_2 -DARROW_WITH_TIMING_TESTS -I/tmp/arrow-HEAD.P3upj/cpp-build/src -I/arrow/cpp/src -I/arrow/cpp/src/generated -Wno-noexcept-type  -fdiagnostics-color=always  -Wall -fno-semantic-interposition -msse4.2  -O3 -DNDEBUG -O2 -ftree-vectorize  -std=c++17 -fPIC -MD -MT src/arrow/CMakeFiles/arrow_array.dir/array/array_run_end.cc.o -MF src/arrow/CMakeFiles/arrow_array.dir/array/array_run_end.cc.o.d -o src/arrow/CMakeFiles/arrow_array.dir/array/array_run_end.cc.o -c /arrow/cpp/src/arrow/array/array_run_end.cc
   In file included from /arrow/cpp/src/arrow/array/array_run_end.cc:19:
   /arrow/cpp/src/arrow/array/builder_primitive.h:38:24: error: expected unqualified-id before '[' token
      explicit NullBuilder([[maybe_unused]] const std::shared_ptr<DataType>& type,
                           ^
   /arrow/cpp/src/arrow/array/builder_primitive.h:38:24: error: expected ')' before '[' token
      explicit NullBuilder([[maybe_unused]] const std::shared_ptr<DataType>& type,
                          ~^
                           )
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-41112: [C++] Clean up unused parameter warnings [arrow]

Posted by "WillAyd (via GitHub)" <gi...@apache.org>.
WillAyd commented on code in PR #41111:
URL: https://github.com/apache/arrow/pull/41111#discussion_r1558568970


##########
cpp/src/arrow/array/builder_base.h:
##########
@@ -177,6 +177,9 @@ class ARROW_EXPORT ArrayBuilder {
   /// The given array must be the same type as the builder.
   virtual Status AppendArraySlice(const ArraySpan& array, int64_t offset,
                                   int64_t length) {
+    ARROW_UNUSED(array);
+    ARROW_UNUSED(offset);
+    ARROW_UNUSED(length);

Review Comment:
   Sure that works. Out of curiosity now that we are on C++17 any reason not to use `[[maybe_unused]]`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org