]> Savannah Git Hosting - gnulib.git/commitdiff
doc: Update info about *printf.
authorBruno Haible <bruno@clisp.org>
Mon, 24 Jun 2024 18:02:46 +0000 (20:02 +0200)
committerBruno Haible <bruno@clisp.org>
Mon, 24 Jun 2024 18:03:05 +0000 (20:03 +0200)
* doc/*-functions/*printf.texi: Update info regarding %a directive.
* m4/printf.m4 (gl_PRINTF_DIRECTIVE_A): Likewise. Improve bits
assignment in return value.

16 files changed:
ChangeLog
doc/glibc-functions/asprintf.texi
doc/glibc-functions/obstack_printf.texi
doc/glibc-functions/obstack_vprintf.texi
doc/glibc-functions/vasprintf.texi
doc/posix-functions/dprintf.texi
doc/posix-functions/fprintf.texi
doc/posix-functions/printf.texi
doc/posix-functions/snprintf.texi
doc/posix-functions/sprintf.texi
doc/posix-functions/vdprintf.texi
doc/posix-functions/vfprintf.texi
doc/posix-functions/vprintf.texi
doc/posix-functions/vsnprintf.texi
doc/posix-functions/vsprintf.texi
m4/printf.m4

index 631a15c7dc7b328bc6327af3879b4990e8992af4..04adbdc9a3695ce2f2d05d8b41441f67ca32d344 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2024-06-24  Bruno Haible  <bruno@clisp.org>
+
+       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  <bruno@clisp.org>
 
        doc: Update info about obstack_*printf.
index ffbf3bd0a9c7d01534ac43fc8f3947bd42443563..be7cd28546e2ea2c59cfc80c31e9f81c2e1b1c07 100644 (file)
@@ -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:
index 01d05080649b3d1eaf8af4cc2682217ba2ceabd0..c205047e65a8989c4f8c1964a3673902f27ed54f 100644 (file)
@@ -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:
index 4ef55504e9ac76ed1764b7d3edb978a3b9dcb5eb..e7703863d3bfe92704068f2117f61e57b625f333 100644 (file)
@@ -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:
index 50e4f11ca1ce1e87c2f0d997841c47e4b239b3bf..4d53e3e407bb9a1cdc991bdbf6fbf1f65a0213d0 100644 (file)
@@ -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:
index 4694ab0901611c11122584ed6734e40ea55b6d50..b19057fbe398e439370c1f4801e49228d954bc94 100644 (file)
@@ -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.
index fa3f331250ce1628bb5ea34c022860b525f18df5..36fafeea2f1e1a882d328b2c509911b752578270 100644 (file)
@@ -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:
index d77e48fcc3ac7cc7abcd943c29cb8303bd6b28b1..55d4291a58be4671288fe66e8f60ede3e8e0c555 100644 (file)
@@ -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:
index 7e77f2ddf29eae5261a3fa0bd67e4c98b02f0da7..c954261289d9b216cb82b755da495cfcbd81a929 100644 (file)
@@ -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:
index d729bf63a1c91952c5fcbc9c50bbd0183c4e11fa..05bfccb771dc3cefc91acc70f00b738d2eb1327f 100644 (file)
@@ -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:
index 23bfae481f3e7e64af365522d1e5e2a45b5da98f..9c12b75584649462d675f02beb213b229d84d768 100644 (file)
@@ -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.
index ae07e6fdd148faf72d04490dfa82d39b6eeaa746..f4f4a96bcdc577d7470a51e71faca94641279de5 100644 (file)
@@ -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:
index c272a51997eedfe0de7a2b47d23e74dcad53337d..5dc013e89576e33bb79edc95d94cfcd058728280 100644 (file)
@@ -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:
index cc77a30d6e9b07b78def56ca1ff51f2edfec6fc3..d470d2710590837430eba3d54b23f5043c82a17b 100644 (file)
@@ -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:
index e80dd85c329327abdd328e294b9fa99cbfdeba13..a1e8db5e1600e524f06eb1bf4f0fe3734df10a32 100644 (file)
@@ -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:
index 5eb694b138ce8fcb49c3cdd540543d0c088e4747..1363fe19e4c1a8f8785db8507844997bd889ab0a 100644 (file)
@@ -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
      <https://lists.gnu.org/r/bug-gnulib/2007-04/msg00107.html> */
   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 <https://sourceware.org/bugzilla/show_bug.cgi?id=2908>.  */
+     glibc 2.4 bug <https://sourceware.org/bugzilla/show_bug.cgi?id=2908>
+     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