summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2021-08-07 19:10:38 +0200
committerBruno Haible <bruno@clisp.org>2021-08-07 19:10:38 +0200
commita8b11d9c7ad1633ed9a1af1beae1ae718ddd199e (patch)
tree0cb648e490a66a0e1d60ad8a8d9e07cb1d9638fc
parent3f14ad2a151664a660916ab0d08adb1f6011db62 (diff)
downloadgnulib-a8b11d9c7ad1633ed9a1af1beae1ae718ddd199e.tar.gz
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'.
-rw-r--r--ChangeLog10
-rw-r--r--lib/bitset.h19
2 files changed, 21 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index e07fc85bda..6e4d3c2062 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
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'.
+
+2021-08-07 Bruno Haible <bruno@clisp.org>
+
argv-iter: Improve GCC 11 allocation-deallocation checking.
* lib/argv-iter.h (argv_iter_free): Move declaration up.
(argv_iter_init_argv, argv_iter_init_stream): Declare that deallocation
diff --git a/lib/bitset.h b/lib/bitset.h
index 97d9ad0c2d..abbfdd1bdf 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);