llvm.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH] maple_tree: Fix build failure with W=1 and LLVM=1
@ 2024-05-03  9:50 Kuan-Wei Chiu
  2024-05-03 12:20 ` Matthew Wilcox
  0 siblings, 1 reply; 7+ messages in thread
From: Kuan-Wei Chiu @ 2024-05-03  9:50 UTC (permalink / raw)
  To: akpm, Liam.Howlett, nathan
  Cc: ndesaulniers, morbo, justinstitt, linux-kernel, maple-tree,
	linux-mm, llvm, jserv, Kuan-Wei Chiu

When compiling library code using "make W=1 LLVM=1 lib/", clang
generated the following compilation errors:

lib/maple_tree.c:351:21: error: unused function 'mte_set_full' [-Werror,-Wunused-function]
static inline void *mte_set_full(const struct maple_enode *node)
                    ^
lib/maple_tree.c:356:21: error: unused function 'mte_clear_full' [-Werror,-Wunused-function]
static inline void *mte_clear_full(const struct maple_enode *node)
                    ^
lib/maple_tree.c:361:20: error: unused function 'mte_has_null' [-Werror,-Wunused-function]
static inline bool mte_has_null(const struct maple_enode *node)
                   ^
3 errors generated.

Remove unused static inline functions to resolve compilation errors
with clang.

Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>
---
 lib/maple_tree.c | 15 ---------------
 1 file changed, 15 deletions(-)

diff --git a/lib/maple_tree.c b/lib/maple_tree.c
index 55e1b35bf877..cd3f5399f9f3 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -348,21 +348,6 @@ static inline void *mte_safe_root(const struct maple_enode *node)
 	return (void *)((unsigned long)node & ~MAPLE_ROOT_NODE);
 }
 
-static inline void *mte_set_full(const struct maple_enode *node)
-{
-	return (void *)((unsigned long)node & ~MAPLE_ENODE_NULL);
-}
-
-static inline void *mte_clear_full(const struct maple_enode *node)
-{
-	return (void *)((unsigned long)node | MAPLE_ENODE_NULL);
-}
-
-static inline bool mte_has_null(const struct maple_enode *node)
-{
-	return (unsigned long)node & MAPLE_ENODE_NULL;
-}
-
 static __always_inline bool ma_is_root(struct maple_node *node)
 {
 	return ((unsigned long)node->parent & MA_ROOT_PARENT);
-- 
2.34.1


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

* Re: [PATCH] maple_tree: Fix build failure with W=1 and LLVM=1
  2024-05-03  9:50 [PATCH] maple_tree: Fix build failure with W=1 and LLVM=1 Kuan-Wei Chiu
@ 2024-05-03 12:20 ` Matthew Wilcox
  2024-05-03 13:01   ` Kuan-Wei Chiu
  0 siblings, 1 reply; 7+ messages in thread
From: Matthew Wilcox @ 2024-05-03 12:20 UTC (permalink / raw)
  To: Kuan-Wei Chiu
  Cc: akpm, Liam.Howlett, nathan, ndesaulniers, morbo, justinstitt,
	linux-kernel, maple-tree, linux-mm, llvm, jserv

On Fri, May 03, 2024 at 05:50:27PM +0800, Kuan-Wei Chiu wrote:
> When compiling library code using "make W=1 LLVM=1 lib/", clang
> generated the following compilation errors:
> 
> lib/maple_tree.c:351:21: error: unused function 'mte_set_full' [-Werror,-Wunused-function]
> static inline void *mte_set_full(const struct maple_enode *node)

Uh, clang is wrong to flag these as an error.  They're just not used
yet.

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

* Re: [PATCH] maple_tree: Fix build failure with W=1 and LLVM=1
  2024-05-03 12:20 ` Matthew Wilcox
@ 2024-05-03 13:01   ` Kuan-Wei Chiu
  2024-05-03 13:29     ` Matthew Wilcox
  0 siblings, 1 reply; 7+ messages in thread
From: Kuan-Wei Chiu @ 2024-05-03 13:01 UTC (permalink / raw)
  To: Matthew Wilcox
  Cc: akpm, Liam.Howlett, nathan, ndesaulniers, morbo, justinstitt,
	linux-kernel, maple-tree, linux-mm, llvm, jserv

On Fri, May 03, 2024 at 01:20:32PM +0100, Matthew Wilcox wrote:
> On Fri, May 03, 2024 at 05:50:27PM +0800, Kuan-Wei Chiu wrote:
> > When compiling library code using "make W=1 LLVM=1 lib/", clang
> > generated the following compilation errors:
> > 
> > lib/maple_tree.c:351:21: error: unused function 'mte_set_full' [-Werror,-Wunused-function]
> > static inline void *mte_set_full(const struct maple_enode *node)
> 
> Uh, clang is wrong to flag these as an error.  They're just not used
> yet.

I think it's because the kernel defaults to treating all compilation
warnings as errors. If you turn off the option to treat compilation
warnings as errors, they will be treated as warnings instead. Should I
update my commit message to change compilation errors to compilation
warnings?

Regards,
Kuan-Wei

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

* Re: [PATCH] maple_tree: Fix build failure with W=1 and LLVM=1
  2024-05-03 13:01   ` Kuan-Wei Chiu
@ 2024-05-03 13:29     ` Matthew Wilcox
  2024-05-03 16:08       ` Nathan Chancellor
  0 siblings, 1 reply; 7+ messages in thread
From: Matthew Wilcox @ 2024-05-03 13:29 UTC (permalink / raw)
  To: Kuan-Wei Chiu
  Cc: akpm, Liam.Howlett, nathan, ndesaulniers, morbo, justinstitt,
	linux-kernel, maple-tree, linux-mm, llvm, jserv

On Fri, May 03, 2024 at 09:01:06PM +0800, Kuan-Wei Chiu wrote:
> On Fri, May 03, 2024 at 01:20:32PM +0100, Matthew Wilcox wrote:
> > On Fri, May 03, 2024 at 05:50:27PM +0800, Kuan-Wei Chiu wrote:
> > > When compiling library code using "make W=1 LLVM=1 lib/", clang
> > > generated the following compilation errors:
> > > 
> > > lib/maple_tree.c:351:21: error: unused function 'mte_set_full' [-Werror,-Wunused-function]
> > > static inline void *mte_set_full(const struct maple_enode *node)
> > 
> > Uh, clang is wrong to flag these as an error.  They're just not used
> > yet.
> 
> I think it's because the kernel defaults to treating all compilation
> warnings as errors. If you turn off the option to treat compilation
> warnings as errors, they will be treated as warnings instead. Should I
> update my commit message to change compilation errors to compilation
> warnings?

just don't use W=1 and clang.

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

* Re: [PATCH] maple_tree: Fix build failure with W=1 and LLVM=1
  2024-05-03 13:29     ` Matthew Wilcox
@ 2024-05-03 16:08       ` Nathan Chancellor
  2024-05-04 23:02         ` Andrew Morton
  0 siblings, 1 reply; 7+ messages in thread
From: Nathan Chancellor @ 2024-05-03 16:08 UTC (permalink / raw)
  To: Matthew Wilcox
  Cc: Kuan-Wei Chiu, akpm, Liam.Howlett, ndesaulniers, morbo,
	justinstitt, linux-kernel, maple-tree, linux-mm, llvm, jserv

On Fri, May 03, 2024 at 02:29:12PM +0100, Matthew Wilcox wrote:
> On Fri, May 03, 2024 at 09:01:06PM +0800, Kuan-Wei Chiu wrote:
> > On Fri, May 03, 2024 at 01:20:32PM +0100, Matthew Wilcox wrote:
> > > On Fri, May 03, 2024 at 05:50:27PM +0800, Kuan-Wei Chiu wrote:
> > > > When compiling library code using "make W=1 LLVM=1 lib/", clang
> > > > generated the following compilation errors:
> > > > 
> > > > lib/maple_tree.c:351:21: error: unused function 'mte_set_full' [-Werror,-Wunused-function]
> > > > static inline void *mte_set_full(const struct maple_enode *node)
> > > 
> > > Uh, clang is wrong to flag these as an error.  They're just not used
> > > yet.
> > 
> > I think it's because the kernel defaults to treating all compilation
> > warnings as errors. If you turn off the option to treat compilation
> > warnings as errors, they will be treated as warnings instead. Should I
> > update my commit message to change compilation errors to compilation
> > warnings?
> 
> just don't use W=1 and clang.

This patch has effectively been sent four times now:

https://lore.kernel.org/all/20220914101829.82000-1-jiapeng.chong@linux.alibaba.com/
https://lore.kernel.org/all/20230217084647.50471-1-jiapeng.chong@linux.alibaba.com/
https://lore.kernel.org/all/20230319132903.1702426-1-trix@redhat.com/
https://lore.kernel.org/all/20240503095027.747838-1-visitorckw@gmail.com/ (this change obviously)

Your first comment from the 2022 patch:

  They're not used now, but they will be in a release or two.

I think a few releases have passed since then :) I don't personally care
if there is a solution here or not, as I don't test with W=1 (there's
enough to do at W=0 :P), but maybe it is time for either __maybe_unused
(as that strikes at the heart of the issue) or at the very least a
comment saying "hey, these functions are currently unused but there are
plans for them to be used, so don't remove them", rather than just
saying the status quo?

Cheers,
Nathan

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

* Re: [PATCH] maple_tree: Fix build failure with W=1 and LLVM=1
  2024-05-03 16:08       ` Nathan Chancellor
@ 2024-05-04 23:02         ` Andrew Morton
  2024-05-06 14:29           ` Liam R. Howlett
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Morton @ 2024-05-04 23:02 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Matthew Wilcox, Kuan-Wei Chiu, Liam.Howlett, ndesaulniers, morbo,
	justinstitt, linux-kernel, maple-tree, linux-mm, llvm, jserv

On Fri, 3 May 2024 09:08:21 -0700 Nathan Chancellor <nathan@kernel.org> wrote:

> This patch has effectively been sent four times now:
> 
> https://lore.kernel.org/all/20220914101829.82000-1-jiapeng.chong@linux.alibaba.com/
> https://lore.kernel.org/all/20230217084647.50471-1-jiapeng.chong@linux.alibaba.com/
> https://lore.kernel.org/all/20230319132903.1702426-1-trix@redhat.com/
> https://lore.kernel.org/all/20240503095027.747838-1-visitorckw@gmail.com/ (this change obviously)
> 
> Your first comment from the 2022 patch:
> 
>   They're not used now, but they will be in a release or two.
> 
> I think a few releases have passed since then :) I don't personally care
> if there is a solution here or not, as I don't test with W=1 (there's
> enough to do at W=0 :P), but maybe it is time for either __maybe_unused
> (as that strikes at the heart of the issue) or at the very least a
> comment saying "hey, these functions are currently unused but there are
> plans for them to be used, so don't remove them", rather than just
> saying the status quo?

We could just slap a #if 0 around them.  But I don't think it'll kill us to
have to type them in again one day ;)

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

* Re: [PATCH] maple_tree: Fix build failure with W=1 and LLVM=1
  2024-05-04 23:02         ` Andrew Morton
@ 2024-05-06 14:29           ` Liam R. Howlett
  0 siblings, 0 replies; 7+ messages in thread
From: Liam R. Howlett @ 2024-05-06 14:29 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Nathan Chancellor, Matthew Wilcox, Kuan-Wei Chiu, ndesaulniers,
	morbo, justinstitt, linux-kernel, maple-tree, linux-mm, llvm,
	jserv

* Andrew Morton <akpm@linux-foundation.org> [240504 19:03]:
> On Fri, 3 May 2024 09:08:21 -0700 Nathan Chancellor <nathan@kernel.org> wrote:
> 
> > This patch has effectively been sent four times now:
> > 
> > https://lore.kernel.org/all/20220914101829.82000-1-jiapeng.chong@linux.alibaba.com/
> > https://lore.kernel.org/all/20230217084647.50471-1-jiapeng.chong@linux.alibaba.com/
> > https://lore.kernel.org/all/20230319132903.1702426-1-trix@redhat.com/
> > https://lore.kernel.org/all/20240503095027.747838-1-visitorckw@gmail.com/ (this change obviously)
> > 
> > Your first comment from the 2022 patch:
> > 
> >   They're not used now, but they will be in a release or two.
> > 
> > I think a few releases have passed since then :) I don't personally care
> > if there is a solution here or not, as I don't test with W=1 (there's
> > enough to do at W=0 :P), but maybe it is time for either __maybe_unused
> > (as that strikes at the heart of the issue) or at the very least a
> > comment saying "hey, these functions are currently unused but there are
> > plans for them to be used, so don't remove them", rather than just
> > saying the status quo?
> 
> We could just slap a #if 0 around them.  But I don't think it'll kill us to
> have to type them in again one day ;)

I've had people try to use this bit for other reasons, even with these
functions.

If we're dropping this code, then we should put something in to avoid it
disappearing on us.

I am working on the use of these functions in a branch, but I don't have
a timeline of when that feature will land.

Thanks,
Liam

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

end of thread, other threads:[~2024-05-06 14:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-03  9:50 [PATCH] maple_tree: Fix build failure with W=1 and LLVM=1 Kuan-Wei Chiu
2024-05-03 12:20 ` Matthew Wilcox
2024-05-03 13:01   ` Kuan-Wei Chiu
2024-05-03 13:29     ` Matthew Wilcox
2024-05-03 16:08       ` Nathan Chancellor
2024-05-04 23:02         ` Andrew Morton
2024-05-06 14:29           ` Liam R. Howlett

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).