Browse Source

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>
main
Ethan Sommer 5 years ago committed by David Gibson
parent
commit
7150286225
  1. 2
      Makefile
  2. 4
      dtc-parser.y

2
Makefile

@ -368,6 +368,6 @@ clean: libfdt_clean pylibfdt_clean tests_clean @@ -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:

4
dtc-parser.y

@ -2,6 +2,8 @@ @@ -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); @@ -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;
%}

Loading…
Cancel
Save