Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp2663907pxm; Mon, 28 Feb 2022 03:52:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJxVRy1xyltuh4Nq6UXMLGswtr9YWu6rNZxpuvJ+aRuC1m5qxWsLbrTtA9LgNR2NIGohwIZG X-Received: by 2002:a17:907:7704:b0:6cf:48ac:b4a8 with SMTP id kw4-20020a170907770400b006cf48acb4a8mr14477360ejc.305.1646049161662; Mon, 28 Feb 2022 03:52:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646049161; cv=none; d=google.com; s=arc-20160816; b=FbGtMPLtfrSwjFwkLrIRJFf+Lj1OrgrXxIM6YknCmbrPdXuPKpTBkvg/Q6IV7v1jS2 BiJEcrBgXJjcy5JybvtMqMQhRCiAyMcAIVKQj4Uhuz6uioePEpfmDBTdVCxX4E8yzwv2 aCJtD5DMg3t1gwBhl94vqpCN24RodvTzdN9Jdlv6ZfqGZDDZf9SP9OgAqrMgMR1lskIH QFTwVBRFy4ym2jULANUb/MLYfqIqpzXLUrCrrDwXnEZy2IBjDDjjlzZa3U9DxQj7tdwj L3gv/aIFT9Kx26xGxa6BwquSWpl162J2Vh/bJjutlvej19ORWrne9ahnA5zLlSWLOum8 voGw== 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=HmRveemBeZ3um8xrQjaazQKzl3ZHcsTiSuZ3EuQZuIw=; b=dR+zqfgQKTBiyDqGXSIzTCjSdMFi3gfAuGhaNu5ybUcYQAFUQhArEimkKY+vkp9iEY /eairnx9g+Za8ayQv9n7Ut1880WHQMmaH0Wvomwv0TfLSCAHE+MqnufoYAJXSVxkX5uS hyJE6l1JvHxk9NGdiFZJ2A9cNDvc6eaEpZg5l01D4z3pULFyRbvYcdYTCTFYQiHJ0e40 NezLQ83l739+4YnlGBcbN43BfNrLmpoWRNeRh/T4yKGCSeVXExOh34TGVoDImOXypIpu Y6VEYLa0Gqsg7dCAinEp1koN5oXIuGC40Nd9y8z7Pip4GM91e/3SZ0zojiXwdn+S7IJ+ Lw2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2mr4o0ih; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n15-20020a5099cf000000b00411809c7a64si6420721edb.188.2022.02.28.03.52.19; Mon, 28 Feb 2022 03:52:41 -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=@linuxfoundation.org header.s=korg header.b=2mr4o0ih; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234452AbiB1Kvu (ORCPT + 99 others); Mon, 28 Feb 2022 05:51:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235007AbiB1Kv0 (ORCPT ); Mon, 28 Feb 2022 05:51:26 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07B7063BCE; Mon, 28 Feb 2022 02:50:47 -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 8665F60B14; Mon, 28 Feb 2022 10:50:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83EF1C340E7; Mon, 28 Feb 2022 10:50:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646045447; bh=RGxEAwdzbR9egvtFInpa3m0a3G+1maC22+8uUJecp+k=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=2mr4o0ihvx67u6tNw0ZQeK8ySDxIIZCnqC4Ex4voBp9cJOAwzLtVgodPoUWwqQh6K Pq2Eo6lAjCsN1L0eP39op+X0xNeqTqIOQPRIGAml0Xcl7auXm21Ibxjj/AduI8S862 87O8cic3X/60Za8DC5rd0XOSXhsp77pYqumwDpDM= Date: Mon, 28 Feb 2022 11:50:43 +0100 From: Greg KH To: Arnd Bergmann Cc: linux-kbuild@vger.kernel.org, Arnd Bergmann , Linus Torvalds , Masahiro Yamada , llvm@lists.linux.dev, Jonathan Corbet , Federico Vaga , Alex Shi , Hu Haowen , Michal Marek , Nick Desaulniers , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc-tw-discuss@lists.sourceforge.net, linux-arm-kernel@lists.infradead.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, greybus-dev@lists.linaro.org, linux-staging@lists.linux.dev, linux-btrfs@vger.kernel.org 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: <20220228103142.3301082-1-arnd@kernel.org> 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 11:27:43AM +0100, Arnd Bergmann wrote: > From: Arnd Bergmann > > During a patch discussion, Linus brought up the option of changing > the C standard version from gnu89 to gnu99, which allows using variable > declaration inside of a for() loop. While the C99, C11 and later standards > introduce many other features, most of these are already available in > gnu89 as GNU extensions as well. > > An earlier attempt to do this when gcc-5 started defaulting to > -std=gnu11 failed because at the time that caused warnings about > designated initializers with older compilers. Now that gcc-5.1 is the > minimum compiler version used for building kernels, that is no longer a > concern. Similarly, the behavior of 'inline' functions changes between > gnu89 and gnu11, but this was taken care of by defining 'inline' to > include __attribute__((gnu_inline)) in order to allow building with > clang a while ago. > > One minor issue that remains is an added gcc warning for shifts of > negative integers when building with -Werror, which happens with the > 'make W=1' option, as well as for three drivers in the kernel that always > enable -Werror, but it was only observed with the i915 driver so far. > To be on the safe side, add -Wno-shift-negative-value to any -Wextra > in a Makefile. > > Nathan Chancellor reported an additional -Wdeclaration-after-statement > warning that appears in a system header on arm, this still needs a > workaround. > > 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 > --- > [v2] > - added -std=gnu11 back, rather than just relying on the default > - minor changes to changelog text > --- > Documentation/process/programming-language.rst | 4 ++-- > .../translations/it_IT/process/programming-language.rst | 4 ++-- > .../translations/zh_CN/process/programming-language.rst | 4 ++-- > .../translations/zh_TW/process/programming-language.rst | 4 ++-- > Makefile | 6 +++--- > arch/arm64/kernel/vdso32/Makefile | 2 +- > drivers/gpu/drm/i915/Makefile | 1 + > drivers/staging/greybus/tools/Makefile | 3 ++- > fs/btrfs/Makefile | 1 + > scripts/Makefile.extrawarn | 1 + > 10 files changed, 17 insertions(+), 13 deletions(-) For the greybus tools section: Reviewed-by: Greg Kroah-Hartman