From 329e7a9be67c15936488ef37739df065a4b81bf7 Mon Sep 17 00:00:00 2001 From: Charles Karney Date: Wed, 18 Sep 2019 13:27:06 -0400 Subject: Get rid of dead code. The end result of this chain of commits is to eliminate most of math.cpp. All that is left is the handling of isnan (and I've this because math.cpp notes that gie.c uses pj_isnan). geodesic.c now handles supplying C99 math functions internally and this can go away once C99 support is mandated. --- CMakeLists.txt | 8 +++----- configure.ac | 8 +++----- src/geodesic.c | 17 +---------------- 3 files changed, 7 insertions(+), 26 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 55722f91..5b8459b6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -139,11 +139,9 @@ check_c_source_compiles(" #include int main() { int q; - return (int)(hypot(3.0, 4.0) + log1p(2.0) + asinh(10.0) + - atanh(0.8) + cbrt(8.0) + remquo(100.0, 90.0, &q) + - remainder(100.0, 90.0) + copysign(1.0, -0.0) + - round(3.5)) + - (int)(lround(-3.5)) + isnan(0.0); + return (int)(hypot(3.0, 4.0) + atanh(0.8) + copysign(1.0, -0.0) + + cbrt(8.0) + remainder(100.0, 90.0) + + remquo(100.0, 90.0, &q)) + isnan(0.0); } " C99_MATH) if(C99_MATH) diff --git a/configure.ac b/configure.ac index 76e45bc0..4db47b26 100644 --- a/configure.ac +++ b/configure.ac @@ -204,11 +204,9 @@ AC_MSG_CHECKING([for C99 math functions]) AC_LINK_IFELSE([AC_LANG_PROGRAM( [#include ], [int q; - return (int)(hypot(3.0, 4.0) + log1p(2.0) + asinh(10.0) + - atanh(0.8) + cbrt(8.0) + remquo(100.0, 90.0, &q) + - remainder(100.0, 90.0) + copysign(1.0, -0.0) + - round(3.5)) + - (int)(lround(-3.5)) + isnan(0.0);])], + return (int)(hypot(3.0, 4.0) + atanh(0.8) + copysign(1.0, -0.0) + + cbrt(8.0) + remainder(100.0, 90.0) + + remquo(100.0, 90.0, &q)) + isnan(0.0);])], [AC_MSG_RESULT([yes]);C99_MATH="-DHAVE_C99_MATH=1"], [AC_MSG_RESULT([no]);C99_MATH="-DHAVE_C99_MATH=0"]) CFLAGS="$save_CFLAGS $C99_MATH" diff --git a/src/geodesic.c b/src/geodesic.c index beb841a0..49c9823e 100644 --- a/src/geodesic.c +++ b/src/geodesic.c @@ -23,23 +23,8 @@ * https://geographiclib.sourceforge.io/ */ -/* The PROJ_COMPILATION flag indicates that this is part of the compilation of - * the PROJ library (keyed off the presence of the PROJ_LIB macro which points - * to the data directory for PROJ). If this is set, we use the PROJ supplied - * implementations of the C99 math functions instead of the ones defined here. - */ -#if 0 && defined(PROJ_LIB) -#define PROJ_COMPILATION 1 -#else -#define PROJ_COMPILATION 0 -#endif - #include "geodesic.h" -#if PROJ_COMPILATION -#include "proj_math.h" -#else #include -#endif #if !defined(HAVE_C99_MATH) #define HAVE_C99_MATH 0 @@ -133,7 +118,7 @@ enum captype { }; static real sq(real x) { return x * x; } -#if HAVE_C99_MATH || PROJ_COMPILATION +#if HAVE_C99_MATH #define atanhx atanh #define copysignx copysign #define hypotx hypot -- cgit v1.2.3