Thread (18 messages) 18 messages, 5 authors, 2017-09-10

Re: [RFC PATCH 0/3] kbuild: generate intermediate C files instead of copying _shipped files

From: Linus Torvalds <torvalds@linux-foundation.org>
Date: 2017-08-19 17:03:56
Also in: linux-kbuild, lkml

On Sat, Aug 19, 2017 at 1:49 AM, Masahiro Yamada
[off-list ref] 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help