diff options
author | Bruno Haible <bruno@clisp.org> | 2023-03-24 22:14:09 +0100 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2023-03-24 22:14:09 +0100 |
commit | 480a59ba60fa0b43a1cebe218bbcea6a947f1e86 (patch) | |
tree | b2b3cdce131d3a52f876c652796d6477c1f758ec /m4/dprintf-posix.m4 | |
parent | d4bf26d359cf758bee20b907352c5db68dda19d4 (diff) | |
download | gnulib-480a59ba60fa0b43a1cebe218bbcea6a947f1e86.tar.gz |
*printf-posix: ISO C 23: Support size specifiers 'wN' and 'wfN'.
* lib/printf-args.h: Include <stdint.h>.
(arg_type): Add TYPE_[U]INT8_T, ..., TYPE_[U]INT_FAST64_T and
TYPE_COUNT_INT8_T_POINTER, ..., TYPE_COUNT_INT_FAST64_T_POINTER.
(argument): Add the union members a_[u]int8_t, ..., a_[u]int_fast64_t
and a_count_int8_t_pointer, ..., a_count_int_fast64_t_pointer.
* lib/printf-args.c: Include <limits.h>.
(PRINTF_FETCHARGS): Handle TYPE_[U]INT8_T, ..., TYPE_[U]INT_FAST64_T and
TYPE_COUNT_INT8_T_POINTER, ..., TYPE_COUNT_INT_FAST64_T_POINTER.
* lib/printf-parse.c (PRINTF_PARSE): Accept only one size specifier, not
a sequence of size specifiers. Accept "wN" and "wfN", where N = 8, 16,
32, 64.
* lib/vasnprintf.c (MAX_ROOM_NEEDED, VASNPRINTF): Handle the new TYPE_*
values as well.
* m4/printf.m4 (gl_PRINTF_SIZES_C23): New macro.
* m4/vasnprintf-posix.m4 (gl_FUNC_VASNPRINTF_IS_POSIX): Require
gl_PRINTF_SIZES_C23. Test gl_cv_func_printf_sizes_c23.
* m4/dprintf-posix.m4 (gl_FUNC_DPRINTF_IS_POSIX): Likewise.
* 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/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.
* tests/test-vasnprintf-posix.c (test_function): Add tests for size
specifiers with %d, %u, %b, %o, %x.
* tests/test-snprintf-posix.h (test_function): Likewise.
* tests/test-sprintf-posix.h (test_function): Likewise.
* tests/test-vasnwprintf-posix.c (test_function): Likewise.
* tests/test-vasprintf-posix.c (test_function): Likewise.
* modules/vasnprintf (Depends-on): Add limits-h.
* modules/vasnwprintf (Depends-on): Add limits-h.
* modules/c-vasnprintf (Depends-on): Add limits-h, stdint.
* modules/unistdio/u-printf-args (Depends-on): Add stdint, limits-h.
* doc/posix-functions/dprintf.texi: Mention the ISO C 23 size
specifiers.
* 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.
Diffstat (limited to 'm4/dprintf-posix.m4')
-rw-r--r-- | m4/dprintf-posix.m4 | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/m4/dprintf-posix.m4 b/m4/dprintf-posix.m4 index 8759beaa22..3d964a6dce 100644 --- a/m4/dprintf-posix.m4 +++ b/m4/dprintf-posix.m4 @@ -1,4 +1,4 @@ -# dprintf-posix.m4 serial 6 +# dprintf-posix.m4 serial 7 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, @@ -19,6 +19,7 @@ dnl Result is gl_cv_func_dprintf_posix. AC_DEFUN([gl_FUNC_DPRINTF_IS_POSIX], [ AC_REQUIRE([gl_PRINTF_SIZES_C99]) + AC_REQUIRE([gl_PRINTF_SIZES_C23]) AC_REQUIRE([gl_PRINTF_LONG_DOUBLE]) AC_REQUIRE([gl_PRINTF_INFINITE]) AC_REQUIRE([gl_PRINTF_INFINITE_LONG_DOUBLE]) @@ -39,39 +40,43 @@ AC_DEFUN([gl_FUNC_DPRINTF_IS_POSIX], if test $ac_cv_func_dprintf = yes; then case "$gl_cv_func_printf_sizes_c99" in *yes) - case "$gl_cv_func_printf_long_double" in + case "$gl_cv_func_printf_sizes_c23" in *yes) - case "$gl_cv_func_printf_infinite" in + case "$gl_cv_func_printf_long_double" in *yes) - case "$gl_cv_func_printf_infinite_long_double" in + case "$gl_cv_func_printf_infinite" in *yes) - case "$gl_cv_func_printf_directive_a" in + case "$gl_cv_func_printf_infinite_long_double" in *yes) - case "$gl_cv_func_printf_directive_b" in + case "$gl_cv_func_printf_directive_a" in *yes) - case "$gl_cv_func_printf_directive_f" in + case "$gl_cv_func_printf_directive_b" in *yes) - case "$gl_cv_func_printf_directive_n" in + case "$gl_cv_func_printf_directive_f" in *yes) - case "$gl_cv_func_printf_directive_ls" in + case "$gl_cv_func_printf_directive_n" in *yes) - case "$gl_cv_func_printf_directive_lc" in + case "$gl_cv_func_printf_directive_ls" in *yes) - case "$gl_cv_func_printf_positions" in + case "$gl_cv_func_printf_directive_lc" in *yes) - case "$gl_cv_func_printf_flag_grouping" in + case "$gl_cv_func_printf_positions" in *yes) - case "$gl_cv_func_printf_flag_leftadjust" in + case "$gl_cv_func_printf_flag_grouping" in *yes) - case "$gl_cv_func_printf_flag_zero" in + case "$gl_cv_func_printf_flag_leftadjust" in *yes) - case "$gl_cv_func_printf_precision" in + case "$gl_cv_func_printf_flag_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 ;; |