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.
This commit is contained in:
Akim Demaille
2018-10-15 14:04:00 +02:00
parent 2b0a9c69df
commit ea31f21fd8
11 changed files with 76 additions and 122 deletions

13
NEWS
View File

@@ -135,21 +135,12 @@ GNU Bison NEWS
made useless: its content is included in the parser definition. It is
still generated for backward compatibility.
To stop generating it, use the following directive:
%define api.stack.file none
When in addition to %defines, location support is requested (%locations),
the file position.hh is also generated. It is now also useless: its
content is now included in location.hh.
To stop generating it, use the following directive:
%define api.position.file none
Any definition of api.location.file eliminates both position.hh and
stack.hh (i.e., implies '%define api.position.file none' and '%define
api.stack.file none').
These files are no longer generated when your grammar file requires at
least Bison 3.2 (%require "3.2").
** Bug fixes