From cc7d856e2dbb0a1e9e28716ce863fd3405e5f7a5 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Tue, 1 Sep 2020 18:15:07 -0700 Subject: [PATCH] use Bison's api.prefix instead of name mangling in expr This is the equivalent of cc2cb52756f545d6863d6fd801fa23762a81704c. My original intent was to split the changes that remove the build-time symbol mangling (the equivalent of 9240da12ab7857975aa34279520f1f6aad113d48) into a separate commit. However, the expression parser does a lot of messy tricks to collide with and suppress Bison-generated macros. It was simpler to undo all of this in one go then try to thread this convoluted needle. Related to #1806. --- lib/expr/Makefile.am | 7 ++----- lib/expr/exparse.y | 6 ++++++ lib/expr/expr.vcxproj | 8 ++++---- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/lib/expr/Makefile.am b/lib/expr/Makefile.am index d031e7bd9..5b4518ee0 100644 --- a/lib/expr/Makefile.am +++ b/lib/expr/Makefile.am @@ -51,17 +51,14 @@ exop.h: exparse.h echo "};" >> exop.h exparse.c: y.tab.c - @SED@ "s/yy/ex/g" exparse.c exparse.h: y.tab.h echo "#ifndef _EXPARSE_H" > exparse.h echo "#define _EXPARSE_H" >> exparse.h - @SED@ "s/yy/ex/g" < y.tab.h | \ - @SED@ "s/YY/EX/g" >> exparse.h + cat y.tab.h >> exparse.h echo "#endif /* _EXPARSE_H */" >> exparse.h y.tab.c y.tab.h: y.output diff --git a/lib/expr/exparse.y b/lib/expr/exparse.y index cb150ed7a..38e6a307f 100644 --- a/lib/expr/exparse.y +++ b/lib/expr/exparse.y @@ -13,6 +13,12 @@ %require "3.0" + /* By default, Bison emits a parser using symbols prefixed with "yy". Graphviz + * contains multiple Bison-generated parsers, so we alter this prefix to avoid + * symbol clashes. + */ +%define api.prefix {ex} + %{ /* diff --git a/lib/expr/expr.vcxproj b/lib/expr/expr.vcxproj index f7c9ab189..5b4c03a1d 100644 --- a/lib/expr/expr.vcxproj +++ b/lib/expr/expr.vcxproj @@ -65,8 +65,8 @@ win_bison -Wno-yacc -dy exparse.y -o exparse-intermediate.c -sed "s/yy/ex/g" < exparse-intermediate.c | sed "s/YY/EX/g" > exparse.c -sed "s/yy/ex/g" < exparse-intermediate.h | sed "s/YY/EX/g" > exparse.h +copy exparse-intermediate.c exparse.c +copy exparse-intermediate.h exparse.h del exparse-intermediate.c del exparse-intermediate.h @@ -83,8 +83,8 @@ del exparse-intermediate.h win_bison -Wno-yacc -dy exparse.y -o exparse-intermediate.c -sed "s/yy/ex/g" < exparse-intermediate.c | sed "s/YY/EX/g" > exparse.c -sed "s/yy/ex/g" < exparse-intermediate.h | sed "s/YY/EX/g" > exparse.h +copy exparse-intermediate.c exparse.c +copy exparse-intermediate.h exparse.h del exparse-intermediate.c del exparse-intermediate.h -- 2.40.0