]> Savannah Git Hosting - gnulib.git/commitdiff
argp: Improve GCC 11 allocation-deallocation checking.
authorBruno Haible <bruno@clisp.org>
Sat, 7 Aug 2021 17:00:42 +0000 (19:00 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 7 Aug 2021 17:00:42 +0000 (19:00 +0200)
* 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'.

ChangeLog
lib/argp-fmtstream.h

index 8039f31483da8c526991c28a12ff710735174291..84d3d008c4387e0a6d231beb63d9c93403c09f9a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2021-08-07  Bruno Haible  <bruno@clisp.org>
+
+       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'.
+
 2021-08-07  Bruno Haible  <bruno@clisp.org>
 
        areadlink, areadlinkat: Improve GCC 11 allocation-deallocation checking.
index 79ba4844f8fa8ac63661472a997da94761a3b0ca..3384a0012b084ef3d24e624141bf7a3ac12aded7 100644 (file)
@@ -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, ...)