From patchwork Thu Feb 22 21:04:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keith Seitz X-Patchwork-Id: 26014 Received: (qmail 125698 invoked by alias); 22 Feb 2018 21:05:02 -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 125684 invoked by uid 89); 22 Feb 2018 21:05:02 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No 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, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=precautionary 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; Thu, 22 Feb 2018 21:05:01 +0000 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9688B4ACA4 for ; Thu, 22 Feb 2018 21:04:59 +0000 (UTC) Received: from theo.uglyboxes.com (ovpn04.gateway.prod.ext.phx2.redhat.com [10.5.9.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 581C66012A; Thu, 22 Feb 2018 21:04:59 +0000 (UTC) From: Keith Seitz To: gdb-patches@sourceware.org Subject: [PATCH] Add libcc1 v1 compatibility to C compile feature Date: Thu, 22 Feb 2018 13:04:59 -0800 Message-Id: <20180222210459.11608-1-keiths@redhat.com> X-IsSubscribed: yes From: Alexandre Oliva This patch adds v1 compatibiltiy to the C compile feature. The only change in v1 concerns the handling of integer types, which permits GDB to specify the built-in name for the type. As far as I know, the C frontend is still on v0, so this patch is purely precautionary. [By default C++ compile uses the equivalent of the C frontend's int_type and float_type (aka the "v1" versions).] gdb/ChangeLog: * compile/compile-c-types.c (convert_int, convert_float): Update for C FE v1. --- gdb/compile/compile-c-types.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/gdb/compile/compile-c-types.c b/gdb/compile/compile-c-types.c index 19669a2edc..212cfe66be 100644 --- a/gdb/compile/compile-c-types.c +++ b/gdb/compile/compile-c-types.c @@ -273,9 +273,22 @@ convert_func (struct compile_c_instance *context, struct type *type) static gcc_type convert_int (struct compile_c_instance *context, struct type *type) { - return C_CTX (context)->c_ops->int_type_v0 (C_CTX (context), - TYPE_UNSIGNED (type), - TYPE_LENGTH (type)); + if (C_CTX (context)->c_ops->c_version >= GCC_C_FE_VERSION_1) + { + if (TYPE_NOSIGN (type)) + { + gdb_assert (TYPE_LENGTH (type) == 1); + return C_CTX (context)->c_ops->char_type (C_CTX (context)); + } + return C_CTX (context)->c_ops->int_type (C_CTX (context), + TYPE_UNSIGNED (type), + TYPE_LENGTH (type), + TYPE_NAME (type)); + } + else + return C_CTX (context)->c_ops->int_type_v0 (C_CTX (context), + TYPE_UNSIGNED (type), + TYPE_LENGTH (type)); } /* Convert a floating-point type to its gcc representation. */ @@ -283,8 +296,13 @@ convert_int (struct compile_c_instance *context, struct type *type) static gcc_type convert_float (struct compile_c_instance *context, struct type *type) { - return C_CTX (context)->c_ops->float_type_v0 (C_CTX (context), - TYPE_LENGTH (type)); + if (C_CTX (context)->c_ops->c_version >= GCC_C_FE_VERSION_1) + return C_CTX (context)->c_ops->float_type (C_CTX (context), + TYPE_LENGTH (type), + TYPE_NAME (type)); + else + return C_CTX (context)->c_ops->float_type_v0 (C_CTX (context), + TYPE_LENGTH (type)); } /* Convert the 'void' type to its gcc representation. */