bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Bruno Haible <bruno@clisp.org>
To: bug-gnulib@gnu.org
Subject: argp: Improve GCC 11 allocation-deallocation checking
Date: Sat, 07 Aug 2021 19:03:11 +0200	[thread overview]
Message-ID: <2078566.irNJs6uVIT@omega> (raw)

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'.

diff --git a/lib/argp-fmtstream.h b/lib/argp-fmtstream.h
index 79ba484..3384a00 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, ...)



                 reply	other threads:[~2021-08-07 17:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2078566.irNJs6uVIT@omega \
    --to=bruno@clisp.org \
    --cc=bug-gnulib@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).