Skip to content

Commit 17bdc64

Browse files
Bala-Vignesh-Reddyakpm00
authored andcommitted
selftests: proc: mark vsyscall strings maybe-unused
The str_vsyscall_* constants in proc-pid-vm.c triggers -Wunused-const-variable warnings with gcc-13.32 and clang 18.1. Define and apply __maybe_unused locally to suppress the warnings. No functional change Fixes compiler warning: warning: `str_vsyscall_*' defined but not used[-Wunused-const-variable] Link: https://lkml.kernel.org/r/20250820175610.83014-1-reddybalavignesh9979@gmail.com Signed-off-by: Bala-Vignesh-Reddy <reddybalavignesh9979@gmail.com> Cc: Shuah Khan <shuah@kernel.org> Cc: Suren Baghdasaryan <surenb@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 3e3f55f commit 17bdc64

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

tools/testing/selftests/proc/proc-pid-vm.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@
4747
#include <sys/resource.h>
4848
#include <linux/fs.h>
4949

50+
#ifndef __maybe_unused
51+
#define __maybe_unused __attribute__((__unused__))
52+
#endif
53+
5054
#include "../kselftest.h"
5155

5256
static inline long sys_execveat(int dirfd, const char *pathname, char **argv, char **envp, int flags)
@@ -218,12 +222,12 @@ static int make_exe(const uint8_t *payload, size_t len)
218222
* 2: vsyscall VMA is r-xp vsyscall=emulate
219223
*/
220224
static volatile int g_vsyscall;
221-
static const char *str_vsyscall;
225+
static const char *str_vsyscall __maybe_unused;
222226

223-
static const char str_vsyscall_0[] = "";
224-
static const char str_vsyscall_1[] =
227+
static const char str_vsyscall_0[] __maybe_unused = "";
228+
static const char str_vsyscall_1[] __maybe_unused =
225229
"ffffffffff600000-ffffffffff601000 --xp 00000000 00:00 0 [vsyscall]\n";
226-
static const char str_vsyscall_2[] =
230+
static const char str_vsyscall_2[] __maybe_unused =
227231
"ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]\n";
228232

229233
#ifdef __x86_64__

0 commit comments

Comments
 (0)