Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Fix build failure on macOS
@ 2019-12-18 15:05 Tom Tromey
  2019-12-18 16:21 ` Pedro Alves
  2019-12-18 16:32 ` Simon Marchi
  0 siblings, 2 replies; 8+ messages in thread
From: Tom Tromey @ 2019-12-18 15:05 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

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.

Let me know what you think.  I intend to check this in on the gdb 9
branch as well.

gdb/ChangeLog
2019-12-18  Tom Tromey  <tromey@adacore.com>

	PR build/25250:
	* ui-out.c (ui_out::vmessage): Update.
	* ui-out.h (enum class) <FIELD_STRING>: Rename from STRING.
	(string_field): Update.

Change-Id: Iae9f36f1b793e22c61fee0de2ab2d508668ee7e4
---
 gdb/ChangeLog | 7 +++++++
 gdb/ui-out.c  | 2 +-
 gdb/ui-out.h  | 6 ++++--
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/gdb/ui-out.c b/gdb/ui-out.c
index 80845f4bcaa..6572546f26c 100644
--- a/gdb/ui-out.c
+++ b/gdb/ui-out.c
@@ -736,7 +736,7 @@ ui_out::vmessage (const ui_file_style &in_style, const char *format,
 		      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 5c96a7825be..0bdb6b8b7d5 100644
--- a/gdb/ui-out.h
+++ b/gdb/ui-out.h
@@ -78,7 +78,9 @@ enum ui_out_type
 enum class field_kind
   {
     SIGNED,
-    STRING,
+    /* This has a funny name to avoid clashes with tokens named
+       "STRING".  See PR build/25250.  */
+    FIELD_STRING,
   };
 
 /* The base type of all fields that can be emitted using %pF.  */
@@ -126,7 +128,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;
 }
-- 
2.21.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-12-19 18:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-18 15:05 [PATCH] Fix build failure on macOS Tom Tromey
2019-12-18 16:21 ` Pedro Alves
2019-12-18 16:35   ` Tom Tromey
2019-12-18 16:38     ` Pedro Alves
2019-12-18 19:18     ` Christian Biesinger via gdb-patches
2019-12-19 18:11       ` Tom Tromey
2019-12-18 16:32 ` Simon Marchi
2019-12-18 16:37   ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox