aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEthan Sommer <e5ten.arch@gmail.com>2019-10-29 12:26:19 -0400
committerDavid Gibson <david@gibson.dropbear.id.au>2019-11-03 20:20:22 +0100
commit7150286225476345bd6e7312331e3baf4d621c32 (patch)
tree40481fad3b13198a8abc5ea068e4be3bfb61a6c4
parentfdf3f6d897ab8759fb7d7277ba5224beb4727d1d (diff)
downloaddtc-7150286225476345bd6e7312331e3baf4d621c32.zip
dtc-7150286225476345bd6e7312331e3baf4d621c32.tar.gz
dtc-7150286225476345bd6e7312331e3baf4d621c32.tar.bz2
support byacc in addition to bison
Use -b to explicitly set file prefix, so that byacc generates files with the same names as bison. Add %locations to dtc-parser.y to explicitly enable location tracking for byacc, and define YYERROR_CALL to prevent byacc from defining it to call yyerror with 2 parameters because of the locations directive, because dtc-parser.y defines yyerror to accept one parameter. Signed-off-by: Ethan Sommer <e5ten.arch@gmail.com> Message-Id: <20191029162619.32561-1-e5ten.arch@gmail.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
-rw-r--r--Makefile2
-rw-r--r--dtc-parser.y4
2 files changed, 5 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index e955242..4d88157 100644
--- a/Makefile
+++ b/Makefile
@@ -368,6 +368,6 @@ clean: libfdt_clean pylibfdt_clean tests_clean
%.tab.c %.tab.h %.output: %.y
@$(VECHO) BISON $@
- $(BISON) -d $<
+ $(BISON) -b $(basename $(basename $@)) -d $<
FORCE:
diff --git a/dtc-parser.y b/dtc-parser.y
index 2ed4dc1..40dcf4f 100644
--- a/dtc-parser.y
+++ b/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;
%}