From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B542F320F; Mon, 28 Feb 2022 08:07:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64C19C340F1; Mon, 28 Feb 2022 08:07:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1646035641; bh=ZIThCTjaypYDGsg6PqLBGFPVK72nb1FskfDKUMQoQFo=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=aD1Bq94lyoSrU2rCMMALEIwxpVEUCGPfDF3dSAY04qYShfUHRGnHnfOLK00oUyW0n ZqsMF2iFDnWnNQU4y+SGtYOAu5Ni1fTK3qmdoXezKrSqgWCYwRDMEoKeNDdb+Nkuz3 qCcOiJz8mrsH9PbnU9Uy6ClGyXORbh7pBctQV46m71jB+a9PCxnWvZ62vTMJBnf1Xx q8KNT0ei+VPVQMCRbzemricf9saJwYLDd4YpN1D4EvBQKNGAbl0BWqTlhRM3X0vYXD MHWCP9V/paczpqcSPuXqjoBZyne5r0/hJDs5BnKQTtpBr0XDpT3ldBKKSTwvH5O2Xk UqCo5U8NmR1hw== Received: by mail-wm1-f52.google.com with SMTP id o62-20020a1ca541000000b00380e3cc26b7so5499799wme.0; Mon, 28 Feb 2022 00:07:21 -0800 (PST) X-Gm-Message-State: AOAM5328iderCE26T1ta0GhQtkLo+h//98CVV0BZtvvN2IsrKD7LsrMr 3uhFaYIcFzJWjelveTxs7Gc5UTAaoGrtfBBDj3w= X-Google-Smtp-Source: ABdhPJzpcZ5s+5KOBMUi70sNCMSXIqY3vXEepsFRSDE8fekaJ/SUkhm+3dpDI9J9lgxQZ0OAu6bPJpVx/Y8rip86Cms= X-Received: by 2002:a05:600c:4f8e:b0:381:6de4:fccc with SMTP id n14-20020a05600c4f8e00b003816de4fcccmr1697739wmq.82.1646035639695; Mon, 28 Feb 2022 00:07:19 -0800 (PST) Precedence: bulk X-Mailing-List: linux-staging@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20220227215408.3180023-1-arnd@kernel.org> In-Reply-To: From: Arnd Bergmann Date: Mon, 28 Feb 2022 09:07:03 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] Kbuild: remove -std=gnu89 from compiler arguments To: Linus Torvalds Cc: Linux Kbuild mailing list , Arnd Bergmann , 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-gfx , dri-devel , greybus-dev@lists.linaro.org, linux-staging@lists.linux.dev, linux-btrfs Content-Type: text/plain; charset="UTF-8" On Sun, Feb 27, 2022 at 11:36 PM Linus Torvalds wrote: > > And I don't want somebody with a newer compiler version to not notice > that he or she ended up using a c17 feature, just because _that_ > compiler supported it, and then other people get build errors because > their compilers use gnu11 instead by default. > > Put another way: I see absolutely no upside to allowing different > users using higher/lower versions of the standard. There are only > downsides. > > If gnu11 is supported by gcc-5.1 and up, and all the relevant clang > versions, then let's just pick that. Ok, changed my patch to -gnu11 now. > And if there are any possible future advantages to gnu17 (or eventual > gnu2x versions), let's document those, so that we can say "once our > compiler version requirements go up sufficiently, we'll move to gnuXX > because we want to take advantage of YY". > > Please? I think all of the options here are equally bad: picking gnu11 means we use a non-standard default for anything other than gcc-5 and may get surprised again in the future when we want to change to a newer version; -std=gnu1x would work as an alias for gnu17 in all versions including gcc-5 but is already marked as 'deprecated' in the gcc documentation; and using -std=gnu17 for modern compilers requires a workaround for gcc-7 and earlier. Regarding new features from gcc-2x, I think we already use most of what is listed in https://en.wikipedia.org/wiki/C2x, as those are all GNU extensions that are valid in modern gnu89 as well. Newly added features seem to only depend on the compiler version, e.g. #elifdef works in both clang-13 and gcc-12 with any -std=gnu?? argument, so picking an earlier standard won't stop people from breaking the build with older compilers. Arnd 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 51BEFC433EF for ; Mon, 28 Feb 2022 08:07:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D572010E215; Mon, 28 Feb 2022 08:07:27 +0000 (UTC) Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by gabe.freedesktop.org (Postfix) with ESMTPS id BAB5610E1EA; Mon, 28 Feb 2022 08:07:25 +0000 (UTC) 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 ams.source.kernel.org (Postfix) with ESMTPS id EBC51B80D85; Mon, 28 Feb 2022 08:07:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A549C340FD; Mon, 28 Feb 2022 08:07:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1646035641; bh=ZIThCTjaypYDGsg6PqLBGFPVK72nb1FskfDKUMQoQFo=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=aD1Bq94lyoSrU2rCMMALEIwxpVEUCGPfDF3dSAY04qYShfUHRGnHnfOLK00oUyW0n ZqsMF2iFDnWnNQU4y+SGtYOAu5Ni1fTK3qmdoXezKrSqgWCYwRDMEoKeNDdb+Nkuz3 qCcOiJz8mrsH9PbnU9Uy6ClGyXORbh7pBctQV46m71jB+a9PCxnWvZ62vTMJBnf1Xx q8KNT0ei+VPVQMCRbzemricf9saJwYLDd4YpN1D4EvBQKNGAbl0BWqTlhRM3X0vYXD MHWCP9V/paczpqcSPuXqjoBZyne5r0/hJDs5BnKQTtpBr0XDpT3ldBKKSTwvH5O2Xk UqCo5U8NmR1hw== Received: by mail-wm1-f48.google.com with SMTP id k29-20020a05600c1c9d00b003817fdc0f00so212782wms.4; Mon, 28 Feb 2022 00:07:21 -0800 (PST) X-Gm-Message-State: AOAM533EeU8QDd8/LLZrVeZkeVcbK09ACGVzU26cpUko3eBDKGT4XqOP S4Sc/Sg7epB6TJQMc9QeLnSc/6CxOoa7fOi9kvE= X-Google-Smtp-Source: ABdhPJzpcZ5s+5KOBMUi70sNCMSXIqY3vXEepsFRSDE8fekaJ/SUkhm+3dpDI9J9lgxQZ0OAu6bPJpVx/Y8rip86Cms= X-Received: by 2002:a05:600c:4f8e:b0:381:6de4:fccc with SMTP id n14-20020a05600c4f8e00b003816de4fcccmr1697739wmq.82.1646035639695; Mon, 28 Feb 2022 00:07:19 -0800 (PST) MIME-Version: 1.0 References: <20220227215408.3180023-1-arnd@kernel.org> In-Reply-To: From: Arnd Bergmann Date: Mon, 28 Feb 2022 09:07:03 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] Kbuild: remove -std=gnu89 from compiler arguments To: Linus Torvalds Content-Type: text/plain; charset="UTF-8" X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Linux ARM , Michal Marek , "open list:DOCUMENTATION" , Arnd Bergmann , Jonathan Corbet , linux-staging@lists.linux.dev, Masahiro Yamada , llvm@lists.linux.dev, Nick Desaulniers , Linux Kernel Mailing List , dri-devel , greybus-dev@lists.linaro.org, Alex Shi , Federico Vaga , Hu Haowen , linux-btrfs , intel-gfx , linux-doc-tw-discuss@lists.sourceforge.net, Linux Kbuild mailing list Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Sun, Feb 27, 2022 at 11:36 PM Linus Torvalds wrote: > > And I don't want somebody with a newer compiler version to not notice > that he or she ended up using a c17 feature, just because _that_ > compiler supported it, and then other people get build errors because > their compilers use gnu11 instead by default. > > Put another way: I see absolutely no upside to allowing different > users using higher/lower versions of the standard. There are only > downsides. > > If gnu11 is supported by gcc-5.1 and up, and all the relevant clang > versions, then let's just pick that. Ok, changed my patch to -gnu11 now. > And if there are any possible future advantages to gnu17 (or eventual > gnu2x versions), let's document those, so that we can say "once our > compiler version requirements go up sufficiently, we'll move to gnuXX > because we want to take advantage of YY". > > Please? I think all of the options here are equally bad: picking gnu11 means we use a non-standard default for anything other than gcc-5 and may get surprised again in the future when we want to change to a newer version; -std=gnu1x would work as an alias for gnu17 in all versions including gcc-5 but is already marked as 'deprecated' in the gcc documentation; and using -std=gnu17 for modern compilers requires a workaround for gcc-7 and earlier. Regarding new features from gcc-2x, I think we already use most of what is listed in https://en.wikipedia.org/wiki/C2x, as those are all GNU extensions that are valid in modern gnu89 as well. Newly added features seem to only depend on the compiler version, e.g. #elifdef works in both clang-13 and gcc-12 with any -std=gnu?? argument, so picking an earlier standard won't stop people from breaking the build with older compilers. Arnd 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 E762AC433EF for ; Mon, 28 Feb 2022 08:08:47 +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-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=dMyS5koMKtdAT0UXk9y6CMqjYrHcWl9iXo3SBzxN8No=; b=mo1FBpHvyDJ5kq zqNAKrZwErsH9sFkAzoUd0QSjiHfy5qEKPX0OspGZO/tfLtdPYzKhH/p9zMxZVirJ4lJwK+mIjODA wn1OGLECReb9cY3xc2I6vnHl2bw1pfWYWxPtoIHNguZCb7o/A4NMp2/N86KrSmwMoMQBVv/jP8o/B tuFNn/BUKtv7ztp741awAouoLKMaY2aud2UIOnFYRgvyvt8Sr3GbVLzkdjFsaCRZkiAPLdlJObIyV w+vHlD6S+uidSMz4dIfmO+blQprqwGbPNE0VHZmzUdVlYxqH553xx9+JUEZZoG6Xz+QZIsI9HEqiz 4Od1E6L8Uump5AeC/XvA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nOb42-00B3fK-Kb; Mon, 28 Feb 2022 08:07:26 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nOb3z-00B3eH-5F for linux-arm-kernel@lists.infradead.org; Mon, 28 Feb 2022 08:07:24 +0000 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 8D2CC61128 for ; Mon, 28 Feb 2022 08:07:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75A46C340F6 for ; Mon, 28 Feb 2022 08:07:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1646035641; bh=ZIThCTjaypYDGsg6PqLBGFPVK72nb1FskfDKUMQoQFo=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=aD1Bq94lyoSrU2rCMMALEIwxpVEUCGPfDF3dSAY04qYShfUHRGnHnfOLK00oUyW0n ZqsMF2iFDnWnNQU4y+SGtYOAu5Ni1fTK3qmdoXezKrSqgWCYwRDMEoKeNDdb+Nkuz3 qCcOiJz8mrsH9PbnU9Uy6ClGyXORbh7pBctQV46m71jB+a9PCxnWvZ62vTMJBnf1Xx q8KNT0ei+VPVQMCRbzemricf9saJwYLDd4YpN1D4EvBQKNGAbl0BWqTlhRM3X0vYXD MHWCP9V/paczpqcSPuXqjoBZyne5r0/hJDs5BnKQTtpBr0XDpT3ldBKKSTwvH5O2Xk UqCo5U8NmR1hw== Received: by mail-wm1-f43.google.com with SMTP id y5so5185042wmi.0 for ; Mon, 28 Feb 2022 00:07:21 -0800 (PST) X-Gm-Message-State: AOAM532pTJh5OGTavpfcFjI7w5A+VEFiUcZ4hFHFIxXnfcBfpvrOEtDW 2l5x+66tEB2W9q8L67JIE3cf8RoV8ji6axCn0Bk= X-Google-Smtp-Source: ABdhPJzpcZ5s+5KOBMUi70sNCMSXIqY3vXEepsFRSDE8fekaJ/SUkhm+3dpDI9J9lgxQZ0OAu6bPJpVx/Y8rip86Cms= X-Received: by 2002:a05:600c:4f8e:b0:381:6de4:fccc with SMTP id n14-20020a05600c4f8e00b003816de4fcccmr1697739wmq.82.1646035639695; Mon, 28 Feb 2022 00:07:19 -0800 (PST) MIME-Version: 1.0 References: <20220227215408.3180023-1-arnd@kernel.org> In-Reply-To: From: Arnd Bergmann Date: Mon, 28 Feb 2022 09:07:03 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] Kbuild: remove -std=gnu89 from compiler arguments To: Linus Torvalds Cc: Linux Kbuild mailing list , Arnd Bergmann , 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-gfx , dri-devel , greybus-dev@lists.linaro.org, linux-staging@lists.linux.dev, linux-btrfs X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220228_000723_299766_CFE0289E X-CRM114-Status: GOOD ( 21.57 ) 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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Sun, Feb 27, 2022 at 11:36 PM Linus Torvalds wrote: > > And I don't want somebody with a newer compiler version to not notice > that he or she ended up using a c17 feature, just because _that_ > compiler supported it, and then other people get build errors because > their compilers use gnu11 instead by default. > > Put another way: I see absolutely no upside to allowing different > users using higher/lower versions of the standard. There are only > downsides. > > If gnu11 is supported by gcc-5.1 and up, and all the relevant clang > versions, then let's just pick that. Ok, changed my patch to -gnu11 now. > And if there are any possible future advantages to gnu17 (or eventual > gnu2x versions), let's document those, so that we can say "once our > compiler version requirements go up sufficiently, we'll move to gnuXX > because we want to take advantage of YY". > > Please? I think all of the options here are equally bad: picking gnu11 means we use a non-standard default for anything other than gcc-5 and may get surprised again in the future when we want to change to a newer version; -std=gnu1x would work as an alias for gnu17 in all versions including gcc-5 but is already marked as 'deprecated' in the gcc documentation; and using -std=gnu17 for modern compilers requires a workaround for gcc-7 and earlier. Regarding new features from gcc-2x, I think we already use most of what is listed in https://en.wikipedia.org/wiki/C2x, as those are all GNU extensions that are valid in modern gnu89 as well. Newly added features seem to only depend on the compiler version, e.g. #elifdef works in both clang-13 and gcc-12 with any -std=gnu?? argument, so picking an earlier standard won't stop people from breaking the build with older compilers. Arnd _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 AB512C433F5 for ; Mon, 28 Feb 2022 14:26:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 307E810E61A; Mon, 28 Feb 2022 14:26:06 +0000 (UTC) Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by gabe.freedesktop.org (Postfix) with ESMTPS id BAB5610E1EA; Mon, 28 Feb 2022 08:07:25 +0000 (UTC) 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 ams.source.kernel.org (Postfix) with ESMTPS id EBC51B80D85; Mon, 28 Feb 2022 08:07:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A549C340FD; Mon, 28 Feb 2022 08:07:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1646035641; bh=ZIThCTjaypYDGsg6PqLBGFPVK72nb1FskfDKUMQoQFo=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=aD1Bq94lyoSrU2rCMMALEIwxpVEUCGPfDF3dSAY04qYShfUHRGnHnfOLK00oUyW0n ZqsMF2iFDnWnNQU4y+SGtYOAu5Ni1fTK3qmdoXezKrSqgWCYwRDMEoKeNDdb+Nkuz3 qCcOiJz8mrsH9PbnU9Uy6ClGyXORbh7pBctQV46m71jB+a9PCxnWvZ62vTMJBnf1Xx q8KNT0ei+VPVQMCRbzemricf9saJwYLDd4YpN1D4EvBQKNGAbl0BWqTlhRM3X0vYXD MHWCP9V/paczpqcSPuXqjoBZyne5r0/hJDs5BnKQTtpBr0XDpT3ldBKKSTwvH5O2Xk UqCo5U8NmR1hw== Received: by mail-wm1-f48.google.com with SMTP id k29-20020a05600c1c9d00b003817fdc0f00so212782wms.4; Mon, 28 Feb 2022 00:07:21 -0800 (PST) X-Gm-Message-State: AOAM533EeU8QDd8/LLZrVeZkeVcbK09ACGVzU26cpUko3eBDKGT4XqOP S4Sc/Sg7epB6TJQMc9QeLnSc/6CxOoa7fOi9kvE= X-Google-Smtp-Source: ABdhPJzpcZ5s+5KOBMUi70sNCMSXIqY3vXEepsFRSDE8fekaJ/SUkhm+3dpDI9J9lgxQZ0OAu6bPJpVx/Y8rip86Cms= X-Received: by 2002:a05:600c:4f8e:b0:381:6de4:fccc with SMTP id n14-20020a05600c4f8e00b003816de4fcccmr1697739wmq.82.1646035639695; Mon, 28 Feb 2022 00:07:19 -0800 (PST) MIME-Version: 1.0 References: <20220227215408.3180023-1-arnd@kernel.org> In-Reply-To: From: Arnd Bergmann Date: Mon, 28 Feb 2022 09:07:03 +0100 X-Gmail-Original-Message-ID: Message-ID: To: Linus Torvalds Content-Type: text/plain; charset="UTF-8" X-Mailman-Approved-At: Mon, 28 Feb 2022 14:26:05 +0000 Subject: Re: [Intel-gfx] [PATCH] Kbuild: remove -std=gnu89 from compiler arguments X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Linux ARM , Michal Marek , "open list:DOCUMENTATION" , Arnd Bergmann , Jonathan Corbet , linux-staging@lists.linux.dev, Masahiro Yamada , llvm@lists.linux.dev, Nick Desaulniers , Linux Kernel Mailing List , dri-devel , greybus-dev@lists.linaro.org, Alex Shi , Federico Vaga , Hu Haowen , linux-btrfs , intel-gfx , linux-doc-tw-discuss@lists.sourceforge.net, Linux Kbuild mailing list Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On Sun, Feb 27, 2022 at 11:36 PM Linus Torvalds wrote: > > And I don't want somebody with a newer compiler version to not notice > that he or she ended up using a c17 feature, just because _that_ > compiler supported it, and then other people get build errors because > their compilers use gnu11 instead by default. > > Put another way: I see absolutely no upside to allowing different > users using higher/lower versions of the standard. There are only > downsides. > > If gnu11 is supported by gcc-5.1 and up, and all the relevant clang > versions, then let's just pick that. Ok, changed my patch to -gnu11 now. > And if there are any possible future advantages to gnu17 (or eventual > gnu2x versions), let's document those, so that we can say "once our > compiler version requirements go up sufficiently, we'll move to gnuXX > because we want to take advantage of YY". > > Please? I think all of the options here are equally bad: picking gnu11 means we use a non-standard default for anything other than gcc-5 and may get surprised again in the future when we want to change to a newer version; -std=gnu1x would work as an alias for gnu17 in all versions including gcc-5 but is already marked as 'deprecated' in the gcc documentation; and using -std=gnu17 for modern compilers requires a workaround for gcc-7 and earlier. Regarding new features from gcc-2x, I think we already use most of what is listed in https://en.wikipedia.org/wiki/C2x, as those are all GNU extensions that are valid in modern gnu89 as well. Newly added features seem to only depend on the compiler version, e.g. #elifdef works in both clang-13 and gcc-12 with any -std=gnu?? argument, so picking an earlier standard won't stop people from breaking the build with older compilers. Arnd