From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 33996 invoked by alias); 24 Apr 2018 15:22:36 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 33857 invoked by uid 89); 24 Apr 2018 15:22:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.2 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=gdbarch, allocate X-HELO: gateway24.websitewelcome.com Received: from gateway24.websitewelcome.com (HELO gateway24.websitewelcome.com) (192.185.50.71) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 24 Apr 2018 15:22:33 +0000 Received: from cm14.websitewelcome.com (cm14.websitewelcome.com [100.42.49.7]) by gateway24.websitewelcome.com (Postfix) with ESMTP id C3D1366DC71 for ; Tue, 24 Apr 2018 10:22:31 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id Azm3fBWa25CKDAzm3fjbAg; Tue, 24 Apr 2018 10:22:31 -0500 X-Authority-Reason: nr=8 Received: from 97-122-176-117.hlrn.qwest.net ([97.122.176.117]:45490 helo=pokyo.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89_1) (envelope-from ) id 1fAzm3-002CeZ-Id; Tue, 24 Apr 2018 10:22:31 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 5/6] Remove rust_type_alignment Date: Tue, 24 Apr 2018 15:22:00 -0000 Message-Id: <20180424152222.8053-6-tom@tromey.com> In-Reply-To: <20180424152222.8053-1-tom@tromey.com> References: <20180424152222.8053-1-tom@tromey.com> X-BWhitelist: no X-Source-L: No X-Exim-ID: 1fAzm3-002CeZ-Id X-Source-Sender: 97-122-176-117.hlrn.qwest.net (pokyo.Home) [97.122.176.117]:45490 X-Source-Auth: tom+tromey.com X-Email-Count: 6 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-SW-Source: 2018-04/txt/msg00470.txt.bz2 rust_type_alignment is not needed now that gdb has type alignment code. So, this removes it. 2018-04-24 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 78acc26f4a..04920fbc4b 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2018-04-24 Tom Tromey + + * rust-lang.c (rust_type_alignment): Remove. + (rust_composite_type): Use type_align. + 2018-04-24 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) { -- 2.14.3