Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Bala-Vignesh-Reddy and committed by
Andrew Morton
17bdc64c 3e3f55f8

+8 -4
+8 -4
tools/testing/selftests/proc/proc-pid-vm.c
··· 47 47 #include <sys/resource.h> 48 48 #include <linux/fs.h> 49 49 50 + #ifndef __maybe_unused 51 + #define __maybe_unused __attribute__((__unused__)) 52 + #endif 53 + 50 54 #include "../kselftest.h" 51 55 52 56 static inline long sys_execveat(int dirfd, const char *pathname, char **argv, char **envp, int flags) ··· 222 218 * 2: vsyscall VMA is r-xp vsyscall=emulate 223 219 */ 224 220 static volatile int g_vsyscall; 225 - static const char *str_vsyscall; 221 + static const char *str_vsyscall __maybe_unused; 226 222 227 - static const char str_vsyscall_0[] = ""; 228 - static const char str_vsyscall_1[] = 223 + static const char str_vsyscall_0[] __maybe_unused = ""; 224 + static const char str_vsyscall_1[] __maybe_unused = 229 225 "ffffffffff600000-ffffffffff601000 --xp 00000000 00:00 0 [vsyscall]\n"; 230 - static const char str_vsyscall_2[] = 226 + static const char str_vsyscall_2[] __maybe_unused = 231 227 "ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]\n"; 232 228 233 229 #ifdef __x86_64__