From db9e538477da947df9212b77ac3c2991af750a8f Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Mon, 10 Oct 2011 17:17:26 +0200 Subject: [PATCH] printf-frexpl: Simplify for platforms where 'long double' == 'double'. * lib/printf-frexpl.c: Include . (printf_frexpl) [HAVE_SAME_LONG_DOUBLE_AS_DOUBLE]: New function. * lib/printf-frexp.c [!USE_LONG_DOUBLE]: Don't include a second time. * m4/printf-frexpl.m4 (gl_FUNC_PRINTF_FREXPL): Require gl_LONG_DOUBLE_VS_DOUBLE. * modules/printf-frexpl (Depends-on): Add printf-frexp. Update conditions. --- ChangeLog | 12 ++++++++++++ lib/printf-frexp.c | 4 +++- lib/printf-frexpl.c | 23 +++++++++++++++++++++-- m4/printf-frexpl.m4 | 4 +++- modules/printf-frexpl | 7 ++++--- 5 files changed, 43 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 465f6ae0e..b9e401ac4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,17 @@ 2011-10-10 Bruno Haible + printf-frexpl: Simplify for platforms where 'long double' == 'double'. + * lib/printf-frexpl.c: Include . + (printf_frexpl) [HAVE_SAME_LONG_DOUBLE_AS_DOUBLE]: New function. + * lib/printf-frexp.c [!USE_LONG_DOUBLE]: Don't include a + second time. + * m4/printf-frexpl.m4 (gl_FUNC_PRINTF_FREXPL): Require + gl_LONG_DOUBLE_VS_DOUBLE. + * modules/printf-frexpl (Depends-on): Add printf-frexp. Update + conditions. + +2011-10-10 Bruno Haible + frexpl: Simplify for platforms where 'long double' == 'double'. * lib/frexpl.c: Include . (frexpl) [HAVE_SAME_LONG_DOUBLE_AS_DOUBLE]: New function. diff --git a/lib/printf-frexp.c b/lib/printf-frexp.c index 7f7e0ecde..267081cec 100644 --- a/lib/printf-frexp.c +++ b/lib/printf-frexp.c @@ -14,7 +14,9 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include +#if ! defined USE_LONG_DOUBLE +# include +#endif /* Specification. */ #ifdef USE_LONG_DOUBLE diff --git a/lib/printf-frexpl.c b/lib/printf-frexpl.c index f19f32168..2de6528bc 100644 --- a/lib/printf-frexpl.c +++ b/lib/printf-frexpl.c @@ -14,5 +14,24 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#define USE_LONG_DOUBLE -#include "printf-frexp.c" +#include + +#if HAVE_SAME_LONG_DOUBLE_AS_DOUBLE + +/* Specification. */ +# include "printf-frexpl.h" + +# include "printf-frexp.h" + +long double +printf_frexpl (long double x, int *expptr) +{ + return printf_frexp (x, expptr); +} + +#else + +# define USE_LONG_DOUBLE +# include "printf-frexp.c" + +#endif diff --git a/m4/printf-frexpl.m4 b/m4/printf-frexpl.m4 index 9b698c9be..e15628aa8 100644 --- a/m4/printf-frexpl.m4 +++ b/m4/printf-frexpl.m4 @@ -1,4 +1,4 @@ -# printf-frexpl.m4 serial 8 +# printf-frexpl.m4 serial 9 dnl Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -9,6 +9,8 @@ dnl Check how to define printf_frexpl() without linking with libm. AC_DEFUN([gl_FUNC_PRINTF_FREXPL], [ AC_REQUIRE([gl_MATH_H_DEFAULTS]) + AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE]) + dnl Subset of gl_FUNC_FREXPL_NO_LIBM. gl_CHECK_FREXPL_NO_LIBM if test $gl_cv_func_frexpl_no_libm = yes; then diff --git a/modules/printf-frexpl b/modules/printf-frexpl index c23550e1b..c506a6266 100644 --- a/modules/printf-frexpl +++ b/modules/printf-frexpl @@ -11,9 +11,10 @@ m4/frexpl.m4 m4/ldexpl.m4 Depends-on: -float -math -fpucw +printf-frexp [test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1] +float [test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 0] +math [test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 0] +fpucw [test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 0] configure.ac: gl_FUNC_PRINTF_FREXPL -- 2.11.0