From patchwork Wed Dec 18 15:05:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 36940 Received: (qmail 73925 invoked by alias); 18 Dec 2019 15:05:24 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 73913 invoked by uid 89); 18 Dec 2019 15:05:24 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=7367, HX-Languages-Length:1972, HContent-Transfer-Encoding:8bit X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 18 Dec 2019 15:05:22 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 35F7256012; Wed, 18 Dec 2019 10:05:21 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id NnfX18qNVKhY; Wed, 18 Dec 2019 10:05:21 -0500 (EST) Received: from murgatroyd.Home (75-166-123-50.hlrn.qwest.net [75.166.123.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by rock.gnat.com (Postfix) with ESMTPSA id E7BA2116127; Wed, 18 Dec 2019 10:05:20 -0500 (EST) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] Fix build failure on macOS Date: Wed, 18 Dec 2019 08:05:18 -0700 Message-Id: <20191218150518.8540-1-tromey@adacore.com> MIME-Version: 1.0 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 PR build/25250: * ui-out.c (ui_out::vmessage): Update. * ui-out.h (enum class) : 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; }