Commit Graph

5850 Commits

Author SHA1 Message Date
Akim Demaille
07a4b32f4d c++: check that emplace for rvalues works
See the previous commit.

* tests/local.at (AT_REQUIRE_CXX_VERSION): New.
* tests/types.at (api.value.type): Check emplace in C++14.
2018-10-21 08:02:52 +02:00
Akim Demaille
3ead69b1c1 c++: prefer a perfect forwarding version of variant's emplace
* data/variant.hh (emplace): In modern C++, use only a perfect
forwarding version.
And use it.
* doc/bison.texi: Document it.
2018-10-20 19:03:01 +02:00
Akim Demaille
42f0b949ec c++: prefer 'emplace' to 'build'
When we introduced variants in Bison, C++ did not have the 'emplace'
functions, and we chose 'build'.  Let's align with modern C++ and
promote 'emplace' rather than 'build'.

* data/lalr1.cc, data/variant.hh (emplace): New.
(build): Deprecate in favor of emplace.
* doc/bison.texi: Adjust.
2018-10-20 19:03:01 +02:00
Akim Demaille
e7b709ab0b %printer: promote yyo rather than yyoutput
* doc/bison.texi: Promote yyo rather than yyoutput.

* data/c.m4, data/glr.cc, tests/types.at, tests/calc.at,
tests/regression.at: Adjust.
2018-10-20 19:03:01 +02:00
Akim Demaille
35068fbe66 doc: improve the C++ section
* doc/bison.texi (C++ Parser): file.hh and location.hh are no longer
mandatory.
Various minor fixes.
2018-10-20 14:13:07 +02:00
Akim Demaille
16d34d8036 doc: reorder C++ sections
* doc/bison.texi (C++ Parser Interface): Document before semantic_type
and location_type.
2018-10-20 14:13:07 +02:00
Akim Demaille
bfbd73f3e0 git: don't ignore auxiliary Texinfo files
As a matter of fact, I think it is wrong to gitignore generated files
that belong to the build tree.  There should be the strict minimum,
and it's up to people that build in place to adjust their own
~/.gitignore.

* doc/.gitignore: here.
Remove files we no longer produce (thanks to texi2dvi).
2018-10-20 14:12:08 +02:00
Akim Demaille
602f8e2a77 c++: do not exhibit private macros
* examples/variant-11.yy: here.
2018-10-20 13:56:40 +02:00
Akim Demaille
ace93397c1 c++: don't obfuscate std::move when not needed
* data/lalr1.cc, data/variant.hh: Avoid macros that depend on the
version of C++ when not needed.
2018-10-20 09:18:40 +02:00
Akim Demaille
d2192653db build: add missing gnulib libs
Reported by Denis Excoffier.

* lib/local.mk, src/local.mk: here.
2018-10-20 09:11:22 +02:00
Akim Demaille
83a832618d maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2018-10-18 13:33:28 +02:00
Akim Demaille
0e0d7d2975 version 3.1.91
* NEWS: Record release date.
v3.1.91
2018-10-18 12:54:37 +02:00
Akim Demaille
5abbc66fe4 NEWS: update 2018-10-18 12:54:08 +02:00
Akim Demaille
bf338b7cd2 examples: force stack resizing with unique_ptr
In the previous commit we fixed a problem when the C++ stack was
resized.  The test was using ints.  Let's add a test with someone
quite touchy: unique_ptr

* examples/variant-11.yy: Accept an argument, which is the number of
numbers to send to the parser.
* examples/variant-11.test: Check with many numbers.
2018-10-18 08:51:08 +02:00
Akim Demaille
3967e46a2d lalr1.cc: fix stack symbol move
In some casing, once we moved a stack symbol, we forget to mark the
source stack symbol as emptied.  As a consequence, it may be destroyed
a second time.

This happens when the stack has to be resized.

* data/lalr1.cc (stack_symbol_type::stack_symbol_type): Record that
the source was emptied.
(stack_symbol_type::operator=): Likewise.
* tests/c++.at (C++ Variant-based Symbols Unit Tests): Force the stack
to be resized.  Check its content.
2018-10-18 07:15:30 +02:00
Akim Demaille
b994c3bf78 doc: improve the doc of the examples
* examples/README: here.
2018-10-17 19:00:29 +02:00
Akim Demaille
03a13ce793 reader: recognize C++ even when it's not lalr1.cc or glr.cc
* src/reader.c (grammar_rule_check_and_complete): If a user uses her
own skeleton but sets the language to C++, recognize it as C++.
2018-10-17 17:53:51 +02:00
Akim Demaille
f5fc21240f maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2018-10-17 07:11:56 +02:00
Akim Demaille
ebddc0a0d2 version 3.1.90
* NEWS: Record release date.
v3.1.90
2018-10-17 06:32:48 +02:00
Akim Demaille
8359341013 examples: don't generate the position/stack files
* examples/variant-11.yy, examples/variant.yy: Require 3.2.
2018-10-16 22:41:13 +02:00
Akim Demaille
c7fe52e514 gnulib: update 2018-10-16 21:07:04 +02:00
Akim Demaille
5cdbc97c9d pacify syntax-checks
* lib/lbitset.c, tests/c++.at: here.
* cfg.mk: Add exceptions.
2018-10-16 18:54:06 +02:00
Akim Demaille
9017924783 regen 2018-10-16 13:41:45 +02:00
Akim Demaille
e3fdc37049 generate the default action only for C++
This commit adds restrictions to what was done in
01898726e2 [1].

Rici Lake [2] has shown that it's risky to disable the pre-action, at
least now.  Also, generating the default $$ = $1 action can have bad
effects in some cases [3].

The original change [1] was prompted for C++.  Let's try it there
only, for a start.  We could restrict it further to lalr1.cc with
variants, but we need to see in the wild how this change behaves.  And
it is not unreasonable to expect grammar files in C++ to behave better
wrt types.

See
[1] https://lists.gnu.org/archive/html/bison-patches/2018-10/msg00050.html
[2] https://lists.gnu.org/archive/html/bison-patches/2018-10/msg00061.html
[3] https://lists.gnu.org/archive/html/bison-patches/2018-10/msg00066.html

* src/getargs.c: Style changes.
* src/reader.c (grammar_rule_check_and_complete): Complete only for
C++.
2018-10-16 13:41:09 +02:00
Akim Demaille
a99b4f45bb regen 2018-10-16 13:33:32 +02:00
Akim Demaille
ea31f21fd8 C++: let %require "3.2" disable the generation of obsolete files
The files stack.hh and position.hh are deprecated.  Rather than
devoting specify %define variables to discard them (api.position.file
and api.stack.file), and rather than having to use special rules when
api.location.file is used, let's simply decide that from %require
"3.2" onwards, these files will not be generated.

The only noticeable thing here is that, in order to be able to check
the behavior of %require "3.2", to have this version (which is still
3.1-*) to accept %require "3.2".

* src/gram.h, src/gram.c (required_version): New.
* src/parse-gram.y (version_check): Set it.
* src/output.c (prepare): Pass it m4.
* data/bison.m4 (b4_required_version_if): Receive it and use it.
* data/location.cc, data/stack.hh: Replace the api.*.file with only
required version comparison.
* tests/input.at: No longer check api.stack.file and api.position.file.
* NEWS, doc/bison.texi: Don't mention them.
Document the %require 3.2 behavior.
* tests/output.at: Use %require 3.2 instead.
2018-10-16 13:33:32 +02:00
Akim Demaille
2b0a9c69df java: bump to Java SE 7
macOS 10.14 no longer supports versions of Java earlier than 5.
And Java 6 will be deprecated by the end of this year.  So let's move
our requirement to Java 7.
Reported by Yu Yijun.
https://lists.gnu.org/archive/html/bug-bison/2018-09/msg00060.html
Suggested by Paul Eggert and Bruno Haible.
http://lists.gnu.org/archive/html/bug-gnulib/2018-10/msg00094.html

* configure.ac: Require Java 7, both compiler and runtime.
2018-10-15 20:28:08 +02:00
Akim Demaille
c69944ff8b doc: do not advertise %nterm
Reported by Rici Lake.
http://lists.gnu.org/archive/html/bug-bison/2018-10/msg00000.html

* NEWS, doc/bison.texi: here.
2018-10-15 19:23:49 +02:00
Akim Demaille
01898726e2 generate the default semantic action
Currently, in C, the default semantic action is implemented by being
always run before running the actual user semantic action.  As a
consequence, when the user action is run, $$ is already set as $1.

In C++ with variants, we don't do that, since we cannot manipulate the
semantic value without knowing its exact type.  When variants are
enabled, the only guarantee is that $$ is default contructed and ready
to the used.

Some users still would like the default action to be run with
variants.  Frank Heckenbach's parser in
C++17 (http://lists.gnu.org/archive/html/bug-bison/2018-04/msg00011.html)
provides this feature, but relying on std::variant's dynamic typing,
which we forbid in lalr1.cc.

The simplest seems to be actually generating the default semantic
action (in all languages/skeletons).  This makes the pre-action (that
sets $$ to $1) useless.  But...  maybe some users depend on this, in
spite of the comments that clearly warn againt this.  So let's not
turn this off just yet.

* src/reader.c (grammar_rule_check_and_complete): Rename as...
(grammar_rule_check_and_complete): this.
Install the default semantic action when applicable.
* examples/variant-11.yy, examples/variant.yy, tests/calc.at:
Exercise the default semantic action, even with variants.
2018-10-14 18:53:21 +02:00
Jannick
20a6c3175f xml2xhtml.xsl: add UTF-8 encoding
To make arrows appear nicely in the browser. Currently it is shown as
some garbled something in mine (Firefox).

* data/xslt/xml2xhtml.xsl: here.
2018-10-14 18:53:21 +02:00
Akim Demaille
45ef3d92a1 reader: reorder some calls to separate checks from assignments
* src/reader.c (packgram): Move assignments to rules[ruleno] after the
checks on the rule.
2018-10-14 15:20:39 +02:00
Akim Demaille
fa386893aa C++: style: add missing space before parens
* data/c++.m4, data/lalr1.cc, data/stack.hh, data/variant.hh,
* examples/variant-11.yy: here.
2018-10-14 15:20:39 +02:00
Akim Demaille
dc73dc4fb2 gnulib: update timevar
See
https://lists.gnu.org/archive/html/bug-gnulib/2018-10/msg00005.html.
2018-10-14 15:15:29 +02:00
Akim Demaille
677a91aef2 style: modernize lib/vbitset.h 2018-10-11 08:54:14 +02:00
Akim Demaille
dab2ee0f74 style: modernize lib/vbitset.c 2018-10-11 08:54:14 +02:00
Akim Demaille
7f49dc7d1d style: modernize lib/lbitset.c 2018-10-11 07:00:34 +02:00
Akim Demaille
5f26baa748 style: modernize lib/lbitset.h 2018-10-11 07:00:34 +02:00
Akim Demaille
80752c0dc1 style: modernize lib/ebitset.c 2018-10-11 07:00:34 +02:00
Akim Demaille
f8c9c7acae style: modernize lib/ebitset.h 2018-10-11 07:00:34 +02:00
Akim Demaille
7d324cf00c style: modernize lib/bitsetv.c 2018-10-11 07:00:34 +02:00
Akim Demaille
98364385a6 style: modernize lib/bitsetv.h 2018-10-11 07:00:34 +02:00
Akim Demaille
b5197d5770 style: modernize lib/bitsetv-print.c 2018-10-11 07:00:34 +02:00
Akim Demaille
e9b69f8655 style: modernize lib/bitsetv-print.h 2018-10-11 07:00:34 +02:00
Akim Demaille
099339df0a style: modernize lib/bitset_stats.c 2018-10-11 07:00:34 +02:00
Akim Demaille
8e4ca87228 style: modernize lib/bitset_stats.h 2018-10-11 07:00:34 +02:00
Akim Demaille
72e2a94d5f style: modernize lib/bitset.c 2018-10-11 07:00:34 +02:00
Akim Demaille
059cb26ca2 style: modernize lib/bitset.h 2018-10-11 07:00:34 +02:00
Akim Demaille
c3d32f4a9a style: modernize lib/bbitset.h 2018-10-11 07:00:34 +02:00
Akim Demaille
74484f42f3 style: modernize lib/abitset.c 2018-10-11 07:00:34 +02:00
Akim Demaille
6565b9a566 style: modernize lib/abitset.h 2018-10-10 22:42:58 +02:00