summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkim Demaille <akim.demaille@gmail.com>2020-05-09 13:31:07 +0200
committerAkim Demaille <akim.demaille@gmail.com>2020-05-09 15:12:57 +0200
commit670f259f1e2104cf86b5811db095d4d374c36507 (patch)
tree56f38714501139789b228a43d0dc3d01880a5ec9
parentd14eb48670838366eafc1616078f9b151012bf6c (diff)
downloadgnulib-670f259f1e2104cf86b5811db095d4d374c36507.tar.gz
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.
-rw-r--r--ChangeLog9
-rw-r--r--lib/bitset.c2
-rw-r--r--lib/bitset/array.c10
-rw-r--r--lib/bitset/base.h3
-rw-r--r--lib/bitset/list.c4
-rw-r--r--lib/bitset/stats.c2
-rw-r--r--lib/bitset/table.c2
-rw-r--r--lib/bitset/vector.c8
-rw-r--r--modules/bitset1
9 files changed, 25 insertions, 16 deletions
diff --git a/ChangeLog b/ChangeLog
index e6750b6b55..ffe44f7167 100644
--- 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.
diff --git a/lib/bitset.c b/lib/bitset.c
index c0fc13fd52..70752b621b 100644
--- a/lib/bitset.c
+++ b/lib/bitset.c
@@ -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)
diff --git a/lib/bitset/array.c b/lib/bitset/array.c
index e611f38bcf..f350b53eb4 100644
--- a/lib/bitset/array.c
+++ b/lib/bitset/array.c
@@ -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. */
diff --git a/lib/bitset/base.h b/lib/bitset/base.h
index 1020515a46..2ae7b20802 100644
--- a/lib/bitset/base.h
+++ b/lib/bitset/base.h
@@ -25,10 +25,9 @@
#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
diff --git a/lib/bitset/list.c b/lib/bitset/list.c
index f453671827..ed975ef001 100644
--- a/lib/bitset/list.c
+++ b/lib/bitset/list.c
@@ -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;
diff --git a/lib/bitset/stats.c b/lib/bitset/stats.c
index 222cde0905..10aa5d768d 100644
--- a/lib/bitset/stats.c
+++ b/lib/bitset/stats.c
@@ -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;
diff --git a/lib/bitset/table.c b/lib/bitset/table.c
index ab68e518d0..56f1a860a4 100644
--- a/lib/bitset/table.c
+++ b/lib/bitset/table.c
@@ -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);
}
diff --git a/lib/bitset/vector.c b/lib/bitset/vector.c
index cb60ba4a3a..fe14d67037 100644
--- a/lib/bitset/vector.c
+++ b/lib/bitset/vector.c
@@ -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);
}
diff --git a/modules/bitset b/modules/bitset
index 81b71c0c7c..ec7f34b60a 100644
--- a/modules/bitset
+++ b/modules/bitset
@@ -17,6 +17,7 @@ lib/bitset/vector.c
lib/bitset/vector.h
Depends-on:
+attribute
c99
gettext-h
obstack