Opened 10 years ago

Closed 10 years ago

#7492 closed Bugs (fixed)

add support of libc++

Reported by: vvavrychuk@… Owned by: John Maddock
Milestone: To Be Determined Component: math
Version: Boost 1.52.0 Severity: Problem
Keywords: Cc:

Description

Without this change I get compilation error

In file included from helmholtz/base/kom/green_func/green_func_helmholtz.cpp:1:
In file included from helmholtz/base/kom/green_func/green_func_helmholtz.hpp:7:
In file included from helmholtz/base/kom/fund_sol/fund_sol_helmholtz.hpp:6:
In file included from base/base/kom/base/special_functions.hpp:9:
In file included from base/base/kom/base/special_functions_ooura.hpp:4:
In file included from third_party/boost/boost/math/special_functions/bessel.hpp:17:
In file included from third_party/boost/boost/math/special_functions/detail/bessel_jy.hpp:14:
In file included from third_party/boost/boost/math/special_functions/gamma.hpp:37:
In file included from third_party/boost/boost/math/special_functions/powm1.hpp:14:
third_party/boost/boost/math/special_functions/expm1.hpp:308:64: error: implicit conversion loses floating-point precision: 'double' to 'float' [-Werror,-Wconversion]
inline float expm1(float x, const policies::policy<>&){ return ::expm1(x); }
                                                        ~~~~~~ ^~~~~~~~~~
2 errors generated.

Change History (5)

comment:1 by vvavrychuk@…, 10 years ago

Patch is

From 69e657661b5d617b189667adf015346821c7297b Mon Sep 17 00:00:00 2001
From: Vasyl Vavrychuk <vvavrychuk@gmail.com>
Date: Wed, 10 Oct 2012 20:57:50 +0300
Subject: [PATCH] Boost.Math: support libcxx

Fixed compilation with libc++.
---
 boost/math/tools/config.hpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/boost/math/tools/config.hpp b/boost/math/tools/config.hpp
index 907d693..3742ae0 100644
--- a/boost/math/tools/config.hpp
+++ b/boost/math/tools/config.hpp
@@ -99,6 +99,10 @@
 #  define BOOST_MATH_USE_C99
 #endif

+#if defined(_LIBCPP_VERSION)
+#  define BOOST_MATH_USE_C99
+#endif
+
 #if defined(__CYGWIN__) || defined(__HP_aCC) || defined(BOOST_INTEL) \
   || defined(BOOST_NO_NATIVE_LONG_DOUBLE_FP_CLASSIFY) \
   || (defined(__GNUC__) && !defined(BOOST_MATH_USE_C99))
-- 
1.7.11.4

comment:2 by John Maddock, 10 years ago

I'm not sure that's quite the correct fix - can we guarantee that libc++ always implies the C99 math functions are available? I suspect it would be better to check the platform (what is the platform BTW)?

In the mean time I'll add a static_cast so you don't get the implicit-conversion warnings/errors.

comment:3 by John Maddock, 10 years ago

(In [81624]) Lots of small patches. Update and regenerate docs. Fixes #7183. Fixes #7290. Fixes #7291. Fixes #7649. Refs #7492.

comment:4 by vvavrychuk@…, 10 years ago

Yes, libc++ has always C99 math functions enabled.

See llvm.org/viewvc/llvm-project/libcxx/trunk/include/cmath?view=markup

comment:5 by John Maddock, 10 years ago

Resolution: fixed
Status: newclosed

(In [81625]) Enable use of C99 functions on libc++. Fixes #7492.

Note: See TracTickets for help on using tickets.