Re: [PATCH] selftests/proc: proc-pid-vm: fix unused variable warning on non-x86

From: Andrew Morton

Date: Sun Oct 11 2026 - 22:17:52 EST


On Sun, 11 Oct 2026 18:33:39 -0400 Sasha Levin <sashal@xxxxxxxxxx> wrote:

> g_vsyscall is only used by the x86_64 test, so other architectures get:
>
> proc-pid-vm.c:224:21: warning: unused variable 'g_vsyscall' [-Wunused-variable]
>
> Mark it __maybe_unused, like str_vsyscall next to it.
>
> ...
>
> --- a/tools/testing/selftests/proc/proc-pid-vm.c
> +++ b/tools/testing/selftests/proc/proc-pid-vm.c
> @@ -221,7 +221,7 @@ static int make_exe(const uint8_t *payload, size_t len)
> * 1: vsyscall VMA is --xp vsyscall=xonly
> * 2: vsyscall VMA is r-xp vsyscall=emulate
> */
> -static volatile int g_vsyscall;
> +static volatile int g_vsyscall __maybe_unused;
> static const char *str_vsyscall __maybe_unused;
>
> static const char str_vsyscall_0[] __maybe_unused = "";

Can't all the x86-specific stuff be moved after the #ifdef __x86_64__
which is a few lines later?