From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2EB332F2F for ; Sun, 27 Feb 2022 22:41:33 +0000 (UTC) Received: by mail-ej1-f44.google.com with SMTP id gb39so21334299ejc.1 for ; Sun, 27 Feb 2022 14:41:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=q8l4d/g0eKsVGAXwcSHou4m9texHyFwjSyXWV84L8X0=; b=aS+Cuu53E5xh6ezL4BQQcygkZ7taEG098ncxgu4s2QZu+Pf48uAsX8EMwnsNmZzs5O eo+kkcQwg/L9tnVyFaERl40XHOJRfEwQ+3p4bNjtTIEqFgNZTrhkUr5c7jHIQo0R2QlD 6Z3HbL6vTEGo3aFlsNtdBL0CtUa6ZZQikH6w4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=q8l4d/g0eKsVGAXwcSHou4m9texHyFwjSyXWV84L8X0=; b=3ml17oHKzRWARCt2lCrYVpqU2lgGWPvmUU0vQNteduGQVo9rj5fQ9SZSciUli3BRjQ VRWrIlGmw0eAy+5W9XIfyuSNRso9xcXlMoX9ltYIgnC8eJvP2FHRSZxBfFIqWpJYTg8M myFfBCi2KOs76PmPgg7N8P7KoInvRMrTnjRPP+pItHxO728vCkVladPO+8ZbH5lVIoTE MxiV/4sHm0eeCePGPgca4fl3SIMVL65nNBgQCgM0mxLBY0+8RUVskAJKEZOn0hRGT2pV hFqTvBgSxCgN4JE46hRqZ+07yfeN/6Ueh3r1GKtICLA9hszZZko83M+GbHrrNtgChSdq jRGw== X-Gm-Message-State: AOAM533+8ytsHncrrJlHyzOSMBOAzd6bZrR/lELZ9SNSAT1+/YKzEYcP ZiNBhgi5ZoSuxYc3hgpOAZQt1JNB+ZlZpLsWLg0= X-Google-Smtp-Source: ABdhPJy8hykp0hMV8u7Stwx9yg9QtMcxod5iz4JkT8pl7rWRx/ryCxp+QBJ0ZBcQU5TFRLSsHoX/VA== X-Received: by 2002:a17:906:b201:b0:6b5:58c8:e43c with SMTP id p1-20020a170906b20100b006b558c8e43cmr12876306ejz.441.1646001691138; Sun, 27 Feb 2022 14:41:31 -0800 (PST) Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com. [209.85.218.54]) by smtp.gmail.com with ESMTPSA id b6-20020a50e386000000b00410d64cb3e4sm5439098edm.75.2022.02.27.14.41.30 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 27 Feb 2022 14:41:30 -0800 (PST) Received: by mail-ej1-f54.google.com with SMTP id qx21so21247128ejb.13 for ; Sun, 27 Feb 2022 14:41:30 -0800 (PST) X-Received: by 2002:a2e:aaa2:0:b0:244:bf42:3e6e with SMTP id bj34-20020a2eaaa2000000b00244bf423e6emr12796324ljb.176.1646001378532; Sun, 27 Feb 2022 14:36:18 -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: <20220227215408.3180023-1-arnd@kernel.org> From: Linus Torvalds Date: Sun, 27 Feb 2022 14:36:02 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] Kbuild: remove -std=gnu89 from compiler arguments To: Arnd Bergmann 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 1:54 PM Arnd Bergmann wrote: > > Since the differences between gnu99, gnu11 and gnu17 are fairly minimal > and mainly impact warnings at the -Wpedantic level that the kernel > never enables, the easiest way is to just leave out the -std=gnu89 > argument entirely, and rely on the compiler default language setting, > which is gnu11 for gcc-5, and gnu1x/gnu17 for all other supported > versions of gcc or clang. Honestly, I'd rather keep the C version we support as some explicit thing, instead of "whatever the installed compiler is". Not only do I suspect that you can set it in gcc spec files (so the standard version might actually be site-specific, not compiler version specific), but particularly with clang, I'd like that "GNU extensions enabled" to be explicit. Yes, maybe it's the default, but let's make sure. The C version level has traditionally had a lot of odd semantic meaning details - you mention "inline", others have existed. So it's not just the actual new features that some C version implements, it's those kind of "same syntax, different meaning" issues. I really don't think that's something we want in the kernel any more. Been there, done that, and we did the explicit standards level for a reason. It may be true that c99/c11/c17 are all very similar, and don't have those issues. Or maybe they do. 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. 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? Linus Linus 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 F35BAC433EF for ; Sun, 27 Feb 2022 22:36:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4F5A310E117; Sun, 27 Feb 2022 22:36:24 +0000 (UTC) Received: from mail-lj1-x233.google.com (mail-lj1-x233.google.com [IPv6:2a00:1450:4864:20::233]) by gabe.freedesktop.org (Postfix) with ESMTPS id 18BBE10E117 for ; Sun, 27 Feb 2022 22:36:23 +0000 (UTC) Received: by mail-lj1-x233.google.com with SMTP id u11so14987716lju.4 for ; Sun, 27 Feb 2022 14:36:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=q8l4d/g0eKsVGAXwcSHou4m9texHyFwjSyXWV84L8X0=; b=aS+Cuu53E5xh6ezL4BQQcygkZ7taEG098ncxgu4s2QZu+Pf48uAsX8EMwnsNmZzs5O eo+kkcQwg/L9tnVyFaERl40XHOJRfEwQ+3p4bNjtTIEqFgNZTrhkUr5c7jHIQo0R2QlD 6Z3HbL6vTEGo3aFlsNtdBL0CtUa6ZZQikH6w4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=q8l4d/g0eKsVGAXwcSHou4m9texHyFwjSyXWV84L8X0=; b=Rt7Nh0tRgUMeDBN3XHdYjnXo88u+YQZ25oHSDk2v8cSwmlqhE8rxh312j5vV84Eiz3 zRFjNkgYEqC7ZzQqnUAx4uE5mPsXC3aQHqaPjIRmWiZaG7EyEsRWW+UgLU2soKIJO3sI G5tWb8xeDb3o0IOhTyknStJkDS165f2n6ldmnsI3BDks1AFFVcyx8puxe+rUhq8ZOqPx 1LYg2o+1QVPHlmdwX/85hFswjKaxPqFXlNjXhvW3MvH5gIg7BtfPyQ1Yo+W0vYt2pveG 8PsTeFlBF9NuxPc0T65LnTkDBPCbKLFJecu7hWoLoGgXb4eh90y28OSFUpkGFck2zSfR SigA== X-Gm-Message-State: AOAM531GCPJI8hsn0MGQfB1vcEiLfZmb81AGo3lz3XdESJ6gqQDFDPdw y9w7RSB1jjG1izMbz4C/UDSG54BcJo5EmLtbyYM= X-Google-Smtp-Source: ABdhPJy7blV3sstEQr9ZgsE1dtUZjsCpT6/VN/ayi1pP2btcxlujwCa1biq38LjWb2k82X2313G+1w== X-Received: by 2002:a05:651c:1043:b0:23b:9302:7c2b with SMTP id x3-20020a05651c104300b0023b93027c2bmr12306145ljm.302.1646001380794; Sun, 27 Feb 2022 14:36:20 -0800 (PST) Received: from mail-lj1-f179.google.com (mail-lj1-f179.google.com. [209.85.208.179]) by smtp.gmail.com with ESMTPSA id f13-20020a2eb5ad000000b00245516b81a2sm1071945ljn.81.2022.02.27.14.36.18 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 27 Feb 2022 14:36:19 -0800 (PST) Received: by mail-lj1-f179.google.com with SMTP id e8so14997665ljj.2 for ; Sun, 27 Feb 2022 14:36:18 -0800 (PST) X-Received: by 2002:a2e:aaa2:0:b0:244:bf42:3e6e with SMTP id bj34-20020a2eaaa2000000b00244bf423e6emr12796324ljb.176.1646001378532; Sun, 27 Feb 2022 14:36:18 -0800 (PST) MIME-Version: 1.0 References: <20220227215408.3180023-1-arnd@kernel.org> In-Reply-To: <20220227215408.3180023-1-arnd@kernel.org> From: Linus Torvalds Date: Sun, 27 Feb 2022 14:36:02 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] Kbuild: remove -std=gnu89 from compiler arguments To: Arnd Bergmann 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 1:54 PM Arnd Bergmann wrote: > > Since the differences between gnu99, gnu11 and gnu17 are fairly minimal > and mainly impact warnings at the -Wpedantic level that the kernel > never enables, the easiest way is to just leave out the -std=gnu89 > argument entirely, and rely on the compiler default language setting, > which is gnu11 for gcc-5, and gnu1x/gnu17 for all other supported > versions of gcc or clang. Honestly, I'd rather keep the C version we support as some explicit thing, instead of "whatever the installed compiler is". Not only do I suspect that you can set it in gcc spec files (so the standard version might actually be site-specific, not compiler version specific), but particularly with clang, I'd like that "GNU extensions enabled" to be explicit. Yes, maybe it's the default, but let's make sure. The C version level has traditionally had a lot of odd semantic meaning details - you mention "inline", others have existed. So it's not just the actual new features that some C version implements, it's those kind of "same syntax, different meaning" issues. I really don't think that's something we want in the kernel any more. Been there, done that, and we did the explicit standards level for a reason. It may be true that c99/c11/c17 are all very similar, and don't have those issues. Or maybe they do. 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. 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? Linus Linus 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 60885C433F5 for ; Sun, 27 Feb 2022 22:37:59 +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=6Jvk9Fdn9WNVg/gvbbpw7hu18M7NjKcIfsO/1Vu2UuA=; b=wcMuAwdgu0Cj+X E2MzLCPWhW7FDGFjeuyn/AOZnl4n0dNsRvPvzHlo3yTCdkdR6H/EiP8jOHcMUeAZ2HKdqIQT67NkS kl+94/jIZgZyB9bY1TK8QGRf+PDyIjI7KSXbiwylXs1MkvUraC/LAZuEMbUM1JDhxe6VtCBlnueDK twcOS/jWoyZOURV1mfirLn9VU8QEU5ULDq5UoMfVJVMmJ7Fe83aXDTDUOgb6jLkWYpphYKAwGAojR QSdm7rH3BvgMYjjJGR2EPMb0H49SSsPus0pBS7yDau+TFJgmvqRQO77iQqJFTDVyADxo/KT7FybiV vF8q2sniJa1O3GfKSbrA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nOS9Z-00AHgU-9B; Sun, 27 Feb 2022 22:36:33 +0000 Received: from mail-lj1-x234.google.com ([2a00:1450:4864:20::234]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nOS9V-00AHfA-LC for linux-arm-kernel@lists.infradead.org; Sun, 27 Feb 2022 22:36:31 +0000 Received: by mail-lj1-x234.google.com with SMTP id s25so14981586lji.5 for ; Sun, 27 Feb 2022 14:36:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=q8l4d/g0eKsVGAXwcSHou4m9texHyFwjSyXWV84L8X0=; b=aS+Cuu53E5xh6ezL4BQQcygkZ7taEG098ncxgu4s2QZu+Pf48uAsX8EMwnsNmZzs5O eo+kkcQwg/L9tnVyFaERl40XHOJRfEwQ+3p4bNjtTIEqFgNZTrhkUr5c7jHIQo0R2QlD 6Z3HbL6vTEGo3aFlsNtdBL0CtUa6ZZQikH6w4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=q8l4d/g0eKsVGAXwcSHou4m9texHyFwjSyXWV84L8X0=; b=Xs+P0QUsWFCqZZrqsdN9NtfUMW1jRIHFm+PlnXIyhFe88ZND1cWEiXjmzshJnsfZX5 wyt8sF+6cPmMOIhX+RENo0INoqGztV+YCSGSu6oYS/Hd4HexGKO5Ux4HDXZ4SVMNktU8 PRX2IkWOLEyunBEU9xFWvB3tCG1Q0ySwShz/PqxsVO9DpXtnTLqeGltKbdWIm80nq2D3 DzHIbm8GGyTbqdb1s8p+PGnRWqIyRd1DeCZzq5T/w9ifrz9uog/rK9pafnCGxPHqebWy QOu/0MvrCGdwHZusK4BhUjP9siTFYWfK2PC+3vNgFWqDdKXXzMyo9ufVBWNavmGKNIrn 2/Ww== X-Gm-Message-State: AOAM530RkbOIUGEDyZUr7p6BBZUczsySSf9Qz0d2cNzonU8k3wg7ytXm 0y88KkCXb9uRiZ4+n0vqmduVKxXKV+jYRbI2Y5Q= X-Google-Smtp-Source: ABdhPJw0XWgeaExXur3yPNsvQ0UUfo32s/XXtI0B3bkLlJ1bgPVtpP0Z7HZExAdxIsaYEQWkH7/kcQ== X-Received: by 2002:a2e:8198:0:b0:246:e7d:45d2 with SMTP id e24-20020a2e8198000000b002460e7d45d2mr12291048ljg.495.1646001381827; Sun, 27 Feb 2022 14:36:21 -0800 (PST) Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com. [209.85.208.176]) by smtp.gmail.com with ESMTPSA id bf31-20020a2eaa1f000000b0024637000209sm1063174ljb.10.2022.02.27.14.36.18 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 27 Feb 2022 14:36:19 -0800 (PST) Received: by mail-lj1-f176.google.com with SMTP id l12so3099202ljh.12 for ; Sun, 27 Feb 2022 14:36:18 -0800 (PST) X-Received: by 2002:a2e:aaa2:0:b0:244:bf42:3e6e with SMTP id bj34-20020a2eaaa2000000b00244bf423e6emr12796324ljb.176.1646001378532; Sun, 27 Feb 2022 14:36:18 -0800 (PST) MIME-Version: 1.0 References: <20220227215408.3180023-1-arnd@kernel.org> In-Reply-To: <20220227215408.3180023-1-arnd@kernel.org> From: Linus Torvalds Date: Sun, 27 Feb 2022 14:36:02 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] Kbuild: remove -std=gnu89 from compiler arguments To: Arnd Bergmann 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-20220227_143629_707004_F2E9DBD3 X-CRM114-Status: GOOD ( 18.61 ) 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 1:54 PM Arnd Bergmann wrote: > > Since the differences between gnu99, gnu11 and gnu17 are fairly minimal > and mainly impact warnings at the -Wpedantic level that the kernel > never enables, the easiest way is to just leave out the -std=gnu89 > argument entirely, and rely on the compiler default language setting, > which is gnu11 for gcc-5, and gnu1x/gnu17 for all other supported > versions of gcc or clang. Honestly, I'd rather keep the C version we support as some explicit thing, instead of "whatever the installed compiler is". Not only do I suspect that you can set it in gcc spec files (so the standard version might actually be site-specific, not compiler version specific), but particularly with clang, I'd like that "GNU extensions enabled" to be explicit. Yes, maybe it's the default, but let's make sure. The C version level has traditionally had a lot of odd semantic meaning details - you mention "inline", others have existed. So it's not just the actual new features that some C version implements, it's those kind of "same syntax, different meaning" issues. I really don't think that's something we want in the kernel any more. Been there, done that, and we did the explicit standards level for a reason. It may be true that c99/c11/c17 are all very similar, and don't have those issues. Or maybe they do. 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. 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? Linus Linus _______________________________________________ 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 91A84C433F5 for ; Sun, 27 Feb 2022 22:41:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EAC5A10E123; Sun, 27 Feb 2022 22:41:54 +0000 (UTC) Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by gabe.freedesktop.org (Postfix) with ESMTPS id 12C2F10E123 for ; Sun, 27 Feb 2022 22:41:54 +0000 (UTC) Received: by mail-lf1-x12a.google.com with SMTP id b9so18388473lfv.7 for ; Sun, 27 Feb 2022 14:41:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=q8l4d/g0eKsVGAXwcSHou4m9texHyFwjSyXWV84L8X0=; b=aS+Cuu53E5xh6ezL4BQQcygkZ7taEG098ncxgu4s2QZu+Pf48uAsX8EMwnsNmZzs5O eo+kkcQwg/L9tnVyFaERl40XHOJRfEwQ+3p4bNjtTIEqFgNZTrhkUr5c7jHIQo0R2QlD 6Z3HbL6vTEGo3aFlsNtdBL0CtUa6ZZQikH6w4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=q8l4d/g0eKsVGAXwcSHou4m9texHyFwjSyXWV84L8X0=; b=ws7G8WNCZ2kz/FheRY35d6JIZ7DaK5RunHnGdXNAUrofazNxrZ59VIWU2vor/Ke5/X lwUuwZOUM7oz6ITdOOdGUt/IB8XhdvZWAoTsf9bNL4YU2tHqDmiIlxdkXvNaXlmIRoDq ht7CjRLCAypyEDZ8pjXnwdoO2JkL+lXFSHEAzHTXHkubkhOAdwuk0P7jogJj0WOhGbZK UcNeOiGqucCaFZclTUy2v8QB/vCQbrzVtVH8c/yuMkrQ3uIVGMf1u2Fe5txCcAuZOAGV VexdmwabHr54z/eUuCzWRU6Ql9Sul2X5i0CFGcOr9t9+7+vRD3jE940kYnWFjZmD7UzC IB0w== X-Gm-Message-State: AOAM530axpRvccS7+d0/8ybxqGxEb/my0qsJNV9o04LOQN1A4KFWMNe5 YtmewsJNQwWAl+LoX7jnsfgJQ7N3OSs6KKjdHV0= X-Google-Smtp-Source: ABdhPJwdPdn7Xj3xgCcZeEUGX8hIyGzZwI5YGCvaZIXLXP4bVe30bfNhEUgd51qMP30HRG+f2F+ycw== X-Received: by 2002:a19:7611:0:b0:43d:c878:dec with SMTP id c17-20020a197611000000b0043dc8780decmr11031148lff.526.1646001711840; Sun, 27 Feb 2022 14:41:51 -0800 (PST) Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com. [209.85.167.46]) by smtp.gmail.com with ESMTPSA id l16-20020a2ea810000000b00246204d9590sm1050404ljq.28.2022.02.27.14.41.51 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 27 Feb 2022 14:41:51 -0800 (PST) Received: by mail-lf1-f46.google.com with SMTP id i11so18392909lfu.3 for ; Sun, 27 Feb 2022 14:41:51 -0800 (PST) X-Received: by 2002:a2e:aaa2:0:b0:244:bf42:3e6e with SMTP id bj34-20020a2eaaa2000000b00244bf423e6emr12796324ljb.176.1646001378532; Sun, 27 Feb 2022 14:36:18 -0800 (PST) MIME-Version: 1.0 References: <20220227215408.3180023-1-arnd@kernel.org> In-Reply-To: <20220227215408.3180023-1-arnd@kernel.org> From: Linus Torvalds Date: Sun, 27 Feb 2022 14:36:02 -0800 X-Gmail-Original-Message-ID: Message-ID: To: Arnd Bergmann Content-Type: text/plain; charset="UTF-8" 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 1:54 PM Arnd Bergmann wrote: > > Since the differences between gnu99, gnu11 and gnu17 are fairly minimal > and mainly impact warnings at the -Wpedantic level that the kernel > never enables, the easiest way is to just leave out the -std=gnu89 > argument entirely, and rely on the compiler default language setting, > which is gnu11 for gcc-5, and gnu1x/gnu17 for all other supported > versions of gcc or clang. Honestly, I'd rather keep the C version we support as some explicit thing, instead of "whatever the installed compiler is". Not only do I suspect that you can set it in gcc spec files (so the standard version might actually be site-specific, not compiler version specific), but particularly with clang, I'd like that "GNU extensions enabled" to be explicit. Yes, maybe it's the default, but let's make sure. The C version level has traditionally had a lot of odd semantic meaning details - you mention "inline", others have existed. So it's not just the actual new features that some C version implements, it's those kind of "same syntax, different meaning" issues. I really don't think that's something we want in the kernel any more. Been there, done that, and we did the explicit standards level for a reason. It may be true that c99/c11/c17 are all very similar, and don't have those issues. Or maybe they do. 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. 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? Linus Linus