From patchwork Thu Nov 21 02:44:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Simon Marchi (Code Review)" X-Patchwork-Id: 36082 Received: (qmail 49428 invoked by alias); 21 Nov 2019 02:44:08 -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 49419 invoked by uid 89); 21 Nov 2019 02:44:08 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy=HX-Languages-Length:2383, HContent-Transfer-Encoding:8bit X-HELO: mx1.osci.io Received: from polly.osci.io (HELO mx1.osci.io) (8.43.85.229) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 21 Nov 2019 02:44:06 +0000 Received: by mx1.osci.io (Postfix, from userid 994) id EACAB20413; Wed, 20 Nov 2019 21:44:04 -0500 (EST) Received: from gnutoolchain-gerrit.osci.io (gnutoolchain-gerrit.osci.io [8.43.85.239]) by mx1.osci.io (Postfix) with ESMTP id F1F1820334 for ; Wed, 20 Nov 2019 21:44:03 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by gnutoolchain-gerrit.osci.io (Postfix) with ESMTP id 78B932816F for ; Wed, 20 Nov 2019 21:44:03 -0500 (EST) X-Gerrit-PatchSet: 1 Date: Wed, 20 Nov 2019 21:44:03 -0500 From: "Simon Marchi (Code Review)" To: gdb-patches@sourceware.org Message-ID: Auto-Submitted: auto-generated X-Gerrit-MessageType: newchange Subject: [review] gdb: remove gen_ret_current_ui_field_ptr X-Gerrit-Change-Id: I86f821c9d119453701caedf0e47124ccddfbab2d X-Gerrit-Change-Number: 696 X-Gerrit-ChangeURL: X-Gerrit-Commit: f79883f1086b02db92c4cccaff53360bfa60e33d References: Reply-To: simon.marchi@polymtl.ca, gdb-patches@sourceware.org MIME-Version: 1.0 Content-Disposition: inline User-Agent: Gerrit/3.0.3-79-g83ff7f88f1 Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/696 ...................................................................... gdb: remove gen_ret_current_ui_field_ptr I think it would be clearer to not use gen_ret_current_ui_field_ptr to generate the implementation of current_ui_gdb_stdout_ptr et al. It doesn't save much code, but adds a layer of complexity for the reader. Plus, it doesn't work well with IDEs, for example if you ask to find all usages the m_gdb_stdout field. gdb/ChangeLog: * top.c (current_ui_gdb_stdout_ptr): Spell out by hand. (current_ui_gdb_stdin_ptr): Likewise. (current_ui_gdb_stderr_ptr): Likewise. (current_ui_gdb_stdlog_ptr): Likewise. (current_ui_current_uiout_ptr): Likewise. (gen_ret_current_ui_field_ptr): Remove. Change-Id: I86f821c9d119453701caedf0e47124ccddfbab2d --- M gdb/top.c 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/gdb/top.c b/gdb/top.c index 08c7425..525eb10 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -92,21 +92,35 @@ #define DEFAULT_PROMPT "(gdb) " #endif -/* Generate a function that exports a pointer to a field of the - current UI. */ - -#define gen_ret_current_ui_field_ptr(type, name) \ -type * \ -current_ui_## name ## _ptr (void) \ -{ \ - return ¤t_ui->m_ ## name; \ +struct ui_file ** +current_ui_gdb_stdout_ptr (void) +{ + return ¤t_ui->m_gdb_stdout; } -gen_ret_current_ui_field_ptr (struct ui_file *, gdb_stdout) -gen_ret_current_ui_field_ptr (struct ui_file *, gdb_stdin) -gen_ret_current_ui_field_ptr (struct ui_file *, gdb_stderr) -gen_ret_current_ui_field_ptr (struct ui_file *, gdb_stdlog) -gen_ret_current_ui_field_ptr (struct ui_out *, current_uiout) +struct ui_file ** +current_ui_gdb_stdin_ptr (void) +{ + return ¤t_ui->m_gdb_stdin; +} + +struct ui_file ** +current_ui_gdb_stderr_ptr (void) +{ + return ¤t_ui->m_gdb_stderr; +} + +struct ui_file ** +current_ui_gdb_stdlog_ptr (void) +{ + return ¤t_ui->m_gdb_stdlog; +} + +struct ui_out ** +current_ui_current_uiout_ptr (void) +{ + return ¤t_ui->m_current_uiout; +} int inhibit_gdbinit = 0;