c++: by default, use const std::string for file names

Reported by Martin Blais and Yuriy Solodkyy.
https://lists.gnu.org/r/help-bison/2020-05/msg00011.html
https://lists.gnu.org/r/bug-bison/2020-06/msg00038.html

While at it, modernize filename_type as api.filename.type and document
it properly.

* data/skeletons/c++.m4 (filename_type): Rename as...
(api.filename.type): this.
Default to const std::string.
* data/skeletons/location.cc (position, location): Expose the
filename_type type.
Use api.filename.type.
* doc/bison.texi (%define Summary): Document api.filename.type.
(C++ Location Values): Document position::filename_type.
* src/muscle-tab.c (muscle_percent_variable_update): Ensure backward
compatibility.
* tests/c++.at: Check that using const file names is ok.
tests/input.at: Check backward compat.
This commit is contained in:
Akim Demaille
2020-06-27 09:43:14 +02:00
parent cf6d8d0631
commit eeafc706e8
8 changed files with 105 additions and 50 deletions

39
NEWS
View File

@@ -2,11 +2,38 @@ GNU Bison NEWS
* Noteworthy changes in release ?.? (????-??-??) [?]
** New features
*** File prefix mapping
Bison learned a new argument, '--file-prefix-map OLD=NEW'. Any file path in
the output (specifically #line directives and #ifdef header guards) that
being with the prefix OLD will have it replace with the prefix NEW, similar
to the -ffile-prefix-map in GCC. This option can be used to make bison output
reproducible.
** Changes
When installed to be relocatable (via configure --enable-relocatable),
*** Relocatable installation
When installed to be relocatable (via `configure --enable-relocatable`),
bison will now also look for a relocated m4.
*** C++ file names
The `filename_type` %define variable was renamed `api.filename.type`.
Instead of
%define filename_type "symbol"
write
%define api.filename.type {symbol}
(Or let `bison --update` do it for you).
It now defaults to `const std::string` instead of `std::string`.
** Bug fixes
*** Include the generated header (yacc.c)
@@ -48,16 +75,6 @@ GNU Bison NEWS
An old, well hidden, bug in the generation of IELR parsers was fixed.
** New features
*** File prefix mapping
Bison learned a new argument, '--file-prefix-map OLD=NEW'. Any file path in
the output (specifically #line directives and #ifdef header guards) that
being with the prefix OLD will have it replace with the prefix NEW, similar
to the -ffile-prefix-map in GCC. This option can be used to make bison output
reproducible.
* Noteworthy changes in release 3.6.4 (2020-06-15) [stable]
** Bug fixes