0004-fix-error-for-expansion-of-macro-in-thread.h.patch 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. From dae3b7c53171dfeacce91e0da1c8bd4e4166352e Mon Sep 17 00:00:00 2001
  2. From: Yi Zhao <yi.zhao@windriver.com>
  3. Date: Wed, 18 Jan 2017 14:59:39 +0800
  4. Subject: [PATCH] fix error for expansion of macro in thread.h
  5. The parameter declaration is missing in expansion of macro
  6. which cause the build error:
  7. | In file included from src/freeradius-devel/libradius.h:80:0,
  8. | from src/lib/log.c:26:
  9. | src/lib/log.c: In function '__fr_thread_local_destroy_fr_strerror_buffer':
  10. | src/lib/log.c:37:31: error: 'fr_strerror_buffer' undeclared (first use in this function)
  11. | fr_thread_local_setup(char *, fr_strerror_buffer) /* macro */
  12. | ^
  13. Add the missing declaration in macro.
  14. Upstream-Status: Pending
  15. Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
  16. Fetch from: http://cgit.openembedded.org/meta-openembedded/tree/meta-networking/recipes-connectivity/freeradius/files
  17. Signed-off-by: David Gouarin <david.gouarin@thalesgroup.com>
  18. Signed-off-by: Matt Weber <matthew.weber@rockwellcollins.com>
  19. Upstream: N/A, code has changed
  20. ---
  21. src/include/threads.h | 10 +++++-----
  22. 1 file changed, 5 insertions(+), 5 deletions(-)
  23. diff --git a/src/include/threads.h b/src/include/threads.h
  24. index e36d81dac0..2bcb6aadcb 100644
  25. --- a/src/include/threads.h
  26. +++ b/src/include/threads.h
  27. @@ -89,7 +89,7 @@ static _t __fr_thread_local_init_##_n(pthread_destructor_t func)\
  28. # define fr_thread_local_get(_n) _n
  29. #elif defined(HAVE_PTHREAD_H)
  30. # include <pthread.h>
  31. -# define fr_thread_local_setup(_t, _n) \
  32. +# define fr_thread_local_setup(_t, _n) static __thread _t _n;\
  33. static pthread_key_t __fr_thread_local_key_##_n;\
  34. static pthread_once_t __fr_thread_local_once_##_n = PTHREAD_ONCE_INIT;\
  35. static pthread_destructor_t __fr_thread_local_destructor_##_n = NULL;\
  36. @@ -100,17 +100,17 @@ static void __fr_thread_local_destroy_##_n(UNUSED void *unused)\
  37. static void __fr_thread_local_key_init_##_n(void)\
  38. {\
  39. (void) pthread_key_create(&__fr_thread_local_key_##_n, __fr_thread_local_destroy_##_n);\
  40. - (void) pthread_setspecific(__fr_thread_local_key_##_n, &(_n));\
  41. }\
  42. static _t __fr_thread_local_init_##_n(pthread_destructor_t func)\
  43. {\
  44. __fr_thread_local_destructor_##_n = func;\
  45. if (_n) return _n; \
  46. (void) pthread_once(&__fr_thread_local_once_##_n, __fr_thread_local_key_init_##_n);\
  47. + (void) pthread_setspecific(__fr_thread_local_key_##_n, &(_n));\
  48. return _n;\
  49. }
  50. -# define fr_thread_local_init(_n, _f) __fr_thread_local_init_##_n(_f)
  51. -# define fr_thread_local_set(_n, _v) __fr_thread_local_set_##_n(_v)
  52. -# define fr_thread_local_get(_n) __fr_thread_local_get_##_n()
  53. +# define fr_thread_local_init(_n, _f) __fr_thread_local_init_##_n(_f)
  54. +# define fr_thread_local_set(_n, _v) ((int)!((_n = _v) || 1))
  55. +# define fr_thread_local_get(_n) _n
  56. #endif
  57. #endif
  58. --
  59. 2.17.1