From: Ethan Sommer <e5ten.arch@gmail.com>
To: unlisted-recipients:; (no To-header on input)
Cc: Ethan Sommer <e5ten.arch@gmail.com>,
Masahiro Yamada <yamada.masahiro@socionext.com>,
Michal Marek <michal.lkml@markovi.net>,
Rob Herring <robh+dt@kernel.org>,
Frank Rowand <frowand.list@gmail.com>,
Sedat Dilek <sedat.dilek@gmail.com>,
Nathan Chancellor <natechancellor@gmail.com>,
Nick Desaulniers <ndesaulniers@google.com>,
linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
devicetree@vger.kernel.org
Subject: [PATCH v2] kbuild: support byacc as alternative YACC to bison
Date: Tue, 29 Oct 2019 11:01:16 -0400 [thread overview]
Message-ID: <20191029150119.19823-1-e5ten.arch@gmail.com> (raw)
In-Reply-To: <CAK7LNASG4GzaU6SR=ThfJpjrqmC53xmcSMAWqppciWbx3jMgdw@mail.gmail.com>
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.
Add %locations to dtc-parser.y to explicitly enable location tracking
for byacc, and define YYERROR_CALL explicitly to prevent the locations
directive from causing it to be defined to a 2-parameter call to
yyerror, which dtc-parser.y defines to accept one parameter.
Requires byacc to be built with --enable-btyacc.
Signed-off-by: Ethan Sommer <e5ten.arch@gmail.com>
---
scripts/Makefile.host | 2 +-
scripts/dtc/dtc-parser.y | 4 ++++
scripts/genksyms/Makefile | 2 +-
scripts/genksyms/lex.l | 2 ++
4 files changed, 8 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/dtc/dtc-parser.y b/scripts/dtc/dtc-parser.y
index 2ed4dc1f07fd..40dcf4f149da 100644
--- a/scripts/dtc/dtc-parser.y
+++ b/scripts/dtc/dtc-parser.y
@@ -2,6 +2,8 @@
/*
* (C) Copyright David Gibson <dwg@au1.ibm.com>, IBM Corporation. 2005.
*/
+%locations
+
%{
#include <stdio.h>
#include <inttypes.h>
@@ -17,6 +19,8 @@ extern void yyerror(char const *s);
treesource_error = true; \
} while (0)
+#define YYERROR_CALL(msg) yyerror(msg)
+
extern struct dt_info *parser_output;
extern bool treesource_error;
%}
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
next prev parent reply other threads:[~2019-10-29 15:02 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Ethan Sommer [this message]
2019-10-29 15:58 ` [PATCH v2] " Frank Rowand
2019-10-30 2:58 ` Masahiro Yamada
2019-11-03 20:30 ` Ethan Sommer
2019-11-11 18:37 Dmitry Golovin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191029150119.19823-1-e5ten.arch@gmail.com \
--to=e5ten.arch@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=frowand.list@gmail.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.lkml@markovi.net \
--cc=natechancellor@gmail.com \
--cc=ndesaulniers@google.com \
--cc=robh+dt@kernel.org \
--cc=sedat.dilek@gmail.com \
--cc=yamada.masahiro@socionext.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).