All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] checksyscalls: ignore -Wunused-macros
@ 2022-04-22 15:17 Vincent Mailhol
  2022-04-24 22:17 ` Nathan Chancellor
  2022-04-29 17:02 ` Masahiro Yamada
  0 siblings, 2 replies; 8+ messages in thread
From: Vincent Mailhol @ 2022-04-22 15:17 UTC (permalink / raw)
  To: Nathan Chancellor, Nick Desaulniers, Tom Rix
  Cc: linux-kernel, llvm, Palmer Dabbelt, Arnd Bergmann, Vincent Mailhol

The macros defined in this file are for testing only and are purposely
not used. When compiled with W=2, both gcc and clang yield some
-Wunused-macros warnings. Ignore them.

Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
---
 scripts/checksyscalls.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scripts/checksyscalls.sh b/scripts/checksyscalls.sh
index 9dbab13329fa..cde15f22ec98 100755
--- a/scripts/checksyscalls.sh
+++ b/scripts/checksyscalls.sh
@@ -255,6 +255,7 @@ cat << EOF
 /* 64-bit ports never needed these, and new 32-bit ports can use statx */
 #define __IGNORE_fstat64
 #define __IGNORE_fstatat64
+
 EOF
 }
 
@@ -268,4 +269,4 @@ syscall_list() {
 }
 
 (ignore_list && syscall_list $(dirname $0)/../arch/x86/entry/syscalls/syscall_32.tbl) | \
-$* -Wno-error -E -x c - > /dev/null
+$* -Wno-error -Wno-unused-macros -E -x c - > /dev/null
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] checksyscalls: ignore -Wunused-macros
  2022-04-22 15:17 [PATCH] checksyscalls: ignore -Wunused-macros Vincent Mailhol
@ 2022-04-24 22:17 ` Nathan Chancellor
  2022-04-25  6:17   ` Vincent MAILHOL
  2022-04-29 17:02 ` Masahiro Yamada
  1 sibling, 1 reply; 8+ messages in thread
From: Nathan Chancellor @ 2022-04-24 22:17 UTC (permalink / raw)
  To: Vincent Mailhol
  Cc: Nick Desaulniers, Tom Rix, linux-kernel, llvm, Palmer Dabbelt,
	Arnd Bergmann

Hi Vincent,

On Sat, Apr 23, 2022 at 12:17:25AM +0900, Vincent Mailhol wrote:
> The macros defined in this file are for testing only and are purposely
> not used. When compiled with W=2, both gcc and clang yield some
> -Wunused-macros warnings. Ignore them.
> 
> Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>

The change itself looks fine but a couple of comments:

1. Nick and I do not pick up patches, we rely on others to do so.
   Additionally, this is not really something within our domain, despite
   what get_maintainer.pl might say. This change should be sent to
   either

   Masahiro Yamada <masahiroy@kernel.org>
   linux-kbuild@vger.kernel.org

   or

   Andrew Morton <akpm@linux-foundation.org>

   so that it can be applied by one of them.

2. I am not sure that silencing warnings from W=2 is that useful, as
   they are unlikely to be real issues. Not to discourage you by any
   means but it might be more useful to focus on cleaning up warnings
   from W=1 and getting those promoted to regular build warnings.

Cheers,
Nathan

> ---
>  scripts/checksyscalls.sh | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/checksyscalls.sh b/scripts/checksyscalls.sh
> index 9dbab13329fa..cde15f22ec98 100755
> --- a/scripts/checksyscalls.sh
> +++ b/scripts/checksyscalls.sh
> @@ -255,6 +255,7 @@ cat << EOF
>  /* 64-bit ports never needed these, and new 32-bit ports can use statx */
>  #define __IGNORE_fstat64
>  #define __IGNORE_fstatat64
> +
>  EOF
>  }
>  
> @@ -268,4 +269,4 @@ syscall_list() {
>  }
>  
>  (ignore_list && syscall_list $(dirname $0)/../arch/x86/entry/syscalls/syscall_32.tbl) | \
> -$* -Wno-error -E -x c - > /dev/null
> +$* -Wno-error -Wno-unused-macros -E -x c - > /dev/null
> -- 
> 2.35.1
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] checksyscalls: ignore -Wunused-macros
  2022-04-24 22:17 ` Nathan Chancellor
@ 2022-04-25  6:17   ` Vincent MAILHOL
  2022-04-25  6:50     ` Arnd Bergmann
  0 siblings, 1 reply; 8+ messages in thread
From: Vincent MAILHOL @ 2022-04-25  6:17 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Nick Desaulniers, Tom Rix, linux-kernel, llvm, Arnd Bergmann

Hi Nathan,

Thanks for the comments!

On Mon. 25 Apr 2022 at 07:17, Nathan Chancellor <nathan@kernel.org> wrote:
> Hi Vincent,
>
> On Sat, Apr 23, 2022 at 12:17:25AM +0900, Vincent Mailhol wrote:
> > The macros defined in this file are for testing only and are purposely
> > not used. When compiled with W=2, both gcc and clang yield some
> > -Wunused-macros warnings. Ignore them.
> >
> > Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
>
> The change itself looks fine but a couple of comments:
>
> 1. Nick and I do not pick up patches, we rely on others to do so.
>    Additionally, this is not really something within our domain, despite
>    what get_maintainer.pl might say. This change should be sent to
>    either
>
>    Masahiro Yamada <masahiroy@kernel.org>
>    linux-kbuild@vger.kernel.org
>
>    or
>
>    Andrew Morton <akpm@linux-foundation.org>
>
>    so that it can be applied by one of them.

Ack. As you pointed out, I indeed just followed get_maintainer.pl.
I will resend a v2 to the people you pointed out (and exclude you).

> 2. I am not sure that silencing warnings from W=2 is that useful, as
>    they are unlikely to be real issues. Not to discourage you by any
>    means but it might be more useful to focus on cleaning up warnings
>    from W=1 and getting those promoted to regular build warnings.

Normally I agree, but there is one reason to fix this W=2: this
warning appears when building other files.

Example:
| $ make W=2 drivers/net/dummy.o
|   CALL    scripts/checksyscalls.sh
| <stdin>:21: warning: macro "__IGNORE_stat64" is not used [-Wunused-macros]
| <stdin>:22: warning: macro "__IGNORE_lstat64" is not used [-Wunused-macros]
| <stdin>:75: warning: macro "__IGNORE_llseek" is not used [-Wunused-macros]
| <stdin>:159: warning: macro "__IGNORE_madvise1" is not used [-Wunused-macros]
(rest of the output redacted).

When I run W=2, I want to only see the warnings of the file I am
working on. So I find it useful to fix the W=2 warnings which
show up when building other files to not get spammed by
irrelevant issues and to simplify the triage.

My initial message lacked the rationale. I will add additional
explanations in the v2 of this patch.


Yours sincerely,
Vincent Mailhol

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] checksyscalls: ignore -Wunused-macros
  2022-04-25  6:17   ` Vincent MAILHOL
@ 2022-04-25  6:50     ` Arnd Bergmann
  2022-04-25  7:42       ` Vincent MAILHOL
  0 siblings, 1 reply; 8+ messages in thread
From: Arnd Bergmann @ 2022-04-25  6:50 UTC (permalink / raw)
  To: Vincent MAILHOL
  Cc: Nathan Chancellor, Nick Desaulniers, Tom Rix,
	Linux Kernel Mailing List, clang-built-linux, Arnd Bergmann,
	Linux API

On Mon, Apr 25, 2022 at 8:17 AM Vincent MAILHOL
<mailhol.vincent@wanadoo.fr> wrote:
> On Mon. 25 Apr 2022 at 07:17, Nathan Chancellor <nathan@kernel.org> wrote:
> > Hi Vincent,
> >
> > On Sat, Apr 23, 2022 at 12:17:25AM +0900, Vincent Mailhol wrote:
> > > The macros defined in this file are for testing only and are purposely
> > > not used. When compiled with W=2, both gcc and clang yield some
> > > -Wunused-macros warnings. Ignore them.
> > >
> > > Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
> >
> > The change itself looks fine but a couple of comments:
> >
> > 1. Nick and I do not pick up patches, we rely on others to do so.
> >    Additionally, this is not really something within our domain, despite
> >    what get_maintainer.pl might say. This change should be sent to
> >    either
> >
> >    Masahiro Yamada <masahiroy@kernel.org>
> >    linux-kbuild@vger.kernel.org
> >
> >    or
> >
> >    Andrew Morton <akpm@linux-foundation.org>
> >
> >    so that it can be applied by one of them.
>
> Ack. As you pointed out, I indeed just followed get_maintainer.pl.
> I will resend a v2 to the people you pointed out (and exclude you).
>
> > 2. I am not sure that silencing warnings from W=2 is that useful, as
> >    they are unlikely to be real issues. Not to discourage you by any
> >    means but it might be more useful to focus on cleaning up warnings
> >    from W=1 and getting those promoted to regular build warnings.
>
> Normally I agree, but there is one reason to fix this W=2: this
> warning appears when building other files.
>
> Example:
> | $ make W=2 drivers/net/dummy.o
> |   CALL    scripts/checksyscalls.sh
> | <stdin>:21: warning: macro "__IGNORE_stat64" is not used [-Wunused-macros]
> | <stdin>:22: warning: macro "__IGNORE_lstat64" is not used [-Wunused-macros]
> | <stdin>:75: warning: macro "__IGNORE_llseek" is not used [-Wunused-macros]
> | <stdin>:159: warning: macro "__IGNORE_madvise1" is not used [-Wunused-macros]
> (rest of the output redacted).
>
> When I run W=2, I want to only see the warnings of the file I am
> working on. So I find it useful to fix the W=2 warnings which
> show up when building other files to not get spammed by
> irrelevant issues and to simplify the triage.
>
> My initial message lacked the rationale. I will add additional
> explanations in the v2 of this patch.

I agree this is worth fixing if we want to make W=2 have any meaning at all.

Your approach is probably fine. We could try to improve this by comparing
against the list from include/uapi/asm-generic/unistd.h instead of the i386
list. I suppose that would involve rewriting the script into a simpler one,
but I'm not sure if anyone has an interest in working on this.

       Arnd

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] checksyscalls: ignore -Wunused-macros
  2022-04-25  6:50     ` Arnd Bergmann
@ 2022-04-25  7:42       ` Vincent MAILHOL
  2022-04-25  8:49         ` Arnd Bergmann
  0 siblings, 1 reply; 8+ messages in thread
From: Vincent MAILHOL @ 2022-04-25  7:42 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Nathan Chancellor, Nick Desaulniers, Tom Rix,
	Linux Kernel Mailing List, clang-built-linux, Linux API

On Mon. 25 Apr 2022 at 15:50, Arnd Bergmann <arnd@arndb.de> wrote:
> On Mon, Apr 25, 2022 at 8:17 AM Vincent MAILHOL
> <mailhol.vincent@wanadoo.fr> wrote:
> > On Mon. 25 Apr 2022 at 07:17, Nathan Chancellor <nathan@kernel.org> wrote:
> > > Hi Vincent,
> > >
> > > On Sat, Apr 23, 2022 at 12:17:25AM +0900, Vincent Mailhol wrote:
> > > > The macros defined in this file are for testing only and are purposely
> > > > not used. When compiled with W=2, both gcc and clang yield some
> > > > -Wunused-macros warnings. Ignore them.
> > > >
> > > > Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
> > >
> > > The change itself looks fine but a couple of comments:
> > >
> > > 1. Nick and I do not pick up patches, we rely on others to do so.
> > >    Additionally, this is not really something within our domain, despite
> > >    what get_maintainer.pl might say. This change should be sent to
> > >    either
> > >
> > >    Masahiro Yamada <masahiroy@kernel.org>
> > >    linux-kbuild@vger.kernel.org
> > >
> > >    or
> > >
> > >    Andrew Morton <akpm@linux-foundation.org>
> > >
> > >    so that it can be applied by one of them.
> >
> > Ack. As you pointed out, I indeed just followed get_maintainer.pl.
> > I will resend a v2 to the people you pointed out (and exclude you).
> >
> > > 2. I am not sure that silencing warnings from W=2 is that useful, as
> > >    they are unlikely to be real issues. Not to discourage you by any
> > >    means but it might be more useful to focus on cleaning up warnings
> > >    from W=1 and getting those promoted to regular build warnings.
> >
> > Normally I agree, but there is one reason to fix this W=2: this
> > warning appears when building other files.
> >
> > Example:
> > | $ make W=2 drivers/net/dummy.o
> > |   CALL    scripts/checksyscalls.sh
> > | <stdin>:21: warning: macro "__IGNORE_stat64" is not used [-Wunused-macros]
> > | <stdin>:22: warning: macro "__IGNORE_lstat64" is not used [-Wunused-macros]
> > | <stdin>:75: warning: macro "__IGNORE_llseek" is not used [-Wunused-macros]
> > | <stdin>:159: warning: macro "__IGNORE_madvise1" is not used [-Wunused-macros]
> > (rest of the output redacted).
> >
> > When I run W=2, I want to only see the warnings of the file I am
> > working on. So I find it useful to fix the W=2 warnings which
> > show up when building other files to not get spammed by
> > irrelevant issues and to simplify the triage.
> >
> > My initial message lacked the rationale. I will add additional
> > explanations in the v2 of this patch.
>
> I agree this is worth fixing if we want to make W=2 have any meaning at all.
>
> Your approach is probably fine. We could try to improve this by comparing
> against the list from include/uapi/asm-generic/unistd.h instead of the i386
> list. I suppose that would involve rewriting the script into a simpler one,
> but I'm not sure if anyone has an interest in working on this.

If someone wants to do it, great, but I do not have the
confidence to do it myself so I hope you will forgive me for
taking a pass here.

Another alternative I considered was to only call
checksyscalls.sh when doing a 'make all'. This way, we keep the
warning but people won’t be spammed when building sub projects
because the script would not be executed.

I tried to be as less disruptive as possible. Unless people show
interest in one of the alternative approaches, I will keep using
the -Wno-unused-macros approach in the v2.

> diff --git a/scripts/checksyscalls.sh b/scripts/checksyscalls.sh
> index 9dbab13329fa..cde15f22ec98 100755
> --- a/scripts/checksyscalls.sh
> +++ b/scripts/checksyscalls.sh
> @@ -255,6 +255,7 @@ cat << EOF
>  /* 64-bit ports never needed these, and new 32-bit ports can use statx */
>  #define __IGNORE_fstat64
>  #define __IGNORE_fstatat64
> +

Just realized that I added a new line for no reason.
This will be removed in v2. Sorry.

>  EOF
>  }
>
> @@ -268,4 +269,4 @@ syscall_list() {
>  }
>
>  (ignore_list && syscall_list $(dirname $0)/../arch/x86/entry/syscalls/syscall_32.tbl) | \
> -$* -Wno-error -E -x c - > /dev/null
> +$* -Wno-error -Wno-unused-macros -E -x c - > /dev/null
> --
> 2.35.1

Yours sincerely,
Vincent Mailhol

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] checksyscalls: ignore -Wunused-macros
  2022-04-25  7:42       ` Vincent MAILHOL
@ 2022-04-25  8:49         ` Arnd Bergmann
  2022-04-26 15:57           ` Vincent MAILHOL
  0 siblings, 1 reply; 8+ messages in thread
From: Arnd Bergmann @ 2022-04-25  8:49 UTC (permalink / raw)
  To: Vincent MAILHOL
  Cc: Arnd Bergmann, Nathan Chancellor, Nick Desaulniers, Tom Rix,
	Linux Kernel Mailing List, clang-built-linux, Linux API

On Mon, Apr 25, 2022 at 9:42 AM Vincent MAILHOL
<mailhol.vincent@wanadoo.fr> wrote:
> On Mon. 25 Apr 2022 at 15:50, Arnd Bergmann <arnd@arndb.de> wrote:
> > On Mon, Apr 25, 2022 at 8:17 AM Vincent MAILHOL> <mailhol.vincent@wanadoo.fr> wrote:
> > > When I run W=2, I want to only see the warnings of the file I am
> > > working on. So I find it useful to fix the W=2 warnings which
> > > show up when building other files to not get spammed by
> > > irrelevant issues and to simplify the triage.
> > >
> > > My initial message lacked the rationale. I will add additional
> > > explanations in the v2 of this patch.
> >
> > I agree this is worth fixing if we want to make W=2 have any meaning at all.
> >
> > Your approach is probably fine. We could try to improve this by comparing
> > against the list from include/uapi/asm-generic/unistd.h instead of the i386
> > list. I suppose that would involve rewriting the script into a simpler one,
> > but I'm not sure if anyone has an interest in working on this.
>
> If someone wants to do it, great, but I do not have the
> confidence to do it myself so I hope you will forgive me for
> taking a pass here.

Sure, no worries.

> Another alternative I considered was to only call
> checksyscalls.sh when doing a 'make all'. This way, we keep the
> warning but people won’t be spammed when building sub projects
> because the script would not be executed.

Right, I like that as well, one less thing to be done for every
iterative make as well. The syscall table really doesn't change
all that much that this needs to be run by most developers.

      Arnd

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] checksyscalls: ignore -Wunused-macros
  2022-04-25  8:49         ` Arnd Bergmann
@ 2022-04-26 15:57           ` Vincent MAILHOL
  0 siblings, 0 replies; 8+ messages in thread
From: Vincent MAILHOL @ 2022-04-26 15:57 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Nathan Chancellor, Nick Desaulniers, Tom Rix,
	Linux Kernel Mailing List, clang-built-linux, Linux API

On Mon. 25 Apr 2022 at 17:49, Arnd Bergmann <arnd@arndb.de> wrote:
> On Mon, Apr 25, 2022 at 9:42 AM Vincent MAILHOL
> <mailhol.vincent@wanadoo.fr> wrote:
> > On Mon. 25 Apr 2022 at 15:50, Arnd Bergmann <arnd@arndb.de> wrote:
> > > On Mon, Apr 25, 2022 at 8:17 AM Vincent MAILHOL> <mailhol.vincent@wanadoo.fr> wrote:
> > > > When I run W=2, I want to only see the warnings of the file I am
> > > > working on. So I find it useful to fix the W=2 warnings which
> > > > show up when building other files to not get spammed by
> > > > irrelevant issues and to simplify the triage.
> > > >
> > > > My initial message lacked the rationale. I will add additional
> > > > explanations in the v2 of this patch.
> > >
> > > I agree this is worth fixing if we want to make W=2 have any meaning at all.
> > >
> > > Your approach is probably fine. We could try to improve this by comparing
> > > against the list from include/uapi/asm-generic/unistd.h instead of the i386
> > > list. I suppose that would involve rewriting the script into a simpler one,
> > > but I'm not sure if anyone has an interest in working on this.
> >
> > If someone wants to do it, great, but I do not have the
> > confidence to do it myself so I hope you will forgive me for
> > taking a pass here.
>
> Sure, no worries.
>
> > Another alternative I considered was to only call
> > checksyscalls.sh when doing a 'make all'. This way, we keep the
> > warning but people won’t be spammed when building sub projects
> > because the script would not be executed.
>
> Right, I like that as well, one less thing to be done for every
> iterative make as well. The syscall table really doesn't change
> all that much that this needs to be run by most developers.

I send a patch in a new thread to only call the script once:
https://lore.kernel.org/lkml/20220426155229.436681-1-mailhol.vincent@wanadoo.fr/T/#u

If this new patch gets rejected, then I will go back to the
-Wno-unused-macros approach.


Yours sincerely,
Vincent Mailhol

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] checksyscalls: ignore -Wunused-macros
  2022-04-22 15:17 [PATCH] checksyscalls: ignore -Wunused-macros Vincent Mailhol
  2022-04-24 22:17 ` Nathan Chancellor
@ 2022-04-29 17:02 ` Masahiro Yamada
  1 sibling, 0 replies; 8+ messages in thread
From: Masahiro Yamada @ 2022-04-29 17:02 UTC (permalink / raw)
  To: Vincent Mailhol
  Cc: Nathan Chancellor, Nick Desaulniers, Tom Rix,
	Linux Kernel Mailing List, clang-built-linux, Palmer Dabbelt,
	Arnd Bergmann

On Sat, Apr 23, 2022 at 12:18 AM Vincent Mailhol
<mailhol.vincent@wanadoo.fr> wrote:
>
> The macros defined in this file are for testing only and are purposely
> not used. When compiled with W=2, both gcc and clang yield some
> -Wunused-macros warnings. Ignore them.
>
> Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
> ---

Applied to linux-kbuild (only the second hunk)
Thanks.

The current check is not nice,
but this does not hurt.



>  scripts/checksyscalls.sh | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/scripts/checksyscalls.sh b/scripts/checksyscalls.sh
> index 9dbab13329fa..cde15f22ec98 100755
> --- a/scripts/checksyscalls.sh
> +++ b/scripts/checksyscalls.sh
> @@ -255,6 +255,7 @@ cat << EOF
>  /* 64-bit ports never needed these, and new 32-bit ports can use statx */
>  #define __IGNORE_fstat64
>  #define __IGNORE_fstatat64
> +
>  EOF
>  }

Noise.
I dropped it.



>
> @@ -268,4 +269,4 @@ syscall_list() {
>  }
>
>  (ignore_list && syscall_list $(dirname $0)/../arch/x86/entry/syscalls/syscall_32.tbl) | \
> -$* -Wno-error -E -x c - > /dev/null
> +$* -Wno-error -Wno-unused-macros -E -x c - > /dev/null
> --
> 2.35.1
>


-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-04-29 17:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-22 15:17 [PATCH] checksyscalls: ignore -Wunused-macros Vincent Mailhol
2022-04-24 22:17 ` Nathan Chancellor
2022-04-25  6:17   ` Vincent MAILHOL
2022-04-25  6:50     ` Arnd Bergmann
2022-04-25  7:42       ` Vincent MAILHOL
2022-04-25  8:49         ` Arnd Bergmann
2022-04-26 15:57           ` Vincent MAILHOL
2022-04-29 17:02 ` Masahiro Yamada

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.