Skip to content

Gcc 10 error#1531

Open
ChenQi1989 wants to merge 1 commit intoshadow-maint:masterfrom
ChenQi1989:gcc-10-error
Open

Gcc 10 error#1531
ChenQi1989 wants to merge 1 commit intoshadow-maint:masterfrom
ChenQi1989:gcc-10-error

Conversation

@ChenQi1989
Copy link

This PR fixes the error for gcc10:
error: parameter name omitted


static void
login_exit(int)
static void login_exit (MAYBE_UNUSED int sig)
Copy link
Collaborator

@alejandro-colomar alejandro-colomar Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we really need to fix the regression, I'd like to not revert the commits. Instead, please call the parameters _ in a new commit. When there is more than one, please call them _, __, ___, etc.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. I'll squash these into one patch and use parameters like '_'.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, after some thought, _ will collide with the _() function from GNU gettext. Also, __ is a reserved identifier.

So, we'll need _1, _2, ...

Copy link
Collaborator

@alejandro-colomar alejandro-colomar Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ping, @ChenQi1989 .

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alejandro-colomar I just came back from a vacation. I will work on this ASAP. Thanks for your above _1 suggestion.

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.

Fixes: shadow-maint#1530

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
@ChenQi1989
Copy link
Author

ChenQi1989 commented Feb 26, 2026

@alejandro-colomar I've squashed the codes with extra fixes for the tests/unit directory.
The build test was done in both ubuntu:24.04 (gcc 13) and debian:bullseye (gcc 10) containers with the following commands:

$ apt update && apt install --fix-missing gawk wget git diffstat unzip texinfo \
            gcc build-essential chrpath socat cpio python3 autopoint \
            autoconf automake libtool pkg-config  libltdl-dev \
            xsltproc libbsd-dev gettext libcmocka-dev
$ ./autogen.sh
$ ./configure --disable-logind --without-libpam
$ make -j 10
$ make -C tests/unit/ check-TESTS

format_attr(printf, 2, 3)
static void
error_acl(struct error_context *, const char *fmt, ...)
static void error_acl (MAYBE_UNUSED struct error_context *_1, const char *fmt, ...)
Copy link
Collaborator

@alejandro-colomar alejandro-colomar Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep the return type in a separate line (and don't add white space).

* TEST
**********************/
static void test_active_sessions_count_return_ok(void **)
static void test_active_sessions_count_return_ok(MAYBE_UNUSED MAYBE_UNUSED void ** _1_1)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why _1_1 instead of _1?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, and MAYBE_UNUSED is also dup'd. It seems some script went wrong. :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, if you use a script, please document it in the commit message (script contents and/or shell session).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was manually changing things. Sorry for the typo. I think I was hitting Ctrl-y twice in emacs. I'll fix all the above issues and update this PR.

@@ -9,6 +9,7 @@
#include <assert.h>
#include <stdio.h>

Copy link
Collaborator

@alejandro-colomar alejandro-colomar Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(in the commit message)

Fixes: #1530

This should be Closes, not Fixes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Regression] Build error with gcc 10: error: parameter name omitted

2 participants