bug-gnulib
[Top][All Lists]
Advanced

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

new module 'strtold'


From: Bruno Haible
Subject: new module 'strtold'
Date: Wed, 30 Jan 2019 04:05:49 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-141-generic; KDE/5.18.0; x86_64; ; )

Hi,

coreutils has recently started to use strtold() [1]. This causes compilation
errors on Android 4.3:

  CC       lib/cl-strtod.o
  CC       lib/cl-strtold.o
In file included from ../lib/cl-strtold.c:2:
../lib/cl-strtod.c: In function 'cl_strtold':
../lib/cl-strtod.c:62: warning: implicit declaration of function 'strtold'

  CCLD     src/printf
lib/libcoreutils.a(cl-strtold.o): In function `cl_strtold':
cl-strtold.c:(.text+0x14): undefined reference to `strtold'
collect2: ld returned 1 exit status
make[2]: *** [src/printf] Error 1

  CCLD     src/seq
lib/libcoreutils.a(cl-strtold.o): In function `cl_strtold':
cl-strtold.c:(.text+0x14): undefined reference to `strtold'
collect2: ld returned 1 exit status
make[2]: *** [src/seq] Error 1

and similarly on Solaris 9 (both lack the strtold() function)
and on HP-UX 11/hppa (where the function is declared to return a struct,
not a 'long double').

And of course the function is not POSIX compliant on some platforms.

Here comes a new gnulib module 'strtold'. Tested on

- a glibc 2.3.2 system (Fedora 1)
- Mac OS X 10.5, Mac OS X 10.4/PowerPC
- FreeBSD 11.0
- NetBSD 7.1
- OpenBSD 6.0
- Minix 3.3
- AIX 7.1
- HP-UX 11.31/hppa
- HP-UX 11.31/ia64 (test failure in line 574, also in test-strtod.c:574)
- IRIX 6.5
- Solaris 9/SPARC, Solaris 10/SPARC, Solaris 10/x86
- Cygwin
- mingw
- Haiku
- Android 4.3

Bruno

[1] 
https://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=eb73e23f31f4ce363b1505cc77424832d5c39063


2019-01-29  Bruno Haible  <address@hidden>

        strtold: New module.
        * lib/stdlib.in.h (strtold): New declaration.
        * lib/strtold.c: New file.
        * lib/strtod.c: Consider USE_LONG_DOUBLE.
        (STRTOD, LDEXP, HAVE_UNDERLYING_STRTOD, DOUBLE, MIN, MAX, L_,
        USE_LDEXP): New macros.
        (LDEXP, scale_radix_exp, parse_number, STRTOD): Adapt for
        USE_LONG_DOUBLE.
        (underlying_strtod): Remove function. Replace with some macros.
        Re-add the code for a missing underlying function that was removed on
        2013-02-19.
        * m4/strtold.m4: New file.
        * m4/stdlib_h.m4 (gl_STDLIB_H): Test whether strtold is declared.
        (gl_STDLIB_H_DEFAULTS): Initialize GNULIB_STRTOLD, HAVE_STRTOLD,
        REPLACE_STRTOLD.
        * modules/stdlib (Makefile.am): Substitute GNULIB_STRTOLD, HAVE_STRTOLD,
        REPLACE_STRTOLD.
        * modules/strtold: New file.
        * doc/posix-functions/strtold.texi: Document the new module.

2019-01-29  Bruno Haible  <address@hidden>

        strtold: Add tests.
        * tests/test-strtold.c: New file, based on tests/test-strtod.c.
        * modules/strtold-tests: New file.

Attachment: 0001-strtold-New-module.patch
Description: Text Data

Attachment: 0002-strtold-Add-tests.patch
Description: Text Data


reply via email to

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