Skip to content

Commit 5bf9b9d

Browse files
ChenQi1989alejandro-colomar
authored andcommitted
Fix build failure on hosts with gcc 10
We cannot just uname these unused parameters because gcc 10 need them. There will be error like below with gcc 10: lib/copydir.c:103:11: error: parameter name omitted The Debian bullseye uses gcc 10 by default. Most of the changes are done manually. Some changes in tests/unit are done via the following shell command: sed -i -e 's#void \*\*#MAYBE_UNUSED void \*\* _1#g' tests/unit/test_*.c Closes: <#1530> Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Cherry-picked-from: cb0ec03 (2026-03-02; "Fix build failure on hosts with gcc 10") Signed-off-by: Alejandro Colomar <alx@kernel.org>
1 parent 3f0a837 commit 5bf9b9d

21 files changed

Lines changed: 101 additions & 98 deletions

lib/copydir.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ static int fchown_if_needed (int fdst, const struct stat *statp,
100100
*/
101101
format_attr(printf, 2, 3)
102102
static void
103-
error_acl(struct error_context *, const char *fmt, ...)
103+
error_acl(MAYBE_UNUSED struct error_context *_1, const char *fmt, ...)
104104
{
105105
va_list ap;
106106
FILE *shadow_logfd = log_get_logfd();

lib/loginprompt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828

2929
static void
30-
login_exit(int)
30+
login_exit(MAYBE_UNUSED int _1)
3131
{
3232
_exit (EXIT_FAILURE);
3333
}

lib/pam_pass_non_interactive.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
static int ni_conv (int num_msg,
2828
const struct pam_message **msg,
2929
struct pam_response **resp,
30-
void *);
30+
MAYBE_UNUSED void *_1);
3131
static const struct pam_conv non_interactive_pam_conv = {
3232
ni_conv,
3333
NULL
@@ -38,7 +38,7 @@ static const struct pam_conv non_interactive_pam_conv = {
3838
static int ni_conv (int num_msg,
3939
const struct pam_message **msg,
4040
struct pam_response **resp,
41-
void *)
41+
MAYBE_UNUSED void *_1)
4242
{
4343
struct pam_response *responses;
4444
int count;

lib/semanage.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929

3030
format_attr(printf, 3, 4)
31-
static void semanage_error_callback (void *,
31+
static void semanage_error_callback(MAYBE_UNUSED void *_1,
3232
semanage_handle_t *handle,
3333
const char *fmt, ...)
3434
{

lib/sssd.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#ifndef _SSSD_H_
22
#define _SSSD_H_
33

4+
#include "attr.h"
5+
46
#define SSSD_DB_PASSWD 0x001
57
#define SSSD_DB_GROUP 0x002
68

@@ -11,7 +13,7 @@
1113
extern int sssd_flush_cache (int dbflags);
1214
#else
1315
static inline int
14-
sssd_flush_cache(int)
16+
sssd_flush_cache(MAYBE_UNUSED int _1)
1517
{
1618
return 0;
1719
}

src/chsh.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ static bool shell_is_listed (const char *sh, bool process_selinux)
198198

199199
#else /* without HAVE_VENDORDIR */
200200

201-
static bool shell_is_listed (const char *sh, bool)
201+
static bool shell_is_listed (const char *sh, MAYBE_UNUSED bool _1)
202202
{
203203
bool found = false;
204204
char *cp;

src/gpasswd.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,14 @@ static void update_group (struct group *gr);
109109
static void change_passwd (struct group *gr);
110110
#endif
111111
static void log_gpasswd_failure (const char *suffix);
112-
static void log_gpasswd_failure_system (/*@null@*/void *);
113-
static void log_gpasswd_failure_group (/*@null@*/void *);
112+
static void log_gpasswd_failure_system (/*@null@*/MAYBE_UNUSED void *_1);
113+
static void log_gpasswd_failure_group (/*@null@*/MAYBE_UNUSED void *_1);
114114
#ifdef SHADOWGRP
115-
static void log_gpasswd_failure_gshadow (/*@null@*/void *);
115+
static void log_gpasswd_failure_gshadow (/*@null@*/MAYBE_UNUSED void *_1);
116116
#endif
117117
static void log_gpasswd_success (const char *suffix);
118-
static void log_gpasswd_success_system (/*@null@*/void *);
119-
static void log_gpasswd_success_group(/*@null@*/void *);
118+
static void log_gpasswd_success_system (/*@null@*/MAYBE_UNUSED void *_1);
119+
static void log_gpasswd_success_group (/*@null@*/MAYBE_UNUSED void *_1);
120120

121121
/*
122122
* usage - display usage message
@@ -472,13 +472,13 @@ static void log_gpasswd_failure (const char *suffix)
472472
}
473473

474474
static void
475-
log_gpasswd_failure_system(void *)
475+
log_gpasswd_failure_system(MAYBE_UNUSED void *_1)
476476
{
477477
log_gpasswd_failure ("");
478478
}
479479

480480
static void
481-
log_gpasswd_failure_group(void *)
481+
log_gpasswd_failure_group(MAYBE_UNUSED void *_1)
482482
{
483483
char buf[1024];
484484

@@ -488,7 +488,7 @@ log_gpasswd_failure_group(void *)
488488

489489
#ifdef SHADOWGRP
490490
static void
491-
log_gpasswd_failure_gshadow(void *)
491+
log_gpasswd_failure_gshadow(MAYBE_UNUSED void *_1)
492492
{
493493
char buf[1024];
494494

@@ -586,13 +586,13 @@ static void log_gpasswd_success (const char *suffix)
586586
}
587587

588588
static void
589-
log_gpasswd_success_system(void *)
589+
log_gpasswd_success_system(MAYBE_UNUSED void *_1)
590590
{
591591
log_gpasswd_success ("");
592592
}
593593

594594
static void
595-
log_gpasswd_success_group(void *)
595+
log_gpasswd_success_group(MAYBE_UNUSED void *_1)
596596
{
597597
char buf[1024];
598598

src/grpconv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ int main (int argc, char **argv)
277277
}
278278
#else /* !SHADOWGRP */
279279
int
280-
main(int, char **argv)
280+
main(MAYBE_UNUSED int _1, char **argv)
281281
{
282282
fprintf (stderr,
283283
"%s: not configured for shadow group support.\n", argv[0]);

src/grpunconv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ int main (int argc, char **argv)
239239
}
240240
#else /* !SHADOWGRP */
241241
int
242-
main(int, char **argv)
242+
main(MAYBE_UNUSED int _1, char **argv)
243243
{
244244
fprintf (stderr,
245245
"%s: not configured for shadow group support.\n", argv[0]);

src/login.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,13 +367,13 @@ static void init_env (void)
367367
}
368368

369369
static void
370-
exit_handler(int)
370+
exit_handler(MAYBE_UNUSED int _1)
371371
{
372372
_exit (0);
373373
}
374374

375375
static void
376-
alarm_handler(int)
376+
alarm_handler(MAYBE_UNUSED int _1)
377377
{
378378
write_full(STDERR_FILENO, tmsg, strlen(tmsg));
379379
signal(SIGALRM, exit_handler);

0 commit comments

Comments
 (0)