Commit a7498388 authored by Bala-Vignesh-Reddy's avatar Bala-Vignesh-Reddy Committed by Andrew Morton
Browse files

selftests: centralise maybe-unused definition in kselftest.h

Several selftests subdirectories duplicated the define __maybe_unused,
leading to redundant code.  Move to kselftest.h header and remove other
definitions.

This addresses the duplication noted in the proc-pid-vm warning fix

Link: https://lkml.kernel.org/r/20250821101159.2238-1-reddybalavignesh9979@gmail.com


Signed-off-by: default avatarBala-Vignesh-Reddy <reddybalavignesh9979@gmail.com>
Suggested-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Link:https://lore.kernel.org/lkml/20250820143954.33d95635e504e94df01930d0@linux-foundation.org/


Reviewed-by: default avatarWei Yang <richard.weiyang@gmail.com>
Acked-by: default avatarSeongJae Park <sj@kernel.org>
Reviewed-by: default avatarMing Lei <ming.lei@redhat.com>
Acked-by: Mickal Salan <mic@digikod.net>	[landlock]
Cc: Shuah Khan <shuah@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 940b1be2
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 __maybe_unused
#define __maybe_unused __attribute__((__unused__))
#endif

/* counters */
struct ksft_count {
	unsigned int ksft_pass;
+2 −4
Original line number Diff line number Diff line
@@ -20,14 +20,12 @@
#include <sys/time.h>
#include <unistd.h>

#include "../kselftest.h"

#ifndef ARRAY_SIZE
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
#endif

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

#define REGEX_LANDLOCK_PREFIX "^audit([0-9.:]\\+): domain=\\([0-9a-f]\\+\\)"

struct audit_filter {
+0 −4
Original line number Diff line number Diff line
@@ -22,10 +22,6 @@

#define TMP_DIR "tmp"

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

/* TEST_F_FORK() should not be used for new tests. */
#define TEST_F_FORK(fixture_name, test_name) TEST_F(fixture_name, test_name)

+0 −3
Original line number Diff line number Diff line
@@ -84,9 +84,6 @@ extern void abort_hooks(void);
#ifndef noinline
# define noinline __attribute__((noinline))
#endif
#ifndef __maybe_unused
# define __maybe_unused __attribute__((__unused__))
#endif

int sys_pkey_alloc(unsigned long flags, unsigned long init_val);
int sys_pkey_free(unsigned long pkey);
+0 −4
Original line number Diff line number Diff line
@@ -22,10 +22,6 @@

#define PORT_BASE			8000

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

static __maybe_unused void pair_udp_setfilter(int fd)
{
	/* the filter below checks for all of the following conditions that
Loading