maple_tree: Fix build failure with W=1 and LLVM=1
Subsystems (3)
PATCH 1/1 maple_tree: Fix build failure with W=1 and LLVM=1
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.
--- lib/maple_tree.c | 15 --------------- 1 file changed, 15 deletions(-)
lib/maple_tree.c +0 -15
@@ -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 );
Signature · 1 line
2.34.1
Quoted 5 lines · 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 structmaple_enode*node)
Uh, clang is wrong to flag these as an error. They're just not used yet.
Quoted 9 lines · Matthew Wilcox
Quoted 5 lines · 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 structmaple_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
Quoted 8 lines · Kuan-Wei Chiu
Quoted 7 lines · Matthew Wilcox
Quoted 5 lines · 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 structmaple_enode*node)
Quoted 8 lines
Quoted 2 lines
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.
Quoted 12 lines · Matthew Wilcox
Quoted 11 lines · Kuan-Wei Chiu
Quoted 9 lines · Matthew Wilcox
Quoted 5 lines · 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 structmaple_enode*node)Uh, clang is wrong to flag these as an error. They're just not used yet.
Quoted 7 lines
Quoted 5 lines
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/[email protected]/
https://lore.kernel.org/all/[email protected]/
https://lore.kernel.org/all/[email protected]/
https://lore.kernel.org/all/[email protected]/ (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
Andrew Morton
maintainerQuoted 11 lines · On Fri, 3 May 2024 09:08:21 -0700 Nathan Chancellor <[email protected]> wrote:
This patch has effectively been sent four times now:
https://lore.kernel.org/all/[email protected]/
https://lore.kernel.org/all/[email protected]/
https://lore.kernel.org/all/[email protected]/
https://lore.kernel.org/all/[email protected]/ (this change obviously)Your first comment from the 2022 patch:
They're not used now, but they will be in a release or two.
Quoted 7 lines
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 ;)
Quoted 21 lines · Andrew Morton
Quoted 11 lines · On Fri, 3 May 2024 09:08:21 -0700 Nathan Chancellor <[email protected]> wrote:
This patch has effectively been sent four times now:
https://lore.kernel.org/all/[email protected]/
https://lore.kernel.org/all/[email protected]/
https://lore.kernel.org/all/[email protected]/
https://lore.kernel.org/all/[email protected]/ (this change obviously)Your first comment from the 2022 patch:
They're not used now, but they will be in a release or two.
Quoted 7 lines
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?
Quoted 2 lines
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