Re: [PATCH RESEND] gcc-plugins: avoid errors with -std=gnu++11 on old gcc
From: Masahiro Yamada
Date: Thu Mar 18 2021 - 05:09:12 EST
On Thu, Mar 18, 2021 at 3:26 PM Miguel Ojeda
<miguel.ojeda.sandonis@xxxxxxxxx> wrote:
>
> On Thu, Mar 18, 2021 at 7:03 AM Valdis Klētnieks
> <valdis.kletnieks@xxxxxx> wrote:
> >
> > Or declare that gcc6 is the minimum for building the kernel.
>
> Cc'ing some interested people in raising GCC's version for one reason
> or another, so that we put this as another one in the pile of reasons
> :-)
>
> https://lore.kernel.org/lkml/CAHk-=wjgvt1Ei72BTrEH5fgfqykVH-AYt56-7yBT8Lcprj7bEg@xxxxxxxxxxxxxx/
>
> Cheers,
> Miguel
Previously we were discussing raising the min GCC
version 5.x, but not further at this point of time.
We can require GCC 6+ for building GCC plugins.
--- a/scripts/gcc-plugins/Kconfig
+++ b/scripts/gcc-plugins/Kconfig
@@ -8,7 +8,7 @@ config HAVE_GCC_PLUGINS
menuconfig GCC_PLUGINS
bool "GCC plugins"
depends on HAVE_GCC_PLUGINS
- depends on CC_IS_GCC
+ depends on CC_IS_GCC && GCC_VERSION >= 60000
depends on $(success,test -e $(shell,$(CC)
-print-file-name=plugin)/include/plugin-version.h)
default y
help
BTW, the commit message mentions that
the issues only happen on GCC 4 and 5,
but the added code was:
GCC_FLAVOR = $(call cc-ifversion, -ge, 1100, 11, 98)
instead of
GCC_FLAVOR = $(call cc-ifversion, -ge, 600, 11, 98)
So, this patch is also requiring to cover two standards:
GCC_VERSION >= 11 : -std=gnu++11
GCC_VERSION < 11 : -std=gnu++98
--
Best Regards
Masahiro Yamada