diff options
author | Bruno Haible <bruno@clisp.org> | 2021-08-07 19:00:42 +0200 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2021-08-07 19:00:42 +0200 |
commit | 2fb0672b4058a81fd977d75865ea3c3aaded4fb6 (patch) | |
tree | 81cb2f681390b5685a037b666e393d1075a8f9a2 /lib | |
parent | 9cf8b021920073161cc52e6748e4a8ac7821e408 (diff) | |
download | gnulib-2fb0672b4058a81fd977d75865ea3c3aaded4fb6.tar.gz |
argp: Improve GCC 11 allocation-deallocation checking.
* lib/argp-fmtstream.h (__argp_fmtstream_free, argp_fmtstream_free):
Move declarations up.
(__argp_make_fmtstream): Declare that deallocation must happen through
'__argp_fmtstream_free'.
(argp_make_fmtstream): Declare that deallocation must happen through
'argp_fmtstream_free'.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/argp-fmtstream.h | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/argp-fmtstream.h b/lib/argp-fmtstream.h index 79ba4844f8..3384a0012b 100644 --- a/lib/argp-fmtstream.h +++ b/lib/argp-fmtstream.h @@ -95,6 +95,10 @@ struct argp_fmtstream typedef struct argp_fmtstream *argp_fmtstream_t; +/* Flush __FS to its stream, and free it (but don't close the stream). */ +extern void __argp_fmtstream_free (argp_fmtstream_t __fs); +extern void argp_fmtstream_free (argp_fmtstream_t __fs); + /* Return an argp_fmtstream that outputs to STREAM, and which prefixes lines written on it with LMARGIN spaces and limits them to RMARGIN columns total. If WMARGIN >= 0, words that extend past RMARGIN are wrapped by @@ -104,15 +108,13 @@ typedef struct argp_fmtstream *argp_fmtstream_t; extern argp_fmtstream_t __argp_make_fmtstream (FILE *__stream, size_t __lmargin, size_t __rmargin, - ssize_t __wmargin); + ssize_t __wmargin) + _GL_ATTRIBUTE_DEALLOC (__argp_fmtstream_free, 1); extern argp_fmtstream_t argp_make_fmtstream (FILE *__stream, size_t __lmargin, size_t __rmargin, - ssize_t __wmargin); - -/* Flush __FS to its stream, and free it (but don't close the stream). */ -extern void __argp_fmtstream_free (argp_fmtstream_t __fs); -extern void argp_fmtstream_free (argp_fmtstream_t __fs); + ssize_t __wmargin) + _GL_ATTRIBUTE_DEALLOC (argp_fmtstream_free, 1); extern ssize_t __argp_fmtstream_printf (argp_fmtstream_t __fs, const char *__fmt, ...) |