]> git.saurik.com Git - bison.git/log
bison.git
9 years agolalr1, yacc: use the default location as initial error location
Akim Demaille [Tue, 11 Aug 2015 11:48:57 +0000 (13:48 +0200)] 
lalr1, yacc: use the default location as initial error location

Currently lalr1.cc makes an out-of-bound access when trying to read @1
in rules with an empty rhs (i.e., when there is no @1) that raises an
error (YYERROR).

glr.c already gracefully handles this by using @$ as initial location
for the errors.  Let's do that in yacc.c and lalr1.cc.

* data/lalr1.cc, data/yacc.c: Use @$ to initialize the error location.
* tests/actions.at: Check that case.

9 years agostyle: formatting and comment changes
Akim Demaille [Tue, 11 Aug 2015 11:40:02 +0000 (13:40 +0200)] 
style: formatting and comment changes

* data/glr.c: Avoid empty lines.
* data/lalr1.cc: Use the same comments as in glr.c and yacc.c.

9 years agoc++: style: use "unsigned", not "unsigned int"
Akim Demaille [Tue, 11 Aug 2015 09:25:16 +0000 (11:25 +0200)] 
c++: style: use "unsigned", not "unsigned int"

This style appears to be more traditional, at least in C++.
For instance in the standard, [facets.examples].
There are occurrences using "unsigned int" too though.

* data/lalr1.cc, data/location.cc, data/stack.hh: here.

9 years agoc++: style: remove useless "inline" and fix space issues
Akim Demaille [Tue, 11 Aug 2015 09:18:46 +0000 (11:18 +0200)] 
c++: style: remove useless "inline" and fix space issues

* data/lalr1.cc, data/c++.m4: Formatting changes.
* data/stack.hh: Remove useless "inline".
Add documentation.
* data/location.cc: Prefer {} for empty bodies.

9 years agotests: beware of additional warnings from GCC 5
Akim Demaille [Tue, 11 Aug 2015 12:28:25 +0000 (14:28 +0200)] 
tests: beware of additional warnings from GCC 5

* tests/synclines.at (AT_SYNCLINES_COMPILE): Avoid warnings about
unused functions.

9 years agotests: beware that clang warns about "#define private public"
Akim Demaille [Tue, 11 Aug 2015 12:05:29 +0000 (14:05 +0200)] 
tests: beware that clang warns about "#define private public"

We use this trick to write some test about internal details.  But
since we use -Werror, clang++ 3.6 dies issueing a warning about it.

* configure.ac (warn_tests): Disable this warning.

9 years agotests: update our Valgrind suppression files
Akim Demaille [Tue, 11 Aug 2015 14:42:04 +0000 (16:42 +0200)] 
tests: update our Valgrind suppression files

* build-aux/linux-gnu.valgrind, build-aux/darwin11.4.0.valgrind: Rename as...
* build-aux/Linux.valgrind, build-aux/Darwin.valgrind: these.
* build-aux/Linux.valgrind: Add suppression clause.
* configure.ac: Update.
* tests/local.mk: Use it.

9 years agodoc: improve html and pdf rendering
Akim Demaille [Tue, 3 Mar 2015 15:47:58 +0000 (16:47 +0100)] 
doc: improve html and pdf rendering

* doc/bison.texi: Help html conversion to understand where the
function names end.
Beware of PDF width.

9 years agodoc: fixes in the C++ part
Akim Demaille [Tue, 3 Mar 2015 15:10:30 +0000 (16:10 +0100)] 
doc: fixes in the C++ part

Reported by Askar Safin.

http://lists.gnu.org/archive/html/bug-bison/2015-02/msg00018.html
http://lists.gnu.org/archive/html/bug-bison/2015-02/msg00019.html

* doc/bison.texi (Split Symbols): Fix access to token types.
yylval is a pointer, so use ->.
Fix coding style issues: space before paren.

9 years agotests: be robust to platforms that support UTF-8 even with LC_ALL=C
Akim Demaille [Tue, 10 Feb 2015 10:12:56 +0000 (11:12 +0100)] 
tests: be robust to platforms that support UTF-8 even with LC_ALL=C

Because musl supports UTF-8 with LC_ALL=C, gcc produces:

  input.y: In function ‘yyparse’:

instead of:

  input.y: In function 'yyparse':

Reported by Ferdinand Thiessen.
http://lists.gnu.org/archive/html/bug-bison/2015-02/msg00001.html

* tests/synclines.at (AT_SYNCLINES_COMPILE): Skip syncline tests when
we can't trust error messages issued about a function body.

9 years agotests: java: avoid recent Java features
Akim Demaille [Tue, 10 Feb 2015 13:56:01 +0000 (14:56 +0100)] 
tests: java: avoid recent Java features

Tests 463 and 464 fail with Java 1.4 compilers.

Reported by Michael Felt.
<http://lists.gnu.org/archive/html/bug-bison/2015-01/msg00091.html>

* tests/javapush.at: Use StringBuffer instead of StringBuilder.

9 years agotests: c++: fix symbol lookup issue
Akim Demaille [Mon, 26 Jan 2015 17:23:12 +0000 (18:23 +0100)] 
tests: c++: fix symbol lookup issue

Sun C 5.13 SunOS_sparc 2014/10/20 reports errors on tests 430-432.

Reported by Dennis Clarke.
<http://lists.gnu.org/archive/html/bug-bison/2015-01/msg00087.html>

* tests/c++.at (Variants): Be sure to emit operator<< before using it:
use "%code top" rather than "%code".
Prefer std::vector to std::list.
Do not define anything in std::, to avoid undefined behavior.

9 years agomaint: post-release administrivia
Akim Demaille [Fri, 23 Jan 2015 13:13:40 +0000 (14:13 +0100)] 
maint: post-release administrivia

* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.

9 years agoversion 3.0.4 v3.0.4
Akim Demaille [Fri, 23 Jan 2015 12:53:53 +0000 (13:53 +0100)] 
version 3.0.4

* NEWS: Record release date.

9 years agognulib: update
Akim Demaille [Fri, 23 Jan 2015 10:27:10 +0000 (11:27 +0100)] 
gnulib: update

9 years agobuild: re-enable compiler warnings, and fix them
Akim Demaille [Thu, 22 Jan 2015 18:03:41 +0000 (19:03 +0100)] 
build: re-enable compiler warnings, and fix them

There are warnings (-Wextra) in generated C++ code:

  ltlparse.cc: In member function 'ltlyy::parser::symbol_number_type
  ltlyy::parser::by_state::type_get() const':
  ltlparse.cc:452:33: warning: enumeral and non-enumeral type in
  conditional expression
      return state == empty_state ? empty_symbol : yystos_[state];

Reported by Alexandre Duret-Lutz.

It turns out that -Wall and -Wextra were disabled because of a stupid
typo.

* configure.ac: Fix the stupid typo.
* data/lalr1.cc, src/AnnotationList.c, src/InadequacyList.c,
* src/ielr.c, src/print.c, src/scan-code.l, src/symlist.c,
* src/symlist.h, src/symtab.c, src/tables.c, tests/actions.at,
* tests/calc.at, tests/cxx-type.at, tests/glr-regression.at,
* tests/named-refs.at, tests/torture.at:
Fix warnings, mostly issues about variables used only with assertions,
which are disabled with -DNDEBUG.

9 years agotests: c++: fix a C++03 conformance issue
Akim Demaille [Wed, 21 Jan 2015 17:34:01 +0000 (18:34 +0100)] 
tests: c++: fix a C++03 conformance issue

This fixes test 241 on xLC:

"input.y", line 42.11: 1540-0274 (S) The name lookup for "report" did not find a declaration.
"input.y", line 42.11: 1540-1292 (I) Static declarations are not considered for a function call if the function is not qualified.

where report is:

  static void
  report (std::ostream& yyo, int ival, float fval)
  {
    yyo << "ival: " << ival << ", fval: " <<  fval;
  }

and line 42 is:

  %printer { report (yyo, $$,       $<fval>$); } <ival>;

It turns out that indeed this function must not be declared static,
<http://stackoverflow.com/a/17662745/1353549>.  Let's put it into an
anonymous namespace.

Reported by Thomas Jahns.
http://lists.gnu.org/archive/html/bug-bison/2015-01/msg00059.html

* tests/actions.at (Qualified $$ in actions): Don't use "static",
prefer anonymous namespace.

9 years agotests: fix a title
Akim Demaille [Tue, 20 Jan 2015 19:47:02 +0000 (20:47 +0100)] 
tests: fix a title

* tests/conflicts.at: De-overquote.

9 years agoc++: reserve 200 slots in the parser's stack
Akim Demaille [Tue, 20 Jan 2015 19:41:57 +0000 (20:41 +0100)] 
c++: reserve 200 slots in the parser's stack

This is consistent with what is done with yacc.c and glr.c.  Because
it also avoids that the stack needs to be resized very soon, it should
help keeping tests about destructors more reliable.

Indeed, if the stack is created too small, very soon the C++ library
needs to enlarge it, which means creating a new one, copying the
elements from the initial one onto it, and then destroy the elements
of the initial stack: that would be a spurious call to a destructor.

Reported by Thomas Jahns.
http://lists.gnu.org/archive/html/bug-bison/2015-01/msg00059.html

* data/stack.hh (stack::stack): Reserve 200 slots.
* tests/c++.at: Remove traces of stack expansions.

9 years agotests: be more robust to unrecognized synclines, and try to recognize xlc
Akim Demaille [Mon, 19 Jan 2015 17:51:54 +0000 (18:51 +0100)] 
tests: be more robust to unrecognized synclines, and try to recognize xlc

Reported by Thomas Jahns.
http://lists.gnu.org/archive/html/bug-bison/2015-01/msg00059.html

* tests/synclines.at (AT_SYNCLINES_COMPILE): Rename as...
(_AT_SYNCLINES_COMPILE): this.
Try to recognize xlc locations.
(AT_SYNCLINES_COMPILE): New.  Skips the test if we can't read the
synclines.

9 years agotests: fix C++ conformance
Akim Demaille [Mon, 19 Jan 2015 17:24:24 +0000 (18:24 +0100)] 
tests: fix C++ conformance

Reported by Thomas Jahns.
http://lists.gnu.org/archive/html/bug-bison/2015-01/msg00059.html

* tests/c++.at (Exception safety): Add missing include.
Don't use const_iterator for erase.

9 years agobuild: fix some warnings
Akim Demaille [Sun, 18 Jan 2015 14:18:38 +0000 (15:18 +0100)] 
build: fix some warnings

Reported by John Horigan.
http://lists.gnu.org/archive/html/bug-bison/2015-01/msg00034.html

* src/graphviz.c, src/symtab.h: Address compiler warnings.

9 years agobuild: avoid infinite recursions on include_next
Akim Demaille [Fri, 16 Jan 2015 08:25:37 +0000 (09:25 +0100)] 
build: avoid infinite recursions on include_next

On MacOS X 10.5 PPC with Apple's GCC 4.0.1:

  % uname -a
  Darwin aria.cielonegro.org 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:57:0
  1 PDT 2009; root:xnu-1228.15.4~1/RELEASE_PPC Power Macintosh
  % gcc --version
  powerpc-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5493)
  Copyright (C) 2005 Free Software Foundation, Inc.
  This is free software; see the source for copying conditions.  There is NO
  warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

building in place enters into an infinite recursion on "#include_next":

  % gmake V=1
  [snip]
  depbase=`echo lib/math.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
  gcc -std=gnu99    -I. -Ilib -I. -I./lib   -g -O2 -MT lib/math.o -MD -MP -MF $depbase.Tpo -c -o lib/math.o lib/math.c &&\
  mv -f $depbase.Tpo $depbase.Po
  In file included from lib/math.h:27,
                   from lib/math.h:27,
                   from lib/math.h:27,
                   from lib/math.h:27,
  [snip]
                   from lib/math.h:27,
                   from lib/math.h:27,
                   from lib/math.c:3:
  lib/math.h:27:23: error: #include nested too deeply
  Makefile:3414: recipe for target 'lib/math.o' failed
  gmake[2]: *** [lib/math.o] Error 1

Using -I./lib instead of -Ilib fixes the problem.

Reported by Pho.
<https://lists.gnu.org/archive/html/bison-patches/2014-01/msg00000.html>

* Makefile.am (AM_CPPFLAGS): Use -I./lib instead of -Ilib.

9 years agodoc: minor fixes
Akim Demaille [Thu, 15 Jan 2015 16:26:43 +0000 (17:26 +0100)] 
doc: minor fixes

* doc/bison.texi: Fix warnings about colon in reference names.
* data/bison.m4, src/files.h: Fix comments.
* doc/Doxyfile.in: update.

9 years agognulib: strtoul is considered obsolete and now useless
Akim Demaille [Thu, 15 Jan 2015 16:26:32 +0000 (17:26 +0100)] 
gnulib: strtoul is considered obsolete and now useless

* bootstrap.conf: here.

9 years agoc++: avoid warnings when destructors don't use $$
Akim Demaille [Thu, 15 Jan 2015 13:25:40 +0000 (14:25 +0100)] 
c++: avoid warnings when destructors don't use $$

* data/c++.m4: here.

9 years agomaint: post-release administrivia
Akim Demaille [Thu, 15 Jan 2015 09:24:34 +0000 (10:24 +0100)] 
maint: post-release administrivia

* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.

9 years agoversion 3.0.3 v3.0.3
Akim Demaille [Thu, 15 Jan 2015 09:04:53 +0000 (10:04 +0100)] 
version 3.0.3

* NEWS: Record release date.

9 years agognulib: update
Akim Demaille [Thu, 15 Jan 2015 08:36:14 +0000 (09:36 +0100)] 
gnulib: update

9 years agotests: split a large test case into several smaller ones
Akim Demaille [Tue, 13 Jan 2015 13:15:47 +0000 (14:15 +0100)] 
tests: split a large test case into several smaller ones

* tests/conflicts.at (AT_CONSISTENT_ERRORS_CHECK): Move AT_SETUP/AT_CLEANUP
into it, so that we don't skip non Java tests following a test case in Java.

9 years agopackage: a bit of trouble shooting indications
Akim Demaille [Mon, 12 Jan 2015 11:11:53 +0000 (12:11 +0100)] 
package: a bit of trouble shooting indications

* README-hacking: here.

9 years agodoc: liby's main arms the internationalization
Akim Demaille [Mon, 12 Jan 2015 10:34:42 +0000 (11:34 +0100)] 
doc: liby's main arms the internationalization

Reported by Nicolas Bedon.
<https://lists.gnu.org/archive/html/bug-bison/2014-11/msg00005.html>

* doc/bison.texi (Yacc Library): Document the call the setlocale.

9 years agobison: avoid warnings from static code analysis
Akim Demaille [Fri, 9 Jan 2015 13:21:09 +0000 (14:21 +0100)] 
bison: avoid warnings from static code analysis

A static analysis tool reports that some callers of symbol_list_n_get
might get NULL and not handle it properly.  This is not the case, yet
we can suppress this pattern.

Reported by Mike Sullivan.
<https://lists.gnu.org/archive/html/bug-bison/2013-12/msg00027.html>

* src/symlist.c (symbol_list_n_get): Actually it is never called
to return 0.  Enforce this postcondition via aver.
(symbol_list_n_type_name_get): Simplify accordingly.  In particular,
discards a (translated) useless error message.
* src/symlist.h: Adjust documentation.
* src/scan-code.l: Style change.

9 years agoc++: fix the use of destructors when variants are enabled
Akim Demaille [Fri, 9 Jan 2015 11:01:22 +0000 (12:01 +0100)] 
c++: fix the use of destructors when variants are enabled

When using variants, destructors generate invalid code.
<http://lists.gnu.org/archive/html/bug-bison/2014-09/msg00005.html>
Reported by Michael Catanzaro.

* data/c++.m4 (~basic_symbol): b4_symbol_foreach works on yysym:
define it.
* tests/c++.at (Variants): Check it.

9 years agostyle: tests: simplify the handling of some C++ tests
Akim Demaille [Thu, 8 Jan 2015 13:03:09 +0000 (14:03 +0100)] 
style: tests: simplify the handling of some C++ tests

* tests/c++.at: here.
(Doxygen): Pass %define, so that files such as position.hh etc.
are generated, instead of putting everything into input.hh.

9 years agoc++: symbols can be empty, so use it
Akim Demaille [Thu, 8 Jan 2015 12:37:16 +0000 (13:37 +0100)] 
c++: symbols can be empty, so use it

The previous patches ensure that symbols (symbol_type and
stack_symbol_type) can be empty, cleared, and their emptiness can be
checked.  Therefore, yyempty, which codes whether yyla is empty or
not, is now useless.

In C skeletons (e.g., yacc.c), the fact that the lookahead is empty is
coded by "yychar = YYEMPTY", which is exactly what this patch
restores, since yychar/yytoken corresponds to yyla.type.

* data/lalr1.cc (yyempty): Remove.
Rather, depend on yyla.empty ().

9 years agoc++: variants: don't leak the lookahead in error recovery
Akim Demaille [Thu, 8 Jan 2015 10:19:57 +0000 (11:19 +0100)] 
c++: variants: don't leak the lookahead in error recovery

During error recovery, when discarding the lookeahead, we don't
destroy it, which is caught by parse.assert assertions.

Reported by Antonio Silva Correia.
With an analysis and suggested patch from Michel d'Hooge.
<http://savannah.gnu.org/support/?108481>

* tests/c++.at (Variants): Strengthen the test to try syntax errors
with discarded lookahead.

9 years agoc++: provide a means to clear symbols
Akim Demaille [Thu, 8 Jan 2015 09:19:10 +0000 (10:19 +0100)] 
c++: provide a means to clear symbols

The symbol destructor is currently the only means to clear a symbol.
Unfortunately during error recovery we might have to clear the
lookahead, which is a local variable (yyla) that has not yet reached
its end of scope.

Rather that duplicating the code to destroy a symbol, or rather than
destroying and recreating yyla, let's provide a means to clear a
symbol.

Reported by Antonio Silva Correia, with an analysis from Michel d'Hooge.
<http://savannah.gnu.org/support/?108481>

* data/c++.m4, data/lalr1.cc (basis_symbol::clear, by_state::clear)
(by_type::clear): New.
(basic_symbol::~basic_symbol): Use clear.

9 years agoc++: clean up the handling of empty symbols
Akim Demaille [Thu, 8 Jan 2015 09:04:53 +0000 (10:04 +0100)] 
c++: clean up the handling of empty symbols

* data/c++.m4, data/lalr1.cc (yyempty_): Remove, replaced by...
(empty_symbol, by_state::empty_state): these.
(basic_symbol::empty): New.

9 years agoc++: comment and style changes
Akim Demaille [Thu, 8 Jan 2015 08:15:10 +0000 (09:15 +0100)] 
c++: comment and style changes

* data/c++.m4, data/lalr1.cc: More documentation.
Tidy.
* tests/c++.at (string_cast): Rename as...
(to_string): this C++11 name.

9 years agoc++: variants: comparing addresses of typeid.name() is undefined
Akim Demaille [Wed, 7 Jan 2015 09:24:53 +0000 (10:24 +0100)] 
c++: variants: comparing addresses of typeid.name() is undefined

Instead of storing and comparing pointers to names of types, store
pointers to the typeids, and compares the typeids.
Reported by Thomas Jahns.
<http://lists.gnu.org/archive/html/bug-bison/2014-03/msg00001.html>

* data/variant.hh (yytname_): Replace with...
(yytypeid_): this.

9 years agoc++: locations: complete the API and fix comments
Akim Demaille [Mon, 5 Jan 2015 17:20:28 +0000 (18:20 +0100)] 
c++: locations: complete the API and fix comments

There are no support for += between locations, and some comments are wrong.
Reported by Alexandre Duret-Lutz.

* data/location.cc: Fix.
* doc/bison.texi: Document.
* tests/c++.at: Check.

9 years agobuild: do not clean figure sources in make clean
Akim Demaille [Mon, 5 Jan 2015 13:31:44 +0000 (14:31 +0100)] 
build: do not clean figure sources in make clean

"make clean && make" fails in in-tree builds.

* doc/local.mk (CLEANDIRS): Replace with...
(CLEANFILES): this safer list of files to clean.

9 years agobuild: don't try to generate docs when cross-compiling
Akim Demaille [Fri, 29 Aug 2014 21:36:20 +0000 (00:36 +0300)] 
build: don't try to generate docs when cross-compiling

When cross-compiling don't run the generated bison to update the docs.
Reported by Aaro Koskinen.
<http://lists.gnu.org/archive/html/bison-patches/2014-03/msg00000.html>

* configure.ac (CROSS_COMPILING): New.
* doc/local.mk: Use it.

9 years agopackage: fix a reporter's name
Akim Demaille [Sun, 4 Jan 2015 16:57:30 +0000 (17:57 +0100)] 
package: fix a reporter's name

* THANKS, build-aux/git-log-fix: s/Bernd Edligner/Bernd Edlinger/.

9 years ago%union: fix the support for named %union
Akim Demaille [Sun, 4 Jan 2015 13:16:23 +0000 (14:16 +0100)] 
%union: fix the support for named %union

Bison supports a union tag, for obscure reasons.  But it does a poor
job at it, especially since Bison 3.0.
Reported by Stephen Cameron and Tobias Frost.

It did not ensure that the name was not given several times.  An easy
way to do this is to make the %union tag be handled as a %define
variable, as they cannot be defined several times.

Since Bison 3.0, the synclines were wrongly placed, resulting in
invalid code.  Addressing this issue, because of the way the union tag
was stored (as a code muscle), would have been tedious.  Unless we
rather define the %union tag as a %percent variable, whose synclines
are easier to manipulate.

So replace the b4_union_name muscle by the api.value.union.name
%define variable, document, and check.

* data/bison.m4: Make sure that api.value.union.name has a keyword value.
* data/c++.m4: Make sure that api.value.union.name is not defined.
* data/c.m4 (b4_union_name): No longer use it, use api.value.union.name.
* doc/bison.texi (%define Summary): Document it.
* src/parse-gram.y (union_name): No longer define b4_uion_name, but
api.value.union.name.
* tests/input.at (Redefined %union name): New.
* tests/synclines.at (%union name syncline): New.
* tests/types.at: Check named %unions.

9 years agopackage: bump to 2015
Akim Demaille [Sun, 4 Jan 2015 16:31:18 +0000 (17:31 +0100)] 
package: bump to 2015

Which also requires:

* gnulib: Update.

9 years agoflex: don't trust YY_USER_INIT
Akim Demaille [Wed, 31 Dec 2014 13:48:13 +0000 (14:48 +0100)] 
flex: don't trust YY_USER_INIT

Reported by Bernd Edligner and others.

* src/scan-gram.l: here.

9 years agoyacc.c: fix broken union when api.value.type=union and %defines are used
Akim Demaille [Wed, 31 Dec 2014 13:15:06 +0000 (14:15 +0100)] 
yacc.c: fix broken union when api.value.type=union and %defines are used

Reported by Rich Wilson.

* data/c.m4 (b4_symbol_type_register): Append to b4_union_members,
not b4_user_union_members.
The latter invokes the former, but it is the former which is reinitialized
to empty by b4_value_type_setup_union.
* tests/types.at: Check it.

This reveals another bug, this time in the case of glr.c parsers.

* data/glr.c: Generate the header file before the implementation file,
to be sure that the setup is run before what depends on it.

9 years agodoc: fix missing xref
Akim Demaille [Wed, 31 Dec 2014 11:49:39 +0000 (12:49 +0100)] 
doc: fix missing xref

Reported by xolodho.

* doc/bison.texi (Printer Decl): here.

9 years agognulib: update
Akim Demaille [Mon, 29 Dec 2014 15:09:28 +0000 (16:09 +0100)] 
gnulib: update

10 years agolocation: remove some ugly debugging code traces
Akim Demaille [Mon, 3 Feb 2014 14:03:03 +0000 (15:03 +0100)] 
location: remove some ugly debugging code traces

* data/location.cc: here.

10 years agobuild: use abort to pacify compiler errors
Akim Demaille [Mon, 3 Feb 2014 14:01:44 +0000 (15:01 +0100)] 
build: use abort to pacify compiler errors

clang, with -DNDEBUG and -Werror fails on some functions that might
lack a return.  This is because aver is just another assert, discarded
with -DNDEBUG.  So use abort.

* src/muscle-tab.c, src/scan-skel.l: here.

10 years agopackage: bump to 2014
Akim Demaille [Mon, 3 Feb 2014 14:26:25 +0000 (15:26 +0100)] 
package: bump to 2014

* AUTHORS, ChangeLog-2012, Makefile.am, NEWS, PACKAGING, README,
* README-alpha, README-hacking, THANKS, TODO, bootstrap.conf,
* build-aux/darwin11.4.0.valgrind, build-aux/local.mk,
* build-aux/update-b4-copyright,
* build-aux/update-package-copyright-year, cfg.mk, configure.ac,
* data/README, data/bison.m4, data/c++-skel.m4, data/c++.m4,
* data/c-like.m4, data/c-skel.m4, data/c.m4, data/glr.c, data/glr.cc,
* data/java-skel.m4, data/java.m4, data/lalr1.cc, data/lalr1.java,
* data/local.mk, data/location.cc, data/stack.hh, data/variant.hh,
* data/xslt/bison.xsl, data/xslt/xml2dot.xsl, data/xslt/xml2text.xsl,
* data/xslt/xml2xhtml.xsl, data/yacc.c, djgpp/Makefile.maint,
* djgpp/README.in, djgpp/config.bat, djgpp/config.sed,
* djgpp/config.site, djgpp/config_h.sed, djgpp/djunpack.bat,
* djgpp/local.mk, djgpp/subpipe.c, djgpp/subpipe.h,
* djgpp/testsuite.sed, doc/bison.texi, doc/local.mk, doc/refcard.tex,
* etc/README, etc/bench.pl.in, etc/local.mk,
* examples/calc++/calc++.test, examples/calc++/local.mk,
* examples/extexi, examples/local.mk, examples/mfcalc/local.mk,
* examples/mfcalc/mfcalc.test, examples/rpcalc/local.mk,
* examples/rpcalc/rpcalc.test, examples/test, examples/variant.yy,
* lib/abitset.c, lib/abitset.h, lib/bbitset.h, lib/bitset.c,
* lib/bitset.h, lib/bitset_stats.c, lib/bitset_stats.h,
* lib/bitsetv-print.c, lib/bitsetv-print.h, lib/bitsetv.c,
* lib/bitsetv.h, lib/ebitset.c, lib/ebitset.h, lib/get-errno.c,
* lib/get-errno.h, lib/lbitset.c, lib/lbitset.h, lib/libiberty.h,
* lib/local.mk, lib/main.c, lib/timevar.c, lib/timevar.def,
* lib/timevar.h, lib/vbitset.c, lib/vbitset.h, lib/yyerror.c,
* m4/bison-i18n.m4, m4/c-working.m4, m4/cxx.m4, m4/flex.m4,
* m4/timevar.m4, src/AnnotationList.c, src/AnnotationList.h,
* src/InadequacyList.c, src/InadequacyList.h, src/LR0.c, src/LR0.h,
* src/Sbitset.c, src/Sbitset.h, src/assoc.c, src/assoc.h,
* src/closure.c, src/closure.h, src/complain.c, src/complain.h,
* src/conflicts.c, src/conflicts.h, src/derives.c, src/derives.h,
* src/files.c, src/files.h, src/flex-scanner.h, src/getargs.c,
* src/getargs.h, src/gram.c, src/gram.h, src/graphviz.c,
* src/graphviz.h, src/ielr.c, src/ielr.h, src/lalr.c, src/lalr.h,
* src/local.mk, src/location.c, src/location.h, src/main.c,
* src/muscle-tab.c, src/muscle-tab.h, src/named-ref.c,
* src/named-ref.h, src/nullable.c, src/nullable.h, src/output.c,
* src/output.h, src/parse-gram.c, src/parse-gram.y, src/print-xml.c,
* src/print-xml.h, src/print.c, src/print.h, src/print_graph.c,
* src/print_graph.h, src/reader.c, src/reader.h, src/reduce.c,
* src/reduce.h, src/relation.c, src/relation.h, src/scan-code.h,
* src/scan-code.l, src/scan-gram.h, src/scan-gram.l, src/scan-skel.h,
* src/scan-skel.l, src/state.c, src/state.h, src/symlist.c,
* src/symlist.h, src/symtab.c, src/symtab.h, src/system.h,
* src/tables.c, src/tables.h, src/uniqstr.c, src/uniqstr.h,
* tests/actions.at, tests/atlocal.in, tests/bison.in, tests/c++.at,
* tests/calc.at, tests/conflicts.at, tests/cxx-type.at,
* tests/existing.at, tests/glr-regression.at, tests/headers.at,
* tests/input.at, tests/java.at, tests/javapush.at, tests/local.at,
* tests/local.mk, tests/named-refs.at, tests/output.at, tests/push.at,
* tests/reduce.at, tests/regression.at, tests/sets.at,
* tests/skeletons.at, tests/synclines.at, tests/testsuite.at,
* tests/torture.at, tests/types.at:
here.

10 years agodoc: specify documentation encoding
Paul Eggert [Fri, 3 Jan 2014 19:02:58 +0000 (11:02 -0800)] 
doc: specify documentation encoding

* doc/bison.texi: Add '@documentencoding UTF-8'; needed since the
manual contains UTF-8 characters.  This will cause the .info files
to contain UTF-8 quotes and the like, which should be OK nowadays.
Add @documentlanguage while we're at it.

10 years agopackage: install the examples
Akim Demaille [Mon, 9 Dec 2013 15:29:05 +0000 (16:29 +0100)] 
package: install the examples

Currently, we do not install the various examples extracted from the
documentation.  Let's do it, as they are useful starting points.

* configure.ac: When --enable-gcc-warnings is set, enable ENABLE_GCC_WARNINGS.
* examples/extexi: No longer issue synclines by default.
* examples/local.mk: Except if ENABLE_GCC_WARNINGS.
* examples/calc++/local.mk, examples/mfcalc/local.mk,
* examples/rpcalc/local.mk: Install the example files.

10 years agopackage: install README and the like in docdir
Akim Demaille [Mon, 9 Dec 2013 15:14:15 +0000 (16:14 +0100)] 
package: install README and the like in docdir

* Makefile.am: here.

10 years agodiagnostics: fix the order of multiple declarations reports
Akim Demaille [Mon, 9 Dec 2013 14:26:52 +0000 (15:26 +0100)] 
diagnostics: fix the order of multiple declarations reports

On

  %token FOO "foo"
  %printer {} "foo"
  %printer {} FOO

we report

  /tmp/foo.yy:2.10-11: error: %printer redeclaration for FOO
   %printer {} "foo"
            ^^
  /tmp/foo.yy:3.10-11:     previous declaration
   %printer {} FOO
            ^^

* src/symtab.c (locations_sort): New.
Use it.
* tests/input.at (Invalid Aliases): Stress the order of diagnostics.

10 years agosymbol: provide an easy means to compare them in source order
Akim Demaille [Mon, 9 Dec 2013 14:40:07 +0000 (15:40 +0100)] 
symbol: provide an easy means to compare them in source order

* src/symtab.c (symbols_sort): New.
(user_token_number_redeclaration): Taken from here.

10 years agomaint: post-release administrivia
Akim Demaille [Thu, 5 Dec 2013 14:16:28 +0000 (15:16 +0100)] 
maint: post-release administrivia

* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.

10 years agoversion 3.0.2 v3.0.2
Akim Demaille [Thu, 5 Dec 2013 13:58:22 +0000 (14:58 +0100)] 
version 3.0.2

* NEWS: Record release date.

10 years agognulib: update
Akim Demaille [Thu, 5 Dec 2013 13:39:30 +0000 (14:39 +0100)] 
gnulib: update

* gnulib: here.

10 years agooutput: do not generate source files when late errors are caught
Akim Demaille [Wed, 4 Dec 2013 09:51:47 +0000 (10:51 +0100)] 
output: do not generate source files when late errors are caught

Reported by Alexandre Duret-Lutz as "second problem" in:
http://lists.gnu.org/archive/html/bug-bison/2013-09/msg00015.html

* bootstrap.conf: We need the "unlink" module.
* src/files.h, src/files.c (unlink_generated_sources): New.
* src/output.c: Use it.
* tests/output.at: Check the case of late errors.

10 years agooutput: record what generated files are source or report files
Akim Demaille [Wed, 4 Dec 2013 09:26:46 +0000 (10:26 +0100)] 
output: record what generated files are source or report files

* src/files.h, src/files.c (output_file_name_check): Take an additional
argument to record whether a file is a source or report file.
* src/files.c (generated_file): New.
(file_names, file_names_count): Replace with...
(generated_files, generated_files_size): these.
* src/scan-skel.l: Adjust.

10 years agooutput: do not generate source files when early errors are caught
Akim Demaille [Wed, 4 Dec 2013 08:30:08 +0000 (09:30 +0100)] 
output: do not generate source files when early errors are caught

Reported by Alexandre Duret-Lutz as "second problem" in:
http://lists.gnu.org/archive/html/bug-bison/2013-09/msg00015.html

One problem is that some errors are caught early, before the
generation of output files, while others can only be detected
afterwards (since, for instance, skeletons can raise errors
themselves).

This will be addressed in two steps: early errors do not generate
source files at all, while later errors will remove the files that
have already been generated.

* src/scan-skel.l (yyout): Open to /dev/null when there are errors.
* tests/output.at (AT_CHECK_FILES): Factored out of...
(AT_CHECK_OUTPUT): this.
Fuse the "SHELLIO" argument in the "FLAGS" one.
Use $5 to denote the expected exit status.
Add a test case for early errors.

10 years agoxml: also use "%empty" with html output
Akim Demaille [Tue, 26 Nov 2013 15:23:52 +0000 (16:23 +0100)] 
xml: also use "%empty" with html output

* data/xslt/xml2xhtml.xsl: No longer issue an Epsilon, display as in
dot and text formats.

10 years agostyle: formatting changes
Akim Demaille [Tue, 26 Nov 2013 15:20:55 +0000 (16:20 +0100)] 
style: formatting changes

* src/print-xml.c: here.

10 years agoxml: also display %empty for empty right-hand sides
Akim Demaille [Tue, 26 Nov 2013 15:20:52 +0000 (16:20 +0100)] 
xml: also display %empty for empty right-hand sides

* data/xslt/xml2dot.xsl, data/xslt/xml2text.xsl: Display %empty where needed.

10 years agoreports: display %empty in the generated pointed-rules
Akim Demaille [Tue, 26 Nov 2013 14:24:53 +0000 (15:24 +0100)] 
reports: display %empty in the generated pointed-rules

* src/print.c (print_core): Use %empty for empty rules.
* src/print_graph.c (print_core): Ditto.
* tests/conflicts.at, tests/output.at, tests/reduce.at: Adjust
expectations.

10 years agonews: YYERROR vs variants
Akim Demaille [Tue, 26 Nov 2013 14:31:33 +0000 (15:31 +0100)] 
news: YYERROR vs variants

11 years agostyle: scope reduction in lalr.cc
Akim Demaille [Mon, 18 Nov 2013 09:29:23 +0000 (10:29 +0100)] 
style: scope reduction in lalr.cc

* src/lalr.c: Shorten variable scopes.
(lookahead_tokens_print): Use the same variable name in two loops
iterating over the same structure.

11 years agolalr1.cc: formatting changes
Akim Demaille [Fri, 15 Nov 2013 09:10:41 +0000 (10:10 +0100)] 
lalr1.cc: formatting changes

* data/lalr1.cc: Fix indentation.

11 years agolalr1.cc: fix the support of YYERROR with variants
Akim Demaille [Fri, 15 Nov 2013 09:08:31 +0000 (10:08 +0100)] 
lalr1.cc: fix the support of YYERROR with variants

When variant are enabled, the yylhs variable (the left-hand side of
the rule being reduced, i.e. $$ and @$) is explicitly destroyed when
YYERROR is called.  This is because before running the user code, $$
is initialized, so that the user can properly use it.

However, when quitting yyparse, yylhs is also reclaimed by the C++
compiler: the variable goes out of scope.

Instead of trying to be too smart, let the compiler do its job: reduce
the scope of yylhs to exactly the reduction.  This way, whatever the
type of scope exit (regular, exception, return, goto...) this variable
will be properly reclaimed.

Reported by Paolo Simone Gasparello.
<http://lists.gnu.org/archive/html/bug-bison/2013-10/msg00003.html>

* data/lalr1.cc (yyparse): Reduce the scope of yylhs.
* tests/c++.at: We now pass this test.

11 years agotests: check $$'s destruction with variant, YYERROR, and no error recovery
Akim Demaille [Fri, 15 Nov 2013 08:43:01 +0000 (09:43 +0100)] 
tests: check $$'s destruction with variant, YYERROR, and no error recovery

When variant are enabled, the yylhs variable (the left-hand side of
the rule being reduced, i.e. $$ and @$) is explicitly destroyed when
YYERROR is called.  This is because before running the user code, $$
is initialized, so that the user can properly use it.

However, when quitting yyparse, yylhs is also reclaimed by the C++
compiler: the variable goes out of scope.

This was not detected by the test suite because (i) the Object tracker
was too weak, and (ii) the problem does not show when there is error
recovery.

Reported by Paolo Simone Gasparello.
<http://lists.gnu.org/archive/html/bug-bison/2013-10/msg00003.html>

* tests/c++.at (Exception safety): Improve the objects logger to make
sure that we never destroy twice an object.
Also track copy-constructors.
Use a set instead of a list.
Display the logs before running the function body, this is more
useful in case of failure.
Generalize to track with and without error recovery.

11 years agotests: simplify useless obfuscation
Akim Demaille [Thu, 14 Nov 2013 15:58:42 +0000 (16:58 +0100)] 
tests: simplify useless obfuscation

* tests/c++.at: $$ is not special for M4, there is no need to "escape"
it.

11 years agoskeletons: use better names when computing a "goto"
Akim Demaille [Thu, 14 Nov 2013 15:14:39 +0000 (16:14 +0100)] 
skeletons: use better names when computing a "goto"

* data/glr.c (yyLRgotoState): Name the symbol argument yysym, instead
of yylhs.
* data/lalr1.cc (yy_lr_goto_state_): Likewise.
* data/lalr1.java (yy_lr_goto_state_): New, modeled after the previous
two routines.
Use it.

11 years agomaint: post-release administrivia
Akim Demaille [Tue, 12 Nov 2013 17:37:14 +0000 (18:37 +0100)] 
maint: post-release administrivia

* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.

11 years agoversion 3.0.1 v3.0.1
Akim Demaille [Tue, 12 Nov 2013 14:55:33 +0000 (15:55 +0100)] 
version 3.0.1

* NEWS: Record release date.

11 years agoaver: it is no longer "protected against NDEBUG"
Akim Demaille [Tue, 12 Nov 2013 14:46:27 +0000 (15:46 +0100)] 
aver: it is no longer "protected against NDEBUG"

Apply the same rules for aver as for assert: no side effects,
especially not important ones.

* src/AnnotationList.c, src/muscle-tab.c: Adjust aver uses to resist
to -DNDEBUG.

11 years agoparsers: rename YY_NULL as YY_NULLPTR to avoid conflicts with Flex
Akim Demaille [Fri, 8 Nov 2013 09:52:15 +0000 (10:52 +0100)] 
parsers: rename YY_NULL as YY_NULLPTR to avoid conflicts with Flex

Flex also defines YY_NULL (to 0).  Avoid gratuitous conflicts.

* data/c.m4 (b4_null_define): Rename YY_NULL as YY_NULLPTR.

* data/glr.c, data/lalr1.cc, data/location.cc, data/variant.hh,
* data/yacc.c, src/parse-gram.c, tests/actions.at, tests/c++.at,
* tests/cxx-type.at, tests/glr-regression.at, tests/headers.at,
* tests/push.at, tests/regression.at:
Adjust.

11 years agobuild: use Automake 1.14's non-recursive Makefile features
Akim Demaille [Tue, 5 Nov 2013 13:32:20 +0000 (14:32 +0100)] 
build: use Automake 1.14's non-recursive Makefile features

* configure.ac: Require Automake 1.14.
* examples/calc++/local.mk, examples/local.mk, examples/mfcalc/local.mk,
* examples/rpcalc/local.mk, tests/local.mk: Use %D% and %C%.

11 years agobuild: restore maintainer-push-check
Akim Demaille [Tue, 5 Nov 2013 13:15:15 +0000 (14:15 +0100)] 
build: restore maintainer-push-check

* tests/local.mk: here.

11 years agoc++: use __attribute__((__pure__)) to avoid warnings
Akim Demaille [Wed, 23 Oct 2013 08:57:51 +0000 (10:57 +0200)] 
c++: use __attribute__((__pure__)) to avoid warnings

Building C++ parsers with -Wsuggest-attribute=const and
-Wsuggest-attribute=noreturn triggers warning in generated code.

* data/lalr1.cc: Call b4_attribute_define.
(debug_stream, debug_level): Flag as pure.
* tests/headers.at (Several parsers): There are now more YY macros
that "leak".

11 years agoskeletons: update the handling of compiler attributes
Akim Demaille [Wed, 23 Oct 2013 08:57:09 +0000 (10:57 +0200)] 
skeletons: update the handling of compiler attributes

* data/c.m4 (b4_attribute_define): Instead of defining __attribute__,
define YY_ATTRIBUTE conditionally.
(YY_ATTRIBUTE_PURE, YY_ATTRIBUTE_UNUSED, _Noreturn): New.
Use them.
* data/glr.c: Use them.

11 years agognulib: update
Akim Demaille [Wed, 23 Oct 2013 08:25:47 +0000 (10:25 +0200)] 
gnulib: update

11 years agostyle: use /* ... */ comments
Akim Demaille [Wed, 23 Oct 2013 13:03:45 +0000 (15:03 +0200)] 
style: use /* ... */ comments

* src/complain.c: Here.

11 years agotests: skip C++ tests that are too demanding for some compilers
Akim Demaille [Wed, 23 Oct 2013 13:04:15 +0000 (15:04 +0200)] 
tests: skip C++ tests that are too demanding for some compilers

Some tests now fail when compiled with G++ 4.3 or 4.4 on MacPorts.

* tests/local.at (AT_SKIP_IF_EXCEPTION_SUPPORT_IS_POOR): New.
* tests/c++.at (Exception safety): Use it.

11 years agoinstall: do not install yacc.1 when --disable-yacc
Akim Demaille [Tue, 22 Oct 2013 15:32:49 +0000 (17:32 +0200)] 
install: do not install yacc.1 when --disable-yacc

* configure.ac (ENABLE_YACC): New conditional.
(YACC_SCRIPT, YACC_LIBRARY): Remove.
* lib/local.mk, src/local.mk: Use the former instead of the latter.
* doc/local.mk: Use ENABLE_YACC to avoid installing yacc.1.

11 years agostyle: avoid tabs
Akim Demaille [Tue, 22 Oct 2013 14:43:17 +0000 (16:43 +0200)] 
style: avoid tabs

* src/scan-code.l: here.

11 years agoc++: fix generated doxygen comments
Akim Demaille [Tue, 22 Oct 2013 14:30:12 +0000 (16:30 +0200)] 
c++: fix generated doxygen comments

* configure.ac: Enable -Wdocumentation if supported.
* data/lalr1.cc: Fix comments.

11 years agofix: uniqstr are already pointers
Akim Demaille [Tue, 22 Oct 2013 14:29:22 +0000 (16:29 +0200)] 
fix: uniqstr are already pointers

* src/uniqstr.c (uniqstr_assert): Remove incorrect double indirection,
and now useless cast.

11 years agobison: pacify Sun C 5.12
Paul Eggert [Mon, 21 Oct 2013 22:21:32 +0000 (15:21 -0700)] 
bison: pacify Sun C 5.12

* src/scan-code.l (show_sub_message):
Redo initializations to work around a bogus Sun C 5.12 warning.
(parse_ref): Remove unreachable code that Sun C 5.12 complains about.
* src/uniqstr.h (uniqstr_vsprintf): Use
_GL_ATTRIBUTE_FORMAT_PRINTF (...)  instead of __attribute__
((__format__ (__printf__, ...))).  Otherwise, Sun C 5.12
complains about an unknown attribute.

11 years agomaint: git now ignores rpcalc
Paul Eggert [Mon, 21 Oct 2013 22:17:16 +0000 (15:17 -0700)] 
maint: git now ignores rpcalc

* examples/rpcalc/.gitignore: Ignore rpcalc.

11 years agobuild: examples/calc++/calc++ requires flex
Paul Eggert [Mon, 21 Oct 2013 22:16:43 +0000 (15:16 -0700)] 
build: examples/calc++/calc++ requires flex

* configure.ac (FLEX_CXX_WORKS): New AM_CONDITIONAL.
* examples/calc++/local.mk (examples/calc++/calc++):
Build if FLEX_CXX_WORKS, not BISON_CXX_WORKS.

11 years agomaint: mention help2man, texinfo, apt-get
Paul Eggert [Mon, 21 Oct 2013 22:13:52 +0000 (15:13 -0700)] 
maint: mention help2man, texinfo, apt-get

* README-hacking: Add help2man, texinfo.
Describe how to add packages if you're using Debian.

11 years agomaint: git now ignores .log and .trs files
Paul Eggert [Mon, 21 Oct 2013 22:12:13 +0000 (15:12 -0700)] 
maint: git now ignores .log and .trs files

* .gitignore: Add *.log, *.trs.

11 years agotests: fix incorrect object construction
Akim Demaille [Fri, 18 Oct 2013 14:22:23 +0000 (16:22 +0200)] 
tests: fix incorrect object construction

Reported by Ken Moffat.
http://lists.gnu.org/archive/html/bug-bison/2013-10/msg00009.html

* tests/c++.at (Exception safety): Here.

11 years agoglr: allow spaces between "%?" and "{" in predicates
Akim Demaille [Wed, 16 Oct 2013 13:19:44 +0000 (15:19 +0200)] 
glr: allow spaces between "%?" and "{" in predicates

Reported by Rici Lake.
http://lists.gnu.org/archive/html/bug-bison/2013-10/msg00004.html
http://stackoverflow.com/questions/19330171/

* src/scan-gram.l: Do not try to be too smart when diagnosing invalid
directives.
* tests/glr-regression.at (Predicates): New test.

11 years agodiagnostics: "-Werror -Wno-error=foo" must not emit errors
Akim Demaille [Wed, 16 Oct 2013 08:55:28 +0000 (10:55 +0200)] 
diagnostics: "-Werror -Wno-error=foo" must not emit errors

Currently "-Werror -Wno-error=foo" still turns "foo" warnings into errors.
Reported by Alexandre Duret-Lutz.
See http://lists.gnu.org/archive/html/bug-bison/2013-09/msg00015.html.

* src/complain.c (errority, errority_flag): New.
(complain_init): Initialize the latter.
(warning_argmatch): Extract the loop iterating on the flag's bits.
Set and unset errority_flag here.
(warnings_argmatch): -Wno-error is not the same as -Wno-error=everything:
we must remember if category foo was explicitly turned in an error/warning
via -W(no-)error=foo.
(warning_severity): Use errority_flag.

* tests/input.at (Symbols): Just check --yacc, not -Wyacc, that's the
job of tests on -W.
(-Werror is not affected by -Wnone and -Wall): Rename as...
(-Werror combinations): this.
Tests more combinations of -W, -W(no-)error, and -W(no-)error=foo.
* tests/local.at (AT_BISON_CHECK_WARNINGS): Don't expect -Werror
to turn runs that issue warnings into runs with errors, as the
warnings might be enforced as warnings by -Wno-error=foo, in which
case -Werror does not change anything.

* doc/bison.texi (Bison Options): Try to be clearer about how
-W(no-)error and -W(no-)error=foo interact.

11 years agocomment changes
Akim Demaille [Tue, 8 Oct 2013 11:01:24 +0000 (13:01 +0200)] 
comment changes

* src/complain.h, src/complain.c: More documentation, more comments.