bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

frexpl, ldexpl declarations


From: Bruno Haible
Subject: frexpl, ldexpl declarations
Date: Tue, 6 Mar 2007 04:43:45 +0100
User-agent: KMail/1.5.4

POSIX specifies [1] that <math.h> should declare frexpl() and ldexpl() but
neither glibc not MacOS X 10.3 do so. (Paul, do you agree that it looks like
a glibc bug?)

Here is a cheap workaround for the 'printf-frexpl' module.

2007-03-05  Bruno Haible  <address@hidden>

        * m4/printf-frexpl.m4 (gl_FUNC_PRINTF_FREXPL): Also test whether
        frexpl and ldexpl are declared.
        * lib/printf-frexp.c (frexpl, ldexpl): Provide fallback declarations.

*** m4/printf-frexpl.m4 3 Mar 2007 13:57:24 -0000       1.1
--- m4/printf-frexpl.m4 6 Mar 2007 03:31:34 -0000
***************
*** 1,4 ****
! # printf-frexpl.m4 serial 1
  dnl Copyright (C) 2007 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
--- 1,4 ----
! # printf-frexpl.m4 serial 2
  dnl Copyright (C) 2007 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
***************
*** 23,28 ****
--- 23,31 ----
      if test $gl_cv_func_frexpl_no_libm = yes; then
        AC_DEFINE([HAVE_FREXPL_IN_LIBC], 1,
          [Define if the frexpl function is available in libc.])
+       dnl Also check whether it's declared. glibc (2.3..2.5 at least) and
+       dnl MacOS X 10.3 have frexpl() in libc but don't declare it in <math.h>.
+       AC_CHECK_DECLS([frexpl])
      fi
  
      AC_CACHE_CHECK([whether ldexpl can be used without linking with libm],
***************
*** 38,43 ****
--- 41,49 ----
      if test $gl_cv_func_ldexpl_no_libm = yes; then
        AC_DEFINE([HAVE_LDEXPL_IN_LIBC], 1,
          [Define if the ldexpl function is available in libc.])
+       dnl Also check whether it's declared. glibc (2.3..2.5 at least) and
+       dnl MacOS X 10.3 have ldexpl() in libc but don't declare it in <math.h>.
+       AC_CHECK_DECLS([ldexpl])
      fi
    fi
  ])
*** lib/printf-frexp.c  25 Feb 2007 18:08:24 -0000      1.3
--- lib/printf-frexp.c  6 Mar 2007 03:31:34 -0000
***************
*** 41,46 ****
--- 41,54 ----
  #   define USE_FREXP_LDEXP
  #   define FREXP frexpl
  #   define LDEXP ldexpl
+     /* glibc (2.3..2.5 at least) and MacOS X 10.3 have frexpl and ldexpl in
+        libc, but don't declare them.  */
+ #   if !HAVE_DECL_FREXPL
+ extern long double frexpl (long double, int *);
+ #   endif
+ #   if !HAVE_DECL_LDEXPL
+ extern long double ldexpl (long double, int);
+ #   endif
  #  endif
  #  define L_(literal) literal##L
  # else


[1] http://www.opengroup.org/susv3/basedefs/math.h.html





reply via email to

[Prev in Thread] Current Thread [Next in Thread]