From: Alejandro Colomar Date: Fri, 21 Feb 2025 07:05:42 +0000 (+0100) Subject: lib/, src/: Add [[gnu::unused]] to parameters used in conditionally-compiled code X-Git-Tag: 4.19.0-rc1~32 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=04f60165ae392825968b7f442c7643c5ccd83e76;p=thirdparty%2Fshadow.git lib/, src/: Add [[gnu::unused]] to parameters used in conditionally-compiled code Reviewed-by: Serge Hallyn Signed-off-by: Alejandro Colomar --- diff --git a/lib/commonio.c b/lib/commonio.c index 5341f7b7e..7cb2f420a 100644 --- a/lib/commonio.c +++ b/lib/commonio.c @@ -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]; diff --git a/lib/copydir.c b/lib/copydir.c index 9bfc94bb1..3cf81fb54 100644 --- a/lib/copydir.c +++ b/lib/copydir.c @@ -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) diff --git a/lib/idmapping.c b/lib/idmapping.c index 9c5723f66..5ae77b7d0 100644 --- a/lib/idmapping.c +++ b/lib/idmapping.c @@ -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; diff --git a/lib/log.c b/lib/log.c index 92d5336df..1d5a9b209 100644 --- a/lib/log.c +++ b/lib/log.c @@ -16,6 +16,7 @@ #include #include +#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; diff --git a/src/groupmems.c b/src/groupmems.c index fc21b6401..0da8086cc 100644 --- a/src/groupmems.c +++ b/src/groupmems.c @@ -20,6 +20,7 @@ #include #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 diff --git a/src/newusers.c b/src/newusers.c index 1320421fc..bde90a3bc 100644 --- a/src/newusers.c +++ b/src/newusers.c @@ -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