[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 6/6] api.prefix: incompatible with %name-prefix.
From: |
Akim Demaille |
Subject: |
[PATCH 6/6] api.prefix: incompatible with %name-prefix. |
Date: |
Thu, 5 Jul 2012 12:44:39 +0200 |
* data/bison.m4: Make it incompatible.
* tests/input.at: Check that it is.
---
data/bison.m4 | 8 ++++++++
tests/input.at | 31 ++++++++++++++++++++++++++++++-
2 files changed, 38 insertions(+), 1 deletion(-)
diff --git a/data/bison.m4 b/data/bison.m4
index 9a66d88..178134a 100644
--- a/data/bison.m4
+++ b/data/bison.m4
@@ -576,3 +576,11 @@ m4_define_default([b4_parse_param], [])
# The initial column and line.
m4_define_default([b4_location_initial_column], [1])
m4_define_default([b4_location_initial_line], [1])
+
+# Sanity checks.
+b4_percent_define_ifdef([api.prefix],
+[m4_ifdef([b4_prefix],
+[b4_complain_at(b4_percent_define_get_loc([api.prefix]),
+ [['%s' and '%s' cannot be used together]],
+ [%name-prefix],
+ [%define api.prefix])])])
diff --git a/tests/input.at b/tests/input.at
index 0ed8635..836ff6d 100644
--- a/tests/input.at
+++ b/tests/input.at
@@ -69,7 +69,7 @@ AT_CLEANUP
# _AT_UNUSED_VALUES_DECLARATIONS()
-# --------------------------------------------
+# --------------------------------
# Generate the token, type, and destructor
# declarations for the unused values tests.
@@ -1340,3 +1340,32 @@ input.y:2.1-7: warning: POSIX Yacc forbids dashes in
symbol names: foo-bar
AT_BISON_CHECK([[-Werror,no-all,yacc input.y]], [[1]], [[]], [[experr]])
AT_CLEANUP
+
+
+## ------------------------------------------------------ ##
+## %name-prefix and %define api.prefix are incompatible. ##
+## ------------------------------------------------------ ##
+
+AT_SETUP([[%name-prefix and %define api.prefix are incompatible]])
+
+# AT_TEST(DIRECTIVES, OPTIONS, ERROR-LOCATION)
+# --------------------------------------------
+m4_pushdef([AT_TEST],
+[AT_DATA([[input.y]],
+[[$1
+%%
+exp:;
+]])
+AT_BISON_CHECK([[$2 input.y]], [[1]], [[]],
+[[$3: '%name-prefix' and '%define api.prefix' cannot be used together
+]])
+])
+
+AT_TEST([%define api.prefix foo %name-prefix "bar"], [], [input.y:1.9-18])
+AT_TEST([], [-Dapi.prefix=foo -p bar], [<command line>:2])
+AT_TEST([%name-prefix "bar"], [-Dapi.prefix=foo], [<command line>:2])
+AT_TEST([%define api.prefix foo], [-p bar], [input.y:1.9-18])
+
+m4_popdef([AT_TEST])
+
+AT_CLEANUP
--
1.7.11.1
- [PATCH 0/6] api.prefix: doc and push parsers, Akim Demaille, 2012/07/05
- [PATCH 3/6] NEWS: minor changes., Akim Demaille, 2012/07/05
- [PATCH 2/6] api.prefix: improve the documentation for YYDEBUG., Akim Demaille, 2012/07/05
- [PATCH 6/6] api.prefix: incompatible with %name-prefix.,
Akim Demaille <=
- [PATCH 5/6] api.prefix: strengthen the tests and fix push-parsers., Akim Demaille, 2012/07/05
- [PATCH 4/6] skeletons: style changes., Akim Demaille, 2012/07/05
- [PATCH 1/6] gnulib: update., Akim Demaille, 2012/07/05