Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1349271imu; Thu, 20 Dec 2018 14:49:40 -0800 (PST) X-Google-Smtp-Source: AFSGD/Vmjf6rXkF15mZH3yYtHtaTRMOyJP6sMPc444yYVxa8+KoTpi5fhPjlTqyjNLjIUFtjnHCF X-Received: by 2002:a62:c42:: with SMTP id u63mr79729pfi.73.1545346179967; Thu, 20 Dec 2018 14:49:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545346179; cv=none; d=google.com; s=arc-20160816; b=DiJvB53oNUrAEoWt6EhTzzwhw2T9UwaYu9Pnn4Z+z4R4XnedjMKJKN2hYKuffT4eu7 /psyaH/tB7j60KM8sMtbJQ1bq9ssWXRQBbAyYMPEfncC1/pOgTjvWgKcsNLQMYt8GMAe Y7Utq32T84FTOZ6KA/XQWExnwyUeiaS+tfJ0JJuWeUY5r+m8mG4TFLw8hNz+HXJ+IjDn wqQKGcQqkQNLB39InmsQZsEmdsvJE/tR7sAkokzIyRmgRdeVFtNrRr/8f/Ub6vMca7ok RHkooAqxoF38UASWcDm26LSDytTAPDfAuturkwHLPrIK6WNQOrhM4Krh6IzsgOf9DIy4 ZcFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=4iYMMqkT3A7DEyBOSKY7tXn3LiIDoM5przbSC7IRYbQ=; b=m2ElRshKv3mxAp7XR9XZFh6tBQLY4aL43GbbvxRz2YUGL1dBy/+Qzstpsa/ZxCUcX3 2LAT13IpTygVhOC8HsJI31IMk3WDDcVoswi+45A8eXO1iQz34ILdQ2UD69KqeJTzu2ka mBmK0eBH0PfY6oHUUhbMQip4FX7pR1pDFymwzMI5S7eT7yxmE98L5c3UWCDiTXWIi25g p9R8yI2NIo0Tup1XfZS3uLjLRP6X3DlOc7f3PmbiW5Ftse2BWxg1RizfpVi/xfEMpXtz W1N+TG4dDFVmt7afPnu5qCa0hlKuazoS7UQQ2GfE1pxmu0YAZUHfR+vATSeuJmzgxbuD j6tg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y73si18751920pgd.478.2018.12.20.14.49.23; Thu, 20 Dec 2018 14:49:39 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731588AbeLTQoi (ORCPT + 99 others); Thu, 20 Dec 2018 11:44:38 -0500 Received: from mail09.linbit.com ([212.69.161.110]:50160 "EHLO mail09.linbit.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730086AbeLTQoi (ORCPT ); Thu, 20 Dec 2018 11:44:38 -0500 Received: from soda.linbit (212-186-191-219.static.upcbusiness.at [212.186.191.219]) by mail09.linbit.com (LINBIT Mail Daemon) with ESMTP id AB7301045C39; Thu, 20 Dec 2018 17:23:50 +0100 (CET) From: Lars Ellenberg To: Jens Axboe , linux-kernel@vger.kernel.org, linux-block@vger.kernel.org Cc: drbd-dev@lists.linbit.com Subject: [PATCH 16/17] drbd: Avoid Clang warning about pointless switch statment Date: Thu, 20 Dec 2018 17:23:43 +0100 Message-Id: <20181220162344.8430-17-lars.ellenberg@linbit.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181220162344.8430-1-lars.ellenberg@linbit.com> References: <20181220162344.8430-1-lars.ellenberg@linbit.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nathan Chancellor There are several warnings from Clang about no case statement matching the constant 0: In file included from drivers/block/drbd/drbd_receiver.c:48: In file included from drivers/block/drbd/drbd_int.h:48: In file included from ./include/linux/drbd_genl_api.h:54: In file included from ./include/linux/genl_magic_struct.h:236: ./include/linux/drbd_genl.h:321:1: warning: no case matching constant switch condition '0' GENL_struct(DRBD_NLA_HELPER, 24, drbd_helper_info, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ./include/linux/genl_magic_struct.h:220:10: note: expanded from macro 'GENL_struct' switch (0) { ^ Silence this warning by adding a 'case 0:' statement. Additionally, adjust the alignment of the statements in the ct_assert_unique macro to avoid a checkpatch warning. This solution was originally sent by Arnd Bergmann with a default case statement: https://lore.kernel.org/patchwork/patch/756723/ Link: https://github.com/ClangBuiltLinux/linux/issues/43 Suggested-by: Lars Ellenberg Signed-off-by: Nathan Chancellor --- include/linux/genl_magic_struct.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/linux/genl_magic_struct.h b/include/linux/genl_magic_struct.h index 5972e4969197..eeae59d3ceb7 100644 --- a/include/linux/genl_magic_struct.h +++ b/include/linux/genl_magic_struct.h @@ -191,6 +191,7 @@ static inline void ct_assert_unique_operations(void) { switch (0) { #include GENL_MAGIC_INCLUDE_FILE + case 0: ; } } @@ -209,6 +210,7 @@ static inline void ct_assert_unique_top_level_attributes(void) { switch (0) { #include GENL_MAGIC_INCLUDE_FILE + case 0: ; } } @@ -218,7 +220,8 @@ static inline void ct_assert_unique_top_level_attributes(void) static inline void ct_assert_unique_ ## s_name ## _attributes(void) \ { \ switch (0) { \ - s_fields \ + s_fields \ + case 0: \ ; \ } \ } -- 2.17.1