From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 71CF3C433F5 for ; Mon, 28 Feb 2022 21:43:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=/FqhjgSDUPByd47UPPbEjSGJnQAPvbXNWr5DMTfmnZc=; b=oIGWBxYnpgmmS/jun9QCyQ9Cci agqBTzSFuuFxzhbk4OkudwFu/GGCV9KGWrOppG+JRBoCcy81jacaqy0pVF4rybfu6D8aJJLxKqUuP n5IdHhJoMtLj1a7bGkQh3OORnuaq4H/ofmxH5J1G0H0zyEEDDC5MuiHiOhB1CLOBEn+OQ6C/VdCRV OYn9f2o4FTb3LlFctAd9coxNqX6XQAQ2bWoWmyMt7rz8vcXVmDbXb/6kbanJ46DIV08bjh/uwEwcA CoAobQXjocOmtP2jD87/SXcgFlzVZdO+qLW1yAYApWlcoQbM7lcVHnknX5BgvkRhNnxeP1K9hZvTs Lbinv78g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nOnmJ-00ECj3-Km; Mon, 28 Feb 2022 21:42:00 +0000 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nOnmF-00ECfR-0b for linux-arm-kernel@lists.infradead.org; Mon, 28 Feb 2022 21:41:57 +0000 Received: by mail-pf1-x42f.google.com with SMTP id k1so1745853pfu.2 for ; Mon, 28 Feb 2022 13:41:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=SDEQwyNhO1YP2PlPCVZv2QT+trnELH3tuuISdUJhH/A=; b=d9xMn/X4LpBqF7CCmU2zh6/QLyVNBTRuNZU+e7jV9ejFO0/bkIPnXV0yhaKjw6dJm8 FJS3J2mi6lbO85oN/dNF+rqWxtAJUijNlNeALlXJL+eaCxB0tcq950US1kKVvr8mqukF e0ToSOH4Si3JfzpFzCogjXNl1DMde6d8MLn9SuHccOTRwzid1E81/cSQ/4tTUtiOrMCh 9TojhlCRrVYJxHlgtGOmRoGhypN9RiWcKC8aFAkMrBK4RGw8XoilLoTMd70dGA9hdZYh n+kv4MVL49Db4WfNBmaeThQEFLAURei7cyQEoj8G+S/4PT3zkCcTFjR/aTe5mw8oJWud 4tvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=SDEQwyNhO1YP2PlPCVZv2QT+trnELH3tuuISdUJhH/A=; b=zgRwj63kpHuY9gntDgIYvzzzWmAL3A5RA9qYJZMg88asPEfThEVgWjeX70U5BDyZG1 Np+Gu0wAeYr1DfHekh9KiZirpYA8s5pIqyRkoHpmk3k3EznoDpQ3g02+sIn4SDJ/ZLI8 fT/mYsUkRqwdj3rwR6JHI9FrMPYAgMwP6jaNY5O6EsGlBl/w1Z3WxzeNplAOEjsWdcIW 4yH+zAicYZ6BRWahNbcbk6skhfH6gl5pTVokSK+vwbhZLgVXerZ0+3PVaXky/KPIGe+S M5RjzCm00OvxkXLZmMyLsSMpaF89iIFY9kYhlKy5RUS9I68IhPQX+WlMcqIiGVbDIVAY +hyw== X-Gm-Message-State: AOAM531kJskYQMkejDphtzXSiG+ehurDMrKDIXjhifDYzHs4lDeL8f99 euO+yQjNuWqS6FwsCoXvvrwrOw== X-Google-Smtp-Source: ABdhPJysQYIb7FAhRgqLT3HifNDIOw9MY3JP0SvCbCIF1CiA1nyX5JMrxTKRUKNjLMnj4tBxx48g9A== X-Received: by 2002:a05:6a00:26e0:b0:4e1:7131:de2b with SMTP id p32-20020a056a0026e000b004e17131de2bmr23819114pfw.20.1646084510471; Mon, 28 Feb 2022 13:41:50 -0800 (PST) Received: from google.com ([2620:15c:2ce:200:777f:ae46:e31e:b07e]) by smtp.gmail.com with ESMTPSA id 23-20020a17090a0b9700b001b8f602eaeasm259006pjr.53.2022.02.28.13.41.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Feb 2022 13:41:50 -0800 (PST) Date: Mon, 28 Feb 2022 13:41:45 -0800 From: Fangrui Song To: Nick Desaulniers Cc: Arnd Bergmann , 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 , 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: <20220228214145.o37bgp3zl3rxpeo4@google.com> References: <20220228103142.3301082-1-arnd@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220228_134155_081321_9EB2189D X-CRM114-Status: GOOD ( 25.02 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Thanks for the patch! (Was always wondering which of binutils and kernel would migrate to C99+ earlier... binutils won) On 2022-02-28, Nick Desaulniers wrote: >On Mon, Feb 28, 2022 at 2:32 AM 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 > >More precisely, the semantics of "extern inline" functions changed >between ISO C90 and ISO C99. Perhaps a clearer explanation to readers is: "extern inline" and "inline" swap semantics with gnu_inline (-fgnu89-inline or __attribute__((__gnu_inline__))). >That's the only concern I have, which I doubt is an issue. The kernel >is already covered by the function attribute as you note. > >Just to have some measure: >$ git grep -rn "extern inline" | wc -l >116 "^inline" behaves like C99+ "extern inline" Agree this is handled by #define inline inline __gnu_inline __inline_maybe_unused notrace >Most of those are in arch/alpha/ which is curious; I wonder if those >were intentional. > >(I do worry about Makefiles that completely reset KBUILD_CFLAGS >though; the function attributes still take precedence). > >> 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. > >Ack; I think we can just fix this in clang. > >> >> 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. > >I agree. With the fixup to s/Werror/Wextra. > >Reviewed-by: Nick Desaulniers > >> >> 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 > >-- >Thanks, >~Nick Desaulniers > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel