From: Bruno Haible Date: Mon, 24 Jun 2024 18:02:46 +0000 (+0200) Subject: doc: Update info about *printf. X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=6dcd0911bff6a4695149ac9c733f46758504fb7c;p=gnulib.git doc: Update info about *printf. * doc/*-functions/*printf.texi: Update info regarding %a directive. * m4/printf.m4 (gl_PRINTF_DIRECTIVE_A): Likewise. Improve bits assignment in return value. --- diff --git a/ChangeLog b/ChangeLog index 631a15c7dc..04adbdc9a3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2024-06-24 Bruno Haible + + doc: Update info about *printf. + * doc/*-functions/*printf.texi: Update info regarding %a directive. + * m4/printf.m4 (gl_PRINTF_DIRECTIVE_A): Likewise. Improve bits + assignment in return value. + 2024-06-24 Bruno Haible doc: Update info about obstack_*printf. diff --git a/doc/glibc-functions/asprintf.texi b/doc/glibc-functions/asprintf.texi index ffbf3bd0a9..be7cd28546 100644 --- a/doc/glibc-functions/asprintf.texi +++ b/doc/glibc-functions/asprintf.texi @@ -39,7 +39,7 @@ Solaris 11.0. @item This function does not support the @samp{a} and @samp{A} directives on some platforms: -glibc-2.3.6, Mac OS X 10.5, NetBSD 10.0, OpenBSD 4.0, Solaris 11.4, Cygwin 1.5.x. +FreeBSD 5.2.1, OpenBSD 4.0, Solaris 11.4, Cygwin 1.5.x. @item This function does not support the @samp{b} directive, required by ISO C23, on some platforms: @@ -65,7 +65,7 @@ NetBSD 3.0, Cygwin 1.5.24. @item This function does not round the argument of the @samp{a} directive correctly on some platforms: -macOS 14, FreeBSD 14.0. +macOS 14, FreeBSD 14.0, NetBSD 10.0, OpenBSD 7.5, AIX 7.3, Solaris 11.4. @item printf @code{"%010f"} of NaN and Infinity yields an incorrect result (padded with zeroes) on some platforms: diff --git a/doc/glibc-functions/obstack_printf.texi b/doc/glibc-functions/obstack_printf.texi index 01d0508064..c205047e65 100644 --- a/doc/glibc-functions/obstack_printf.texi +++ b/doc/glibc-functions/obstack_printf.texi @@ -36,7 +36,7 @@ AIX 5.2, Solaris 11.0, mingw, MSVC 14. @item This function does not support the @samp{a} and @samp{A} directives on some platforms: -glibc-2.3.6, NetBSD 10.0, OpenBSD 4.0, AIX 5.2, HP-UX 11, +FreeBSD 5.2.1, OpenBSD 4.0, AIX 5.2, HP-UX 11, Solaris 11.4, Cygwin 1.5.x, mingw, MSVC 14. @item This function does not support the @samp{b} directive, required by ISO C23, @@ -64,7 +64,7 @@ NetBSD 3.0, Cygwin 1.5.24, mingw, MSVC 14. @item This function does not round the argument of the @samp{a} directive correctly on some platforms: -Mac OS X 10.12, FreeBSD 6.1. +macOS 14, FreeBSD 14.0, NetBSD 10.0, OpenBSD 7.5, AIX 7.3, Solaris 11.4. @item printf @code{"%010f"} of NaN and Infinity yields an incorrect result (padded with zeroes) on some platforms: diff --git a/doc/glibc-functions/obstack_vprintf.texi b/doc/glibc-functions/obstack_vprintf.texi index 4ef55504e9..e7703863d3 100644 --- a/doc/glibc-functions/obstack_vprintf.texi +++ b/doc/glibc-functions/obstack_vprintf.texi @@ -36,7 +36,7 @@ AIX 5.2, Solaris 11.0, mingw, MSVC 14. @item This function does not support the @samp{a} and @samp{A} directives on some platforms: -glibc-2.3.6, NetBSD 10.0, OpenBSD 4.0, AIX 5.2, HP-UX 11, +FreeBSD 5.2.1, OpenBSD 4.0, AIX 5.2, HP-UX 11, Solaris 11.4, Cygwin 1.5.x, mingw, MSVC 14. @item This function does not support the @samp{b} directive, required by ISO C23, @@ -64,7 +64,7 @@ NetBSD 3.0, Cygwin 1.5.24, mingw, MSVC 14. @item This function does not round the argument of the @samp{a} directive correctly on some platforms: -Mac OS X 10.12, FreeBSD 6.1. +macOS 14, FreeBSD 14.0, NetBSD 10.0, OpenBSD 7.5, AIX 7.3, Solaris 11.4. @item printf @code{"%010f"} of NaN and Infinity yields an incorrect result (padded with zeroes) on some platforms: diff --git a/doc/glibc-functions/vasprintf.texi b/doc/glibc-functions/vasprintf.texi index 50e4f11ca1..4d53e3e407 100644 --- a/doc/glibc-functions/vasprintf.texi +++ b/doc/glibc-functions/vasprintf.texi @@ -39,7 +39,7 @@ Solaris 11.0. @item This function does not support the @samp{a} and @samp{A} directives on some platforms: -glibc-2.3.6, Mac OS X 10.5, NetBSD 10.0, OpenBSD 4.0, Solaris 11.4, Cygwin 1.5.x. +FreeBSD 5.2.1, OpenBSD 4.0, Solaris 11.4, Cygwin 1.5.x. @item This function does not support the @samp{b} directive, required by ISO C23, on some platforms: @@ -65,7 +65,7 @@ NetBSD 3.0, Cygwin 1.5.24. @item This function does not round the argument of the @samp{a} directive correctly on some platforms: -macOS 14, FreeBSD 14.0. +macOS 14, FreeBSD 14.0, NetBSD 10.0, OpenBSD 7.5, AIX 7.3, Solaris 11.4. @item printf @code{"%010f"} of NaN and Infinity yields an incorrect result (padded with zeroes) on some platforms: diff --git a/doc/posix-functions/dprintf.texi b/doc/posix-functions/dprintf.texi index 4694ab0901..b19057fbe3 100644 --- a/doc/posix-functions/dprintf.texi +++ b/doc/posix-functions/dprintf.texi @@ -28,7 +28,7 @@ Solaris 11.4. @item This function does not support the @samp{a} and @samp{A} directives on some platforms: -glibc-2.3.6, Solaris 11.4. +Solaris 11.4. @item This function does not support the @samp{b} directive, required by ISO C23, on some platforms: @@ -39,6 +39,10 @@ This function does not support precisions in the @samp{ls} directive correctly on some platforms: Solaris 11.4. @item +This function does not round the argument of the @samp{a} directive correctly +on some platforms: +macOS 14, FreeBSD 14.0, NetBSD 10.0, OpenBSD 7.5, AIX 7.3, Solaris 11.4. +@item printf @code{"%010f"} of NaN and Infinity yields an incorrect result (padded with zeroes, or wrong capitalization) on some platforms: Solaris 11.4. diff --git a/doc/posix-functions/fprintf.texi b/doc/posix-functions/fprintf.texi index fa3f331250..36fafeea2f 100644 --- a/doc/posix-functions/fprintf.texi +++ b/doc/posix-functions/fprintf.texi @@ -28,7 +28,7 @@ AIX 5.2, Solaris 11.4, mingw, MSVC 14. @item This function does not support the @samp{a} and @samp{A} directives on some platforms: -glibc-2.3.6, Mac OS X 10.5, NetBSD 10.0, OpenBSD 4.0, AIX 5.2, HP-UX 11, +FreeBSD 5.2.1, OpenBSD 4.0, AIX 5.2, HP-UX 11, Solaris 11.4, Cygwin 1.5.x, mingw, MSVC 14. @item This function does not support the @samp{b} directive, required by ISO C23, @@ -56,7 +56,7 @@ NetBSD 3.0, Cygwin 1.5.24, mingw, MSVC 14. @item This function does not round the argument of the @samp{a} directive correctly on some platforms: -macOS 14, FreeBSD 14.0. +macOS 14, FreeBSD 14.0, NetBSD 10.0, OpenBSD 7.5, AIX 7.3, Solaris 11.4. @item printf @code{"%010f"} of NaN and Infinity yields an incorrect result (padded with zeroes, or wrong capitalization) on some platforms: diff --git a/doc/posix-functions/printf.texi b/doc/posix-functions/printf.texi index d77e48fcc3..55d4291a58 100644 --- a/doc/posix-functions/printf.texi +++ b/doc/posix-functions/printf.texi @@ -28,7 +28,7 @@ AIX 5.2, Solaris 11.4, mingw, MSVC 14. @item This function does not support the @samp{a} and @samp{A} directives on some platforms: -glibc-2.3.6, Mac OS X 10.5, NetBSD 10.0, OpenBSD 4.0, AIX 5.2, HP-UX 11, +FreeBSD 5.2.1, OpenBSD 4.0, AIX 5.2, HP-UX 11, Solaris 11.4, Cygwin 1.5.x, mingw, MSVC 14. @item This function does not support the @samp{b} directive, required by ISO C23, @@ -56,7 +56,7 @@ NetBSD 3.0, Cygwin 1.5.24, mingw, MSVC 14. @item This function does not round the argument of the @samp{a} directive correctly on some platforms: -macOS 14, FreeBSD 14.0. +macOS 14, FreeBSD 14.0, NetBSD 10.0, OpenBSD 7.5, AIX 7.3, Solaris 11.4. @item printf @code{"%010f"} of NaN and Infinity yields an incorrect result (padded with zeroes, or wrong capitalization) on some platforms: diff --git a/doc/posix-functions/snprintf.texi b/doc/posix-functions/snprintf.texi index 7e77f2ddf2..c954261289 100644 --- a/doc/posix-functions/snprintf.texi +++ b/doc/posix-functions/snprintf.texi @@ -43,7 +43,7 @@ AIX 5.2, Solaris 11.4, mingw, MSVC 14. @item This function does not support the @samp{a} and @samp{A} directives on some platforms: -glibc-2.3.6, Mac OS X 10.5, NetBSD 10.0, OpenBSD 4.0, AIX 5.2, HP-UX 11, +FreeBSD 5.2.1, OpenBSD 4.0, AIX 5.2, HP-UX 11, Solaris 11.4, Cygwin 1.5.x, mingw, MSVC 14. @item This function does not support the @samp{b} directive, required by ISO C23, @@ -67,7 +67,7 @@ NetBSD 3.0, Cygwin 1.5.24, mingw, MSVC 14. @item This function does not round the argument of the @samp{a} directive correctly on some platforms: -macOS 14, FreeBSD 14.0. +macOS 14, FreeBSD 14.0, NetBSD 10.0, OpenBSD 7.5, AIX 7.3, Solaris 11.4. @item printf @code{"%010f"} of NaN and Infinity yields an incorrect result (padded with zeroes, or wrong capitalization) on some platforms: diff --git a/doc/posix-functions/sprintf.texi b/doc/posix-functions/sprintf.texi index d729bf63a1..05bfccb771 100644 --- a/doc/posix-functions/sprintf.texi +++ b/doc/posix-functions/sprintf.texi @@ -28,7 +28,7 @@ AIX 5.2, Solaris 11.4, mingw, MSVC 14. @item This function does not support the @samp{a} and @samp{A} directives on some platforms: -glibc-2.3.6, Mac OS X 10.5, NetBSD 10.0, OpenBSD 4.0, AIX 5.2, HP-UX 11, +FreeBSD 5.2.1, OpenBSD 4.0, AIX 5.2, HP-UX 11, Solaris 11.4, Cygwin 1.5.x, mingw, MSVC 14. @item This function does not support the @samp{b} directive, required by ISO C23, @@ -56,7 +56,7 @@ NetBSD 3.0, Cygwin 1.5.24, mingw, MSVC 14. @item This function does not round the argument of the @samp{a} directive correctly on some platforms: -macOS 14, FreeBSD 14.0. +macOS 14, FreeBSD 14.0, NetBSD 10.0, OpenBSD 7.5, AIX 7.3, Solaris 11.4. @item printf @code{"%010f"} of NaN and Infinity yields an incorrect result (padded with zeroes, or wrong capitalization) on some platforms: diff --git a/doc/posix-functions/vdprintf.texi b/doc/posix-functions/vdprintf.texi index 23bfae481f..9c12b75584 100644 --- a/doc/posix-functions/vdprintf.texi +++ b/doc/posix-functions/vdprintf.texi @@ -28,7 +28,7 @@ Solaris 11.4. @item This function does not support the @samp{a} and @samp{A} directives on some platforms: -glibc-2.3.6, Solaris 11.4. +Solaris 11.4. @item This function does not support the @samp{b} directive, required by ISO C23, on some platforms: @@ -39,6 +39,10 @@ This function does not support precisions in the @samp{ls} directive correctly on some platforms: Solaris 11.4. @item +This function does not round the argument of the @samp{a} directive correctly +on some platforms: +macOS 14, FreeBSD 14.0, NetBSD 10.0, OpenBSD 7.5, AIX 7.3, Solaris 11.4. +@item printf @code{"%010f"} of NaN and Infinity yields an incorrect result (padded with zeroes, or wrong capitalization) on some platforms: Solaris 11.4. diff --git a/doc/posix-functions/vfprintf.texi b/doc/posix-functions/vfprintf.texi index ae07e6fdd1..f4f4a96bcd 100644 --- a/doc/posix-functions/vfprintf.texi +++ b/doc/posix-functions/vfprintf.texi @@ -28,7 +28,7 @@ AIX 5.2, Solaris 11.4, mingw, MSVC 14. @item This function does not support the @samp{a} and @samp{A} directives on some platforms: -glibc-2.3.6, Mac OS X 10.5, NetBSD 10.0, OpenBSD 4.0, AIX 5.2, HP-UX 11, +FreeBSD 5.2.1, OpenBSD 4.0, AIX 5.2, HP-UX 11, Solaris 11.4, Cygwin 1.5.x, mingw, MSVC 14. @item This function does not support the @samp{b} directive, required by ISO C23, @@ -56,7 +56,7 @@ NetBSD 3.0, Cygwin 1.5.24, mingw, MSVC 14. @item This function does not round the argument of the @samp{a} directive correctly on some platforms: -macOS 14, FreeBSD 14.0. +macOS 14, FreeBSD 14.0, NetBSD 10.0, OpenBSD 7.5, AIX 7.3, Solaris 11.4. @item printf @code{"%010f"} of NaN and Infinity yields an incorrect result (padded with zeroes, or wrong capitalization) on some platforms: diff --git a/doc/posix-functions/vprintf.texi b/doc/posix-functions/vprintf.texi index c272a51997..5dc013e895 100644 --- a/doc/posix-functions/vprintf.texi +++ b/doc/posix-functions/vprintf.texi @@ -28,7 +28,7 @@ AIX 5.2, Solaris 11.4, mingw, MSVC 14. @item This function does not support the @samp{a} and @samp{A} directives on some platforms: -glibc-2.3.6, Mac OS X 10.5, NetBSD 10.0, OpenBSD 4.0, AIX 5.2, HP-UX 11, +FreeBSD 5.2.1, OpenBSD 4.0, AIX 5.2, HP-UX 11, Solaris 11.4, Cygwin 1.5.x, mingw, MSVC 14. @item This function does not support the @samp{b} directive, required by ISO C23, @@ -56,7 +56,7 @@ NetBSD 3.0, Cygwin 1.5.24, mingw, MSVC 14. @item This function does not round the argument of the @samp{a} directive correctly on some platforms: -macOS 14, FreeBSD 14.0. +macOS 14, FreeBSD 14.0, NetBSD 10.0, OpenBSD 7.5, AIX 7.3, Solaris 11.4. @item printf @code{"%010f"} of NaN and Infinity yields an incorrect result (padded with zeroes, or wrong capitalization) on some platforms: diff --git a/doc/posix-functions/vsnprintf.texi b/doc/posix-functions/vsnprintf.texi index cc77a30d6e..d470d27105 100644 --- a/doc/posix-functions/vsnprintf.texi +++ b/doc/posix-functions/vsnprintf.texi @@ -40,7 +40,7 @@ AIX 5.2, Solaris 11.4, mingw, MSVC 14. @item This function does not support the @samp{a} and @samp{A} directives on some platforms: -glibc-2.3.6, Mac OS X 10.5, NetBSD 10.0, OpenBSD 4.0, AIX 5.2, HP-UX 11, +FreeBSD 5.2.1, OpenBSD 4.0, AIX 5.2, HP-UX 11, Solaris 11.4, Cygwin 1.5.x, mingw, MSVC 14. @item This function does not support the @samp{b} directive, required by ISO C23, @@ -64,7 +64,7 @@ NetBSD 3.0, Cygwin 1.5.24, mingw, MSVC 14. @item This function does not round the argument of the @samp{a} directive correctly on some platforms: -macOS 14, FreeBSD 14.0. +macOS 14, FreeBSD 14.0, NetBSD 10.0, OpenBSD 7.5, AIX 7.3, Solaris 11.4. @item printf @code{"%010f"} of NaN and Infinity yields an incorrect result (padded with zeroes, or wrong capitalization) on some platforms: diff --git a/doc/posix-functions/vsprintf.texi b/doc/posix-functions/vsprintf.texi index e80dd85c32..a1e8db5e16 100644 --- a/doc/posix-functions/vsprintf.texi +++ b/doc/posix-functions/vsprintf.texi @@ -28,7 +28,7 @@ AIX 5.2, Solaris 11.4, mingw, MSVC 14. @item This function does not support the @samp{a} and @samp{A} directives on some platforms: -glibc-2.3.6, Mac OS X 10.5, NetBSD 10.0, OpenBSD 4.0, AIX 5.2, HP-UX 11, +FreeBSD 5.2.1, OpenBSD 4.0, AIX 5.2, HP-UX 11, Solaris 11.4, Cygwin 1.5.x, mingw, MSVC 14. @item This function does not support the @samp{b} directive, required by ISO C23, @@ -56,7 +56,7 @@ NetBSD 3.0, Cygwin 1.5.24, mingw, MSVC 14. @item This function does not round the argument of the @samp{a} directive correctly on some platforms: -macOS 14, FreeBSD 14.0. +macOS 14, FreeBSD 14.0, NetBSD 10.0, OpenBSD 7.5, AIX 7.3, Solaris 11.4. @item printf @code{"%010f"} of NaN and Infinity yields an incorrect result (padded with zeroes, or wrong capitalization) on some platforms: diff --git a/m4/printf.m4 b/m4/printf.m4 index 5eb694b138..1363fe19e4 100644 --- a/m4/printf.m4 +++ b/m4/printf.m4 @@ -1,5 +1,5 @@ # printf.m4 -# serial 93 +# serial 94 dnl Copyright (C) 2003, 2007-2024 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -616,6 +616,7 @@ static double zero = 0.0; int main () { int result = 0; + /* This fails on FreeBSD 5.2.1, Solaris 11.4. */ if (sprintf (buf, "%a %d", 3.1416015625, 33, 44, 55) < 0 || (strcmp (buf, "0x1.922p+1 33") != 0 && strcmp (buf, "0x3.244p+0 33") != 0 @@ -627,27 +628,29 @@ int main () && strcmp (buf, "-0X3.244P+0 33") != 0 && strcmp (buf, "-0X6.488P-1 33") != 0 && strcmp (buf, "-0XC.91P-2 33") != 0)) - result |= 2; - /* This catches a FreeBSD 13.0 bug: it doesn't round. */ + result |= 1; + /* This catches a Mac OS X 10.5, FreeBSD 6.4, NetBSD 10.0 bug: + it doesn't round. */ if (sprintf (buf, "%.2a %d", 1.51, 33, 44, 55) < 0 || (strcmp (buf, "0x1.83p+0 33") != 0 && strcmp (buf, "0x3.05p-1 33") != 0 && strcmp (buf, "0x6.0ap-2 33") != 0 && strcmp (buf, "0xc.14p-3 33") != 0)) - result |= 4; - /* This catches a macOS 14 (Darwin 23) bug: it doesn't round. */ + result |= 2; + /* This catches a macOS 14 (Darwin 23), FreeBSD 14.0, OpenBSD 7.5, AIX 7.3, + Solaris 11.4 bug: it doesn't round. */ if (sprintf (buf, "%.0a %d", 1.51, 33, 44, 55) < 0 || (strcmp (buf, "0x2p+0 33") != 0 && strcmp (buf, "0x3p-1 33") != 0 && strcmp (buf, "0x6p-2 33") != 0 && strcmp (buf, "0xcp-3 33") != 0)) result |= 4; - /* This catches a FreeBSD 6.1 bug. See + /* This catches a Mac OS X 10.5, FreeBSD 6.4 bug. See */ if (sprintf (buf, "%010a %d", 1.0 / zero, 33, 44, 55) < 0 || buf[0] == '0') result |= 8; - /* This catches a Mac OS X 10.3.9 (Darwin 7.9) bug. */ + /* This catches a Mac OS X 10.3.9 (Darwin 7.9), FreeBSD 6.4 bug. */ if (sprintf (buf, "%.1a", 1.999) < 0 || (strcmp (buf, "0x1.0p+1") != 0 && strcmp (buf, "0x2.0p+0") != 0 @@ -655,7 +658,8 @@ int main () && strcmp (buf, "0x8.0p-2") != 0)) result |= 16; /* This catches the same Mac OS X 10.3.9 (Darwin 7.9) bug and also a - glibc 2.4 bug . */ + glibc 2.4 bug + and a FreeBSD 6.4, NetBSD 10.0 bug. */ if (sprintf (buf, "%.1La", 1.999L) < 0 || (strcmp (buf, "0x1.0p+1") != 0 && strcmp (buf, "0x2.0p+0") != 0