From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [RFA v2 5/6] Remove rust_type_alignment
Date: Fri, 27 Apr 2018 14:01:00 -0000 [thread overview]
Message-ID: <20180427140139.7957-6-tom@tromey.com> (raw)
In-Reply-To: <20180427140139.7957-1-tom@tromey.com>
rust_type_alignment is not needed now that gdb has type alignment
code. So, this removes it.
2018-04-27 Tom Tromey <tom@tromey.com>
* 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 <tom@tromey.com>
+
+ * rust-lang.c (rust_type_alignment): Remove.
+ (rust_composite_type): Use type_align.
+
2018-04-27 Tom Tromey <tom@tromey.com>
* 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,
\f
-/* 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
prev parent reply other threads:[~2018-04-27 14:01 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-27 14:01 [RFA v2 0/6] Type alignment Tom Tromey
2018-04-27 14:01 ` [RFA v2 3/6] Reindent type_object_getset in py-type.c Tom Tromey
2018-04-27 18:47 ` Pedro Alves
2018-04-27 20:39 ` Tom Tromey
2018-04-27 14:01 ` [RFA v2 1/6] Add initial type alignment support Tom Tromey
2018-04-27 18:46 ` Pedro Alves
2018-04-27 14:01 ` [RFA v2 2/6] Handle alignof and _Alignof Tom Tromey
2018-04-27 14:19 ` Eli Zaretskii
2018-04-27 18:47 ` Pedro Alves
2018-04-27 20:55 ` Tom Tromey
2018-04-27 20:59 ` Tom Tromey
2018-04-30 16:50 ` Tom Tromey
2018-04-30 17:17 ` Pedro Alves
2018-04-27 14:01 ` [RFA v2 6/6] Remove long_long_align_bit gdbarch attribute Tom Tromey
2018-04-27 18:47 ` Pedro Alves
2018-04-27 14:01 ` [RFA v2 4/6] Expose type alignment on gdb.Type Tom Tromey
2018-04-27 14:18 ` Eli Zaretskii
2018-04-27 18:47 ` Pedro Alves
2018-04-27 20:41 ` Tom Tromey
2018-04-27 14:01 ` Tom Tromey [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180427140139.7957-6-tom@tromey.com \
--to=tom@tromey.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox