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

Add -Wno-error=redundant-move to cmake builds #13582

Merged
merged 1 commit into from
Sep 4, 2024

Conversation

dconeybe
Copy link
Contributor

@dconeybe dconeybe commented Sep 4, 2024

Add -Wno-error=redundant-move to avoid failing the build due to unnecessary std::move() calls. It is common practice to use std::move() liberally, even if it's not strictly beneficial, to ensure that a type is moved if its definition is ever changed to not be trivially movable. Therefore, it doesn't make sense to fail the build due to unnecessary std::move() calls.

This fixes the following compiler error:

[2094/2338] Building CXX object Firestore/core/CMakeFiles/firestore_util.dir/src/util/logic_utils.cc.o
FAILED: Firestore/core/CMakeFiles/firestore_util.dir/src/util/logic_utils.cc.o 
/usr/bin/ccache /usr/bin/c++ -DCARES_STATICLIB -DFIRESTORE_HAVE_CONFIG_DETECTED_H -DPB_ENABLE_MALLOC -DPB_FIELD_32BIT -DPB_NO_PACKED_STRUCTS=1 -Ifirebase-ios-sdk/cmake-build-debug -Ifirebase-ios-sdk -Ifirebase-ios-sdk/cmake-build-debug/external/src/abseil-cpp -Ifirebase-ios-sdk/cmake-build-debug/external/src/nanopb -Ifirebase-ios-sdk/Firestore/Protos/nanopb -Ifirebase-ios-sdk/cmake-build-debug/external/src/grpc/include -Ifirebase-ios-sdk/cmake-build-debug/external/src/re2 -Ifirebase-ios-sdk/cmake-build-debug/external/src/grpc-build/third_party/cares/cares -Ifirebase-ios-sdk/cmake-build-debug/external/src/cares -Ifirebase-ios-sdk/cmake-build-debug/external/src/boringssl/src/include -Ifirebase-ios-sdk/cmake-build-debug/external/src/protobuf/src -g -std=c++14 -fdiagnostics-color=always -Wall -Wextra -Werror -Wformat -Wuninitialized -fno-common -Wunused-function -Wunused-value -Wunused-variable -fdiagnostics-color -Wreorder -Werror=reorder -MD -MT Firestore/core/CMakeFiles/firestore_util.dir/src/util/logic_utils.cc.o -MF Firestore/core/CMakeFiles/firestore_util.dir/src/util/logic_utils.cc.o.d -o Firestore/core/CMakeFiles/firestore_util.dir/src/util/logic_utils.cc.o -c firebase-ios-sdk/Firestore/core/src/util/logic_utils.cc
firebase-ios-sdk/Firestore/core/src/util/logic_utils.cc: In static member function ‘static firebase::firestore::core::Filter firebase::firestore::util::LogicUtils::ApplyAssociation(const firebase::firestore::core::Filter&)’:
firebase-ios-sdk/Firestore/core/src/util/logic_utils.cc:95:21: error: redundant move in return statement [-Werror=redundant-move]
   95 |     return std::move(composite_filter);
      |            ~~~~~~~~~^~~~~~~~~~~~~~~~~~
firebase-ios-sdk/Firestore/core/src/util/logic_utils.cc:95:21: note: remove ‘std::move’ call
cc1plus: all warnings being treated as errors
[2098/2338] Linking CXX static library external/src/grpc-build/libgrpc.a
ninja: build stopped: subcommand failed.

The compiler in use in this case was reported by cmake as -- The CXX compiler identification is GNU 13.2.0

#no-changelog

@dconeybe dconeybe self-assigned this Sep 4, 2024
@dconeybe dconeybe changed the title Add -Wno-error=redundant-move to cmake c++ compiler invocation Add -Wno-error=redundant-move to cmake builds Sep 4, 2024
@dconeybe dconeybe changed the title Add -Wno-error=redundant-move to cmake builds Add -Wno-error=redundant-move to cmake builds Sep 4, 2024
@dconeybe dconeybe requested a review from ehsannas September 4, 2024 17:30
@dconeybe dconeybe merged commit e0158c0 into main Sep 4, 2024
35 checks passed
@dconeybe dconeybe deleted the dconeybe/RedundantMoveNoError branch September 4, 2024 17:37
@firebase firebase locked and limited conversation to collaborators Oct 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants