[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <C39A7DE9-5D89-4B98-A61F-1BB766ADEFC0@intel.com>
Date: Thu, 2 Feb 2017 07:50:24 +0000
From: "Dilger, Andreas" <andreas.dilger@...el.com>
To: Arnd Bergmann <arnd@...db.de>
CC: "Drokin, Oleg" <oleg.drokin@...el.com>,
James Simmons <jsimmons@...radead.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Eremin, Dmitry" <dmitry.eremin@...el.com>,
Lustre Development List <lustre-devel@...ts.lustre.org>,
"devel@...verdev.osuosl.org" <devel@...verdev.osuosl.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] staging: lustre: shut up clang warnings on CLASSERT()
On Feb 1, 2017, at 09:52, Arnd Bergmann <arnd@...db.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@...db.de>
Reviewed-by: Andreas Dilger <andreas.dilger@...el.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
Powered by blists - more mailing lists