From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 56769A0032;
	Thu, 16 Dec 2021 00:15:53 +0100 (CET)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id C86F840696;
	Thu, 16 Dec 2021 00:15:52 +0100 (CET)
Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com
 [209.85.214.182])
 by mails.dpdk.org (Postfix) with ESMTP id A562D40688
 for <dev@dpdk.org>; Thu, 16 Dec 2021 00:15:50 +0100 (CET)
Received: by mail-pl1-f182.google.com with SMTP id u17so17853661plg.9
 for <dev@dpdk.org>; Wed, 15 Dec 2021 15:15:50 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=networkplumber-org.20210112.gappssmtp.com; s=20210112;
 h=date:from:to:cc:subject:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=M0WN4GSnNQ7BzkOjbJbnEbuZcOn32rc8GWv7lClD+vM=;
 b=DL88iI68QKl61Lv2Wmw9VhVkxPqnPBSCocaWBB6E2IeQVpHQIqkIJXHNDvNKUtJZWo
 YWwl4yAjHwGH0RZEJakrYy5Zz3SI1G0bOm2zY8CI7MlaRlR6Kap7PW5dE1154k6Z0FIj
 24sQtRmbqa+ZoU/nR05kkcCTo5SSi1lYgfgav8M0fKGzQE091sGHkzfVX5CajZLq9SRH
 76ZWq0Sx26hKpkGI7JQN3OfTXXoDBvF/uEtJwPEfdHyaMQoYp9YLQN65xgXJ807p9LBv
 y8BuUZCmZYk0+dT7wz8dG0vyvvcHMmpBX2y3jZXYq7ox1onu3wPnPKLLuNEIpW17bps5
 Tz2g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=M0WN4GSnNQ7BzkOjbJbnEbuZcOn32rc8GWv7lClD+vM=;
 b=GEyDz70FB5F8s9akc5c2gV6QjUcHeGR2Pn+D95YK804G2bCXMBCq3/P9Bi39Zf8UBM
 MYgKgxByIVzBqJvkJ8T5WJ7w4kNmG2LI/C1GfTY4cAVcTb3LnbSA5AmZD71Irdx8Dfuu
 MSf9yTzVjm7yAZIx0fI6wH8KKyuPXRze5hC2DEvp+a3y0kwLBBiOXW7Qx4UO2z/4Iewy
 p+4XL9plZdhYlYfu1P8j/13vV+wKOCjSK6hSWTdHuhZp1yxk+hS+3CIce4LHMVHbPphW
 PQ9l41S214Lakca1H/u4vcvqjXwcuhbUbhyPmUxFYQVKQoEzUaQ+f9gQ7WcwSiZa8mUy
 xK9g==
X-Gm-Message-State: AOAM532i3tURnY6pUCf6PukgY79R2GbWgiB8Ua/yz/sD5Iv3wkQ0vRkZ
 RpcntTlD+b+TaX6XmnwNiLGoJOGA2enANQ==
X-Google-Smtp-Source: ABdhPJzjG2OabZ3mmpPWihNDsFseZwoLGlrHIxRWlq5SPhbNeStEs0TaAVsuyu3NHMqXl5Myy19HgQ==
X-Received: by 2002:a17:902:7b8e:b0:148:a2f7:9d8f with SMTP id
 w14-20020a1709027b8e00b00148a2f79d8fmr6588607pll.174.1639610149615; 
 Wed, 15 Dec 2021 15:15:49 -0800 (PST)
Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199])
 by smtp.gmail.com with ESMTPSA id
 bf13sm2957849pjb.47.2021.12.15.15.15.48
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 15 Dec 2021 15:15:49 -0800 (PST)
Date: Wed, 15 Dec 2021 15:15:46 -0800
From: Stephen Hemminger <stephen@networkplumber.org>
To: Ferruh Yigit <ferruh.yigit@intel.com>
Cc: <dev@dpdk.org>
Subject: Re: [dpdk-kmods] linux/igb_uio: fix build for switch fall through
Message-ID: <20211215151546.40de01c3@hermes.local>
In-Reply-To: <19cc482d-d7a4-7a14-a34f-33fd15a99a04@intel.com>
References: <20211215184859.1859870-1-ferruh.yigit@intel.com>
 <20211215112017.26958d79@hermes.local>
 <19cc482d-d7a4-7a14-a34f-33fd15a99a04@intel.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

On Wed, 15 Dec 2021 21:04:30 +0000
Ferruh Yigit <ferruh.yigit@intel.com> wrote:

> On 12/15/2021 7:20 PM, Stephen Hemminger wrote:
> > On Wed, 15 Dec 2021 18:48:59 +0000
> > Ferruh Yigit <ferruh.yigit@intel.com> wrote:
> >   
> >> Linux is using '-Wimplicit-fallthrough=5' compiler option, which doesn't
> >> take any fall through comments into account but only uses compiler
> >> 'fallthrough' attribute to document fall through action is intended.
> >>
> >> "falls through" comment was used in the code which is causing a build
> >> error now, this patch converts comment to the 'fallthrough' macro
> >> defined in the Linux.
> >>
> >> To cover the case where Linux version doesn't have the macro, defined it
> >> in the compatibility header too.
> >>
> >> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>  
> > 
> > Are you sure that fixes it? because the comment in the macro is typically
> > not visible in a macro expansion.
> >    Since in most case Linux uses gcc why not use the gcc attribute
> > 
> >   __attribute__ ((fallthrough))  
> 
> Hi Stephen,
> 
> That is the intention already.
> 
> Patch is using the Linux kernel defined macro:
> #if __has_attribute(__fallthrough__)
> # define fallthrough                    __attribute__((__fallthrough__))
> #else
> # define fallthrough                    do {} while (0)  /* fallthrough */
> #endif
> 
> And it builds fine without the macro in the 'compat.h'.
> 
> 
> I added the define in the 'compat.h' for old kernels which doesn't
> define the macro. For that case I expect default '-Wimplicit-fallthrough'
> option is used which accepts 'fallthrough;' as a regex hit.

Your right, on older kernels it really is just a dummy statement.
The regex can't work, you can take (or leave the comment) it has no effect
because implicit-fallthrough won't see it in a macro.