[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 5/8] c++: when api.location.file is defined, don't generate stack
From: |
Akim Demaille |
Subject: |
[PATCH 5/8] c++: when api.location.file is defined, don't generate stack.hh |
Date: |
Sat, 6 Oct 2018 18:03:14 +0200 |
Make it easier to have fewer files.
* data/stack.hh: Don't generate stack.hh when api.location.file is
specified.
* tests/calc++.at, tests/output.at: Adjust tests.
---
data/stack.hh | 4 +++-
tests/calc.at | 4 ++--
tests/output.at | 10 +++++++---
3 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/data/stack.hh b/data/stack.hh
index 992e92ef..1946cc48 100644
--- a/data/stack.hh
+++ b/data/stack.hh
@@ -22,7 +22,9 @@
b4_percent_define_ifdef([[api.stack.file]],
[b4_percent_define_check_values([[[[api.stack.file]],
[[none]]]])],
-[b4_defines_if([m4_define([b4_stack_file], [stack.hh])])])
+[b4_defines_if([b4_percent_define_ifdef([[api.location.file]],
+ [],
+ [m4_define([b4_stack_file],
[stack.hh])])])])
# b4_stack_define
diff --git a/tests/calc.at b/tests/calc.at
index 3ae8bc4e..5c799c44 100644
--- a/tests/calc.at
+++ b/tests/calc.at
@@ -694,8 +694,8 @@ AT_CHECK_CALC_LALR1_CC([%defines %locations %define
parse.error verbose %debug %
AT_CHECK_CALC_LALR1_CC([%define parse.error verbose %debug %define api.prefix
{calc} %verbose %yacc %parse-param {semantic_value *result} %parse-param {int
*count}])
AT_CHECK_CALC_LALR1_CC([%defines %locations %define parse.error verbose %debug
%define api.prefix {calc} %verbose %yacc %parse-param {semantic_value *result}
%parse-param {int *count}])
-AT_CHECK_CALC_LALR1_CC([%locations %defines %define api.stack.file none
%define api.location.file none %define api.position.file none])
-AT_CHECK_CALC_LALR1_CC([%defines %locations %define api.stack.file none
%define api.position.file none %define api.location.file "my-location.hh"])
+AT_CHECK_CALC_LALR1_CC([%defines %locations %define api.location.file none])
+AT_CHECK_CALC_LALR1_CC([%defines %locations %define api.location.file
"my-location.hh"])
# --------------------------- #
diff --git a/tests/output.at b/tests/output.at
index 1684fa04..3ee79df7 100644
--- a/tests/output.at
+++ b/tests/output.at
@@ -195,13 +195,17 @@ AT_CHECK_OUTPUT([foo.yy],
[],
[foo.tab.cc foo.tab.hh location.hh])
-# api.location.file=none => api.position.file=none
+# api.location.file=none => api.position.file=none and api.stack.file=none.
AT_CHECK_OUTPUT([foo.yy],
- [%skeleton "lalr1.cc" %defines %define api.stack.file none
%locations %define api.location.file none],
+ [%skeleton "lalr1.cc" %defines %locations %define
api.location.file none],
[],
[foo.tab.cc foo.tab.hh])
-# api.location.file="*" => api.position.file=none
+# 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"],
+ [],
+ [foo.loc.hh foo.tab.cc foo.tab.hh])
AT_CHECK_OUTPUT([foo.yy],
[%skeleton "lalr1.cc" %defines %define api.stack.file none
%locations %define api.location.file "foo.loc.hh"],
[],
--
2.19.0
- [PATCH 0/8] provide more control over C++ file names, Akim Demaille, 2018/10/06
- [PATCH 7/8] c++: provide a means to control how location.hh is included, Akim Demaille, 2018/10/06
- [PATCH 8/8] NEWS: document api.*.file changes, Akim Demaille, 2018/10/06
- [PATCH 6/8] c++: support absolute api.location.file names, Akim Demaille, 2018/10/06
- [PATCH 3/8] c++: make stack.hh completely useless, Akim Demaille, 2018/10/06
- [PATCH 5/8] c++: when api.location.file is defined, don't generate stack.hh,
Akim Demaille <=
- [PATCH 4/8] c++: make position.hh completely useless, Akim Demaille, 2018/10/06
- [PATCH 2/8] c++: add support for api.position.file and api.location.file, Akim Demaille, 2018/10/06
- [PATCH 1/8] c++: provide control over the stack.hh file name, Akim Demaille, 2018/10/06
- Re: [PATCH 0/8] provide more control over C++ file names, Hans Ã…berg, 2018/10/07