This is an automated email from the ASF dual-hosted git repository.
apitrou 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 8b4a548baf GH-35651: [C++] Suppress self-move warning introduced in
gcc 13 (#36328)
8b4a548baf is described below
commit 8b4a548baf862c4333fab8868b416fcf30612956
Author: zhjwpku <[email protected]>
AuthorDate: Wed Jun 28 00:05:45 2023 +0800
GH-35651: [C++] Suppress self-move warning introduced in gcc 13 (#36328)
### Rationale for this change
PR #35653 had a fix for MinGW, but I think the real cause is that gcc add a
new warning -Wself-move.
see https://gcc.gnu.org/gcc-13/changes.html.
We should suppress it if we need to move to itself.
### What changes are included in this PR?
suppress self-move warning by adding a cpp flag
### Are these changes tested?
Yes
### Are there any user-facing changes?
No
* Closes: #35651
Authored-by: Zhao Junwang <[email protected]>
Signed-off-by: Antoine Pitrou <[email protected]>
---
cpp/cmake_modules/SetupCxxFlags.cmake | 7 +++++++
cpp/src/arrow/util/small_vector_test.cc | 2 --
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/cpp/cmake_modules/SetupCxxFlags.cmake
b/cpp/cmake_modules/SetupCxxFlags.cmake
index 03124e1b38..076c2e7450 100644
--- a/cpp/cmake_modules/SetupCxxFlags.cmake
+++ b/cpp/cmake_modules/SetupCxxFlags.cmake
@@ -404,6 +404,13 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CXX_ONLY_FLAGS "${CXX_ONLY_FLAGS} -Wno-noexcept-type")
endif()
+ if(CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL "13.0" OR
CMAKE_CXX_COMPILER_VERSION
+ VERSION_GREATER "13.0")
+ # -Wself-move added in GCC 13 warns when a value is moved to itself
+ # See https://gcc.gnu.org/gcc-13/changes.html
+ set(CXX_ONLY_FLAGS "${CXX_ONLY_FLAGS} -Wno-self-move")
+ endif()
+
# Disabling semantic interposition allows faster calling conventions
# when calling global functions internally, and can also help inlining.
# See
https://stackoverflow.com/questions/35745543/new-option-in-gcc-5-3-fno-semantic-interposition
diff --git a/cpp/src/arrow/util/small_vector_test.cc
b/cpp/src/arrow/util/small_vector_test.cc
index d450e2084a..f9ec5fedfe 100644
--- a/cpp/src/arrow/util/small_vector_test.cc
+++ b/cpp/src/arrow/util/small_vector_test.cc
@@ -413,12 +413,10 @@ class TestSmallStaticVector : public ::testing::Test {
ASSERT_EQ(moved_moved_ints.size(), 5);
EXPECT_THAT(moved_moved_ints, ElementsAre(4, 5, 6, 7, 8));
-#ifndef __MINGW32__
// Move into itself
moved_moved_ints = std::move(moved_moved_ints);
ASSERT_EQ(moved_moved_ints.size(), 5);
EXPECT_THAT(moved_moved_ints, ElementsAre(4, 5, 6, 7, 8));
-#endif
}
void TestMove() {