Commit Graph

1395 Commits

Author SHA1 Message Date
Akim Demaille
15233a3728 tests: style changes
* tests/c++.at (C++ Variant-based Symbols): Rename as...
(C++ Variant-based Symbols Unit Tests): this.
Comment/style changes.
2018-08-30 08:14:21 +02:00
Akim Demaille
33e523878b C++: make sure the generated header is self container
See the previous commit.

* data/lalr1.cc: Be sure to define YY_NULLPTR.
* tests/headers.at: Check the case that was failing.
2018-08-26 18:54:42 +02:00
Akim Demaille
2360e39906 tests: check that headers are sane
The header generated for variants with assertions but without
locations, is not self-contained.  Prepare a check for this.

* tests/headers.at (Sane headers): New, extracted from...
(Several parsers): here.
2018-08-26 18:51:11 +02:00
Akim Demaille
9645a2b20e tests: disable -Wmaybe-uninitialized in some tests
On these tests, at -O2 and above, GCC 8 complains that yylval may be
uninitialized.  But it seems wrong: it is initialized.  Rather than
turning off the warning in the skeleton (hence possibility hiding
relevant warnings of user parsers), let's turn it off in the tests
only.

    163: parse.error=verbose and consistent errors:      FAILED (conflicts.at:625)
    165: parse.error=verbose and consistent errors: lr.default-reduction=consistent FAILED (conflicts.at:635)
    166: parse.error=verbose and consistent errors: lr.default-reduction=accepting FAILED (conflicts.at:641)
    167: parse.error=verbose and consistent errors: lr.type=canonical-lr FAILED (conflicts.at:645)
    168: parse.error=verbose and consistent errors: parse.lac=full FAILED (conflicts.at:650)
    169: parse.error=verbose and consistent errors: parse.lac=full lr.default-reduction=accepting FAILED (conflicts.at:655)

We get:

    input.c: In function 'yyparse':
    input.c:980:9: error: 'yylval' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
             ^~~~~~
    cc1: all warnings being treated as errors

See https://lists.gnu.org/archive/html/bison-patches/2018-08/msg00063.html.

* tests/conflicts.at (AT_CONSISTENT_ERRORS_CHECK): Disable
-Wmaybe-uninitialized.
2018-08-23 13:36:19 +02:00
Akim Demaille
44e76d801f lalr1.cc: support compilation with disabled support for exceptions
Reported by Brooks Moses <bmoses@google.com>
http://lists.gnu.org/archive/html/bison-patches/2018-02/msg00000.html

* data/lalr1.cc (YY_EXCEPTIONS): New.
Use it to disable try/catch clauses.

* doc/bison.texi (C++ Parser Interface): Document it.

* configure.ac (CXXFLAGS_NO_EXCEPTIONS): New.
* tests/atlocal.in: Receive it.
* tests/local.at (AT_FULL_COMPILE, AT_LANG_COMPILE):
Accept a new argument, extra compiler flags.
* tests/calc.at: Run the C++ calculator with exception support disabled.
2018-08-19 17:47:59 +02:00
Akim Demaille
adf0425d11 escape properly the file names in #line for printer/destructor
Reported by Jannick.
http://lists.gnu.org/archive/html/bug-bison/2017-05/msg00001.html

"Amusingly" enough, we have the same problem with %defines when the
parser file name has backslashes or quotes: we generate #includes with
an incorrect C string.

* src/output.c (prepare_symbol_definitions): Escape properly the file
names before passing them to M4.
* data/bison.m4, data/lalr1.cc: Don't simply put the file name between
two quotes (that should have been strong enough a smell...), expect
the string to be properly quoted.
* tests/synclines.at: New tests to check this.
2018-08-18 10:04:50 +02:00
Akim Demaille
cb4e7ecefa tests: fix title and improve quoting
* tests/synclines.at: here.
Also, prefer '%code' to ;%{...%}' for yylex/yyerror prototypes.
2018-08-18 10:00:21 +02:00
Akim Demaille
75417c1c1c tests: style changes
* tests/c++.at, tests/local.at: Formatting and title changes.
2018-08-18 07:28:04 +02:00
Akim Demaille
45b9d97b54 tests: style: use %empty
* tests/conflicts.at: here.
2018-08-15 19:40:19 +02:00
Akim Demaille
45ca5043ce tests: avoid compiler warnings
* tests/calc.at (AT_CALC_MAIN): Declare yyparse and operator<< in an
unnamed namespace to avoid "not declared" warnings (clang
-Weverything).
Remove useless prototypes.
2018-08-15 19:21:17 +02:00
Akim Demaille
e3b7c01820 style: tests: remove useless reference to 'int' in integral types
* tests/actions.at, tests/cxx-type.at: Prefer 'unsigned' to 'unsigned
int'.  Likewise for long and short.
2018-08-14 06:15:41 +02:00
Akim Demaille
4ad0ed3425 tests: check variants and typed mid-rule actions
See
http://lists.gnu.org/archive/html/bison-patches/2018-08/msg00013.html

* tests/c++.at (Variants and Typed Mid-rule Actions): New.
2018-08-12 09:04:04 +02:00
Akim Demaille
ad42f96053 tests: fix minor issues
* tests/actions.at: Fix some log messages.
Prefer #error to fprintf: it fixes the invalid use of yyoutput in
%destructor, and it is an even stronger check: that the code is not
even emitted.  The portability of #error is not really a problem here,
since the point is anyway to have the compilation fail.
2018-08-12 08:44:32 +02:00
Akim Demaille
da8f4a2f5f rule actions cannot be typed
Make sure that we cannot apply a type to the (main) action of a rule.

* src/reader.c (grammar_rule_check): Issue the warning.
* tests/input.at (Cannot type action): Check the warning.
2018-08-11 18:09:29 +02:00
Akim Demaille
f18f71cfb0 warn about typed mid-rule actions in Yacc mode
* src/reader.c (grammar_current_rule_action_append): Warn.
* tests/input.at (AT_CHECK_UNUSED_VALUES): Check.
2018-08-11 18:09:29 +02:00
Akim Demaille
11548b8e68 tests: check typed mid-rule actions
* tests/input.at (_AT_UNUSED_VALUES_DECLARATIONS): Check
typed mid-rule actions.
* tests/report.at (Reports): Check that types of typed mid-rule
actions are reported.
* tests/actions.at (Typed mid-rule actions): Check that
the values of typed mid-rule actions are correct.
2018-08-11 18:09:29 +02:00
Akim Demaille
0d06a966f8 tests: make room for more cases
* tests/input.at (AT_CHECK_UNUSED_VALUES): Add an empty line
to allow more symbols, and adjust line numbers.
Use a more consistent m4 quoting scheme.
2018-08-05 20:25:59 +02:00
Akim Demaille
a0f33a28e9 tests: fix typo
* tests/actions.at: Remove (harmless) stray character.
2018-07-26 20:13:05 +02:00
Akim Demaille
34d1773990 tests: check the typed symbols in the reports
* tests/report.at: New.
* tests/local.mk, tests/testsuite.at: Use it.
2018-06-18 08:53:27 +02:00
Akim Demaille
f462a08572 Merge maint into master
* upstream/maint: (48 commits)
  THANKS: update an address
  tests: adjust syncline tests to GCC 7
  glr: fix improperly placed synclines
  bison: be git grep friendly
  Replace ftp with https
  maint: post-release administrivia
  version 3.0.5
  bison: style: indentation fixes
  regen
  bison: please address sanitizer
  C++: style: fix indentation
  NEWS: update
  C++: style: prefer `unsigned` to `unsigned int`
  C++: style: space before paren
  C++: fix -Wdeprecated warnings
  tests: fix -Wdeprecated warning
  maint: update syntax-check exclusions
  autoconf: update
  regen
  Update copyright years
  ...
2018-06-17 18:43:59 +02:00
Akim Demaille
6053dcae59 tests: adjust syncline tests to GCC 7
GCC 7 also underlines the error.

    syncline.c:4:2: error: #error "4"
     #error "4"
      ^~~~~

* tests/synclines.at (_AT_SYNCLINES_COMPILE): Remove tildas from GCC 7.
2018-05-30 19:17:06 +02:00
Akim Demaille
5952fe5abf glr: fix improperly placed synclines
Predicates with GLR are issued with synclines in the middle of C code:

          case 2:
      if (! (#line 6 "sempred.y" /* glr.c:816  */
      new_syntax)) YYERROR;
    #line 793 "sempred.tab.c" /* glr.c:816  */
      break;

Reported by Rici Lake.
http://lists.gnu.org/archive/html/bug-bison/2018-05/msg00033.html

* data/c.m4 (b4_predicate_case): Be sure to start on column 0.
It would be nicer if b4_syncline could ensure this by itself
(that would avoid ugly code when synclines are disabled), but that's
way more work.
* tests/glr-regression.at (Predicates): Be a real end-to-end test.
This would have caught this error years ago...
2018-05-29 09:02:21 +02:00
Akim Demaille
7bb478bd19 tests: fix -Wdeprecated warning
With recent compilers:

    input.yy:49:5: error: definition of implicit copy assignment
                          operator for 'Object' is deprecated because
                          it has a user-declared destructor
                          [-Werror,-Wdeprecated]
        ~Object ()
        ^
    input.yy:130:35: note: in implicit copy assignment operator for
                           'Object' first required here
        { yylhs.value.as< Object > () = yystack_[0].value.as< Object > (); }

* tests/c++.at (Object): Add missing assignment operator.
2018-05-27 09:32:16 +02:00
Akim Demaille
2e9e591889 Update copyright years
Run `make update-copyright`.
2018-05-12 18:18:41 +02:00
Akim Demaille
d132c2d545 C++: fix uses of inline
Sometimes `inline` would be used in *.cc files on symbols that are not
exported (useless but harmless), and sometimes on exported symbols
such as the constructor of syntax_error (harmful: linking fails).

Reported several times, including:

- by Dennis T
  http://lists.gnu.org/archive/html/bug-bison/2016-03/msg00002.html
- by Frank Heckenbach
  https://savannah.gnu.org/patch/?9616

* data/c++.m4 (b4_inline): New: expands to `inline` or nothing.
Use it where appropriate.
* data/lalr1.cc: Use it where appropriate.

* tests/c++.at (Syntax error as exception): Put the scanner in another
compilation unit to exercise the constructor of syntax_error.
2018-05-10 17:33:18 +02:00
Akim Demaille
dbd1609311 style: don't use std::endl
* data/lalr1.cc, doc/bison.texi, etc/bench.pl.in, examples/variant.yy,
* tests/actions.at, tests/atlocal.in, tests/c++.at, tests/headers.at,
* tests/local.at, tests/types.at:
Don't use std::endl, it flushes uselessly, and is considered bad
style.
2018-05-08 12:35:06 +02:00
Akim Demaille
7e6bd4bb33 tests: we might need to find gnulib headers
315. calc.at:596: testing Calculator  ...
    ++ cat
    ++ test x = x1
    ++ set +x
    bison/tests/calc.at:596: bison -fno-caret -o calc.c calc.y
    ++ bison -fno-caret -o calc.c calc.y
    ++ set +x
    bison/tests/calc.at:596: $BISON_C_WORKS
    stderr:
    stdout:
    ++ set +x
    bison/tests/calc.at:596: $CC $CFLAGS $CPPFLAGS $LDFLAGS -o calc calc.c $LIBS
    ++ ccache clang-mp-6.0 -Qunused-arguments -O3 -g -Wall -Wextra -Wno-sign-compare -Wcast-align -Wdocumentation -Wformat -Wpointer-arith -Wwrite-strings -Wbad-function-cast -Wshadow -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -Wmissing-declarations -Wmissing-prototypes -Wundef -pedantic -Wsign-compare -fno-color-diagnostics -Wno-keyword-macro -Werror -Ibison/_build/6s/lib -DNDEBUG -isystem /opt/local/include -I/opt/local/include -L/opt/local/lib -o calc calc.c bison/_build/6s/lib/libbison.a -lintl -Wl,-framework -Wl,CoreFoundation
    stderr:
    In file included from calc.y:198:
    bison/_build/6s/lib/unistd.h:592:11: fatal error: 'getopt-pfx-core.h' file not found
    # include <getopt-pfx-core.h>
              ^~~~~~~~~~~~~~~~~~~
    1 error generated.
    stdout:
    bison/tests/calc.at:596: exit code was 1, expected 0
    315. calc.at:596: 315. Calculator  (calc.at:596): FAILED (calc.at:596)

* tests/atlocal.in (CPPFLAGS): Find gnulib's headers.
2018-05-08 12:35:06 +02:00
Akim Demaille
476c1cca59 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.
2015-08-12 13:56:07 +02:00
Akim Demaille
009285d20a tests: beware of additional warnings from GCC 5
* tests/synclines.at (AT_SYNCLINES_COMPILE): Avoid warnings about
unused functions.
2015-08-12 13:56:06 +02:00
Akim Demaille
32ea6125e3 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.
2015-08-12 13:56:06 +02:00
Akim Demaille
a668f48631 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.
2015-02-10 14:56:30 +01:00
Akim Demaille
3d75e7de1e 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.
2015-02-10 14:56:12 +01:00
Akim Demaille
9524161147 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.
2015-01-26 18:44:38 +01:00
Akim Demaille
d6445ec10b Merge remote-tracking branch 'origin/maint'
* origin/maint:
  maint: post-release administrivia
  version 3.0.4
  gnulib: update
  build: re-enable compiler warnings, and fix them
  tests: c++: fix a C++03 conformance issue
  tests: fix a title
  c++: reserve 200 slots in the parser's stack
  tests: be more robust to unrecognized synclines, and try to recognize xlc
  tests: fix C++ conformance
  build: fix some warnings
  build: avoid infinite recursions on include_next
2015-01-23 15:17:35 +01:00
Akim Demaille
a2c525b34c 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.
2015-01-23 07:52:50 +01:00
Akim Demaille
658b189348 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.
2015-01-22 08:45:44 +01:00
Akim Demaille
a06344172a tests: fix a title
* tests/conflicts.at: De-overquote.
2015-01-20 20:47:02 +01:00
Akim Demaille
573654ca9e 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.
2015-01-20 20:45:48 +01:00
Akim Demaille
0b0370ff42 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.
2015-01-20 18:16:09 +01:00
Akim Demaille
eaa476a7e9 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.
2015-01-20 18:04:24 +01:00
Akim Demaille
875ef1b90c symbol: use the first occurrence as an LHS as defining location
Currently on the following grammar:

    %type <foo> foo
    %%
    start: foo | bar | "baz"
    foo: foo
    bar: bar

bison reports:

    warning: 2 nonterminals useless in grammar [-Wother]
    warning: 4 rules useless in grammar [-Wother]
    1.13-15: warning: nonterminal useless in grammar: foo [-Wother]
     %type <foo> foo
                 ^^^
    3.14-16: warning: nonterminal useless in grammar: bar [-Wother]
     start: foo | bar | "baz"
                  ^^^
    [...]

i.e., the location of the first occurrence of a symbol is taken as its
definition point.  In the case of nonterminals, the first occurrence
as a left-hand side of a rule makes more sense:

    warning: 2 nonterminals useless in grammar [-Wother]
    warning: 4 rules useless in grammar [-Wother]
    4.1-3: warning: nonterminal useless in grammar: foo [-Wother]
     foo: foo
     ^^^
    5.1-3: warning: nonterminal useless in grammar: bar [-Wother]
     bar: bar
     ^^^
    [...]

* src/symtab.h, src/symtab.c (symbol::location_of_lhs): New.
(symbol_location_as_lhs_set): New.
* src/parse-gram.y (current_lhs): Use it.
* tests/reduce.at: Update locations.
2015-01-14 17:05:35 +01:00
Akim Demaille
650af77812 reduce: don't complain about rules whose lhs is useless
In the following grammar, the 'exp' nonterminal is trivially useless.
So, of course, its rules are useless too.

    %%
    input: '0' | exp
    exp: exp '+' exp | exp '-' exp | '(' exp ')'

Previously all the useless rules were reported, including those whose
left-hand side is the 'exp' nonterminal:

    warning: 1 nonterminal useless in grammar [-Wother]
    warning: 4 rules useless in grammar [-Wother]
    2.14-16: warning: nonterminal useless in grammar: exp [-Wother]
     input: '0' | exp
                  ^^^
    2.14-16: warning: rule useless in grammar [-Wother]
     input: '0' | exp
                  ^^^
  ! 3.6-16: warning: rule useless in grammar [-Wother]
  !  exp: exp '+' exp | exp '-' exp | '(' exp ')'
  !       ^^^^^^^^^^^
  ! 3.20-30: warning: rule useless in grammar [-Wother]
  !  exp: exp '+' exp | exp '-' exp | '(' exp ')'
  !                     ^^^^^^^^^^^
  ! 3.34-44: warning: rule useless in grammar [-Wother]
  !  exp: exp '+' exp | exp '-' exp | '(' exp ')'
  !                                   ^^^^^^^^^^^

The interest of being so verbose is dubious.  I suspect most of the
time nonterminals are not expected to be useless, so the user wants to
fix the nonterminal, not remove its rules.  And even if the user
wanted to get rid of its rules, the position of these rules probably
does not help more that just having the name of the nonterminal.

This commit discard these messages, marked with '!', and keep the
others.  In particular, we still report:

    2.14-16: warning: rule useless in grammar [-Wother]
     input: '0' | exp
                  ^^^

All the useless rules (including the '!' ones) are still reported in
the reports (xml, text, etc.); only the diagnostics on stderr change.

* src/gram.c (grammar_rules_useless_report): Don't complain about
useless rules whose lhs is useless.
* src/reduce.h, src/reduce.c (reduce_nonterminal_useless_in_grammar):
Take a sym_content as argument.
Adjust callers.
* tests/reduce.at (Useless Rules, Underivable Rules, Reduced Automaton):
Adjust.
2015-01-14 13:59:53 +01:00
Akim Demaille
ca5a716303 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.
2015-01-13 14:19:02 +01:00
Akim Demaille
ee028dceff 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.
2015-01-09 13:54:58 +01:00
Akim Demaille
e1d06b5235 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.
2015-01-08 16:08:00 +01:00
Akim Demaille
00cebd11d4 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.
2015-01-08 16:07:59 +01:00
Akim Demaille
8a4ec3595b 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.
2015-01-08 11:25:07 +01:00
Akim Demaille
56351d4c7b 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.
2015-01-05 18:32:23 +01:00
Akim Demaille
827bc59ca1 %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.
2015-01-04 18:00:51 +01:00
Akim Demaille
3209eb1c4c package: bump to 2015
Which also requires:

* gnulib: Update.
2015-01-04 17:49:13 +01:00