diff --git a/paddle/fluid/distributed/test/ctr_accessor_test.cc b/paddle/fluid/distributed/test/ctr_accessor_test.cc index 258b4d3326209c3a289c89fa507b06de35665a93..ee893ff01b59e3a356564a30554b1335feea7379 100644 --- a/paddle/fluid/distributed/test/ctr_accessor_test.cc +++ b/paddle/fluid/distributed/test/ctr_accessor_test.cc @@ -61,7 +61,7 @@ TableAccessorParameter gen_param() { naive_param->add_weight_bounds(-10.0); naive_param->add_weight_bounds(10.0); - return std::move(param); + return param; } TEST(downpour_feature_value_accessor_test, test_shrink) { diff --git a/paddle/fluid/framework/ir/fusion_group/code_generator_tester.cc b/paddle/fluid/framework/ir/fusion_group/code_generator_tester.cc index f671e0ae7690a4d803b38ebc18c9a6891d4d843d..7b6bbf0251001ab3bff96ea6d9b49dd8859fdf1f 100644 --- a/paddle/fluid/framework/ir/fusion_group/code_generator_tester.cc +++ b/paddle/fluid/framework/ir/fusion_group/code_generator_tester.cc @@ -420,11 +420,7 @@ std::unique_ptr BuildGraph(bool backward, n->Var()->SetDataType(proto_dtype); } } -#ifdef __clang__ return graph; -#else - return std::move(graph); -#endif } std::unordered_set DistilGradNodes( diff --git a/paddle/fluid/framework/ir/fusion_group/fusion_group_pass_tester.cc b/paddle/fluid/framework/ir/fusion_group/fusion_group_pass_tester.cc index d14c7e433bd081c58794804adda5a18a7239aeec..db22c03a7d9c00fb4a067a9a62ba0442d7f43e54 100644 --- a/paddle/fluid/framework/ir/fusion_group/fusion_group_pass_tester.cc +++ b/paddle/fluid/framework/ir/fusion_group/fusion_group_pass_tester.cc @@ -63,11 +63,7 @@ std::unique_ptr BuildElementwiseListGraph(bool backward = false) { n->Var()->SetDataType(proto::VarType::FP32); } } -#ifdef __clang__ return graph; -#else - return std::move(graph); -#endif } std::unique_ptr BuildElementwiseTreeGraph(bool backward = false) { @@ -125,11 +121,7 @@ std::unique_ptr BuildElementwiseTreeGraph(bool backward = false) { n->Var()->SetDataType(proto::VarType::FP32); } } -#ifdef __clang__ return graph; -#else - return std::move(graph); -#endif } int TestMain(std::unique_ptr graph, std::string prefix) { diff --git a/paddle/fluid/framework/new_executor/interpretercore_util.cc b/paddle/fluid/framework/new_executor/interpretercore_util.cc index 71893d661ed6bf01edda7f239e46183309b43ac4..d6de37a72c7722960c97e92d251721ebd0959a75 100644 --- a/paddle/fluid/framework/new_executor/interpretercore_util.cc +++ b/paddle/fluid/framework/new_executor/interpretercore_util.cc @@ -741,7 +741,7 @@ std::map> get_downstream_map( VLOG(6) << "downstream count: " << downstream_map_count(); VLOG(6) << "downstream_map: " << std::endl << downstream_map_to_str(); - return std::move(downstream); + return downstream; } std::map> build_op_downstream_map( @@ -995,7 +995,7 @@ std::map> build_op_downstream_map( std::ostream_iterator(oss, " ")); VLOG(10) << oss.str(); } - return std::move(get_downstream_map(op2dependences, op_happens_before)); + return get_downstream_map(op2dependences, op_happens_before); } } // namespace interpreter diff --git a/paddle/fluid/framework/var_desc.h b/paddle/fluid/framework/var_desc.h index a20ef58f9c95ff4bc5c5064eebc124814d760321..0f8c10604f39a51d2a62543c8c5b969184986bb7 100644 --- a/paddle/fluid/framework/var_desc.h +++ b/paddle/fluid/framework/var_desc.h @@ -74,6 +74,12 @@ class VarDesc { : desc_(other.desc_), attrs_(other.attrs_), original_id_(other.original_id_) {} + VarDesc &operator=(const VarDesc &other) { + desc_ = other.desc_; + attrs_ = other.attrs_; + original_id_ = other.original_id_; + return *this; + } proto::VarDesc *Proto() { return &desc_; } diff --git a/paddle/fluid/inference/utils/table_printer.cc b/paddle/fluid/inference/utils/table_printer.cc index bd19320cbe64768863df3f7fb126f3d81492e496..628465c423b03af234b176b8ee02f8e580c4e7b8 100644 --- a/paddle/fluid/inference/utils/table_printer.cc +++ b/paddle/fluid/inference/utils/table_printer.cc @@ -53,7 +53,7 @@ std::string TablePrinter::PrintTable() { AddRowDivider(ss); - return std::move(ss.str()); + return ss.str(); } TablePrinter::TablePrinter(const std::vector& header) { diff --git a/paddle/fluid/platform/profiler.cc b/paddle/fluid/platform/profiler.cc index 8fa48ffcfb15853c503a4d9af88315a1346a467b..75abf36e676d06321e9d2eefb3d03bea5cafcaf0 100644 --- a/paddle/fluid/platform/profiler.cc +++ b/paddle/fluid/platform/profiler.cc @@ -612,7 +612,7 @@ static std::map DockHostEventRecorderHostPart() { auto host_evt_sec = HostEventRecorder::GetInstance().GatherEvents(); EmulateEventPushAndPop(host_evt_sec, &thr_events); EmulateCPURecordsAdd(host_evt_sec); - return std::move(thr_events); + return thr_events; } static void DockHostEventRecorderDevicePart( diff --git a/paddle/phi/api/lib/api_gen_utils.cc b/paddle/phi/api/lib/api_gen_utils.cc index e0c910ba3d66c9c8e61265d12e60da4dd252d035..a0fd42d769aac2269c12f058d51e7724ba3fa3cd 100644 --- a/paddle/phi/api/lib/api_gen_utils.cc +++ b/paddle/phi/api/lib/api_gen_utils.cc @@ -41,7 +41,7 @@ std::unique_ptr> TensorToDenseTensor( *std::dynamic_pointer_cast(t.impl())); } - return std::move(pt_tensors); + return pt_tensors; } std::shared_ptr TensorToSelectedRows(const Tensor& tensor) { diff --git a/paddle/phi/api/lib/data_transform.cc b/paddle/phi/api/lib/data_transform.cc index 65cb37d4142992cda482121fa9a576ee651cadd4..58827a98503ceb7505703f9b3c1baa3628ed97f9 100644 --- a/paddle/phi/api/lib/data_transform.cc +++ b/paddle/phi/api/lib/data_transform.cc @@ -253,7 +253,7 @@ std::unique_ptr> PrepareData( } } - return std::move(pt_tensors); + return pt_tensors; } } // namespace experimental diff --git a/paddle/phi/core/compat/arg_map_context.h b/paddle/phi/core/compat/arg_map_context.h index 102dca48b998b2ca5c172754e52aeadf528d44f0..f807f268a2d3377eae41b04a43b6bda9aaab4796 100644 --- a/paddle/phi/core/compat/arg_map_context.h +++ b/paddle/phi/core/compat/arg_map_context.h @@ -58,6 +58,11 @@ struct KernelSignature { // TODO(chenweihang): add assign constructor to solve windows compile // problem, remove it later + KernelSignature(const KernelSignature& other) + : name(other.name), + input_names(other.input_names), + attr_names(other.attr_names), + output_names(other.output_names) {} KernelSignature& operator=(const KernelSignature& other) { name = other.name; input_names = other.input_names; diff --git a/paddle/phi/core/utils/type_registry.h b/paddle/phi/core/utils/type_registry.h index f27c3db2275c379f5a1ce7d95c0684ba68a8c1a9..5b64dbd01643e60c8eca9077dacd1631f55034c5 100644 --- a/paddle/phi/core/utils/type_registry.h +++ b/paddle/phi/core/utils/type_registry.h @@ -50,7 +50,8 @@ template TypeInfo TypeRegistry::RegisterType(const std::string& type) { std::lock_guard guard(mutex_); assert(name_to_id_.find(type) == name_to_id_.end()); - assert(names_.size() < std::numeric_limits::max()); + assert(names_.size() < static_cast( + std::numeric_limits::max())); int8_t id = static_cast(names_.size()); names_.emplace_back(type); name_to_id_[type] = id; diff --git a/paddle/utils/array_ref.h b/paddle/utils/array_ref.h index d2ab762bb154f6336e7b203a1140fe942e3524d1..788710925936bf3764062b8e26a7c29d948f23a1 100644 --- a/paddle/utils/array_ref.h +++ b/paddle/utils/array_ref.h @@ -96,10 +96,21 @@ class ArrayRef { template /*implicit*/ constexpr ArrayRef(const T (&Arr)[N]) : Data(Arr), Length(N) {} - /// Construct an ArrayRef from a std::initializer_list. +/// Construct an ArrayRef from a std::initializer_list. +#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ >= 9 +// Disable gcc's warning in this constructor as it generates an enormous +// amount +// of messages. Anyone using ArrayRef should already be aware of the fact that +// it does not do lifetime extension. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Winit-list-lifetime" +#endif /*implicit*/ ArrayRef(const std::initializer_list &Vec) : Data(Vec.begin() == Vec.end() ? (T *)nullptr : Vec.begin()), Length(Vec.size()) {} +#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ >= 9 +#pragma GCC diagnostic pop +#endif /// Construct an ArrayRef from ArrayRef. This uses SFINAE to /// ensure that only ArrayRefs of pointers can be converted.