[PATCH] Fix build failure with macOS bison
Tom Tromey
tom@tromey.com
Sun Jan 6 16:49:00 GMT 2019
PR gdb/24060 points out a compilation failure of the C parser when it
is built using the macOS system bison. The bug is a name clash
between the VARIABLE token name and the VARIABLE enumerator in
ui-out.h.
This patch renames VARIABLE in c-exp.y to avoid the clash. I chose to
rename this identifier because it was the more localized change.
gdb/ChangeLog
2019-01-06 Tom Tromey <tom@tromey.com>
PR gdb/24060:
* c-exp.y (CONV_VAR): Rename from VARIABLE.
---
gdb/ChangeLog | 5 +++++
gdb/c-exp.y | 8 ++++----
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index 155fe09f37..3d7f6a05b5 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -234,7 +234,7 @@ static void c_print_token (FILE *file, int type, YYSTYPE value);
legal basetypes. */
%token SIGNED_KEYWORD LONG SHORT INT_KEYWORD CONST_KEYWORD VOLATILE_KEYWORD DOUBLE_KEYWORD
-%token <sval> VARIABLE
+%token <sval> CONV_VAR
%token <opcode> ASSIGN_MODIFY
@@ -798,7 +798,7 @@ exp : FLOAT
exp : variable
;
-exp : VARIABLE
+exp : CONV_VAR
{
write_dollar_variable (pstate, $1);
}
@@ -2884,7 +2884,7 @@ lex_one_token (struct parser_state *par_state, bool *is_quoted_name)
}
if (*tokstart == '$')
- return VARIABLE;
+ return CONV_VAR;
if (parse_completion && *lexptr == '\0')
saw_name_at_eof = 1;
@@ -3337,7 +3337,7 @@ c_print_token (FILE *file, int type, YYSTYPE value)
break;
case NSSTRING:
- case VARIABLE:
+ case CONV_VAR:
parser_fprintf (file, "sval<%s>", copy_name (value.sval));
break;
--
2.17.2
More information about the Gdb-patches
mailing list