Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp2976596pxm; Mon, 28 Feb 2022 09:34:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJww4EoMY0vPYFR0NiTc5VcfRWL5Hio9CxHUTPOTRsaPE+t4ZQBAp2ukukizr6VBsZyRXgpn X-Received: by 2002:a17:907:3347:b0:6ce:6bc4:d18a with SMTP id yr7-20020a170907334700b006ce6bc4d18amr15575400ejb.612.1646069676903; Mon, 28 Feb 2022 09:34:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646069676; cv=none; d=google.com; s=arc-20160816; b=NFlp31PnzwZJQgNRRlP9gKFQ4JvZ5xfMo7+/9zejUCSzVqHbwhibMMqAdORzoZI5Lq 8QoMmEx6gW4ISS9JwfjvrR53Gfu3XMRP4B+FO6e65Qy6TDMaE+D5lxSnr8gXzdL/nVzv PP3yaIknLgjqIXr20peA/Q1xnfc6T3j+oQrlXUbHvuz9OjcOKOku76uHV/GyPDxDIGU2 jhsN20dsDImjRqq6RWan49xWfY0Kr7HJRhB5ud6VXOptP9jPIZwqeJrHPPMmXBBIys1Z CEBI40g9zLaNmi9nq+pIFqgWUOeBeoVRMNFrlwGe52HOuuwsI7EscF6A+/npbBhRZp84 1uiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature:dkim-filter; bh=98mZh3DSkLLdEUaUpwDchiQq5D3wILeXQhtbg+uZ5C0=; b=lLk0JdpHDGREIFdQhfdjRNv60hLUOWAHdiVtXy1BwfitGkiQtGw6ALnFF5Hl9yPSd7 dTeGpBvAe258s9GFU2A5PI/aa9EFaFRLbIy9aqgdebXJ9p+lsYo01y0kleqSPW9p9JUd 9RTCVXovt38+Xvs4aTEQTbrqD7Xg3cIimohvcjv+62kdngYI+KC4EPaOBmpxe7RrTXHY mrdHJRN/40qbFHmLXEsEcCh5vXiXNrVVDjeZB96E/nchOb68UHe3E9Rk5YLlWYYB8w/Q /g2b83MEwoXmstzgSfs4Pgj2U8f3mxVnhw8nDNqJOlZOPkKGcMLC72ZcMypkr3VW+Qf3 UFiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=D7+3GydI; 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 r11-20020aa7cfcb000000b00410b84562b9si6680539edy.624.2022.02.28.09.34.14; Mon, 28 Feb 2022 09:34:36 -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=@nifty.com header.s=dec2015msa header.b=D7+3GydI; 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 S237695AbiB1RIt (ORCPT + 99 others); Mon, 28 Feb 2022 12:08:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235657AbiB1RIs (ORCPT ); Mon, 28 Feb 2022 12:08:48 -0500 X-Greylist: delayed 240 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 28 Feb 2022 09:08:06 PST Received: from conssluserg-04.nifty.com (conssluserg-04.nifty.com [210.131.2.83]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A758533E12; Mon, 28 Feb 2022 09:08:05 -0800 (PST) Received: from mail-pg1-f171.google.com (mail-pg1-f171.google.com [209.85.215.171]) (authenticated) by conssluserg-04.nifty.com with ESMTP id 21SH7qjg001599; Tue, 1 Mar 2022 02:07:52 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-04.nifty.com 21SH7qjg001599 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1646068072; bh=98mZh3DSkLLdEUaUpwDchiQq5D3wILeXQhtbg+uZ5C0=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=D7+3GydIml5G5ULFdTIEOoeqAwyMiUllHF3GnHTuWW10nvZHqUydYyT+Jh/PjJc0C 9dGdscCwyV7M2qIK+TzlPN1lAgIFyW+LG8jTroxw3JcjB6xKD7AirJYq0hUGTm8FH0 G+ADSE21IaerZgVAUzhrazbpc1LG5nCdoDPIyOH+HiPFxvUV/fpB4XJyJl5QpYMKTS 4ZTfUYOn5AT4FiPGSuUklu/G/I3NUW/sdn3Ghx5EQK34yrsnKdstPivvN6BQ2Vg4IY ckEBCcFgDL3VltZ5/Wnp4REwrg9Mbqj+hvGqQh0dDV6gu6iHvDuGU/mp/Vm9sD7zLJ M5BfVt3YSVuhQ== X-Nifty-SrcIP: [209.85.215.171] Received: by mail-pg1-f171.google.com with SMTP id bc27so3199726pgb.4; Mon, 28 Feb 2022 09:07:52 -0800 (PST) X-Gm-Message-State: AOAM533ZQQRv9BZdlSf1H6fD9183Jw+blY7bLetooRw1g+AKcoSk6sxc xqUAdO8d0vJTNfQ7K1s2koHl/S6hFhx4aqW5jdo= X-Received: by 2002:a63:e758:0:b0:378:8511:cfe7 with SMTP id j24-20020a63e758000000b003788511cfe7mr7050358pgk.126.1646068071650; Mon, 28 Feb 2022 09:07:51 -0800 (PST) MIME-Version: 1.0 References: <20220228103142.3301082-1-arnd@kernel.org> In-Reply-To: From: Masahiro Yamada Date: Tue, 1 Mar 2022 02:07:08 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] [v2] Kbuild: move to -std=gnu11 To: Mark Rutland Cc: Arnd Bergmann , Linux Kbuild mailing list , Arnd Bergmann , Linus Torvalds , 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-kernel , intel-gfx , dri-devel , greybus-dev@lists.linaro.org, linux-staging@lists.linux.dev, linux-btrfs@vger.kernel.org, Marco Elver Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_SOFTFAIL, T_SCC_BODY_TEXT_LINE autolearn=no 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 8:25 PM Mark Rutland wrote: > > Hi Arnd, > > This is great! > > 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. > > FWIW, I had a go at moving to c99 a few weeks ago (to be able to use > for-loop-declarations in some concurrency primitives), and when I tried, I also > saw declaration-after-statement warnings when building modpost.c, which is easy > enough to fix: > > https://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git/commit/?h=treewide/gnu99&id=505775bd6fd0bc1883f3271f826963066bbdc194 > I do not understand this statement: "Usually such warnings are implciitly enabled as part of `-std=gnu89`, and in preparation for changing the standard used, this patch explciitly enales the warnings with `-Wdeclaration-after-statement`, which takes effect regardless of which version of the C standard is in use." modpost is already built with -std=gnu89. If Wdeclaration-after-statement is implied by gnu89, why did nobody notice this before? -- Best Regards Masahiro Yamada