From 04856fed2e35de3ad176f21958ce3aa42f85bb2a Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Wed, 16 Aug 2023 11:18:25 +0200 Subject: [PATCH] channel: Fix redundant redeclaration warning MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit g++ reports: ``` In file included from channel.cc:23: channel.hh:38:17: warning: redundant redeclaration of ‘void __tsan_acquire(void*)’ in same scope [-Wredundant-decls] 38 | extern "C" void __tsan_acquire(void* addr); | ^~~~~~~~~~~~~~ In file included from /usr/include/c++/13.2.1/bits/shared_ptr_atomic.h:37, from /usr/include/c++/13.2.1/memory:81, from channel.hh:23: /usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/include/sanitizer/tsan_interface.h:24:6: note: previous declaration of ‘void __tsan_acquire(void*)’ 24 | void __tsan_acquire(void *addr); | ^~~~~~~~~~~~~~ channel.hh:39:17: warning: redundant redeclaration of ‘void __tsan_release(void*)’ in same scope [-Wredundant-decls] 39 | extern "C" void __tsan_release(void* addr); | ^~~~~~~~~~~~~~ /usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/include/sanitizer/tsan_interface.h:25:6: note: previous declaration of ‘void __tsan_release(void*)’ 25 | void __tsan_release(void *addr); ``` --- pdns/channel.hh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pdns/channel.hh b/pdns/channel.hh index 6947d3b26d..b06ff03e48 100644 --- a/pdns/channel.hh +++ b/pdns/channel.hh @@ -35,9 +35,18 @@ #endif #if __SANITIZE_THREAD__ +#if defined __has_include +#if __has_include() +#include +#else /* __has_include() */ extern "C" void __tsan_acquire(void* addr); extern "C" void __tsan_release(void* addr); -#endif +#endif /* __has_include() */ +#else /* defined __has_include */ +extern "C" void __tsan_acquire(void* addr); +extern "C" void __tsan_release(void* addr); +#endif /* defined __has_include */ +#endif /* __SANITIZE_THREAD__ */ namespace pdns { -- 2.47.2