bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

traces: display the Bison version


From: Akim Demaille
Subject: traces: display the Bison version
Date: Sat, 30 Jan 2021 14:33:13 +0100

commit fc0dbb3bba902ee3e6d77379cb5c8227cb8dc3eb
Author: Akim Demaille <akim.demaille@gmail.com>
Date:   Sat Jan 30 09:43:57 2021 +0100

    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.

diff --git a/src/main.c b/src/main.c
index 3afb68ad3..22291d23f 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 19f357fbb..30d68408b 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 8e6e9ac7d..6ba57a4b0 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 6452e6f7f..231c8cb9a 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 <bug-bison@gnu.org>.
 // Home page: <https://www.gnu.org/software/bison/>.
 
@@ -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]], [],
 [[<?xml version="1.0"?>
 
-<bison-xml-report version="VERSION" bug-report="bug-bison@gnu.org" 
url="https://www.gnu.org/software/bison/";>
+<bison-xml-report version="]AT_PACKAGE_VERSION[" 
bug-report="bug-bison@gnu.org" url="https://www.gnu.org/software/bison/";>
 
   <filename>input.yy</filename>
 
@@ -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]], [],
 [[<?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
 <html xmlns="http://www.w3.org/1999/xhtml"; 
xmlns:bison="https://www.gnu.org/software/bison/";>
@@ -1492,7 +1492,7 @@ AT_CHECK([[sed -e 's/GNU Bison [0-9][-.0-9a-z]*/GNU Bison 
VERSION/g' input.html]
 
 <div id="footer"><hr />This document was generated using
       <a href="https://www.gnu.org/software/bison/"; title="GNU Bison">
-      GNU Bison VERSION</a>
+      GNU Bison ]AT_PACKAGE_VERSION[</a>
       XML Automaton Report.<br />
       Verbatim copying and distribution of this entire page is
       permitted in any medium, provided this notice is preserved.</div></body>
@@ -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 <bug-bison@gnu.org>.
 // Home page: <https://www.gnu.org/software/bison/>.
 
@@ -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]], [],
 [[<?xml version="1.0"?>
 
-<bison-xml-report version="VERSION" bug-report="bug-bison@gnu.org" 
url="https://www.gnu.org/software/bison/";>
+<bison-xml-report version="]AT_PACKAGE_VERSION[" 
bug-report="bug-bison@gnu.org" url="https://www.gnu.org/software/bison/";>
 
   <filename>input.yy</filename>
 
@@ -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 .*</a>,GNU Bison VERSION</a>,' input.html], [],
+  AT_CHECK([cat input.html], [],
 [[<?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
 <html xmlns="http://www.w3.org/1999/xhtml"; 
xmlns:bison="https://www.gnu.org/software/bison/";>
@@ -3088,7 +3088,7 @@ if test x"$XSLTPROC" != x""; then
 
 <div id="footer"><hr />This document was generated using
       <a href="https://www.gnu.org/software/bison/"; title="GNU Bison">
-      GNU Bison VERSION</a>
+      GNU Bison ]AT_PACKAGE_VERSION[</a>
       XML Automaton Report.<br />
       Verbatim copying and distribution of this entire page is
       permitted in any medium, provided this notice is preserved.</div></body>
@@ -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 <bug-bison@gnu.org>.
 // Home page: <https://www.gnu.org/software/bison/>.
 
@@ -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]], [],
 [[<?xml version="1.0"?>
 
-<bison-xml-report version="VERSION" bug-report="bug-bison@gnu.org" 
url="https://www.gnu.org/software/bison/";>
+<bison-xml-report version="]AT_PACKAGE_VERSION[" 
bug-report="bug-bison@gnu.org" url="https://www.gnu.org/software/bison/";>
 
   <filename>input.y</filename>
 
@@ -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]], [],
 [[<?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
 <html xmlns="http://www.w3.org/1999/xhtml"; 
xmlns:bison="https://www.gnu.org/software/bison/";>
@@ -3971,7 +3971,7 @@ AT_CHECK([[sed -e 's/GNU Bison [0-9][-.0-9a-z]*/GNU Bison 
VERSION/g' input.html]
 
 <div id="footer"><hr />This document was generated using
       <a href="https://www.gnu.org/software/bison/"; title="GNU Bison">
-      GNU Bison VERSION</a>
+      GNU Bison ]AT_PACKAGE_VERSION[</a>
       XML Automaton Report.<br />
       Verbatim copying and distribution of this entire page is
       permitted in any medium, provided this notice is preserved.</div></body>
diff --git a/tests/sets.at b/tests/sets.at
index aeba435e4..2de00d57f 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
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]