1 From 066e28ccecb4bad5c0477606a138591f1da1963e Mon Sep 17 00:00:00 2001
2 From: Raffi Enficiaud <raffi.enficiaud@free.fr>
3 Date: Mon, 30 Jan 2017 22:09:12 +0100
4 Subject: [PATCH] Preventing the compilation of floating points with GCC when
7 - Gathering the support of FPE in one place/several macros and using those in both
8 execution_monitor.hpp and execution_monitor.ipp in a more coherent way
9 - Updating the support of the floating point exceptions: fenableexcept/fdisableexcept are
10 GLIBC extensions and the definition of FENV does not imply the existance of those functions
13 https://github.com/boostorg/test/commit/066e28ccecb4bad5c0477606a138591f1da1963e
15 [Adjust github patch to tarball release]
16 Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>
18 boost/test/execution_monitor.hpp | 17 +++++++++++++++--
19 boost/test/impl/execution_monitor.ipp | 21 +++++++--------------
20 2 files changed, 22 insertions(+), 16 deletions(-)
22 diff --git a/boost/test/execution_monitor.hpp b/boost/test/execution_monitor.hpp
23 index f53348a..12c5644 100644
24 --- a/boost/test/execution_monitor.hpp
25 +++ b/boost/test/execution_monitor.hpp
30 +#if defined(BOOST_SEH_BASED_SIGNAL_HANDLING) && !defined(UNDER_CE)
31 + //! Indicates tha the floating point exception handling is supported
33 + #define BOOST_TEST_FPE_SUPPORT_WITH_SEH__
34 +#elif !defined(BOOST_SEH_BASED_SIGNAL_HANDLING) && !defined(UNDER_CE)
35 + #if !defined(BOOST_NO_FENV_H) && !defined(BOOST_CLANG) && \
36 + (defined(__GLIBC__) && defined(__USE_GNU))
37 + //! Indicates that floating point exception handling is supported for the
38 + //! non SEH version of it, for the GLIBC extensions only
39 + #define BOOST_TEST_FPE_SUPPORT_WITH_GLIBC_EXTENSIONS__
44 // Additional macro documentations not being generated without this hack
45 #ifdef BOOST_TEST_DOXYGEN_DOC__
46 @@ -489,7 +502,7 @@ namespace fpe {
50 -#ifdef BOOST_SEH_BASED_SIGNAL_HANDLING /* *** */
51 +#if defined(BOOST_TEST_FPE_SUPPORT_WITH_SEH__) /* *** */
52 BOOST_FPE_DIVBYZERO = EM_ZERODIVIDE,
53 BOOST_FPE_INEXACT = EM_INEXACT,
54 BOOST_FPE_INVALID = EM_INVALID,
55 @@ -498,7 +511,7 @@ enum masks {
57 BOOST_FPE_ALL = MCW_EM,
59 -#elif defined(BOOST_NO_FENV_H) || defined(BOOST_CLANG) /* *** */
60 +#elif !defined(BOOST_TEST_FPE_SUPPORT_WITH_GLIBC_EXTENSIONS__)/* *** */
61 BOOST_FPE_ALL = BOOST_FPE_OFF,
64 diff --git a/boost/test/impl/execution_monitor.ipp b/boost/test/impl/execution_monitor.ipp
65 index 416004d..0c5690c 100644
66 --- a/boost/test/impl/execution_monitor.ipp
67 +++ b/boost/test/impl/execution_monitor.ipp
68 @@ -1354,11 +1354,7 @@ unsigned
69 enable( unsigned mask )
71 boost::ignore_unused(mask);
73 -#if defined(UNDER_CE)
74 - /* Not Implemented in Windows CE */
75 - return BOOST_FPE_OFF;
76 -#elif defined(BOOST_SEH_BASED_SIGNAL_HANDLING)
77 +#if defined(BOOST_TEST_FPE_SUPPORT_WITH_SEH__)
80 #if BOOST_WORKAROUND( BOOST_MSVC, <= 1310)
81 @@ -1373,9 +1369,10 @@ enable( unsigned mask )
82 if( ::_controlfp_s( 0, old_cw & ~mask, BOOST_FPE_ALL ) != 0 )
86 return ~old_cw & BOOST_FPE_ALL;
87 -#elif defined(__GLIBC__) && defined(__USE_GNU)
89 +#elif defined(BOOST_TEST_FPE_SUPPORT_WITH_GLIBC_EXTENSIONS__)
90 + // same macro definition as in execution_monitor.hpp
91 if (BOOST_FPE_ALL == BOOST_FPE_OFF)
94 @@ -1395,12 +1392,8 @@ disable( unsigned mask )
96 boost::ignore_unused(mask);
98 -#if defined(UNDER_CE)
99 - /* Not Implemented in Windows CE */
100 - return BOOST_FPE_INV;
101 -#elif defined(BOOST_SEH_BASED_SIGNAL_HANDLING)
102 +#if defined(BOOST_TEST_FPE_SUPPORT_WITH_SEH__)
105 #if BOOST_WORKAROUND( BOOST_MSVC, <= 1310)
106 unsigned old_cw = ::_controlfp( 0, 0 );
107 ::_controlfp( old_cw | mask, BOOST_FPE_ALL );
108 @@ -1413,9 +1406,9 @@ disable( unsigned mask )
109 if( ::_controlfp_s( 0, old_cw | mask, BOOST_FPE_ALL ) != 0 )
110 return BOOST_FPE_INV;
113 return ~old_cw & BOOST_FPE_ALL;
114 -#elif defined(__GLIBC__) && defined(__USE_GNU)
116 +#elif defined(BOOST_TEST_FPE_SUPPORT_WITH_GLIBC_EXTENSIONS__)
117 if (BOOST_FPE_ALL == BOOST_FPE_OFF)
118 /* Not Implemented */
119 return BOOST_FPE_INV;