ext4: mark ctx_*_flags() with __maybe_unused
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 5 Sep 2024 16:32:29 +0000 (19:32 +0300)
committerTheodore Ts'o <tytso@mit.edu>
Wed, 13 Nov 2024 04:54:13 +0000 (23:54 -0500)
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>
Link: https://patch.msgid.link/20240905163229.140522-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/super.c

index e4bdb896e2025d0a2e4325fd81fadb37f338e0cb..dce37f784b59f97341e37149077c82f29022ed71 100644 (file)
@@ -2096,16 +2096,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;                                    \