From 1fef50d07b0a2c209b3f8b546bc8da7801dedd0a Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 9 May 2025 15:52:15 -0700 Subject: [PATCH] maint: use MAYBE_UNUSED more consistently * src/basenc.c (no_required_padding): * gl/lib/smack.h (smack_new_label_from_self) (smack_set_label_for_self): * src/cksum.c (output_crc): * src/digest.c (md5_sum_stream, sha1_sum_stream) (sha224_sum_stream, sha256_sum_stream, sha384_sum_stream) (sha512_sum_stream, sm3_sum_stream, output_file): * src/stat.c (print_statfs, print_stat): * src/sum.c (output_bsd, output_sysv): * src/timeout.c (chld): Mark possibly-unused parameters with MAYBE_UNUSED. --- gl/lib/smack.h | 4 ++-- src/basenc.c | 2 +- src/cksum.c | 5 +++-- src/digest.c | 22 +++++++++++++--------- src/stat.c | 4 ++-- src/sum.c | 10 +++++----- src/timeout.c | 2 +- 7 files changed, 27 insertions(+), 22 deletions(-) diff --git a/gl/lib/smack.h b/gl/lib/smack.h index 99f7747aa2..c503d0b79f 100644 --- a/gl/lib/smack.h +++ b/gl/lib/smack.h @@ -21,13 +21,13 @@ # include #else static inline ssize_t -smack_new_label_from_self (char **label) +smack_new_label_from_self (MAYBE_UNUSED char **label) { return -1; } static inline int -smack_set_label_for_self (char const *label) +smack_set_label_for_self (MAYBE_UNUSED char const *label) { return -1; } diff --git a/src/basenc.c b/src/basenc.c index de1070b44e..3f550a71fa 100644 --- a/src/basenc.c +++ b/src/basenc.c @@ -193,7 +193,7 @@ base64_required_padding (int len) #if BASE_TYPE == 42 static int -no_required_padding (int len) +no_required_padding (MAYBE_UNUSED int len) { return 0; } diff --git a/src/cksum.c b/src/cksum.c index 3381125bdb..8711ffeb93 100644 --- a/src/cksum.c +++ b/src/cksum.c @@ -356,8 +356,9 @@ crc32b_sum_stream (FILE *stream, void *resstream, uintmax_t *reslen) If ARGS is true, also print the FILE name. */ void -output_crc (char const *file, int binary_file, void const *digest, bool raw, - bool tagged, unsigned char delim, bool args, uintmax_t length) +output_crc (char const *file, MAYBE_UNUSED int binary_file, + void const *digest, bool raw, MAYBE_UNUSED bool tagged, + unsigned char delim, bool args, uintmax_t length) { if (raw) { diff --git a/src/digest.c b/src/digest.c index 1f65c73b48..302739e9f5 100644 --- a/src/digest.c +++ b/src/digest.c @@ -245,32 +245,36 @@ static digest_output_fn sum_output_fns[]= #if HASH_ALGO_CKSUM static int -md5_sum_stream (FILE *stream, void *resstream, uintmax_t *length) +md5_sum_stream (FILE *stream, void *resstream, MAYBE_UNUSED uintmax_t *length) { return md5_stream (stream, resstream); } static int -sha1_sum_stream (FILE *stream, void *resstream, uintmax_t *length) +sha1_sum_stream (FILE *stream, void *resstream, MAYBE_UNUSED uintmax_t *length) { return sha1_stream (stream, resstream); } static int -sha224_sum_stream (FILE *stream, void *resstream, uintmax_t *length) +sha224_sum_stream (FILE *stream, void *resstream, + MAYBE_UNUSED uintmax_t *length) { return sha224_stream (stream, resstream); } static int -sha256_sum_stream (FILE *stream, void *resstream, uintmax_t *length) +sha256_sum_stream (FILE *stream, void *resstream, + MAYBE_UNUSED uintmax_t *length) { return sha256_stream (stream, resstream); } static int -sha384_sum_stream (FILE *stream, void *resstream, uintmax_t *length) +sha384_sum_stream (FILE *stream, void *resstream, + MAYBE_UNUSED uintmax_t *length) { return sha384_stream (stream, resstream); } static int -sha512_sum_stream (FILE *stream, void *resstream, uintmax_t *length) +sha512_sum_stream (FILE *stream, void *resstream, + MAYBE_UNUSED uintmax_t *length) { return sha512_stream (stream, resstream); } @@ -280,7 +284,7 @@ blake2b_sum_stream (FILE *stream, void *resstream, uintmax_t *length) return blake2b_stream (stream, resstream, *length); } static int -sm3_sum_stream (FILE *stream, void *resstream, uintmax_t *length) +sm3_sum_stream (FILE *stream, void *resstream, MAYBE_UNUSED uintmax_t *length) { return sm3_stream (stream, resstream); } @@ -1037,8 +1041,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 raw, bool tagged, unsigned char delim, MAYBE_UNUSED bool args, - MAYBE_UNUSED uintmax_t length) + MAYBE_UNUSED bool raw, bool tagged, unsigned char delim, + MAYBE_UNUSED bool args, MAYBE_UNUSED uintmax_t length) { # if HASH_ALGO_CKSUM if (raw) diff --git a/src/stat.c b/src/stat.c index 3ea7da7f56..df9e3d4408 100644 --- a/src/stat.c +++ b/src/stat.c @@ -857,7 +857,7 @@ out_file_context (char *pformat, size_t prefix_len, char const *filename) NODISCARD static bool print_statfs (char *pformat, size_t prefix_len, MAYBE_UNUSED char mod, char m, - int fd, char const *filename, + MAYBE_UNUSED int fd, char const *filename, void const *data) { STRUCT_STATVFS const *statfsbuf = data; @@ -1501,7 +1501,7 @@ unsigned_file_size (off_t size) /* Print stat info. Return zero upon success, nonzero upon failure. */ static bool print_stat (char *pformat, size_t prefix_len, char mod, char m, - int fd, char const *filename, void const *data) + MAYBE_UNUSED int fd, char const *filename, void const *data) { struct print_args *parg = (struct print_args *) data; struct stat *statbuf = parg->st; diff --git a/src/sum.c b/src/sum.c index 95af4e3858..08bb88b12e 100644 --- a/src/sum.c +++ b/src/sum.c @@ -184,8 +184,8 @@ cleanup_buffer: If ARGS is true, also print the FILE name. */ void -output_bsd (char const *file, int binary_file, void const *digest, - bool raw, bool tagged, unsigned char delim, bool args, +output_bsd (char const *file, MAYBE_UNUSED int binary_file, void const *digest, + bool raw, MAYBE_UNUSED bool tagged, unsigned char delim, bool args, uintmax_t length) { if (raw) @@ -209,9 +209,9 @@ output_bsd (char const *file, int binary_file, void const *digest, If ARGS is true, also print the FILE name. */ void -output_sysv (char const *file, int binary_file, void const *digest, - bool raw, bool tagged, unsigned char delim, bool args, - uintmax_t length) +output_sysv (char const *file, MAYBE_UNUSED int binary_file, + void const *digest, bool raw, MAYBE_UNUSED bool tagged, + unsigned char delim, bool args, uintmax_t length) { if (raw) { diff --git a/src/timeout.c b/src/timeout.c index e869b2533d..a73dd32970 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -187,7 +187,7 @@ send_sig (pid_t where, int sig) /* Signal handler which is required for sigsuspend() to be interrupted whenever SIGCHLD is received. */ static void -chld (int sig) +chld (MAYBE_UNUSED int sig) { } -- 2.47.3