Boost logo

Boost-Commit :

From: john_at_[hidden]
Date: 2007-11-09 13:42:47


Author: johnmaddock
Date: 2007-11-09 13:42:46 EST (Fri, 09 Nov 2007)
New Revision: 40971
URL: http://svn.boost.org/trac/boost/changeset/40971

Log:
Fixes for IBM xlc: ensure that functions that are also macros are correctly protected against macro expansion.
Text files modified:
   trunk/libs/math/test/compile_test/instantiate.hpp | 28 ++++++++++++++--------------
   trunk/libs/math/test/compile_test/sf_fpclassify_incl_test.cpp | 30 +++++++++++++++---------------
   trunk/libs/math/test/test_policy_sf.cpp | 9 +++++++++
   trunk/libs/math/test/test_triangular.cpp | 2 +-
   4 files changed, 39 insertions(+), 30 deletions(-)

Modified: trunk/libs/math/test/compile_test/instantiate.hpp
==============================================================================
--- trunk/libs/math/test/compile_test/instantiate.hpp (original)
+++ trunk/libs/math/test/compile_test/instantiate.hpp 2007-11-09 13:42:46 EST (Fri, 09 Nov 2007)
@@ -137,10 +137,10 @@
    boost::math::ibetac_invb(v1, v2, v3);
    boost::math::gamma_p_derivative(v2, v3);
    boost::math::ibeta_derivative(v1, v2, v3);
- boost::math::fpclassify(v1);
- boost::math::isfinite(v1);
- boost::math::isnormal(v1);
- boost::math::isnan(v1);
+ (boost::math::fpclassify)(v1);
+ (boost::math::isfinite)(v1);
+ (boost::math::isnormal)(v1);
+ (boost::math::isnan)(v1);
    boost::math::isinf(v1);
    boost::math::log1p(v1);
    boost::math::expm1(v1);
@@ -233,11 +233,11 @@
    boost::math::ibetac_invb(v1, v2, v3, pol);
    boost::math::gamma_p_derivative(v2, v3, pol);
    boost::math::ibeta_derivative(v1, v2, v3, pol);
- boost::math::fpclassify(v1);
- boost::math::isfinite(v1);
- boost::math::isnormal(v1);
- boost::math::isnan(v1);
- boost::math::isinf(v1);
+ (boost::math::fpclassify)(v1);
+ (boost::math::isfinite)(v1);
+ (boost::math::isnormal)(v1);
+ (boost::math::isnan)(v1);
+ (boost::math::isinf)(v1);
    boost::math::log1p(v1, pol);
    boost::math::expm1(v1, pol);
    boost::math::cbrt(v1, pol);
@@ -327,11 +327,11 @@
    test::ibetac_invb(v1, v2, v3);
    test::gamma_p_derivative(v2, v3);
    test::ibeta_derivative(v1, v2, v3);
- test::fpclassify(v1);
- test::isfinite(v1);
- test::isnormal(v1);
- test::isnan(v1);
- test::isinf(v1);
+ (test::fpclassify)(v1);
+ (test::isfinite)(v1);
+ (test::isnormal)(v1);
+ (test::isnan)(v1);
+ (test::isinf)(v1);
    test::log1p(v1);
    test::expm1(v1);
    test::cbrt(v1);

Modified: trunk/libs/math/test/compile_test/sf_fpclassify_incl_test.cpp
==============================================================================
--- trunk/libs/math/test/compile_test/sf_fpclassify_incl_test.cpp (original)
+++ trunk/libs/math/test/compile_test/sf_fpclassify_incl_test.cpp 2007-11-09 13:42:46 EST (Fri, 09 Nov 2007)
@@ -15,21 +15,21 @@
 
 void check()
 {
- check_result<int>(boost::math::fpclassify<float>(f));
- check_result<int>(boost::math::fpclassify<double>(d));
- check_result<int>(boost::math::fpclassify<long double>(l));
-
- check_result<bool>(boost::math::isfinite<float>(f));
- check_result<bool>(boost::math::isfinite<double>(d));
- check_result<bool>(boost::math::isfinite<long double>(l));
-
- check_result<bool>(boost::math::isinf<float>(f));
- check_result<bool>(boost::math::isinf<double>(d));
- check_result<bool>(boost::math::isinf<long double>(l));
-
- check_result<bool>(boost::math::isnormal<float>(f));
- check_result<bool>(boost::math::isnormal<double>(d));
- check_result<bool>(boost::math::isnormal<long double>(l));
+ check_result<int>(boost::math::fpclassify BOOST_NO_MACRO_EXPAND<float>(f));
+ check_result<int>(boost::math::fpclassify BOOST_NO_MACRO_EXPAND<double>(d));
+ check_result<int>(boost::math::fpclassify BOOST_NO_MACRO_EXPAND<long double>(l));
+
+ check_result<bool>(boost::math::isfinite BOOST_NO_MACRO_EXPAND<float>(f));
+ check_result<bool>(boost::math::isfinite BOOST_NO_MACRO_EXPAND<double>(d));
+ check_result<bool>(boost::math::isfinite BOOST_NO_MACRO_EXPAND<long double>(l));
+
+ check_result<bool>(boost::math::isinf BOOST_NO_MACRO_EXPAND<float>(f));
+ check_result<bool>(boost::math::isinf BOOST_NO_MACRO_EXPAND<double>(d));
+ check_result<bool>(boost::math::isinf BOOST_NO_MACRO_EXPAND<long double>(l));
+
+ check_result<bool>(boost::math::isnormal BOOST_NO_MACRO_EXPAND<float>(f));
+ check_result<bool>(boost::math::isnormal BOOST_NO_MACRO_EXPAND<double>(d));
+ check_result<bool>(boost::math::isnormal BOOST_NO_MACRO_EXPAND<long double>(l));
 }
 
 

Modified: trunk/libs/math/test/test_policy_sf.cpp
==============================================================================
--- trunk/libs/math/test/test_policy_sf.cpp (original)
+++ trunk/libs/math/test/test_policy_sf.cpp 2007-11-09 13:42:46 EST (Fri, 09 Nov 2007)
@@ -28,6 +28,15 @@
 #define TEST_POLICY_SF(call)\
    BOOST_CHECK_EQUAL(boost::math::call , test::call)
 
+//
+// Prevent some macro conflicts just in case:
+//
+#undef fpclassify
+#undef isnormal
+#undef isinf
+#undef isfinite
+#undef isnan
+
 int test_main(int, char* [])
 {
    int i;

Modified: trunk/libs/math/test/test_triangular.cpp
==============================================================================
--- trunk/libs/math/test/test_triangular.cpp (original)
+++ trunk/libs/math/test/test_triangular.cpp 2007-11-09 13:42:46 EST (Fri, 09 Nov 2007)
@@ -486,7 +486,7 @@
     triangular_distribution<RealType, inf_policy> tridef_inf(-1, 0., 1);
     // But can't use BOOST_CHECK_EQUAL(?, quiet_NaN)
     using boost::math::isnan;
- BOOST_CHECK(isnan(pdf(tridef_inf, std::numeric_limits<RealType>::infinity())));
+ BOOST_CHECK((isnan)(pdf(tridef_inf, std::numeric_limits<RealType>::infinity())));
   } // test for infinity using std::numeric_limits<>::infinity()
   else
   { // real_concept case, does has_infinfity == false, so can't check it throws.


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk