* m4/printf-with-n-directive.m4: New file.
* modules/printf-with-n-directive: New file.
* m4/dprintf-posix.m4 (gl_FUNC_DPRINTF_IS_POSIX): If
gl_PRINTF_SUPPORT_N_DIRECTIVE is not defined, ignore the value of the
gl_cv_func_printf_directive_n variable.
* m4/fprintf-posix.m4 (gl_FUNC_FPRINTF_IS_POSIX): Likewise.
* m4/obstack-printf-posix.m4 (gl_FUNC_OBSTACK_PRINTF_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/vsprintf-posix.m4 (gl_FUNC_VSPRINTF_IS_POSIX): Likewise.
* m4/snprintf-posix.m4 (gl_FUNC_SNPRINTF_IS_POSIX): If
gl_PRINTF_SUPPORT_N_DIRECTIVE is not defined, ignore the values of the
gl_cv_func_printf_directive_n and gl_cv_func_snprintf_directive_n
variables.
* m4/vsnprintf-posix.m4 (gl_FUNC_VSNPRINTF_IS_POSIX): Likewise.
* lib/printf-parse.c (PRINTF_PARSE): If NEED_PRINTF_WITH_N_DIRECTIVE is
not defined, treat the 'n' directive like an unknown directive.
* lib/vasnprintf.c (VASNPRINTF): If NEED_PRINTF_WITH_N_DIRECTIVE is not
defined, disable the processing of the 'n' directive.
* tests/test-snprintf-posix.h (test_function): If
NEED_PRINTF_WITH_N_DIRECTIVE is not defined, skip the %n test.
* tests/test-sprintf-posix.h (test_function): Likewise.
* tests/test-vasnprintf-posix.c (test_function): Likewise.
* tests/test-vasnwprintf-posix.c (test_function): Likewise.
* tests/test-vasprintf-posix.c (test_function): Likewise.
* doc/posix-functions/dprintf.texi: Mention that support for the 'n'
directive is only enabled together with the module
'printf-with-n-directive'.
* doc/posix-functions/fprintf.texi: Likewise.
* doc/posix-functions/printf.texi: Likewise.
* doc/posix-functions/snprintf.texi: Likewise.
* doc/posix-functions/sprintf.texi: Likewise.
* doc/posix-functions/vdprintf.texi: Likewise.
* doc/posix-functions/vfprintf.texi: Likewise.
* doc/posix-functions/vprintf.texi: Likewise.
* doc/posix-functions/vsnprintf.texi: Likewise.
* doc/posix-functions/vsprintf.texi: Likewise.
* doc/glibc-functions/obstack_printf.texi: Likewise.
* doc/glibc-functions/obstack_vprintf.texi: Likewise.
* NEWS: Mention the change.
+2024-02-21 Bruno Haible <bruno@clisp.org>
+
+ *printf-posix: Disable support for the 'n' directive by default.
+ * m4/printf-with-n-directive.m4: New file.
+ * modules/printf-with-n-directive: New file.
+ * m4/dprintf-posix.m4 (gl_FUNC_DPRINTF_IS_POSIX): If
+ gl_PRINTF_SUPPORT_N_DIRECTIVE is not defined, ignore the value of the
+ gl_cv_func_printf_directive_n variable.
+ * m4/fprintf-posix.m4 (gl_FUNC_FPRINTF_IS_POSIX): Likewise.
+ * m4/obstack-printf-posix.m4 (gl_FUNC_OBSTACK_PRINTF_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/vsprintf-posix.m4 (gl_FUNC_VSPRINTF_IS_POSIX): Likewise.
+ * m4/snprintf-posix.m4 (gl_FUNC_SNPRINTF_IS_POSIX): If
+ gl_PRINTF_SUPPORT_N_DIRECTIVE is not defined, ignore the values of the
+ gl_cv_func_printf_directive_n and gl_cv_func_snprintf_directive_n
+ variables.
+ * m4/vsnprintf-posix.m4 (gl_FUNC_VSNPRINTF_IS_POSIX): Likewise.
+ * lib/printf-parse.c (PRINTF_PARSE): If NEED_PRINTF_WITH_N_DIRECTIVE is
+ not defined, treat the 'n' directive like an unknown directive.
+ * lib/vasnprintf.c (VASNPRINTF): If NEED_PRINTF_WITH_N_DIRECTIVE is not
+ defined, disable the processing of the 'n' directive.
+ * tests/test-snprintf-posix.h (test_function): If
+ NEED_PRINTF_WITH_N_DIRECTIVE is not defined, skip the %n test.
+ * tests/test-sprintf-posix.h (test_function): Likewise.
+ * tests/test-vasnprintf-posix.c (test_function): Likewise.
+ * tests/test-vasnwprintf-posix.c (test_function): Likewise.
+ * tests/test-vasprintf-posix.c (test_function): Likewise.
+ * doc/posix-functions/dprintf.texi: Mention that support for the 'n'
+ directive is only enabled together with the module
+ 'printf-with-n-directive'.
+ * doc/posix-functions/fprintf.texi: Likewise.
+ * doc/posix-functions/printf.texi: Likewise.
+ * doc/posix-functions/snprintf.texi: Likewise.
+ * doc/posix-functions/sprintf.texi: Likewise.
+ * doc/posix-functions/vdprintf.texi: Likewise.
+ * doc/posix-functions/vfprintf.texi: Likewise.
+ * doc/posix-functions/vprintf.texi: Likewise.
+ * doc/posix-functions/vsnprintf.texi: Likewise.
+ * doc/posix-functions/vsprintf.texi: Likewise.
+ * doc/glibc-functions/obstack_printf.texi: Likewise.
+ * doc/glibc-functions/obstack_vprintf.texi: Likewise.
+ * NEWS: Mention the change.
+
2024-02-21 Bruno Haible <bruno@clisp.org>
*printf-posix: Avoid crash in another configure test.
Date Modules Changes
+2024-02-21 *printf-posix These modules no longer support the 'n' directive
+ by default. In order to keep the 'n' directive
+ enabled, you need to additionally request the
+ module 'printf-with-n-directive'.
+
2024-02-09 strftime This module, deprecated on 2017-07-23, is removed.
Use module 'nstrftime' instead.
2009-06-25 fpurge The include file is changed from "fpurge.h" to
<stdio.h>.
-2009-04-26 modules/uniconv/u8-conv-from-enc
- modules/uniconv/u16-conv-from-enc
- modules/uniconv/u32-conv-from-enc
+2009-04-26 uniconv/u8-conv-from-enc
+ uniconv/u16-conv-from-enc
+ uniconv/u32-conv-from-enc
The calling convention of the functions
u*_conv_from_encoding is changed.
-2009-04-26 modules/uniconv/u8-conv-to-enc
- modules/uniconv/u16-conv-to-enc
- modules/uniconv/u32-conv-to-enc
+2009-04-26 uniconv/u8-conv-to-enc
+ uniconv/u16-conv-to-enc
+ uniconv/u32-conv-to-enc
The calling convention of the functions
u*_conv_to_encoding is changed.
NetBSD 3.0, AIX 5.1, HP-UX 11.23, IRIX 6.5, Solaris 9,
Cygwin 1.5.x, mingw, MSVC 14.
@item
-This function does not support the @samp{n} directive on some platforms:
-MSVC 14.
-@item
This function does not support the @samp{ls} directive on some platforms:
OpenBSD 4.0, IRIX 6.5, Cygwin 1.5.x, Haiku.
@item
@item
This function can crash in out-of-memory conditions on some platforms:
FreeBSD 14.0, NetBSD 5.0.
-@item
-This function does not fully support the @samp{n} directive on some platforms:
-HP-UX 11, mingw, MSVC 14.
@end itemize
Portability problems fixed by Gnulib module @code{obstack-printf-gnu}:
glibc 2.34, FreeBSD 13.2, NetBSD 9.0, OpenBSD 7.2, macOS 12.5, AIX 7.2, Solaris 11.4, and others.
@end itemize
+Portability problems fixed by either Gnulib module @code{obstack-printf-posix} or @code{obstack-printf-gnu}
+and additionally the Gnulib module @code{printf-with-n-directive}:
+@itemize
+@item
+This function does not support the @samp{n} directive on some platforms:
+MSVC 14.
+@item
+This function does not fully support the @samp{n} directive on some platforms:
+HP-UX 11, mingw, MSVC 14.
+@end itemize
+
Portability problems not fixed by Gnulib:
@itemize
@item
NetBSD 3.0, AIX 5.1, HP-UX 11.23, IRIX 6.5, Solaris 9,
Cygwin 1.5.x, mingw, MSVC 14.
@item
-This function does not support the @samp{n} directive on some platforms:
-MSVC 14.
-@item
This function does not support the @samp{ls} directive on some platforms:
OpenBSD 4.0, IRIX 6.5, Cygwin 1.5.x, Haiku.
@item
@item
This function can crash in out-of-memory conditions on some platforms:
FreeBSD 14.0, NetBSD 5.0.
-@item
-This function does not fully support the @samp{n} directive on some platforms:
-HP-UX 11, mingw, MSVC 14.
@end itemize
Portability problems fixed by Gnulib module @code{obstack-printf-gnu}:
glibc 2.34, FreeBSD 13.2, NetBSD 9.0, OpenBSD 7.2, macOS 12.5, AIX 7.2, Solaris 11.4, and others.
@end itemize
+Portability problems fixed by either Gnulib module @code{obstack-printf-posix} or @code{obstack-printf-gnu}
+and additionally the Gnulib module @code{printf-with-n-directive}:
+@itemize
+@item
+This function does not support the @samp{n} directive on some platforms:
+MSVC 14.
+@item
+This function does not fully support the @samp{n} directive on some platforms:
+HP-UX 11, mingw, MSVC 14.
+@end itemize
+
Portability problems not fixed by Gnulib:
@itemize
@item
glibc 2.34, musl libc, macOS 12.5, FreeBSD 13.2, NetBSD 9.0, OpenBSD 7.2,
AIX 7.2, Solaris 11.4, Cygwin 2.9.0.
@item
-This function does not support the @samp{n} directive on some platforms:
-glibc when used with @code{_FORTIFY_SOURCE >= 2} (set by default on Ubuntu),
-Android, OpenBSD, macOS 11.1.
-@item
This function does not support precisions in the @samp{ls} directive correctly
on some platforms:
Solaris 11.4.
glibc 2.34, FreeBSD 13.2, NetBSD 9.0, OpenBSD 7.2, macOS 12.5, AIX 7.2, Solaris 11.4, and others.
@end itemize
+Portability problems fixed by either Gnulib module @code{dprintf-posix} or @code{dprintf-gnu}
+and additionally the Gnulib module @code{printf-with-n-directive}:
+@itemize
+@item
+This function does not support the @samp{n} directive on some platforms:
+glibc when used with @code{_FORTIFY_SOURCE >= 2} (set by default on Ubuntu),
+Android, OpenBSD, macOS 11.1.
+@end itemize
+
Portability problems not fixed by Gnulib:
@itemize
@item
NetBSD 3.0, AIX 5.1, HP-UX 11.23, IRIX 6.5, Solaris 9,
Cygwin 1.5.x, mingw, MSVC 14.
@item
-This function does not support the @samp{n} directive on some platforms:
-glibc when used with @code{_FORTIFY_SOURCE >= 2} (set by default on Ubuntu),
-Android, OpenBSD, macOS 11.1, MSVC 14.
-@item
This function does not support the @samp{ls} directive on some platforms:
OpenBSD 4.0, IRIX 6.5, Cygwin 1.5.x, Haiku.
@item
glibc 2.34, FreeBSD 13.2, NetBSD 9.0, OpenBSD 7.2, macOS 12.5, AIX 7.2, Solaris 11.4, and others.
@end itemize
+Portability problems fixed by either Gnulib module @code{fprintf-posix} or @code{fprintf-gnu}
+and additionally the Gnulib module @code{printf-with-n-directive}:
+@itemize
+@item
+This function does not support the @samp{n} directive on some platforms:
+glibc when used with @code{_FORTIFY_SOURCE >= 2} (set by default on Ubuntu),
+Android, OpenBSD, macOS 11.1, MSVC 14.
+@end itemize
+
Portability problems fixed by Gnulib module @code{stdio} or @code{fprintf-posix} or @code{fprintf-gnu}, together with module @code{nonblocking}:
@itemize
@item
NetBSD 3.0, AIX 5.1, HP-UX 11.23, IRIX 6.5, Solaris 9,
Cygwin 1.5.x, mingw, MSVC 14.
@item
-This function does not support the @samp{n} directive on some platforms:
-glibc when used with @code{_FORTIFY_SOURCE >= 2} (set by default on Ubuntu),
-Android, OpenBSD, macOS 11.1, MSVC 14.
-@item
This function does not support the @samp{ls} directive on some platforms:
OpenBSD 4.0, IRIX 6.5, Cygwin 1.5.x, Haiku.
@item
glibc 2.34, FreeBSD 13.2, NetBSD 9.0, OpenBSD 7.2, macOS 12.5, AIX 7.2, Solaris 11.4, and others.
@end itemize
+Portability problems fixed by either Gnulib module @code{printf-posix} or @code{printf-gnu}
+and additionally the Gnulib module @code{printf-with-n-directive}:
+@itemize
+@item
+This function does not support the @samp{n} directive on some platforms:
+glibc when used with @code{_FORTIFY_SOURCE >= 2} (set by default on Ubuntu),
+Android, OpenBSD, macOS 11.1, MSVC 14.
+@end itemize
+
Portability problems fixed by Gnulib module @code{stdio} or @code{printf-posix} or @code{printf-gnu}, together with module @code{nonblocking}:
@itemize
@item
NetBSD 3.0, AIX 5.1, HP-UX 11.23, IRIX 6.5, Solaris 9,
Cygwin 1.5.x, mingw, MSVC 14.
@item
-This function does not support the @samp{n} directive on some platforms:
-glibc when used with @code{_FORTIFY_SOURCE >= 2} (set by default on Ubuntu),
-Android, OpenBSD, macOS 11.1, MSVC 14.
-@item
This function does not support the @samp{ls} directive on some platforms:
OpenBSD 4.0, IRIX 6.5, Cygwin 1.5.x, Haiku.
@item
glibc 2.34, FreeBSD 13.2, NetBSD 9.0, OpenBSD 7.2, macOS 12.5, AIX 7.2, Solaris 11.4, and others.
@end itemize
+Portability problems fixed by either Gnulib module @code{snprintf-posix} or @code{snprintf-gnu}
+and additionally the Gnulib module @code{printf-with-n-directive}:
+@itemize
+@item
+This function does not support the @samp{n} directive on some platforms:
+glibc when used with @code{_FORTIFY_SOURCE >= 2} (set by default on Ubuntu),
+Android, OpenBSD, macOS 11.1, MSVC 14.
+@end itemize
+
Portability problems not fixed by Gnulib:
@itemize
@item
NetBSD 3.0, AIX 5.1, HP-UX 11.23, IRIX 6.5, Solaris 9,
Cygwin 1.5.x, mingw, MSVC 14.
@item
-This function does not support the @samp{n} directive on some platforms:
-glibc when used with @code{_FORTIFY_SOURCE >= 2} (set by default on Ubuntu),
-Android, OpenBSD, macOS 11.1, MSVC 14.
-@item
This function does not support the @samp{ls} directive on some platforms:
OpenBSD 4.0, IRIX 6.5, Cygwin 1.5.x, Haiku.
@item
glibc 2.34, FreeBSD 13.2, NetBSD 9.0, OpenBSD 7.2, macOS 12.5, AIX 7.2, Solaris 11.4, and others.
@end itemize
+Portability problems fixed by either Gnulib module @code{sprintf-posix} or @code{sprintf-gnu}
+and additionally the Gnulib module @code{printf-with-n-directive}:
+@itemize
+@item
+This function does not support the @samp{n} directive on some platforms:
+glibc when used with @code{_FORTIFY_SOURCE >= 2} (set by default on Ubuntu),
+Android, OpenBSD, macOS 11.1, MSVC 14.
+@end itemize
+
Portability problems not fixed by Gnulib:
@itemize
@item
glibc 2.34, musl libc, macOS 12.5, FreeBSD 13.2, NetBSD 9.0, OpenBSD 7.2,
AIX 7.2, Solaris 11.4, Cygwin 2.9.0.
@item
-This function does not support the @samp{n} directive on some platforms:
-glibc when used with @code{_FORTIFY_SOURCE >= 2} (set by default on Ubuntu),
-Android, OpenBSD, macOS 11.1.
-@item
This function does not support precisions in the @samp{ls} directive correctly
on some platforms:
Solaris 11.4.
glibc 2.34, FreeBSD 13.2, NetBSD 9.0, OpenBSD 7.2, macOS 12.5, AIX 7.2, Solaris 11.4, and others.
@end itemize
+Portability problems fixed by either Gnulib module @code{vdprintf-posix} or @code{vdprintf-gnu}
+and additionally the Gnulib module @code{printf-with-n-directive}:
+@itemize
+@item
+This function does not support the @samp{n} directive on some platforms:
+glibc when used with @code{_FORTIFY_SOURCE >= 2} (set by default on Ubuntu),
+Android, OpenBSD, macOS 11.1.
+@end itemize
+
Portability problems not fixed by Gnulib:
@itemize
@item
NetBSD 3.0, AIX 5.1, HP-UX 11.23, IRIX 6.5, Solaris 9,
Cygwin 1.5.x, mingw, MSVC 14.
@item
-This function does not support the @samp{n} directive on some platforms:
-glibc when used with @code{_FORTIFY_SOURCE >= 2} (set by default on Ubuntu),
-Android, OpenBSD, macOS 11.1, MSVC 14.
-@item
This function does not support the @samp{ls} directive on some platforms:
OpenBSD 4.0, IRIX 6.5, Cygwin 1.5.x, Haiku.
@item
glibc 2.34, FreeBSD 13.2, NetBSD 9.0, OpenBSD 7.2, macOS 12.5, AIX 7.2, Solaris 11.4, and others.
@end itemize
+Portability problems fixed by either Gnulib module @code{vfprintf-posix} or @code{vfprintf-gnu}
+and additionally the Gnulib module @code{printf-with-n-directive}:
+@itemize
+@item
+This function does not support the @samp{n} directive on some platforms:
+glibc when used with @code{_FORTIFY_SOURCE >= 2} (set by default on Ubuntu),
+Android, OpenBSD, macOS 11.1, MSVC 14.
+@end itemize
+
Portability problems fixed by Gnulib module @code{stdio} or @code{vfprintf-posix} or @code{vfprintf-gnu}, together with module @code{nonblocking}:
@itemize
@item
NetBSD 3.0, AIX 5.1, HP-UX 11.23, IRIX 6.5, Solaris 9,
Cygwin 1.5.x, mingw, MSVC 14.
@item
-This function does not support the @samp{n} directive on some platforms:
-glibc when used with @code{_FORTIFY_SOURCE >= 2} (set by default on Ubuntu),
-Android, OpenBSD, macOS 11.1, MSVC 14.
-@item
This function does not support the @samp{ls} directive on some platforms:
OpenBSD 4.0, IRIX 6.5, Cygwin 1.5.x, Haiku.
@item
glibc 2.34, FreeBSD 13.2, NetBSD 9.0, OpenBSD 7.2, macOS 12.5, AIX 7.2, Solaris 11.4, and others.
@end itemize
+Portability problems fixed by either Gnulib module @code{vprintf-posix} or @code{vprintf-gnu}
+and additionally the Gnulib module @code{printf-with-n-directive}:
+@itemize
+@item
+This function does not support the @samp{n} directive on some platforms:
+glibc when used with @code{_FORTIFY_SOURCE >= 2} (set by default on Ubuntu),
+Android, OpenBSD, macOS 11.1, MSVC 14.
+@end itemize
+
Portability problems fixed by Gnulib module @code{stdio} or @code{vprintf-posix} or @code{vprintf-gnu}, together with module @code{nonblocking}:
@itemize
@item
This function does not truncate the result as specified in C99 on some platforms:
mingw, MSVC 14.
@item
-This function does not fully support the @samp{n} directive on some platforms:
-glibc when used with @code{_FORTIFY_SOURCE >= 2} (set by default on Ubuntu),
-Android, OpenBSD, macOS 11.1, HP-UX 11, mingw, MSVC 14.
-@item
This function overwrites memory even when a zero size argument is passed on some
platforms:
HP-UX 11.
glibc 2.34, FreeBSD 13.2, NetBSD 9.0, OpenBSD 7.2, macOS 12.5, AIX 7.2, Solaris 11.4, and others.
@end itemize
+Portability problems fixed by either Gnulib module @code{vsnprintf-posix} or @code{vsnprintf-gnu}
+and additionally the Gnulib module @code{printf-with-n-directive}:
+@itemize
+@item
+This function does not fully support the @samp{n} directive on some platforms:
+glibc when used with @code{_FORTIFY_SOURCE >= 2} (set by default on Ubuntu),
+Android, OpenBSD, macOS 11.1, HP-UX 11, mingw, MSVC 14.
+@end itemize
+
Portability problems not fixed by Gnulib:
@itemize
@item
NetBSD 3.0, AIX 5.1, HP-UX 11.23, IRIX 6.5, Solaris 9,
Cygwin 1.5.x, mingw, MSVC 14.
@item
-This function does not support the @samp{n} directive on some platforms:
-glibc when used with @code{_FORTIFY_SOURCE >= 2} (set by default on Ubuntu),
-Android, OpenBSD, macOS 11.1, MSVC 14.
-@item
This function does not support the @samp{ls} directive on some platforms:
OpenBSD 4.0, IRIX 6.5, Cygwin 1.5.x, Haiku.
@item
glibc 2.34, FreeBSD 13.2, NetBSD 9.0, OpenBSD 7.2, macOS 12.5, AIX 7.2, Solaris 11.4, and others.
@end itemize
+Portability problems fixed by either Gnulib module @code{vsprintf-posix} or @code{vsprintf-gnu}
+and additionally the Gnulib module @code{printf-with-n-directive}:
+@itemize
+@item
+This function does not support the @samp{n} directive on some platforms:
+glibc when used with @code{_FORTIFY_SOURCE >= 2} (set by default on Ubuntu),
+Android, OpenBSD, macOS 11.1, MSVC 14.
+@end itemize
+
Portability problems not fixed by Gnulib:
@itemize
@item
cp += 3;
}
#endif
+ (void) pointer_type;
/* Read the conversion character. */
c = *cp++;
case 'p':
type = TYPE_POINTER;
break;
+#if NEED_PRINTF_WITH_N_DIRECTIVE
case 'n':
type = pointer_type;
break;
+#endif
#if ENABLE_UNISTDIO
/* The unistdio extensions. */
case 'U':
if (dp->conversion == 'n')
{
+#if NEED_PRINTF_WITH_N_DIRECTIVE
switch (a.arg[dp->arg_index].type)
{
case TYPE_COUNT_SCHAR_POINTER:
default:
abort ();
}
+#else
+ abort ();
+#endif
}
#if ENABLE_UNISTDIO
/* The unistdio extensions. */
-# dprintf-posix.m4 serial 8
+# dprintf-posix.m4 serial 9
dnl Copyright (C) 2007-2024 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
*yes)
case "$gl_cv_func_printf_directive_f" in
*yes)
- case "$gl_cv_func_printf_directive_n" in
+ case m4_ifdef([gl_PRINTF_SUPPORT_N_DIRECTIVE],["$gl_cv_func_printf_directive_n"],["yes"]) in
*yes)
case "$gl_cv_func_printf_directive_ls" in
*yes)
-# fprintf-posix.m4 serial 19
+# fprintf-posix.m4 serial 20
dnl Copyright (C) 2007-2024 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
*yes)
case "$gl_cv_func_printf_directive_f" in
*yes)
- case "$gl_cv_func_printf_directive_n" in
+ case m4_ifdef([gl_PRINTF_SUPPORT_N_DIRECTIVE],["$gl_cv_func_printf_directive_n"],["yes"]) in
*yes)
case "$gl_cv_func_printf_directive_ls" in
*yes)
-# obstack-printf-posix.m4 serial 9
+# obstack-printf-posix.m4 serial 10
dnl Copyright (C) 2008-2024 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
*yes)
case "$gl_cv_func_printf_directive_f" in
*yes)
- case "$gl_cv_func_printf_directive_n" in
+ case m4_ifdef([gl_PRINTF_SUPPORT_N_DIRECTIVE],["$gl_cv_func_printf_directive_n"],["yes"]) in
*yes)
case "$gl_cv_func_printf_directive_ls" in
*yes)
--- /dev/null
+# printf-with-n-directive.m4 serial 1
+dnl Copyright (C) 2024 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl This macro is a witness that support of the %n directive in *printf
+dnl functions is desired.
+AC_DEFUN([gl_PRINTF_SUPPORT_N_DIRECTIVE], [
+ AC_DEFINE([NEED_PRINTF_WITH_N_DIRECTIVE], [1],
+ [Define to 1 to enable support of the %n directive in *printf functions.])
+])
-# snprintf-posix.m4 serial 19
+# snprintf-posix.m4 serial 21
dnl Copyright (C) 2007-2024 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
*yes)
case "$gl_cv_func_printf_directive_f" in
*yes)
- case "$gl_cv_func_printf_directive_n" in
+ case m4_ifdef([gl_PRINTF_SUPPORT_N_DIRECTIVE],["$gl_cv_func_printf_directive_n"],["yes"]) in
*yes)
case "$gl_cv_func_printf_directive_ls" in
*yes)
*yes)
case "$gl_cv_func_snprintf_retval_c99" in
*yes)
- case "$gl_cv_func_snprintf_directive_n" in
+ case m4_ifdef([gl_PRINTF_SUPPORT_N_DIRECTIVE],["$gl_cv_func_snprintf_directive_n"],["yes"]) in
*yes)
case "$gl_cv_func_snprintf_size1" in
*yes)
-# sprintf-posix.m4 serial 17
+# sprintf-posix.m4 serial 18
dnl Copyright (C) 2007-2024 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
*yes)
case "$gl_cv_func_printf_directive_f" in
*yes)
- case "$gl_cv_func_printf_directive_n" in
+ case m4_ifdef([gl_PRINTF_SUPPORT_N_DIRECTIVE],["$gl_cv_func_printf_directive_n"],["yes"]) in
*yes)
case "$gl_cv_func_printf_directive_ls" in
*yes)
-# vasnprintf-posix.m4 serial 18
+# vasnprintf-posix.m4 serial 19
dnl Copyright (C) 2007-2024 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
*yes)
case "$gl_cv_func_printf_directive_f" in
*yes)
- case "$gl_cv_func_printf_directive_n" in
+ case m4_ifdef([gl_PRINTF_SUPPORT_N_DIRECTIVE],["$gl_cv_func_printf_directive_n"],["yes"]) in
*yes)
case "$gl_cv_func_printf_directive_ls" in
*yes)
-# vasprintf-posix.m4 serial 18
+# vasprintf-posix.m4 serial 19
dnl Copyright (C) 2007-2024 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
*yes)
case "$gl_cv_func_printf_directive_f" in
*yes)
- case "$gl_cv_func_printf_directive_n" in
+ case m4_ifdef([gl_PRINTF_SUPPORT_N_DIRECTIVE],["$gl_cv_func_printf_directive_n"],["yes"]) in
*yes)
case "$gl_cv_func_printf_directive_ls" in
*yes)
-# vdprintf-posix.m4 serial 8
+# vdprintf-posix.m4 serial 9
dnl Copyright (C) 2007-2024 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
*yes)
case "$gl_cv_func_printf_directive_f" in
*yes)
- case "$gl_cv_func_printf_directive_n" in
+ case m4_ifdef([gl_PRINTF_SUPPORT_N_DIRECTIVE],["$gl_cv_func_printf_directive_n"],["yes"]) in
*yes)
case "$gl_cv_func_printf_directive_ls" in
*yes)
-# vfprintf-posix.m4 serial 19
+# vfprintf-posix.m4 serial 20
dnl Copyright (C) 2007-2024 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
*yes)
case "$gl_cv_func_printf_directive_f" in
*yes)
- case "$gl_cv_func_printf_directive_n" in
+ case m4_ifdef([gl_PRINTF_SUPPORT_N_DIRECTIVE],["$gl_cv_func_printf_directive_n"],["yes"]) in
*yes)
case "$gl_cv_func_printf_directive_ls" in
*yes)
-# vsnprintf-posix.m4 serial 20
+# vsnprintf-posix.m4 serial 22
dnl Copyright (C) 2007-2024 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
*yes)
case "$gl_cv_func_printf_directive_f" in
*yes)
- case "$gl_cv_func_printf_directive_n" in
+ case m4_ifdef([gl_PRINTF_SUPPORT_N_DIRECTIVE],["$gl_cv_func_printf_directive_n"],["yes"]) in
*yes)
case "$gl_cv_func_printf_directive_ls" in
*yes)
*yes)
case "$gl_cv_func_snprintf_retval_c99" in
*yes)
- case "$gl_cv_func_snprintf_directive_n" in
+ case m4_ifdef([gl_PRINTF_SUPPORT_N_DIRECTIVE],["$gl_cv_func_snprintf_directive_n"],["yes"]) in
*yes)
case "$gl_cv_func_snprintf_size1" in
*yes)
-# vsprintf-posix.m4 serial 17
+# vsprintf-posix.m4 serial 18
dnl Copyright (C) 2007-2024 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
*yes)
case "$gl_cv_func_printf_directive_f" in
*yes)
- case "$gl_cv_func_printf_directive_n" in
+ case m4_ifdef([gl_PRINTF_SUPPORT_N_DIRECTIVE],["$gl_cv_func_printf_directive_n"],["yes"]) in
*yes)
case "$gl_cv_func_printf_directive_ls" in
*yes)
--- /dev/null
+Description:
+Enable processing of the %n directive in *printf functions.
+
+Comment:
+This module should not be used as a dependency from a test module,
+otherwise when this module occurs as a tests-related module, it will
+have side effects on the compilation of the 'vasnprintf' module, if
+that module occurs among the main modules in lib/.
+
+Files:
+m4/printf-with-n-directive.m4
+
+Depends-on:
+
+configure.ac:
+gl_PRINTF_SUPPORT_N_DIRECTIVE
+
+Makefile.am:
+
+Include:
+
+License:
+LGPLv2+
+
+Maintainer:
+all
ASSERT (retval == strlen (result));
}
+#if NEED_PRINTF_WITH_N_DIRECTIVE
/* Test the support of the %n format directive. */
{
ASSERT (retval == strlen (result));
ASSERT (count == 4);
}
+#endif
/* Test the support of the POSIX/XSI format strings with positions. */
ASSERT (retval == strlen (result));
}
+#if NEED_PRINTF_WITH_N_DIRECTIVE
/* Test the support of the %n format directive. */
{
ASSERT (retval == strlen (result));
ASSERT (count == 4);
}
+#endif
/* Test the support of the POSIX/XSI format strings with positions. */
free (result);
}
+#if NEED_PRINTF_WITH_N_DIRECTIVE
/* Test the support of the %n format directive. */
{
ASSERT (count == 4);
free (result);
}
+#endif
/* Test the support of the POSIX/XSI format strings with positions. */
free (result);
}
+#if NEED_PRINTF_WITH_N_DIRECTIVE
/* Test the support of the %n format directive. */
{
ASSERT (count == 4);
free (result);
}
+#endif
/* Test the support of the POSIX/XSI format strings with positions. */
free (result);
}
+#if NEED_PRINTF_WITH_N_DIRECTIVE
/* Test the support of the %n format directive. */
{
ASSERT (count == 4);
free (result);
}
+#endif
/* Test the support of the POSIX/XSI format strings with positions. */