This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Fix build failure with macOS bison


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=cfeadda545c4961877969e6a66be79278696e012

commit cfeadda545c4961877969e6a66be79278696e012
Author: Tom Tromey <tom@tromey.com>
Date:   Sun Jan 6 09:49:11 2019 -0700

    Fix build failure with macOS bison
    
    PR gdb/24060 points out a compilation failure of the C, Fortran and Pascal
    parsers when they are 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, f-exp.y and p-exp.y to DOLLAR_VARIABLE
    to avoid the clash.  It also renames similar variables in other .y files so
    that all languages use the same name.
    
    gdb/ChangeLog
    2019-01-07  Tom Tromey  <tom@tromey.com>
    2019-01-07  Simon Marchi  <simon.marchi@ericsson.com>
    
    	PR gdb/24060:
    	* ada-exp.y (DOLLAR_VARIABLE): Rename from SPECIAL_VARIABLE.
    	* ada-lex.l (DOLLAR_VARIABLE): Likewise.
    	* c-exp.y (DOLLAR_VARIABLE): Rename from VARIABLE.
    	* f-exp.y (DOLLAR_VARIABLE): Likewise.
    	* m2-exp.y (DOLLAR_VARIABLE): Rename from INTERNAL_VAR.
    	* p-exp.y (DOLLAR_VARIABLE): Rename from VARIABLE.

Diff:
---
 gdb/ChangeLog | 11 +++++++++++
 gdb/ada-exp.y |  4 ++--
 gdb/ada-lex.l |  2 +-
 gdb/c-exp.y   |  8 ++++----
 gdb/f-exp.y   |  6 +++---
 gdb/m2-exp.y  |  6 +++---
 gdb/p-exp.y   |  6 +++---
 7 files changed, 27 insertions(+), 16 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 71345ac..d16d9e1 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,14 @@
+2019-01-08  Tom Tromey  <tom@tromey.com>
+	    Simon Marchi  <simon.marchi@ericsson.com>
+
+	PR gdb/24060
+	* ada-exp.y (DOLLAR_VARIABLE): Rename from SPECIAL_VARIABLE.
+	* ada-lex.l (DOLLAR_VARIABLE): Likewise.
+	* c-exp.y (DOLLAR_VARIABLE): Rename from VARIABLE.
+	* f-exp.y (DOLLAR_VARIABLE): Likewise.
+	* m2-exp.y (DOLLAR_VARIABLE): Rename from INTERNAL_VAR.
+	* p-exp.y (DOLLAR_VARIABLE): Rename from VARIABLE.
+
 2019-01-08  Andrew Burgess  <andrew.burgess@embecosm.com>
 
 	* source.c (select_source_symtab): Move header comment to
diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y
index 5342e6b..5925416 100644
--- a/gdb/ada-exp.y
+++ b/gdb/ada-exp.y
@@ -151,7 +151,7 @@ static struct type *type_system_address (struct parser_state *);
 
 /* Special type cases, put in to allow the parser to distinguish different
    legal basetypes.  */
-%token <sval> SPECIAL_VARIABLE
+%token <sval> DOLLAR_VARIABLE
 
 %nonassoc ASSIGN
 %left _AND_ OR XOR THEN ELSE
@@ -275,7 +275,7 @@ primary :	var_or_type	%prec VAR
 			}
 	;
 
-primary :	SPECIAL_VARIABLE /* Various GDB extensions */
+primary :	DOLLAR_VARIABLE /* Various GDB extensions */
 			{ write_dollar_variable (pstate, $1); }
 	;
 
diff --git a/gdb/ada-lex.l b/gdb/ada-lex.l
index 95ea92e..05af013 100644
--- a/gdb/ada-lex.l
+++ b/gdb/ada-lex.l
@@ -290,7 +290,7 @@ false		{ return FALSEKEYWORD; }
 "$"({LETTER}|{DIG}|"$")*  {
 		  yylval.sval.ptr = yytext;
 		  yylval.sval.length = yyleng;
-		  return SPECIAL_VARIABLE;
+		  return DOLLAR_VARIABLE;
 		}
 
 	/* CATCH-ALL ERROR CASE */
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index 155fe09..f3ef23c 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> DOLLAR_VARIABLE
 
 %token <opcode> ASSIGN_MODIFY
 
@@ -798,7 +798,7 @@ exp	:	FLOAT
 exp	:	variable
 	;
 
-exp	:	VARIABLE
+exp	:	DOLLAR_VARIABLE
 			{
 			  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 DOLLAR_VARIABLE;
 
   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 DOLLAR_VARIABLE:
       parser_fprintf (file, "sval<%s>", copy_name (value.sval));
       break;
 
diff --git a/gdb/f-exp.y b/gdb/f-exp.y
index ae6f86a..d70c664 100644
--- a/gdb/f-exp.y
+++ b/gdb/f-exp.y
@@ -161,7 +161,7 @@ static int parse_number (struct parser_state *, const char *, int,
 %token BOOL_AND BOOL_OR BOOL_NOT   
 %token <lval> CHARACTER 
 
-%token <voidval> VARIABLE
+%token <voidval> DOLLAR_VARIABLE
 
 %token <opcode> ASSIGN_MODIFY
 
@@ -426,7 +426,7 @@ exp	:	FLOAT
 exp	:	variable
 	;
 
-exp	:	VARIABLE
+exp	:	DOLLAR_VARIABLE
 	;
 
 exp	:	SIZEOF '(' type ')'	%prec UNARY
@@ -1135,7 +1135,7 @@ yylex (void)
   if (*tokstart == '$')
     {
       write_dollar_variable (pstate, yylval.sval);
-      return VARIABLE;
+      return DOLLAR_VARIABLE;
     }
   
   /* Use token-type TYPENAME for symbols that happen to be defined
diff --git a/gdb/m2-exp.y b/gdb/m2-exp.y
index a039491..85d5876 100644
--- a/gdb/m2-exp.y
+++ b/gdb/m2-exp.y
@@ -125,7 +125,7 @@ static int number_sign = 1;
 /* The GDB scope operator */
 %token COLONCOLON
 
-%token <voidval> INTERNAL_VAR
+%token <voidval> DOLLAR_VARIABLE
 
 /* M2 tokens */
 %left ','
@@ -535,7 +535,7 @@ variable:	fblock
 	;
 
 /* GDB internal ($foo) variable */
-variable:	INTERNAL_VAR
+variable:	DOLLAR_VARIABLE
 	;
 
 /* GDB scope operator */
@@ -949,7 +949,7 @@ yylex (void)
   if (*tokstart == '$')
     {
       write_dollar_variable (pstate, yylval.sval);
-      return INTERNAL_VAR;
+      return DOLLAR_VARIABLE;
     }
 
   /* Use token-type BLOCKNAME for symbols that happen to be defined as
diff --git a/gdb/p-exp.y b/gdb/p-exp.y
index 7e2769e..31e8c4b 100644
--- a/gdb/p-exp.y
+++ b/gdb/p-exp.y
@@ -158,7 +158,7 @@ static int search_field;
 /* Special type cases, put in to allow the parser to distinguish different
    legal basetypes.  */
 
-%token <voidval> VARIABLE
+%token <voidval> DOLLAR_VARIABLE
 
 
 /* Object pascal */
@@ -521,7 +521,7 @@ exp	:	FLOAT
 exp	:	variable
 	;
 
-exp	:	VARIABLE
+exp	:	DOLLAR_VARIABLE
 			/* Already written by write_dollar_variable.
 			   Handle current_type.  */
  			{  if (intvar) {
@@ -1492,7 +1492,7 @@ yylex (void)
       tmp[namelen] = '\0';
       intvar = lookup_only_internalvar (tmp + 1);
       free (uptokstart);
-      return VARIABLE;
+      return DOLLAR_VARIABLE;
     }
 
   /* Use token-type BLOCKNAME for symbols that happen to be defined as


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]