From: Arnd Bergmann <arnd@kernel.org>
To: "Andrew Morton" <akpm@linux-foundation.org>,
"Petr Mladek" <pmladek@suse.com>,
"Uwe Kleine-König" <uwe@kleine-koenig.org>,
"Rasmus Villemoes" <linux@rasmusvillemoes.dk>,
"Andy Shevchenko" <andy.shevchenko@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>, linux-kernel@vger.kernel.org
Subject: [PATCH] printf: fix Woverride-init warning for EDEADLK errno
Date: Mon, 26 Oct 2020 22:49:59 +0100 [thread overview]
Message-ID: <20201026215004.3893088-1-arnd@kernel.org> (raw)
From: Arnd Bergmann <arnd@arndb.de>
On most architectures, gcc -Wextra warns about the list of error
numbers containing both EDEADLK and EDEADLOCK:
lib/errname.c:15:67: warning: initialized field overwritten [-Woverride-init]
15 | #define E(err) [err + BUILD_BUG_ON_ZERO(err <= 0 || err > 300)] = "-" #err
| ^~~
lib/errname.c:172:2: note: in expansion of macro 'E'
172 | E(EDEADLK), /* EDEADLOCK */
| ^
lib/errname.c:15:67: note: (near initialization for 'names_0[35]')
15 | #define E(err) [err + BUILD_BUG_ON_ZERO(err <= 0 || err > 300)] = "-" #err
| ^~~
lib/errname.c:172:2: note: in expansion of macro 'E'
172 | E(EDEADLK), /* EDEADLOCK */
| ^
Make that line conditional on the two values being distinct.
Fixes: 57f5677e535b ("printf: add support for printing symbolic error names")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
lib/errname.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lib/errname.c b/lib/errname.c
index 0c4d3e66170e..6adff0bf2445 100644
--- a/lib/errname.c
+++ b/lib/errname.c
@@ -169,7 +169,9 @@ static const char *names_0[] = {
E(ECANCELED), /* ECANCELLED */
E(EAGAIN), /* EWOULDBLOCK */
E(ECONNREFUSED), /* EREFUSED */
+#if EDEADLK != EDEADLOCK
E(EDEADLK), /* EDEADLOCK */
+#endif
};
#undef E
--
2.27.0
next reply other threads:[~2020-10-26 21:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-26 21:49 Arnd Bergmann [this message]
2020-10-27 6:55 ` Uwe Kleine-König
2020-10-27 8:41 ` Arnd Bergmann
2020-10-27 7:23 ` Rasmus Villemoes
2020-10-27 7:25 ` Rasmus Villemoes
2020-10-27 8:46 ` Arnd Bergmann
2020-10-27 9:12 ` Petr Mladek
2020-10-27 10:55 ` Rasmus Villemoes
2020-10-27 12:03 ` Petr Mladek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201026215004.3893088-1-arnd@kernel.org \
--to=arnd@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=andy.shevchenko@gmail.com \
--cc=arnd@arndb.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=pmladek@suse.com \
--cc=uwe@kleine-koenig.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®