+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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
{
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
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)
{
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)
#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 \
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;
#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
}
#endif
-#if NEED_PRINTF_UNBOUNDED_PRECISION
+#if NEED_PRINTF_FLAG_ALT_PRECISION_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
if (prec_ourselves)
{
/* Handle the precision. */
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
/* 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;
-# 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,
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
*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
;;
-# 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,
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
*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
;;
-# 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,
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
*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
;;
-# 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,
])
])
+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
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...
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 # # # # # # # # # . . ? # # . # ? # ? . # # # . . # ? ?
-# 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,
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
*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
;;
-# 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,
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
*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
;;
-# 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,
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
*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
;;
-# 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,
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],
[
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
])
-# 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,
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
*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
;;
-# 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,
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
*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
;;
-# 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,
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
*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
;;
-# 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,
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
*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
;;
-# 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,
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
*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
;;