Commit 5ea8ab7f authored by Muhammad Usama Anjum's avatar Muhammad Usama Anjum Committed by Andrew Morton
Browse files

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: default avatarMuhammad Usama Anjum <usama.anjum@collabora.com>
Acked-by: default avatarDavid 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: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 7db551fc
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -92,6 +92,10 @@
#endif
#define __printf(a, b)   __attribute__((format(printf, a, b)))

#ifndef __always_unused
#define __always_unused __attribute__((__unused__))
#endif

#ifndef __maybe_unused
#define __maybe_unused __attribute__((__unused__))
#endif
+1 −1
Original line number Diff line number Diff line
@@ -1304,7 +1304,7 @@ static void test_mprotect_with_pkey_0(int *ptr, u16 pkey)

static void test_ptrace_of_child(int *ptr, u16 pkey)
{
	__attribute__((__unused__)) int peek_result;
	__always_unused int peek_result;
	pid_t child_pid;
	void *ignored = 0;
	long ret;
+2 −1
Original line number Diff line number Diff line
@@ -32,9 +32,10 @@

#include <sys/socket.h>

#include "../../kselftest.h"

/* defines to make checkpatch happy */
#define strscpy strncpy
#define __always_unused __attribute__((__unused__))

/* libnl < 3.5.0 does not set the NLA_F_NESTED on its own, therefore we
 * have to explicitly do it to prevent the kernel from failing upon