From fc0dbb3bba902ee3e6d77379cb5c8227cb8dc3eb Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Sat, 30 Jan 2021 09:43:57 +0100 Subject: [PATCH] traces: display the Bison version * src/main.c (main): When traces are enabled, display the Bison version. * tests/conflicts.at, tests/report.at, tests/sets.at: Use AT_PACKAGE_VERSION (for package.m4) instead of post-processing the output. --- src/main.c | 3 +++ tests/.gitignore | 3 --- tests/conflicts.at | 3 ++- tests/report.at | 36 ++++++++++++++++++------------------ tests/sets.at | 6 ++++-- 5 files changed, 27 insertions(+), 24 deletions(-) diff --git a/src/main.c b/src/main.c index 3afb68ad..22291d23 100644 --- a/src/main.c +++ b/src/main.c @@ -94,6 +94,9 @@ main (int argc, char *argv[]) getargs (argc, argv); + if (trace_flag) + fprintf (stderr, "bison (GNU Bison) %s\n", VERSION); + timevar_enabled = trace_flag & trace_time; timevar_init (); timevar_start (tv_total); diff --git a/tests/.gitignore b/tests/.gitignore index 19f357fb..30d68408 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -2,9 +2,6 @@ /atconfig /atlocal /bison -/calc -/calc.[chy] -/calc.tab.* /package.m4 /testsuite /testsuite.dir diff --git a/tests/conflicts.at b/tests/conflicts.at index 8e6e9ac7..6ba57a4b 100644 --- a/tests/conflicts.at +++ b/tests/conflicts.at @@ -1957,7 +1957,8 @@ empty_c3: %prec 'c' ; ]]) AT_BISON_CHECK([[--trace=cex -fcaret --report=all -o input.c input.y]], 0, [], -[[init: 0.000000 +[[bison (GNU Bison) ]AT_PACKAGE_VERSION[ +init: 0.000000 # state items: 26 State 0: 0 $accept: . start $end diff --git a/tests/report.at b/tests/report.at index 6452e6f7..231c8cb9 100644 --- a/tests/report.at +++ b/tests/report.at @@ -578,8 +578,8 @@ State 19 -AT_CHECK([sed -e '1s/GNU Bison .*\.$/GNU Bison VERSION./' input.gv], [], -[[// Generated by GNU Bison VERSION. +AT_CHECK([cat input.gv], [], +[[// Generated by GNU Bison ]AT_PACKAGE_VERSION[. // Report bugs to . // Home page: . @@ -672,10 +672,10 @@ digraph "input.yy" ]]) -AT_CHECK([[sed -e 's/bison-xml-report version="[^"]*"/bison-xml-report version="VERSION"/g' input.xml]], [], +AT_CHECK([[cat input.xml]], [], [[ - + input.yy @@ -1140,7 +1140,7 @@ AT_CHECK([[sed -e 's/bison-xml-report version="[^"]*"/bison-xml-report version=" ]]) # Check HTML output. -AT_CHECK([[sed -e 's/GNU Bison [0-9][-.0-9a-z]*/GNU Bison VERSION/g' input.html]], [], +AT_CHECK([[cat input.html]], [], [[ @@ -1492,7 +1492,7 @@ AT_CHECK([[sed -e 's/GNU Bison [0-9][-.0-9a-z]*/GNU Bison VERSION/g' input.html] @@ -1902,8 +1902,8 @@ State 27 -AT_CHECK([sed -e '1s/GNU Bison .*\.$/GNU Bison VERSION./' input.gv], [], -[[// Generated by GNU Bison VERSION. +AT_CHECK([cat input.gv], [], +[[// Generated by GNU Bison ]AT_PACKAGE_VERSION[. // Report bugs to . // Home page: . @@ -2026,10 +2026,10 @@ digraph "input.yy" ]]) -AT_CHECK([[sed -e 's/bison-xml-report version="[^"]*"/bison-xml-report version="VERSION"/g' input.xml]], [], +AT_CHECK([[cat input.xml]], [], [[ - + input.yy @@ -2651,7 +2651,7 @@ if test x"$XSLTPROC" != x""; then AT_CHECK([[$XSLTPROC \ `]]AT_SET_ENV[[ bison --print-datadir`/xslt/xml2xhtml.xsl \ input.xml >input.html]]) - AT_CHECK([sed -e 's,GNU Bison .*,GNU Bison VERSION,' input.html], [], + AT_CHECK([cat input.html], [], [[ @@ -3088,7 +3088,7 @@ if test x"$XSLTPROC" != x""; then @@ -3429,8 +3429,8 @@ State 8 -AT_CHECK([sed -e '1s/GNU Bison .*\.$/GNU Bison VERSION./' input.gv], [], -[[// Generated by GNU Bison VERSION. +AT_CHECK([cat input.gv], [], +[[// Generated by GNU Bison ]AT_PACKAGE_VERSION[. // Report bugs to . // Home page: . @@ -3483,10 +3483,10 @@ digraph "input.y" ]]) -AT_CHECK([[sed -e 's/bison-xml-report version="[^"]*"/bison-xml-report version="VERSION"/g' input.xml]], [], +AT_CHECK([[cat input.xml]], [], [[ - + input.y @@ -3749,7 +3749,7 @@ AT_CHECK([[sed -e 's/bison-xml-report version="[^"]*"/bison-xml-report version=" ]]) -AT_CHECK([[sed -e 's/GNU Bison [0-9][-.0-9a-z]*/GNU Bison VERSION/g' input.html]], [], +AT_CHECK([[cat input.html]], [], [[ @@ -3971,7 +3971,7 @@ AT_CHECK([[sed -e 's/GNU Bison [0-9][-.0-9a-z]*/GNU Bison VERSION/g' input.html] diff --git a/tests/sets.at b/tests/sets.at index aeba435e..2de00d57 100644 --- a/tests/sets.at +++ b/tests/sets.at @@ -323,7 +323,8 @@ fact: "num" ]]) AT_BISON_CHECK([[--trace=grammar -o input.c input.y]], [], [], -[[input.y: warning: 1 nonterminal useless in grammar [-Wother] +[[bison (GNU Bison) ]AT_PACKAGE_VERSION[ +input.y: warning: 1 nonterminal useless in grammar [-Wother] input.y: warning: 1 rule useless in grammar [-Wother] input.y:4.1-7: warning: nonterminal useless in grammar: useless [-Wother] Reduced Grammar @@ -409,7 +410,8 @@ exp: ]]) AT_BISON_CHECK([[--trace=grammar -o input.c input.y]], [], [], -[[Reduced Grammar +[[bison (GNU Bison) ]AT_PACKAGE_VERSION[ +Reduced Grammar ntokens = 10, nnterms = 2, nsyms = 12, nrules = 8, nritems = 29