printf-frexpl: Simplify for platforms where 'long double' == 'double'.
authorBruno Haible <bruno@clisp.org>
Mon, 10 Oct 2011 15:17:26 +0000 (17:17 +0200)
committerBruno Haible <bruno@clisp.org>
Mon, 10 Oct 2011 15:17:26 +0000 (17:17 +0200)
* lib/printf-frexpl.c: Include <config.h>.
(printf_frexpl) [HAVE_SAME_LONG_DOUBLE_AS_DOUBLE]: New function.
* lib/printf-frexp.c [!USE_LONG_DOUBLE]: Don't include <config.h> 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
lib/printf-frexp.c
lib/printf-frexpl.c
m4/printf-frexpl.m4
modules/printf-frexpl

index 465f6ae..b9e401a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
 2011-10-10  Bruno Haible  <bruno@clisp.org>
 
+       printf-frexpl: Simplify for platforms where 'long double' == 'double'.
+       * lib/printf-frexpl.c: Include <config.h>.
+       (printf_frexpl) [HAVE_SAME_LONG_DOUBLE_AS_DOUBLE]: New function.
+       * lib/printf-frexp.c [!USE_LONG_DOUBLE]: Don't include <config.h> 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  <bruno@clisp.org>
+
        frexpl: Simplify for platforms where 'long double' == 'double'.
        * lib/frexpl.c: Include <config.h>.
        (frexpl) [HAVE_SAME_LONG_DOUBLE_AS_DOUBLE]: New function.
index 7f7e0ec..267081c 100644 (file)
@@ -14,7 +14,9 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include <config.h>
+#if ! defined USE_LONG_DOUBLE
+# include <config.h>
+#endif
 
 /* Specification.  */
 #ifdef USE_LONG_DOUBLE
index f19f321..2de6528 100644 (file)
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#define USE_LONG_DOUBLE
-#include "printf-frexp.c"
+#include <config.h>
+
+#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
index 9b698c9..e15628a 100644 (file)
@@ -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
index c23550e..c506a62 100644 (file)
@@ -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