From: Bruno Haible <bruno@clisp.org>
To: bug-gnulib@gnu.org
Cc: Akim Demaille <akim.demaille@gmail.com>
Subject: bitset: Improve GCC 11 allocation-deallocation checking
Date: Sat, 07 Aug 2021 19:12:16 +0200 [thread overview]
Message-ID: <3572641.ByePZIQJDE@omega> (raw)
2021-08-07 Bruno Haible <bruno@clisp.org>
bitset: Improve GCC 11 allocation-deallocation checking.
* lib/bitset.h (bitset_free): Move declaration up.
(bitset_alloc, bitset_create): Declare that deallocation must happen
through 'bitset_free'.
(bitset_obstack_free): Move declaration up.
(bitset_obstack_alloc): Declare that deallocation must happen through
'bitset_obstack_free'.
diff --git a/lib/bitset.h b/lib/bitset.h
index 97d9ad0..abbfdd1 100644
--- a/lib/bitset.h
+++ b/lib/bitset.h
@@ -96,6 +96,9 @@ typedef struct
} bitset_iterator;
+/* Free bitset. Do nothing if NULL. */
+void bitset_free (bitset);
+
/* Return bytes required for bitset of desired type and size. */
size_t bitset_bytes (enum bitset_type, bitset_bindex);
@@ -107,21 +110,21 @@ bitset bitset_init (bitset, bitset_bindex, enum bitset_type);
enum bitset_type bitset_type_choose (bitset_bindex, bitset_attrs);
/* Create a bitset of desired type and size. The bitset is zeroed. */
-bitset bitset_alloc (bitset_bindex, enum bitset_type);
+bitset bitset_alloc (bitset_bindex, enum bitset_type)
+ _GL_ATTRIBUTE_DEALLOC (bitset_free, 1);
-/* Free bitset. Do nothing if NULL. */
-void bitset_free (bitset);
+/* Free bitset allocated on obstack. Do nothing if NULL. */
+void bitset_obstack_free (bitset);
/* Create a bitset of desired type and size using an obstack. The
bitset is zeroed. */
bitset bitset_obstack_alloc (struct obstack *bobstack,
- bitset_bindex, enum bitset_type);
-
-/* Free bitset allocated on obstack. Do nothing if NULL. */
-void bitset_obstack_free (bitset);
+ bitset_bindex, enum bitset_type)
+ _GL_ATTRIBUTE_DEALLOC (bitset_obstack_free, 1);
/* Create a bitset of desired size and attributes. The bitset is zeroed. */
-bitset bitset_create (bitset_bindex, bitset_attrs);
+bitset bitset_create (bitset_bindex, bitset_attrs)
+ _GL_ATTRIBUTE_DEALLOC (bitset_free, 1);
/* Return bitset type. */
enum bitset_type bitset_type_get (bitset);
reply other threads:[~2021-08-07 17:12 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=3572641.ByePZIQJDE@omega \
--to=bruno@clisp.org \
--cc=akim.demaille@gmail.com \
--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).