From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753029AbdBFNn3 (ORCPT ); Mon, 6 Feb 2017 08:43:29 -0500 Received: from mail-wm0-f45.google.com ([74.125.82.45]:38264 "EHLO mail-wm0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751214AbdBFNn1 (ORCPT ); Mon, 6 Feb 2017 08:43:27 -0500 Date: Mon, 6 Feb 2017 14:43:23 +0100 From: Lars Ellenberg To: Arnd Bergmann Cc: Philipp Reisner , drbd-dev@lists.linbit.com, Nicolas Dichtel , "David S. Miller" , linux-kernel@vger.kernel.org Subject: Re: [PATCH] drbd: avoid clang warning about pointless switch statement Message-ID: <20170206134323.GC16345@soda.linbit> Mail-Followup-To: Arnd Bergmann , Philipp Reisner , drbd-dev@lists.linbit.com, Nicolas Dichtel , "David S. Miller" , linux-kernel@vger.kernel.org References: <20170201165532.2605534-1-arnd@arndb.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170201165532.2605534-1-arnd@arndb.de> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Ack. Ok, not exactly "pintless", it's a valid compile time assert for uniq ids, basically a BUILD_BUG_ON(duplicate-ids). But adding a default clause there does not hurt. Thanks, Lars On Wed, Feb 01, 2017 at 05:55:02PM +0100, Arnd Bergmann wrote: > The drbd code causes warnings that we cannot easily disable when building with clang: > > In file included from drivers/block/drbd/drbd_debugfs.c:10: > In file included from drivers/block/drbd/drbd_int.h:48: > In file included from include/linux/drbd_genl_api.h:53: > In file included from include/linux/genl_magic_struct.h:237: > include/linux/drbd_genl.h:300:1: warning: no case matching constant switch condition '0' > > There is nothing wrong with the code, and adding 'default:' labels > in the right place is enough to let clang shut up about the warning. > > Fixes: ec2c35ac1ea2 ("drbd: prepare the transition from connector to genetlink") > Signed-off-by: Arnd Bergmann > --- > include/linux/genl_magic_struct.h | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/include/linux/genl_magic_struct.h b/include/linux/genl_magic_struct.h > index 6270a56e5edc..c6fbafb834f1 100644 > --- a/include/linux/genl_magic_struct.h > +++ b/include/linux/genl_magic_struct.h > @@ -190,6 +190,7 @@ static inline void ct_assert_unique_operations(void) > { > switch (0) { > #include GENL_MAGIC_INCLUDE_FILE > + default: > ; > } > } > @@ -208,6 +209,7 @@ static inline void ct_assert_unique_top_level_attributes(void) > { > switch (0) { > #include GENL_MAGIC_INCLUDE_FILE > + default: > ; > } > } > @@ -218,6 +220,7 @@ static inline void ct_assert_unique_ ## s_name ## _attributes(void) \ > { \ > switch (0) { \ > s_fields \ > + default: \ > ; \ > } \ > } > -- > 2.9.0