From patchwork Fri Apr 27 14:01:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 26999 Received: (qmail 29476 invoked by alias); 27 Apr 2018 14:01: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 29427 invoked by uid 89); 27 Apr 2018 14:01:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: gateway30.websitewelcome.com Received: from gateway30.websitewelcome.com (HELO gateway30.websitewelcome.com) (192.185.149.4) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 27 Apr 2018 14:01:44 +0000 Received: from cm12.websitewelcome.com (cm12.websitewelcome.com [100.42.49.8]) by gateway30.websitewelcome.com (Postfix) with ESMTP id 288BEB558 for ; Fri, 27 Apr 2018 09:01:43 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id C3wVfXLhAlAdrC3wVf6sRD; Fri, 27 Apr 2018 09:01:43 -0500 X-Authority-Reason: nr=8 Received: from 97-122-176-117.hlrn.qwest.net ([97.122.176.117]:54910 helo=pokyo.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89_1) (envelope-from ) id 1fC3wU-000h2v-VG; Fri, 27 Apr 2018 09:01:43 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA v2 5/6] Remove rust_type_alignment Date: Fri, 27 Apr 2018 08:01:38 -0600 Message-Id: <20180427140139.7957-6-tom@tromey.com> In-Reply-To: <20180427140139.7957-1-tom@tromey.com> References: <20180427140139.7957-1-tom@tromey.com> X-BWhitelist: no X-Source-L: No X-Exim-ID: 1fC3wU-000h2v-VG X-Source-Sender: 97-122-176-117.hlrn.qwest.net (pokyo.Home) [97.122.176.117]:54910 X-Source-Auth: tom+tromey.com X-Email-Count: 6 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes rust_type_alignment is not needed now that gdb has type alignment code. So, this removes it. 2018-04-27 Tom Tromey * rust-lang.c (rust_type_alignment): Remove. (rust_composite_type): Use type_align. --- gdb/ChangeLog | 5 +++++ gdb/rust-lang.c | 43 +------------------------------------------ 2 files changed, 6 insertions(+), 42 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 4e1f52dbdf..8aa0fc655e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2018-04-27 Tom Tromey + + * rust-lang.c (rust_type_alignment): Remove. + (rust_composite_type): Use type_align. + 2018-04-27 Tom Tromey * NEWS: Mention Type.align. diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c index cf8a15ee43..74e86d7008 100644 --- a/gdb/rust-lang.c +++ b/gdb/rust-lang.c @@ -851,47 +851,6 @@ rust_print_type (struct type *type, const char *varstring, -/* Compute the alignment of the type T. */ - -static int -rust_type_alignment (struct type *t) -{ - t = check_typedef (t); - switch (TYPE_CODE (t)) - { - default: - error (_("Could not compute alignment of type")); - - case TYPE_CODE_PTR: - case TYPE_CODE_ENUM: - case TYPE_CODE_INT: - case TYPE_CODE_FLT: - case TYPE_CODE_REF: - case TYPE_CODE_CHAR: - case TYPE_CODE_BOOL: - return TYPE_LENGTH (t); - - case TYPE_CODE_ARRAY: - case TYPE_CODE_COMPLEX: - return rust_type_alignment (TYPE_TARGET_TYPE (t)); - - case TYPE_CODE_STRUCT: - case TYPE_CODE_UNION: - { - int i; - int align = 1; - - for (i = 0; i < TYPE_NFIELDS (t); ++i) - { - int a = rust_type_alignment (TYPE_FIELD_TYPE (t, i)); - if (a > align) - align = a; - } - return align; - } - } -} - /* Like arch_composite_type, but uses TYPE to decide how to allocate -- either on an obstack or on a gdbarch. */ @@ -934,7 +893,7 @@ rust_composite_type (struct type *original, if (field2 != NULL) { struct field *field = &TYPE_FIELD (result, i); - int align = rust_type_alignment (type2); + unsigned align = type_align (type2); if (align != 0) {