Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3012973imu; Mon, 17 Dec 2018 11:38:53 -0800 (PST) X-Google-Smtp-Source: AFSGD/UFVepgdvrIfIJgv028mjwmC36HUh2/ys4I0sFCF8/G1YH6ygjOW50dAQRi4ZVlism1IyHi X-Received: by 2002:a62:1f9d:: with SMTP id l29mr13924299pfj.14.1545075533275; Mon, 17 Dec 2018 11:38:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545075533; cv=none; d=google.com; s=arc-20160816; b=M2osnTVJm8uISa8SW+B05zZxeLHJqHuaoJXqRt888N2wpxeVA6ZwBK9IhAL6Bjja8U bcEBpSm4typOln7J349A8uynlw4j8aC0WNNLsLusz3Tnj+djjsB95xAbTsl0BMz5YPrw e2sIQpxFmUm0s8uR4dIlJFXkwhphO9gRCdPiUO2BJI2mr4avW9i/2+LnuHmyTE/wGGVg nOshK6FFL150m7t4YFdNkxw34ev4Nr+vPj8BIX2qjw0wZPmuCwLcw2nTLcgLwlScoqWW mMQhljBfRXg9/ahSPIN1OvgU/btmB16gFGZgsZynjMcrYscZR+x9nosumeG4yjglG0Gx wVJA== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=zDIKAUw2yxp3jOxvHDtRHBErp1NASLNXA9NXDsqqVPE=; b=xywrmV4wFhzwxnAEBzyOYB4f1+iDytChL+CwrLgeGuFWiyJfzZWO+jVbXofBmSXtBy /uxvBvjlpQAuYzGQdrWnUNh6XPj0UCPg76VVKTgG+gd4SjrsNXwkObxG2u0T0C2o29Be YdQIvakn/TbOBafqG+x7XSHN76W11d+xRXFm7ZW4J6rWUsqezqp3a16diBMrh3RKvOCv 82w88jjf1Psu8LW6/3fRJUAcUhlwyjESUxWhAJURD+W16u+ZhqizW6QFkDlkhWH3SVIa oipleS4UJ2ycYEQEVaqUARYpBnCniuvDQechHDSC1kPbMFkhBu6ePrGex1gnsJkNOJKZ KTEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=NFFkOO+K; 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 92si11196222pld.84.2018.12.17.11.38.38; Mon, 17 Dec 2018 11:38:53 -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=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=NFFkOO+K; 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 S1732857AbeLQR3n (ORCPT + 99 others); Mon, 17 Dec 2018 12:29:43 -0500 Received: from mail-io1-f66.google.com ([209.85.166.66]:41566 "EHLO mail-io1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726436AbeLQR3m (ORCPT ); Mon, 17 Dec 2018 12:29:42 -0500 Received: by mail-io1-f66.google.com with SMTP id s22so10591193ioc.8 for ; Mon, 17 Dec 2018 09:29:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=zDIKAUw2yxp3jOxvHDtRHBErp1NASLNXA9NXDsqqVPE=; b=NFFkOO+Kje5vD3F+RRLx/8xrvr7CCD60rOcCBriu8tF0W11p5AuKxPL0reMfR40UMd pEPmgqpsLStGjZfNdqLfUARSVYczKqR3xIqlgCcYMqCjLSDZfFvwDq+/mzmqnJ7z8RFL g/FkQWa4VGyINaOL/9zuJqAQp/u5TQyLlZsobAmbWxeQc7WpyU0vn7NnX/Jfh2Zdpp+9 2d6a+sTtAWXQIA+AVPA2qiM1NR+5ZVcqMEUfw76QRUI0AQu1QQLMdG+LCntD/XeqxGUz S+KWPSRCdXAs0JcGBGtuCryH2KV11D4eTgLmR08cLMgUaVy0X6QGwS0x6+bIBoxukHct KwDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=zDIKAUw2yxp3jOxvHDtRHBErp1NASLNXA9NXDsqqVPE=; b=XPwkAq1XcpQ/hKpmqrRn1l2lifSv48VeZi2bnv5Bny+uFPH7r9xyKrCfMToBHmVYTS FzVr9zWk82BoD/s5bdWPW6Njdiw4wu3IZEscQcy0Qhvf2vEgIFiib9G5wSYB7nlDP3t5 1XySojHwYgTg+CAGuAJod1rb9xhRR4567qaR5VHJRuKrCb3r6M42JVqjw6hl6PPcMql1 2dlil/Yp9QzdxalABV00mdAmpxUxcddE0OUM5m602IKAO9jrx1c2ppjJFM/9dg3wdbcp 6bozDtM96LGtwUj1Bw06Q/OFqm26BsSNJa+stdrJJceY9sRB3Psmy8gcVuLTjdw0htDX 4wqg== X-Gm-Message-State: AA+aEWYvagsXCJYhTVaunzaMAhMTqMlc/n5cQ0bJ7jkibk230SrEQfLE f/Xzn8bP4LpYDviucEZKUl6L9Q== X-Received: by 2002:a5e:d702:: with SMTP id v2mr11119403iom.224.1545067781252; Mon, 17 Dec 2018 09:29:41 -0800 (PST) Received: from [192.168.1.56] ([216.160.245.98]) by smtp.gmail.com with ESMTPSA id j14sm5849643ioa.5.2018.12.17.09.29.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Dec 2018 09:29:40 -0800 (PST) Subject: Re: [PATCH v2] drbd: Avoid Clang warning about pointless switch statment To: Nathan Chancellor , Philipp Reisner , Lars Ellenberg Cc: drbd-dev@lists.linbit.com, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann , Nick Desaulniers References: <20181002171447.10765-1-natechancellor@gmail.com> <20181004200912.32348-1-natechancellor@gmail.com> <20181217172401.GA30635@flashbox> From: Jens Axboe Message-ID: <0110d874-7595-1786-77e3-e2b0daec2327@kernel.dk> Date: Mon, 17 Dec 2018 10:29:38 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20181217172401.GA30635@flashbox> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/17/18 10:24 AM, Nathan Chancellor wrote: > 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. It needs to get here now, but drbd hasn't really sent anything in for about a year, so I'm starting to doubt how maintained it is at this point. -- Jens Axboe