From afdd2e0ca23ccd6a19a604d90b9d75c971a3fe7c Mon Sep 17 00:00:00 2001 From: Zhi Qi <30543181+LittleFall@users.noreply.github.com> Date: Mon, 18 Apr 2022 22:08:03 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20fix=20build=20issue=20`=E2=80=98maybe=5F?= =?UTF-8?q?unused=E2=80=99=20attribute=20ignored`=20on=20centos=20server?= =?UTF-8?q?=20=20(#4700)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit close pingcap/tiflash#4701 --- dbms/src/Common/CPUAffinityManager.h | 7 +++++-- libs/libcommon/include/common/defines.h | 6 ++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/dbms/src/Common/CPUAffinityManager.h b/dbms/src/Common/CPUAffinityManager.h index 8c88c3ab1fd..5de62cf8368 100644 --- a/dbms/src/Common/CPUAffinityManager.h +++ b/dbms/src/Common/CPUAffinityManager.h @@ -14,6 +14,8 @@ #pragma once +#include + #include #include #include @@ -115,8 +117,9 @@ class CPUAffinityManager #endif // unused except Linux - [[maybe_unused]] int query_cpu_percent; - [[maybe_unused]] int cpu_cores; + MAYBE_UNUSED_MEMBER int query_cpu_percent; + MAYBE_UNUSED_MEMBER int cpu_cores; + std::vector query_threads; Poco::Logger * log; diff --git a/libs/libcommon/include/common/defines.h b/libs/libcommon/include/common/defines.h index 51b99a2d0ba..ff79a4d2077 100644 --- a/libs/libcommon/include/common/defines.h +++ b/libs/libcommon/include/common/defines.h @@ -199,3 +199,9 @@ static ALWAYS_INLINE inline void TIFLASH_NO_OPTIMIZE(T && var) #define TIFLASH_DUMMY_FUNCTION_DEFINITION #define tiflash_compiler_builtin_memcpy __builtin_memcpy #endif + +#ifdef __clang__ +#define MAYBE_UNUSED_MEMBER [[maybe_unused]] +#else +#define MAYBE_UNUSED_MEMBER +#endif