0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2025-01-03 07:31:54 +00:00

Fix thread local storage support in GCC older than 4.9.

Let's hope this will be history soon.
This commit is contained in:
Maria Matejka 2020-04-22 17:14:26 +02:00
parent 5387208e1c
commit 2a0d6c32ac
4 changed files with 16 additions and 5 deletions

11
aclocal.m4 vendored
View File

@ -15,8 +15,17 @@ AC_DEFUN([BIRD_CHECK_THREAD_LOCAL],
)
],
[bird_cv_thread_local=yes],
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM(
[
static __thread int x = 42;
],
[]
)
],
[bird_cv_thread_local=__thread],
[bird_cv_thread_local=no]
)
))
)
])

View File

@ -120,7 +120,9 @@ fi
BIRD_CHECK_THREAD_LOCAL
if test "$bird_cv_thread_local" = no ; then
AC_MSG_ERROR([Thread-local storage not available])
AC_MSG_ERROR([Thread-local storage not available])
elif test "$bird_cv_thread_local" != yes ; then
CFLAGS="$CFLAGS -D_Thread_local=$bird_cv_thread_local"
fi
BIRD_CHECK_PTHREADS

View File

@ -91,8 +91,8 @@ struct filter_state {
struct buffer buf;
};
_Thread_local static struct filter_state filter_state;
_Thread_local static struct filter_stack filter_stack;
static _Thread_local struct filter_state filter_state;
static _Thread_local struct filter_stack filter_stack;
void (*bt_assert_hook)(int result, const struct f_line_item *assert);

View File

@ -2248,7 +2248,7 @@ bgp_rte_modify_stale(struct rte_storage *r, struct linpool *pool)
if (ad && int_set_contains(ad, BGP_COMM_LLGR_STALE))
return r->attrs;
_Thread_local static struct {
static _Thread_local struct {
rta a;
u32 labels[MPLS_MAX_LABEL_STACK];
} aloc;