public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/1] ext4: Mark ctx_*_flags() with __maybe_unused
@ 2024-09-05 16:32 Andy Shevchenko
  2024-11-07 15:12 ` Theodore Ts'o
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2024-09-05 16:32 UTC (permalink / raw)
  To: linux-ext4, linux-kernel, llvm
  Cc: Theodore Ts'o, Andreas Dilger, Nathan Chancellor,
	Nick Desaulniers, Bill Wendling, Justin Stitt, Andy Shevchenko

When ctx_set_flags() is unused, it prevents kernel builds
with clang, `make W=1` and CONFIG_WERROR=y:

.../ext4/super.c:2120:1: error: unused function 'ctx_set_flags' [-Werror,-Wunused-function]
 2120 | EXT4_SET_CTX(flags); /* set only */
      | ^~~~~~~~~~~~~~~~~~~

Fix this by marking ctx_*_flags() with __maybe_unused
(mark both for the sake of symmetry).

See also commit 6863f5643dd7 ("kbuild: allow Clang to find unused static
inline functions for W=1 build").

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 fs/ext4/super.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index e72145c4ae5a..8bbd84c2f3ca 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -2095,16 +2095,16 @@ static int ext4_parse_test_dummy_encryption(const struct fs_parameter *param,
 }
 
 #define EXT4_SET_CTX(name)						\
-static inline void ctx_set_##name(struct ext4_fs_context *ctx,		\
-				  unsigned long flag)			\
+static inline __maybe_unused						\
+void ctx_set_##name(struct ext4_fs_context *ctx, unsigned long flag)	\
 {									\
 	ctx->mask_s_##name |= flag;					\
 	ctx->vals_s_##name |= flag;					\
 }
 
 #define EXT4_CLEAR_CTX(name)						\
-static inline void ctx_clear_##name(struct ext4_fs_context *ctx,	\
-				    unsigned long flag)			\
+static inline __maybe_unused						\
+void ctx_clear_##name(struct ext4_fs_context *ctx, unsigned long flag)	\
 {									\
 	ctx->mask_s_##name |= flag;					\
 	ctx->vals_s_##name &= ~flag;					\
-- 
2.43.0.rc1.1336.g36b5255a03ac


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

* Re: [PATCH v1 1/1] ext4: Mark ctx_*_flags() with __maybe_unused
  2024-09-05 16:32 [PATCH v1 1/1] ext4: Mark ctx_*_flags() with __maybe_unused Andy Shevchenko
@ 2024-11-07 15:12 ` Theodore Ts'o
  0 siblings, 0 replies; 2+ messages in thread
From: Theodore Ts'o @ 2024-11-07 15:12 UTC (permalink / raw)
  To: linux-ext4, linux-kernel, llvm, Andy Shevchenko
  Cc: Theodore Ts'o, Andreas Dilger, Nathan Chancellor,
	Nick Desaulniers, Bill Wendling, Justin Stitt


On Thu, 05 Sep 2024 19:32:29 +0300, Andy Shevchenko wrote:
> When ctx_set_flags() is unused, it prevents kernel builds
> with clang, `make W=1` and CONFIG_WERROR=y:
> 
> .../ext4/super.c:2120:1: error: unused function 'ctx_set_flags' [-Werror,-Wunused-function]
>  2120 | EXT4_SET_CTX(flags); /* set only */
>       | ^~~~~~~~~~~~~~~~~~~
> 
> [...]

Applied, thanks!

[1/1] ext4: Mark ctx_*_flags() with __maybe_unused
      commit: 7bdb90e0f6c832c00a4c0a5d841aa367502dbfef

Best regards,
-- 
Theodore Ts'o <tytso@mit.edu>

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

end of thread, other threads:[~2024-11-07 15:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-05 16:32 [PATCH v1 1/1] ext4: Mark ctx_*_flags() with __maybe_unused Andy Shevchenko
2024-11-07 15:12 ` Theodore Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox