aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Waterman <andrew@sifive.com>2024-06-12 18:06:35 -0700
committerAndrew Waterman <andrew@sifive.com>2024-06-13 17:43:07 -0700
commit6c008e990c999dca2f1fff06c5bc96e455f63acd (patch)
tree8723423caad4a71f68e345771f67f2079fde06db
parent62d5c06dfb3aae38d979afc066bd604cbccbfbe0 (diff)
downloadspike-6c008e990c999dca2f1fff06c5bc96e455f63acd.zip
spike-6c008e990c999dca2f1fff06c5bc96e455f63acd.tar.gz
spike-6c008e990c999dca2f1fff06c5bc96e455f63acd.tar.bz2
Make softfloat's rounding mode thread-local
This has no effect on Spike itself, but it might matter for anyone who's using Spike as a library in a multithreaded program.
-rw-r--r--softfloat/softfloat.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/softfloat/softfloat.h b/softfloat/softfloat.h
index eb78d74..72daccb 100644
--- a/softfloat/softfloat.h
+++ b/softfloat/softfloat.h
@@ -50,8 +50,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <stdint.h>
#include "softfloat_types.h"
-#ifndef THREAD_LOCAL
-#define THREAD_LOCAL
+#if __has_include(<threads.h>)
+# include <threads.h>
+# define THREAD_LOCAL thread_local
+#else
+# define THREAD_LOCAL _Thread_local
#endif
#ifdef __cplusplus