bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bitsetv: Improve GCC 11 allocation-deallocation checking


From: Bruno Haible
Subject: bitsetv: Improve GCC 11 allocation-deallocation checking
Date: Sat, 07 Aug 2021 19:14:40 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-210-generic; KDE/5.18.0; x86_64; ; )

2021-08-07  Bruno Haible  <bruno@clisp.org>

        bitsetv: Improve GCC 11 allocation-deallocation checking.
        * lib/bitsetv.h (bitsetv_free): Move declaration up.
        (bitsetv_alloc, bitsetv_create): Declare that deallocation must happen
        through 'bitsetv_free'.

diff --git a/lib/bitsetv.h b/lib/bitsetv.h
index 72bf277..2ab9b80 100644
--- a/lib/bitsetv.h
+++ b/lib/bitsetv.h
@@ -25,16 +25,18 @@
 
 typedef bitset * bitsetv;
 
+/* Free vector of bitsets.  Do nothing if NULL.  */
+void bitsetv_free (bitsetv);
+
 /* Create a vector of N_VECS bitsets, each of N_BITS, and of
    type TYPE.  */
-bitsetv bitsetv_alloc (bitset_bindex, bitset_bindex, enum bitset_type);
+bitsetv bitsetv_alloc (bitset_bindex, bitset_bindex, enum bitset_type)
+  _GL_ATTRIBUTE_DEALLOC (bitsetv_free, 1);
 
 /* Create a vector of N_VECS bitsets, each of N_BITS, and with
    attribute hints specified by ATTR.  */
-bitsetv bitsetv_create (bitset_bindex, bitset_bindex, unsigned);
-
-/* Free vector of bitsets.  Do nothing if NULL.  */
-void bitsetv_free (bitsetv);
+bitsetv bitsetv_create (bitset_bindex, bitset_bindex, unsigned)
+  _GL_ATTRIBUTE_DEALLOC (bitsetv_free, 1);
 
 /* Zero vector of bitsets.  */
 void bitsetv_zero (bitsetv);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]