From: Bruno Haible Date: Sat, 7 Aug 2021 17:16:48 +0000 (+0200) Subject: c-xvasprintf: Improve GCC 11 allocation-deallocation checking. X-Git-Tag: v1.0~2708 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=6decb4e2d2054924e035ae391a758864a2167249;p=gnulib.git c-xvasprintf: Improve GCC 11 allocation-deallocation checking. * lib/c-xvasprintf.h: Include . (c_xasprintf, c_xvasprintf): Declare that deallocation must happen through 'free'. --- diff --git a/ChangeLog b/ChangeLog index 7d193dac0a..0d2b8e9c3a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2021-08-07 Bruno Haible + + c-xvasprintf: Improve GCC 11 allocation-deallocation checking. + * lib/c-xvasprintf.h: Include . + (c_xasprintf, c_xvasprintf): Declare that deallocation must happen + through 'free'. + 2021-08-07 Bruno Haible bitsetv: Improve GCC 11 allocation-deallocation checking. diff --git a/lib/c-xvasprintf.h b/lib/c-xvasprintf.h index ae48780729..69e5c1bbe4 100644 --- a/lib/c-xvasprintf.h +++ b/lib/c-xvasprintf.h @@ -23,6 +23,8 @@ /* Get _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD. */ #include +#include + #ifdef __cplusplus extern "C" { #endif @@ -38,9 +40,11 @@ extern "C" { Formatting takes place in the C locale, that is, the decimal point used in floating-point formatting directives is always '.'. */ extern char *c_xasprintf (const char *format, ...) - _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, 1, 2)); + _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, 1, 2)) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_RETURNS_NONNULL; extern char *c_xvasprintf (const char *format, va_list args) - _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, 1, 0)); + _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, 1, 0)) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_RETURNS_NONNULL; #ifdef __cplusplus }