From 497b6f6c0f3993bfc8bcca249484b5b8cbb11271 Mon Sep 17 00:00:00 2001 From: obdev Date: Wed, 12 Jul 2023 04:12:10 +0000 Subject: [PATCH] Enhance vostest --- deps/oblib/src/lib/stat/ob_di_tls.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/deps/oblib/src/lib/stat/ob_di_tls.h b/deps/oblib/src/lib/stat/ob_di_tls.h index 69aeeedfc..56d785d80 100644 --- a/deps/oblib/src/lib/stat/ob_di_tls.h +++ b/deps/oblib/src/lib/stat/ob_di_tls.h @@ -22,6 +22,12 @@ namespace oceanbase { namespace common { +template +struct ObDITlsPlaceHolder +{ + char buf_[sizeof(T[N])]; +}; + extern thread_local bool is_thread_in_exit; template @@ -84,6 +90,8 @@ ObDITls::~ObDITls() template T* ObDITls::get_instance() { + // for static check + static ObDITlsPlaceHolder placeholder __attribute__((used)); static thread_local ObDITls di_tls; if (OB_LIKELY(!di_tls.is_valid() && !is_thread_in_exit)) { static const char* label = get_label(); @@ -156,6 +164,8 @@ ObDITls::~ObDITls() template T* ObDITls::get_instance() { + // for static check + static ObDITlsPlaceHolder placeholder __attribute__((used)); static thread_local ObDITls di_tls; if (OB_LIKELY(!di_tls.is_valid() && !is_thread_in_exit)) { static const char* label = get_label();