From 17688c4487cbc5296bb4da4ca7e78092307d2bbd Mon Sep 17 00:00:00 2001 From: Ed Schouten Date: Fri, 9 Jan 2015 13:00:48 +0100 Subject: [PATCH] Rename include/fenv.h to . OpenLibm has an implementation of fenv.h internally. This may be problematic in case you want it to build against the host system's implementation, as it would require you to somehow take the fenv.h file out of the compiler search path. Simply use a different naming scheme, similar to openlibm.h and openlibm_complex.h. If we want to build against the host's fenv.h, we can simply add an '#include ' from within this header. --- amd64/fenv.c | 2 +- amd64/fenv.h | 6 ++++-- arm/fenv.c | 2 +- i387/fenv.c | 2 +- include/fenv.h | 9 --------- src/e_sqrtl.c | 2 +- src/openlibm_fenv.h | 9 +++++++++ src/s_fma.c | 2 +- src/s_fmaf.c | 3 +-- src/s_fmal.c | 2 +- src/s_lrint.c | 2 +- src/s_lround.c | 2 +- src/s_nearbyint.c | 2 +- test/libm-test.c | 2 +- 14 files changed, 24 insertions(+), 23 deletions(-) delete mode 100644 include/fenv.h create mode 100644 src/openlibm_fenv.h diff --git a/amd64/fenv.c b/amd64/fenv.c index ecd0ab2..b06c899 100644 --- a/amd64/fenv.c +++ b/amd64/fenv.c @@ -32,7 +32,7 @@ #ifdef _WIN32 #define __fenv_static #endif -#include "fenv.h" +#include "openlibm_fenv.h" #ifdef __GNUC_GNU_INLINE__ #error "This file must be compiled with C99 'inline' semantics" diff --git a/amd64/fenv.h b/amd64/fenv.h index b7e7610..df3ceab 100644 --- a/amd64/fenv.h +++ b/amd64/fenv.h @@ -29,8 +29,10 @@ #ifndef _FENV_H_ #define _FENV_H_ -#include "include/cdefs-compat.h" -#include "include/types-compat.h" +#include "cdefs-compat.h" +#include "types-compat.h" + +#include "math_private.h" #ifndef __fenv_static #define __fenv_static static diff --git a/arm/fenv.c b/arm/fenv.c index bf6b1f9..c9abf14 100644 --- a/arm/fenv.c +++ b/arm/fenv.c @@ -27,7 +27,7 @@ */ #define __fenv_static -#include "fenv.h" +#include #ifdef __GNUC_GNU_INLINE__ #error "This file must be compiled with C99 'inline' semantics" diff --git a/i387/fenv.c b/i387/fenv.c index b0a8497..5ad4de6 100644 --- a/i387/fenv.c +++ b/i387/fenv.c @@ -32,7 +32,7 @@ #include #define __fenv_static -#include "fenv.h" +#include #ifdef __GNUC_GNU_INLINE__ #error "This file must be compiled with C99 'inline' semantics" diff --git a/include/fenv.h b/include/fenv.h deleted file mode 100644 index cfe40b9..0000000 --- a/include/fenv.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifdef __arm__ -#include "../arm/fenv.h" -#else -#ifdef __LP64 -#include "../amd64/fenv.h" -#else -#include "../i387/fenv.h" -#endif -#endif diff --git a/src/e_sqrtl.c b/src/e_sqrtl.c index 7b2ea83..80f3d61 100644 --- a/src/e_sqrtl.c +++ b/src/e_sqrtl.c @@ -27,11 +27,11 @@ #include "cdefs-compat.h" //__FBSDID("$FreeBSD: src/lib/msun/src/e_sqrtl.c,v 1.1 2008/03/02 01:47:58 das Exp $"); -#include #include #include "fpmath.h" #include "openlibm.h" +#include "openlibm_fenv.h" #include "math_private.h" /* Return (x + ulp) for normal positive x. Assumes no overflow. */ diff --git a/src/openlibm_fenv.h b/src/openlibm_fenv.h new file mode 100644 index 0000000..69ccf9f --- /dev/null +++ b/src/openlibm_fenv.h @@ -0,0 +1,9 @@ +#if defined(__arm__) +#include "../arm/fenv.h" +#elif defined(__x86_64__) +#include "../amd64/fenv.h" +#elif defined(__i386__) +#include "../i387/fenv.h" +#else +#error "Unsupported platform" +#endif diff --git a/src/s_fma.c b/src/s_fma.c index 1c93f55..7fa8ba3 100644 --- a/src/s_fma.c +++ b/src/s_fma.c @@ -27,9 +27,9 @@ #include "cdefs-compat.h" //__FBSDID("$FreeBSD: src/lib/msun/src/s_fma.c,v 1.8 2011/10/21 06:30:43 das Exp $"); -#include #include #include +#include #include "math_private.h" diff --git a/src/s_fmaf.c b/src/s_fmaf.c index da0e019..b697f9a 100644 --- a/src/s_fmaf.c +++ b/src/s_fmaf.c @@ -27,9 +27,8 @@ #include "cdefs-compat.h" //__FBSDID("$FreeBSD: src/lib/msun/src/s_fmaf.c,v 1.3 2011/10/15 04:16:58 das Exp $"); -#include - #include "openlibm.h" +#include "openlibm_fenv.h" #include "math_private.h" /* diff --git a/src/s_fmal.c b/src/s_fmal.c index 1d6b6b8..1aa7ab3 100644 --- a/src/s_fmal.c +++ b/src/s_fmal.c @@ -27,9 +27,9 @@ #include "cdefs-compat.h" //__FBSDID("$FreeBSD: src/lib/msun/src/s_fmal.c,v 1.7 2011/10/21 06:30:43 das Exp $"); -#include #include #include +#include #include "math_private.h" #include "fpmath.h" diff --git a/src/s_lrint.c b/src/s_lrint.c index ff7bce7..9ecb558 100644 --- a/src/s_lrint.c +++ b/src/s_lrint.c @@ -25,8 +25,8 @@ */ #include "cdefs-compat.h" -#include #include +#include #include "math_private.h" #ifndef type diff --git a/src/s_lround.c b/src/s_lround.c index f89d031..37068fe 100644 --- a/src/s_lround.c +++ b/src/s_lround.c @@ -29,8 +29,8 @@ //#include #include //VBS end -#include #include +#include #include "math_private.h" #ifndef type diff --git a/src/s_nearbyint.c b/src/s_nearbyint.c index 6de1d77..f0fc19f 100644 --- a/src/s_nearbyint.c +++ b/src/s_nearbyint.c @@ -27,8 +27,8 @@ #include "cdefs-compat.h" //__FBSDID("$FreeBSD: src/lib/msun/src/s_nearbyint.c,v 1.2 2008/01/14 02:12:06 das Exp $"); -#include #include +#include #include "math_private.h" /* diff --git a/test/libm-test.c b/test/libm-test.c index be01255..ebd7eb4 100644 --- a/test/libm-test.c +++ b/test/libm-test.c @@ -123,8 +123,8 @@ #include #else #include "openlibm.h" +#include "openlibm_fenv.h" #include "float.h" -#include "fenv.h" #endif #if 0 /* XXX scp XXX */