From patchwork Thu Jan 10 22:01:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe Waroquiers X-Patchwork-Id: 31026 Received: (qmail 83390 invoked by alias); 10 Jan 2019 22:01:26 -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 83282 invoked by uid 89); 10 Jan 2019 22:01:25 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-27.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=languageh, language.h, UD:language.h, 1156 X-HELO: mailsec102.isp.belgacom.be Received: from mailsec102.isp.belgacom.be (HELO mailsec102.isp.belgacom.be) (195.238.20.98) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 10 Jan 2019 22:01:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=skynet.be; i=@skynet.be; q=dns/txt; s=securemail; t=1547157683; x=1578693683; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=w1GDOfBfWCb5sPv5MDbG5YzIfTbnZfUX4HSQgyzsVsU=; b=L8oOXbT9TNflVJnTF1WhDsPtRa9sH/bmN5OxhlBpZJyuEgopZQCRNWWj 4SP28QAQ0xWc+o6YrjHquV1rBx6NTw==; Received: from 184.205-67-87.adsl-dyn.isp.belgacom.be (HELO md.home) ([87.67.205.184]) by relay.skynet.be with ESMTP/TLS/DHE-RSA-AES128-GCM-SHA256; 10 Jan 2019 23:01:18 +0100 From: Philippe Waroquiers To: gdb-patches@sourceware.org Cc: Philippe Waroquiers Subject: [RFA 1/3] Use function_name_style to print Ada and C function names Date: Thu, 10 Jan 2019 23:01:11 +0100 Message-Id: <20190110220113.26169-2-philippe.waroquiers@skynet.be> In-Reply-To: <20190110220113.26169-1-philippe.waroquiers@skynet.be> References: <20190110220113.26169-1-philippe.waroquiers@skynet.be> MIME-Version: 1.0 X-IsSubscribed: yes gdb/ChangeLog 2019-01-10 Philippe Waroquiers * ada-typeprint.c (print_func_type): Print function name style to print function name. * c-typeprint.c (c_print_type_1): Likewise. --- gdb/ada-typeprint.c | 6 +++++- gdb/c-typeprint.c | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/gdb/ada-typeprint.c b/gdb/ada-typeprint.c index 2b6cdaf264..8c42e8140d 100644 --- a/gdb/ada-typeprint.c +++ b/gdb/ada-typeprint.c @@ -30,6 +30,7 @@ #include "language.h" #include "demangle.h" #include "c-lang.h" +#include "cli/cli-style.h" #include "typeprint.h" #include "target-float.h" #include "ada-lang.h" @@ -779,7 +780,10 @@ print_func_type (struct type *type, struct ui_file *stream, const char *name, fprintf_filtered (stream, "function"); if (name != NULL && name[0] != '\0') - fprintf_filtered (stream, " %s", name); + { + fputs_filtered (" ", stream); + fputs_styled (name, function_name_style.style (), stream); + } if (len > 0) { diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c index 5e7e672e02..0d2d9b5106 100644 --- a/gdb/c-typeprint.c +++ b/gdb/c-typeprint.c @@ -28,6 +28,7 @@ #include "language.h" #include "demangle.h" #include "c-lang.h" +#include "cli/cli-style.h" #include "typeprint.h" #include "cp-abi.h" #include "cp-support.h" @@ -115,6 +116,7 @@ c_print_type_1 (struct type *type, type = check_typedef (type); local_name = typedef_hash_table::find_typedef (flags, type); + code = TYPE_CODE (type); if (local_name != NULL) { fputs_filtered (local_name, stream); @@ -124,7 +126,6 @@ c_print_type_1 (struct type *type, else { c_type_print_base_1 (type, stream, show, level, language, flags, podata); - code = TYPE_CODE (type); if ((varstring != NULL && *varstring != '\0') /* Need a space if going to print stars or brackets; but not if we will print just a type name. */ @@ -144,7 +145,10 @@ c_print_type_1 (struct type *type, if (varstring != NULL) { - fputs_filtered (varstring, stream); + if (code == TYPE_CODE_FUNC || code == TYPE_CODE_METHOD) + fputs_styled (varstring, function_name_style.style (), stream ); + else + fputs_filtered (varstring, stream); /* For demangled function names, we have the arglist as part of the name, so don't print an additional pair of ()'s. */