From ab1630631795ec4f196d426af35b9d0636d16016 Mon Sep 17 00:00:00 2001 From: Galaxy1458 <55453380+Galaxy1458@users.noreply.github.com> Date: Fri, 14 Apr 2023 14:11:02 +0800 Subject: [PATCH] fix some [-Wunused-function] and [-Wunused-function] warning (#52868) * test,test=develop * test,test=develop * test,test=develop --- paddle/phi/core/enforce.h | 4 ++-- paddle/phi/core/generator.cc | 6 ++++++ paddle/phi/core/generator.h | 5 ----- paddle/phi/core/utils/unroll_array_ops.h | 4 ++-- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/paddle/phi/core/enforce.h b/paddle/phi/core/enforce.h index d0b240e8941..d2028af0c0d 100644 --- a/paddle/phi/core/enforce.h +++ b/paddle/phi/core/enforce.h @@ -51,7 +51,7 @@ limitations under the License. */ #include #include #include - +#include "paddle/phi/core/macros.h" #if !defined(_WIN32) && !defined(PADDLE_WITH_MUSL) #include #endif @@ -222,7 +222,7 @@ struct BinaryCompareMessageConverter { template <> struct BinaryCompareMessageConverter { template - static const char* Convert(const char* expression, const T& value) { + static const char* Convert(const char* expression, const T& value UNUSED) { return expression; } }; diff --git a/paddle/phi/core/generator.cc b/paddle/phi/core/generator.cc index 16a72117a2a..51674af6699 100644 --- a/paddle/phi/core/generator.cc +++ b/paddle/phi/core/generator.cc @@ -23,6 +23,12 @@ limitations under the License. */ #include "paddle/phi/backends/xpu/xpu_info.h" #include "paddle/phi/core/enforce.h" +static uint64_t GetRandomSeed() { + std::random_device rd; + // double has 53 bit significant, so limit uint64 to 53 bits + return ((((uint64_t)rd()) << 32) + rd()) & 0x1FFFFFFFFFFFFF; +} + namespace phi { const std::shared_ptr& DefaultXPUGenerator(int64_t device_id) { diff --git a/paddle/phi/core/generator.h b/paddle/phi/core/generator.h index 9e46b94300b..5473be29780 100644 --- a/paddle/phi/core/generator.h +++ b/paddle/phi/core/generator.h @@ -24,11 +24,6 @@ limitations under the License. */ #include #include #include -static uint64_t GetRandomSeed() { - std::random_device rd; - // double has 53 bit significant, so limit uint64 to 53 bits - return ((((uint64_t)rd()) << 32) + rd()) & 0x1FFFFFFFFFFFFF; -} namespace phi { diff --git a/paddle/phi/core/utils/unroll_array_ops.h b/paddle/phi/core/utils/unroll_array_ops.h index fe3ca8ab5ac..2e1d84080af 100644 --- a/paddle/phi/core/utils/unroll_array_ops.h +++ b/paddle/phi/core/utils/unroll_array_ops.h @@ -15,8 +15,8 @@ #pragma once #include #include - #include "paddle/phi/core/hostdevice.h" +#include "paddle/phi/core/macros.h" namespace phi { namespace detail { @@ -47,7 +47,7 @@ struct UnrollAssign { template struct UnrollAssign { template - HOSTDEVICE inline static void Run(const Tin *d1, Tout *d2) {} + HOSTDEVICE inline static void Run(const Tin *d1 UNUSED, Tout *d2 UNUSED) {} }; template -- GitLab