maint: prefer MAYBE_UNUSED

Prefer MAYBE_UNUSED to _GL_UNUSED, since the C2x syntax
will be [[maybe_unused]] at the start of the declaration,
and we want to look forward to that.  All uses of _GL_UNUSED
either changed to MAYBE_UNUSED, or (when not needed) removed.
This commit is contained in:
Paul Eggert committed 2021-11-18 21:37:38 -08:00
1 parent d0f035fc64
commit 3e2d644483
14 files changed
+51 -48

No files matched your search

+1 -1
View File
@@ -67,7 +67,7 @@ static struct option const long_opts[] =
#if ! HAVE_SETGROUPS
/* At least Interix lacks supplemental group support. */
static int
setgroups (size_t size, gid_t const *list _GL_UNUSED)
setgroups (size_t size, MAYBE_UNUSED gid_t const *list)
{
if (size == 0)
{
+1 -2
View File
@@ -286,8 +286,7 @@ crc_sum_stream (FILE *stream, void *resstream, uintmax_t *length)
void
output_crc (char const *file, int binary_file, void const *digest,
bool tagged, unsigned char delim, bool args _GL_UNUSED,
uintmax_t length _GL_UNUSED)
bool tagged, unsigned char delim, bool args, uintmax_t length)
{
char length_buf[INT_BUFSIZE_BOUND (uintmax_t)];
printf ("%u %s", *(unsigned int *)digest, umaxtostr (length, length_buf));
+1 -2
View File
@@ -8,8 +8,7 @@ crc_sum_stream (FILE *stream, void *resstream, uintmax_t *length);
extern void
output_crc (char const *file, int binary_file, void const *digest,
bool tagged, unsigned char delim, bool args _GL_UNUSED,
uintmax_t length _GL_UNUSED)
bool tagged, unsigned char delim, bool args, uintmax_t length)
_GL_ATTRIBUTE_NONNULL ((3));
extern bool
+10 -10
View File
@@ -669,7 +669,7 @@ errno_unsupported (int err)
#if USE_XATTR
ATTRIBUTE_FORMAT ((printf, 2, 3))
static void
copy_attr_error (struct error_context *ctx _GL_UNUSED,
copy_attr_error (MAYBE_UNUSED struct error_context *ctx,
char const *fmt, ...)
{
if (!errno_unsupported (errno))
@@ -686,7 +686,7 @@ copy_attr_error (struct error_context *ctx _GL_UNUSED,
ATTRIBUTE_FORMAT ((printf, 2, 3))
static void
copy_attr_allerror (struct error_context *ctx _GL_UNUSED,
copy_attr_allerror (MAYBE_UNUSED struct error_context *ctx,
char const *fmt, ...)
{
int err = errno;
@@ -699,14 +699,14 @@ copy_attr_allerror (struct error_context *ctx _GL_UNUSED,
}
static char const *
copy_attr_quote (struct error_context *ctx _GL_UNUSED, char const *str)
copy_attr_quote (MAYBE_UNUSED struct error_context *ctx, char const *str)
{
return quoteaf (str);
}
static void
copy_attr_free (struct error_context *ctx _GL_UNUSED,
char const *str _GL_UNUSED)
copy_attr_free (MAYBE_UNUSED struct error_context *ctx,
MAYBE_UNUSED char const *str)
{
}
@@ -759,11 +759,11 @@ copy_attr (char const *src_path, int src_fd,
#else /* USE_XATTR */
static bool
copy_attr (char const *src_path _GL_UNUSED,
int src_fd _GL_UNUSED,
char const *dst_path _GL_UNUSED,
int dst_fd _GL_UNUSED,
struct cp_options const *x _GL_UNUSED)
copy_attr (MAYBE_UNUSED char const *src_path,
MAYBE_UNUSED int src_fd,
MAYBE_UNUSED char const *dst_path,
MAYBE_UNUSED int dst_fd,
MAYBE_UNUSED struct cp_options const *x)
{
return true;
}
+5 -5
View File
@@ -167,8 +167,8 @@
#if !HASH_ALGO_SUM
static void
output_file (char const *file, int binary_file, void const *digest,
bool tagged, unsigned char delim, bool args _GL_UNUSED,
uintmax_t length _GL_UNUSED);
bool tagged, unsigned char delim, bool args,
uintmax_t length);
#endif
/* True if any of the files read were the standard input. */
@@ -902,7 +902,7 @@ print_filename (char const *file, bool escape)
static bool
digest_file (char const *filename, int *binary, unsigned char *bin_result,
bool *missing, uintmax_t* length _GL_UNUSED)
bool *missing, MAYBE_UNUSED uintmax_t *length)
{
FILE *fp;
int err;
@@ -968,8 +968,8 @@ digest_file (char const *filename, int *binary, unsigned char *bin_result,
#if !HASH_ALGO_SUM
static void
output_file (char const *file, int binary_file, void const *digest,
bool tagged, unsigned char delim, bool args _GL_UNUSED,
uintmax_t length _GL_UNUSED)
bool tagged, unsigned char delim, MAYBE_UNUSED bool args,
MAYBE_UNUSED uintmax_t length)
{
unsigned char const *bin_buffer = digest;
+11 -7
View File
@@ -776,7 +776,8 @@ factor_using_division (uintmax_t *t1p, uintmax_t t1, uintmax_t t0,
{
for (;;)
{
uintmax_t q1, q0, hi, lo _GL_UNUSED;
uintmax_t q1, q0, hi;
MAYBE_UNUSED uintmax_t lo;
q0 = t0 * primes_dtab[i].binv;
umul_ppmm (hi, lo, q0, p);
@@ -916,7 +917,8 @@ static const unsigned char binvert_table[128] =
_q0 = (u0) * _di; \
if ((u1) >= (d)) \
{ \
uintmax_t _p1, _p0 _GL_UNUSED; \
uintmax_t _p1; \
MAYBE_UNUSED intmax_t _p0; \
umul_ppmm (_p1, _p0, _q0, d); \
(q1) = ((u1) - _p1) * _di; \
(q0) = _q0; \
@@ -931,7 +933,7 @@ static const unsigned char binvert_table[128] =
/* x B (mod n). */
#define redcify(r_prim, r, n) \
do { \
uintmax_t _redcify_q _GL_UNUSED; \
MAYBE_UNUSED uintmax_t _redcify_q; \
udiv_qrnnd (_redcify_q, r_prim, r, 0, n); \
} while (0)
@@ -964,7 +966,8 @@ static const unsigned char binvert_table[128] =
static inline uintmax_t
mulredc (uintmax_t a, uintmax_t b, uintmax_t m, uintmax_t mi)
{
uintmax_t rh, rl, q, th, tl _GL_UNUSED, xh;
uintmax_t rh, rl, q, th, xh;
MAYBE_UNUSED uintmax_t tl;
umul_ppmm (rh, rl, a, b);
q = rl * mi;
@@ -984,7 +987,8 @@ mulredc2 (uintmax_t *r1p,
uintmax_t a1, uintmax_t a0, uintmax_t b1, uintmax_t b0,
uintmax_t m1, uintmax_t m0, uintmax_t mi)
{
uintmax_t r1, r0, q, p1, p0 _GL_UNUSED, t1, t0, s1, s0;
uintmax_t r1, r0, q, p1, t1, t0, s1, s0;
MAYBE_UNUSED uintmax_t p0;
mi = -mi;
assert ((a1 >> (W_TYPE_SIZE - 1)) == 0);
assert ((b1 >> (W_TYPE_SIZE - 1)) == 0);
@@ -1254,7 +1258,7 @@ prime_p (uintmax_t n)
a_prim = s0 % n;
else
{
uintmax_t dummy _GL_UNUSED;
MAYBE_UNUSED uintmax_t dummy;
udiv_qrnnd (dummy, a_prim, s1, s0, n);
}
}
@@ -1802,7 +1806,7 @@ isqrt2 (uintmax_t nh, uintmax_t nl)
/* Do we need more than one iteration? */
for (;;)
{
uintmax_t r _GL_UNUSED;
MAYBE_UNUSED uintmax_t r;
uintmax_t q, y;
udiv_qrnnd (q, r, nh, nl, x);
y = (x + q) / 2;
+1 -1
View File
@@ -3177,7 +3177,7 @@ has_capability (char const *name)
}
#else
static bool
has_capability (char const *name _GL_UNUSED)
has_capability (MAYBE_UNUSED char const *name)
{
errno = ENOTSUP;
return false;
+9 -8
View File
@@ -427,10 +427,10 @@ Binary prefixes can be used, too: KiB=K, MiB=M, and so on.\n\
/* Define the print functions. */
#define PRINT_FIELDS(N, T, FMT_STRING, ACTION) \
#define PRINT_FIELDS(N, T, FMT_STRING_DECL, ACTION) \
static void \
N (size_t fields, size_t blank, void const *block, \
char const *FMT_STRING, int width, int pad) \
FMT_STRING_DECL, int width, int pad) \
{ \
T const *p = block; \
uintmax_t i; \
@@ -460,10 +460,11 @@ N (size_t fields, size_t blank, void const *block, \
}
#define PRINT_TYPE(N, T) \
PRINT_FIELDS (N, T, fmt_string, xprintf (fmt_string, adjusted_width, x))
PRINT_FIELDS (N, T, char const *fmt_string, \
xprintf (fmt_string, adjusted_width, x))
#define PRINT_FLOATTYPE(N, T, FTOASTR, BUFSIZE) \
PRINT_FIELDS (N, T, fmt_string _GL_UNUSED, \
PRINT_FIELDS (N, T, MAYBE_UNUSED char const *fmt_string, \
char buf[BUFSIZE]; \
FTOASTR (buf, sizeof buf, 0, 0, x); \
xprintf ("%*s", adjusted_width, buf))
@@ -498,7 +499,7 @@ dump_hexl_mode_trailer (size_t n_bytes, char const *block)
static void
print_named_ascii (size_t fields, size_t blank, void const *block,
char const *unused_fmt_string _GL_UNUSED,
MAYBE_UNUSED char const *unused_fmt_string,
int width, int pad)
{
unsigned char const *p = block;
@@ -529,7 +530,7 @@ print_named_ascii (size_t fields, size_t blank, void const *block,
static void
print_ascii (size_t fields, size_t blank, void const *block,
char const *unused_fmt_string _GL_UNUSED, int width,
MAYBE_UNUSED char const *unused_fmt_string, int width,
int pad)
{
unsigned char const *p = block;
@@ -1112,8 +1113,8 @@ skip (uintmax_t n_skip)
}
static void
format_address_none (uintmax_t address _GL_UNUSED,
char c _GL_UNUSED)
format_address_none (MAYBE_UNUSED uintmax_t address,
MAYBE_UNUSED char c)
{
}
+1 -1
View File
@@ -860,7 +860,7 @@ out_file_context (char *pformat, size_t prefix_len, char const *filename)
/* Print statfs info. Return zero upon success, nonzero upon failure. */
NODISCARD
static bool
print_statfs (char *pformat, size_t prefix_len, char mod _GL_UNUSED, char m,
print_statfs (char *pformat, size_t prefix_len, MAYBE_UNUSED char mod, char m,
int fd, char const *filename,
void const *data)
{
+1 -1
View File
@@ -1274,7 +1274,7 @@ main (int argc, char **argv)
int argi = 0;
int opti = 1;
bool require_set_attr;
bool speed_was_set _GL_UNUSED;
MAYBE_UNUSED bool speed_was_set;
bool verbose_output;
bool recoverable_output;
bool noargs = true;
+4 -4
View File
@@ -184,8 +184,8 @@ cleanup_buffer:
void
output_bsd (char const *file, int binary_file, void const *digest,
bool tagged, unsigned char delim, bool args _GL_UNUSED,
uintmax_t length _GL_UNUSED)
bool tagged, unsigned char delim, bool args,
uintmax_t length)
{
char hbuf[LONGEST_HUMAN_READABLE + 1];
@@ -201,8 +201,8 @@ output_bsd (char const *file, int binary_file, void const *digest,
void
output_sysv (char const *file, int binary_file, void const *digest,
bool tagged, unsigned char delim, bool args _GL_UNUSED,
uintmax_t length _GL_UNUSED)
bool tagged, unsigned char delim, bool args,
uintmax_t length)
{
char hbuf[LONGEST_HUMAN_READABLE + 1];
+4 -4
View File
@@ -9,10 +9,10 @@ typedef int (*sumfn)(FILE *, void *, uintmax_t*);
extern void
output_bsd (char const *file, int binary_file, void const *digest,
bool tagged, unsigned char delim, bool args _GL_UNUSED,
uintmax_t length _GL_UNUSED);
bool tagged, unsigned char delim, bool args,
uintmax_t length);
extern void
output_sysv (char const *file, int binary_file, void const *digest,
bool tagged, unsigned char delim, bool args _GL_UNUSED,
uintmax_t length _GL_UNUSED);
bool tagged, unsigned char delim, bool args,
uintmax_t length);
+1 -1
View File
@@ -417,7 +417,7 @@ record_or_unlink_tempfile (char const *fn, FILE *fp)
#else
static void
record_or_unlink_tempfile (char const *fn, FILE *fp _GL_UNUSED)
record_or_unlink_tempfile (char const *fn, MAYBE_UNUSED FILE *fp)
{
unlink (fn);
}
+1 -1
View File
@@ -285,7 +285,7 @@ record_relation (struct item *j, struct item *k)
}
static bool
count_items (struct item *unused _GL_UNUSED)
count_items (MAYBE_UNUSED struct item *unused)
{
n_strings++;
return false;