Fix "'__thread' not at start of declaration" warnings (-Wextra) Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
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 62 63
diff --git a/api.doxygen b/api.doxygen
index faf2dae..4d25aed 100644
--- a/api.doxygen
+++ b/api.doxygen
@@ -17,6 +17,7 @@ CASE_SENSE_NAMES = NO
PREDEFINED = \
"GIT_EXTERN(x)=x" \
+ "GIT_EXTERN_TLS(x)=x" \
"GIT_INLINE(x)=x" \
"GIT_BEGIN_DECL=" \
"GIT_END_DECL=" \
diff --git a/src/git/common.h b/src/git/common.h
index c470e0e..375649f 100644
--- a/src/git/common.h
+++ b/src/git/common.h
@@ -1,6 +1,8 @@
#ifndef INCLUDE_git_common_h__
#define INCLUDE_git_common_h__
+#include "thread-utils.h"
+
#ifdef __cplusplus
# define GIT_BEGIN_DECL extern "C" {
# define GIT_END_DECL }
@@ -20,6 +22,16 @@
# define GIT_EXTERN(type) extern type
#endif
+/** Declare a public TLS symbol exported for application use. */
+#ifdef __GNUC__
+# define GIT_EXTERN_TLS(type) extern \
+ __attribute__((visibility("default"))) \
+ GIT_TLS \
+ type
+#else
+# define GIT_EXTERN_TLS(type) extern GIT_TLS type
+#endif
+
/** Declare a function as always inlined. */
#if defined(_MSC_VER)
# define GIT_INLINE(type) static __inline type
diff --git a/src/git/errors.h b/src/git/errors.h
index 37870a4..8e9e423 100644
--- a/src/git/errors.h
+++ b/src/git/errors.h
@@ -2,7 +2,6 @@
#define INCLUDE_git_errors_h__
#include "common.h"
-#include "thread-utils.h"
/**
* @file git/errors.h
@@ -14,7 +13,7 @@ GIT_BEGIN_DECL
/** The git errno. */
#if defined(GIT_TLS)
-GIT_EXTERN(int) GIT_TLS git_errno;
+GIT_EXTERN_TLS(int) git_errno;
#elif defined(GIT_HAS_PTHREAD)
# define git_errno (*git__errno_storage())