Re: [RFC PATCH 0/3] kbuild: generate intermediate C files instead of copying _shipped files
From: Linus Torvalds
Date: Sat Aug 19 2017 - 13:04:02 EST
On Sat, Aug 19, 2017 at 1:49 AM, Masahiro Yamada
<yamada.masahiro@xxxxxxxxxxxxx> wrote:
>
> Here is one question. Is it acceptable to use those rules all the time?
> That is, generate those C files by flex, bison, gperf during the
> kernel building.
Yeah, I think we probably should do that.
However, when I just tested, I noticed that we have issues with
re-generating those files. With gperf 3.1 installed, I get
In file included from scripts/kconfig/zconf.tab.c:213:0:
scripts/kconfig/zconf.gperf:147:1: error: conflicting types for
âkconf_id_lookupâ
scripts/kconfig/zconf.gperf:12:31: note: previous declaration of
âkconf_id_lookupâ was here
static const struct kconf_id *kconf_id_lookup(register const char
*str, register unsigned int len);
^~~~~~~~~~~~~~~
because gperf now generates
const struct kconf_id *
-kconf_id_lookup (register const char *str, register unsigned int len)
+kconf_id_lookup (register const char *str, register size_t len)
and I'm not sure how to detect that automatically. It seems to be a
gperf-3.1 change, and gperf doesn't seem to generate any version
markers.
Working around that, I hit:
In file included from scripts/genksyms/lex.lex.c:1921:0:
scripts/genksyms/keywords.gperf:54:1: error: conflicting types for
âis_reserved_wordâ
static, STATIC_KEYW
^~~~~~~~~~~~~~~~
In file included from scripts/genksyms/lex.lex.c:1921:0:
scripts/genksyms/keywords.gperf:6:30: note: previous declaration of
âis_reserved_wordâ was here
static const struct resword *is_reserved_word(register const char
*str, register unsigned int len);
^~~~~~~~~~~~~~~~
so we have at least two cases of this in the source tree.
So one of the advantages of the pre-shipped files is that we can avoid
that kind of crazy version issues with the tools.
But if we can solve the versioning thing easily, I certainly don't
mind getting rid of the pre-generated files. Having to have
flex/bison/gperf isn't a huge onus on the kernel build system.
Linus