From 6e4b96b1f1d3d19c9669317ccca0ce6aaf4fb9cf Mon Sep 17 00:00:00 2001 From: Dnomd343 Date: Sun, 22 Sep 2024 16:48:42 +0800 Subject: [PATCH] update: avoid clang warnings in exposer --- src/core_test/utility/exposer.h | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/core_test/utility/exposer.h b/src/core_test/utility/exposer.h index 2ae2082..f8ba92b 100644 --- a/src/core_test/utility/exposer.h +++ b/src/core_test/utility/exposer.h @@ -1,5 +1,7 @@ #pragma once +// TODO: move to independent repo + /// The Exposer can forcibly access private members of a class without changing /// any code, and in most scenarios, it has zero over-cost. This exposer using /// macros to construct function that return a reference of target variable or @@ -49,11 +51,17 @@ struct Exposer { #define UNIQUE_TAG UNIQUE_TAG_IMPL(__COUNTER__) -#define NS_EXPOSER_START \ - namespace { \ - namespace exposer { \ +// TODO: add GCC warning ignored + +#define NS_EXPOSER_START \ + namespace { \ + namespace exposer { \ + _Pragma("clang diagnostic push") \ + _Pragma("clang diagnostic ignored \"-Wunused-function\"") -#define NS_EXPOSER_END }} +#define NS_EXPOSER_END \ + _Pragma("clang diagnostic pop") \ + }} // ----------------------------------------------------------------------------------------- //