Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp2985451pxm; Mon, 28 Feb 2022 09:45:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJxt5d3sVRlFfuRl0j8NG4Q/XcjYz2kzOFZQ/zxyxJWNCTvxtUk0v7AVdp7FsRBIcDmg113s X-Received: by 2002:a17:903:2349:b0:150:1189:c823 with SMTP id c9-20020a170903234900b001501189c823mr21684500plh.121.1646070331815; Mon, 28 Feb 2022 09:45:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646070331; cv=none; d=google.com; s=arc-20160816; b=LqBOIZOHw2zyb87OVErkHSH9pUBWQJNSeQdbLbeCcJ/kyHmvFR58guAB7pdZSgxhJ8 6cP7n5q0S8jA+cFtZ2DVI6PAgSykj+c/zG5Bhvy17Yp3crNDoMQE8bUC7qUZoe9HbrW7 tvp01Dqj1PD8dtgF7WH9YvDnCr0ZU5BTFOtHoYDI5XpRuTy+P+LKu68FAXmGrAcMfomz l7pal8gbQ2yJnJYT0BL0FAza1geI7rniT4ZVNHEFMgj/tdQYi4el+vptnMFIiFndIYsb nfFo+yu1Ghm0cQbg29BwiR/33nV3jTOEDL7RxhOa+O0TSB9XKf4E8QVzB37j076DhHye b47A== 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=8mqPb/qt/2QqmI8yhkMh/vyfwOIyh6LfGLyCoA822Qo=; b=sP4E9Anybntngqx7pPGhhx4ZUPoXqCv5afTlbRxNCDr37DkGZm8RZ974ON+En31R/r UrUVyRGffv47Wk+eP4O5bOp27MO7B3it3zHDOavY+ifIi+KzpaWKzSY+5PZmy8vEMHR2 1KLYqeSnfWRRDfYbvR+Yec1qCRs4Gf6TLdi8lMOTdOyEVIm4kRV0Ri2e1QMUb6Qw8mZd RBOgavnwePfOsX/6+Ai2Dnd+yU58TFvIEivYQfsoE7fycEQA0HiJ3z+KExjax219xwv3 N7TMN5R/UgfjNpM4V44lJVSdHNHgeY/C28iA1AUdPxCTpCYsHrwB3RheKyumNW3olbT0 aGCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LgVJuH4d; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c20-20020a170902c1d400b0014fce67d090si9813389plc.183.2022.02.28.09.45.15; Mon, 28 Feb 2022 09:45:31 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=LgVJuH4d; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238055AbiB1Q5D (ORCPT + 99 others); Mon, 28 Feb 2022 11:57:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233487AbiB1Q5B (ORCPT ); Mon, 28 Feb 2022 11:57:01 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDF2D79C75; Mon, 28 Feb 2022 08:56:21 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 71B42612CB; Mon, 28 Feb 2022 16:56:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A46A1C340E7; Mon, 28 Feb 2022 16:56:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1646067380; bh=523gBdVPJChXozDXmy5Cb2pK2i/xRfAcGRZVUQAHjNc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=LgVJuH4da0tpuW1nX+TSzWKpqT1/5OI3uq9Url+IKydIaNvJrwxxCJ02pDsUamp0J BXgyENWeP0ucoramTVXNaT23Z6w+IPOpRsVnisqnZwdBL4ARuBusSY6JLdz3305OfE YtZvql2BfkwdTq2LxRIJRizjGmx3hngX5RBUDcSxgf2mLkssqkaZFIqarTisHboNdy Xy986yF0zeYZbw6HX61O+ecCg/MIlsoP4bKonolKYJ+91DSdYuEy6Ckl7v583fSXhJ fxInQ5iK44jGAKr2Pvl9ywk4psfT+Vv0H/AbdegLc3kV5x8iLrYBvahTmACsIjfZ5u Ol9BFIfpBb+FA== Date: Mon, 28 Feb 2022 09:56:13 -0700 From: Nathan Chancellor To: Arnd Bergmann Cc: Marco Elver , Linux Kbuild mailing list , Arnd Bergmann , Linus Torvalds , Masahiro Yamada , llvm@lists.linux.dev, Jonathan Corbet , Federico Vaga , Alex Shi , Hu Haowen , Michal Marek , Nick Desaulniers , "open list:DOCUMENTATION" , Linux Kernel Mailing List , linux-doc-tw-discuss@lists.sourceforge.net, Linux ARM , Intel Graphics , dri-devel , greybus-dev@lists.linaro.org, linux-staging@lists.linux.dev, linux-btrfs , Mark Rutland Subject: Re: [PATCH] [v2] Kbuild: move to -std=gnu11 Message-ID: References: <20220228103142.3301082-1-arnd@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,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: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 28, 2022 at 12:57:55PM +0100, Arnd Bergmann wrote: > On Mon, Feb 28, 2022 at 12:47 PM Marco Elver wrote: > > On Mon, 28 Feb 2022 at 11:32, Arnd Bergmann wrote: > > > > > Nathan Chancellor reported an additional -Wdeclaration-after-statement > > > warning that appears in a system header on arm, this still needs a > > > workaround. > > > > On the topic of Wdeclaration-after-statement, Clang only respects this > > warning with C99 and later starting with Clang 14: > > https://github.com/llvm/llvm-project/commit/c65186c89f35#diff-ec770381d76c859f5f572db789175fe44410a72608f58ad5dbb14335ba56eb97R61 > > > > Until Clang 14, -Wdeclaration-after-statement is ignored by Clang in > > newer standards. If this is a big problem, we can probably convince > > the Clang stable folks to backport the fixes. However, the build won't > > fail, folks might just miss the warning if they don't also test with > > GCC. Unfortunately, none of the branches prior to release/14.x are going to see any more updates (at least as far as I am aware, as the LLVM community only supports one release branch at a time) but as Arnd mentioned below, I do not really see that as a problem, as newer versions of clang and GCC will catch these warnings. > I don't expect this is to be a big issue, as long as the latest clang behaves > as expected. There are many warnings that are only produced by one of the > two compilers, so this is something we already deal with. > > I think it's more important to address the extra warning that Nathan > reported, where clang now complains about the intermingled declaration > in a system header when previously neither gcc nor clang noticed this. Right. Based on the upstream LLVM bug, I think we should just fix arm_neon.h to avoid triggering -Wdeclaration-after-statement to have something that is (hopefully) relatively low risk for a clang-14 backport, rather than addressing the root cause of clang warning in system macros, as it sounds like fixing that has some risks that are not fully understood at this point. The kernel only uses very specific system headers after commit 04e85bbf71c9 ("isystem: delete global -isystem compile option"), so I don't think that my suggested approach will have many downsides. I think I see how to potentially fix arm_neon.h in clang/utils/TableGen/NeonEmitter.cpp, I just have to think about it a little more. Realistically, I don't think special casing this in lib/raid6 is the end of the world: diff --git a/lib/raid6/Makefile b/lib/raid6/Makefile index 45e17619422b..a41ff71b90af 100644 --- a/lib/raid6/Makefile +++ b/lib/raid6/Makefile @@ -38,6 +38,10 @@ ifeq ($(CONFIG_KERNEL_MODE_NEON),y) NEON_FLAGS := -ffreestanding # Enable NEON_FLAGS += -isystem $(shell $(CC) -print-file-name=include) +# https://github.com/ClangBuiltLinux/linux/issues/1603 +ifeq ($(CONFIG_CC_IS_CLANG)$(CONFIG_CPU_BIG_ENDIAN),yy) +NEON_FLAGS += -Wno-declaration-after-statement +endif ifeq ($(ARCH),arm) NEON_FLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=neon endif > > > The differences between gnu99, gnu11, gnu1x and gnu17 are fairly > > > minimal and mainly impact warnings at the -Wpedantic level that the > > > kernel never enables. Between these, gnu11 is the newest version > > > that is supported by all supported compiler versions, though it is > > > only the default on gcc-5, while all other supported versions of > > > gcc or clang default to gnu1x/gnu17. > > > > > > Link: https://lore.kernel.org/lkml/CAHk-=wiyCH7xeHcmiFJ-YgXUy2Jaj7pnkdKpcovt8fYbVFW3TA@mail.gmail.com/ > > > Link: https://github.com/ClangBuiltLinux/linux/issues/1603 > > > Suggested-by: Linus Torvalds > > > Cc: Masahiro Yamada > > > Cc: linux-kbuild@vger.kernel.org > > > Cc: llvm@lists.linux.dev > > > Signed-off-by: Arnd Bergmann > > > > Acked-by: Marco Elver Cheers, Nathan