]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: tools: silence a build warning when USE_THREAD=0
authorWilly Tarreau <w@1wt.eu>
Wed, 12 Mar 2025 17:11:14 +0000 (18:11 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 12 Mar 2025 17:11:14 +0000 (18:11 +0100)
The dladdr_lock that was added to avoid re-entering into dladdr is
conditioned by threads, but the way it's declared causes a build
warning if threads are disabled due to the insertion of a lone semi
colon in the variables block. Let's switch to __decl_thread_var()
for this.

This can be backported wherever commit eb41d768f9 ("MINOR: tools:
use only opportunistic symbols resolution") is backported. It relies
on these previous two commits:

   bb4addabb7 ("MINOR: compiler: add a simple macro to concatenate resolved strings")
   69ac4cd315 ("MINOR: compiler: add a new __decl_thread_var() macro to declare local variables")

src/tools.c

index 2a8813ed52a6e26c116b57fa0a02d78deac9b747..9401337c2302384e30ead7ab25ca330629d8f7db 100644 (file)
@@ -5543,7 +5543,7 @@ const void *resolve_sym_name(struct buffer *buf, const char *pfx, const void *ad
 #if (defined(__ELF__) && !defined(__linux__)) || defined(USE_DL)
        static Dl_info dli_main;
        static int dli_main_done; // 0 = not resolved, 1 = resolve in progress, 2 = done
-       static __decl_thread(HA_SPINLOCK_T dladdr_lock);
+       __decl_thread_var(static HA_SPINLOCK_T dladdr_lock);
        int isolated;
        Dl_info dli;
        size_t size;