Message ID | 20230612093537.693926033@infradead.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2469713vqr; Mon, 12 Jun 2023 02:57:29 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5hELyCM2J6cGE3zCr4eaDp40AH0xUsTGY4A3daTdGDmf+VnMx7QxBtVqhGq5hJyf20B+GN X-Received: by 2002:a17:903:2582:b0:1b2:43a2:f2d with SMTP id jb2-20020a170903258200b001b243a20f2dmr5062678plb.32.1686563849389; Mon, 12 Jun 2023 02:57:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686563849; cv=none; d=google.com; s=arc-20160816; b=ZdOUKOo6QmnX7q4m5X16R34JWIBrujMq6j8ge5kdk4ZFyV2oYHzTOs4n91GW1A6jNY YfjPDlvdZS4KtJ2YI5Esv3YDhHEO6wQqNu1ADlrfY/YdP0a4AoZvV0AHTyHF7+ZPdYQ8 olLBh+HQpsgHwJ1HwPXcTXSm7sKFrpoOmL3gUi23TdCHCXMmttKsO1WG/c9XD/unk4Ps t26hHd3sM89vGForXMG/QtfTx9OqoM0fVDQf/sAXLf/4WniIUlEzUYtvU33POAUSklbh UJa0FmEe6sQPn9eZgZOsDLQ/DEXAEVt5YCpw4x/rhjkUeHeaR2duMppxrIcFL5GVNcKT jmVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:subject:cc:to:from:date :user-agent:message-id:dkim-signature; bh=iuKjwptMM283OkeCg3rHRYfDPMncNnTiTfZUlZvzjjw=; b=qwAIq7Q4i0RI3zm46ECXPKgO2sEkK1XmsDsnu276UHf3o9Y3F5gUDrZ+FKFrYDrsCl 97CTbMqyxWXq4bPDz2XDMc+NdUwoSbVoHG5p4bccY4F5m+cIfNlS/f7pyf6RWloDEdIN 4Z94G3467UtM3m7fhXfjFx5z2eDDjZolHsken1u9a3hJJSyBt7Lgm0btgBaCWjazoHiD f14tdf063S9vwpHUjw1VAfeQ/EW97WAXctOVfvhM1wgOxSH5BE6Gyl4/srWNZcuwlu/x 3f69YZNfA78AFv2BH1WTUiNXELrx7iXJjEbS/Cx6nIFeh6e5A8KzrL0pGbt42EiF/CT+ ssmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=eQ6OsD4k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b10-20020a170902d88a00b001a814f7db5fsi6563533plz.632.2023.06.12.02.57.09; Mon, 12 Jun 2023 02:57:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=eQ6OsD4k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235516AbjFLJzx (ORCPT <rfc822;rust.linux@gmail.com> + 99 others); Mon, 12 Jun 2023 05:55:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230186AbjFLJyT (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 12 Jun 2023 05:54:19 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C79749FA; Mon, 12 Jun 2023 02:38:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:MIME-Version:References: Subject:Cc:To:From:Date:Message-ID:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:In-Reply-To; bh=iuKjwptMM283OkeCg3rHRYfDPMncNnTiTfZUlZvzjjw=; b=eQ6OsD4kYVKLafcm5zMaXykUrJ t3Yx8a+byrZdB944/0aNdLOqAmoLeWSa1sowLg19pvZhRfEGH12EfjQizZN73l+Q2lmgWVTy/jEN2 66w/tSoR035EtMK1QJrtp16Z85OKpvfSl1I8OLy7JSDS0vEBXw8vGKRffU4u96Gz85h50NrSym32v 8aadmJp7+8xctTmftjzi5KRquTBd3yr6fYIYX7v7Rb7TZGAQFPvFwW5JY6GaXXShnDrDMfhQWRx/H Hx6pFtrNHcKkz/xQw6bxea1nVgSbzWPnczzWWwxrD46aGrv+zXbaZt8xVprl8zZZmhqQuJnaVP8+3 u9+4lFQg==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1q8e0f-008kOo-0K; Mon, 12 Jun 2023 09:38:49 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 7FC1C302E28; Mon, 12 Jun 2023 11:38:48 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 0) id 0C29230A58077; Mon, 12 Jun 2023 11:38:48 +0200 (CEST) Message-ID: <20230612093537.693926033@infradead.org> User-Agent: quilt/0.66 Date: Mon, 12 Jun 2023 11:07:17 +0200 From: Peter Zijlstra <peterz@infradead.org> To: torvalds@linux-foundation.org, keescook@chromium.org, gregkh@linuxfoundation.org, pbonzini@redhat.com Cc: masahiroy@kernel.org, nathan@kernel.org, ndesaulniers@google.com, nicolas@fjasle.eu, catalin.marinas@arm.com, will@kernel.org, vkoul@kernel.org, trix@redhat.com, ojeda@kernel.org, peterz@infradead.org, mingo@redhat.com, longman@redhat.com, boqun.feng@gmail.com, dennis@kernel.org, tj@kernel.org, cl@linux.com, acme@kernel.org, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, jolsa@kernel.org, namhyung@kernel.org, irogers@google.com, adrian.hunter@intel.com, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, vschneid@redhat.com, paulmck@kernel.org, frederic@kernel.org, quic_neeraju@quicinc.com, joel@joelfernandes.org, josh@joshtriplett.org, mathieu.desnoyers@efficios.com, jiangshanlai@gmail.com, rientjes@google.com, vbabka@suse.cz, roman.gushchin@linux.dev, 42.hyeyoo@gmail.com, apw@canonical.com, joe@perches.com, dwaipayanray1@gmail.com, lukas.bulwahn@gmail.com, john.johansen@canonical.com, paul@paul-moore.com, jmorris@namei.org, serge@hallyn.com, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org, llvm@lists.linux.dev, linux-perf-users@vger.kernel.org, rcu@vger.kernel.org, linux-security-module@vger.kernel.org, tglx@linutronix.de, ravi.bangoria@amd.com, error27@gmail.com, luc.vanoostenryck@gmail.com Subject: [PATCH v3 04/57] kbuild: Drop -Wdeclaration-after-statement References: <20230612090713.652690195@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768490375178963547?= X-GMAIL-MSGID: =?utf-8?q?1768490375178963547?= |
Series |
Scope-based Resource Management
|
|
Commit Message
Peter Zijlstra
June 12, 2023, 9:07 a.m. UTC
With the advent on scope-based resource management it comes really
tedious to abide by the contraints of -Wdeclaration-after-statement.
It will still be recommeneded to place declarations at the start of a
scope where possible, but it will no longer be enforced.
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
Makefile | 6 +-----
arch/arm64/kernel/vdso32/Makefile | 2 --
2 files changed, 1 insertion(+), 7 deletions(-)
Comments
On Mon, Jun 12, 2023 at 6:39 PM Peter Zijlstra <peterz@infradead.org> wrote: > > With the advent on scope-based resource management it comes really > tedious to abide by the contraints of -Wdeclaration-after-statement. Where is the context of Linus' suggested-by? I do not know where this came from. I suddenly got a huge v3 in my mailbox. I see an equivalent patch submitted last year: https://lore.kernel.org/lkml/Y1w031iI6Ld29IVT@p183/ Linus rejected it. Did he change his mind? > It will still be recommeneded to place declarations at the start of a > scope where possible, but it will no longer be enforced. If you remove the warning, we will not be able to detect code that opts out the recommendation for no good reason.
On Wed, Jun 14, 2023 at 03:13:03PM +0900, Masahiro Yamada wrote: > On Mon, Jun 12, 2023 at 6:39 PM Peter Zijlstra <peterz@infradead.org> wrote: > > > > With the advent on scope-based resource management it comes really > > tedious to abide by the contraints of -Wdeclaration-after-statement. > > Where is the context of Linus' suggested-by? > > I do not know where this came from. > I suddenly got a huge v3 in my mailbox. > > > I see an equivalent patch submitted last year: > https://lore.kernel.org/lkml/Y1w031iI6Ld29IVT@p183/ > > Linus rejected it. Did he change his mind? https://lkml.kernel.org/r/CAHk-%3Dwi-RyoUhbChiVaJZoZXheAwnJ7OO%3DGxe85BkPAd93TwDA%40mail.gmail.com I'll add it as a Link tag to the Changelog. > > > It will still be recommeneded to place declarations at the start of a > > scope where possible, but it will no longer be enforced. > > If you remove the warning, we will not be able to > detect code that opts out the recommendation > for no good reason. Yeah, so per that thread linked above I tried to play clever games with _Pragma() to get around this, but GCC hates on it (works fine with Clang though). Linus said to just give up and scrap the whole -Wdeclaration-after-statement thing. I suppose it'll be up to reviewers and perhaps checkpatch like things to 'enforce' the rules.
--- a/Makefile +++ b/Makefile @@ -447,8 +447,7 @@ HOSTRUSTC = rustc HOSTPKG_CONFIG = pkg-config KBUILD_USERHOSTCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes \ - -O2 -fomit-frame-pointer -std=gnu11 \ - -Wdeclaration-after-statement + -O2 -fomit-frame-pointer -std=gnu11 KBUILD_USERCFLAGS := $(KBUILD_USERHOSTCFLAGS) $(USERCFLAGS) KBUILD_USERLDFLAGS := $(USERLDFLAGS) @@ -1012,9 +1011,6 @@ endif # arch Makefile may override CC so keep this after arch Makefile is included NOSTDINC_FLAGS += -nostdinc -# warn about C99 declaration after statement -KBUILD_CFLAGS += -Wdeclaration-after-statement - # Variable Length Arrays (VLAs) should not be used anywhere in the kernel KBUILD_CFLAGS += -Wvla --- a/arch/arm64/kernel/vdso32/Makefile +++ b/arch/arm64/kernel/vdso32/Makefile @@ -65,11 +65,9 @@ VDSO_CFLAGS += -Wall -Wundef -Wstrict-pr -fno-strict-aliasing -fno-common \ -Werror-implicit-function-declaration \ -Wno-format-security \ - -Wdeclaration-after-statement \ -std=gnu11 VDSO_CFLAGS += -O2 # Some useful compiler-dependent flags from top-level Makefile -VDSO_CFLAGS += $(call cc32-option,-Wdeclaration-after-statement,) VDSO_CFLAGS += $(call cc32-option,-Wno-pointer-sign) VDSO_CFLAGS += -fno-strict-overflow VDSO_CFLAGS += $(call cc32-option,-Werror=strict-prototypes)