From: Remi Gacogne Date: Wed, 16 Aug 2023 09:18:25 +0000 (+0200) Subject: channel: Fix redundant redeclaration warning X-Git-Tag: rec-5.0.0-alpha1~28^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F13142%2Fhead;p=thirdparty%2Fpdns.git channel: Fix redundant redeclaration warning 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); ``` --- 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 {