From patchwork Fri Jun 2 12:22:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 20702 Received: (qmail 129347 invoked by alias); 2 Jun 2017 12:22:48 -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 129165 invoked by uid 89); 2 Jun 2017 12:22:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_STOCKGEN, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=designs, mill, Tracker X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 02 Jun 2017 12:22:44 +0000 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 76DBDC0467DB for ; Fri, 2 Jun 2017 12:22:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 76DBDC0467DB Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=palves@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 76DBDC0467DB Received: from cascais.lan (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id F17274DA6D for ; Fri, 2 Jun 2017 12:22:46 +0000 (UTC) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 08/40] completion_list_add_name wrapper functions Date: Fri, 2 Jun 2017 13:22:06 +0100 Message-Id: <1496406158-12663-9-git-send-email-palves@redhat.com> In-Reply-To: <1496406158-12663-1-git-send-email-palves@redhat.com> References: <1496406158-12663-1-git-send-email-palves@redhat.com> I've had to adjust these macros numerous times while working on this series, adding/removing parameters while experimenting with designs. At some point, I got fed up with fighting the preprocessor, and decided to make them proper functions. gdb/ChangeLog: yyyy-mm-dd Pedro Alves * symtab.c (COMPLETION_LIST_ADD_SYMBOL) (MCOMPLETION_LIST_ADD_SYMBOL): Delete macros, replace with ... (completion_list_add_symbol, completion_list_add_msymbol): ... these new functions. (add_symtab_completions) (default_make_symbol_completion_list_break_on_1): Adjust. --- gdb/symtab.c | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/gdb/symtab.c b/gdb/symtab.c index 4414d71..183164d 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -4779,18 +4779,8 @@ do_free_completion_list (void *list) free_completion_list ((VEC (char_ptr) **) list); } -/* Helper routine for make_symbol_completion_list. */ - static VEC (char_ptr) *return_val; -#define COMPLETION_LIST_ADD_SYMBOL(symbol, sym_text, len, text, word) \ - completion_list_add_name \ - (SYMBOL_NATURAL_NAME (symbol), (sym_text), (len), (text), (word)) - -#define MCOMPLETION_LIST_ADD_SYMBOL(symbol, sym_text, len, text, word) \ - completion_list_add_name \ - (MSYMBOL_NATURAL_NAME (symbol), (sym_text), (len), (text), (word)) - /* Tracker for how many unique completions have been generated. Used to terminate completion list generation early if the list has grown to a size so large as to be useless. This helps avoid GDB seeming @@ -4860,6 +4850,28 @@ completion_list_add_name (const char *symname, } } +/* completion_list_add_name wrapper for struct symbol. */ + +static void +completion_list_add_symbol (symbol *sym, + const char *sym_text, int sym_text_len, + const char *text, const char *word) +{ + completion_list_add_name (SYMBOL_NATURAL_NAME (sym), + sym_text, sym_text_len, text, word); +} + +/* completion_list_add_name wrapper for struct minimal_symbol. */ + +static void +completion_list_add_msymbol (minimal_symbol *sym, + const char *sym_text, int sym_text_len, + const char *text, const char *word) +{ + completion_list_add_name (MSYMBOL_NATURAL_NAME (sym), + sym_text, sym_text_len, text, word); +} + /* ObjC: In case we are completing on a selector, look as the msymbol again and feed all the selectors into the mill. */ @@ -5010,7 +5022,7 @@ add_symtab_completions (struct compunit_symtab *cust, if (code == TYPE_CODE_UNDEF || (SYMBOL_DOMAIN (sym) == STRUCT_DOMAIN && TYPE_CODE (SYMBOL_TYPE (sym)) == code)) - COMPLETION_LIST_ADD_SYMBOL (sym, + completion_list_add_symbol (sym, sym_text, sym_text_len, text, word); } @@ -5121,7 +5133,7 @@ default_make_symbol_completion_list_break_on_1 (const char *text, ALL_MSYMBOLS (objfile, msymbol) { QUIT; - MCOMPLETION_LIST_ADD_SYMBOL (msymbol, sym_text, sym_text_len, text, + completion_list_add_msymbol (msymbol, sym_text, sym_text_len, text, word); completion_list_objc_symbol (msymbol, sym_text, sym_text_len, text, @@ -5168,14 +5180,14 @@ default_make_symbol_completion_list_break_on_1 (const char *text, { if (code == TYPE_CODE_UNDEF) { - COMPLETION_LIST_ADD_SYMBOL (sym, sym_text, sym_text_len, text, + completion_list_add_symbol (sym, sym_text, sym_text_len, text, word); completion_list_add_fields (sym, sym_text, sym_text_len, text, word); } else if (SYMBOL_DOMAIN (sym) == STRUCT_DOMAIN && TYPE_CODE (SYMBOL_TYPE (sym)) == code) - COMPLETION_LIST_ADD_SYMBOL (sym, sym_text, sym_text_len, text, + completion_list_add_symbol (sym, sym_text, sym_text_len, text, word); }