Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3011810imu; Mon, 17 Dec 2018 11:37:20 -0800 (PST) X-Google-Smtp-Source: AFSGD/WGRujkINjZEDbYgMIpHgANSB7ZHkQJl6xXSjMOz9wGpxvxC/pUxqZgBUcLBgpSFUgZtwpP X-Received: by 2002:a63:65c7:: with SMTP id z190mr13212977pgb.249.1545075440925; Mon, 17 Dec 2018 11:37:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545075440; cv=none; d=google.com; s=arc-20160816; b=T0J5KdwW9L09pVMVSqdsLs3haxBS/wOrIbBY1LTL87TMOR1gfYzWBQ3NU5o6ngjYXW GoMeAXcKPehG3JbtHtN9oreP0cgLFvCWvSSqiReacoNw39D6nRI37YrVESmXauVDjPxz q7+CQxp2i4IqU9VSIiOMd2s7VE+Nz6B9NAogmO+NW+w1h8aEn7c3LdYJmUPnyQgfUtJW /kax6xb6R8x0PdtgOZgUrYwDuKz0YwVy56XZ2hSSUn+VUIHbEwseEPFopiYS0kXlF396 wXSrdQrgYdrIXuUmT9ebC7leUsn7HJLZfJ7lzBRgBB91UDTe04uTWBX+Ajz61o9F2rdx gakw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=7LX8zkJ55ucDSuOlduiKG9DRTub6ofiKcrVx45LdZZA=; b=Tz3OdLDcEHu8Wx5svKo9JicudXs+a4s9cCZXP7d/WRbvaR9jMFP1WlWGi7Hy0C9cm9 kZlIp8E4VC+E3S2SdFafhHZtTHe+99AutKlSBJMCql79eQdzkhDnQnTcpHNTA0CzPvwa M/J9sUmXdmaQqt+0KEbzV6NFUutER1iMILJad1QO3ebvF4ysTKeClxcVVHW9yhaQlJ6k h5xWDprZSwNFPAPv5AAgsYzr/BNAq0+KaEws/UBeuSkrfmC3B0txkxirtllzTZyTyoF3 C25QNE5zgQhS0LIjxvViUIIQtI3KQeTARedLFZLW9aCX6J+GszshPJVaoboFATCpQsY5 R09g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=f+FB6nQb; 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 z5si9549120plh.133.2018.12.17.11.37.05; Mon, 17 Dec 2018 11:37:20 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=f+FB6nQb; 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 S1727998AbeLQRYH (ORCPT + 99 others); Mon, 17 Dec 2018 12:24:07 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:33788 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726758AbeLQRYG (ORCPT ); Mon, 17 Dec 2018 12:24:06 -0500 Received: by mail-wm1-f65.google.com with SMTP id r24so5238096wmh.0; Mon, 17 Dec 2018 09:24:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=7LX8zkJ55ucDSuOlduiKG9DRTub6ofiKcrVx45LdZZA=; b=f+FB6nQbgVHJRUo06ueF+3puLuoN2e/pBiqEiizsMZxq5QH0gMc9st25ZF7VxmUsUO UU1VQX2NSMnxfQwxBR4LLEUVvEeuxXK/9B8rxuzav0N15+7MFF2e5ZNVbVzJs78zkx6/ CuEF252kLfdctMzMXIC35T/6VQveK/ZQY9Vm8zy5AbfRtYIyYWG9BNtABYlRuGEOeo5W pha/VAjVGKw2dvwAneBbvRh5OxsuSO4u48pIp6vwo10hkSH7mmZQRuNtbcfVVvEBmkjW RRB5L3lMy4VV7XywRMNuh6NMgyczgrLuoAbBm80LpJ8mu8nwQaXetPvoawruqCVfrsLk 9ayw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=7LX8zkJ55ucDSuOlduiKG9DRTub6ofiKcrVx45LdZZA=; b=ka2rv0hVzyNV3G6+pEScYSSXGiK+pqbN4p++eGUE+RzPRDQPlIlQYjwbcM2TAVMgzF 05x9JwS1Hia+Ujs42Y+zdpLjihyoW1Xj+JxGWpG0A23DWjZwRYSDkE4nCWyW/tVjnIh4 p0X5tZrXtoC+Sfo2ChKXQ8a2Zj3c2ihK135EAcQ6A3Oc9QdiJzA4yG/KH9Wxn6bGoX1m e9TlkDRwFlXShf3N4WwVUuojQR0Dg09nAFALyGmuV6vgDESmgdUfXMWx+gJ4G7WWzzS1 dsONmwNR1Yjr9RVVJHLqNNjmVGFA5PTltBDTL5NCzSVTNiEl56G5H4NwUfk8bRYzRFsW WdpA== X-Gm-Message-State: AA+aEWbe/Kj9388cEFkxZwbPoIQEUrGwZbqv+kUMvccZvXUioEDedQxN yhgy8/06i8HfVxA4HK1Uzkw= X-Received: by 2002:a1c:400b:: with SMTP id n11mr12708174wma.85.1545067443531; Mon, 17 Dec 2018 09:24:03 -0800 (PST) Received: from flashbox ([2a01:4f8:10b:24a5::2]) by smtp.gmail.com with ESMTPSA id a12sm1098379wro.18.2018.12.17.09.24.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 Dec 2018 09:24:02 -0800 (PST) Date: Mon, 17 Dec 2018 10:24:01 -0700 From: Nathan Chancellor To: Philipp Reisner , Lars Ellenberg Cc: drbd-dev@lists.linbit.com, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann , Jens Axboe , Nick Desaulniers Subject: Re: [PATCH v2] drbd: Avoid Clang warning about pointless switch statment Message-ID: <20181217172401.GA30635@flashbox> References: <20181002171447.10765-1-natechancellor@gmail.com> <20181004200912.32348-1-natechancellor@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181004200912.32348-1-natechancellor@gmail.com> User-Agent: Mutt/1.11.1 (2018-12-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 04, 2018 at 01:09:13PM -0700, Nathan Chancellor wrote: > 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 > Hi Lars and Philipp, Could you please make sure that this patch and the other one I sent make it into 4.21/5.0? I am not sure when you were planning on sending the pull request to Jens that you mentioned in the other thread but I've noticed most maintainers typically send their requests for the impending merge window around -rc7 or so and I wanted to make sure it was on your radar. Thank you, Nathan