]> Savannah Git Hosting - gnulib.git/commitdiff
*printf-posix: Work around bug with %#.0x on Mac OS X 10.6.
authorBruno Haible <bruno@clisp.org>
Tue, 3 Oct 2023 21:27:30 +0000 (23:27 +0200)
committerBruno Haible <bruno@clisp.org>
Tue, 3 Oct 2023 21:27:30 +0000 (23:27 +0200)
* lib/vasnprintf.c (VASNPRINTF): Enable NEED_PRINTF_UNBOUNDED_PRECISION-
guarded code also for NEED_PRINTF_FLAG_ALT_PRECISION_ZERO. Set
prec_ourselves to 1 if NEED_PRINTF_FLAG_ALT_PRECISION_ZERO, precision is
0, and the directive is 'x' or 'X'. If prec_ourselves, remove the "0"
output if required.
* m4/printf.m4 (gl_PRINTF_FLAG_ALT_PRECISION_ZERO): New macro.
* m4/vasnprintf.m4 (gl_PREREQ_VASNPRINTF_FLAG_ALT_PRECISION_ZERO): New
macro.
(gl_PREREQ_VASNPRINTF_WITH_POSIX_EXTRAS): Invoke it.
* m4/dprintf-posix.m4 (gl_FUNC_DPRINTF_IS_POSIX): Require
gl_PRINTF_FLAG_ALT_PRECISION_ZERO and test its result.
* m4/fprintf-posix.m4 (gl_FUNC_FPRINTF_IS_POSIX): Likewise.
* m4/obstack-printf-posix.m4 (gl_FUNC_OBSTACK_PRINTF_IS_POSIX):
Likewise.
* m4/snprintf-posix.m4 (gl_FUNC_SNPRINTF_IS_POSIX): Likewise.
* m4/sprintf-posix.m4 (gl_FUNC_SPRINTF_IS_POSIX): Likewise.
* m4/vasnprintf-posix.m4 (gl_FUNC_VASNPRINTF_IS_POSIX): Likewise.
* m4/vasprintf-posix.m4 (gl_FUNC_VASPRINTF_IS_POSIX): Likewise.
* m4/vdprintf-posix.m4 (gl_FUNC_VDPRINTF_IS_POSIX): Likewise.
* m4/vfprintf-posix.m4 (gl_FUNC_VFPRINTF_IS_POSIX): Likewise.
* m4/vsnprintf-posix.m4 (gl_FUNC_VSNPRINTF_IS_POSIX): Likewise.
* m4/vsprintf-posix.m4 (gl_FUNC_VSPRINTF_IS_POSIX): Likewise.
* doc/glibc-functions/asprintf.texi: Mention the %#.0x bug.
* doc/glibc-functions/obstack_printf.texi: Likewise.
* doc/glibc-functions/obstack_vprintf.texi: Likewise.
* doc/glibc-functions/vasprintf.texi: Likewise.
* doc/posix-functions/dprintf.texi: Likewise.
* doc/posix-functions/fprintf.texi: Likewise.
* doc/posix-functions/fwprintf.texi: Likewise.
* doc/posix-functions/printf.texi: Likewise.
* doc/posix-functions/snprintf.texi: Likewise.
* doc/posix-functions/sprintf.texi: Likewise.
* doc/posix-functions/swprintf.texi: Likewise.
* doc/posix-functions/vdprintf.texi: Likewise.
* doc/posix-functions/vfprintf.texi: Likewise.
* doc/posix-functions/vfwprintf.texi: Likewise.
* doc/posix-functions/vprintf.texi: Likewise.
* doc/posix-functions/vsnprintf.texi: Likewise.
* doc/posix-functions/vsprintf.texi: Likewise.
* doc/posix-functions/vswprintf.texi: Likewise.
* doc/posix-functions/vwprintf.texi: Likewise.
* doc/posix-functions/wprintf.texi: Likewise.

35 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/fwprintf.texi
doc/posix-functions/printf.texi
doc/posix-functions/snprintf.texi
doc/posix-functions/sprintf.texi
doc/posix-functions/swprintf.texi
doc/posix-functions/vdprintf.texi
doc/posix-functions/vfprintf.texi
doc/posix-functions/vfwprintf.texi
doc/posix-functions/vprintf.texi
doc/posix-functions/vsnprintf.texi
doc/posix-functions/vsprintf.texi
doc/posix-functions/vswprintf.texi
doc/posix-functions/vwprintf.texi
doc/posix-functions/wprintf.texi
lib/vasnprintf.c
m4/dprintf-posix.m4
m4/fprintf-posix.m4
m4/obstack-printf-posix.m4
m4/printf.m4
m4/snprintf-posix.m4
m4/sprintf-posix.m4
m4/vasnprintf-posix.m4
m4/vasnprintf.m4
m4/vasprintf-posix.m4
m4/vdprintf-posix.m4
m4/vfprintf-posix.m4
m4/vsnprintf-posix.m4
m4/vsprintf-posix.m4

index 0e7896212c340332c79d38bd3471fed761c674dd..4732d499bc2c0ac4913a71242f92cd81ffa45106 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,49 @@
+2023-10-03  Bruno Haible  <bruno@clisp.org>
+
+       *printf-posix: Work around bug with %#.0x on Mac OS X 10.6.
+       * lib/vasnprintf.c (VASNPRINTF): Enable NEED_PRINTF_UNBOUNDED_PRECISION-
+       guarded code also for NEED_PRINTF_FLAG_ALT_PRECISION_ZERO. Set
+       prec_ourselves to 1 if NEED_PRINTF_FLAG_ALT_PRECISION_ZERO, precision is
+       0, and the directive is 'x' or 'X'. If prec_ourselves, remove the "0"
+       output if required.
+       * m4/printf.m4 (gl_PRINTF_FLAG_ALT_PRECISION_ZERO): New macro.
+       * m4/vasnprintf.m4 (gl_PREREQ_VASNPRINTF_FLAG_ALT_PRECISION_ZERO): New
+       macro.
+       (gl_PREREQ_VASNPRINTF_WITH_POSIX_EXTRAS): Invoke it.
+       * m4/dprintf-posix.m4 (gl_FUNC_DPRINTF_IS_POSIX): Require
+       gl_PRINTF_FLAG_ALT_PRECISION_ZERO and test its result.
+       * m4/fprintf-posix.m4 (gl_FUNC_FPRINTF_IS_POSIX): Likewise.
+       * m4/obstack-printf-posix.m4 (gl_FUNC_OBSTACK_PRINTF_IS_POSIX):
+       Likewise.
+       * m4/snprintf-posix.m4 (gl_FUNC_SNPRINTF_IS_POSIX): Likewise.
+       * m4/sprintf-posix.m4 (gl_FUNC_SPRINTF_IS_POSIX): Likewise.
+       * m4/vasnprintf-posix.m4 (gl_FUNC_VASNPRINTF_IS_POSIX): Likewise.
+       * m4/vasprintf-posix.m4 (gl_FUNC_VASPRINTF_IS_POSIX): Likewise.
+       * m4/vdprintf-posix.m4 (gl_FUNC_VDPRINTF_IS_POSIX): Likewise.
+       * m4/vfprintf-posix.m4 (gl_FUNC_VFPRINTF_IS_POSIX): Likewise.
+       * m4/vsnprintf-posix.m4 (gl_FUNC_VSNPRINTF_IS_POSIX): Likewise.
+       * m4/vsprintf-posix.m4 (gl_FUNC_VSPRINTF_IS_POSIX): Likewise.
+       * doc/glibc-functions/asprintf.texi: Mention the %#.0x bug.
+       * doc/glibc-functions/obstack_printf.texi: Likewise.
+       * doc/glibc-functions/obstack_vprintf.texi: Likewise.
+       * doc/glibc-functions/vasprintf.texi: Likewise.
+       * doc/posix-functions/dprintf.texi: Likewise.
+       * doc/posix-functions/fprintf.texi: Likewise.
+       * doc/posix-functions/fwprintf.texi: Likewise.
+       * doc/posix-functions/printf.texi: Likewise.
+       * doc/posix-functions/snprintf.texi: Likewise.
+       * doc/posix-functions/sprintf.texi: Likewise.
+       * doc/posix-functions/swprintf.texi: Likewise.
+       * doc/posix-functions/vdprintf.texi: Likewise.
+       * doc/posix-functions/vfprintf.texi: Likewise.
+       * doc/posix-functions/vfwprintf.texi: Likewise.
+       * doc/posix-functions/vprintf.texi: Likewise.
+       * doc/posix-functions/vsnprintf.texi: Likewise.
+       * doc/posix-functions/vsprintf.texi: Likewise.
+       * doc/posix-functions/vswprintf.texi: Likewise.
+       * doc/posix-functions/vwprintf.texi: Likewise.
+       * doc/posix-functions/wprintf.texi: Likewise.
+
 2023-10-03  Bruno Haible  <bruno@clisp.org>
 
        faccessat tests: Strengthen tests.
index 017220f66fad35c6c68f10dfc9546e83c1b5e273..19602929ccabebb9c8acbde2edf8af8d7e3e2e64 100644 (file)
@@ -71,6 +71,10 @@ printf @code{"%010f"} of NaN and Infinity yields an incorrect result (padded
 with zeroes) on some platforms:
 Mac OS X 10.5, FreeBSD 6.0, NetBSD 5.0, Solaris 11.0, Cygwin 1.5.x.
 @item
+printf @code{"%#.0x"} or @code{"%#.0X"} with a zero argument yields an
+incorrect result (non-empty) on some platforms:
+Mac OS X 10.6.
+@item
 This function produces wrong output for the @samp{lc} directive with a NUL
 wide character argument on some platforms:
 glibc 2.35, FreeBSD 13.1, NetBSD 9.0, OpenBSD 7.2, macOS 12.5, AIX 7.2, Solaris 11.4, and others.
index e74327db217c7fedde4cc5adea6c571066287698..975b2552741c6482b75a6175ac1d38df06c1a296 100644 (file)
@@ -73,6 +73,10 @@ printf @code{"%010f"} of NaN and Infinity yields an incorrect result (padded
 with zeroes) on some platforms:
 Mac OS X 10.5, FreeBSD 13.0, NetBSD 5.0, AIX 5.2, IRIX 6.5, Solaris 11.0, Cygwin 1.5.x, mingw, MSVC/clang.
 @item
+printf @code{"%#.0x"} or @code{"%#.0X"} with a zero argument yields an
+incorrect result (non-empty) on some platforms:
+Mac OS X 10.6.
+@item
 This function does not support precisions larger than 512 or 1024 in integer,
 floating-point and pointer output on some platforms:
 Solaris 10/x86, mingw, MSVC/clang.
index 1799832b581e9b53bbc64a702947b79a81f54a7b..a3ec3d364b412dfaf79ea404a4a4eb6546425dc6 100644 (file)
@@ -73,6 +73,10 @@ printf @code{"%010f"} of NaN and Infinity yields an incorrect result (padded
 with zeroes) on some platforms:
 Mac OS X 10.5, FreeBSD 13.0, NetBSD 5.0, AIX 5.2, IRIX 6.5, Solaris 11.0, Cygwin 1.5.x, mingw, MSVC/clang.
 @item
+printf @code{"%#.0x"} or @code{"%#.0X"} with a zero argument yields an
+incorrect result (non-empty) on some platforms:
+Mac OS X 10.6.
+@item
 This function does not support precisions larger than 512 or 1024 in integer,
 floating-point and pointer output on some platforms:
 Solaris 10/x86, mingw, MSVC/clang.
index 91cf7d5635610725cf04506ee91a51673f278352..b33ad91642a616b057c309bf0a9504575ee8347d 100644 (file)
@@ -71,6 +71,10 @@ printf @code{"%010f"} of NaN and Infinity yields an incorrect result (padded
 with zeroes) on some platforms:
 Mac OS X 10.5, FreeBSD 6.0, NetBSD 5.0, Solaris 11.0, Cygwin 1.5.x.
 @item
+printf @code{"%#.0x"} or @code{"%#.0X"} with a zero argument yields an
+incorrect result (non-empty) on some platforms:
+Mac OS X 10.6.
+@item
 This function produces wrong output for the @samp{lc} directive with a NUL
 wide character argument on some platforms:
 glibc 2.35, FreeBSD 13.1, NetBSD 9.0, OpenBSD 7.2, macOS 12.5, AIX 7.2, Solaris 11.4, and others.
index 92b73a97b59f54083fcf7def662d1baab04b721c..b10939879376bd2f5609188f4c928c59c76c7406 100644 (file)
@@ -47,6 +47,10 @@ printf @code{"%010f"} of NaN and Infinity yields an incorrect result (padded
 with zeroes, or wrong capitalization) on some platforms:
 Solaris 11.4.
 @item
+printf @code{"%#.0x"} or @code{"%#.0X"} with a zero argument yields an
+incorrect result (non-empty) on some platforms:
+Mac OS X 10.6.
+@item
 This function does not support precisions larger than 512 or 1024 in integer,
 floating-point and pointer output on some platforms:
 AIX 7.1.
index e08ece486964013719f3d1fde6ac43a0f3da1460..7bd9ff50d8a74e0a1d5bdddabb86ea0d45d82077 100644 (file)
@@ -66,6 +66,10 @@ printf @code{"%010f"} of NaN and Infinity yields an incorrect result (padded
 with zeroes, or wrong capitalization) on some platforms:
 Mac OS X 10.5, FreeBSD 6.0, NetBSD 5.0, AIX 5.2, IRIX 6.5, Solaris 11.4, Cygwin 1.5.x, mingw, MSVC/clang.
 @item
+printf @code{"%#.0x"} or @code{"%#.0X"} with a zero argument yields an
+incorrect result (non-empty) on some platforms:
+Mac OS X 10.6.
+@item
 This function does not support precisions larger than 512 or 1024 in integer,
 floating-point and pointer output on some platforms:
 AIX 7.1, Solaris 10/x86, mingw, MSVC/clang.
index db42363cfaccb32944980ff72e3ee23f75ea1695..fed553f2b56ae88a244091f3debaf024dc81f83c 100644 (file)
@@ -30,6 +30,10 @@ on some platforms:
 glibc 2.34, musl libc, macOS 12.5, FreeBSD 13.1, NetBSD 9.0, OpenBSD 7.2,
 AIX 7.2, HP-UX 11, Solaris 11.4, Cygwin 2.9.0, mingw, MSVC 14.
 @item
+printf @code{"%#.0x"} or @code{"%#.0X"} with a zero argument yields an
+incorrect result (non-empty) on some platforms:
+Mac OS X 10.6.
+@item
 The @code{%m} directive is not portable, use @code{%s} mapped to an
 argument of @code{strerror(errno)} (or a version of @code{strerror_r})
 instead.
index 4af0105b6680b2a4d0c4671be67e3e8675e35d0e..12ba645734b59abf59c9579b00fc25d2cffbac05 100644 (file)
@@ -66,6 +66,10 @@ printf @code{"%010f"} of NaN and Infinity yields an incorrect result (padded
 with zeroes, or wrong capitalization) on some platforms:
 Mac OS X 10.5, FreeBSD 6.0, NetBSD 5.0, AIX 5.2, IRIX 6.5, Solaris 11.4, Cygwin 1.5.x, mingw, MSVC/clang.
 @item
+printf @code{"%#.0x"} or @code{"%#.0X"} with a zero argument yields an
+incorrect result (non-empty) on some platforms:
+Mac OS X 10.6.
+@item
 This function does not support precisions larger than 512 or 1024 in integer,
 floating-point and pointer output on some platforms:
 AIX 7.1, Solaris 10/x86, mingw, MSVC/clang.
index 7446b88f5f6af85c7af973263c5bd6682a9aa01a..f907e9cc7fb22058033602eb673663e345bfee37 100644 (file)
@@ -77,6 +77,10 @@ printf @code{"%010f"} of NaN and Infinity yields an incorrect result (padded
 with zeroes, or wrong capitalization) on some platforms:
 Mac OS X 10.5, FreeBSD 6.0, NetBSD 5.0, AIX 5.2, IRIX 6.5, Solaris 11.4, Cygwin 1.5.x, mingw, MSVC/clang.
 @item
+printf @code{"%#.0x"} or @code{"%#.0X"} with a zero argument yields an
+incorrect result (non-empty) on some platforms:
+Mac OS X 10.6.
+@item
 This function does not support precisions larger than 512 or 1024 in integer,
 floating-point and pointer output on some platforms:
 AIX 7.1, Solaris 10/x86, mingw, MSVC/clang.
index 8cd5de619f275f6e8bb686e2cb44398bc6cd4194..2652acdebce7a01897d1e484c1244cf6e55ffff3 100644 (file)
@@ -66,6 +66,10 @@ printf @code{"%010f"} of NaN and Infinity yields an incorrect result (padded
 with zeroes, or wrong capitalization) on some platforms:
 Mac OS X 10.5, FreeBSD 6.0, NetBSD 5.0, AIX 5.2, IRIX 6.5, Solaris 11.4, Cygwin 1.5.x, mingw, MSVC/clang.
 @item
+printf @code{"%#.0x"} or @code{"%#.0X"} with a zero argument yields an
+incorrect result (non-empty) on some platforms:
+Mac OS X 10.6.
+@item
 This function does not support precisions larger than 512 or 1024 in integer,
 floating-point and pointer output on some platforms:
 AIX 7.1, Solaris 10/x86, mingw, MSVC/clang.
index 6029adbb669e068d0e5a4d76790824decaf0a85d..6e139ae0d8e65a637327666a43013e7a96945cba 100644 (file)
@@ -66,6 +66,10 @@ on some platforms:
 glibc 2.34, musl libc, macOS 12.5, FreeBSD 13.1, NetBSD 9.0, OpenBSD 7.2,
 AIX 7.2, HP-UX 11, Solaris 11.4, Cygwin 2.9.0, mingw, MSVC 14.
 @item
+printf @code{"%#.0x"} or @code{"%#.0X"} with a zero argument yields an
+incorrect result (non-empty) on some platforms:
+Mac OS X 10.6.
+@item
 The @code{%m} directive is not portable, use @code{%s} mapped to an
 argument of @code{strerror(errno)} (or a version of @code{strerror_r})
 instead.
index 05f001d707013250240d8e7605b6c362bf8dd117..22ac3d17b4d873e9cd7dd6f2ff6aa6b141b9d403 100644 (file)
@@ -47,6 +47,10 @@ printf @code{"%010f"} of NaN and Infinity yields an incorrect result (padded
 with zeroes, or wrong capitalization) on some platforms:
 Solaris 11.4.
 @item
+printf @code{"%#.0x"} or @code{"%#.0X"} with a zero argument yields an
+incorrect result (non-empty) on some platforms:
+Mac OS X 10.6.
+@item
 This function does not support precisions larger than 512 or 1024 in integer,
 floating-point and pointer output on some platforms:
 AIX 7.1.
index c80599e06a601bb01070dae0b9761f1290814332..94bd3a75d45dc29a91f694497152d71c47fc72cf 100644 (file)
@@ -66,6 +66,10 @@ printf @code{"%010f"} of NaN and Infinity yields an incorrect result (padded
 with zeroes, or wrong capitalization) on some platforms:
 Mac OS X 10.5, FreeBSD 6.0, NetBSD 5.0, AIX 5.2, IRIX 6.5, Solaris 11.4, Cygwin 1.5.x, mingw, MSVC/clang.
 @item
+printf @code{"%#.0x"} or @code{"%#.0X"} with a zero argument yields an
+incorrect result (non-empty) on some platforms:
+Mac OS X 10.6.
+@item
 This function does not support precisions larger than 512 or 1024 in integer,
 floating-point and pointer output on some platforms:
 AIX 7.1, Solaris 10/x86, mingw, MSVC/clang.
index 0712269aa4681769d826786b77b582ea0f6ea7cb..5669b56711d095f5348cc2d1eacea4aceab374c7 100644 (file)
@@ -30,6 +30,10 @@ on some platforms:
 glibc 2.34, musl libc, macOS 12.5, FreeBSD 13.1, NetBSD 9.0, OpenBSD 7.2,
 AIX 7.2, HP-UX 11, Solaris 11.4, Cygwin 2.9.0, mingw, MSVC 14.
 @item
+printf @code{"%#.0x"} or @code{"%#.0X"} with a zero argument yields an
+incorrect result (non-empty) on some platforms:
+Mac OS X 10.6.
+@item
 The @code{%m} directive is not portable, use @code{%s} mapped to an
 argument of @code{strerror(errno)} (or a version of @code{strerror_r})
 instead.
index 733032c5f4f41937ac7b0a325647906752d48bf2..8877376b91941679f2a69f3aacee706fcefe152e 100644 (file)
@@ -66,6 +66,10 @@ printf @code{"%010f"} of NaN and Infinity yields an incorrect result (padded
 with zeroes, or wrong capitalization) on some platforms:
 Mac OS X 10.5, FreeBSD 6.0, NetBSD 5.0, AIX 5.2, IRIX 6.5, Solaris 11.4, Cygwin 1.5.x, mingw, MSVC/clang.
 @item
+printf @code{"%#.0x"} or @code{"%#.0X"} with a zero argument yields an
+incorrect result (non-empty) on some platforms:
+Mac OS X 10.6.
+@item
 This function does not support precisions larger than 512 or 1024 in integer,
 floating-point and pointer output on some platforms:
 AIX 7.1, Solaris 10/x86, mingw, MSVC/clang.
index c00aec68ddfbd1c3b7da9693fc28298456ec224f..5bc943fde39bae794045fb46bba9d47d95d04e3f 100644 (file)
@@ -70,6 +70,10 @@ printf @code{"%010f"} of NaN and Infinity yields an incorrect result (padded
 with zeroes, or wrong capitalization) on some platforms:
 Mac OS X 10.5, FreeBSD 6.0, NetBSD 5.0, AIX 5.2, IRIX 6.5, Solaris 11.4, Cygwin 1.5.x, mingw, MSVC/clang.
 @item
+printf @code{"%#.0x"} or @code{"%#.0X"} with a zero argument yields an
+incorrect result (non-empty) on some platforms:
+Mac OS X 10.6.
+@item
 This function does not support precisions larger than 512 or 1024 in integer,
 floating-point and pointer output on some platforms:
 AIX 7.1, Solaris 10/x86, mingw, MSVC/clang.
index 84bf7eec6fc897818de55f8b00638cca17272a84..4e726f96b0de2f8ad51f041fe68cebfc63c02348 100644 (file)
@@ -66,6 +66,10 @@ printf @code{"%010f"} of NaN and Infinity yields an incorrect result (padded
 with zeroes, or wrong capitalization) on some platforms:
 Mac OS X 10.5, FreeBSD 6.0, NetBSD 5.0, AIX 5.2, IRIX 6.5, Solaris 11.4, Cygwin 1.5.x, mingw, MSVC/clang.
 @item
+printf @code{"%#.0x"} or @code{"%#.0X"} with a zero argument yields an
+incorrect result (non-empty) on some platforms:
+Mac OS X 10.6.
+@item
 This function does not support precisions larger than 512 or 1024 in integer,
 floating-point and pointer output on some platforms:
 AIX 7.1, Solaris 10/x86, mingw, MSVC/clang.
index 7512a2d0237a39788db3b7f95917f2b8ce2dfb13..9fee75e929ca12d7baf7f314a898a7a35a1e14c6 100644 (file)
@@ -32,6 +32,10 @@ on some platforms:
 glibc 2.34, musl libc, macOS 12.5, FreeBSD 13.1, NetBSD 9.0, OpenBSD 7.2,
 AIX 7.2, HP-UX 11, Solaris 11.4, Cygwin 2.9.0, mingw, MSVC 14.
 @item
+printf @code{"%#.0x"} or @code{"%#.0X"} with a zero argument yields an
+incorrect result (non-empty) on some platforms:
+Mac OS X 10.6.
+@item
 The @code{%m} directive is not portable, use @code{%s} mapped to an
 argument of @code{strerror(errno)} (or a version of @code{strerror_r})
 instead.
index 1e364288f62254c6b506b3217572e11fe98dfa44..19f96fd241d511ef006b0720f10743524308a514 100644 (file)
@@ -33,6 +33,10 @@ on some platforms:
 glibc 2.34, musl libc, macOS 12.5, FreeBSD 13.1, NetBSD 9.0, OpenBSD 7.2,
 AIX 7.2, HP-UX 11, Solaris 11.4, Cygwin 2.9.0, mingw, MSVC 14.
 @item
+printf @code{"%#.0x"} or @code{"%#.0X"} with a zero argument yields an
+incorrect result (non-empty) on some platforms:
+Mac OS X 10.6.
+@item
 The @code{%m} directive is not portable, use @code{%s} mapped to an
 argument of @code{strerror(errno)} (or a version of @code{strerror_r})
 instead.
index c4d58fab2e158aa199f95830091f212dfc65fca1..8c977ab506fc1e8a3202152425710f2cfb247f79 100644 (file)
@@ -33,6 +33,10 @@ on some platforms:
 glibc 2.34, musl libc, macOS 12.5, FreeBSD 13.1, NetBSD 9.0, OpenBSD 7.2,
 AIX 7.2, HP-UX 11, Solaris 11.4, Cygwin 2.9.0, mingw, MSVC 14.
 @item
+printf @code{"%#.0x"} or @code{"%#.0X"} with a zero argument yields an
+incorrect result (non-empty) on some platforms:
+Mac OS X 10.6.
+@item
 The @code{%m} directive is not portable, use @code{%s} mapped to an
 argument of @code{strerror(errno)} (or a version of @code{strerror_r})
 instead.
index 815c7c509859e93d3c1125bdb1fd1a9f73fc0a49..2cfdbe97bdaa970e2b1a9f11ebc9438b02385886 100644 (file)
@@ -5622,24 +5622,24 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
               {
                 arg_type type = a.arg[dp->arg_index].type;
                 int flags = dp->flags;
-#if (WIDE_CHAR_VERSION && MUSL_LIBC) || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
+#if (WIDE_CHAR_VERSION && MUSL_LIBC) || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
                 int has_width;
 #endif
-#if !USE_SNPRINTF || WIDE_CHAR_VERSION || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
+#if !USE_SNPRINTF || WIDE_CHAR_VERSION || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
                 size_t width;
 #endif
-#if !USE_SNPRINTF || (WIDE_CHAR_VERSION && DCHAR_IS_TCHAR) || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || (WIDE_CHAR_VERSION && MUSL_LIBC) || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
+#if !USE_SNPRINTF || (WIDE_CHAR_VERSION && DCHAR_IS_TCHAR) || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || (WIDE_CHAR_VERSION && MUSL_LIBC) || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
                 int has_precision;
                 size_t precision;
 #endif
-#if NEED_PRINTF_UNBOUNDED_PRECISION
+#if NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
                 int prec_ourselves;
 #else
 #               define prec_ourselves 0
 #endif
 #if (WIDE_CHAR_VERSION && MUSL_LIBC) || NEED_PRINTF_FLAG_LEFTADJUST
 #               define pad_ourselves 1
-#elif !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
+#elif !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
                 int pad_ourselves;
 #else
 #               define pad_ourselves 0
@@ -5654,10 +5654,10 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                 TCHAR_T *tmp;
 #endif
 
-#if (WIDE_CHAR_VERSION && MUSL_LIBC) || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
+#if (WIDE_CHAR_VERSION && MUSL_LIBC) || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
                 has_width = 0;
 #endif
-#if !USE_SNPRINTF || WIDE_CHAR_VERSION || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
+#if !USE_SNPRINTF || WIDE_CHAR_VERSION || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
                 width = 0;
                 if (dp->width_start != dp->width_end)
                   {
@@ -5685,13 +5685,13 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                           width = xsum (xtimes (width, 10), *digitp++ - '0');
                         while (digitp != dp->width_end);
                       }
-# if (WIDE_CHAR_VERSION && MUSL_LIBC) || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
+# if (WIDE_CHAR_VERSION && MUSL_LIBC) || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
                     has_width = 1;
 # endif
                   }
 #endif
 
-#if !USE_SNPRINTF || (WIDE_CHAR_VERSION && DCHAR_IS_TCHAR) || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || (WIDE_CHAR_VERSION && MUSL_LIBC) || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
+#if !USE_SNPRINTF || (WIDE_CHAR_VERSION && DCHAR_IS_TCHAR) || !HAVE_SNPRINTF_RETVAL_C99 || USE_MSVC__SNPRINTF || (WIDE_CHAR_VERSION && MUSL_LIBC) || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
                 has_precision = 0;
                 precision = 6;
                 if (dp->precision_start != dp->precision_end)
@@ -5724,9 +5724,10 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
 #endif
 
                 /* Decide whether to handle the precision ourselves.  */
-#if NEED_PRINTF_UNBOUNDED_PRECISION
+#if NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
                 switch (dp->conversion)
                   {
+# if NEED_PRINTF_UNBOUNDED_PRECISION
                   case 'd': case 'i': case 'u':
                   case 'b':
                   #if SUPPORT_GNU_PRINTF_DIRECTIVES \
@@ -5734,9 +5735,21 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                   case 'B':
                   #endif
                   case 'o':
-                  case 'x': case 'X': case 'p':
                     prec_ourselves = has_precision && (precision > 0);
                     break;
+# endif
+                  case 'x': case 'X': case 'p':
+                    prec_ourselves =
+                      has_precision
+                      && (0
+# if NEED_PRINTF_FLAG_ALT_PRECISION_ZERO
+                          || (precision == 0)
+# endif
+# if NEED_PRINTF_UNBOUNDED_PRECISION
+                          || (precision > 0)
+# endif
+                         );
+                    break;
                   default:
                     prec_ourselves = 0;
                     break;
@@ -5744,7 +5757,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
 #endif
 
                 /* Decide whether to perform the padding ourselves.  */
-#if !((WIDE_CHAR_VERSION && MUSL_LIBC) || NEED_PRINTF_FLAG_LEFTADJUST) && (!DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION)
+#if !((WIDE_CHAR_VERSION && MUSL_LIBC) || NEED_PRINTF_FLAG_LEFTADJUST) && (!DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION)
                 switch (dp->conversion)
                   {
 # if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO
@@ -6508,7 +6521,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                       }
 #endif
 
-#if NEED_PRINTF_UNBOUNDED_PRECISION
+#if NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
                     if (prec_ourselves)
                       {
                         /* Handle the precision.  */
@@ -6568,6 +6581,15 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
 
                             count += insert;
                           }
+# if NEED_PRINTF_FLAG_ALT_PRECISION_ZERO
+                        else if (precision == 0
+                                 && move == 1
+                                 && prec_ptr[prefix_count] == '0')
+                          {
+                            /* Replace the "0" result with an empty string.  */
+                            count = prefix_count;
+                          }
+# endif
                       }
 #endif
 
@@ -6722,7 +6744,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                     /* Here count <= allocated - length.  */
 
                     /* Perform padding.  */
-#if (WIDE_CHAR_VERSION && MUSL_LIBC) || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
+#if (WIDE_CHAR_VERSION && MUSL_LIBC) || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
                     if (pad_ourselves && has_width)
                       {
                         size_t w;
index 3d964a6dce8e06b987e33bc4a9cca28e6c63abc0..d6d0539c5e6daca0263c6cebcc2a23e9cea2273c 100644 (file)
@@ -1,4 +1,4 @@
-# dprintf-posix.m4 serial 7
+# dprintf-posix.m4 serial 8
 dnl Copyright (C) 2007-2023 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -33,6 +33,7 @@ AC_DEFUN([gl_FUNC_DPRINTF_IS_POSIX],
   AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
   AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
   AC_REQUIRE([gl_PRINTF_FLAG_ZERO])
+  AC_REQUIRE([gl_PRINTF_FLAG_ALT_PRECISION_ZERO])
   AC_REQUIRE([gl_PRINTF_PRECISION])
   AC_REQUIRE([gl_PRINTF_ENOMEM])
   gl_cv_func_dprintf_posix=no
@@ -68,13 +69,17 @@ AC_DEFUN([gl_FUNC_DPRINTF_IS_POSIX],
                                                           *yes)
                                                             case "$gl_cv_func_printf_flag_zero" in
                                                               *yes)
-                                                                case "$gl_cv_func_printf_precision" in
+                                                                case "$gl_cv_func_printf_flag_alt_precision_zero" in
                                                                   *yes)
-                                                                    case "$gl_cv_func_printf_enomem" in
+                                                                    case "$gl_cv_func_printf_precision" in
                                                                       *yes)
-                                                                        # dprintf exists and is
-                                                                        # already POSIX compliant.
-                                                                        gl_cv_func_dprintf_posix=yes
+                                                                        case "$gl_cv_func_printf_enomem" in
+                                                                          *yes)
+                                                                            # dprintf exists and is
+                                                                            # already POSIX compliant.
+                                                                            gl_cv_func_dprintf_posix=yes
+                                                                            ;;
+                                                                        esac
                                                                         ;;
                                                                     esac
                                                                     ;;
index 67ecbf353b3e9eca82d94ee322f2098c15bdbe09..4d2c1e57c7cbe49d09e8ac4e62e85e727a2abe28 100644 (file)
@@ -1,4 +1,4 @@
-# fprintf-posix.m4 serial 18
+# fprintf-posix.m4 serial 19
 dnl Copyright (C) 2007-2023 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -33,6 +33,7 @@ AC_DEFUN([gl_FUNC_FPRINTF_IS_POSIX],
   AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
   AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
   AC_REQUIRE([gl_PRINTF_FLAG_ZERO])
+  AC_REQUIRE([gl_PRINTF_FLAG_ALT_PRECISION_ZERO])
   AC_REQUIRE([gl_PRINTF_PRECISION])
   AC_REQUIRE([gl_PRINTF_ENOMEM])
   gl_cv_func_fprintf_posix=no
@@ -66,13 +67,17 @@ AC_DEFUN([gl_FUNC_FPRINTF_IS_POSIX],
                                                         *yes)
                                                           case "$gl_cv_func_printf_flag_zero" in
                                                             *yes)
-                                                              case "$gl_cv_func_printf_precision" in
+                                                              case "$gl_cv_func_printf_flag_alt_precision_zero" in
                                                                 *yes)
-                                                                  case "$gl_cv_func_printf_enomem" in
+                                                                  case "$gl_cv_func_printf_precision" in
                                                                     *yes)
-                                                                      # fprintf exists and is
-                                                                      # already POSIX compliant.
-                                                                      gl_cv_func_fprintf_posix=yes
+                                                                      case "$gl_cv_func_printf_enomem" in
+                                                                        *yes)
+                                                                          # fprintf exists and is
+                                                                          # already POSIX compliant.
+                                                                          gl_cv_func_fprintf_posix=yes
+                                                                          ;;
+                                                                      esac
                                                                       ;;
                                                                   esac
                                                                   ;;
index d306b8426d88720cb4c27ca4c86b98b5fb490366..8c0de32536dba368536a1a23f6da6100864d30b3 100644 (file)
@@ -1,4 +1,4 @@
-# obstack-printf-posix.m4 serial 8
+# obstack-printf-posix.m4 serial 9
 dnl Copyright (C) 2008-2023 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -37,6 +37,7 @@ AC_DEFUN([gl_FUNC_OBSTACK_PRINTF_IS_POSIX],
   AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
   AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
   AC_REQUIRE([gl_PRINTF_FLAG_ZERO])
+  AC_REQUIRE([gl_PRINTF_FLAG_ALT_PRECISION_ZERO])
   AC_REQUIRE([gl_PRINTF_PRECISION])
   AC_REQUIRE([gl_PRINTF_ENOMEM])
   gl_cv_func_obstack_printf_posix=no
@@ -72,13 +73,17 @@ AC_DEFUN([gl_FUNC_OBSTACK_PRINTF_IS_POSIX],
                                                           *yes)
                                                             case "$gl_cv_func_printf_flag_zero" in
                                                               *yes)
-                                                                case "$gl_cv_func_printf_precision" in
+                                                                case "$gl_cv_func_printf_flag_alt_precision_zero" in
                                                                   *yes)
-                                                                    case "$gl_cv_func_printf_enomem" in
+                                                                    case "$gl_cv_func_printf_precision" in
                                                                       *yes)
-                                                                        # obstack_printf exists and is
-                                                                        # already POSIX compliant.
-                                                                        gl_cv_func_obstack_printf_posix=yes
+                                                                        case "$gl_cv_func_printf_enomem" in
+                                                                          *yes)
+                                                                            # obstack_printf exists and is
+                                                                            # already POSIX compliant.
+                                                                            gl_cv_func_obstack_printf_posix=yes
+                                                                            ;;
+                                                                        esac
                                                                         ;;
                                                                     esac
                                                                     ;;
index d0d15eb9698dc7f4335fa2ce82d2986a235ceda8..729847b0aabf42721d023b9ea5b0aeedcbe84ce1 100644 (file)
@@ -1,4 +1,4 @@
-# printf.m4 serial 86
+# printf.m4 serial 87
 dnl Copyright (C) 2003, 2007-2023 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -1260,6 +1260,50 @@ changequote([,])dnl
     ])
 ])
 
+dnl Test whether the *printf family of functions supports the # flag with a
+dnl zero precision and a zero value in the 'x' and 'X' directives correctly.
+dnl ISO C and POSIX specify that for the 'd', 'i', 'b', 'o', 'u', 'x', 'X'
+dnl directives: "The result of converting a zero value with a precision of
+dnl zero is no characters."  But on Mac OS X 10.5, for the 'x', 'X' directives,
+dnl when a # flag is present, the output is "0" instead of "".
+dnl Result is gl_cv_func_printf_flag_alt_precision_zero.
+
+AC_DEFUN([gl_PRINTF_FLAG_ALT_PRECISION_ZERO],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CACHE_CHECK([whether printf supports the alternative flag with a zero precision],
+    [gl_cv_func_printf_flag_alt_precision_zero],
+    [
+      AC_RUN_IFELSE(
+        [AC_LANG_SOURCE([[
+#include <stdio.h>
+static char buf[10];
+int main ()
+{
+  int result = 0;
+  if (sprintf (buf, "%#.0x %d", 0, 33, 44) > 0 + 3)
+    result |= 1;
+  return result;
+}]])],
+        [gl_cv_func_printf_flag_alt_precision_zero=yes],
+        [gl_cv_func_printf_flag_alt_precision_zero=no],
+        [
+changequote(,)dnl
+         case "$host_os" in
+           # Guess no only on macOS 10..12 systems.
+           darwin[0-9] | darwin[0-9].* | \
+           darwin1[0-9] | darwin1[0-9].* | \
+           darwin2[0-1] | darwin2[0-1].*)
+                    gl_cv_func_printf_flag_alt_precision_zero="guessing no" ;;
+           darwin*) gl_cv_func_printf_flag_alt_precision_zero="guessing yes" ;;
+           *)       gl_cv_func_printf_flag_alt_precision_zero="guessing yes" ;;
+         esac
+changequote([,])dnl
+        ])
+    ])
+])
+
 dnl Test whether the *printf family of functions supports large precisions.
 dnl On mingw, precisions larger than 512 are treated like 512, in integer,
 dnl floating-point or pointer output. On Solaris 10/x86, precisions larger
@@ -2083,17 +2127,18 @@ dnl 13 = gl_PRINTF_POSITIONS
 dnl 14 = gl_PRINTF_FLAG_GROUPING
 dnl 15 = gl_PRINTF_FLAG_LEFTADJUST
 dnl 16 = gl_PRINTF_FLAG_ZERO
-dnl 17 = gl_PRINTF_PRECISION
-dnl 18 = gl_PRINTF_ENOMEM
-dnl 19 = gl_SNPRINTF_PRESENCE
-dnl 20 = gl_SNPRINTF_TRUNCATION_C99
-dnl 21 = gl_SNPRINTF_RETVAL_C99
-dnl 22 = gl_SNPRINTF_DIRECTIVE_N
-dnl 23 = gl_SNPRINTF_SIZE1
-dnl 24 = gl_VSNPRINTF_ZEROSIZE_C99
-dnl 25 = gl_SWPRINTF_WORKS
-dnl 26 = gl_SWPRINTF_DIRECTIVE_LA
-dnl 27 = gl_SWPRINTF_DIRECTIVE_LC
+dnl 17 = gl_PRINTF_FLAG_ALT_PRECISION_ZERO
+dnl 18 = gl_PRINTF_PRECISION
+dnl 19 = gl_PRINTF_ENOMEM
+dnl 20 = gl_SNPRINTF_PRESENCE
+dnl 21 = gl_SNPRINTF_TRUNCATION_C99
+dnl 22 = gl_SNPRINTF_RETVAL_C99
+dnl 23 = gl_SNPRINTF_DIRECTIVE_N
+dnl 24 = gl_SNPRINTF_SIZE1
+dnl 25 = gl_VSNPRINTF_ZEROSIZE_C99
+dnl 26 = gl_SWPRINTF_WORKS
+dnl 27 = gl_SWPRINTF_DIRECTIVE_LA
+dnl 28 = gl_SWPRINTF_DIRECTIVE_LC
 dnl
 dnl 1 = checking whether printf supports size specifiers as in C99...
 dnl 2 = checking whether printf supports size specifiers as in C23...
@@ -2111,58 +2156,59 @@ dnl 13 = checking whether printf supports POSIX/XSI format strings with position
 dnl 14 = checking whether printf supports the grouping flag...
 dnl 15 = checking whether printf supports the left-adjust flag correctly...
 dnl 16 = checking whether printf supports the zero flag correctly...
-dnl 17 = checking whether printf supports large precisions...
-dnl 18 = checking whether printf survives out-of-memory conditions...
-dnl 19 = checking for snprintf...
-dnl 20 = checking whether snprintf truncates the result as in C99...
-dnl 21 = checking whether snprintf returns a byte count as in C99...
-dnl 22 = checking whether snprintf fully supports the 'n' directive...
-dnl 23 = checking whether snprintf respects a size of 1...
-dnl 24 = checking whether vsnprintf respects a zero size as in C99...
-dnl 25 = checking whether swprintf works...
-dnl 26 = checking whether swprintf supports the 'La' and 'LA' directives...
-dnl 27 = checking whether swprintf supports the 'lc' directive...
+dnl 17 = checking whether printf supports the alternative flag with a zero precision...
+dnl 18 = checking whether printf supports large precisions...
+dnl 19 = checking whether printf survives out-of-memory conditions...
+dnl 20 = checking for snprintf...
+dnl 21 = checking whether snprintf truncates the result as in C99...
+dnl 22 = checking whether snprintf returns a byte count as in C99...
+dnl 23 = checking whether snprintf fully supports the 'n' directive...
+dnl 24 = checking whether snprintf respects a size of 1...
+dnl 25 = checking whether vsnprintf respects a zero size as in C99...
+dnl 26 = checking whether swprintf works...
+dnl 27 = checking whether swprintf supports the 'La' and 'LA' directives...
+dnl 28 = checking whether swprintf supports the 'lc' directive...
 dnl
 dnl . = yes, # = no.
 dnl
-dnl                                  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
-dnl   musl libc 1.2.3                .  #  .  .  .  .  #  #  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  #  .  #
-dnl   glibc 2.35                     .  #  .  .  .  .  .  .  .  .  .  #  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .
-dnl   glibc 2.5                      .  #  .  .  .  .  #  #  .  .  .  #  .  .  .  .  .  .  .  .  .  .  .  .  .  #  .
-dnl   glibc 2.3.6                    .  #  .  .  .  #  #  #  .  .  .  #  .  .  .  .  .  .  .  .  .  .  .  .  .  #  .
-dnl   FreeBSD 13.0                   .  #  .  .  .  #  #  #  .  .  .  #  .  .  .  .  .  #  .  .  .  .  .  .  #  .  #
-dnl   FreeBSD 5.4, 6.1               .  #  .  .  .  #  #  #  .  .  .  #  .  .  .  #  .  #  .  .  .  .  .  .  #  ?  ?
-dnl   Mac OS X 10.13.5               .  #  .  .  #  #  #  #  .  #  .  #  .  .  .  .  .  .  .  .  .  #  .  .  #  ?  ?
-dnl   Mac OS X 10.5.8                .  #  .  .  #  #  #  #  .  .  .  #  .  .  .  #  .  .  .  .  .  .  .  .  #  ?  ?
-dnl   Mac OS X 10.3.9                .  #  .  .  .  #  #  #  .  .  .  #  .  .  .  #  .  #  .  .  .  .  .  .  #  ?  ?
-dnl   OpenBSD 6.0, 6.7               .  #  .  .  .  #  #  #  .  .  .  #  .  .  .  .  .  #  .  .  .  .  .  .  #  .  #
-dnl   OpenBSD 3.9, 4.0               .  #  .  #  #  #  #  #  #  .  #  #  .  #  .  #  .  #  .  .  .  .  .  .  #  ?  ?
-dnl   Cygwin 1.7.0 (2009)            .  #  .  .  #  .  #  #  .  .  ?  ?  .  .  .  .  .  ?  .  .  .  .  .  .  ?  ?  ?
-dnl   Cygwin 1.5.25 (2008)           .  #  .  .  #  #  #  #  .  .  #  ?  .  .  .  .  .  #  .  .  .  .  .  .  ?  ?  ?
-dnl   Cygwin 1.5.19 (2006)           #  #  .  .  #  #  #  #  #  .  #  ?  .  #  .  #  #  #  .  .  .  .  .  .  ?  ?  ?
-dnl   Solaris 11.4                   .  #  .  #  #  #  #  #  .  .  #  #  .  .  .  #  .  .  .  .  .  .  .  .  .  #  .
-dnl   Solaris 11.3                   .  #  .  .  .  #  #  #  .  .  #  #  .  .  .  .  .  .  .  .  .  .  .  .  .  #  .
-dnl   Solaris 11.0                   .  #  .  #  #  #  #  #  .  .  #  #  .  .  .  #  .  .  .  .  .  .  .  .  ?  ?  ?
-dnl   Solaris 10                     .  #  .  #  #  #  #  #  .  .  #  #  .  .  .  #  #  .  .  .  .  .  .  .  .  #  .
-dnl   Solaris 2.6 ... 9              #  #  .  #  #  #  #  #  #  .  #  #  .  .  .  #  #  .  .  .  #  .  .  .  ?  ?  ?
-dnl   Solaris 2.5.1                  #  #  .  #  #  #  #  #  #  .  #  #  .  .  .  #  .  .  #  #  #  #  #  #  ?  ?  ?
-dnl   AIX 7.1                        .  #  .  #  #  #  #  #  .  .  .  #  .  .  .  #  #  .  .  .  .  .  .  .  #  .  .
-dnl   AIX 5.2                        .  #  .  #  #  #  #  #  .  .  .  #  .  .  .  #  .  .  .  .  .  .  .  .  #  ?  ?
-dnl   AIX 4.3.2, 5.1                 #  #  .  #  #  #  #  #  #  .  .  #  .  .  .  #  .  .  .  .  #  .  .  .  #  ?  ?
-dnl   HP-UX 11.31                    .  #  .  .  .  #  #  #  .  .  .  ?  .  .  .  #  .  .  .  .  #  #  .  .  ?  ?  ?
-dnl   HP-UX 11.{00,11,23}            #  #  .  .  .  #  #  #  #  .  .  ?  .  .  .  #  .  .  .  .  #  #  .  #  ?  ?  ?
-dnl   HP-UX 10.20                    #  #  .  #  .  #  #  #  #  .  ?  ?  .  .  #  #  .  .  .  .  #  #  ?  #  ?  ?  ?
-dnl   IRIX 6.5                       #  #  .  #  #  #  #  #  #  .  #  #  .  .  .  #  .  .  .  .  #  .  .  .  #  ?  ?
-dnl   OSF/1 5.1                      #  #  .  #  #  #  #  #  #  .  .  ?  .  .  .  #  .  .  .  .  #  .  .  #  ?  ?  ?
-dnl   OSF/1 4.0d                     #  #  .  #  #  #  #  #  #  .  .  ?  .  .  .  #  .  .  #  #  #  #  #  #  ?  ?  ?
-dnl   NetBSD 9.0                     .  #  .  .  .  #  #  #  .  .  .  #  .  .  .  .  .  .  .  .  .  .  .  .  #  .  #
-dnl   NetBSD 5.0                     .  #  .  .  #  #  #  #  .  .  .  #  .  .  .  #  .  #  .  .  .  .  .  .  #  ?  ?
-dnl   NetBSD 4.0                     .  #  ?  ?  ?  ?  #  #  ?  .  ?  #  .  ?  ?  ?  ?  ?  .  .  .  ?  ?  ?  #  ?  ?
-dnl   NetBSD 3.0                     .  #  .  .  .  #  #  #  #  .  ?  #  #  #  ?  #  .  #  .  .  .  .  .  .  #  ?  ?
-dnl   Haiku                          .  #  .  .  #  #  #  #  #  .  #  ?  .  .  .  .  .  ?  .  .  ?  .  .  .  .  #  .
-dnl   BeOS                           #  #  #  .  #  #  #  #  #  .  ?  ?  #  .  ?  .  #  ?  .  .  ?  .  .  .  ?  ?  ?
-dnl   Android 4.3                    .  #  .  #  #  #  #  #  #  #  #  ?  .  #  .  #  .  #  .  .  .  #  .  .  ?  ?  ?
-dnl   old mingw / msvcrt             #  #  #  #  #  #  #  #  #  .  .  ?  #  #  .  #  #  ?  .  #  #  #  .  .  #  ?  ?
-dnl   MSVC 9                         #  #  #  #  #  #  #  #  #  #  .  ?  #  #  .  #  #  ?  #  #  #  #  .  .  #  ?  ?
-dnl   mingw 2009-2011                .  #  #  .  #  .  #  #  .  .  .  ?  #  #  .  .  .  ?  .  .  .  .  .  .  #  ?  ?
-dnl   mingw-w64 2011                 #  #  #  #  #  #  #  #  #  .  .  ?  #  #  .  #  #  ?  .  #  #  #  .  .  #  ?  ?
+dnl                                  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
+dnl   musl libc 1.2.3                .  #  .  .  .  .  #  #  .  .  .  .  .  .  .  .  ?  .  .  .  .  .  .  .  .  #  .  #
+dnl   glibc 2.35                     .  #  .  .  .  .  .  .  .  .  .  #  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .
+dnl   glibc 2.5                      .  #  .  .  .  .  #  #  .  .  .  #  .  .  .  .  .  .  .  .  .  .  .  .  .  .  #  .
+dnl   glibc 2.3.6                    .  #  .  .  .  #  #  #  .  .  .  #  .  .  .  .  .  .  .  .  .  .  .  .  .  .  #  .
+dnl   FreeBSD 13.0                   .  #  .  .  .  #  #  #  .  .  .  #  .  .  .  .  .  .  #  .  .  .  .  .  .  #  .  #
+dnl   FreeBSD 5.4, 6.1               .  #  .  .  .  #  #  #  .  .  .  #  .  .  .  #  ?  .  #  .  .  .  .  .  .  #  ?  ?
+dnl   Mac OS X 10.13.5               .  #  .  .  #  #  #  #  .  #  .  #  .  .  .  .  .  .  .  .  .  .  #  .  .  #  ?  ?
+dnl   Mac OS X 10.5.8                .  #  .  .  #  #  #  #  .  .  .  #  .  .  .  #  #  .  .  .  .  .  .  .  .  #  ?  ?
+dnl   Mac OS X 10.3.9                .  #  .  .  .  #  #  #  .  .  .  #  .  .  .  #  #  .  #  .  .  .  .  .  .  #  ?  ?
+dnl   OpenBSD 6.0, 6.7               .  #  .  .  .  #  #  #  .  .  .  #  .  .  .  .  .  .  #  .  .  .  .  .  .  #  .  #
+dnl   OpenBSD 3.9, 4.0               .  #  .  #  #  #  #  #  #  .  #  #  .  #  .  #  ?  .  #  .  .  .  .  .  .  #  ?  ?
+dnl   Cygwin 1.7.0 (2009)            .  #  .  .  #  .  #  #  .  .  ?  ?  .  .  .  .  ?  .  ?  .  .  .  .  .  .  ?  ?  ?
+dnl   Cygwin 1.5.25 (2008)           .  #  .  .  #  #  #  #  .  .  #  ?  .  .  .  .  ?  .  #  .  .  .  .  .  .  ?  ?  ?
+dnl   Cygwin 1.5.19 (2006)           #  #  .  .  #  #  #  #  #  .  #  ?  .  #  .  #  ?  #  #  .  .  .  .  .  .  ?  ?  ?
+dnl   Solaris 11.4                   .  #  .  #  #  #  #  #  .  .  #  #  .  .  .  #  .  .  .  .  .  .  .  .  .  .  #  .
+dnl   Solaris 11.3                   .  #  .  .  .  #  #  #  .  .  #  #  .  .  .  .  .  .  .  .  .  .  .  .  .  .  #  .
+dnl   Solaris 11.0                   .  #  .  #  #  #  #  #  .  .  #  #  .  .  .  #  .  .  .  .  .  .  .  .  .  ?  ?  ?
+dnl   Solaris 10                     .  #  .  #  #  #  #  #  .  .  #  #  .  .  .  #  .  #  .  .  .  .  .  .  .  .  #  .
+dnl   Solaris 2.6 ... 9              #  #  .  #  #  #  #  #  #  .  #  #  .  .  .  #  ?  #  .  .  .  #  .  .  .  ?  ?  ?
+dnl   Solaris 2.5.1                  #  #  .  #  #  #  #  #  #  .  #  #  .  .  .  #  ?  .  .  #  #  #  #  #  #  ?  ?  ?
+dnl   AIX 7.1                        .  #  .  #  #  #  #  #  .  .  .  #  .  .  .  #  .  #  .  .  .  .  .  .  .  #  .  .
+dnl   AIX 5.2                        .  #  .  #  #  #  #  #  .  .  .  #  .  .  .  #  ?  .  .  .  .  .  .  .  .  #  ?  ?
+dnl   AIX 4.3.2, 5.1                 #  #  .  #  #  #  #  #  #  .  .  #  .  .  .  #  ?  .  .  .  .  #  .  .  .  #  ?  ?
+dnl   HP-UX 11.31                    .  #  .  .  .  #  #  #  .  .  .  ?  .  .  .  #  ?  .  .  .  .  #  #  .  .  ?  ?  ?
+dnl   HP-UX 11.{00,11,23}            #  #  .  .  .  #  #  #  #  .  .  ?  .  .  .  #  ?  .  .  .  .  #  #  .  #  ?  ?  ?
+dnl   HP-UX 10.20                    #  #  .  #  .  #  #  #  #  .  ?  ?  .  .  #  #  ?  .  .  .  .  #  #  ?  #  ?  ?  ?
+dnl   IRIX 6.5                       #  #  .  #  #  #  #  #  #  .  #  #  .  .  .  #  ?  .  .  .  .  #  .  .  .  #  ?  ?
+dnl   OSF/1 5.1                      #  #  .  #  #  #  #  #  #  .  .  ?  .  .  .  #  ?  .  .  .  .  #  .  .  #  ?  ?  ?
+dnl   OSF/1 4.0d                     #  #  .  #  #  #  #  #  #  .  .  ?  .  .  .  #  ?  .  .  #  #  #  #  #  #  ?  ?  ?
+dnl   NetBSD 9.0                     .  #  .  .  .  #  #  #  .  .  .  #  .  .  .  .  .  .  .  .  .  .  .  .  .  #  .  #
+dnl   NetBSD 5.0                     .  #  .  .  #  #  #  #  .  .  .  #  .  .  .  #  ?  .  #  .  .  .  .  .  .  #  ?  ?
+dnl   NetBSD 4.0                     .  #  ?  ?  ?  ?  #  #  ?  .  ?  #  .  ?  ?  ?  ?  ?  ?  .  .  .  ?  ?  ?  #  ?  ?
+dnl   NetBSD 3.0                     .  #  .  .  .  #  #  #  #  .  ?  #  #  #  ?  #  ?  .  #  .  .  .  .  .  .  #  ?  ?
+dnl   Haiku                          .  #  .  .  #  #  #  #  #  .  #  ?  .  .  .  .  ?  .  ?  .  .  ?  .  .  .  .  #  .
+dnl   BeOS                           #  #  #  .  #  #  #  #  #  .  ?  ?  #  .  ?  .  ?  #  ?  .  .  ?  .  .  .  ?  ?  ?
+dnl   Android 4.3                    .  #  .  #  #  #  #  #  #  #  #  ?  .  #  .  #  ?  .  #  .  .  .  #  .  .  ?  ?  ?
+dnl   old mingw / msvcrt             #  #  #  #  #  #  #  #  #  .  .  ?  #  #  .  #  ?  #  ?  .  #  #  #  .  .  #  ?  ?
+dnl   MSVC 9                         #  #  #  #  #  #  #  #  #  #  .  ?  #  #  .  #  ?  #  ?  #  #  #  #  .  .  #  ?  ?
+dnl   mingw 2009-2011                .  #  #  .  #  .  #  #  .  .  .  ?  #  #  .  .  ?  .  ?  .  .  .  .  .  .  #  ?  ?
+dnl   mingw-w64 2011                 #  #  #  #  #  #  #  #  #  .  .  ?  #  #  .  #  ?  #  ?  .  #  #  #  .  .  #  ?  ?
index 010ca5aea2f74372bcf9603b0beb3d74af2b5266..f15cd4b4970ebb53bc28988649d57121152e71f2 100644 (file)
@@ -1,4 +1,4 @@
-# snprintf-posix.m4 serial 18
+# snprintf-posix.m4 serial 19
 dnl Copyright (C) 2007-2023 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -33,6 +33,7 @@ AC_DEFUN([gl_FUNC_SNPRINTF_IS_POSIX],
   AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
   AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
   AC_REQUIRE([gl_PRINTF_FLAG_ZERO])
+  AC_REQUIRE([gl_PRINTF_FLAG_ALT_PRECISION_ZERO])
   AC_REQUIRE([gl_PRINTF_PRECISION])
   AC_REQUIRE([gl_PRINTF_ENOMEM])
   gl_cv_func_snprintf_posix=no
@@ -73,23 +74,27 @@ AC_DEFUN([gl_FUNC_SNPRINTF_IS_POSIX],
                                                           *yes)
                                                             case "$gl_cv_func_printf_flag_zero" in
                                                               *yes)
-                                                                case "$gl_cv_func_printf_precision" in
+                                                                case "$gl_cv_func_printf_flag_alt_precision_zero" in
                                                                   *yes)
-                                                                    case "$gl_cv_func_printf_enomem" in
+                                                                    case "$gl_cv_func_printf_precision" in
                                                                       *yes)
-                                                                        case "$gl_cv_func_snprintf_truncation_c99" in
+                                                                        case "$gl_cv_func_printf_enomem" in
                                                                           *yes)
-                                                                            case "$gl_cv_func_snprintf_retval_c99" in
+                                                                            case "$gl_cv_func_snprintf_truncation_c99" in
                                                                               *yes)
-                                                                                case "$gl_cv_func_snprintf_directive_n" in
+                                                                                case "$gl_cv_func_snprintf_retval_c99" in
                                                                                   *yes)
-                                                                                    case "$gl_cv_func_snprintf_size1" in
+                                                                                    case "$gl_cv_func_snprintf_directive_n" in
                                                                                       *yes)
-                                                                                        case "$gl_cv_func_vsnprintf_zerosize_c99" in
+                                                                                        case "$gl_cv_func_snprintf_size1" in
                                                                                           *yes)
-                                                                                            # snprintf exists and is
-                                                                                            # already POSIX compliant.
-                                                                                            gl_cv_func_snprintf_posix=yes
+                                                                                            case "$gl_cv_func_vsnprintf_zerosize_c99" in
+                                                                                              *yes)
+                                                                                                # snprintf exists and is
+                                                                                                # already POSIX compliant.
+                                                                                                gl_cv_func_snprintf_posix=yes
+                                                                                                ;;
+                                                                                            esac
                                                                                             ;;
                                                                                         esac
                                                                                         ;;
index 09a4ec8e57da90a03fb22717f3e0384d3e54a39c..cdbc81343587b5650f375d9427a81c983d7517fd 100644 (file)
@@ -1,4 +1,4 @@
-# sprintf-posix.m4 serial 16
+# sprintf-posix.m4 serial 17
 dnl Copyright (C) 2007-2023 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -33,6 +33,7 @@ AC_DEFUN([gl_FUNC_SPRINTF_IS_POSIX],
   AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
   AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
   AC_REQUIRE([gl_PRINTF_FLAG_ZERO])
+  AC_REQUIRE([gl_PRINTF_FLAG_ALT_PRECISION_ZERO])
   AC_REQUIRE([gl_PRINTF_PRECISION])
   AC_REQUIRE([gl_PRINTF_ENOMEM])
   gl_cv_func_sprintf_posix=no
@@ -66,13 +67,17 @@ AC_DEFUN([gl_FUNC_SPRINTF_IS_POSIX],
                                                         *yes)
                                                           case "$gl_cv_func_printf_flag_zero" in
                                                             *yes)
-                                                              case "$gl_cv_func_printf_precision" in
+                                                              case "$gl_cv_func_printf_flag_alt_precision_zero" in
                                                                 *yes)
-                                                                  case "$gl_cv_func_printf_enomem" in
+                                                                  case "$gl_cv_func_printf_precision" in
                                                                     *yes)
-                                                                      # sprintf exists and is
-                                                                      # already POSIX compliant.
-                                                                      gl_cv_func_sprintf_posix=yes
+                                                                      case "$gl_cv_func_printf_enomem" in
+                                                                        *yes)
+                                                                          # sprintf exists and is
+                                                                          # already POSIX compliant.
+                                                                          gl_cv_func_sprintf_posix=yes
+                                                                          ;;
+                                                                      esac
                                                                       ;;
                                                                   esac
                                                                   ;;
index f72fb510940fb4db7f2d8d5d015874cdd7899fe2..63046e16087ae8755312bc9d560d12ad53854f77 100644 (file)
@@ -1,4 +1,4 @@
-# vasnprintf-posix.m4 serial 17
+# vasnprintf-posix.m4 serial 18
 dnl Copyright (C) 2007-2023 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -32,6 +32,7 @@ AC_DEFUN_ONCE([gl_FUNC_VASNPRINTF_IS_POSIX],
   AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
   AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
   AC_REQUIRE([gl_PRINTF_FLAG_ZERO])
+  AC_REQUIRE([gl_PRINTF_FLAG_ALT_PRECISION_ZERO])
   AC_REQUIRE([gl_PRINTF_PRECISION])
   AC_REQUIRE([gl_PRINTF_ENOMEM])
   gl_cv_func_vasnprintf_posix=no
@@ -66,15 +67,19 @@ AC_DEFUN_ONCE([gl_FUNC_VASNPRINTF_IS_POSIX],
                                                         *yes)
                                                           case "$gl_cv_func_printf_flag_zero" in
                                                             *yes)
-                                                              case "$gl_cv_func_printf_precision" in
+                                                              case "$gl_cv_func_printf_flag_alt_precision_zero" in
                                                                 *yes)
-                                                                  case "$gl_cv_func_printf_enomem" in
+                                                                  case "$gl_cv_func_printf_precision" in
                                                                     *yes)
-                                                                      if test $ac_cv_func_vasnprintf = yes; then
-                                                                        # vasnprintf exists and is
-                                                                        # already POSIX compliant.
-                                                                        gl_cv_func_vasnprintf_posix=yes
-                                                                      fi
+                                                                      case "$gl_cv_func_printf_enomem" in
+                                                                        *yes)
+                                                                          if test $ac_cv_func_vasnprintf = yes; then
+                                                                            # vasnprintf exists and is
+                                                                            # already POSIX compliant.
+                                                                            gl_cv_func_vasnprintf_posix=yes
+                                                                          fi
+                                                                          ;;
+                                                                      esac
                                                                       ;;
                                                                   esac
                                                                   ;;
index df87b9e798601b2e71750fcb3f3efac000b98219..77da78218871e3f2348a72393150e015daf9ae39 100644 (file)
@@ -1,4 +1,4 @@
-# vasnprintf.m4 serial 50
+# vasnprintf.m4 serial 51
 dnl Copyright (C) 2002-2004, 2006-2023 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -367,6 +367,22 @@ AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_ZERO],
   esac
 ])
 
+# Extra prerequisites of lib/vasnprintf.c for supporting the # flag with a
+# zero precision and a zero value in the 'x' and 'X' directives.
+AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_ALT_PRECISION_ZERO],
+[
+  AC_REQUIRE([gl_PRINTF_FLAG_ALT_PRECISION_ZERO])
+  case "$gl_cv_func_printf_flag_alt_precision_zero" in
+    *yes)
+      ;;
+    *)
+      AC_DEFINE([NEED_PRINTF_FLAG_ALT_PRECISION_ZERO], [1],
+        [Define if the vasnprintf implementation needs special code for the
+         # flag with a zero precision and a zero value in the 'x' and 'X' directives.])
+      ;;
+  esac
+])
+
 # Extra prerequisites of lib/vasnprintf.c for supporting large precisions.
 AC_DEFUN([gl_PREREQ_VASNPRINTF_PRECISION],
 [
@@ -425,6 +441,7 @@ AC_DEFUN([gl_PREREQ_VASNPRINTF_WITH_POSIX_EXTRAS],
   gl_PREREQ_VASNPRINTF_FLAG_GROUPING
   gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST
   gl_PREREQ_VASNPRINTF_FLAG_ZERO
+  gl_PREREQ_VASNPRINTF_FLAG_ALT_PRECISION_ZERO
   gl_PREREQ_VASNPRINTF_PRECISION
   gl_PREREQ_VASNPRINTF_ENOMEM
 ])
index 3c7a6540bd10bc23e96388c59bc59544e6b1ac30..09d306d01d2ac10a17a85b3a35937f5e0bf0363a 100644 (file)
@@ -1,4 +1,4 @@
-# vasprintf-posix.m4 serial 17
+# vasprintf-posix.m4 serial 18
 dnl Copyright (C) 2007-2023 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -33,6 +33,7 @@ AC_DEFUN([gl_FUNC_VASPRINTF_IS_POSIX],
   AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
   AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
   AC_REQUIRE([gl_PRINTF_FLAG_ZERO])
+  AC_REQUIRE([gl_PRINTF_FLAG_ALT_PRECISION_ZERO])
   AC_REQUIRE([gl_PRINTF_PRECISION])
   AC_REQUIRE([gl_PRINTF_ENOMEM])
   gl_cv_func_vasprintf_posix=no
@@ -67,15 +68,19 @@ AC_DEFUN([gl_FUNC_VASPRINTF_IS_POSIX],
                                                         *yes)
                                                           case "$gl_cv_func_printf_flag_zero" in
                                                             *yes)
-                                                              case "$gl_cv_func_printf_precision" in
+                                                              case "$gl_cv_func_printf_flag_alt_precision_zero" in
                                                                 *yes)
-                                                                  case "$gl_cv_func_printf_enomem" in
+                                                                  case "$gl_cv_func_printf_precision" in
                                                                     *yes)
-                                                                      if test $ac_cv_func_vasprintf = yes; then
-                                                                        # vasprintf exists and is
-                                                                        # already POSIX compliant.
-                                                                        gl_cv_func_vasprintf_posix=yes
-                                                                      fi
+                                                                      case "$gl_cv_func_printf_enomem" in
+                                                                        *yes)
+                                                                          if test $ac_cv_func_vasprintf = yes; then
+                                                                            # vasprintf exists and is
+                                                                            # already POSIX compliant.
+                                                                            gl_cv_func_vasprintf_posix=yes
+                                                                          fi
+                                                                          ;;
+                                                                      esac
                                                                       ;;
                                                                   esac
                                                                   ;;
index e4b57924cd9e99685be3dbfd5b6098393b5927ba..57d3b234837878e6245814d1b7b1a4d61fe42dda 100644 (file)
@@ -1,4 +1,4 @@
-# vdprintf-posix.m4 serial 7
+# vdprintf-posix.m4 serial 8
 dnl Copyright (C) 2007-2023 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -33,6 +33,7 @@ AC_DEFUN([gl_FUNC_VDPRINTF_IS_POSIX],
   AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
   AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
   AC_REQUIRE([gl_PRINTF_FLAG_ZERO])
+  AC_REQUIRE([gl_PRINTF_FLAG_ALT_PRECISION_ZERO])
   AC_REQUIRE([gl_PRINTF_PRECISION])
   AC_REQUIRE([gl_PRINTF_ENOMEM])
   gl_cv_func_vdprintf_posix=no
@@ -68,13 +69,17 @@ AC_DEFUN([gl_FUNC_VDPRINTF_IS_POSIX],
                                                           *yes)
                                                             case "$gl_cv_func_printf_flag_zero" in
                                                               *yes)
-                                                                case "$gl_cv_func_printf_precision" in
+                                                                case "$gl_cv_func_printf_flag_alt_precision_zero" in
                                                                   *yes)
-                                                                    case "$gl_cv_func_printf_enomem" in
+                                                                    case "$gl_cv_func_printf_precision" in
                                                                       *yes)
-                                                                        # vdprintf exists and is
-                                                                        # already POSIX compliant.
-                                                                        gl_cv_func_vdprintf_posix=yes
+                                                                        case "$gl_cv_func_printf_enomem" in
+                                                                          *yes)
+                                                                            # vdprintf exists and is
+                                                                            # already POSIX compliant.
+                                                                            gl_cv_func_vdprintf_posix=yes
+                                                                            ;;
+                                                                        esac
                                                                         ;;
                                                                     esac
                                                                     ;;
index 6b51c50adab4b4591a357f176d5a32b7555f1de8..063bb86a405a9400522c88a5ea15a8da7d96bd69 100644 (file)
@@ -1,4 +1,4 @@
-# vfprintf-posix.m4 serial 18
+# vfprintf-posix.m4 serial 19
 dnl Copyright (C) 2007-2023 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -33,6 +33,7 @@ AC_DEFUN([gl_FUNC_VFPRINTF_IS_POSIX],
   AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
   AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
   AC_REQUIRE([gl_PRINTF_FLAG_ZERO])
+  AC_REQUIRE([gl_PRINTF_FLAG_ALT_PRECISION_ZERO])
   AC_REQUIRE([gl_PRINTF_PRECISION])
   AC_REQUIRE([gl_PRINTF_ENOMEM])
   gl_cv_func_vfprintf_posix=no
@@ -66,13 +67,17 @@ AC_DEFUN([gl_FUNC_VFPRINTF_IS_POSIX],
                                                         *yes)
                                                           case "$gl_cv_func_printf_flag_zero" in
                                                             *yes)
-                                                              case "$gl_cv_func_printf_precision" in
+                                                              case "$gl_cv_func_printf_flag_alt_precision_zero" in
                                                                 *yes)
-                                                                  case "$gl_cv_func_printf_enomem" in
+                                                                  case "$gl_cv_func_printf_precision" in
                                                                     *yes)
-                                                                      # vfprintf exists and is
-                                                                      # already POSIX compliant.
-                                                                      gl_cv_func_vfprintf_posix=yes
+                                                                      case "$gl_cv_func_printf_enomem" in
+                                                                        *yes)
+                                                                          # vfprintf exists and is
+                                                                          # already POSIX compliant.
+                                                                          gl_cv_func_vfprintf_posix=yes
+                                                                          ;;
+                                                                      esac
                                                                       ;;
                                                                   esac
                                                                   ;;
index b47715c472d11d0c8ccdb0517b3c401fb714a1d4..005fa1859f522f91874f9086c28b293430699d99 100644 (file)
@@ -1,4 +1,4 @@
-# vsnprintf-posix.m4 serial 19
+# vsnprintf-posix.m4 serial 20
 dnl Copyright (C) 2007-2023 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -33,6 +33,7 @@ AC_DEFUN([gl_FUNC_VSNPRINTF_IS_POSIX],
   AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
   AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
   AC_REQUIRE([gl_PRINTF_FLAG_ZERO])
+  AC_REQUIRE([gl_PRINTF_FLAG_ALT_PRECISION_ZERO])
   AC_REQUIRE([gl_PRINTF_PRECISION])
   AC_REQUIRE([gl_PRINTF_ENOMEM])
   gl_cv_func_vsnprintf_posix=no
@@ -74,23 +75,27 @@ AC_DEFUN([gl_FUNC_VSNPRINTF_IS_POSIX],
                                                           *yes)
                                                             case "$gl_cv_func_printf_flag_zero" in
                                                               *yes)
-                                                                case "$gl_cv_func_printf_precision" in
+                                                                case "$gl_cv_func_printf_flag_alt_precision_zero" in
                                                                   *yes)
-                                                                    case "$gl_cv_func_printf_enomem" in
+                                                                    case "$gl_cv_func_printf_precision" in
                                                                       *yes)
-                                                                        case "$gl_cv_func_snprintf_truncation_c99" in
+                                                                        case "$gl_cv_func_printf_enomem" in
                                                                           *yes)
-                                                                            case "$gl_cv_func_snprintf_retval_c99" in
+                                                                            case "$gl_cv_func_snprintf_truncation_c99" in
                                                                               *yes)
-                                                                                case "$gl_cv_func_snprintf_directive_n" in
+                                                                                case "$gl_cv_func_snprintf_retval_c99" in
                                                                                   *yes)
-                                                                                    case "$gl_cv_func_snprintf_size1" in
+                                                                                    case "$gl_cv_func_snprintf_directive_n" in
                                                                                       *yes)
-                                                                                        case "$gl_cv_func_vsnprintf_zerosize_c99" in
+                                                                                        case "$gl_cv_func_snprintf_size1" in
                                                                                           *yes)
-                                                                                            # vsnprintf exists and is
-                                                                                            # already POSIX compliant.
-                                                                                            gl_cv_func_vsnprintf_posix=yes
+                                                                                            case "$gl_cv_func_vsnprintf_zerosize_c99" in
+                                                                                              *yes)
+                                                                                                # vsnprintf exists and is
+                                                                                                # already POSIX compliant.
+                                                                                                gl_cv_func_vsnprintf_posix=yes
+                                                                                                ;;
+                                                                                            esac
                                                                                             ;;
                                                                                         esac
                                                                                         ;;
index 57c3dd98f8d6c0de3c2c1ee9cf03bc8f4afbdb47..0e131a2afa781a24686135c23bbb7b85ef2ac1fb 100644 (file)
@@ -1,4 +1,4 @@
-# vsprintf-posix.m4 serial 16
+# vsprintf-posix.m4 serial 17
 dnl Copyright (C) 2007-2023 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -33,6 +33,7 @@ AC_DEFUN([gl_FUNC_VSPRINTF_IS_POSIX],
   AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
   AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
   AC_REQUIRE([gl_PRINTF_FLAG_ZERO])
+  AC_REQUIRE([gl_PRINTF_FLAG_ALT_PRECISION_ZERO])
   AC_REQUIRE([gl_PRINTF_PRECISION])
   AC_REQUIRE([gl_PRINTF_ENOMEM])
   gl_cv_func_vsprintf_posix=no
@@ -66,13 +67,17 @@ AC_DEFUN([gl_FUNC_VSPRINTF_IS_POSIX],
                                                         *yes)
                                                           case "$gl_cv_func_printf_flag_zero" in
                                                             *yes)
-                                                              case "$gl_cv_func_printf_precision" in
+                                                              case "$gl_cv_func_printf_flag_alt_precision_zero" in
                                                                 *yes)
-                                                                  case "$gl_cv_func_printf_enomem" in
+                                                                  case "$gl_cv_func_printf_precision" in
                                                                     *yes)
-                                                                      # vsprintf exists and is
-                                                                      # already POSIX compliant.
-                                                                      gl_cv_func_vsprintf_posix=yes
+                                                                      case "$gl_cv_func_printf_enomem" in
+                                                                        *yes)
+                                                                          # vsprintf exists and is
+                                                                          # already POSIX compliant.
+                                                                          gl_cv_func_vsprintf_posix=yes
+                                                                          ;;
+                                                                      esac
                                                                       ;;
                                                                   esac
                                                                   ;;