Re: [PATCH] Fix build when compiling without threads traffic

2018-01-24 Thread Willy Tarreau
On Wed, Jan 24, 2018 at 03:44:25PM +0100, Olivier Houchard wrote:
> Hi,
> 
> Commit 1605c7ae6154d8c2cfcf3b325872b1a7266c5bc2 broke building haproxy
> without threads support. The attached patch should fix it.

Oh, thank you Olivier. I didn't know that HA_SPINLOCK_T wasn't declared
without threads, since the macros that use it are transparent. Then I
can remove the __maybe_unused attribute which I placed there on purpose
to avoid a build warning.

Willy



[PATCH] Fix build when compiling without threads traffic

2018-01-24 Thread Olivier Houchard
Hi,

Commit 1605c7ae6154d8c2cfcf3b325872b1a7266c5bc2 broke building haproxy
without threads support. The attached patch should fix it.

Regards,

Olivier
>From 17e4494874b4a75da039f06f00f668d413038283 Mon Sep 17 00:00:00 2001
From: Olivier Houchard 
Date: Wed, 24 Jan 2018 15:41:04 +0100
Subject: [PATCH] MINOR: threads: Fix build when we're not compiling with
 threads.

Only declare the start_lock if threads are compiled in, otherwise
HA_SPINLOCK_T won't be defined.
This should be backported to 1.8 when/if
1605c7ae6154d8c2cfcf3b325872b1a7266c5bc2 is backported.
---
 src/haproxy.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/haproxy.c b/src/haproxy.c
index 8e0e30d8..b1d77653 100644
--- a/src/haproxy.c
+++ b/src/haproxy.c
@@ -2422,7 +2422,9 @@ static void *run_thread_poll_loop(void *data)
 {
struct per_thread_init_fct   *ptif;
struct per_thread_deinit_fct *ptdf;
+#ifdef USE_THREAD
static __maybe_unused HA_SPINLOCK_T start_lock;
+#endif
 
tid = *((unsigned int *)data);
tid_bit = (1UL << tid);
-- 
2.14.3