Ver código fonte

tar: make safe for -Wunused-parameter

This also ports to C23 [[maybe_unused]].
* configure.ac (WARN_CFLAGS): Do not add -Wno-unused-parameter.
Add MAYBE_UNUSED where needed in source code.
Also, put it at the front where C23 requires it.
Paul Eggert 1 ano atrás
pai
commit
2ccd643d01
14 arquivos alterados com 108 adições e 110 exclusões
  1. 0 1
      configure.ac
  2. 1 1
      src/buffer.c
  3. 1 1
      src/common.h
  4. 1 1
      src/compare.c
  5. 4 4
      src/create.c
  6. 6 3
      src/exclist.c
  7. 4 4
      src/extract.c
  8. 1 1
      src/list.c
  9. 4 9
      src/names.c
  10. 2 2
      src/sparse.c
  11. 1 1
      src/tar.c
  12. 11 16
      src/xattrs.c
  13. 1 1
      src/xattrs.h
  14. 71 65
      src/xheader.c

+ 0 - 1
configure.ac

@@ -189,7 +189,6 @@ if test "$gl_gcc_warnings" = yes; then
   done
   gl_WARN_ADD([-Wno-sign-compare])     # Too many warnings for now
   gl_WARN_ADD([-Wno-type-limits])      # It's OK to optimize based on types.
-  gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
   gl_WARN_ADD([-Wno-format-nonliteral])
 
   gl_WARN_ADD([-fdiagnostics-show-option])

+ 1 - 1
src/buffer.c

@@ -1828,7 +1828,7 @@ simple_flush_read (void)
 
 /* Simple flush write (no multi-volume or label extensions) */
 static void
-simple_flush_write (size_t level MAYBE_UNUSED)
+simple_flush_write (MAYBE_UNUSED size_t level)
 {
   ssize_t status;
 

+ 1 - 1
src/common.h

@@ -616,7 +616,7 @@ uintmax_t uintmax_from_header (const char *buf, size_t size);
 
 void list_archive (void);
 void test_archive_label (void);
-void print_for_mkdir (char *dirname, int length, mode_t mode);
+void print_for_mkdir (char *dirname, mode_t mode);
 void print_header (struct tar_stat_info *st, union block *blk,
 	           off_t block_ordinal);
 void read_and (void (*do_something) (void));

+ 1 - 1
src/compare.c

@@ -73,7 +73,7 @@ report_difference (struct tar_stat_info *st, const char *fmt, ...)
 
 /* Take a buffer returned by read_and_process and do nothing with it.  */
 static int
-process_noop (size_t size MAYBE_UNUSED, char *data MAYBE_UNUSED)
+process_noop (MAYBE_UNUSED size_t size, MAYBE_UNUSED char *data)
 {
   return 1;
 }

+ 4 - 4
src/create.c

@@ -1737,7 +1737,7 @@ dump_file0 (struct tar_stat_info *st, char const *name, char const *p)
       bool ok;
       struct stat st2;
 
-      xattrs_acls_get (parentfd, name, st, 0, !is_dir);
+      xattrs_acls_get (parentfd, name, st, !is_dir);
       xattrs_selinux_get (parentfd, name, st, fd);
       xattrs_xattrs_get (parentfd, name, st, fd);
 
@@ -1900,21 +1900,21 @@ dump_file0 (struct tar_stat_info *st, char const *name, char const *p)
   else if (S_ISCHR (st->stat.st_mode))
     {
       type = CHRTYPE;
-      xattrs_acls_get (parentfd, name, st, 0, true);
+      xattrs_acls_get (parentfd, name, st, true);
       xattrs_selinux_get (parentfd, name, st, 0);
       xattrs_xattrs_get (parentfd, name, st, 0);
     }
   else if (S_ISBLK (st->stat.st_mode))
     {
       type = BLKTYPE;
-      xattrs_acls_get (parentfd, name, st, 0, true);
+      xattrs_acls_get (parentfd, name, st, true);
       xattrs_selinux_get (parentfd, name, st, 0);
       xattrs_xattrs_get (parentfd, name, st, 0);
     }
   else if (S_ISFIFO (st->stat.st_mode))
     {
       type = FIFOTYPE;
-      xattrs_acls_get (parentfd, name, st, 0, true);
+      xattrs_acls_get (parentfd, name, st, true);
       xattrs_selinux_get (parentfd, name, st, 0);
       xattrs_xattrs_get (parentfd, name, st, 0);
     }

+ 6 - 3
src/exclist.c

@@ -200,7 +200,8 @@ excluded_name (char const *name, struct tar_stat_info *st)
 }
 
 static void
-cvs_addfn (struct exclude *ex, char const *pattern, int options, void *data)
+cvs_addfn (struct exclude *ex, char const *pattern, int options,
+	   MAYBE_UNUSED void *data)
 {
   struct wordsplit ws;
   size_t i;
@@ -215,7 +216,8 @@ cvs_addfn (struct exclude *ex, char const *pattern, int options, void *data)
 }
 
 static void
-git_addfn (struct exclude *ex, char const *pattern, int options, void *data)
+git_addfn (struct exclude *ex, char const *pattern, int options,
+	   MAYBE_UNUSED void *data)
 {
   while (isspace (*pattern))
     ++pattern;
@@ -227,7 +229,8 @@ git_addfn (struct exclude *ex, char const *pattern, int options, void *data)
 }
 
 static void
-bzr_addfn (struct exclude *ex, char const *pattern, int options, void *data)
+bzr_addfn (struct exclude *ex, char const *pattern, int options,
+	   MAYBE_UNUSED void *data)
 {
   while (isspace (*pattern))
     ++pattern;

+ 4 - 4
src/extract.c

@@ -726,7 +726,7 @@ make_directories (char *file_name)
 			  0, mode & ~ current_umask, MODE_RWX,
 			  desired_mode, AT_SYMLINK_NOFOLLOW);
 
-	  print_for_mkdir (file_name, cursor - file_name, desired_mode);
+	  print_for_mkdir (file_name, desired_mode);
 	  parent_end = NULL;
 	}
       else
@@ -1400,7 +1400,7 @@ find_delayed_link_source (char const *name)
 
 static int
 create_placeholder_file (char *file_name, bool is_symlink, bool *interdir_made,
-			 struct delayed_link *prev)
+			 MAYBE_UNUSED struct delayed_link *prev)
 {
   int fd;
   struct stat st;
@@ -1500,7 +1500,7 @@ create_placeholder_file (char *file_name, bool is_symlink, bool *interdir_made,
 }
 
 static int
-extract_link (char *file_name, int typeflag)
+extract_link (char *file_name, MAYBE_UNUSED int typeflag)
 {
   bool interdir_made = false;
   char const *link_name;
@@ -1570,7 +1570,7 @@ extract_link (char *file_name, int typeflag)
 }
 
 static int
-extract_symlink (char *file_name, int typeflag)
+extract_symlink (char *file_name, MAYBE_UNUSED int typeflag)
 {
 #ifdef HAVE_SYMLINK
   bool interdir_made = false;

+ 1 - 1
src/list.c

@@ -1376,7 +1376,7 @@ print_header (struct tar_stat_info *st, union block *blk,
 
 /* Print a similar line when we make a directory automatically.  */
 void
-print_for_mkdir (char *dirname, int length, mode_t mode)
+print_for_mkdir (char *dirname, mode_t mode)
 {
   char modes[11];
 

+ 4 - 9
src/names.c

@@ -1269,10 +1269,9 @@ add_starting_file (char const *file_name)
   starting_file_option = true;
 }
 
-/* Find a match for FILE_NAME (whose string length is LENGTH) in the name
-   list.  */
+/* Find a match for FILE_NAME in the name list.  */
 static struct name *
-namelist_match (char const *file_name, size_t length)
+namelist_match (char const *file_name)
 {
   struct name *p;
 
@@ -1307,8 +1306,6 @@ remname (struct name *name)
 bool
 name_match (const char *file_name)
 {
-  size_t length = strlen (file_name);
-
   while (1)
     {
       struct name *cursor = namelist;
@@ -1324,7 +1321,7 @@ name_match (const char *file_name)
 	  return true;
 	}
 
-      cursor = namelist_match (file_name, length);
+      cursor = namelist_match (file_name);
       if (starting_file_option)
 	{
 	  /* If starting_file_option is set, the head of the list is the name
@@ -1877,11 +1874,9 @@ collect_and_sort_names (void)
 struct name *
 name_scan (const char *file_name)
 {
-  size_t length = strlen (file_name);
-
   while (1)
     {
-      struct name *cursor = namelist_match (file_name, length);
+      struct name *cursor = namelist_match (file_name);
       if (cursor)
 	return cursor;
 

+ 2 - 2
src/sparse.c

@@ -755,7 +755,7 @@ enum oldgnu_add_status
   };
 
 static bool
-oldgnu_sparse_member_p (struct tar_sparse_file *file MAYBE_UNUSED)
+oldgnu_sparse_member_p (MAYBE_UNUSED struct tar_sparse_file *file)
 {
   return current_header->header.typeflag == GNUTYPE_SPARSE;
 }
@@ -899,7 +899,7 @@ static struct tar_sparse_optab const oldgnu_optab = {
 /* Star */
 
 static bool
-star_sparse_member_p (struct tar_sparse_file *file MAYBE_UNUSED)
+star_sparse_member_p (MAYBE_UNUSED struct tar_sparse_file *file)
 {
   return current_header->header.typeflag == GNUTYPE_SPARSE;
 }

+ 1 - 1
src/tar.c

@@ -1135,7 +1135,7 @@ report_textual_dates (struct tar_args *args)
 
 
 static char *
-tar_help_filter (int key, const char *text, void *input)
+tar_help_filter (int key, const char *text, MAYBE_UNUSED void *input)
 {
   struct obstack stk;
   char *s;

+ 11 - 16
src/xattrs.c

@@ -69,7 +69,7 @@ xattr_map_add (struct xattr_map *map,
 	       const char *key, const char *val, size_t len)
 {
   struct xattr_array *p;
-  
+
   if (map->xm_size == map->xm_max)
     map->xm_map = x2nrealloc (map->xm_map, &map->xm_max,
 			      sizeof (map->xm_map[0]));
@@ -285,13 +285,12 @@ fixup_extra_acl_fields (char *ptr)
 static void
 xattrs__acls_set (struct tar_stat_info const *st,
                   char const *file_name, int type,
-                  char *ptr, size_t len, bool def)
+		  char *ptr, bool def)
 {
   acl_t acl;
 
   if (ptr)
     {
-      /* assert (strlen (ptr) == len); */
       ptr = fixup_extra_acl_fields (ptr);
       acl = acl_from_text (ptr);
     }
@@ -396,7 +395,6 @@ acls_get_text (int parentfd, const char *file_name, acl_type_t type,
 
 static void
 xattrs__acls_get_a (int parentfd, const char *file_name,
-                    struct tar_stat_info *st,
                     char **ret_ptr, size_t *ret_len)
 {
   acls_get_text (parentfd, file_name, ACL_TYPE_ACCESS, ret_ptr, ret_len);
@@ -405,7 +403,6 @@ xattrs__acls_get_a (int parentfd, const char *file_name,
 /* "system.posix_acl_default" */
 static void
 xattrs__acls_get_d (int parentfd, char const *file_name,
-                    struct tar_stat_info *st,
                     char **ret_ptr, size_t * ret_len)
 {
   acls_get_text (parentfd, file_name, ACL_TYPE_DEFAULT, ret_ptr, ret_len);
@@ -451,7 +448,7 @@ acls_one_line (const char *prefix, char delim,
 
 void
 xattrs_acls_get (int parentfd, char const *file_name,
-                 struct tar_stat_info *st, int fd, int xisfile)
+		 struct tar_stat_info *st, int xisfile)
 {
   if (acls_option > 0)
     {
@@ -470,10 +467,10 @@ xattrs_acls_get (int parentfd, char const *file_name,
           return;
         }
 
-      xattrs__acls_get_a (parentfd, file_name, st,
+      xattrs__acls_get_a (parentfd, file_name,
                           &st->acls_a_ptr, &st->acls_a_len);
       if (!xisfile)
-        xattrs__acls_get_d (parentfd, file_name, st,
+	xattrs__acls_get_d (parentfd, file_name,
                             &st->acls_d_ptr, &st->acls_d_len);
 #endif
     }
@@ -492,10 +489,10 @@ xattrs_acls_set (struct tar_stat_info const *st,
       done = 1;
 #else
       xattrs__acls_set (st, file_name, ACL_TYPE_ACCESS,
-                        st->acls_a_ptr, st->acls_a_len, false);
+			st->acls_a_ptr, false);
       if (typeflag == DIRTYPE || typeflag == GNUTYPE_DUMPDIR)
         xattrs__acls_set (st, file_name, ACL_TYPE_DEFAULT,
-                          st->acls_d_ptr, st->acls_d_len, true);
+			  st->acls_d_ptr, true);
 #endif
     }
 }
@@ -615,8 +612,7 @@ xattrs_xattrs_get (int parentfd, char const *file_name,
 
 #ifdef HAVE_XATTRS
 static void
-xattrs__fd_set (struct tar_stat_info const *st,
-                char const *file_name, char typeflag,
+xattrs__fd_set (char const *file_name, char typeflag,
                 const char *attr, const char *ptr, size_t len)
 {
   if (ptr)
@@ -732,7 +728,7 @@ xattrs_kw_included (const char *kw, bool archiving)
 }
 
 static bool
-xattrs_kw_excluded (const char *kw, bool archiving)
+xattrs_kw_excluded (const char *kw)
 {
   return xattrs_setup.excl.size ?
     xattrs_matches_mask (kw, &xattrs_setup.excl) : false;
@@ -744,8 +740,7 @@ xattrs_kw_excluded (const char *kw, bool archiving)
 static bool
 xattrs_masked_out (const char *kw, bool archiving)
 {
-  return xattrs_kw_included (kw, archiving) ?
-    xattrs_kw_excluded (kw, archiving) : true;
+  return xattrs_kw_included (kw, archiving) ? xattrs_kw_excluded (kw) : true;
 }
 
 void
@@ -783,7 +778,7 @@ xattrs_xattrs_set (struct tar_stat_info const *st,
             /* we don't want to restore this keyword */
             continue;
 
-          xattrs__fd_set (st, file_name, typeflag, keyword,
+	  xattrs__fd_set (file_name, typeflag, keyword,
                           st->xattr_map.xm_map[i].xval_ptr,
                           st->xattr_map.xm_map[i].xval_len);
         }

+ 1 - 1
src/xattrs.h

@@ -30,7 +30,7 @@ extern void xattrs_mask_add (const char *mask, bool incl);
 extern void xattrs_clear_setup (void);
 
 extern void xattrs_acls_get (int parentfd, char const *file_name,
-                             struct tar_stat_info *st, int fd, int xisfile);
+			     struct tar_stat_info *st, int xisfile);
 extern void xattrs_selinux_get (int parentfd, char const *file_name,
                                 struct tar_stat_info *st, int fd);
 extern void xattrs_xattrs_get (int parentfd, char const *file_name,

+ 71 - 65
src/xheader.c

@@ -723,7 +723,7 @@ xheader_decode (struct tar_stat_info *st)
 
 static void
 decg (void *data, char const *keyword, char const *value,
-      size_t size MAYBE_UNUSED)
+      MAYBE_UNUSED size_t size)
 {
   struct keyword_list **kwl = data;
   struct xhdr_tab const *tab = locate_handler (keyword);
@@ -1121,24 +1121,24 @@ decode_num (uintmax_t *num, char const *arg, uintmax_t maxval,
 }
 
 static void
-dummy_coder (struct tar_stat_info const *st MAYBE_UNUSED,
-	     char const *keyword MAYBE_UNUSED,
-	     struct xheader *xhdr MAYBE_UNUSED,
-	     void const *data MAYBE_UNUSED)
+dummy_coder (MAYBE_UNUSED struct tar_stat_info const *st,
+	     MAYBE_UNUSED char const *keyword,
+	     MAYBE_UNUSED struct xheader *xhdr,
+	     MAYBE_UNUSED void const *data)
 {
 }
 
 static void
-dummy_decoder (struct tar_stat_info *st MAYBE_UNUSED,
-	       char const *keyword MAYBE_UNUSED,
-	       char const *arg MAYBE_UNUSED,
-	       size_t size MAYBE_UNUSED)
+dummy_decoder (MAYBE_UNUSED struct tar_stat_info *st,
+	       MAYBE_UNUSED char const *keyword,
+	       MAYBE_UNUSED char const *arg,
+	       MAYBE_UNUSED size_t size)
 {
 }
 
 static void
 atime_coder (struct tar_stat_info const *st, char const *keyword,
-	     struct xheader *xhdr, void const *data MAYBE_UNUSED)
+	     struct xheader *xhdr, MAYBE_UNUSED void const *data)
 {
   code_time (st->atime, keyword, xhdr);
 }
@@ -1147,7 +1147,7 @@ static void
 atime_decoder (struct tar_stat_info *st,
 	       char const *keyword,
 	       char const *arg,
-	       size_t size MAYBE_UNUSED)
+	       MAYBE_UNUSED size_t size)
 {
   struct timespec ts;
   if (decode_time (&ts, arg, keyword))
@@ -1156,7 +1156,7 @@ atime_decoder (struct tar_stat_info *st,
 
 static void
 gid_coder (struct tar_stat_info const *st, char const *keyword,
-	   struct xheader *xhdr, void const *data MAYBE_UNUSED)
+	   struct xheader *xhdr, MAYBE_UNUSED void const *data)
 {
   code_signed_num (st->stat.st_gid, keyword,
 		   TYPE_MINIMUM (gid_t), TYPE_MAXIMUM (gid_t), xhdr);
@@ -1166,7 +1166,7 @@ static void
 gid_decoder (struct tar_stat_info *st,
 	     char const *keyword,
 	     char const *arg,
-	     size_t size MAYBE_UNUSED)
+	     MAYBE_UNUSED size_t size)
 {
   intmax_t u;
   if (decode_signed_num (&u, arg, TYPE_MINIMUM (gid_t),
@@ -1176,39 +1176,39 @@ gid_decoder (struct tar_stat_info *st,
 
 static void
 gname_coder (struct tar_stat_info const *st, char const *keyword,
-	     struct xheader *xhdr, void const *data MAYBE_UNUSED)
+	     struct xheader *xhdr, MAYBE_UNUSED void const *data)
 {
   code_string (st->gname, keyword, xhdr);
 }
 
 static void
 gname_decoder (struct tar_stat_info *st,
-	       char const *keyword MAYBE_UNUSED,
+	       MAYBE_UNUSED char const *keyword,
 	       char const *arg,
-	       size_t size MAYBE_UNUSED)
+	       MAYBE_UNUSED size_t size)
 {
   decode_string (&st->gname, arg);
 }
 
 static void
 linkpath_coder (struct tar_stat_info const *st, char const *keyword,
-		struct xheader *xhdr, void const *data MAYBE_UNUSED)
+		struct xheader *xhdr, MAYBE_UNUSED void const *data)
 {
   code_string (st->link_name, keyword, xhdr);
 }
 
 static void
 linkpath_decoder (struct tar_stat_info *st,
-		  char const *keyword MAYBE_UNUSED,
+		  MAYBE_UNUSED char const *keyword,
 		  char const *arg,
-		  size_t size MAYBE_UNUSED)
+		  MAYBE_UNUSED size_t size)
 {
   decode_string (&st->link_name, arg);
 }
 
 static void
 ctime_coder (struct tar_stat_info const *st, char const *keyword,
-	     struct xheader *xhdr, void const *data MAYBE_UNUSED)
+	     struct xheader *xhdr, MAYBE_UNUSED void const *data)
 {
   code_time (st->ctime, keyword, xhdr);
 }
@@ -1217,7 +1217,7 @@ static void
 ctime_decoder (struct tar_stat_info *st,
 	       char const *keyword,
 	       char const *arg,
-	       size_t size MAYBE_UNUSED)
+	       MAYBE_UNUSED size_t size)
 {
   struct timespec ts;
   if (decode_time (&ts, arg, keyword))
@@ -1236,7 +1236,7 @@ static void
 mtime_decoder (struct tar_stat_info *st,
 	       char const *keyword,
 	       char const *arg,
-	       size_t size MAYBE_UNUSED)
+	       MAYBE_UNUSED size_t size)
 {
   struct timespec ts;
   if (decode_time (&ts, arg, keyword))
@@ -1245,7 +1245,7 @@ mtime_decoder (struct tar_stat_info *st,
 
 static void
 path_coder (struct tar_stat_info const *st, char const *keyword,
-	    struct xheader *xhdr, void const *data MAYBE_UNUSED)
+	    struct xheader *xhdr, MAYBE_UNUSED void const *data)
 {
   code_string (st->file_name, keyword, xhdr);
 }
@@ -1264,9 +1264,9 @@ raw_path_decoder (struct tar_stat_info *st, char const *arg)
 
 static void
 path_decoder (struct tar_stat_info *st,
-	      char const *keyword MAYBE_UNUSED,
+	      MAYBE_UNUSED char const *keyword,
 	      char const *arg,
-	      size_t size MAYBE_UNUSED)
+	      MAYBE_UNUSED size_t size)
 {
   if (! st->sparse_name_done)
     raw_path_decoder (st, arg);
@@ -1274,9 +1274,9 @@ path_decoder (struct tar_stat_info *st,
 
 static void
 sparse_path_decoder (struct tar_stat_info *st,
-                     char const *keyword MAYBE_UNUSED,
+		     MAYBE_UNUSED char const *keyword,
                      char const *arg,
-                     size_t size MAYBE_UNUSED)
+		     MAYBE_UNUSED size_t size)
 {
   st->sparse_name_done = true;
   raw_path_decoder (st, arg);
@@ -1284,7 +1284,7 @@ sparse_path_decoder (struct tar_stat_info *st,
 
 static void
 size_coder (struct tar_stat_info const *st, char const *keyword,
-	    struct xheader *xhdr, void const *data MAYBE_UNUSED)
+	    struct xheader *xhdr, MAYBE_UNUSED void const *data)
 {
   code_num (st->stat.st_size, keyword, xhdr);
 }
@@ -1293,7 +1293,7 @@ static void
 size_decoder (struct tar_stat_info *st,
 	      char const *keyword,
 	      char const *arg,
-	      size_t size MAYBE_UNUSED)
+	      MAYBE_UNUSED size_t size)
 {
   uintmax_t u;
   if (decode_num (&u, arg, TYPE_MAXIMUM (off_t), keyword))
@@ -1302,7 +1302,7 @@ size_decoder (struct tar_stat_info *st,
 
 static void
 uid_coder (struct tar_stat_info const *st, char const *keyword,
-	   struct xheader *xhdr, void const *data MAYBE_UNUSED)
+	   struct xheader *xhdr, MAYBE_UNUSED void const *data)
 {
   code_signed_num (st->stat.st_uid, keyword,
 		   TYPE_MINIMUM (uid_t), TYPE_MAXIMUM (uid_t), xhdr);
@@ -1312,7 +1312,7 @@ static void
 uid_decoder (struct tar_stat_info *st,
 	     char const *keyword,
 	     char const *arg,
-	     size_t size MAYBE_UNUSED)
+	     MAYBE_UNUSED size_t size)
 {
   intmax_t u;
   if (decode_signed_num (&u, arg, TYPE_MINIMUM (uid_t),
@@ -1322,16 +1322,16 @@ uid_decoder (struct tar_stat_info *st,
 
 static void
 uname_coder (struct tar_stat_info const *st, char const *keyword,
-	     struct xheader *xhdr, void const *data MAYBE_UNUSED)
+	     struct xheader *xhdr, MAYBE_UNUSED void const *data)
 {
   code_string (st->uname, keyword, xhdr);
 }
 
 static void
 uname_decoder (struct tar_stat_info *st,
-	       char const *keyword MAYBE_UNUSED,
+	       MAYBE_UNUSED char const *keyword,
 	       char const *arg,
-	       size_t size MAYBE_UNUSED)
+	       MAYBE_UNUSED size_t size)
 {
   decode_string (&st->uname, arg);
 }
@@ -1347,7 +1347,7 @@ static void
 sparse_size_decoder (struct tar_stat_info *st,
 		     char const *keyword,
 		     char const *arg,
-		     size_t size MAYBE_UNUSED)
+		     MAYBE_UNUSED size_t size)
 {
   uintmax_t u;
   if (decode_num (&u, arg, TYPE_MAXIMUM (off_t), keyword))
@@ -1360,7 +1360,7 @@ sparse_size_decoder (struct tar_stat_info *st,
 static void
 sparse_numblocks_coder (struct tar_stat_info const *st, char const *keyword,
 			struct xheader *xhdr,
-			void const *data MAYBE_UNUSED)
+			MAYBE_UNUSED void const *data)
 {
   code_num (st->sparse_map_avail, keyword, xhdr);
 }
@@ -1369,7 +1369,7 @@ static void
 sparse_numblocks_decoder (struct tar_stat_info *st,
 			  char const *keyword,
 			  char const *arg,
-			  size_t size MAYBE_UNUSED)
+			  MAYBE_UNUSED size_t size)
 {
   uintmax_t u;
   if (decode_num (&u, arg, SIZE_MAX, keyword))
@@ -1392,7 +1392,7 @@ static void
 sparse_offset_decoder (struct tar_stat_info *st,
 		       char const *keyword,
 		       char const *arg,
-		       size_t size MAYBE_UNUSED)
+		       MAYBE_UNUSED size_t size)
 {
   uintmax_t u;
   if (decode_num (&u, arg, TYPE_MAXIMUM (off_t), keyword))
@@ -1417,7 +1417,7 @@ static void
 sparse_numbytes_decoder (struct tar_stat_info *st,
 			 char const *keyword,
 			 char const *arg,
-			 size_t size MAYBE_UNUSED)
+			 MAYBE_UNUSED size_t size)
 {
   uintmax_t u;
   if (decode_num (&u, arg, TYPE_MAXIMUM (off_t), keyword))
@@ -1434,7 +1434,7 @@ static void
 sparse_map_decoder (struct tar_stat_info *st,
 		    char const *keyword,
 		    char const *arg,
-		    size_t size MAYBE_UNUSED)
+		    MAYBE_UNUSED size_t size)
 {
   int offset = 1;
   struct sp_array e;
@@ -1508,7 +1508,7 @@ sparse_map_decoder (struct tar_stat_info *st,
 }
 
 static void
-dumpdir_coder (struct tar_stat_info const *st, char const *keyword,
+dumpdir_coder (MAYBE_UNUSED struct tar_stat_info const *st, char const *keyword,
 	       struct xheader *xhdr, void const *data)
 {
   xheader_print_n (xhdr, keyword, data, dumpdir_size (data));
@@ -1516,7 +1516,7 @@ dumpdir_coder (struct tar_stat_info const *st, char const *keyword,
 
 static void
 dumpdir_decoder (struct tar_stat_info *st,
-		 char const *keyword MAYBE_UNUSED,
+		 MAYBE_UNUSED char const *keyword,
 		 char const *arg,
 		 size_t size)
 {
@@ -1525,23 +1525,25 @@ dumpdir_decoder (struct tar_stat_info *st,
 }
 
 static void
-volume_label_coder (struct tar_stat_info const *st, char const *keyword,
+volume_label_coder (MAYBE_UNUSED struct tar_stat_info const *st,
+		    char const *keyword,
 		    struct xheader *xhdr, void const *data)
 {
   code_string (data, keyword, xhdr);
 }
 
 static void
-volume_label_decoder (struct tar_stat_info *st,
-		      char const *keyword MAYBE_UNUSED,
+volume_label_decoder (MAYBE_UNUSED struct tar_stat_info *st,
+		      MAYBE_UNUSED char const *keyword,
 		      char const *arg,
-		      size_t size MAYBE_UNUSED)
+		      MAYBE_UNUSED size_t size)
 {
   decode_string (&volume_label, arg);
 }
 
 static void
-volume_size_coder (struct tar_stat_info const *st, char const *keyword,
+volume_size_coder (MAYBE_UNUSED struct tar_stat_info const *st,
+		   char const *keyword,
 		   struct xheader *xhdr, void const *data)
 {
   off_t const *v = data;
@@ -1549,9 +1551,9 @@ volume_size_coder (struct tar_stat_info const *st, char const *keyword,
 }
 
 static void
-volume_size_decoder (struct tar_stat_info *st,
+volume_size_decoder (MAYBE_UNUSED struct tar_stat_info *st,
 		     char const *keyword,
-		     char const *arg, size_t size)
+		     char const *arg, MAYBE_UNUSED size_t size)
 {
   uintmax_t u;
   if (decode_num (&u, arg, TYPE_MAXIMUM (uintmax_t), keyword))
@@ -1560,7 +1562,8 @@ volume_size_decoder (struct tar_stat_info *st,
 
 /* FIXME: Merge with volume_size_coder */
 static void
-volume_offset_coder (struct tar_stat_info const *st, char const *keyword,
+volume_offset_coder (MAYBE_UNUSED struct tar_stat_info const *st,
+		     char const *keyword,
 		     struct xheader *xhdr, void const *data)
 {
   off_t const *v = data;
@@ -1568,9 +1571,9 @@ volume_offset_coder (struct tar_stat_info const *st, char const *keyword,
 }
 
 static void
-volume_offset_decoder (struct tar_stat_info *st,
+volume_offset_decoder (MAYBE_UNUSED struct tar_stat_info *st,
 		       char const *keyword,
-		       char const *arg, size_t size)
+		       char const *arg, MAYBE_UNUSED size_t size)
 {
   uintmax_t u;
   if (decode_num (&u, arg, TYPE_MAXIMUM (uintmax_t), keyword))
@@ -1578,38 +1581,40 @@ volume_offset_decoder (struct tar_stat_info *st,
 }
 
 static void
-volume_filename_decoder (struct tar_stat_info *st,
-			 char const *keyword MAYBE_UNUSED,
+volume_filename_decoder (MAYBE_UNUSED struct tar_stat_info *st,
+			 MAYBE_UNUSED char const *keyword,
 			 char const *arg,
-			 size_t size MAYBE_UNUSED)
+			 MAYBE_UNUSED size_t size)
 {
   decode_string (&continued_file_name, arg);
 }
 
 static void
 xattr_selinux_coder (struct tar_stat_info const *st, char const *keyword,
-                     struct xheader *xhdr, void const *data)
+		     struct xheader *xhdr, MAYBE_UNUSED void const *data)
 {
   code_string (st->cntx_name, keyword, xhdr);
 }
 
 static void
 xattr_selinux_decoder (struct tar_stat_info *st,
-                       char const *keyword, char const *arg, size_t size)
+		       MAYBE_UNUSED char const *keyword, char const *arg,
+		       MAYBE_UNUSED size_t size)
 {
   decode_string (&st->cntx_name, arg);
 }
 
 static void
 xattr_acls_a_coder (struct tar_stat_info const *st , char const *keyword,
-                    struct xheader *xhdr, void const *data)
+		    struct xheader *xhdr, MAYBE_UNUSED void const *data)
 {
   xheader_print_n (xhdr, keyword, st->acls_a_ptr, st->acls_a_len);
 }
 
 static void
 xattr_acls_a_decoder (struct tar_stat_info *st,
-                      char const *keyword, char const *arg, size_t size)
+		      MAYBE_UNUSED char const *keyword,
+		      char const *arg, size_t size)
 {
   st->acls_a_ptr = xmemdup (arg, size + 1);
   st->acls_a_len = size;
@@ -1617,14 +1622,15 @@ xattr_acls_a_decoder (struct tar_stat_info *st,
 
 static void
 xattr_acls_d_coder (struct tar_stat_info const *st , char const *keyword,
-                    struct xheader *xhdr, void const *data)
+		    struct xheader *xhdr, MAYBE_UNUSED void const *data)
 {
   xheader_print_n (xhdr, keyword, st->acls_d_ptr, st->acls_d_len);
 }
 
 static void
 xattr_acls_d_decoder (struct tar_stat_info *st,
-                      char const *keyword, char const *arg, size_t size)
+		      MAYBE_UNUSED char const *keyword, char const *arg,
+		      size_t size)
 {
   st->acls_d_ptr = xmemdup (arg, size + 1);
   st->acls_d_len = size;
@@ -1658,7 +1664,7 @@ xattr_decoder (struct tar_stat_info *st,
 
 static void
 sparse_major_coder (struct tar_stat_info const *st, char const *keyword,
-		    struct xheader *xhdr, void const *data)
+		    struct xheader *xhdr, MAYBE_UNUSED void const *data)
 {
   code_num (st->sparse_major, keyword, xhdr);
 }
@@ -1667,7 +1673,7 @@ static void
 sparse_major_decoder (struct tar_stat_info *st,
 		      char const *keyword,
 		      char const *arg,
-		      size_t size)
+		      MAYBE_UNUSED size_t size)
 {
   uintmax_t u;
   if (decode_num (&u, arg, TYPE_MAXIMUM (unsigned), keyword))
@@ -1676,7 +1682,7 @@ sparse_major_decoder (struct tar_stat_info *st,
 
 static void
 sparse_minor_coder (struct tar_stat_info const *st, char const *keyword,
-		      struct xheader *xhdr, void const *data)
+		    struct xheader *xhdr, MAYBE_UNUSED void const *data)
 {
   code_num (st->sparse_minor, keyword, xhdr);
 }
@@ -1685,7 +1691,7 @@ static void
 sparse_minor_decoder (struct tar_stat_info *st,
 		      char const *keyword,
 		      char const *arg,
-		      size_t size)
+		      MAYBE_UNUSED size_t size)
 {
   uintmax_t u;
   if (decode_num (&u, arg, TYPE_MAXIMUM (unsigned), keyword))