public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb/gdb-9-branch] Fix build failure on macOS
@ 2019-12-18 17:40 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2019-12-18 17:40 UTC (permalink / raw)
  To: gdb-cvs

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

commit 1c66314dcbf262b8ef5793f3e08347de9c85e620
Author: Tom Tromey <tromey@adacore.com>
Date:   Wed Dec 18 08:03:01 2019 -0700

    Fix build failure on macOS
    
    PR build/25250 notes that the gdb 9 pre-release fails to build on
    macOS, due to a name clash between field_kind::STRING and the STRING
    token in ada-exp.y.  I am not sure (I couldn't reproduce this myself),
    but presumably this is due to differences caused by the version of
    bison in use there.
    
    This patch works around the problem by renaming the field_kind
    enumerator.  I chose to rename this one because it is used in
    relatively few places -- it's just an implementation detail of the
    style code.
    
    This version also renames field_kind::SIGNED for consistency.
    
    Let me know what you think.  I intend to check this in on the gdb 9
    branch as well.
    
    2019-12-18  Tom Tromey  <tromey@adacore.com>
    
    	PR build/25250:
    	* ui-out.c (ui_out::vmessage): Update.
    	* ui-out.h (enum class field_kind) <FIELD_STRING, FIELD_SIGNED>:
    	Rename.
    	(string_field): Update.
    	(signed_field): Update.
    
    Change-Id: Iae9f36f1b793e22c61fee0de2ab2d508668ee7e4

Diff:
---
 gdb/ChangeLog |  9 +++++++++
 gdb/ui-out.c  |  4 ++--
 gdb/ui-out.h  | 11 +++++++----
 3 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index cf7254f..6174da4 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,12 @@
+2019-12-18  Tom Tromey  <tromey@adacore.com>
+
+	PR build/25250:
+	* ui-out.c (ui_out::vmessage): Update.
+	* ui-out.h (enum class field_kind) <FIELD_STRING, FIELD_SIGNED>:
+	Rename.
+	(string_field): Update.
+	(signed_field): Update.
+
 2019-12-16  Simon Marchi  <simon.marchi@polymtl.ca>
 
 	* jit.c (finalize_symtab): Set gdb_block_iter_tmp in loop.
diff --git a/gdb/ui-out.c b/gdb/ui-out.c
index 80845f4..2b3b7e4 100644
--- a/gdb/ui-out.c
+++ b/gdb/ui-out.c
@@ -730,13 +730,13 @@ ui_out::vmessage (const ui_file_style &in_style, const char *format,
 		base_field_s *bf = va_arg (args, base_field_s *);
 		switch (bf->kind)
 		  {
-		  case field_kind::SIGNED:
+		  case field_kind::FIELD_SIGNED:
 		    {
 		      auto *f = (signed_field_s *) bf;
 		      field_signed (f->name, f->val);
 		    }
 		    break;
-		  case field_kind::STRING:
+		  case field_kind::FIELD_STRING:
 		    {
 		      auto *f = (string_field_s *) bf;
 		      field_string (f->name, f->str);
diff --git a/gdb/ui-out.h b/gdb/ui-out.h
index 5c96a78..c3ef8a5 100644
--- a/gdb/ui-out.h
+++ b/gdb/ui-out.h
@@ -77,8 +77,11 @@ enum ui_out_type
 /* The possible kinds of fields.  */
 enum class field_kind
   {
-    SIGNED,
-    STRING,
+    /* "FIELD_STRING" needs has a funny name to avoid clashes with
+       tokens named "STRING".  See PR build/25250.  FIELD_SIGNED is
+       given a similar name for consistency.  */
+    FIELD_SIGNED,
+    FIELD_STRING,
   };
 
 /* The base type of all fields that can be emitted using %pF.  */
@@ -105,7 +108,7 @@ signed_field (const char *name, LONGEST val,
 	      signed_field_s &&tmp = {})
 {
   tmp.name = name;
-  tmp.kind = field_kind::SIGNED;
+  tmp.kind = field_kind::FIELD_SIGNED;
   tmp.val = val;
   return &tmp;
 }
@@ -126,7 +129,7 @@ string_field (const char *name, const char *str,
 	      string_field_s &&tmp = {})
 {
   tmp.name = name;
-  tmp.kind = field_kind::STRING;
+  tmp.kind = field_kind::FIELD_STRING;
   tmp.str = str;
   return &tmp;
 }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-12-18 17:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-18 17:40 [binutils-gdb/gdb-9-branch] Fix build failure on macOS Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).