platform/upstream/bison.git
11 years agoMerge remote-tracking branch 'origin/maint'
Akim Demaille [Thu, 29 Nov 2012 13:54:37 +0000 (14:54 +0100)]
Merge remote-tracking branch 'origin/maint'

* origin/maint:
  doc: minor fixes
  doc: improve the index
  doc: introduce api.pure full, rearrange some examples
  yacc.c: support "%define api.pure full"
  local.at: improvements

Conflicts:
NEWS
data/yacc.c
doc/bison.texi
tests/calc.at

11 years agodoc: minor fixes
Akim Demaille [Thu, 29 Nov 2012 13:35:48 +0000 (14:35 +0100)]
doc: minor fixes

* doc/bison.texi: Use stderr for error messages.
Meta-variables are usually spelled in lower case.
Use @code for function names.

11 years agodoc: improve the index
Akim Demaille [Thu, 29 Nov 2012 13:09:34 +0000 (14:09 +0100)]
doc: improve the index

* doc/bison.texi: Fix uses of "deffn" so that the arguments of the
directives do not show in the index.
Remove a duplicate entry for api.pure.

11 years agodoc: introduce api.pure full, rearrange some examples
Theophile Ranquet [Mon, 26 Nov 2012 17:17:15 +0000 (18:17 +0100)]
doc: introduce api.pure full, rearrange some examples

* NEWS: Add entry.
* doc/bison.texi (%define Summary): Show the old Yacc behaviour.
(Parser Function): Move parse-param examples here.
(Pure Calling): Remove parse-param examples.
(Error Reporting): Don't show the old behavior, stick to 'full'.

11 years agoyacc.c: support "%define api.pure full"
Theophile Ranquet [Fri, 23 Nov 2012 17:30:47 +0000 (17:30 +0000)]
yacc.c: support "%define api.pure full"

This makes the interface for yyerror() pure without the need for a spurious
parse_param.

* data/yacc.c (b4_pure_if, b4_pure_flag): New definition, accept three states.
(b4_yacc_pure_if): Rename as...
(b4_yyerror_arg_loc_if): This, and use b4_pure_flag.
* tests/actions.at (%define api.pure): Modernize.
* test/calc.at (Simple LALR Calculator): Modernize.
* tests/local.at (AT_YYERROR_ARG_LOC_IF): Adjust.

11 years agotests: check variants without locations
Akim Demaille [Wed, 28 Nov 2012 09:51:45 +0000 (10:51 +0100)]
tests: check variants without locations

* tests/c++.at (Variants): Support non-use of locations, and
check its support.

11 years agolocal.at: improvements
Theophile Ranquet [Fri, 23 Nov 2012 16:23:27 +0000 (16:23 +0000)]
local.at: improvements

* tests/local.at (AT_YYERROR_FORMALS): Make llocp const.
(AT_PURE_AND_LOC_IF, AT_GLR_OR_PARAM_IF): Remove, expand...
(AT_YYERROR_ARG_LOC_IF): Here, and use m4_join for readability.

11 years agotests: use -fno-strict-aliasing with variants
Akim Demaille [Mon, 26 Nov 2012 09:42:49 +0000 (10:42 +0100)]
tests: use -fno-strict-aliasing with variants

Reported by Théophile Ranquet.

* configure.ac (NO_STRICT_ALIAS_CXXFLAGS): New.
* tests/c++.at, tests/atlocal.in, examples/local.mk: Use it.

11 years agotests: remove leftover
Akim Demaille [Mon, 26 Nov 2012 09:42:43 +0000 (10:42 +0100)]
tests: remove leftover

* tests/atlocal.in: Remove duplicate handling of --compile-c-with-cxx.

11 years agodoc: use %precedence instead of nonassoc when associativity is not wanted
Akim Demaille [Mon, 26 Nov 2012 08:49:23 +0000 (09:49 +0100)]
doc: use %precedence instead of nonassoc when associativity is not wanted

* doc/bison.texi: here.
Formatting changes in some grammars.
Fix a %prec into %precedence.

11 years agoMerge remote-tracking branch 'origin/maint'
Akim Demaille [Mon, 26 Nov 2012 08:14:51 +0000 (09:14 +0100)]
Merge remote-tracking branch 'origin/maint'

* origin/maint:
  yacc.c: always initialize yylloc
  scanner: issue a single error for groups of invalid characters
  tests: formatting changes
  doc: one of the fixes for an ambiguous grammar was ambiguous too
  doc: fix the dangling else with precedence directives
  doc: prefer "token" to TOKEN
  doc: formatting changes
  scanner: use explicit "ignore" statements

Conflicts:
src/scan-gram.l

11 years agoMerge remote-tracking branch 'origin/branch-2.6' into maint
Akim Demaille [Mon, 26 Nov 2012 08:05:28 +0000 (09:05 +0100)]
Merge remote-tracking branch 'origin/branch-2.6' into maint

* origin/branch-2.6:
  yacc.c: always initialize yylloc
  doc: one of the fixes for an ambiguous grammar was ambiguous too
  doc: fix the dangling else with precedence directives
  doc: prefer "token" to TOKEN
  doc: formatting changes

Conflicts:
NEWS
doc/bison.texi

11 years agoyacc.c: always initialize yylloc
Theophile Ranquet [Mon, 19 Nov 2012 10:43:56 +0000 (10:43 +0000)]
yacc.c: always initialize yylloc

The initial location might be used if the parser starts by an empty
reduction, so really ensure proper initialization of the initial
location.  The previous approach fails for PostgreSQL, which uses
Reported by Peter Eisentraut.
http://lists.gnu.org/archive/html/bug-bison/2012-11/msg00023.html
With help from Théophile Ranquet.

* data/yacc.c (b4_declare_scanner_communication_variables): Be sure
to initialize yylloc, even when its structure is unknown.
(yyparse): Simplify the call to b4_dollar_pushdef.
* tests/actions.at (Initial location): Check of similar pattern
as in the case of PostgreSQL.

11 years agoscanner: issue a single error for groups of invalid characters
Akim Demaille [Fri, 23 Nov 2012 10:21:47 +0000 (11:21 +0100)]
scanner: issue a single error for groups of invalid characters

* src/scan-gram.l: Scan groups of invalid characters together.
* tests/input.at, tests/named-refs.at: Adjust.

11 years agotests: formatting changes
Akim Demaille [Fri, 23 Nov 2012 09:11:50 +0000 (10:11 +0100)]
tests: formatting changes

* tests/named-refs.at: Here.

11 years agodoc: one of the fixes for an ambiguous grammar was ambiguous too
Akim Demaille [Thu, 22 Nov 2012 14:49:18 +0000 (15:49 +0100)]
doc: one of the fixes for an ambiguous grammar was ambiguous too

Reported by Аскар Сафин.
http://lists.gnu.org/archive/html/bug-bison/2012-11/msg00024.html

* doc/bison.texi (Reduce/Reduce): Fix the resulting ambiguity using
precedence/associativity directives.

11 years agodoc: fix the dangling else with precedence directives
Akim Demaille [Thu, 22 Nov 2012 14:16:07 +0000 (15:16 +0100)]
doc: fix the dangling else with precedence directives

* doc/bison.texi (Non Operators): New node.
(Shift/Reduce): Point to it.
Don't promote "%expect n" too much.

11 years agodoc: prefer "token" to TOKEN
Akim Demaille [Thu, 22 Nov 2012 14:12:24 +0000 (15:12 +0100)]
doc: prefer "token" to TOKEN

This is more readable in short examples.

* doc/bison.texi (Shift/Reduce): here.
Make "win" and "lose" action more alike.

11 years agodoc: formatting changes
Akim Demaille [Thu, 22 Nov 2012 13:24:54 +0000 (14:24 +0100)]
doc: formatting changes

* doc/bison.texi: Use @group.

12 years agoscanner: use explicit "ignore" statements
Akim Demaille [Wed, 14 Nov 2012 09:57:45 +0000 (10:57 +0100)]
scanner: use explicit "ignore" statements

* src/scan-gram.l: here.

12 years agoMerge remote-tracking branch 'origin/maint'
Akim Demaille [Tue, 13 Nov 2012 09:59:55 +0000 (10:59 +0100)]
Merge remote-tracking branch 'origin/maint'

* origin/maint:
  tests: close files in glr-regression
  xml: match DOT output and xml2dot.xsl processing
  xml: factor xslt space template
  graph: fix a memory leak
  xml: documentation
  output: capitalize State

12 years agotests: close files in glr-regression
Theophile Ranquet [Mon, 12 Nov 2012 15:41:52 +0000 (15:41 +0000)]
tests: close files in glr-regression

* tests/glr-regression.at: Here.

12 years agoxml: match DOT output and xml2dot.xsl processing
Theophile Ranquet [Tue, 23 Oct 2012 15:43:54 +0000 (15:43 +0000)]
xml: match DOT output and xml2dot.xsl processing

Make the DOT produced by XSLT processing equivalent to the one made with the
--graph option.

* data/xslt/xml2dot.xsl: Stylistic changes, and add support for reductions.
* doc/bison.texi (Xml): Update.
* src/graphviz.c (conclude_red): Minor stylistic changes to DOT internals.
(output_red): Swap enabled and disabled reductions output, for coherence
with XSLT output.
* src/print_graph.c (print_core): Minor stylistic change to States' output.
(print_actions): Swap order of output for reductions and transitions.
* tests/local.at (AT_BISON_CHECK_XML): Ignore differences in order.
* tests/output.at: Adjust to changes in DOT internals.

12 years agoxml: factor xslt space template
Theophile Ranquet [Wed, 7 Nov 2012 09:54:06 +0000 (09:54 +0000)]
xml: factor xslt space template

* data/xslt/bison.xsl (space): New, import from...
* data/xslt/xml2text.xsl: Here.

12 years agograph: fix a memory leak
Theophile Ranquet [Fri, 9 Nov 2012 16:40:45 +0000 (16:40 +0000)]
graph: fix a memory leak

* src/graphviz.c (output_red): Here.

12 years agoxml: documentation
Theophile Ranquet [Mon, 22 Oct 2012 17:37:57 +0000 (17:37 +0000)]
xml: documentation

The XML output combined with the XSL Transformations provided in data/ are
incredibly useful, they should be documented.

* doc/bison.texi (Xml): New node.

12 years agooutput: capitalize State
Theophile Ranquet [Thu, 18 Oct 2012 12:02:05 +0000 (12:02 +0000)]
output: capitalize State

* src/print.c (print_state): Here.
* tests/conflicts.at, tests/existing.at, tests/local.at, tests/reduce.at,
tests/regression.at, tests/sets.at: Adjust.

12 years agotests: fix syntax-check errors
Akim Demaille [Mon, 12 Nov 2012 08:49:49 +0000 (09:49 +0100)]
tests: fix syntax-check errors

Reported by Théophile Ranquet.

* tests/c++.at: Use AT_PARSER_CHECK.
Avoid using "strcmp", which triggers an error from syntax-check.

12 years agoMerge remote-tracking branch 'origin/maint'
Akim Demaille [Mon, 12 Nov 2012 08:45:30 +0000 (09:45 +0100)]
Merge remote-tracking branch 'origin/maint'

* origin/maint:
  maint: address syntax-check errors.
  tests: use valgrind where appropriate
  tests: use valgrind where appropriate
  tests: don't expect $EGREP to support -w
  tests: more possible error compiler messages for "#error"

Conflicts:
cfg.mk
tests/headers.at

12 years agomaint: address syntax-check errors.
Akim Demaille [Mon, 12 Nov 2012 08:39:41 +0000 (09:39 +0100)]
maint: address syntax-check errors.

* cfg.mk: Ignore the "error" call in tests/c++.at, it is not to be
translated.
* doc/bison.texi: Fix incorrect @pxref use.
* po/POTFILES.in: Add missing file.
* src/print_graph.c: Remove useless include.

12 years agotests: use valgrind where appropriate
Akim Demaille [Mon, 12 Nov 2012 08:33:26 +0000 (09:33 +0100)]
tests: use valgrind where appropriate

Reported by Théophile Ranquet.

* cfg.mk (sc_at_parser_check): New.
* tests/c++.at: Fix use of AT_CHECK vs. AT_PARSER_CHECK.

12 years agoMerge remote-tracking branch 'origin/branch-2.6' into maint
Akim Demaille [Mon, 12 Nov 2012 08:06:55 +0000 (09:06 +0100)]
Merge remote-tracking branch 'origin/branch-2.6' into maint

* origin/branch-2.6:
  tests: use valgrind where appropriate
  tests: don't expect $EGREP to support -w

12 years agotests: use valgrind where appropriate
Akim Demaille [Sat, 10 Nov 2012 08:26:40 +0000 (09:26 +0100)]
tests: use valgrind where appropriate

Reported by Théophile Ranquet.

* tests/glr-regression.at: Rewrite some test cases so that AT_PARSER_CHECK,
which runs valgrind, is exposed with the parser, not with "echo".
* tests/local.at, tests/regression.at, tests/headers.at:
Use AT_PARSER_CHECK for generated parsers.

12 years agotests: don't expect $EGREP to support -w
Akim Demaille [Thu, 8 Nov 2012 18:34:29 +0000 (19:34 +0100)]
tests: don't expect $EGREP to support -w

Does not work on Solaris 10.  Reported by Dennis Clarke.
http://lists.gnu.org/archive/html/bug-bison/2012-11/msg00009.html
* tests/headers.at (Several parsers): Use Perl instead.
While at it, run it only once, on all the generated headers.
Adjust to YY_NULL be defined in position.hh.

12 years agotests: more possible error compiler messages for "#error"
Akim Demaille [Thu, 8 Nov 2012 09:25:15 +0000 (10:25 +0100)]
tests: more possible error compiler messages for "#error"

* tests/synclines.at (AT_SYNCLINES_COMPILE): Adjust for Clang.
Verified with GCC 4.0, 4.2 to 4.8, and Clang 2.9, 3.2: none skip.

12 years agoregen
Akim Demaille [Thu, 8 Nov 2012 08:35:59 +0000 (09:35 +0100)]
regen

12 years agoMerge branch 'maint'
Akim Demaille [Thu, 8 Nov 2012 08:24:51 +0000 (09:24 +0100)]
Merge branch 'maint'

* origin/maint:
  regen
  maint: post-release administrivia
  version 2.6.5
  regen
  tests: syntax-check
  tests: beware of compilers that do not support POSIXLY_CORRECT
  gnulib: update

Conflicts:
src/parse-gram.c
src/parse-gram.h
tests/atlocal.in

12 years agoregen
Akim Demaille [Thu, 8 Nov 2012 08:22:58 +0000 (09:22 +0100)]
regen

12 years agoMerge branch 'branch-2.6' into maint
Akim Demaille [Thu, 8 Nov 2012 08:20:48 +0000 (09:20 +0100)]
Merge branch 'branch-2.6' into maint

* origin/branch-2.6:
  maint: post-release administrivia
  version 2.6.5
  regen
  tests: syntax-check
  tests: beware of compilers that do not support POSIXLY_CORRECT
  gnulib: update

Conflicts:
NEWS
src/parse-gram.c
src/parse-gram.h

12 years agomaint: post-release administrivia
Akim Demaille [Wed, 7 Nov 2012 17:35:36 +0000 (18:35 +0100)]
maint: post-release administrivia

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

12 years agoversion 2.6.5 v2.6.5
Akim Demaille [Wed, 7 Nov 2012 17:09:46 +0000 (18:09 +0100)]
version 2.6.5

* NEWS: Record release date.

12 years agoregen
Akim Demaille [Wed, 7 Nov 2012 16:33:14 +0000 (17:33 +0100)]
regen

12 years agotests: syntax-check
Akim Demaille [Wed, 7 Nov 2012 16:31:32 +0000 (17:31 +0100)]
tests: syntax-check

* tests/actions.at: Fix typo.

12 years agotests: beware of compilers that do not support POSIXLY_CORRECT
Akim Demaille [Wed, 7 Nov 2012 16:23:06 +0000 (17:23 +0100)]
tests: beware of compilers that do not support POSIXLY_CORRECT

Running "maintainer-release-check" on OS X with Clang 2.9 fails,
because "clang-mp-2.9 -o test -g test.c" launches "/usr/bin/dsymutil
test -o test.dSYM" which fails with "error: unable to open executable
'-o'".

* m4/c-working.m4 (BISON_CHECK_WITH_POSIXLY_CORRECT)
(BISON_C_COMPILER_POSIXLY_CORRECT): New.
* configure.ac: Use the latter.
* tests/atlocal.in (POSIXLY_CORRECT_IS_EXPORTED): New.
* tests/local.at (AT_BISON_CHECK_WARNINGS_): Use it instead of computing its
value each time.
(AT_QUELL_VALGRIND): Skip tests that cannot work because of compilers
that do not support POSIXLY_CORRECT.

12 years agognulib: update
Akim Demaille [Wed, 7 Nov 2012 11:46:30 +0000 (12:46 +0100)]
gnulib: update

12 years agoMerge remote-tracking branch 'origin/maint'
Akim Demaille [Tue, 6 Nov 2012 17:23:47 +0000 (18:23 +0100)]
Merge remote-tracking branch 'origin/maint'

* origin/maint: (24 commits)
  tests: calc: modernize the use of locations
  tests: remove useless location initializations
  lalr1.cc: always initialize yylval.
  tests: check that C and C++ objects can be linked together.
  yacc.c: also disable -Wuninitialized.
  glr.cc, yacc.c: initialize yylloc properly
  yacc.c, glr.c: a better YY_LOCATION_PRINT
  yacc.c: simplify initialization
  doc: formatting changes
  c++: fix position operator signatures
  tests: remove useless location initialization.
  tests: fix locations in C
  tests: handle %parse-param in the generated yyerror
  tests: simplifications
  grammars: fix display of nul character in error message
  tests: sort
  tests: cosmetic changes
  comment changes
  autoconf: update
  gnulib: update
  ...

Conflicts:
data/lalr1.cc
gnulib
src/scan-gram.l
submodules/autoconf
tests/calc.at

12 years agoMerge branch 'branch-2.6' into maint
Akim Demaille [Tue, 6 Nov 2012 17:00:33 +0000 (18:00 +0100)]
Merge branch 'branch-2.6' into maint

* origin/branch-2.6: (24 commits)
  tests: calc: modernize the use of locations
  tests: remove useless location initializations
  lalr1.cc: always initialize yylval.
  tests: check that C and C++ objects can be linked together.
  yacc.c: also disable -Wuninitialized.
  glr.cc, yacc.c: initialize yylloc properly
  yacc.c, glr.c: a better YY_LOCATION_PRINT
  yacc.c: simplify initialization
  doc: formatting changes
  c++: fix position operator signatures
  tests: remove useless location initialization.
  tests: fix locations in C
  tests: handle %parse-param in the generated yyerror
  tests: simplifications
  grammars: fix display of nul character in error message
  tests: sort
  tests: cosmetic changes
  comment changes
  autoconf: update
  gnulib: update
  ...

Conflicts:
NEWS
gnulib
tests/named-refs.at
tests/regression.at

12 years agotests: calc: modernize the use of locations
Akim Demaille [Tue, 6 Nov 2012 15:25:37 +0000 (16:25 +0100)]
tests: calc: modernize the use of locations

* tests/calc.at: Don't initialize the location, let the parser
do it.
Use a $printer.
Change some testing input to be easier to distinguish (instead of always
"0 0" for instance).

12 years agotests: remove useless location initializations
Akim Demaille [Tue, 6 Nov 2012 14:42:50 +0000 (15:42 +0100)]
tests: remove useless location initializations

* tests/actions.at, tests/calc.at: here.

12 years agolalr1.cc: always initialize yylval.
Akim Demaille [Thu, 1 Nov 2012 14:38:25 +0000 (15:38 +0100)]
lalr1.cc: always initialize yylval.

* data/lalr1.cc: here.

12 years agotests: check that C and C++ objects can be linked together.
Akim Demaille [Tue, 6 Nov 2012 14:35:37 +0000 (15:35 +0100)]
tests: check that C and C++ objects can be linked together.

* tests/local.at (AT_SKIP_IF_CANNOT_LINK_C_AND_CXX): New.
* tests/headers.at (Several parsers): Use it.

12 years agoyacc.c: also disable -Wuninitialized.
Akim Demaille [Tue, 6 Nov 2012 14:34:56 +0000 (15:34 +0100)]
yacc.c: also disable -Wuninitialized.

* data/yacc.c (YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN): For some versions
of GCC, -Wmaybe-uninitialized alone does not suffice.

12 years agoglr.cc, yacc.c: initialize yylloc properly
Akim Demaille [Tue, 6 Nov 2012 14:34:51 +0000 (15:34 +0100)]
glr.cc, yacc.c: initialize yylloc properly

There are several issues to address here.  One is that yylloc should
be initialized when possible.  Another is that the push parser needs
to update yypushed_loc when the user modified it.  And if the parser
starts by a reduction of an empty, it uses the first location on the
stack, which, therefore, must also be initialized to this initial
location.

This is getting complex, especially since because initializing a
global (impure interface) is different from initializing a local
variable.  To simplify, the local yylloc is not initialized during its
definition.

* data/c.m4 (b4_yyloc_default_define): Replace by...
(b4_yyloc_default): this.
Adjust dependencies.
* data/glr.cc: Initialize yylloc.
* data/yacc.c (b4_declare_scanner_communication_variables):
Initialize yylloc during its definition.
Don't define yyloc_default.
(yypush_parse): The location formal is not const, as we might
initialize it.
(yyparse): Define yyloc_default.
Use it before running the user initial action.
Possibly update the first location on the stack, and the pushed
location after the user initial action.
* tests/actions.at (Initial locations): Check that the initial
location is correct.

12 years agoyacc.c, glr.c: a better YY_LOCATION_PRINT
Akim Demaille [Mon, 5 Nov 2012 15:58:24 +0000 (16:58 +0100)]
yacc.c, glr.c: a better YY_LOCATION_PRINT

* data/c.m4 (b4_yy_location_print_define): New.
Now issues "short" locations, e.g., "1.1" instead of "1.1-1.1".
Was initially a function, but then we face "static but unused"
warnings.
Simpler as a macro.
* tests/local.at, data/glr.c, data/yacc.c: Use it instead of duplicating.
* tests/actions.at: Adjust expectations.

12 years agoyacc.c: simplify initialization
Akim Demaille [Mon, 5 Nov 2012 14:19:45 +0000 (15:19 +0100)]
yacc.c: simplify initialization

* data/yacc.c: Fuse the initializations of yyssp, yyss and the like.
Remove an obsolete comment: we do initialize these initial stack
members (in some cases).

12 years agodoc: formatting changes
Akim Demaille [Sat, 3 Nov 2012 16:52:13 +0000 (17:52 +0100)]
doc: formatting changes

* doc/bison.texi: In a pointer type.

12 years agoc++: fix position operator signatures
Akim Demaille [Sat, 3 Nov 2012 15:22:15 +0000 (16:22 +0100)]
c++: fix position operator signatures

* data/location.cc (operator+=, operator-=): Remove const from return
type.

12 years agotests: remove useless location initialization.
Akim Demaille [Sat, 3 Nov 2012 16:29:07 +0000 (17:29 +0100)]
tests: remove useless location initialization.

* tests/glr-regression.at: here.
glr.c does initialize yylloc.

12 years agotests: fix locations in C
Akim Demaille [Sat, 3 Nov 2012 16:15:43 +0000 (17:15 +0100)]
tests: fix locations in C

* tests/local.at (AT_YYERROR_DEFINE): Don't display the end of the location
if it is not after its beginning.
* tests/actions.at, tests/cxx-type.at: Adjust the expected output.

12 years agotests: handle %parse-param in the generated yyerror
Akim Demaille [Sat, 3 Nov 2012 09:05:03 +0000 (10:05 +0100)]
tests: handle %parse-param in the generated yyerror

* tests/local.at (AT_PARSE_PARAMS): New.
(AT_YYERROR_FORMALS, AT_YYERROR_DEFINE): Use it to add the parse-param
to yyerror.
* tests/calc.at, tests/regression.at: Use AT_YYERROR_DEFINE and
AT_YYERROR_DECLARE, now that they handle properly the parse-params.
Be sure to let AT_BISON_OPTION_PUSHDEFS now what parse-params are used.

12 years agotests: simplifications
Akim Demaille [Fri, 2 Nov 2012 17:20:56 +0000 (18:20 +0100)]
tests: simplifications

* tests/actions.at (Exotic Dollars): Formatting changes.
Use AT_FULL_COMPILE.
(AT_CHECK_PRINTER_AND_DESTRUCTOR): Remove useless initialization of @$.

12 years agolalr1.cc: rename lex_symbol as api.token.constructor
Akim Demaille [Thu, 1 Nov 2012 16:54:13 +0000 (17:54 +0100)]
lalr1.cc: rename lex_symbol as api.token.constructor

* data/bison.m4 (b4_lex_symbol_if): Rename as...
(b4_token_ctor_if): this.
Depend upon api.token.constructor.
* data/c++.m4, data/lalr1.cc: Adjust.
* doc/bison.texi: Fix all the occurrences of lex_symbol.
* etc/bench.pl.in: Adjust.
* examples/variant.yy: Likewise.

* tests/local.at (AT_BISON_OPTION_PUSHDEFS, AT_BISON_OPTION_POPDEFS):
Handle AT_TOKEN_CTOR_IF.
* tests/c++.at: Adjust to using api.token.constructor and AT_TOKEN_CTOR_IF.
Simplify the test of both build call styles.
(AT_CHECK_VARIANTS): Rename as...
(AT_TEST): this.
And undef when done.

12 years agoexamples: simplify/improve
Akim Demaille [Thu, 1 Nov 2012 16:52:41 +0000 (17:52 +0100)]
examples: simplify/improve

* examples/variant.yy: Put yylex in yy::, and simplify accordingly.
Minor formatting changes.

12 years agobison.m4: support b4_*_if macros whose name differ from their variable
Akim Demaille [Thu, 1 Nov 2012 16:50:37 +0000 (17:50 +0100)]
bison.m4: support b4_*_if macros whose name differ from their variable

* data/bison.m4 (b4_percent_define_if_define_, b4_percent_define_if_define):
Accept a second argument.

12 years agogrammars: fix display of nul character in error message
Akim Demaille [Thu, 1 Nov 2012 12:47:12 +0000 (13:47 +0100)]
grammars: fix display of nul character in error message

Reported by Marc Mendiola.
http://lists.gnu.org/archive/html/help-bison/2012-10/msg00017.html

* gnulib: Update to get quote_mem.
* src/scan-gram.l: Use it.
* tests/input.at (Invalid inputs): Additional checks.
* tests/named-refs.at: Likewise.

12 years agotests: sort
Akim Demaille [Thu, 1 Nov 2012 12:54:36 +0000 (13:54 +0100)]
tests: sort

* tests/regression.at (Invalid inputs, Invalid inputs with {}): Move to...
* tests/input.at: here, for consistency.

12 years agotests: cosmetic changes
Akim Demaille [Thu, 1 Nov 2012 15:11:13 +0000 (16:11 +0100)]
tests: cosmetic changes

* tests/actions.at (AT_CHECK_PRINTER_AND_DESTRUCTOR): Improve the
displayed title.

12 years agocomment changes
Akim Demaille [Thu, 1 Nov 2012 14:38:32 +0000 (15:38 +0100)]
comment changes

* data/lalr1.cc: here.

12 years agoautoconf: update
Akim Demaille [Thu, 1 Nov 2012 14:36:44 +0000 (15:36 +0100)]
autoconf: update

There are comment changes only in the files we use.

12 years agognulib: update
Akim Demaille [Thu, 1 Nov 2012 14:34:03 +0000 (15:34 +0100)]
gnulib: update

12 years agoregen
Akim Demaille [Fri, 26 Oct 2012 12:23:18 +0000 (14:23 +0200)]
regen

12 years agoyacc.c: initialize yylval and yylloc.
Akim Demaille [Fri, 26 Oct 2012 09:25:41 +0000 (11:25 +0200)]
yacc.c: initialize yylval and yylloc.

When generating a pure push parser, the initialization of yylval and
yylloc may not be visible to the compiler.  With warnings enabled, GCC
4.3.6, 4.4.7, 4.5.4, and 4.6.3 report uninitialized uses of
yylval/yylloc.  Using local pragmas to disable these warnings is not
supported before 4.6, and 4.6 does not support it properly.  So
initialize yylval and yylloc at their definition.  Reported by Peter
Simons.  See
http://lists.gnu.org/archive/html/bison-patches/2012-10/msg00133.html

* data/c.m4 (b4_yyloc_default_define): New.
* data/yacc.c: Use it when locations are requested.
(YYLVAL_INITIALIZE): Replace by...
(YY_INITIAL_VALUE): this.
(yyparse): Initialize yylloc and yylval.
Therefore, remove the initialization of yylloc's field.
* data/glr.c: Likewise.

12 years agographs: fix spacing refactoring
Theophile Ranquet [Fri, 26 Oct 2012 18:07:08 +0000 (18:07 +0000)]
graphs: fix spacing refactoring

* src/print_graph.c (print_lhs, print_core): Here.

12 years agotests: make deprecation tests more specific
Theophile Ranquet [Fri, 26 Oct 2012 17:54:56 +0000 (17:54 +0000)]
tests: make deprecation tests more specific

* tests/input.at (Deprecated directives): Here, don't generate unrelated errors
or warnings.

12 years agotests: fix AT_BISON_CHECK_WARNINGS_ stderr rewriting
Theophile Ranquet [Fri, 26 Oct 2012 16:11:08 +0000 (16:11 +0000)]
tests: fix AT_BISON_CHECK_WARNINGS_ stderr rewriting

* tests/input.at (Deprecated directives): Avoid spurious error.
* tests/locat.at (AT_BISON_CHECK_WARNINGS): Adjust for recent changes.

12 years agoscan-skel.l: consider m4 notes as related to "complaint" errors
Theophile Ranquet [Fri, 26 Oct 2012 18:13:44 +0000 (18:13 +0000)]
scan-skel.l: consider m4 notes as related to "complaint" errors

* src/scan-skel.l (flag): Here.

12 years agowarnings: distinguish context information based on warning type
Theophile Ranquet [Fri, 26 Oct 2012 18:13:27 +0000 (18:13 +0000)]
warnings: distinguish context information based on warning type

* src/scan-code.l (show_sub_message, show_sub_messages): Take a new warnings
argument.

12 years agowarnings: fix early exit of warnings treated as errors
Theophile Ranquet [Fri, 26 Oct 2012 18:12:53 +0000 (18:12 +0000)]
warnings: fix early exit of warnings treated as errors

Treating warnings as errors caused Bison to exit earlier than needed, making it
hide warnings that would have been printed had -Werror not been set.

Also, fix a bug that caused some context information of errors to not be
shown.

* src/complain.c (complaint_issued): Rename as...
(complaint_status): This, and change its type from boolean to
* src/complain.h (err_status): This, new enumeration.
* src/main.c (main): Adjust (only finish early if an actual complaint was
risen, not a mere warning treated an error).
* src/reader.c: Adjust.

12 years agotests: reindent for legibility
Theophile Ranquet [Thu, 25 Oct 2012 12:12:28 +0000 (12:12 +0000)]
tests: reindent for legibility

* tests/local.at (AT_BISON_CHECK_WARNINGS_): Here.

12 years agobuild: fix Texinfo compilation
Akim Demaille [Fri, 26 Oct 2012 15:04:55 +0000 (17:04 +0200)]
build: fix Texinfo compilation

* doc/local.mk: fix dependencies.

12 years agoregen
Akim Demaille [Fri, 26 Oct 2012 14:59:04 +0000 (16:59 +0200)]
regen

12 years agoMerge remote-tracking branch 'origin/maint'
Akim Demaille [Fri, 26 Oct 2012 14:50:26 +0000 (16:50 +0200)]
Merge remote-tracking branch 'origin/maint'

* origin/maint: (46 commits)
  doc: minor style change
  maint: use gendocs's new -I option
  regen
  yacc.c: do not define location support when not using locations
  maint: be compilable with GCC 4.0
  tests: address a warning from GCC 4.4
  tests: don't use options that Clang does not support
  tests: restore the tests on -Werror
  regen
  parse-gram: update the Bison interface
  fix comment
  maint: post-release administrivia
  version 2.6.4
  regen
  2.6.4: botched 2.6.3
  maint: post-release administrivia
  version 2.6.3
  gnulib: update
  tests: check %no-lines
  NEWS: warnings with clang
  ...

Conflicts:
NEWS
TODO
data/c.m4
data/java.m4
doc/Makefile.am
src/getargs.c
src/getargs.h
src/output.c
src/parse-gram.c
src/parse-gram.h
src/parse-gram.y
src/reader.h

12 years agoMerge branch 'branch-2.6' into maint
Akim Demaille [Fri, 26 Oct 2012 14:33:20 +0000 (16:33 +0200)]
Merge branch 'branch-2.6' into maint

* origin/branch-2.6:
  regen
  yacc.c: do not define location support when not using locations
  maint: be compilable with GCC 4.0
  tests: address a warning from GCC 4.4
  tests: don't use options that Clang does not support
  tests: restore the tests on -Werror
  regen
  parse-gram: update the Bison interface
  fix comment

12 years agodoc: minor style change
Akim Demaille [Wed, 24 Oct 2012 14:59:41 +0000 (16:59 +0200)]
doc: minor style change

* doc/figs/example-reduce.txt: here.

12 years agomaint: use gendocs's new -I option
Akim Demaille [Wed, 24 Oct 2012 14:59:30 +0000 (16:59 +0200)]
maint: use gendocs's new -I option

* gnulib: Update gendocs.
* cfg.mk (gendocs_options_): New.

12 years agoregen
Akim Demaille [Thu, 25 Oct 2012 12:49:11 +0000 (14:49 +0200)]
regen

12 years agoyacc.c: don't use _Pragma GCC diagnostic with 4.6
Akim Demaille [Thu, 25 Oct 2012 12:45:36 +0000 (14:45 +0200)]
yacc.c: don't use _Pragma GCC diagnostic with 4.6

Reported by Peter Simons.
http://lists.gnu.org/archive/html/bug-bison/2012-10/msg00033.html

* data/yacc.c (b4_declare_scanner_communication_variables): 4.7
seems fine though.

12 years agoregen
Akim Demaille [Fri, 26 Oct 2012 12:27:32 +0000 (14:27 +0200)]
regen

12 years agoyacc.c: do not define location support when not using locations
Akim Demaille [Fri, 26 Oct 2012 08:31:55 +0000 (10:31 +0200)]
yacc.c: do not define location support when not using locations

* data/yacc.c (YYLLOC_DEFAULT, YYRHSLOC): Don't define when not
using locations.

12 years agomaint: be compilable with GCC 4.0
Akim Demaille [Fri, 26 Oct 2012 12:16:29 +0000 (14:16 +0200)]
maint: be compilable with GCC 4.0

The "shadows a global declaration" warning in GCC 4.0 was a bit
annoying.  It does not like that a type name be used in a prototype of
a function (not the implementation, just the declaration):

  In file included from src/LR0.c:38:
  src/reader.h:56: warning: declaration of 'named_ref' shadows a
                            global declaration
  src/named-ref.h:35: warning: shadowed declaration is here

It does not like either when a global variable name is used in a
prototype.  Flex 2.5.37 generates this prototype:

  void gram_set_debug (int debug_flag  );

* src/getargs.h, src/getargs.c (debug_flag): Rename as...
(debug): this.
Adjust dependencies.
* src/reader.h: Don't use "named_ref" as a formal argument name.

12 years agomisc: document TESTSUITEFLAGS in README-hacking
Theophile Ranquet [Mon, 22 Oct 2012 14:19:31 +0000 (14:19 +0000)]
misc: document TESTSUITEFLAGS in README-hacking

* README-hacking: Document -j and -k flags.

12 years agodeprecation: add tests
Theophile Ranquet [Mon, 22 Oct 2012 11:10:53 +0000 (11:10 +0000)]
deprecation: add tests

* tests/input.at (Deprecated directives warn, Non-deprecated
directives don't, Unput doesn't mess up locations): New tests.

12 years agotests: address a warning from GCC 4.4
Akim Demaille [Thu, 25 Oct 2012 12:42:24 +0000 (14:42 +0200)]
tests: address a warning from GCC 4.4

236. torture.at:465: testing Exploding the Stack Size with Alloca ...
../../../tests/torture.at:474: bison -o input.c input.y
../../../tests/torture.at:474: $CC $CFLAGS $CPPFLAGS $LDFLAGS -o input input.c $LIBS
stderr:
cc1: warnings being treated as errors
input.y: In function 'main':
input.y:60: error: 'status' may be used uninitialized in this function

* tests/torture.at (AT_DATA_STACK_TORTURE): Initial status to avoid
the previous error.

12 years agotests: don't use options that Clang does not support
Akim Demaille [Thu, 25 Oct 2012 12:26:09 +0000 (14:26 +0200)]
tests: don't use options that Clang does not support

* configure.ac (WARN_CFLAGS, WARN_CXXFLAGS): Do not include options
that Clang does not support.

12 years agotests: restore the tests on -Werror
Akim Demaille [Thu, 25 Oct 2012 10:28:35 +0000 (12:28 +0200)]
tests: restore the tests on -Werror

When run as /bin/sh, Bash sets the shell variable POSIXLY_CORRECT to
y.  The test suite checks for the envvar POSIXLY_CORRECT to turn of
some tests not supported in POSIX mode.  Restore these tests.

Reported by the Hydra build farm, from Rob Vermaas.

* tests/local.at (AT_BISON_CHECK_WARNINGS_): Check the envvar
POSIXLY_CORRECT, not the shell variable.

12 years agoregen
Akim Demaille [Thu, 25 Oct 2012 07:42:03 +0000 (09:42 +0200)]
regen

12 years agoparse-gram: update the Bison interface
Akim Demaille [Thu, 25 Oct 2012 07:34:00 +0000 (09:34 +0200)]
parse-gram: update the Bison interface

* src/parse-gram.y (%pure-parser, %name-prefix): Replace with...
(%define api.pure, %define api.prefix)
* src/location.h, src/scan-gram.h: Adjust to api.prefix.

12 years agofix comment
Akim Demaille [Thu, 25 Oct 2012 07:40:20 +0000 (09:40 +0200)]
fix comment

* data/c.m4 (b4_YYDEBUG_define): here.

12 years agoregen
Theophile Ranquet [Wed, 24 Oct 2012 10:46:03 +0000 (10:46 +0000)]
regen

12 years agodeprecation: issue warnings in scanner
Theophile Ranquet [Thu, 18 Oct 2012 18:00:51 +0000 (18:00 +0000)]
deprecation: issue warnings in scanner

* src/parse-gram.y: Move the handling of (three) deprecated constructs ...
* src/scan-gram.l: ...Here, and issue warnings.
(DEPRECATED): New.