]> Savannah Git Hosting - gnulib.git/commitdiff
bitset: use the attribute module
authorAkim Demaille <akim.demaille@gmail.com>
Sat, 9 May 2020 11:31:07 +0000 (13:31 +0200)
committerAkim Demaille <akim.demaille@gmail.com>
Sat, 9 May 2020 13:12:57 +0000 (15:12 +0200)
* modules/bitset: Depend on 'attribute'.
* lib/bitset/base.h (ATTRIBUTE_UNUSED): Remove.
* lib/bitset.c, lib/bitset/array.c, lib/bitset/list.c,
* lib/bitset/stats.c, lib/bitset/table.c, lib/bitset/vector.c:
Use MAYBE_UNUSED instead of ATTRIBUTE_UNUSED.

ChangeLog
lib/bitset.c
lib/bitset/array.c
lib/bitset/base.h
lib/bitset/list.c
lib/bitset/stats.c
lib/bitset/table.c
lib/bitset/vector.c
modules/bitset

index e6750b6b554a2643bf11d316499be1614dd8114b..ffe44f7167861ff2237f2ff96a49858a38c07a3c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2020-05-09  Akim Demaille  <akim@lrde.epita.fr>
+
+       bitset: use the attribute module
+       * modules/bitset: Depend on 'attribute'.
+       * lib/bitset/base.h (ATTRIBUTE_UNUSED): Remove.
+       * lib/bitset.c, lib/bitset/array.c, lib/bitset/list.c,
+       * lib/bitset/stats.c, lib/bitset/table.c, lib/bitset/vector.c:
+       Use MAYBE_UNUSED instead of ATTRIBUTE_UNUSED.
+
 2020-05-09  Bruno Haible  <bruno@clisp.org>
 
        c-stack: Fix warning when DEBUG is enabled.
index c0fc13fd521ff5098f79cea2ec366a8019e846cd..70752b621b661fe0ddd44106f061288bd8c23806 100644 (file)
@@ -94,7 +94,7 @@ bitset_init (bitset bset, bitset_bindex n_bits, enum bitset_type type)
    specified by ATTR.  For variable size bitsets, N_BITS is only a
    hint and may be zero.  */
 enum bitset_type
-bitset_type_choose (bitset_bindex n_bits ATTRIBUTE_UNUSED, unsigned attr)
+bitset_type_choose (bitset_bindex n_bits MAYBE_UNUSED, unsigned attr)
 {
   /* Check attributes.  */
   if (attr & BITSET_FIXED && attr & BITSET_VARIABLE)
index e611f38bcfe824f5e5a188265f9dd8de69f73505..f350b53eb492b2cbded4e5f7789c254c37399fab 100644 (file)
@@ -99,7 +99,7 @@ abitset_small_list (bitset src, bitset_bindex *list,
 
 /* Set bit BITNO in bitset DST.  */
 static void
-abitset_set (bitset dst ATTRIBUTE_UNUSED, bitset_bindex bitno ATTRIBUTE_UNUSED)
+abitset_set (bitset dst MAYBE_UNUSED, bitset_bindex bitno MAYBE_UNUSED)
 {
   /* This should never occur for abitsets since we should always hit
      the cache.  It is likely someone is trying to access outside the
@@ -110,8 +110,8 @@ abitset_set (bitset dst ATTRIBUTE_UNUSED, bitset_bindex bitno ATTRIBUTE_UNUSED)
 
 /* Reset bit BITNO in bitset DST.  */
 static void
-abitset_reset (bitset dst ATTRIBUTE_UNUSED,
-               bitset_bindex bitno ATTRIBUTE_UNUSED)
+abitset_reset (bitset dst MAYBE_UNUSED,
+               bitset_bindex bitno MAYBE_UNUSED)
 {
   /* This should never occur for abitsets since we should always hit
      the cache.  It is likely someone is trying to access outside the
@@ -121,8 +121,8 @@ abitset_reset (bitset dst ATTRIBUTE_UNUSED,
 
 /* Test bit BITNO in bitset SRC.  */
 static bool
-abitset_test (bitset src ATTRIBUTE_UNUSED,
-              bitset_bindex bitno ATTRIBUTE_UNUSED)
+abitset_test (bitset src MAYBE_UNUSED,
+              bitset_bindex bitno MAYBE_UNUSED)
 {
   /* This should never occur for abitsets since we should always
      hit the cache.  */
index 1020515a467ae18df669a4dd2c2eecabb545fbf4..2ae7b20802ad46e8cf853a1af2368ecdebdee18f 100644 (file)
 #include <stdbool.h>
 #include <stddef.h>
 
+#include "attribute.h"
 #include "xalloc.h"
 
-#define ATTRIBUTE_UNUSED _GL_ATTRIBUTE_MAYBE_UNUSED
-
 /* Currently we support five flavours of bitsets:
    BITSET_ARRAY:  Array of bits (fixed size, fast for dense bitsets).
                   Memory for bit array and bitset structure allocated
index f45367182714e568ead6e363a392d2236d64877e..ed975ef001b8e4ecf457bf107a27da5bbba1e641 100644 (file)
@@ -1276,7 +1276,7 @@ struct bitset_vtable lbitset_vtable = {
 
 /* Return size of initial structure.  */
 size_t
-lbitset_bytes (bitset_bindex n_bits ATTRIBUTE_UNUSED)
+lbitset_bytes (bitset_bindex n_bits MAYBE_UNUSED)
 {
   return sizeof (struct lbitset_struct);
 }
@@ -1284,7 +1284,7 @@ lbitset_bytes (bitset_bindex n_bits ATTRIBUTE_UNUSED)
 
 /* Initialize a bitset.  */
 bitset
-lbitset_init (bitset bset, bitset_bindex n_bits ATTRIBUTE_UNUSED)
+lbitset_init (bitset bset, bitset_bindex n_bits MAYBE_UNUSED)
 {
   BITSET_NBITS_ (bset) = n_bits;
   bset->b.vtable = &lbitset_vtable;
index 222cde09051bb89f99456558223bac43fd910980..10aa5d768dc1853f04368913dc68286cfec527b8 100644 (file)
@@ -202,7 +202,7 @@ bitset_stats_print_1 (FILE *file, const char *name,
 
 /* Print all bitset statistics to FILE.  */
 static void
-bitset_stats_print (FILE *file, bool verbose ATTRIBUTE_UNUSED)
+bitset_stats_print (FILE *file, bool verbose MAYBE_UNUSED)
 {
   if (!bitset_stats_info)
     return;
index ab68e518d040b50a5c77c0e70536f1f82223fc21..56f1a860a45ea9b9f02a917d467d1bad2ab85623 100644 (file)
@@ -1184,7 +1184,7 @@ struct bitset_vtable tbitset_vtable = {
 
 /* Return size of initial structure.  */
 size_t
-tbitset_bytes (bitset_bindex n_bits ATTRIBUTE_UNUSED)
+tbitset_bytes (bitset_bindex n_bits MAYBE_UNUSED)
 {
   return sizeof (struct tbitset_struct);
 }
index cb60ba4a3a8529c6675ff8b8ab56918973483ffd..fe14d670371dc2a6ce5eecbc2c9aca987f4bf23d 100644 (file)
@@ -126,7 +126,7 @@ vbitset_set (bitset dst, bitset_bindex bitno)
 
 /* Reset bit BITNO in bitset DST.  */
 static void
-vbitset_reset (bitset dst ATTRIBUTE_UNUSED, bitset_bindex bitno ATTRIBUTE_UNUSED)
+vbitset_reset (bitset dst MAYBE_UNUSED, bitset_bindex bitno MAYBE_UNUSED)
 {
   /* We must be accessing outside the cache so the bit is
      zero anyway.  */
@@ -135,8 +135,8 @@ vbitset_reset (bitset dst ATTRIBUTE_UNUSED, bitset_bindex bitno ATTRIBUTE_UNUSED
 
 /* Test bit BITNO in bitset SRC.  */
 static bool
-vbitset_test (bitset src ATTRIBUTE_UNUSED,
-              bitset_bindex bitno ATTRIBUTE_UNUSED)
+vbitset_test (bitset src MAYBE_UNUSED,
+              bitset_bindex bitno MAYBE_UNUSED)
 {
   /* We must be accessing outside the cache so the bit is
      zero anyway.  */
@@ -978,7 +978,7 @@ struct bitset_vtable vbitset_vtable = {
 
 
 size_t
-vbitset_bytes (bitset_bindex n_bits ATTRIBUTE_UNUSED)
+vbitset_bytes (bitset_bindex n_bits MAYBE_UNUSED)
 {
   return sizeof (struct vbitset_struct);
 }
index 81b71c0c7c1ddf392eed3dce1dae45ad0d1bb663..ec7f34b60a2b79bdbad3fc43d055cc578845e78f 100644 (file)
@@ -17,6 +17,7 @@ lib/bitset/vector.c
 lib/bitset/vector.h
 
 Depends-on:
+attribute
 c99
 gettext-h
 obstack