Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp3154034pxm; Mon, 28 Feb 2022 13:13:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJyac0Ri4dkETcxfLWR+pJBYQPz1Ct3piI+n7tXjGLiQWXQDIKwR/AA5RAM0EeYkK3XWCK0Q X-Received: by 2002:a05:6402:27cb:b0:412:124:e0db with SMTP id c11-20020a05640227cb00b004120124e0dbmr21551415ede.72.1646082829235; Mon, 28 Feb 2022 13:13:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646082829; cv=none; d=google.com; s=arc-20160816; b=TtdXPvKk2lz8dHE8bOSmICymHNnxsRPpYqZKOtBMuZ3UvxUejhGN0YuQ8fKmdVv6Ck VuTyfD3uQisyLYeLkuFDh0LGgwVWSOLvtA4TMb2qDcPvOnuurBcwrdUgqdCOhFpIVDPi LufUKcaaKt7nP1pwUE/DuZqRvuz5UxnvyL1Jckp6624emjyzPRiwSFy5iRuPSKadG0al LIfGagvFYGhdOnQT4zkv2Xe0kT5bVZwXsz1bRNEKxbvUVQG8QM72rOTsf4WN2LHnZ8rL rLwXfc7kClJ4v5Kb2WZZjt5+OS+npXOmMr4Bd4UdA5QtRceo3dHLnkYa5q/c6VPAZ739 F0mQ== 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=iiqNCFc6U32ONzTNhKfvxI6B2p9x39AVrXt2rLta2M8=; b=nu+z73BrP6BYGex3tq+/Hskc6o9moc7LR6aETxEcPMpR3t3xCuIhEUw90iM7acPOdP 2brZ+q+S0k4otNbarXDs6LvawL0BOkwZa+PXe+9wJrg5jhZaxlZBkLrMA7USe04CXNZY P0E/XpSTrc4XvDk2LymySEJpAFiUYuRWoBukbxoyxwUx5z2JkeScLT8HgTvN/Ow8vCxx uF1VGCH0drKyzylHoiRUkUTQ31lNXj4toHQsie+Il2VT9EVhaLV0LI+OScjIgy+kXjDl gLZOLmXZdBhU2MEsMO6Hr5EegN+u+WQzfW/JfKBEL+zU+2i2DaDM6QUTnTEt70942o4r Vzvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=W1quCfVq; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s4-20020a1709062ec400b006ab8590c1e1si6409338eji.33.2022.02.28.13.13.22; Mon, 28 Feb 2022 13:13:49 -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=@google.com header.s=20210112 header.b=W1quCfVq; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230027AbiB1VEn (ORCPT + 99 others); Mon, 28 Feb 2022 16:04:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229838AbiB1VEi (ORCPT ); Mon, 28 Feb 2022 16:04:38 -0500 Received: from mail-lj1-x234.google.com (mail-lj1-x234.google.com [IPv6:2a00:1450:4864:20::234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 864F81A801 for ; Mon, 28 Feb 2022 13:03:58 -0800 (PST) Received: by mail-lj1-x234.google.com with SMTP id bn33so19188115ljb.6 for ; Mon, 28 Feb 2022 13:03:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=iiqNCFc6U32ONzTNhKfvxI6B2p9x39AVrXt2rLta2M8=; b=W1quCfVq9oQhkjVMSeWaW2Z55DxdyDGbetnmG15rPiQ3v4OpkSJBRZVXEMnaa2odqg QOxU/DybvDsA1JnfyM0Ii4qw3F6xR+UbY0dAPPGiPqs4IHrP1aOpkQPW6UBPfhHTs8Tm PR7CBwZgGDqGkw8bM51JgA90FDhHoPP/FDNizSDpxNc9PDO+WtRrOnLiA4YcU9jxsmrw z0maaOELQKiR1hC/GWCjcXmHCEwCPjiDrVGmn41QSQ89BJlDlTrXtLJTHpab0xmVnH4M sZrukyP266PjsJuciZ6D4hmibJchflD3xDwtX05kLpAsnblhXyGN7U6wiOr/bpk5iv1a EfsA== 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=iiqNCFc6U32ONzTNhKfvxI6B2p9x39AVrXt2rLta2M8=; b=wfsgANdseWy+aGWAzP6PuPWOozN5/GZQEMBwCAqrgxvIkjG2by6ahQy6Y9RLmdqy7k yGG4k77r2YR9mLbOASWUkeHsBR00XBxQNd9a5/n5ePEH0ymRANDbbNE8uvVmSi7vimJs P7mYlkOOxvAxcmZXcwCWfPaY9mw8rZT0sZ0WzeckVnxH9PVtU28tgo15kZUd82E15cCh v0gSvvJ/3DIBh4sBZelZk2AvPGdKC32Govd1tWh6SSy/uMx5ovAP4Fub6ODtv0g5iix6 fmSlSnLKYZWNtXGjZVKYHvwyTLl70g5m+IcABOViVwncIOYfKvpKRc8gYoOfW2Zc57Dm I3lA== X-Gm-Message-State: AOAM530UEUixmBfE47EZczqmibXQiYPcBOoKTy2xJZFfAq1kKfYRT3oR v4fV6dYvrRMwpmZlaVM3wQe9Sx1Q/hee5qKox2ZdFg== X-Received: by 2002:a2e:bf24:0:b0:246:801e:39d3 with SMTP id c36-20020a2ebf24000000b00246801e39d3mr8506477ljr.472.1646082236647; Mon, 28 Feb 2022 13:03:56 -0800 (PST) MIME-Version: 1.0 References: <20220228103142.3301082-1-arnd@kernel.org> In-Reply-To: <20220228103142.3301082-1-arnd@kernel.org> From: Nick Desaulniers Date: Mon, 28 Feb 2022 13:03:45 -0800 Message-ID: Subject: Re: [PATCH] [v2] Kbuild: move to -std=gnu11 To: Arnd Bergmann Cc: 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 Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-18.1 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham 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 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. 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 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