1
0
mirror of https://git.savannah.gnu.org/git/gnulib.git synced 2025-08-08 17:22:05 +03:00

vasprintf-gnu: New module.

* m4/vasprintf-posix.m4 (gl_FUNC_VASPRINTF_IS_POSIX): New macro,
extracted from gl_FUNC_VASPRINTF_POSIX.
(gl_FUNC_VASPRINTF_POSIX): Require it. Invoke
gl_PREREQ_VASNPRINTF_WITH_POSIX_EXTRAS.
* m4/vasprintf-gnu.m4: New file, based on m4/vasprintf-posix.m4.
* modules/vasprintf-gnu: New file, based on modules/vasnprintf-gnu.
* doc/glibc-functions/vasprintf.texi: Mention the new module.
* doc/glibc-functions/asprintf.texi: Likewise.
This commit is contained in:
Bruno Haible
2023-03-24 11:28:38 +01:00
parent 20ba9bfff2
commit 891708e6f2
6 changed files with 98 additions and 24 deletions

View File

@@ -1,3 +1,15 @@
2023-03-24 Bruno Haible <bruno@clisp.org>
vasprintf-gnu: New module.
* m4/vasprintf-posix.m4 (gl_FUNC_VASPRINTF_IS_POSIX): New macro,
extracted from gl_FUNC_VASPRINTF_POSIX.
(gl_FUNC_VASPRINTF_POSIX): Require it. Invoke
gl_PREREQ_VASNPRINTF_WITH_POSIX_EXTRAS.
* m4/vasprintf-gnu.m4: New file, based on m4/vasprintf-posix.m4.
* modules/vasprintf-gnu: New file, based on modules/vasnprintf-gnu.
* doc/glibc-functions/vasprintf.texi: Mention the new module.
* doc/glibc-functions/asprintf.texi: Likewise.
2023-03-24 Bruno Haible <bruno@clisp.org>
sprintf-gnu: Add tests.

View File

@@ -17,16 +17,16 @@ Documentation:
@uref{https://www.kernel.org/doc/man-pages/online/pages/man3/asprintf.3.html,,man asprintf}.
@end itemize
Gnulib module: vasprintf or vasprintf-posix
Gnulib module: vasprintf or vasprintf-posix or vasprintf-gnu
Portability problems fixed by either Gnulib module @code{vasprintf} or @code{vasprintf-posix}:
Portability problems fixed by either Gnulib module @code{vasprintf} or @code{vasprintf-posix} or @code{vasprintf-gnu}:
@itemize
@item
This function is missing on some platforms:
AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 10, mingw, MSVC 14.
@end itemize
Portability problems fixed by Gnulib module @code{vasprintf-posix}:
Portability problems fixed by either Gnulib module @code{vasprintf-posix} or @code{vasprintf-gnu}:
@itemize
@item
This function does not support size specifiers as in C99 (@code{hh}, @code{ll},
@@ -79,6 +79,13 @@ This function can crash in out-of-memory conditions on some platforms:
FreeBSD 13.0, NetBSD 5.0.
@end itemize
Portability problems fixed by Gnulib module @code{vasprintf-gnu}:
@itemize
@item
This function does not support the @samp{B} directive on some platforms:
glibc 2.34, FreeBSD 13.1, NetBSD 9.0, OpenBSD 7.2, macOS 12.5, AIX 7.2, Solaris 11.4, and others.
@end itemize
Portability problems not fixed by Gnulib:
@itemize
@item

View File

@@ -17,16 +17,16 @@ Documentation:
@uref{https://www.kernel.org/doc/man-pages/online/pages/man3/vasprintf.3.html,,man vasprintf}.
@end itemize
Gnulib module: vasprintf or vasprintf-posix
Gnulib module: vasprintf or vasprintf-posix or vasprintf-gnu
Portability problems fixed by either Gnulib module @code{vasprintf} or @code{vasprintf-posix}:
Portability problems fixed by either Gnulib module @code{vasprintf} or @code{vasprintf-posix} or @code{vasprintf-gnu}:
@itemize
@item
This function is missing on some platforms:
AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 10, mingw, MSVC 14.
@end itemize
Portability problems fixed by Gnulib module @code{vasprintf-posix}:
Portability problems fixed by either Gnulib module @code{vasprintf-posix} or @code{vasprintf-gnu}:
@itemize
@item
This function does not support size specifiers as in C99 (@code{hh}, @code{ll},
@@ -79,6 +79,13 @@ This function can crash in out-of-memory conditions on some platforms:
FreeBSD 13.0, NetBSD 5.0.
@end itemize
Portability problems fixed by Gnulib module @code{vasprintf-gnu}:
@itemize
@item
This function does not support the @samp{B} directive on some platforms:
glibc 2.34, FreeBSD 13.1, NetBSD 9.0, OpenBSD 7.2, macOS 12.5, AIX 7.2, Solaris 11.4, and others.
@end itemize
Portability problems not fixed by Gnulib:
@itemize
@item

25
m4/vasprintf-gnu.m4 Normal file
View File

@@ -0,0 +1,25 @@
# vasprintf-gnu.m4 serial 1
dnl Copyright (C) 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 with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_FUNC_VASPRINTF_GNU],
[
AC_REQUIRE([gl_FUNC_VASPRINTF_IS_POSIX])
AC_REQUIRE([gl_PRINTF_DIRECTIVE_UPPERCASE_B])
gl_cv_func_vasprintf_gnu=no
if test $gl_cv_func_vasprintf_posix = yes; then
case "$gl_cv_func_printf_directive_uppercase_b" in
*yes)
# vasprintf exists and is already POSIX compliant and GNU compatible.
gl_cv_func_vasprintf_gnu=yes
;;
esac
fi
if test $gl_cv_func_vasprintf_gnu = no; then
gl_PREREQ_VASNPRINTF_WITH_GNU_EXTRAS
gl_REPLACE_VASNPRINTF
gl_REPLACE_VASPRINTF
fi
])

View File

@@ -1,10 +1,22 @@
# vasprintf-posix.m4 serial 15
# vasprintf-posix.m4 serial 16
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,
dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_FUNC_VASPRINTF_POSIX],
[
AC_REQUIRE([gl_FUNC_VASPRINTF_IS_POSIX])
if test $gl_cv_func_vasprintf_posix = no; then
gl_PREREQ_VASNPRINTF_WITH_POSIX_EXTRAS
gl_REPLACE_VASNPRINTF
gl_REPLACE_VASPRINTF
fi
])
dnl Test whether vasprintf exists and is POSIX compliant.
dnl Result is gl_cv_func_vasprintf_posix.
AC_DEFUN([gl_FUNC_VASPRINTF_IS_POSIX],
[
AC_REQUIRE([gl_PRINTF_SIZES_C99])
AC_REQUIRE([gl_PRINTF_LONG_DOUBLE])
@@ -93,21 +105,4 @@ AC_DEFUN([gl_FUNC_VASPRINTF_POSIX],
esac
;;
esac
if test $gl_cv_func_vasprintf_posix = no; then
gl_PREREQ_VASNPRINTF_LONG_DOUBLE
gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE
gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE
gl_PREREQ_VASNPRINTF_DIRECTIVE_A
gl_PREREQ_VASNPRINTF_DIRECTIVE_B
gl_PREREQ_VASNPRINTF_DIRECTIVE_F
gl_PREREQ_VASNPRINTF_DIRECTIVE_LS
gl_PREREQ_VASNPRINTF_DIRECTIVE_LC
gl_PREREQ_VASNPRINTF_FLAG_GROUPING
gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST
gl_PREREQ_VASNPRINTF_FLAG_ZERO
gl_PREREQ_VASNPRINTF_PRECISION
gl_PREREQ_VASNPRINTF_ENOMEM
gl_REPLACE_VASNPRINTF
gl_REPLACE_VASPRINTF
fi
])

28
modules/vasprintf-gnu Normal file
View File

@@ -0,0 +1,28 @@
Description:
POSIX and GNU compatible vsprintf with automatic memory allocation.
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/vasprintf-gnu.m4
Depends-on:
vasprintf-posix
configure.ac:
gl_FUNC_VASPRINTF_GNU
Makefile.am:
Include:
"vasprintf.h"
License:
LGPL
Maintainer:
all