From 337cc2caceaec711c57f01e9d5a6a627928ef828 Mon Sep 17 00:00:00 2001 From: Galaxy1458 <55453380+Galaxy1458@users.noreply.github.com> Date: Mon, 17 Apr 2023 15:15:08 +0800 Subject: [PATCH] remove some [-Wunused-paramter] warning (#52924) --- paddle/fluid/distributed/auto_parallel/utils.h | 2 +- paddle/fluid/framework/details/op_registry.h | 3 ++- paddle/fluid/memory/allocation/allocator.h | 4 +++- paddle/phi/common/place.h | 8 ++++---- paddle/phi/common/transform.h | 2 +- paddle/phi/core/kernel_utils.h | 4 +++- paddle/phi/core/utils/dim.h | 2 +- 7 files changed, 15 insertions(+), 10 deletions(-) diff --git a/paddle/fluid/distributed/auto_parallel/utils.h b/paddle/fluid/distributed/auto_parallel/utils.h index 58f9425f532..55b6f221f97 100644 --- a/paddle/fluid/distributed/auto_parallel/utils.h +++ b/paddle/fluid/distributed/auto_parallel/utils.h @@ -80,7 +80,7 @@ inline std::string str_join(std::map const& elements, const std::string& delimiter = ",") { std::string str; for (const auto& item : elements) { - str += item.first + ": " + std::to_string(item.second) + ","; + str += item.first + ": " + std::to_string(item.second) + delimiter; } return str.substr(0, str.size() - 1); } diff --git a/paddle/fluid/framework/details/op_registry.h b/paddle/fluid/framework/details/op_registry.h index 4b109ba0dcf..7642d0f64a0 100644 --- a/paddle/fluid/framework/details/op_registry.h +++ b/paddle/fluid/framework/details/op_registry.h @@ -33,6 +33,7 @@ limitations under the License. */ #include "paddle/fluid/imperative/dygraph_grad_maker.h" #include "paddle/fluid/imperative/type_defs.h" #include "paddle/fluid/prim/utils/static/composite_grad_desc_maker.h" +#include "paddle/phi/core/macros.h" namespace paddle { namespace framework { @@ -161,7 +162,7 @@ class OperatorRegistrarRecursive { template class OperatorRegistrarRecursive { public: - OperatorRegistrarRecursive(const char* op_type, OpInfo* info) {} + OperatorRegistrarRecursive(const char* op_type UNUSED, OpInfo* info UNUSED) {} }; template diff --git a/paddle/fluid/memory/allocation/allocator.h b/paddle/fluid/memory/allocation/allocator.h index 3b5b06b2eba..a7cf653980d 100644 --- a/paddle/fluid/memory/allocation/allocator.h +++ b/paddle/fluid/memory/allocation/allocator.h @@ -162,7 +162,9 @@ class Allocator : public phi::Allocator { protected: virtual phi::Allocation* AllocateImpl(size_t size) = 0; virtual void FreeImpl(phi::Allocation* allocation); - virtual uint64_t ReleaseImpl(const platform::Place& place) { return 0; } + virtual uint64_t ReleaseImpl(const platform::Place& place UNUSED) { + return 0; + } }; inline size_t AlignedSize(size_t size, size_t alignment) { diff --git a/paddle/phi/common/place.h b/paddle/phi/common/place.h index 2235d55de25..e65235cfa3d 100644 --- a/paddle/phi/common/place.h +++ b/paddle/phi/common/place.h @@ -18,7 +18,7 @@ limitations under the License. */ #include #include "paddle/phi/api/include/dll_decl.h" - +#include "paddle/phi/core/macros.h" namespace paddle { enum class PlaceType; } @@ -132,7 +132,7 @@ class CPUPlace : public Place { CPUPlace() : Place(AllocationType::CPU) {} CPUPlace(const CPUPlace&) = default; - CPUPlace(const Place& place) : Place(AllocationType::CPU) {} // NOLINT + CPUPlace(const Place& place UNUSED) : Place(AllocationType::CPU) {} // NOLINT }; class GPUPlace : public Place { @@ -150,7 +150,7 @@ class GPUPinnedPlace : public Place { GPUPinnedPlace() : Place(AllocationType::GPUPINNED) {} GPUPinnedPlace(const GPUPinnedPlace&) = default; - GPUPinnedPlace(const Place& place) // NOLINT + GPUPinnedPlace(const Place& place UNUSED) // NOLINT : Place(AllocationType::GPUPINNED) {} }; @@ -179,7 +179,7 @@ class NPUPinnedPlace : public Place { NPUPinnedPlace() : Place(AllocationType::NPUPINNED) {} NPUPinnedPlace(const NPUPinnedPlace&) = default; - NPUPinnedPlace(const Place& place) // NOLINT + NPUPinnedPlace(const Place& place UNUSED) // NOLINT : Place(AllocationType::NPUPINNED) {} }; diff --git a/paddle/phi/common/transform.h b/paddle/phi/common/transform.h index ffee95a3770..38ec0b56273 100644 --- a/paddle/phi/common/transform.h +++ b/paddle/phi/common/transform.h @@ -82,7 +82,7 @@ struct Transform { typename InputIter2, typename OutputIter, typename BinaryOperation> - void operator()(const phi::CPUContext& context, + void operator()(const phi::CPUContext& context UNUSED, InputIter1 first1, InputIter1 last1, InputIter2 first2, diff --git a/paddle/phi/core/kernel_utils.h b/paddle/phi/core/kernel_utils.h index ca43a73094d..23258104181 100644 --- a/paddle/phi/core/kernel_utils.h +++ b/paddle/phi/core/kernel_utils.h @@ -332,7 +332,9 @@ struct KernelImpl { template struct KernelCallHelper> { template - static void Compute(KernelContext* ctx, DevCtx dev_ctx, Args&... args) { + static void Compute(KernelContext* ctx UNUSED, + DevCtx dev_ctx, + Args&... args) { static_assert(dev_ctx_idx > 0, "Kernel should pass DeviceContext as argument."); return kernel_fn(dev_ctx, args...); diff --git a/paddle/phi/core/utils/dim.h b/paddle/phi/core/utils/dim.h index d6740d907a0..7cc023f8cc7 100644 --- a/paddle/phi/core/utils/dim.h +++ b/paddle/phi/core/utils/dim.h @@ -84,7 +84,7 @@ inline std::ostream& operator<<(std::ostream& os, const Dim& d) { return os; } -inline std::ostream& operator<<(std::ostream& os, const Dim<0>& d) { +inline std::ostream& operator<<(std::ostream& os, const Dim<0>& d UNUSED) { return os; } -- GitLab