From: "Dilger, Andreas" <andreas.dilger@intel.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: "Drokin, Oleg" <oleg.drokin@intel.com>,
James Simmons <jsimmons@infradead.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Eremin, Dmitry" <dmitry.eremin@intel.com>,
Lustre Development List <lustre-devel@lists.lustre.org>,
"devel@driverdev.osuosl.org" <devel@driverdev.osuosl.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] staging: lustre: shut up clang warnings on CLASSERT()
Date: Thu, 2 Feb 2017 07:50:24 +0000 [thread overview]
Message-ID: <C39A7DE9-5D89-4B98-A61F-1BB766ADEFC0@intel.com> (raw)
In-Reply-To: <20170201165314.2588373-1-arnd@arndb.de>
On Feb 1, 2017, at 09:52, Arnd Bergmann <arnd@arndb.de> wrote:
>
> lustre uses a fake switch() statement as a compile-time assert, but unfortunately
> each use of that causes a warning when building with clang:
>
> drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c:2907:2: warning: no case matching constant switch condition '42'
> drivers/staging/lustre/lnet/klnds/socklnd/../../../include/linux/libcfs/libcfs_private.h:294:36: note: expanded from macro 'CLASSERT'
> #define CLASSERT(cond) do {switch (42) {case (cond): case 0: break; } } while (0)
>
> Adding a 'default:' label in there shuts up the warning.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
> ---
> drivers/staging/lustre/include/linux/libcfs/libcfs_private.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h
> index aab15d8112a4..2d5435029185 100644
> --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h
> +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h
> @@ -291,7 +291,7 @@ do { \
> * value after conversion...
> *
> */
> -#define CLASSERT(cond) do {switch (42) {case (cond): case 0: break; } } while (0)
> +#define CLASSERT(cond) do {switch (42) {case (cond): case 0: default: break; } } while (0)
>
> /* max value for numeric network address */
> #define MAX_NUMERIC_VALUE 0xffffffff
> --
> 2.9.0
>
Cheers, Andreas
--
Andreas Dilger
Lustre Principal Architect
Intel Corporation
next prev parent reply other threads:[~2017-02-02 7:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-01 16:52 Arnd Bergmann
2017-02-02 7:50 ` Dilger, Andreas [this message]
2017-02-02 9:54 ` Greg Kroah-Hartman
2017-02-02 10:40 ` Arnd Bergmann
2017-02-02 10:43 ` Greg Kroah-Hartman
2017-02-02 11:22 ` Arnd Bergmann
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=C39A7DE9-5D89-4B98-A61F-1BB766ADEFC0@intel.com \
--to=andreas.dilger@intel.com \
--cc=arnd@arndb.de \
--cc=devel@driverdev.osuosl.org \
--cc=dmitry.eremin@intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=jsimmons@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lustre-devel@lists.lustre.org \
--cc=oleg.drokin@intel.com \
/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®