linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kbuild: support byacc as alternative YACC to bison
@ 2019-10-28 15:56 Ethan Sommer
  2019-10-28 22:31 ` Masahiro Yamada
  0 siblings, 1 reply; 9+ messages in thread
From: Ethan Sommer @ 2019-10-28 15:56 UTC (permalink / raw)
  Cc: Ethan Sommer, Masahiro Yamada, Michal Marek, Nathan Chancellor,
	Sedat Dilek, Nick Desaulniers, linux-kbuild, linux-kernel

Switches to a more portable set of flags for generating the same file
names instead of the bison-specific --defines, uses the more portable -V
instead of --version, and explicitly defines YYSTYPE in lex.l, which
bison implicitly defines if not present but byacc does not.

Signed-off-by: Ethan Sommer <e5ten.arch@gmail.com>
---
 scripts/Makefile.host     | 2 +-
 scripts/genksyms/Makefile | 2 +-
 scripts/genksyms/lex.l    | 2 ++
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/scripts/Makefile.host b/scripts/Makefile.host
index 4c51c95d40f4..64e98e1d4825 100644
--- a/scripts/Makefile.host
+++ b/scripts/Makefile.host
@@ -11,7 +11,7 @@ $(obj)/%.lex.c: $(src)/%.l FORCE
 # YACC
 # ---------------------------------------------------------------------------
 quiet_cmd_bison = YACC    $(basename $@).[ch]
-      cmd_bison = $(YACC) -o $(basename $@).c --defines=$(basename $@).h -t -l $<
+      cmd_bison = $(YACC) -b $(basename $(basename $@)) -d -t -l $<
 
 $(obj)/%.tab.c $(obj)/%.tab.h: $(src)/%.y FORCE
 	$(call if_changed,bison)
diff --git a/scripts/genksyms/Makefile b/scripts/genksyms/Makefile
index 78629f515e78..397c2dc8182b 100644
--- a/scripts/genksyms/Makefile
+++ b/scripts/genksyms/Makefile
@@ -15,7 +15,7 @@ genksyms-objs	:= genksyms.o parse.tab.o lex.lex.o
 ifeq ($(findstring 1,$(KBUILD_EXTRA_WARN)),)
 
 quiet_cmd_bison_no_warn = $(quiet_cmd_bison)
-      cmd_bison_no_warn = $(YACC) --version >/dev/null; \
+      cmd_bison_no_warn = $(YACC) -V >/dev/null; \
 			  $(cmd_bison) 2>/dev/null
 
 $(obj)/pars%.tab.c $(obj)/pars%.tab.h: $(src)/pars%.y FORCE
diff --git a/scripts/genksyms/lex.l b/scripts/genksyms/lex.l
index e265c5d96861..0580c088527f 100644
--- a/scripts/genksyms/lex.l
+++ b/scripts/genksyms/lex.l
@@ -19,6 +19,8 @@
 #include "genksyms.h"
 #include "parse.tab.h"
 
+extern YYSTYPE yylval;
+
 /* We've got a two-level lexer here.  We let flex do basic tokenization
    and then we categorize those basic tokens in the second stage.  */
 #define YY_DECL		static int yylex1(void)
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread
* Re: [PATCH v2] kbuild: support byacc as alternative YACC to bison
@ 2019-11-11 18:37 Dmitry Golovin
  0 siblings, 0 replies; 9+ messages in thread
From: Dmitry Golovin @ 2019-11-11 18:37 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Ethan Sommer, Michal Marek, Rob Herring, Frank Rowand,
	Sedat Dilek, Nathan Chancellor, Nick Desaulniers,
	Linux Kbuild mailing list, Linux Kernel Mailing List, DTML

> Hmm, this is unfortunate since there is no common way to
> specify the header path directly.
> 
> I am not sure how much effort we should invent
> to support non-GNU implementation
> since we already rely on various GNU tools.
> 
> If we decide to support byacc,
> we must carry the restriction
> that bans GNU-extension.

In fact Linux now can be built without using GNU
binutils and using LLVM tools instead. It's just
one architecture and a specific config now, but
eventually the others will be built too. You can
follow the progress here:
https://github.com/ClangBuiltLinux/continuous-integration/issues/73

I believe that compatibility with different
alternative tools is a good thing as long as it
doesn't add unwanted complexity. And as this patch
is just changing command-line flags to their
portable variants and explicitly adds a couple of
definitions that are presumed by GNU bison, I
can't see a problem with it.

Regards,
Dmitry

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-11-11 18:43 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-28 15:56 [PATCH] kbuild: support byacc as alternative YACC to bison Ethan Sommer
2019-10-28 22:31 ` Masahiro Yamada
2019-10-29  1:40   ` Ethan Sommer
2019-10-29  1:56     ` Masahiro Yamada
2019-10-29 15:01       ` [PATCH v2] " Ethan Sommer
2019-10-29 15:58         ` Frank Rowand
2019-10-30  2:58         ` Masahiro Yamada
2019-11-03 20:30           ` Ethan Sommer
2019-11-11 18:37 Dmitry Golovin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).