From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com [209.85.208.180]) (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 E3C1C4C9E for ; Mon, 28 Feb 2022 21:03:58 +0000 (UTC) Received: by mail-lj1-f180.google.com with SMTP id s25so19170673lji.5 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=o32i4UEW38VVzfWBB36TmXL4+CoJ3wBc7EPjeP4RxJ0YkGiOB9L8+daKkUR9TUEmdH 3xkx+PXq5A3e7pf2h54drt5dAlySArDs+N6bkt5MDwpHXRDAVh/R6N6sDt5ABJLudT0A rQbLYaWwFN8dnU7esTa2xejbqOEyU7Dsh7pbFCqtufIGUlnTPjypFEFCPbvOm3k1hzkZ BxOG7Wbu6WYB8GMxMyDDqRh/cZD4CB5oIFb/dmutByxeojzO1H6wCimDeUpHlMId+0vM YT42MTeLUqgFeeFe8tGb2TR85C0TP5/3/KyqTKz6IEBjpGib76szvgBxxC1ZFjfxRvET APvA== X-Gm-Message-State: AOAM531ZqMKMtCEnSZyhpWksseFBfyWeb1BF/u+bbn5SmKJGLjI/wvaH 4SHXjonnCDJZSi1jjiW5S3zEtqGzxn6fJvUPhdoZMQ== X-Google-Smtp-Source: ABdhPJzGFFfCBCn90UYvglywOrc8nxTF2i5r3/1lhRKGwuSQ5VMkWLmIJa+L1faEtfi148WU9C5GVQ0oji3KdUudozI= 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) Precedence: bulk X-Mailing-List: linux-staging@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: 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" 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 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 54B09C433EF for ; Mon, 28 Feb 2022 21:04:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F184E10E8BD; Mon, 28 Feb 2022 21:03:59 +0000 (UTC) Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [IPv6:2a00:1450:4864:20::22e]) by gabe.freedesktop.org (Postfix) with ESMTPS id 97BAC10E442 for ; Mon, 28 Feb 2022 21:03:58 +0000 (UTC) Received: by mail-lj1-x22e.google.com with SMTP id bn33so19188118ljb.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=mYJvOLCBu9ucao8vWCCkoXmgSVWNfHqxNAgK4LuajwGd24knOf6jMT3ZtUmYThCDNN 15ALrmksvpYw5DG3nelF8/xT0KLOLGWtJxyq4a0zhdjC6/jWxwMQpZE1FlxxXHNGK0xE QNQrkrY8Gb+lotN74xlPvBZHUKv6NlaovPUSCakt1pK5OuTtdghGQKBqS7kNyhML4oJX 6Tgm4eJyuZ5P0M/fxJhw//DfUIaMsrJ4rtEJn3QmSxcoIpGYFtctAfO8Wh0P96GUXYkU ImTgdvUQBGpDut4j0sTPs5GzGRSxrwW5ise455F6X6qZacZy8FS0FdWzEzJh5vKnWJa6 Fg+Q== X-Gm-Message-State: AOAM532U+d3YXyPXy/aZY0ynJWoM6wtzleVAyDsp/Y0cajes073iPspV cXED6ASDfRH8p8F77hP0QSMtT92CgYG6NN5caDYaHA== X-Google-Smtp-Source: ABdhPJzGFFfCBCn90UYvglywOrc8nxTF2i5r3/1lhRKGwuSQ5VMkWLmIJa+L1faEtfi148WU9C5GVQ0oji3KdUudozI= 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 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-kernel@lists.infradead.org, Michal Marek , Arnd Bergmann , Jonathan Corbet , linux-staging@lists.linux.dev, Masahiro Yamada , llvm@lists.linux.dev, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, greybus-dev@lists.linaro.org, Alex Shi , Federico Vaga , Hu Haowen , intel-gfx@lists.freedesktop.org, linux-btrfs@vger.kernel.org, Linus Torvalds , linux-doc-tw-discuss@lists.sourceforge.net, linux-kbuild@vger.kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 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 9B4B9C433F5 for ; Mon, 28 Feb 2022 21:04:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DD4D010E442; Mon, 28 Feb 2022 21:03:59 +0000 (UTC) Received: from mail-lj1-x22c.google.com (mail-lj1-x22c.google.com [IPv6:2a00:1450:4864:20::22c]) by gabe.freedesktop.org (Postfix) with ESMTPS id 97C1510E8BD for ; Mon, 28 Feb 2022 21:03:58 +0000 (UTC) Received: by mail-lj1-x22c.google.com with SMTP id v22so19182322ljh.7 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=wpIokiiz6fFFDiW+asGBoC+PaO9PyScUWrLwi0etM7mXXM9SijXc6jT6cidPudT5rl TU2YBcfdlmhuspJwYSiBAMkertXR/a2l+wJkHXCu0zfdRGGL/LPdZ6smWaunVfdfBG8H nmtY2Lz6zWbp+u6LfnfUgGJn/thew4YqhijLR0C3hogn5KIXbYE7Dl9qPKPfSCrqRts/ B1FNLIMZEtqausuHzKx3Br78McLquHl0o3eIyuksR2zHt7XejQoqSAtxmesEh5YZlNML rnyy6bnQmUoOjF5bPmf4N9qTcchpT12VZbXbU+GzoYOfDeEaZVa2y1aoMxt5taDDfMUO PjwA== X-Gm-Message-State: AOAM530mgF36TDZNuztlHwfk/XZIKjlssYYx9UlbzYFj/71glsPiLelr o+JvJXsQgIkxKX0sLY65th3WZyUzrY94vCIKe1GJUw== X-Google-Smtp-Source: ABdhPJzGFFfCBCn90UYvglywOrc8nxTF2i5r3/1lhRKGwuSQ5VMkWLmIJa+L1faEtfi148WU9C5GVQ0oji3KdUudozI= 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: To: Arnd Bergmann Content-Type: text/plain; charset="UTF-8" Subject: Re: [Intel-gfx] [PATCH] [v2] Kbuild: move to -std=gnu11 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-kernel@lists.infradead.org, Michal Marek , Arnd Bergmann , Jonathan Corbet , linux-staging@lists.linux.dev, Masahiro Yamada , llvm@lists.linux.dev, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, greybus-dev@lists.linaro.org, Alex Shi , Federico Vaga , Hu Haowen , intel-gfx@lists.freedesktop.org, linux-btrfs@vger.kernel.org, Linus Torvalds , linux-doc-tw-discuss@lists.sourceforge.net, linux-kbuild@vger.kernel.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" 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 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 E5509C433F5 for ; Mon, 28 Feb 2022 21:05:39 +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=PTDVgVrOewgFMzsrcCBDsYy7eLmvGPfa/w1pU5ucYp0=; b=PitkxH18SOKqGV 9FmyqiRKrI5WuJLY3twsZL4dnRuaSAFIqASqi1EuoIftSS/xVNLHicLim2jNRK7iUukI/3nBrinZm KgoSVmhKNH8hp8TT5nFvwn7DtVealw0WieBS8vhhxLPmrsVk7Rn+B5dH4NdtqNEVowd9MLOYVhoQ+ Y0QW7eR1IoEctJAYXDktMkOE7vGpevB+pWa8+x6t9D3fI6e2cJgdC9Nzxc/MxQLodVrkLvpqtm+n0 ihhljuRRe78rupR28LcgwleTP5xCVxWJ1PP2kDI7m/1shijs2af9aFuaDvWAztwyDIKfxb0FN+4NV 81eeiJ671Kamw0EICN0w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nOnBd-00E6NS-Rf; Mon, 28 Feb 2022 21:04:06 +0000 Received: from mail-lj1-x233.google.com ([2a00:1450:4864:20::233]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nOnBZ-00E6MI-Nj for linux-arm-kernel@lists.infradead.org; Mon, 28 Feb 2022 21:04:03 +0000 Received: by mail-lj1-x233.google.com with SMTP id l12so7288898ljh.12 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=EjufrR6bHhJgLCvxcj+sWvla9g6DUu09EyC3oUfcYUwJ1DcTqaaYT8UBjHxSqvYzp1 9BF2efMbpkr16xcLA+S6NkrznGP8uAhp1QNqRYbQqcyHFD7EBIFmvHul+8KZ1pOkQW28 HE0shuS4X2X6/C3J5RDT1FE3de0iRPN9cSbU1M/rbIeZoTtfjtfEhy3Ew+VClU2C1irm nlQUH2svR8Y77zbP735mpUAVkfeLf29OxEk4WL5pQrz/IQfw1hOr6GQoyQL/0SvZ6oXb lOwmlIOC62EM4/SPUc925Ja+UqkVUPBmVPD031O470Z/UivTONXZ4tDOTeUCzM3oVRm7 94bg== X-Gm-Message-State: AOAM530ih0+s32oQyHb+Y26dcV2tupq6Mh4VGM25cOSoNNDPpRsiWXMs 4OzXdmG5UdyDwUoNTnPexnmQ3kPyLpemhPVkMT3tzA== X-Google-Smtp-Source: ABdhPJzGFFfCBCn90UYvglywOrc8nxTF2i5r3/1lhRKGwuSQ5VMkWLmIJa+L1faEtfi148WU9C5GVQ0oji3KdUudozI= 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220228_130401_779440_5E09C7F7 X-CRM114-Status: GOOD ( 27.58 ) 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 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel