Re: [PATCH] selftests: proc: mark vsyscall strings maybe-unused

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 20 Aug 2025 23:26:10 +0530 Bala-Vignesh-Reddy <reddybalavignesh9979@xxxxxxxxx> wrote:

> The str_vsyscall_* constants in proc-pid-vm.c triggers
> -Wunused-const-variable warnings with gcc-13.32 and clang 18.1.

OT but lol.  My head is spinning at the term "const-variable".  I
understand what they mean, but it's oxymoronic.

> 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]
>
> ...
>
> --- a/tools/testing/selftests/proc/proc-pid-vm.c
> +++ b/tools/testing/selftests/proc/proc-pid-vm.c
> @@ -47,6 +47,10 @@
>  #include <sys/resource.h>
>  #include <linux/fs.h>
>  
> +#ifndef __maybe_unused
> +#define __maybe_unused __attribute__((__unused__))
> +#endif

This would be approximately the seventh definition of __maybe_unused
under tools/testing/selftests.  And there's another in
tools/testing/memblock, which, as if admitting that its directory is in
the wrong place, had to go and include ../selftests/kselftest.h.

So it would be pleasing if some kind soul were to define __maybe_unused
in a common place, which looks to be
tools/testing/selftests/kselftest.h.  Then go zap all those private
definitions.

This could be done either before or after your patch.

>  #include "../kselftest.h"

And we have 350 occurrences of "../kselftest.h".  Shouldn't the build
system be providing -Itools/testing/selftests?

Anyway, patch looks OK - I'll add it to mm.git, thanks.




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux