aboutsummaryrefslogtreecommitdiffstats
path: root/meta-networking/recipes-connectivity/freeradius/files/freeradius-fix-error-for-expansion-of-macro.patch
blob: af1bff051fde1d9984cf0fee41184e239e38c249 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
From 5b6d8b14f2696fcf1dca119212f9d0a0fa04defd Mon Sep 17 00:00:00 2001
From: Yi Zhao <yi.zhao@windriver.com>
Date: Wed, 18 Jan 2017 14:59:39 +0800
Subject: [PATCH] fix error for expansion of macro in thread.h

The parameter declaration is missing in expansion of macro
which cause the build error:
| In file included from src/freeradius-devel/libradius.h:80:0,
|                  from src/lib/log.c:26:
| src/lib/log.c: In function '__fr_thread_local_destroy_fr_strerror_buffer':
| src/lib/log.c:37:31: error: 'fr_strerror_buffer' undeclared (first use in this function)
|  fr_thread_local_setup(char *, fr_strerror_buffer) /* macro */
|                                ^

Add the missing declaration in macro.

Upstream-Status: Pending

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
---
 src/include/threads.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/include/threads.h b/src/include/threads.h
index e36d81d..2bcb6aa 100644
--- a/src/include/threads.h
+++ b/src/include/threads.h
@@ -89,7 +89,7 @@ static _t __fr_thread_local_init_##_n(pthread_destructor_t func)\
 #  define fr_thread_local_get(_n) _n
 #elif defined(HAVE_PTHREAD_H)
 #  include <pthread.h>
-#  define fr_thread_local_setup(_t, _n) \
+#  define fr_thread_local_setup(_t, _n) static __thread _t _n;\
 static pthread_key_t __fr_thread_local_key_##_n;\
 static pthread_once_t __fr_thread_local_once_##_n = PTHREAD_ONCE_INIT;\
 static pthread_destructor_t __fr_thread_local_destructor_##_n = NULL;\
@@ -100,17 +100,17 @@ static void __fr_thread_local_destroy_##_n(UNUSED void *unused)\
 static void __fr_thread_local_key_init_##_n(void)\
 {\
 	(void) pthread_key_create(&__fr_thread_local_key_##_n, __fr_thread_local_destroy_##_n);\
-	(void) pthread_setspecific(__fr_thread_local_key_##_n, &(_n));\
 }\
 static _t __fr_thread_local_init_##_n(pthread_destructor_t func)\
 {\
 	__fr_thread_local_destructor_##_n = func;\
 	if (_n) return _n; \
 	(void) pthread_once(&__fr_thread_local_once_##_n, __fr_thread_local_key_init_##_n);\
+	(void) pthread_setspecific(__fr_thread_local_key_##_n, &(_n));\
 	return _n;\
 }
-#  define fr_thread_local_init(_n, _f)			__fr_thread_local_init_##_n(_f)
-#  define fr_thread_local_set(_n, _v)			__fr_thread_local_set_##_n(_v)
-#  define fr_thread_local_get(_n)			__fr_thread_local_get_##_n()
+#  define fr_thread_local_init(_n, _f)	__fr_thread_local_init_##_n(_f)
+#  define fr_thread_local_set(_n, _v) ((int)!((_n = _v) || 1))
+#  define fr_thread_local_get(_n) _n
 #endif
 #endif
-- 
2.10.2