python-dataproperty: bump version to 0.17.0
[buildroot-gz.git] / package / boost / 0005-fix-test-of-fpe-support.patch
blob4d8f827e5fd297d69ca02cb5e5ba84c98ccb5724
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
5 glibc is not in use
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
12 Fetch from:
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>
17 ---
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
26 @@ -66,6 +66,19 @@
28 #endif
30 +#if defined(BOOST_SEH_BASED_SIGNAL_HANDLING) && !defined(UNDER_CE)
31 + //! Indicates tha the floating point exception handling is supported
32 + //! through SEH
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__
40 + #endif
41 +#endif
44 // Additional macro documentations not being generated without this hack
45 #ifdef BOOST_TEST_DOXYGEN_DOC__
46 @@ -489,7 +502,7 @@ namespace fpe {
47 enum masks {
48 BOOST_FPE_OFF = 0,
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,
63 #else /* *** */
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__)
78 _clearfp();
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 )
83 return BOOST_FPE_INV;
84 #endif
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)
92 /* Not Implemented */
93 return 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__)
103 _clearfp();
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;
111 #endif
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;