[Libreoffice-commits] cppunit.git: 3 commits - autogen.sh configure.ac examples/money include/cppunit m4/ax_cxx_have_isfinite.m4 m4/README Makefile.am

Markus Mohrhard markus.mohrhard at googlemail.com
Wed May 23 00:07:47 UTC 2018


 Makefile.am                                 |    1 
 autogen.sh                                  |    2 -
 configure.ac                                |    2 -
 examples/money/Makefile.am                  |    2 -
 include/cppunit/portability/FloatingPoint.h |   41 ++--------------------------
 m4/README                                   |    1 
 m4/ax_cxx_have_isfinite.m4                  |   27 ------------------
 7 files changed, 4 insertions(+), 72 deletions(-)

New commits:
commit fd7111241a90b00eed45c7fb847101c732b9df83
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Wed May 23 02:06:52 2018 +0200

    C++11 provides std::isfinite and std::isnan

diff --git a/Makefile.am b/Makefile.am
index 674afd3..90c6a1c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -32,7 +32,6 @@ m4internal = \
 	m4/ac_cxx_string_compare_string_first.m4 \
 	m4/ac_dll.m4 \
 	m4/ax_cxx_gcc_abi_demangle.m4 \
-	m4/ax_cxx_have_isfinite.m4 \
 	m4/ax_cxx_have_sstream.m4 \
 	m4/ax_cxx_namespaces.m4 \
 	m4/ax_cxx_compile_stdcxx_11.m4 \
diff --git a/configure.ac b/configure.ac
index b34947a..21172f0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -38,8 +38,6 @@ AC_LIBTOOL_WIN32_DLL
 AC_HEADER_STDC
 AC_LTDL_DLLIB
 AC_CHECK_HEADERS(cmath,[],[],[/**/])
-AX_CXX_HAVE_ISFINITE
-AC_CHECK_FUNCS(finite)
 AX_CXX_HAVE_SSTREAM
 AC_CXX_HAVE_STRSTREAM
 
diff --git a/include/cppunit/portability/FloatingPoint.h b/include/cppunit/portability/FloatingPoint.h
index 15bf95b..56138fa 100644
--- a/include/cppunit/portability/FloatingPoint.h
+++ b/include/cppunit/portability/FloatingPoint.h
@@ -2,39 +2,13 @@
 #define CPPUNIT_PORTABILITY_FLOATINGPOINT_H_INCLUDED
 
 #include <cppunit/Portability.h>
-#include <math.h>
-
-#if defined(__sun) && !defined(CPPUNIT_HAVE_ISFINITE) && defined(CPPUNIT_HAVE_FINITE)
-#include <ieeefp.h>
-  // <math.h> is still needed for usage of fabs in TestAssert.cpp
-#endif
+#include <cmath>
 
 CPPUNIT_NS_BEGIN
 
-/// \brief Tests if a floating-point is a NaN.
-// According to IEEE-754 floating point standard, 
-// (see e.g. page 8 of
-// http://www.cs.berkeley.edu/~wkahan/ieee754status/ieee754.ps) 
-// all comparisons with NaN are false except "x != x", which is true.
-//
-// At least Microsoft Visual Studio 6 is known not to implement this test correctly.
-// It emits the following code to test equality:
-//  fcomp       qword ptr [nan]
-//  fnstsw      ax                        // copie fp (floating-point) status register to ax
-//  test        ah,40h                    // test bit 14 of ax (0x4000) => C3 of fp status register
-// According to the following documentation on the x86 floating point status register,
-// the C2 bit should be tested to test for NaN value. 
-// http://webster.cs.ucr.edu/AoA/Windows/HTML/RealArithmetic.html#1000117
-// In Microsoft Visual Studio 2003 & 2005, the test is implemented with:
-//  test        ah,44h         // Visual Studio 2005 test both C2 & C3...
-//
-// To work around this, a NaN is assumed to be detected if no strict ordering is found.
 inline bool floatingPointIsUnordered( double x )
 {
-   // x != x will detect a NaN on conformant platform
-   // (2.0 < x  &&  x < 1.0) will detect a NaN on non conformant platform:
-   // => no ordering can be found for x.
-   return  (x != x) ||  (2.0 < x  &&  x < 1.0);
+    return std::isnan(x);
 }
 
 
@@ -42,16 +16,7 @@ inline bool floatingPointIsUnordered( double x )
 /// @return \c true if x is neither a NaN, nor +inf, nor -inf, \c false otherwise.
 inline int floatingPointIsFinite( double x )
 {
-#if defined(CPPUNIT_HAVE_ISFINITE)
-   return isfinite( x );
-#elif defined(CPPUNIT_HAVE_FINITE)
-   return finite( x );
-#elif defined(CPPUNIT_HAVE__FINITE)
-   return _finite(x);
-#else
-   double testInf = x * 0.0;  // Produce 0.0 if x is finite, a NaN otherwise.
-   return testInf == 0.0  &&  !floatingPointIsUnordered(testInf);
-#endif
+    return std::isfinite(x);
 }
 
 CPPUNIT_NS_END
diff --git a/m4/README b/m4/README
index 90a85e2..b082695 100644
--- a/m4/README
+++ b/m4/README
@@ -3,6 +3,5 @@
 # Exceptions internal code:
 #    bb_enable_doxygen.m4
 #    ac_cxx_string_compare_string_first.m4
-#    ax_cxx_have_isfinite.m4
 #    ac_dll.m4
 #    ac_cxx_have_strstream.m4
commit 03fe3b83eb95a20a3397a0b5c19c25f02986c888
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Wed May 23 02:06:03 2018 +0200

    fix make distcheck, part2

diff --git a/examples/money/Makefile.am b/examples/money/Makefile.am
index f6afb40..5db63fb 100644
--- a/examples/money/Makefile.am
+++ b/examples/money/Makefile.am
@@ -1,5 +1,5 @@
 # Include cookbook.html in distro
-EXTRA_DIST = money.dsp money.dsw configure.in StdAfx.cpp
+EXTRA_DIST = money.dsp money.dsw configure.ac StdAfx.cpp
 
 AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include
 
commit 66e39e76d7f9acc27522b0a25cd6e538ecc920f0
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Wed May 23 02:05:43 2018 +0200

    fix make distcheck, part1

diff --git a/autogen.sh b/autogen.sh
index 7f22237..479564b 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -33,8 +33,6 @@ if [ "$LIBTOOLIZEFOUND" = "0" ]; then
 	exit 1
 fi
 
-rm -rf autom4te*.cache
-
 $LIBTOOLIZE --force --copy || {
 	echo "error: libtoolize failed"
 	exit 1
diff --git a/m4/ax_cxx_have_isfinite.m4 b/m4/ax_cxx_have_isfinite.m4
deleted file mode 100644
index 5f9c7fc..0000000
--- a/m4/ax_cxx_have_isfinite.m4
+++ /dev/null
@@ -1,27 +0,0 @@
-dnl @synopsis AX_CXX_HAVE_ISFINITE
-dnl
-dnl If isfinite() is available to the C++ compiler:
-dnl   define HAVE_ISFINITE
-dnl   add "-lm" to LIBS
-dnl
-AC_DEFUN([AX_CXX_HAVE_ISFINITE],
-  [ax_cxx_have_isfinite_save_LIBS=$LIBS
-   LIBS="$LIBS -lm"
-
-   AC_CACHE_CHECK(for isfinite, ax_cv_cxx_have_isfinite,
-    [AC_LANG_SAVE
-     AC_LANG_CPLUSPLUS
-     AC_LINK_IFELSE(
-       [AC_LANG_PROGRAM(
-         [[#include <math.h>]],
-         [[int f = isfinite( 3 );]])],
-       [ax_cv_cxx_have_isfinite=yes],
-       [ax_cv_cxx_have_isfinite=no])
-     AC_LANG_RESTORE])
-
-   if test "$ax_cv_cxx_have_isfinite" = yes; then
-     AC_DEFINE([HAVE_ISFINITE],1,[define if compiler has isfinite])
-   else
-     LIBS=$ax_cxx_have_isfinite_save_LIBS
-   fi
-])


More information about the Libreoffice-commits mailing list