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

selftests/mm: centralize the __always_unused macro

This macro gets used in different tests. Add it to kselftest.h which is
central location and tests use this header. Then use this new macro.

Link: https://lkml.kernel.org/r/20250912125102.1309796-1-usama.anjum@collabora.com
Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
Acked-by: David Hildenbrand <david@redhat.com>
Cc: Antonio Quartulli <antonio@openvpn.net>
Cc: David S. Miller <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kacinski <kuba@kernel.org>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: "Sabrina Dubroca" <sd@queasysnail.net>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Simon Horman <horms@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Muhammad Usama Anjum and committed by
Andrew Morton
5ea8ab7f 7db551fc

+7 -2
+4
tools/testing/selftests/kselftest.h
··· 92 92 #endif 93 93 #define __printf(a, b) __attribute__((format(printf, a, b))) 94 94 95 + #ifndef __always_unused 96 + #define __always_unused __attribute__((__unused__)) 97 + #endif 98 + 95 99 #ifndef __maybe_unused 96 100 #define __maybe_unused __attribute__((__unused__)) 97 101 #endif
+1 -1
tools/testing/selftests/mm/protection_keys.c
··· 1304 1304 1305 1305 static void test_ptrace_of_child(int *ptr, u16 pkey) 1306 1306 { 1307 - __attribute__((__unused__)) int peek_result; 1307 + __always_unused int peek_result; 1308 1308 pid_t child_pid; 1309 1309 void *ignored = 0; 1310 1310 long ret;
+2 -1
tools/testing/selftests/net/ovpn/ovpn-cli.c
··· 32 32 33 33 #include <sys/socket.h> 34 34 35 + #include "../../kselftest.h" 36 + 35 37 /* defines to make checkpatch happy */ 36 38 #define strscpy strncpy 37 - #define __always_unused __attribute__((__unused__)) 38 39 39 40 /* libnl < 3.5.0 does not set the NLA_F_NESTED on its own, therefore we 40 41 * have to explicitly do it to prevent the kernel from failing upon