From patchwork Wed Feb 27 20:00:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 31635 Received: (qmail 69398 invoked by alias); 27 Feb 2019 20:01:05 -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 69247 invoked by uid 89); 27 Feb 2019 20:00:55 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=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.2 spammy= X-HELO: mail.efficios.com Received: from mail.efficios.com (HELO mail.efficios.com) (167.114.142.138) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 27 Feb 2019 20:00:49 +0000 Received: from localhost (ip6-localhost [IPv6:::1]) by mail.efficios.com (Postfix) with ESMTP id DF27480865 for ; Wed, 27 Feb 2019 15:00:38 -0500 (EST) Received: from mail.efficios.com ([IPv6:::1]) by localhost (mail02.efficios.com [IPv6:::1]) (amavisd-new, port 10032) with ESMTP id KakVCjPM9PhQ; Wed, 27 Feb 2019 15:00:38 -0500 (EST) Received: from localhost (ip6-localhost [IPv6:::1]) by mail.efficios.com (Postfix) with ESMTP id A3D4E8082D; Wed, 27 Feb 2019 15:00:38 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com A3D4E8082D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=default; t=1551297638; bh=kOfAsE/FdbpSGpemt1P1eMEflyfST0zJlCS0iLcFFVk=; h=From:To:Date:Message-Id:MIME-Version; b=QSYlP606gTvIUdbtwq9wWxD0rXLMDgXMxmuO+ey7svr4CfLmRkMddx6A5vu9G9d+H dTOwKdwtlSl2Dbl0Nqap5Di7YfaclYi2c4HihmVreG1Q0lXVfn3wyE294UgpgZPMbx 5dyfMLk05AtPZpFd1f+H5YkS+f4le/oGMcTfRThpJy8Ci8O0uOpd/hfMFQiWS/UT5O UZgr51IZEeDj9qFrsRJQxfReMTWKMJfUshzRaNPlVcTGNP/DYjqL8qcCcXSqEIGTOL sXp4+RwxYWlWza41H8iR0g1UuwIDOjl0qacJQA+Qk8nm4f2aOOCaLQhFPswcrUY9KP Mm/qTwtC99EEQ== Received: from mail.efficios.com ([IPv6:::1]) by localhost (mail02.efficios.com [IPv6:::1]) (amavisd-new, port 10026) with ESMTP id RYO3g0iChu9I; Wed, 27 Feb 2019 15:00:38 -0500 (EST) Received: from smarchi-efficios.internal.efficios.com (192-222-157-41.qc.cable.ebox.net [192.222.157.41]) by mail.efficios.com (Postfix) with ESMTPSA id 88C0F80815; Wed, 27 Feb 2019 15:00:38 -0500 (EST) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 10/13] Split rank_one_type_parm_complex from rank_one_type Date: Wed, 27 Feb 2019 15:00:25 -0500 Message-Id: <20190227200028.27360-11-simon.marchi@efficios.com> In-Reply-To: <20190227200028.27360-1-simon.marchi@efficios.com> References: <20190227200028.27360-1-simon.marchi@efficios.com> MIME-Version: 1.0 gdb/ChangeLog: * gdbtypes.c (rank_one_type_parm_complex): New function extracted from... (rank_one_type): ... this. --- gdb/gdbtypes.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index f9aa14d724..3cf6ba87f7 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -4146,6 +4146,22 @@ rank_one_type_parm_float (struct type *parm, struct type *arg, struct value *val } } +/* rank_one_type helper for when PARM's type code is TYPE_CODE_COMPLEX. */ + +static struct rank +rank_one_type_parm_complex (struct type *parm, struct type *arg, struct value *value) +{ + switch (TYPE_CODE (arg)) + { /* Strictly not needed for C++, but... */ + case TYPE_CODE_FLT: + return FLOAT_PROMOTION_BADNESS; + case TYPE_CODE_COMPLEX: + return EXACT_MATCH_BADNESS; + default: + return INCOMPATIBLE_TYPE_BADNESS; + } +} + /* Compare one type (PARM) for compatibility with another (ARG). * PARM is intended to be the parameter type of a function; and * ARG is the supplied argument's type. This function tests if @@ -4254,16 +4270,7 @@ rank_one_type (struct type *parm, struct type *arg, struct value *value) case TYPE_CODE_FLT: return rank_one_type_parm_float (parm, arg, value); case TYPE_CODE_COMPLEX: - switch (TYPE_CODE (arg)) - { /* Strictly not needed for C++, but... */ - case TYPE_CODE_FLT: - return FLOAT_PROMOTION_BADNESS; - case TYPE_CODE_COMPLEX: - return EXACT_MATCH_BADNESS; - default: - return INCOMPATIBLE_TYPE_BADNESS; - } - break; + return rank_one_type_parm_complex (parm, arg, value); case TYPE_CODE_STRUCT: switch (TYPE_CODE (arg)) {