Received: by 2002:a05:7412:b795:b0:e2:908c:2ebd with SMTP id iv21csp82315rdb; Wed, 1 Nov 2023 18:07:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEdwuPdnMN4j3q+nx+WmPMJzhmVgy23QP0M6tqsaiCxjPKDSQAsiEMyseWHej98TdvocIW3 X-Received: by 2002:a17:90a:17a7:b0:27d:a14c:eba6 with SMTP id q36-20020a17090a17a700b0027da14ceba6mr14097409pja.21.1698887259241; Wed, 01 Nov 2023 18:07:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698887259; cv=none; d=google.com; s=arc-20160816; b=HbJwpVVVcEdxxwqFZ+diX/o9YWCSdwR92lfWJpVdstdST5nrzTrISsLGPZXX1HJ4rw aKiBbUsZWpTn+tY1+gU98EWk+qzEVKS0IVFNoH2vb77vN8/oljVbwmMkU1joIfn6T1I4 5ybv3LQ/cBVUzo9Ke3WEGs4tTUQSDFJV3A8eVuW5p7VvGrmMcOCHnMaKTUSzBy2KJ6rO oyM5c3pBJk3UJzTx8XTdTC47ksCkyJgs6Azge3vW2ugOGvIehuV4SualYNMCZTSiLxiv xPTZfzV3agQ7RWs1/c/SevOGQXd++QNS2iktkzK6B39lftEKG5oiubnNZ2D1hEwlWbmc cmvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=fuC0DB5P1Wc7+YfIrCYY4pt20vRYGhFqGXNwzq5CzVA=; fh=jiXLkqNDzG3b/QAzJIuozV0UAbRlJBktbkYfqgIaIi0=; b=eqNMsBoGSNfLoCzapqmnGXx/a4biwxIPZZ0ainud6vUT0bXw8gcDoDlfrYXO7mDmQa Yt2YImTJ93+2ph5XGtjqv4Yo3wgbnOmnQ1ZWZQ3+WF400S1+z/qSmA3mC+rBBeLFgCRl 6fdFaJLJxABxXy0pPmea2PuSqTNF2Wtt4AS8hShHXjMoe+om/nOLUCGQV+BER47DtqYY FUEAqnPU4H34xIIzy0BBEoI72IKMYyAcgpMs6OSxwHza87NGx1yReFlE+X8+byVGBb8S 7FO5CkIWSedbGWFzqZazV0lNs12EBOaGO5D3h8vM1JXB1tSTytecY7Gynu53kPN/rsL9 tTZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=eHlHp2PM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id bj13-20020a17090b088d00b002741e78e66asi1805957pjb.153.2023.11.01.18.07.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Nov 2023 18:07:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=eHlHp2PM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id E3DA280C6EB9; Wed, 1 Nov 2023 18:07:35 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234819AbjKBBH3 (ORCPT + 99 others); Wed, 1 Nov 2023 21:07:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230395AbjKBBH2 (ORCPT ); Wed, 1 Nov 2023 21:07:28 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06774E8 for ; Wed, 1 Nov 2023 18:07:26 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C0DC4C433C8; Thu, 2 Nov 2023 01:07:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1698887245; bh=bt/lkt4dy1gi54m725q76c9DzTFRJyTNf0BQmwj5u4k=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=eHlHp2PMIvBUDVHR661JJDncqlkJTtIwaAU336jsUHR4qVZk+FTMK9am4VpDUDLiK 18jdtk9x2GnYkK5wzz1V+/2ybMp7JfaUBU6sWRRrAGdnPFs1lFUWqvruiuwlqQM3EO M5gzBv4HlODQWcBpk7gEq171ZPxY4R1d6EVYWJd4GqnBSng+/k0b+3YDBkhFnrvkkP 5ddGTgjfl93NJ9qXbIBgnAPMqKLCxAd39WXvugA4Dn9XBwSKio++tmfoQ2F3W8meJA 3x1Lx+hCwzpMYYwP9YopRfhBfYWg9yxOcK0DvqfPfGSZZy/HLNMpi+KPIKxdLSGrRn F1ZcXRtYYjROA== Date: Wed, 1 Nov 2023 18:07:23 -0700 From: Nathan Chancellor To: Palmer Dabbelt Cc: edumazet@google.com, davem@davemloft.net, dsahern@kernel.org, kuba@kernel.org, pabeni@redhat.com, ndesaulniers@google.com, trix@redhat.com, 0x7f454c46@gmail.com, fruggeri@arista.com, noureddine@arista.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, patches@lists.linux.dev Subject: Re: [PATCH net] tcp: Fix -Wc23-extensions in tcp_options_write() Message-ID: <20231102010723.GA406542@dev-arch.thelio-3990X> References: <20231031-tcp-ao-fix-label-in-compound-statement-warning-v1-1-c9731d115f17@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 01 Nov 2023 18:07:36 -0700 (PDT) On Wed, Nov 01, 2023 at 05:41:10PM -0700, Palmer Dabbelt wrote: > On Tue, 31 Oct 2023 13:23:35 PDT (-0700), nathan@kernel.org wrote: > > Clang warns (or errors with CONFIG_WERROR=y) when CONFIG_TCP_AO is set: > > > > net/ipv4/tcp_output.c:663:2: error: label at end of compound statement is a C23 extension [-Werror,-Wc23-extensions] > > 663 | } > > | ^ > > 1 error generated. > > > > On earlier releases (such as clang-11, the current minimum supported > > version for building the kernel) that do not support C23, this was a > > hard error unconditionally: > > > > net/ipv4/tcp_output.c:663:2: error: expected statement > > } > > ^ > > 1 error generated. > > > > Add a semicolon after the label to create an empty statement, which > > resolves the warning or error for all compilers. > > > > Closes: https://github.com/ClangBuiltLinux/linux/issues/1953 > > Fixes: 1e03d32bea8e ("net/tcp: Add TCP-AO sign to outgoing packets") > > Signed-off-by: Nathan Chancellor > > --- > > net/ipv4/tcp_output.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c > > index f558c054cf6e..6064895daece 100644 > > --- a/net/ipv4/tcp_output.c > > +++ b/net/ipv4/tcp_output.c > > @@ -658,7 +658,7 @@ static void tcp_options_write(struct tcphdr *th, struct tcp_sock *tp, > > memset(ptr, TCPOPT_NOP, sizeof(*ptr)); > > ptr++; > > } > > -out_ao: > > +out_ao:; > > #endif > > } > > if (unlikely(opts->mss)) { > > > > --- > > base-commit: 55c900477f5b3897d9038446f72a281cae0efd86 > > change-id: 20231031-tcp-ao-fix-label-in-compound-statement-warning-ebd6c9978498 > > > > Best regards, > > This gives me a > > linux/net/ipv4/tcp_output.c:663:2: error: expected statement > } > > on GCC for me. What GCC version? I cannot reproduce that error with my patch applied. I tested mainline at commit deefd5024f07 ("Merge tag 'vfio-v6.7-rc1' of https://github.com/awilliam/linux-vfio") using GCC 6 from kernel.org and I can reproduce a similar failure with ARCH=x86_64 allyesconfig: net/ipv4/tcp_output.c: In function 'tcp_options_write': net/ipv4/tcp_output.c:661:1: error: label at end of compound statement out_ao: ^~~~~~ With this change applied, the error disappears for GCC 6 and GCC 13 continues to build without error. I can try the other supported versions later, I just did an older and newer one for a quick test. > So I think something like > > diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c > index f558c054cf6e..ca09763acaa8 100644 > --- a/net/ipv4/tcp_output.c > +++ b/net/ipv4/tcp_output.c > @@ -659,6 +659,11 @@ static void tcp_options_write(struct tcphdr *th, struct tcp_sock *tp, > ptr++; > } > out_ao: > + /* > + * Labels at the end of compound statements are a C23 feature, so > + * introduce a block to avoid a warning/error on strict toolchains. > + */ > + {} > #endif > } > if (unlikely(opts->mss)) { > > should do it (though it's still build testing...) I am not opposed to this once we understand what versions are affected by this so that we have some timeline of removing this workaround. Cheers, Nathan