summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkim Demaille <akim.demaille@gmail.com>2021-08-11 17:41:27 +0200
committerAkim Demaille <akim.demaille@gmail.com>2021-08-11 18:01:12 +0200
commitc2ba260487927a4cdf061fae10fdd1b387ca3d95 (patch)
treee445a38751b42239905b537cdded5af1d8993de3
parente4e3cbce774af6c407e5cb699a8227ef213d54a1 (diff)
downloadbison-c2ba260487927a4cdf061fae10fdd1b387ca3d95.tar.gz
glr.c: fix signature when using custom error messages
Reported by Tom Shields <thomas.evans.shields@icloud.com>. * data/skeletons/glr.c (yypcontext_location): Fix return type. * tests/calc.at: Check the case pure, location, custom error messages.
-rw-r--r--TODO2
-rw-r--r--data/skeletons/glr.c4
-rw-r--r--tests/calc.at2
3 files changed, 6 insertions, 2 deletions
diff --git a/TODO b/TODO
index d9277255..de240dda 100644
--- a/TODO
+++ b/TODO
@@ -185,6 +185,8 @@ Line -1 and -3 should mention CATEGORIE, not CATEGORY.
* Bison 3.8
** Rewrite glr.cc (currently glr2.cc)
+*** custom error messages
+
*** Remove jumps
We can probably replace setjmp/longjmp with exceptions. That would help
tremendously other languages such as D and Java that probably have no
diff --git a/data/skeletons/glr.c b/data/skeletons/glr.c
index 117c996b..fab3733f 100644
--- a/data/skeletons/glr.c
+++ b/data/skeletons/glr.c
@@ -2174,10 +2174,10 @@ yypcontext_token (const yyGLRStack *yystackp)
}
]b4_locations_if([[/* The location of the lookahead of this context. */
-static YYLTYPE *
+static const YYLTYPE *
yypcontext_location (const yyGLRStack *yystackp) YY_ATTRIBUTE_UNUSED;
-static YYLTYPE *
+static const YYLTYPE *
yypcontext_location (const yyGLRStack *yystackp)
{
YY_USE (yystackp);
diff --git a/tests/calc.at b/tests/calc.at
index cd4b50a1..47ef720c 100644
--- a/tests/calc.at
+++ b/tests/calc.at
@@ -1469,6 +1469,8 @@ AT_CHECK_CALC_GLR_CC([%debug])
AT_CHECK_CALC_GLR_CC([%define parse.error verbose %debug %name-prefix "calc" %verbose])
AT_CHECK_CALC_GLR_CC([%define parse.error verbose %debug %name-prefix "calc" %define api.token.prefix {TOK_} %verbose])
+AT_CHECK_CALC_GLR_CC([%define parse.error custom %locations %header %name-prefix "calc" %verbose])
+
AT_CHECK_CALC_GLR_CC([%locations %header %define parse.error verbose %debug %name-prefix "calc" %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs}])
AT_CHECK_CALC_GLR_CC([%locations %header %define parse.error verbose %debug %define api.prefix {calc} %verbose %parse-param {semantic_value *result}{int *count}{int *nerrs}])