Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1409596imm; Thu, 4 Oct 2018 13:10:42 -0700 (PDT) X-Google-Smtp-Source: ACcGV63s3okZKTUvWHO2ICUAd9o3fV/ESqsHMaRLYbw/igkE367fgfQHg/kXhmy32TMY+5D+y+A+ X-Received: by 2002:a62:41d6:: with SMTP id g83-v6mr8368951pfd.44.1538683842569; Thu, 04 Oct 2018 13:10:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538683842; cv=none; d=google.com; s=arc-20160816; b=MZIb50cjKn1RGhmy2bAOcHP07J3tXP/fjxAmWWePrxdyJm0fJ0xL/ACA9rs7dvOtLF rTdenkJJpwxhO7Aw5q0zYA4uyCj+JWc6g6aJ8qyyxbD5g1aOJeO03GQrZlJT2xH9i9iP rU5lmRZTsCacHXWfYnQqvAZcHqBk+yLcul2Aw0kEfNcXuS5Z+N2kNuDoHaR20NtZ8eCe wkMmVwKDKiB08tvoyCnncAWdpHK6GuVK8u/sirMrKzjBtCXxcgRBV6cxuJ8kcR/ptz1A r3gtbKerrCfn6YGVxuDS7VgXOWFNL/NqIygGCQkB7IbdB5l9g4+WxDcpxHLTaJaURa4P awjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=plKZcTA1l7bnOvI3XXQN4ShOETcX2TSCfStU+Qp5/5M=; b=nFa+a3s7hRB4ikzKnwb8gyr72Os8MlRfgHcRD2InG9mootood/UKWBU4gUCgt76Zd5 f6ju0cl6K/Hw/FcPgE/pM5efil5R6qYF/CT/3xaQck6m1nYv9T2XIr9PYh69L/adeho6 TO2UpW2LI5dU6S/17KGC9dIKmbbBeh1CQL3tZLtI+BHaHUFISX9Jvmat709h0+FU7ETm YSHuw0kc2tXHHtoiNOK5ltEYJSbbKoa4zNHdsuX6tLybDzxNL2e2w4KOpYJOoiU4sFNj lLrVsHsKtdFh4zfzLu3KZC9EoApy862ngn5upIYtGI80zlyuLvuMoJ+UyZekvtC0vE/3 PSpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=N3kVK8wk; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n32-v6si5912842pgm.469.2018.10.04.13.10.26; Thu, 04 Oct 2018 13:10:42 -0700 (PDT) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=N3kVK8wk; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727797AbeJEDEz (ORCPT + 99 others); Thu, 4 Oct 2018 23:04:55 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:50823 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727444AbeJEDEz (ORCPT ); Thu, 4 Oct 2018 23:04:55 -0400 Received: by mail-wm1-f65.google.com with SMTP id s12-v6so10179651wmc.0; Thu, 04 Oct 2018 13:10:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=plKZcTA1l7bnOvI3XXQN4ShOETcX2TSCfStU+Qp5/5M=; b=N3kVK8wkuktYWwu905GstVMoeUQ3BMVztUMNqj5efxykT3t2xnlq4VjGJqUrreksXK Z2mn0snDluUvijRarVwXKBYFky0vj0WTXbVBDQHIVxBt6WFY53ETWhRR3MNDRkaP/pag Gneog8/a/2caRRTGGnJc/l8KjhL//Rf6aocEqtGTrQrAd3OfXkmHDNHRJb4hYvw3BEbj PlnHk/65iSMv4D2DkelzC782kTE0xGmtWm0hG+9GMy28cdo1s/9MldWhQHuBR+bGwDOb TUTKTGmnps8aOfsSLqkryQEedfiU6wJI1YhPM8BFppmvrT8gauLvnFFjOenQKXFwd6OI BHsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=plKZcTA1l7bnOvI3XXQN4ShOETcX2TSCfStU+Qp5/5M=; b=YOhkKnFegry8uyTGOAYHkxnyJJpvz/B9BXHn5xb8GfBCbFJPjQULvoQKMLaCMD0xmQ ZSwKm+jTXbdEeYUhdhSWi4AWMRAdaZdVrEB2qrpUM5wWCyzoGCCrORhdlVRtGDCwkUD3 C4fw29cRubqPs/9Ob/p5pPV9NJQ2EbRYNjhuVuxS9q0CsyrS20OEra9zn4Tz5dORIVta 3qztIHXnRCyE147Rcri+uLTUow8FQXE+ObXTH4d8D8arexxB7AUhQ2/fes8B+ojTJts3 PapMzflgcXAeifCbkqcvq9Wq8UdZKbPnR8tCMqNDznVda1QrAi+nM6VDuyBbOY5I2x06 ufuw== X-Gm-Message-State: ABuFfogEk1mfnaZbF4oB5zxi/XpISMPmpDL/jNFywC4izS5oEBoqciSH 3Mgy0PNoteicBL8k25WAKxAomPUMnvTgBQ== X-Received: by 2002:a1c:5801:: with SMTP id m1-v6mr5635429wmb.118.1538683802923; Thu, 04 Oct 2018 13:10:02 -0700 (PDT) Received: from localhost.localdomain ([2a01:4f8:10b:24a5::2]) by smtp.gmail.com with ESMTPSA id z2-v6sm4220871wrh.8.2018.10.04.13.10.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Oct 2018 13:10:01 -0700 (PDT) From: Nathan Chancellor To: Philipp Reisner , Lars Ellenberg , Jens Axboe Cc: drbd-dev@lists.linbit.com, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann , Nathan Chancellor Subject: [PATCH v2] drbd: Avoid Clang warning about pointless switch statment Date: Thu, 4 Oct 2018 13:09:13 -0700 Message-Id: <20181004200912.32348-1-natechancellor@gmail.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181002171447.10765-1-natechancellor@gmail.com> References: <20181002171447.10765-1-natechancellor@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- Since this is not the same as Arnd's patch, I took authorship for it while leaving a link to the original patch in the commit message. If this is not how it should have been done, please let me know. 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.19.0