1From 32bd6197353f6ea8e5bef01f09e25c944141acfc Mon Sep 17 00:00:00 2001
2From: jzmaddock <john@johnmaddock.co.uk>
3Date: Wed, 1 Sep 2021 18:54:54 +0100
4Subject: [PATCH] Allow definition of BOOST_MATH_NO_ATOMIC_INT on the command
5 line. Allows us to test/emulate platforms with no atomic integers.
6
7[buildroot@heine.tech:
8  - backport from boostorg/math 32bd6197353f6ea8e5bef01f09e25c944141acfc
9  - alter path to match boost release
10]
11Signed-off-by: Michael Nosthoff <buildroot@heine.tech>
12---
13 boost/math/tools/atomic.hpp | 10 +++++-----
14 1 file changed, 5 insertions(+), 5 deletions(-)
15
16diff --git a/boost/math/tools/atomic.hpp b/boost/math/tools/atomic.hpp
17index cc76ed269f..e3cbf5db89 100644
18--- a/boost/math/tools/atomic.hpp
19+++ b/boost/math/tools/atomic.hpp
20@@ -16,27 +16,27 @@
21 namespace boost {
22    namespace math {
23       namespace detail {
24-#if ATOMIC_INT_LOCK_FREE == 2
25+#if (ATOMIC_INT_LOCK_FREE == 2) && !defined(BOOST_MATH_NO_ATOMIC_INT)
26          typedef std::atomic<int> atomic_counter_type;
27          typedef std::atomic<unsigned> atomic_unsigned_type;
28          typedef int atomic_integer_type;
29          typedef unsigned atomic_unsigned_integer_type;
30-#elif ATOMIC_SHORT_LOCK_FREE == 2
31+#elif (ATOMIC_SHORT_LOCK_FREE == 2) && !defined(BOOST_MATH_NO_ATOMIC_INT)
32          typedef std::atomic<short> atomic_counter_type;
33          typedef std::atomic<unsigned short> atomic_unsigned_type;
34          typedef short atomic_integer_type;
35          typedef unsigned short atomic_unsigned_type;
36-#elif ATOMIC_LONG_LOCK_FREE == 2
37+#elif (ATOMIC_LONG_LOCK_FREE == 2) && !defined(BOOST_MATH_NO_ATOMIC_INT)
38          typedef std::atomic<long> atomic_unsigned_integer_type;
39          typedef std::atomic<unsigned long> atomic_unsigned_type;
40          typedef unsigned long atomic_unsigned_type;
41          typedef long atomic_integer_type;
42-#elif ATOMIC_LLONG_LOCK_FREE == 2
43+#elif (ATOMIC_LLONG_LOCK_FREE == 2) && !defined(BOOST_MATH_NO_ATOMIC_INT)
44          typedef std::atomic<long long> atomic_unsigned_integer_type;
45          typedef std::atomic<unsigned long long> atomic_unsigned_type;
46          typedef long long atomic_integer_type;
47          typedef unsigned long long atomic_unsigned_integer_type;
48-#else
49+#elif !defined(BOOST_MATH_NO_ATOMIC_INT)
50 #  define BOOST_MATH_NO_ATOMIC_INT
51 #endif
52       } // Namespace detail
53