Skip to content

Commit

Permalink
fix: fix build issue ‘maybe_unused’ attribute ignored on centos ser…
Browse files Browse the repository at this point in the history
…ver (#4700)

close #4701
  • Loading branch information
LittleFall authored Apr 18, 2022
1 parent cf8ab95 commit afdd2e0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 5 additions & 2 deletions dbms/src/Common/CPUAffinityManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

#pragma once

#include <common/defines.h>

#include <string>
#include <thread>
#include <unordered_map>
Expand Down Expand Up @@ -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<std::string> query_threads;
Poco::Logger * log;

Expand Down
6 changes: 6 additions & 0 deletions libs/libcommon/include/common/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit afdd2e0

Please sign in to comment.