I'd rather use MAYBE_UNUSED to avoid the warnings for unused arguments,
or ignore_value only if needed.

-- 8< --

* src/cksum_crc.c (crc32b_sum_stream): Don't void cast a function.
* src/copy.c (clone_file, set_author, copy_internal): Use MAYBE_UNUSED
in the prototype instead of void casting the arguments.
---
 src/cksum_crc.c |  2 +-
 src/copy.c      | 13 ++++---------
 2 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/src/cksum_crc.c b/src/cksum_crc.c
index fccf3d27c..077bb6775 100644
--- a/src/cksum_crc.c
+++ b/src/cksum_crc.c
@@ -327,7 +327,7 @@ crc32b_sum_stream (FILE *stream, void *resstream, uintmax_t 
*reslen)
 
 # if GL_CRC_X86_64_PCLMUL
   if (cksum_debug)
-    (void) pclmul_supported ();
+    pclmul_supported ();
 # endif
 
   while ((bytes_read = fread (buf, 1, BUFLEN, stream)) > 0)
diff --git a/src/copy.c b/src/copy.c
index 4af66c882..5fae7f318 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -226,13 +226,11 @@ is_terminal_error (int err)
 /* Perform the O(1) btrfs clone operation, if possible.
    Upon success, return 0.  Otherwise, return -1 and set errno.  */
 static inline int
-clone_file (int dest_fd, int src_fd)
+clone_file (MAYBE_UNUSED int dest_fd, MAYBE_UNUSED int src_fd)
 {
 #ifdef FICLONE
   return ioctl (dest_fd, FICLONE, src_fd);
 #else
-  (void) dest_fd;
-  (void) src_fd;
   errno = ENOTSUP;
   return -1;
 #endif
@@ -541,7 +539,8 @@ set_owner (const struct cp_options *x, char const *dst_name,
    DST_NAME if defined.  */
 
 static void
-set_author (char const *dst_name, int dest_desc, const struct stat *src_sb)
+set_author (MAYBE_UNUSED char const *dst_name, MAYBE_UNUSED int dest_desc,
+            MAYBE_UNUSED const struct stat *src_sb)
 {
 #if HAVE_STRUCT_STAT_ST_AUTHOR
   /* FIXME: Modify the following code so that it does not
@@ -561,10 +560,6 @@ set_author (char const *dst_name, int dest_desc, const 
struct stat *src_sb)
                quoteaf (dst_name));
       mach_port_deallocate (mach_task_self (), file);
     }
-#else
-  (void) dst_name;
-  (void) dest_desc;
-  (void) src_sb;
 #endif
 }
 
@@ -2166,7 +2161,7 @@ skip:
           if (x->set_security_context)
             {
               /* -Z failures are only warnings currently.  */
-              (void) set_file_security_ctx (dst_name, true, x);
+              set_file_security_ctx (dst_name, true, x);
             }
 
           if (rename_succeeded)
-- 
2.51.1


Reply via email to