2
0
mirror of https://github.com/boostorg/math.git synced 2026-01-19 04:22:09 +00:00

Add BOOST_NOINLINE to standalone config and apply to erf_inv_initializer.

Replaces: https://github.com/boostorg/math/pull/807.
This commit is contained in:
jzmaddock
2022-07-27 11:20:51 +01:00
parent d4aacdd30f
commit b33e40eb4b
2 changed files with 21 additions and 1 deletions

View File

@@ -384,7 +384,7 @@ template <class T, class Policy>
const typename erf_inv_initializer<T, Policy>::init erf_inv_initializer<T, Policy>::initializer;
template <class T, class Policy>
bool erf_inv_initializer<T, Policy>::init::is_value_non_zero(T v)
BOOST_NOINLINE bool erf_inv_initializer<T, Policy>::init::is_value_non_zero(T v)
{
// This needs to be non-inline to detect whether v is non zero at runtime
// rather than at compile time, only relevant when running under valgrind

View File

@@ -107,6 +107,26 @@
# endif
#endif
#if !defined(BOOST_NOINLINE)
# if defined(_MSC_VER)
# define BOOST_NOINLINE __declspec(noinline)
# elif defined(__GNUC__) && __GNUC__ > 3
// Clang also defines __GNUC__ (as 4)
# if defined(__CUDACC__)
// nvcc doesn't always parse __noinline__,
// see: https://svn.boost.org/trac/boost/ticket/9392
# define BOOST_NOINLINE __attribute__ ((noinline))
# elif defined(__HIP__)
// See https://github.com/boostorg/config/issues/392
# define BOOST_NOINLINE __attribute__ ((noinline))
# else
# define BOOST_NOINLINE __attribute__ ((__noinline__))
# endif
# else
# define BOOST_NOINLINE
# endif
#endif
#endif // BOOST_MATH_STANDALONE
// Support compilers with P0024R2 implemented without linking TBB