Ticket #11756: 0001-config-BOOST_NO_FENV_H.patch

File 0001-config-BOOST_NO_FENV_H.patch, 3.6 KB (added by André Draszik <git@…>, 6 years ago)

gcc: #define BOOST_NO_FENV_H on FPU-less arches

  • boost/config/compiler/gcc.hpp

    From c97b70d96b63ec116a486e3b599dd505d13f5478 Mon Sep 17 00:00:00 2001
    From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <adraszik@tycoint.com>
    Date: Mon, 29 Aug 2016 10:51:07 +0100
    Subject: [PATCH] gcc: #define BOOST_NO_FENV_H on FPU-less arches
    
    gcc.compile.c++ <builddir>/boost/bin.v2/libs/test/build/gcc-4.3.1/release/threading-multi/execution_monitor.o
    
        "mipsel-poky-linux-musl-g++" "-mel" "-mabi=32" "-msoft-float" "-march=mips32r2" "-mips16" "-minterlink-compressed" "-mtune=24kec" "-mdsp" "-Wl,-O1" "-Wl,--as-needed" "-fstack-protector-strong" "-Wl,-z,relro,-z,now" "--sysroot=<sysroot>"  -ftemplate-depth-128 -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=<srcdir>=/usr/src/debug/boost/1.61.0-r0 -fdebug-prefix-map=<sysroot_host>= -fdebug-prefix-map=<sysroot>= -fstack-protector-strong -pie -fpie -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security -fvisibility-inlines-hidden -O3 -finline-functions -Wno-inline -Wall -pedantic -pthread -fPIC -Wno-variadic-macros -DBOOST_ALL_NO_LIB=1 -DBOOST_CHRONO_DYN_LINK=1 -DBOOST_SYSTEM_DYN_LINK=1 -DBOOST_SYSTEM_NO_DEPRECATED -DBOOST_TEST_DYN_LINK=1 -DBOOST_TIMER_DYN_LINK=1 -DNDEBUG  -I"." -c -o "<builddir>/boost/bin.v2/libs/test/build/gcc-4.3.1/release/threading-multi/execution_monitor.o" "libs/test/src/execution_monitor.cpp"
    
    In file included from ./boost/test/impl/execution_monitor.ipp:31:0,
                     from libs/test/src/execution_monitor.cpp:16:
    ./boost/test/execution_monitor.hpp:491:27: error: 'FE_DIVBYZERO' was not declared in this scope
         BOOST_FPE_DIVBYZERO = FE_DIVBYZERO,
                               ^~~~~~~~~~~~
    ./boost/test/execution_monitor.hpp:492:27: error: 'FE_INEXACT' was not declared in this scope
         BOOST_FPE_INEXACT   = FE_INEXACT,
                               ^~~~~~~~~~
    ./boost/test/execution_monitor.hpp:493:27: error: 'FE_INVALID' was not declared in this scope
         BOOST_FPE_INVALID   = FE_INVALID,
                               ^~~~~~~~~~
    ./boost/test/execution_monitor.hpp:494:27: error: 'FE_OVERFLOW' was not declared in this scope
         BOOST_FPE_OVERFLOW  = FE_OVERFLOW,
                               ^~~~~~~~~~~
    ./boost/test/execution_monitor.hpp:495:27: error: 'FE_UNDERFLOW' was not declared in this scope
         BOOST_FPE_UNDERFLOW = FE_UNDERFLOW,
                               ^~~~~~~~~~~~
    
    The reason is that some (notably FPU-less) architectures,
    including mips*-nf, don't define/implement some of the
    floating point constants, even though fenv.h is
    available.
    
    At least on MIPS, while FE_ALL_EXCEPT is #define'd, its
    value is 0.
    
    A similar problem exists on FPU-less ARM machines.
    
      https://svn.boost.org/trac/boost/ticket/11756
    
    Other projects have similar issues, e.g. pixman, and
    apply similar work-arounds:
      https://lists.freedesktop.org/archives/pixman/2014-February/003172.html
    
    Signed-off-by: André Draszik <adraszik@tycoint.com>
    ---
     boost/config/compiler/gcc.hpp | 18 ++++++++++++++++++
     1 file changed, 18 insertions(+)
    
    diff --git a/boost/config/compiler/gcc.hpp b/boost/config/compiler/gcc.hpp
    index fbd3dd9..7c4fd06 100644
    a b  
    262262#  define BOOST_NO_CXX14_BINARY_LITERALS
    263263#endif
    264264
     265// C++11 floating-point environment
     266#if !defined(BOOST_NO_FENV_H)
     267   // Some (notably FPU-less) architectures,
     268   // including mips*-nf, don't define/implement some of
     269   // the floating point constants, even though fenv.h
     270   // is available.
     271#  include <bits/fenv.h>
     272#  if !defined(FE_ALL_EXCEPT) || (FE_ALL_EXCEPT == 0)
     273#    define BOOST_NO_FENV_H
     274#  endif
     275#endif
     276
    265277// C++14 features in 4.9.0 and later
    266278//
    267279#if (BOOST_GCC_VERSION < 40900) || (__cplusplus < 201300)