From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751133AbdBBJy6 (ORCPT ); Thu, 2 Feb 2017 04:54:58 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:57334 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751020AbdBBJy5 (ORCPT ); Thu, 2 Feb 2017 04:54:57 -0500 Date: Thu, 2 Feb 2017 10:54:53 +0100 From: Greg Kroah-Hartman To: "Dilger, Andreas" Cc: Arnd Bergmann , "Drokin, Oleg" , James Simmons , "Eremin, Dmitry" , Lustre Development List , "devel@driverdev.osuosl.org" , LKML Subject: Re: [PATCH] staging: lustre: shut up clang warnings on CLASSERT() Message-ID: <20170202095453.GA30437@kroah.com> References: <20170201165314.2588373-1-arnd@arndb.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.7.2 (2016-11-26) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 02, 2017 at 07:50:24AM +0000, Dilger, Andreas wrote: > On Feb 1, 2017, at 09:52, Arnd Bergmann 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 > > Reviewed-by: Andreas Dilger > > > --- > > 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