Commit a15772fa authored by Maria Matejka's avatar Maria Matejka
Browse files

Fix thread_local storage and deprecated attribute for other supported compilers

parent 02657095
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -9,14 +9,23 @@ AC_DEFUN([BIRD_CHECK_THREAD_LOCAL],
    AC_COMPILE_IFELSE([
      AC_LANG_PROGRAM(
        [
	  _Thread_local static int x = 42;
	  static _Thread_local int x = 42;
	],
	[]
      )
    ],
    [bird_cv_thread_local=yes],
    [bird_cv_thread_local=no]
    [AC_COMPILE_IFELSE([
      AC_LANG_PROGRAM(
	[
	  static __thread int x = 42;
	],
	[]
      )
    ],
    [bird_cv_thread_local=__thread],
    [bird_cv_thread_local=no]
    )])
  )
])

+4 −2
Original line number Diff line number Diff line
@@ -119,8 +119,10 @@ if test -z "$GCC" ; then
fi

BIRD_CHECK_THREAD_LOCAL
if test "$bird_cv_thread_local" = yes ; then
  AC_DEFINE([HAVE_THREAD_LOCAL], [1], [Define to 1 if _Thread_local is available])
if test "$bird_cv_thread_local" = no ; then
  AC_MSG_ERROR([This program requires thread local storage.])
elif test "$bird_cv_thread_local" != yes ; then
  AC_DEFINE_UNQUOTED([_Thread_local], [$bird_cv_thread_local], [Legacy _Thread_local])
fi

BIRD_CHECK_PTHREADS
+2 −2
Original line number Diff line number Diff line
@@ -94,8 +94,8 @@ struct filter_state {
  int flags;
};

_Thread_local static struct filter_state filter_state;
_Thread_local static struct filter_stack *filter_stack = NULL;
static _Thread_local struct filter_state filter_state;
static _Thread_local struct filter_stack *filter_stack = NULL;

static struct filter_stack *get_filter_stack(void)
{
+0 −4
Original line number Diff line number Diff line
@@ -75,10 +75,6 @@ static inline int u64_cmp(u64 i1, u64 i2)
#define PACKED __attribute__((packed))
#define NONNULL(...) __attribute__((nonnull((__VA_ARGS__))))

#ifndef HAVE_THREAD_LOCAL
#define _Thread_local
#endif

/* Microsecond time */

typedef s64 btime;
+1 −1
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ event *ev_new(pool *);
void ev_schedule(event *);

/* Run the event directly */
static inline void __attribute_deprecated__ ev_run(event *e)
static inline void __attribute__((deprecated)) ev_run(event *e)
{ e->hook(e->data); }

/* Cancel an event */
Loading