Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp2275364pxm; Sun, 27 Feb 2022 16:47:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJw9JxuKSXoRPG8kATkUbzEpO5vBFyGrRMXAbdrkJjLsqVnDkIZetjEKBdfa1TGFn5/sQCDj X-Received: by 2002:a17:90a:fe86:b0:1bc:6935:346 with SMTP id co6-20020a17090afe8600b001bc69350346mr14346099pjb.150.1646009243946; Sun, 27 Feb 2022 16:47:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646009243; cv=none; d=google.com; s=arc-20160816; b=hqryQHIlSCX952C3e3khCRdTsf6Mkjk29oHKflmUGc59zZv+rRyISOU6GXSj0GfuuH h8Aawbu1nWjEemJ0+clxCMiqVq23M4udKVqthCMA0q8npXdUVBccLqU4i3pBMP0CxrJo maTEQ/laXtd9bqG0vUV8WMEPiF4h5e/epsjfQujqq7A8YwFzH0Fwa2VHmKuvk8B/Ra1L QNKlr0+4ZV4dqY3S5Kpu/+0WZjhWKTS/lv6YC/jAIBOBCh73LZY/DRkbYYHhc5ULX+Wq TFYsy2+0wFewFcP23/7nBSE65IWa58Tl8QkIhZUCqa20KI/WJHyAz9Yt8YBY32hC7NEr 9wiA== 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; bh=q8l4d/g0eKsVGAXwcSHou4m9texHyFwjSyXWV84L8X0=; b=duJreTccSdIi41931HV5HEstW5udaOoWVoMLSGGaiyuaTRtYMysOdAVQx8OtVd+7P2 v2edlmiXHli4MFgPGNl+AeXoBt7wW546gmqKXK5HODPelYSGxtNX4GBrRBp1Cq9xVRyL wHsTybIaEEA2jpDyvuzDdUeb4OiUGW2tzxNTRatBkRo/EgQMi66e1UJWwAssPBrjnrPC wvjNdt7hYdY/su+PfEwCIdg9SEw+kRxpqVtBOTMCn40y7LEhmozRzQypmLMsPif4NyCQ 8hoLsyIAREjnl1YceQMaBaMYpdARwaSk7ozhte+YhU1VUrFYt4ARP2+elc90CGJmvjwy nGvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=aS+Cuu53; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c23-20020a170902b69700b0014fd0d571e3si7322174pls.510.2022.02.27.16.47.08; Sun, 27 Feb 2022 16:47:23 -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=@linux-foundation.org header.s=google header.b=aS+Cuu53; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232088AbiB0Wn6 (ORCPT + 99 others); Sun, 27 Feb 2022 17:43:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229486AbiB0Wn5 (ORCPT ); Sun, 27 Feb 2022 17:43:57 -0500 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2873D3EB9F for ; Sun, 27 Feb 2022 14:43:19 -0800 (PST) Received: by mail-ed1-x52f.google.com with SMTP id bq11so15090073edb.2 for ; Sun, 27 Feb 2022 14:43:19 -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=tKVf3dM3wxXxe3e/nq33SWVMqbT7ZfAGMbMtgJt4btIN7NKCVsHTi8AgG0sTbCTiKK OVH4l8JLtVFqhf85S5B1YPJAaarvcQHh7dQO5Rl3q9ZE9+rnZXGxClAzbVlcQWg4+u3F l0Yd5B97QMPaoOIPuqvl/nLA3PYSOp2RVtpz1YSYwfmFY3cXWmopZM1nwU2MMfCRgAw+ 0lpDbz8Ir5tQAAtpjTwB3LNONkINSfSQqEYmNU9S+fG8s0FRXVXhVUyzUVBNaRNFD5Kv J5oSRABQgEn37Nv8cBN0RkBF14CmGKuqZQXjRGgVjOgscTFqn5xQJ6VyZWhqiENykcaS Hvdg== X-Gm-Message-State: AOAM532HgC+PtIev3bwsLz7uTEMaI2umWLq6z+bmdhyVQluHkPZZtG40 T6vRy/xRybPoCgepmQ7lGO8lR9su7VQxyY4NQFM= X-Received: by 2002:a05:6402:d0d:b0:412:d49c:74d3 with SMTP id eb13-20020a0564020d0d00b00412d49c74d3mr16731948edb.207.1646001797509; Sun, 27 Feb 2022 14:43:17 -0800 (PST) Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com. [209.85.221.44]) by smtp.gmail.com with ESMTPSA id h30-20020a056402095e00b00412b81dd96esm5169747edz.29.2022.02.27.14.43.17 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 27 Feb 2022 14:43:17 -0800 (PST) Received: by mail-wr1-f44.google.com with SMTP id d3so12722168wrf.1 for ; Sun, 27 Feb 2022 14:43:17 -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 Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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 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