]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/, src/: Add [[gnu::unused]] to parameters used in conditionally-compiled code
authorAlejandro Colomar <alx@kernel.org>
Fri, 21 Feb 2025 07:05:42 +0000 (08:05 +0100)
committerSerge Hallyn <serge@hallyn.com>
Fri, 5 Dec 2025 15:21:50 +0000 (09:21 -0600)
Reviewed-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
lib/commonio.c
lib/copydir.c
lib/idmapping.c
lib/log.c
src/groupmems.c
src/newusers.c

index 5341f7b7eb2a90407b182d3a9f0293f50d8f0b7a..7cb2f420a5c2c841b589815fea0017589874a174 100644 (file)
@@ -882,7 +882,8 @@ static int write_all (const struct commonio_db *db)
 }
 
 
-int commonio_close (struct commonio_db *db, bool process_selinux)
+int
+commonio_close(struct commonio_db *db, MAYBE_UNUSED bool process_selinux)
 {
        bool         errors = false;
        char         buf[1024];
index 9bfc94bb16fa6848d4b6c634de0e89676afd40f3..3cf81fb5461c5c2d8214adff5888c651b0626620 100644 (file)
@@ -650,8 +650,8 @@ static int copy_hardlink (const struct path_info *dst,
  *     Return 0 on success, -1 on error.
  */
 static int
-copy_special(const struct path_info *src, const struct path_info *dst,
-             bool reset_selinux,
+copy_special(MAYBE_UNUSED const struct path_info *src, const struct path_info *dst,
+             MAYBE_UNUSED bool reset_selinux,
              const struct stat *statp, const struct timespec mt[],
              uid_t old_uid, uid_t new_uid,
              gid_t old_gid, gid_t new_gid)
@@ -706,7 +706,7 @@ copy_special(const struct path_info *src, const struct path_info *dst,
  *     Return 0 on success, -1 on error.
  */
 static int copy_file (const struct path_info *src, const struct path_info *dst,
-                      bool reset_selinux,
+                      MAYBE_UNUSED bool reset_selinux,
                       const struct stat *statp, const struct timespec mt[],
                       uid_t old_uid, uid_t new_uid,
                       gid_t old_gid, gid_t new_gid)
index 9c5723f66c26cae4259e40d075445c6441a93c48..5ae77b7d0d2ab2adea9da84d75b66c270dacf410 100644 (file)
@@ -22,6 +22,7 @@
 #include "alloc/calloc.h"
 #include "alloc/malloc.h"
 #include "atoi/a2i.h"
+#include "attr.h"
 #include "idmapping.h"
 #include "prototypes.h"
 #include "shadowlog.h"
@@ -124,7 +125,7 @@ static inline bool maps_lower_root(int cap, int ranges, const struct map_range *
  * If this is wanted: use file capabilities!
  */
 void write_mapping(int proc_dir_fd, int ranges, const struct map_range *mappings,
-       const char *map_file, uid_t ruid)
+       const char *map_file, MAYBE_UNUSED uid_t ruid)
 {
        int idx;
        const struct map_range *mapping;
index 92d5336dffa0472a1f8c4b9b31815910a26a3d80..1d5a9b209c0599befb042590924d01414883e5c0 100644 (file)
--- a/lib/log.c
+++ b/lib/log.c
@@ -16,6 +16,7 @@
 #include <sys/types.h>
 #include <time.h>
 
+#include "attr.h"
 #include "defines.h"
 #include "prototypes.h"
 #include "string/memset/memzero.h"
@@ -34,7 +35,7 @@ void dolastlog (
        struct lastlog *ll,
        const struct passwd *pw,
        /*@unique@*/const char *line,
-       /*@unique@*/const char *host)
+       MAYBE_UNUSED /*@unique@*/const char *host)
 {
        int fd;
        off_t offset;
index fc21b640122375777d1dad8780654a1557c717c1..0da8086ccf8553828b51c0c5b75fa72c13de1e11 100644 (file)
@@ -20,6 +20,7 @@
 #include <pwd.h>
 
 #include "alloc/malloc.h"
+#include "attr.h"
 #include "defines.h"
 #include "groupio.h"
 #include "prototypes.h"
@@ -427,7 +428,8 @@ static void process_flags (int argc, char **argv, struct option_flags *flags)
 
 }
 
-static void check_perms (bool process_selinux)
+static void
+check_perms(MAYBE_UNUSED bool process_selinux)
 {
        if (!list) {
 #ifdef USE_PAM
index 1320421fca78eb99dee89f3c812629cfd779e238..bde90a3bca87141bf0b12a97eddb87d2b1c2fbe4 100644 (file)
@@ -35,6 +35,7 @@
 #include "alloc/reallocf.h"
 #include "atoi/a2i.h"
 #include "atoi/getnum.h"
+#include "attr.h"
 #ifdef ACCT_TOOLS_SETUID
 #ifdef USE_PAM
 #include "pam_defs.h"
@@ -481,7 +482,8 @@ static int update_passwd (struct passwd *pwd, const char *password)
 /*
  * add_passwd - add or update the encrypted password
  */
-static int add_passwd (struct passwd *pwd, const char *password)
+static int
+add_passwd(struct passwd *pwd, MAYBE_UNUSED const char *password)
 {
        const struct spwd *sp;
        struct spwd spent;
@@ -797,7 +799,8 @@ static void check_flags (void)
  *
  *     It will not return if the user is not allowed.
  */
-static void check_perms(const struct option_flags *flags)
+static void
+check_perms(MAYBE_UNUSED const struct option_flags *flags)
 {
 #ifdef ACCT_TOOLS_SETUID
 #ifdef USE_PAM