Fix build failure with macOS bison
Commit Message
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(-)
Comments
>>>>> "Tom" == Tom Tromey <tom@tromey.com> writes:
Tom> PR gdb/24060 points out a compilation failure of the C parser when it
Tom> is built using the macOS system bison. The bug is a name clash
Tom> between the VARIABLE token name and the VARIABLE enumerator in
Tom> ui-out.h.
Tom> This patch renames VARIABLE in c-exp.y to avoid the clash. I chose to
Tom> rename this identifier because it was the more localized change.
Tom> gdb/ChangeLog
Tom> 2019-01-06 Tom Tromey <tom@tromey.com>
Tom> PR gdb/24060:
Tom> * c-exp.y (CONV_VAR): Rename from VARIABLE.
Simon -- I can't readily try this patch on macOS right now, so I was
hoping you could.
Tom
On 2019-01-06 11:50, Tom Tromey wrote:
> Simon -- I can't readily try this patch on macOS right now, so I was
> hoping you could.
I could tomorrow when I am at work.
Simon
@@ -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;