* [PATCH -next] efs: fix -Wunused-const-variable= warning
@ 2023-08-02 6:57 Zhu Wang
2023-08-02 17:02 ` Andrew Morton
0 siblings, 1 reply; 2+ messages in thread
From: Zhu Wang @ 2023-08-02 6:57 UTC (permalink / raw)
To: akpm, linux-kernel; +Cc: wangzhu9
When building with W=1, the following warning occurs.
In file included from fs/efs/super.c:18:0:
fs/efs/efs.h:22:19: warning: ‘cprt’ defined but not used [-Wunused-const-variable=]
static const char cprt[] = "EFS: "EFS_VERSION" - (c) 1999 Al Smith
<Al.Smith@aeschi.ch.eu.org>";
^~~~
The header file is included in many C files, there are many
similar errors which are not included here. We add __maybe_unsed
to remove it.
Fixes: 45254b4fb2ae ("efs: move headers out of include/linux/")
Signed-off-by: Zhu Wang <wangzhu9@huawei.com>
---
fs/efs/efs.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/efs/efs.h b/fs/efs/efs.h
index 13a4d9622633..8202be1b2ade 100644
--- a/fs/efs/efs.h
+++ b/fs/efs/efs.h
@@ -19,7 +19,8 @@
#define EFS_VERSION "1.0a"
-static const char cprt[] = "EFS: "EFS_VERSION" - (c) 1999 Al Smith <Al.Smith@aeschi.ch.eu.org>";
+static const char __maybe_unused cprt[] =
+ "EFS: "EFS_VERSION" - (c) 1999 Al Smith <Al.Smith@aeschi.ch.eu.org>";
/* 1 block is 512 bytes */
--
2.17.1
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH -next] efs: fix -Wunused-const-variable= warning
2023-08-02 6:57 [PATCH -next] efs: fix -Wunused-const-variable= warning Zhu Wang
@ 2023-08-02 17:02 ` Andrew Morton
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2023-08-02 17:02 UTC (permalink / raw)
To: Zhu Wang; +Cc: linux-kernel, Al.Smith, linux-fsdevel
On Wed, 2 Aug 2023 14:57:53 +0800 Zhu Wang <wangzhu9@huawei.com> wrote:
> When building with W=1, the following warning occurs.
>
> In file included from fs/efs/super.c:18:0:
> fs/efs/efs.h:22:19: warning: ‘cprt’ defined but not used [-Wunused-const-variable=]
> static const char cprt[] = "EFS: "EFS_VERSION" - (c) 1999 Al Smith
> <Al.Smith@aeschi.ch.eu.org>";
> ^~~~
> The header file is included in many C files, there are many
> similar errors which are not included here. We add __maybe_unsed
> to remove it.
>
> ...
>
> --- a/fs/efs/efs.h
> +++ b/fs/efs/efs.h
> @@ -19,7 +19,8 @@
>
> #define EFS_VERSION "1.0a"
>
> -static const char cprt[] = "EFS: "EFS_VERSION" - (c) 1999 Al Smith <Al.Smith@aeschi.ch.eu.org>";
> +static const char __maybe_unused cprt[] =
> + "EFS: "EFS_VERSION" - (c) 1999 Al Smith <Al.Smith@aeschi.ch.eu.org>";
>
>
> /* 1 block is 512 bytes */
I don't know if Al is still around, but I added the Cc anyway.
cprt[] is unreferenced in fs/efs/*.c. I assume the intent here was to
embed the copyright strings in the generated binary. But this doesn't
work nowadays - the compiler/linker are removing this string entirely.
I guess the best approach is to move this copyright statement into a
comment as we do in many other places. See fs/ext2/acl.c for a random
example.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-08-02 17:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-02 6:57 [PATCH -next] efs: fix -Wunused-const-variable= warning Zhu Wang
2023-08-02 17:02 ` Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®