changeset 15933:6860d9f2e394

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.
author Bruno Haible <bruno@clisp.org>
date Mon, 10 Oct 2011 17:17:26 +0200
parents 0057ae480fc5
children 7107ea7879b2
files ChangeLog lib/printf-frexp.c lib/printf-frexpl.c m4/printf-frexpl.m4 modules/printf-frexpl
diffstat 5 files changed, 43 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+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'.
--- 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 <http://www.gnu.org/licenses/>.  */
 
-#include <config.h>
+#if ! defined USE_LONG_DOUBLE
+# include <config.h>
+#endif
 
 /* Specification.  */
 #ifdef USE_LONG_DOUBLE
--- 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 <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
--- 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 @@
 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
--- a/modules/printf-frexpl
+++ b/modules/printf-frexpl
@@ -11,9 +11,10 @@
 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