From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: "Dilger, Andreas" <andreas.dilger@intel.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
"Drokin, Oleg" <oleg.drokin@intel.com>,
James Simmons <jsimmons@infradead.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: [lustre-devel] [PATCH] staging: lustre: shut up clang warnings on CLASSERT()
Date: Thu, 2 Feb 2017 10:54:53 +0100 [thread overview]
Message-ID: <20170202095453.GA30437@kroah.com> (raw)
In-Reply-To: <C39A7DE9-5D89-4B98-A61F-1BB766ADEFC0@intel.com>
On Thu, Feb 02, 2017 at 07:50:24AM +0000, Dilger, Andreas wrote:
> 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)
Ugh, why not just use the in-kernel ASSERT macro instead?
thanks,
greg k-h
WARNING: multiple messages have this Message-ID (diff)
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: "Dilger, Andreas" <andreas.dilger@intel.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
"Drokin, Oleg" <oleg.drokin@intel.com>,
James Simmons <jsimmons@infradead.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 10:54:53 +0100 [thread overview]
Message-ID: <20170202095453.GA30437@kroah.com> (raw)
In-Reply-To: <C39A7DE9-5D89-4B98-A61F-1BB766ADEFC0@intel.com>
On Thu, Feb 02, 2017 at 07:50:24AM +0000, Dilger, Andreas wrote:
> 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)
Ugh, why not just use the in-kernel ASSERT macro instead?
thanks,
greg k-h
next prev parent reply other threads:[~2017-02-02 9:54 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-01 16:52 [lustre-devel] [PATCH] staging: lustre: shut up clang warnings on CLASSERT() Arnd Bergmann
2017-02-01 16:52 ` Arnd Bergmann
2017-02-02 7:50 ` [lustre-devel] " Dilger, Andreas
2017-02-02 7:50 ` Dilger, Andreas
2017-02-02 9:54 ` Greg Kroah-Hartman [this message]
2017-02-02 9:54 ` Greg Kroah-Hartman
2017-02-02 10:40 ` [lustre-devel] " Arnd Bergmann
2017-02-02 10:40 ` Arnd Bergmann
2017-02-02 10:43 ` [lustre-devel] " Greg Kroah-Hartman
2017-02-02 10:43 ` Greg Kroah-Hartman
2017-02-02 11:22 ` [lustre-devel] " Arnd Bergmann
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=20170202095453.GA30437@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=andreas.dilger@intel.com \
--cc=arnd@arndb.de \
--cc=devel@driverdev.osuosl.org \
--cc=dmitry.eremin@intel.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.