From 31d06cecac572852c6e5e8d85cea641883cbe4c6 Mon Sep 17 00:00:00 2001 From: Raphael Manfredi Date: Mon, 9 Aug 2021 09:36:00 +0200 Subject: [PATCH] Fix compilation with newest glibc. The PTHREAD_STACK_MIN value is no longer a constant but rather defined as sysconf(_SC_THREAD_STACK_MIN). Therefore, we must avoid using cpp computations on that value. --- src/lib/thread.c | 7 +------ src/lib/thread.h | 2 +- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/lib/thread.c b/src/lib/thread.c index 178c09794..e7a702029 100644 --- a/src/lib/thread.c +++ b/src/lib/thread.c @@ -9705,7 +9705,7 @@ thread_launch_trampoline(void *arg) * In case PTHREAD_STACK_MIN is not defined by . */ #ifndef PTHREAD_STACK_MIN -#define PTHREAD_STACK_MIN 0 +#define PTHREAD_STACK_MIN 1024U #endif /** @@ -9737,12 +9737,7 @@ thread_launch(struct thread_element *te, pthread_attr_init(&attr); if (stack != 0) { - /* Avoid compiler warning when PTHREAD_STACK_MIN == 0 */ -#if PTHREAD_STACK_MIN != 0 stacksize = MAX(PTHREAD_STACK_MIN, stack); -#else - stacksize = stack; -#endif stacksize = MAX(stacksize, THREAD_STACK_MIN); } else { stacksize = MAX(THREAD_STACK_DFLT, PTHREAD_STACK_MIN); diff --git a/src/lib/thread.h b/src/lib/thread.h index 73e15fa36..740f3a6f9 100644 --- a/src/lib/thread.h +++ b/src/lib/thread.h @@ -63,7 +63,7 @@ typedef size_t thread_qid_t; /* Quasi Thread ID */ typedef unsigned int thread_key_t; /* Local thread storage key */ #define THREAD_MAX 64 /**< Max amount of threads we can track */ -#define THREAD_STACK_DFLT (65536 * PTRSIZE) /**< Default stack requested */ +#define THREAD_STACK_DFLT (65536U * PTRSIZE) /**< Default stack requested */ #define THREAD_LOCAL_MAX 1024 /**< Max amount of thread-local keys */ #define THREAD_SUSPEND_TIMEOUT 90 /**< secs: thread max suspension time */