From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 86769 invoked by alias); 21 Nov 2019 14:33:32 -0000 Mailing-List: contact gdb-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: , Sender: gdb-cvs-owner@sourceware.org List-Subscribe: Sender: gdb-cvs-owner@sourceware.org Received: (qmail 86701 invoked by uid 10037); 21 Nov 2019 14:33:31 -0000 Date: Thu, 21 Nov 2019 14:33:00 -0000 Message-ID: <20191121143331.86700.qmail@sourceware.org> Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Simon Marchi To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb: remove gen_ret_current_ui_field_ptr X-Act-Checkin: binutils-gdb X-Git-Author: Simon Marchi X-Git-Refname: refs/heads/master X-Git-Oldrev: e19511a60cda301feacdb6244375363b08dccf7d X-Git-Newrev: 87fb00ea229f69a659ea044588b88bec03ae3a9c X-SW-Source: 2019-11/txt/msg00060.txt.bz2 https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=87fb00ea229f69a659ea044588b88bec03ae3a9c commit 87fb00ea229f69a659ea044588b88bec03ae3a9c Author: Simon Marchi Date: Thu Nov 21 09:32:15 2019 -0500 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 Diff: --- gdb/ChangeLog | 9 +++++++++ gdb/top.c | 38 ++++++++++++++++++++++++++------------ 2 files changed, 35 insertions(+), 12 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 3652685..57e8f6b 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +2019-11-21 Simon Marchi + + * 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. + 2019-11-21 Tom de Vries PR gdb/24956 diff --git a/gdb/top.c b/gdb/top.c index 08c7425..2953eac 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -92,21 +92,35 @@ extern void initialize_all_files (void); #define DEFAULT_PROMPT "(gdb) " #endif -/* Generate a function that exports a pointer to a field of the - current UI. */ +struct ui_file ** +current_ui_gdb_stdout_ptr () +{ + return ¤t_ui->m_gdb_stdout; +} + +struct ui_file ** +current_ui_gdb_stdin_ptr () +{ + return ¤t_ui->m_gdb_stdin; +} -#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_stderr_ptr () +{ + return ¤t_ui->m_gdb_stderr; } -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_stdlog_ptr () +{ + return ¤t_ui->m_gdb_stdlog; +} + +struct ui_out ** +current_ui_current_uiout_ptr () +{ + return ¤t_ui->m_current_uiout; +} int inhibit_gdbinit = 0;