Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add BOOST_NOINLINE to standalone config and apply to erf_inv_initiali… #809

Merged
merged 1 commit into from
Jul 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/boost/math/special_functions/detail/erf_inv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 20 additions & 0 deletions include/boost/math/tools/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down