Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp823023ima; Sat, 20 Oct 2018 21:17:36 -0700 (PDT) X-Google-Smtp-Source: ACcGV623K4jMfpUSeNDZdQSsxZy1TTLfKf2m0v9mF4KJvx+w7W1v0t8AgDrhPsJy5Ltdrg+S4tWQ X-Received: by 2002:a63:31cc:: with SMTP id x195-v6mr12293431pgx.226.1540095456690; Sat, 20 Oct 2018 21:17:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540095456; cv=none; d=google.com; s=arc-20160816; b=enqByEsg8NTcWGRPRiz7aIachtYNtMH8odIDEx73KRLSSaD/mWJrQiI41leIDvwzHT gLgcYpHnTI00xs6mKIF/rp29d2hpAAnxrXteydEoTlmyhxvNjAy8ezhj5xXuMCldPxZT +GVIShV7VgM7j7mrraQzUmF3a4mDT5+cPGVGv3bGMFtU+6eUrqQ+TBGKWlQrGsi9hXBW cvYzPrtFayj/rjawB2OjaN/dzAHrnsGD5wXhIEZUWKQ5Hv9gzO8u92vvORdZOEDV4T/h ZaDaQvvXah1HZ0QbRrU2mCDJeBrkfFLpZUqMdkJH8V6gR1WvCxv7CottMa6i99VKALqh cg0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=7MNQfSkJBOmbT03Ak/vQRrAaCyw3Ier5klZZhm8tj9k=; b=BDRrFRjg14xYe+roe78FT7I/sdyNb/A+GgIw7bjO8n1zjO3PLzUX6Q14FgWg95qCut 26Q0XVpEQXWb4tVazM0ibkuZwjKyF8dgIbkdLxslUVnmtnOzjiX+2aPGko+2pBdBoQsu +EL/vr6Vh+Y6PVPfGaWXOqEvq791d71kf5szITwpqk4GB8Zf30tyNsOgXnGbDumC1rf1 zLg5XeRGfwk+LWKrOAIEGv8cf9vXmH2YT5yJ/70b4/DQbBefrjDg5H9f0e9HxSARLB78 JZtDPyiRb4ePdl8j3eZ2eeu6ZFBYxx8D7Pj0MxSoG+KMP7LZR3nOQmHsX7Fz8b9iFlY1 BdRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=J5mXPkeR; 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 h6-v6si5104253plt.403.2018.10.20.21.16.54; Sat, 20 Oct 2018 21:17:36 -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=J5mXPkeR; 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 S1727017AbeJUM3A (ORCPT + 99 others); Sun, 21 Oct 2018 08:29:00 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:42852 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726895AbeJUM3A (ORCPT ); Sun, 21 Oct 2018 08:29:00 -0400 Received: by mail-lj1-f195.google.com with SMTP id y71-v6so34021894lje.9; Sat, 20 Oct 2018 21:16:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=7MNQfSkJBOmbT03Ak/vQRrAaCyw3Ier5klZZhm8tj9k=; b=J5mXPkeRqXBn5h6Ur59TpNPpn5YLfLNX+1MUVCdq4dKueBcmA5tOEsMdLQflFfYQNY iamg/9tp1BzwoA3Psxjzp2g6ybGCOEQBg+3haZiQADidpFr+lmSBB1S8SyEk9KzNStlR Nvkf05l5VL52/DHJDm2D0r71PO4+V5ADxe+VGP0htqV8c4+lv0qX69jRfinVyEM0MQp0 3Ekf+zAsQ76/7MXsXAbTMp0La8ScNrYHfGsRA5CaV4QLEjboRwCtk05w+9tGURMxFJZL YeZ0PVEb4GWBcMEdOBDH+Vtaa2pr9CDEM+KKD++1fvL6h0JFRQ7o3HIV5UE5WsZ9k6yY e2vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=7MNQfSkJBOmbT03Ak/vQRrAaCyw3Ier5klZZhm8tj9k=; b=eyyQ76M/y/LzjrRFJYScl7WjVn2vjU+Yy+sLMuxuIjKljZo+P+qde4xkzOMPhAHPgJ 3afRVpMQHokhpQiy4pkXlv+0ijV4aciTyWauZpmCuv+82fjas90MCEKCK62vXBClBFNz /Zj4pz9ZoiT/Ly7bEvdeheNgBt3OH+TnVDbvMkU2oDWcC9yYmLITdAeQqucUdtkgObPf wHvD3UowLQlu5zZq5MJb0E616KZencsHib6mPcpFGbbYLYor0qCfcAPRrtt0LpXwskTR 6G0WRYW03RauD+5LZwpmZ8pQDrOgcGAaypB/2NYoQlkKMJG8cVBArSVqY1cI0n8wsqnX MC0w== X-Gm-Message-State: AGRZ1gLfGqBThen/cbcxHP6ITEGXsJ86Xy5H4YgFtqJW2QfhbUSdUCgt gSvHBUZPSD8roHdxh4vmmUdnwbwnjPjKyZF0Qus= X-Received: by 2002:a2e:c52:: with SMTP id o18-v6mr1969356ljd.94.1540095365480; Sat, 20 Oct 2018 21:16:05 -0700 (PDT) MIME-Version: 1.0 References: <20181017031241.669-1-kys@linuxonhyperv.com> <20181017031406.773-1-kys@linuxonhyperv.com> <20181017031406.773-3-kys@linuxonhyperv.com> <20181017050705.GE22447@kroah.com> <20181017062255.oiu44y4zuuwilan3@mwanda> <20181020192207.a6mne4npklprlyym@mwanda> In-Reply-To: <20181020192207.a6mne4npklprlyym@mwanda> From: Miguel Ojeda Date: Sun, 21 Oct 2018 06:15:53 +0200 Message-ID: Subject: Re: [PATCH 3/5] Drivers: hv: kvp: Fix the recent regression caused by incorrect clean-up To: Dan Cc: olaf@aepfle.de, sthemmin@microsoft.com, Greg KH , jasowang@redhat.com, linux-kernel , Stable@vger.kernel.org, Michael.H.Kelley@microsoft.com, Robo Bot , devel@linuxdriverproject.org, vkuznets@redhat.com, haiyangz@microsoft.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Dan, On Sat, Oct 20, 2018 at 9:22 PM Dan Carpenter wrote: > > On Sat, Oct 20, 2018 at 04:42:07PM +0200, Miguel Ojeda wrote: > > Using an attribute is indeed better whenever possible. In C++17 it is > > an standard attribute and there have been proposals to include some of > > them for C as well since 2016 at least, e.g. the latest for > > fallthrough at: > > > > http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2268.pdf > > > > I have taken a quick look into supporting it (typing it here to save > > it on the mailing list :-), and we have: > > > > * gcc >= 7.1 supports -Wimplicit-fallthrough with > > __attribute__((fallthrough)), the comment syntax and the C++ > > [[fallthrough]] syntax. > > * gcc < 7.1 complains about empty declarations (it does not know > > about attributes for null statements) and also > > -Wdeclaration-after-statement. > > I'm not sure I understand about empty decalarations. The idea is that > we would do: That paragraph tried to explain that gcc < 7.1 did not know about __attribute__((fallthrough)); i.e. that everything was introduced in gcc 7.1. Anyway, the conclusion was a neuron misfiring of mine -- in my mind I was thinking clang supported the comment syntax (when I clearly wrote that it didn't). Never mind --- thanks for pointing it out! > > case 3: > frob(); > __fall_through(); > case 4: > frob(); > > #if GCC > 7.1 > #define __fall_through() __attribute__((fallthrough)) > #else > #define __fall_through() > #endif Yes, of course, that is what we do for other attributes -- actually in -next we have pending a better way for checking, using __has_attribute: #if __has_attribute(fallthrough) #define __fallthrough __attribute__((fallthrough)) #else #define __fallthrough #endif > > So long as GCC and static analysis tools understand about the attribute > that's enought to catch the bugs. No one cares what clang and icc do. Not so sure about that -- there are quite some people looking forward to building Linux with clang, even if only to have another compiler to check for warnings and to use the clang/llvm-related tools (and to write new ones). > We would just disable the fall through warnings on those until they are > updated to support the fallthrough attribute. You mean if they start supporting the warning but not the attribute? I don't think that would be likely (i.e. if clang enables the warning on C mode, they will have to introduce a way to suppress it; which should be the attribute (at least), since they typically like to be compatible with gcc and since they already support it in C++ >= 11), but everything is possible. > > We wouldn't update all the fall through comments until later, but going > forward people could use the __fall_through() macro if they want. Agreed. I will introduce it in the compiler-attributes tree -- should be there for -rc1 if no one complains. CC'ing all of you in the patch. Cheers, Miguel