aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2019-07-19 18:00:37 -0400
committerJack Lloyd <[email protected]>2019-07-19 18:00:37 -0400
commit13bddf2d10ffcd35db2798ac1b4ad1d5c0e0e99e (patch)
tree37a55768683bb466dc77078977f2484d0dc5d8df /src
parentaa314cddff4d8875542de036739f9916720e5e9e (diff)
Support disable thread_local but not threads
Needed for old iOS and maybe other things GH #2045
Diffstat (limited to 'src')
-rw-r--r--src/build-data/os/aix.txt1
-rw-r--r--src/build-data/os/android.txt1
-rw-r--r--src/build-data/os/cygwin.txt1
-rw-r--r--src/build-data/os/dragonfly.txt1
-rw-r--r--src/build-data/os/freebsd.txt1
-rw-r--r--src/build-data/os/haiku.txt1
-rw-r--r--src/build-data/os/hpux.txt1
-rw-r--r--src/build-data/os/hurd.txt1
-rw-r--r--src/build-data/os/ios.txt1
-rw-r--r--src/build-data/os/linux.txt1
-rw-r--r--src/build-data/os/macos.txt1
-rw-r--r--src/build-data/os/mingw.txt1
-rw-r--r--src/build-data/os/nacl.txt1
-rw-r--r--src/build-data/os/netbsd.txt1
-rw-r--r--src/build-data/os/openbsd.txt1
-rw-r--r--src/build-data/os/qnx.txt1
-rw-r--r--src/build-data/os/solaris.txt1
-rw-r--r--src/build-data/os/uwp.txt1
-rw-r--r--src/build-data/os/windows.txt1
-rw-r--r--src/lib/utils/compiler.h12
-rw-r--r--src/tests/test_runner.cpp2
21 files changed, 28 insertions, 5 deletions
diff --git a/src/build-data/os/aix.txt b/src/build-data/os/aix.txt
index be5a8717e..93b689a0a 100644
--- a/src/build-data/os/aix.txt
+++ b/src/build-data/os/aix.txt
@@ -12,5 +12,6 @@ proc_fs
sockets
threads
+thread_local
filesystem
</target_features>
diff --git a/src/build-data/os/android.txt b/src/build-data/os/android.txt
index 0f9d73f85..e55a7e3d3 100644
--- a/src/build-data/os/android.txt
+++ b/src/build-data/os/android.txt
@@ -20,5 +20,6 @@ getauxval
sockets
threads
+thread_local
filesystem
</target_features>
diff --git a/src/build-data/os/cygwin.txt b/src/build-data/os/cygwin.txt
index 1d106b06c..2133c1587 100644
--- a/src/build-data/os/cygwin.txt
+++ b/src/build-data/os/cygwin.txt
@@ -14,5 +14,6 @@ dev_random
sockets
threads
+thread_local
filesystem
</target_features>
diff --git a/src/build-data/os/dragonfly.txt b/src/build-data/os/dragonfly.txt
index 6cf794948..36a9d33b4 100644
--- a/src/build-data/os/dragonfly.txt
+++ b/src/build-data/os/dragonfly.txt
@@ -11,5 +11,6 @@ arc4random
sockets
threads
+thread_local
filesystem
</target_features>
diff --git a/src/build-data/os/freebsd.txt b/src/build-data/os/freebsd.txt
index 99f69fe6a..cb8817909 100644
--- a/src/build-data/os/freebsd.txt
+++ b/src/build-data/os/freebsd.txt
@@ -16,5 +16,6 @@ getentropy
sockets
threads
+thread_local
filesystem
</target_features>
diff --git a/src/build-data/os/haiku.txt b/src/build-data/os/haiku.txt
index e203a0d26..9899eb80d 100644
--- a/src/build-data/os/haiku.txt
+++ b/src/build-data/os/haiku.txt
@@ -15,6 +15,7 @@ dev_random
sockets
threads
+thread_local
filesystem
</target_features>
diff --git a/src/build-data/os/hpux.txt b/src/build-data/os/hpux.txt
index f9a74f639..d2b50be94 100644
--- a/src/build-data/os/hpux.txt
+++ b/src/build-data/os/hpux.txt
@@ -10,6 +10,7 @@ dev_random
sockets
threads
+thread_local
filesystem
</target_features>
diff --git a/src/build-data/os/hurd.txt b/src/build-data/os/hurd.txt
index 6d12c9a48..a5d4fcbd4 100644
--- a/src/build-data/os/hurd.txt
+++ b/src/build-data/os/hurd.txt
@@ -9,6 +9,7 @@ clock_gettime
sockets
threads
+thread_local
filesystem
</target_features>
diff --git a/src/build-data/os/ios.txt b/src/build-data/os/ios.txt
index 89e044cd1..65f0c6fb4 100644
--- a/src/build-data/os/ios.txt
+++ b/src/build-data/os/ios.txt
@@ -13,6 +13,7 @@ arc4random
commoncrypto
sockets
threads
+thread_local
filesystem
</target_features>
diff --git a/src/build-data/os/linux.txt b/src/build-data/os/linux.txt
index c72114471..5d5a36e3c 100644
--- a/src/build-data/os/linux.txt
+++ b/src/build-data/os/linux.txt
@@ -16,6 +16,7 @@ getauxval
sockets
threads
+thread_local
filesystem
</target_features>
diff --git a/src/build-data/os/macos.txt b/src/build-data/os/macos.txt
index 08e543565..cd8c8eb97 100644
--- a/src/build-data/os/macos.txt
+++ b/src/build-data/os/macos.txt
@@ -22,6 +22,7 @@ clock_gettime
commoncrypto
sockets
threads
+thread_local
filesystem
apple_keychain
diff --git a/src/build-data/os/mingw.txt b/src/build-data/os/mingw.txt
index 8394eade6..d81fc97f4 100644
--- a/src/build-data/os/mingw.txt
+++ b/src/build-data/os/mingw.txt
@@ -23,5 +23,6 @@ rtlgenrandom
virtual_lock
threads
+thread_local
filesystem
</target_features>
diff --git a/src/build-data/os/nacl.txt b/src/build-data/os/nacl.txt
index 55156e401..0cb08ab93 100644
--- a/src/build-data/os/nacl.txt
+++ b/src/build-data/os/nacl.txt
@@ -2,4 +2,5 @@
<target_features>
threads
+thread_local
</target_features>
diff --git a/src/build-data/os/netbsd.txt b/src/build-data/os/netbsd.txt
index cbfd8659e..f9ee81cb8 100644
--- a/src/build-data/os/netbsd.txt
+++ b/src/build-data/os/netbsd.txt
@@ -11,6 +11,7 @@ explicit_memset
sockets
threads
+thread_local
filesystem
</target_features>
diff --git a/src/build-data/os/openbsd.txt b/src/build-data/os/openbsd.txt
index e1a4c55eb..4b483273c 100644
--- a/src/build-data/os/openbsd.txt
+++ b/src/build-data/os/openbsd.txt
@@ -19,5 +19,6 @@ pledge
sockets
threads
+thread_local
filesystem
</target_features>
diff --git a/src/build-data/os/qnx.txt b/src/build-data/os/qnx.txt
index ef5c0872b..658c52da2 100644
--- a/src/build-data/os/qnx.txt
+++ b/src/build-data/os/qnx.txt
@@ -8,6 +8,7 @@ dev_random
sockets
threads
+thread_local
filesystem
</target_features>
diff --git a/src/build-data/os/solaris.txt b/src/build-data/os/solaris.txt
index c729f6aa1..3abee02da 100644
--- a/src/build-data/os/solaris.txt
+++ b/src/build-data/os/solaris.txt
@@ -9,6 +9,7 @@ dev_random
proc_fs
threads
+thread_local
sockets
filesystem
</target_features>
diff --git a/src/build-data/os/uwp.txt b/src/build-data/os/uwp.txt
index df156f0a0..bda092170 100644
--- a/src/build-data/os/uwp.txt
+++ b/src/build-data/os/uwp.txt
@@ -15,6 +15,7 @@ crypto_ng
rtlsecurezeromemory
threads
+thread_local
filesystem
</target_features>
diff --git a/src/build-data/os/windows.txt b/src/build-data/os/windows.txt
index edd4541d6..a9abd82fb 100644
--- a/src/build-data/os/windows.txt
+++ b/src/build-data/os/windows.txt
@@ -35,6 +35,7 @@ rtlsecurezeromemory
virtual_lock
threads
+thread_local
filesystem
certificate_store
diff --git a/src/lib/utils/compiler.h b/src/lib/utils/compiler.h
index 7eeaee58a..de9f0f3c3 100644
--- a/src/lib/utils/compiler.h
+++ b/src/lib/utils/compiler.h
@@ -145,10 +145,14 @@
/*
* Define BOTAN_THREAD_LOCAL
*/
-#if defined(BOTAN_TARGET_OS_HAS_THREADS)
- #define BOTAN_THREAD_LOCAL thread_local
-#else
- #define BOTAN_THREAD_LOCAL /**/
+#if !defined(BOTAN_THREAD_LOCAL)
+
+ #if defined(BOTAN_TARGET_OS_HAS_THREADS) && defined(BOTAN_TARGET_OS_HAS_THREAD_LOCAL)
+ #define BOTAN_THREAD_LOCAL thread_local
+ #else
+ #define BOTAN_THREAD_LOCAL /**/
+ #endif
+
#endif
/*
diff --git a/src/tests/test_runner.cpp b/src/tests/test_runner.cpp
index 86ceab1f8..240ce93ca 100644
--- a/src/tests/test_runner.cpp
+++ b/src/tests/test_runner.cpp
@@ -311,7 +311,7 @@ size_t Test_Runner::run_tests(const std::vector<std::string>& tests_to_run,
if(test_threads != 1)
{
-#if defined(BOTAN_HAS_THREAD_UTILS)
+#if defined(BOTAN_HAS_THREAD_UTILS) && defined(BOTAN_TARGET_OS_HAS_THREAD_LOCAL)
// If 0 then we let thread pool select the count
Botan::Thread_Pool pool(test_threads);