mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 20:33:03 +00:00
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:
@@ -1660,24 +1660,14 @@ AT_SETUP([["%define" file variables]])
|
||||
AT_DATA([[input.y]],
|
||||
[[%skeleton "lalr1.cc"
|
||||
%locations
|
||||
%define api.stack.file bogus
|
||||
%define api.location.file {bogus}
|
||||
%define api.position.file bogus
|
||||
%%
|
||||
start: %empty;
|
||||
]])
|
||||
AT_BISON_CHECK([[-fcaret input.y]], [[1]], [[]],
|
||||
[[input.y:5.9-25: error: invalid value for %define variable 'api.position.file': 'bogus'
|
||||
%define api.position.file bogus
|
||||
^^^^^^^^^^^^^^^^^
|
||||
input.y:5.9-25: accepted value: 'none'
|
||||
input.y:4.9-25: error: %define variable 'api.location.file' requires 'none' or '"..."' values
|
||||
[[input.y:3.9-25: error: %define variable 'api.location.file' requires 'none' or '"..."' values
|
||||
%define api.location.file {bogus}
|
||||
^^^^^^^^^^^^^^^^^
|
||||
input.y:3.9-22: error: invalid value for %define variable 'api.stack.file': 'bogus'
|
||||
%define api.stack.file bogus
|
||||
^^^^^^^^^^^^^^
|
||||
input.y:3.9-22: accepted value: 'none'
|
||||
]])
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
@@ -183,37 +183,20 @@ AT_CHECK_OUTPUT([gram_dir/foo.yy],
|
||||
[],
|
||||
[output_dir/foo.output output_dir/foo.tab.cc output_dir/foo.tab.hh output_dir/location.hh output_dir/position.hh output_dir/stack.hh])
|
||||
|
||||
# api.stack.file.
|
||||
# %require "3.2" => no position.hh not stack.hh.
|
||||
AT_CHECK_OUTPUT([foo.yy],
|
||||
[%skeleton "lalr1.cc" %defines %define api.stack.file none],
|
||||
[%skeleton "lalr1.cc" %defines %locations %define api.location.file none %require "3.2"],
|
||||
[],
|
||||
[foo.tab.cc foo.tab.hh])
|
||||
|
||||
AT_CHECK_OUTPUT([foo.yy],
|
||||
[%skeleton "lalr1.cc" %defines %define api.stack.file none %locations],
|
||||
[],
|
||||
[foo.tab.cc foo.tab.hh location.hh position.hh])
|
||||
|
||||
AT_CHECK_OUTPUT([foo.yy],
|
||||
[%skeleton "lalr1.cc" %defines %define api.stack.file none %locations %define api.position.file none],
|
||||
[],
|
||||
[foo.tab.cc foo.tab.hh location.hh])
|
||||
|
||||
# api.location.file=none => api.position.file=none and api.stack.file=none.
|
||||
AT_CHECK_OUTPUT([foo.yy],
|
||||
[%skeleton "lalr1.cc" %defines %locations %define api.location.file none],
|
||||
[],
|
||||
[foo.tab.cc foo.tab.hh])
|
||||
|
||||
# api.location.file="*" => api.position.file=none and api.stack.file=none.
|
||||
AT_CHECK_OUTPUT([foo.yy],
|
||||
[%skeleton "lalr1.cc" %defines %locations %define api.location.file "foo.loc.hh"],
|
||||
[%skeleton "lalr1.cc" %defines %locations %define api.location.file "foo.loc.hh" %require "3.2"],
|
||||
[],
|
||||
[foo.loc.hh foo.tab.cc foo.tab.hh])
|
||||
|
||||
# Absolute paths.
|
||||
AT_CHECK_OUTPUT([foo.yy],
|
||||
[%skeleton "lalr1.cc" %defines %locations %define api.location.file "$at_dir/foo.loc.hh"],
|
||||
[%skeleton "lalr1.cc" %defines %locations %define api.location.file "$at_dir/foo.loc.hh" %require "3.2"],
|
||||
[],
|
||||
[foo.loc.hh foo.tab.cc foo.tab.hh])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user