This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Remove rust_type_alignment


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=2fff16dd8c25831fb5fbf198ca86d5befff629be

commit 2fff16dd8c25831fb5fbf198ca86d5befff629be
Author: Tom Tromey <tom@tromey.com>
Date:   Mon Apr 23 13:23:02 2018 -0600

    Remove rust_type_alignment
    
    rust_type_alignment is not needed now that gdb has type alignment
    code.  So, this removes it.
    
    2018-04-30  Tom Tromey  <tom@tromey.com>
    
    	* rust-lang.c (rust_type_alignment): Remove.
    	(rust_composite_type): Use type_align.

Diff:
---
 gdb/ChangeLog   |  5 +++++
 gdb/rust-lang.c | 43 +------------------------------------------
 2 files changed, 6 insertions(+), 42 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 0053b90..49481e0 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
 2018-04-30  Tom Tromey  <tom@tromey.com>
 
+	* rust-lang.c (rust_type_alignment): Remove.
+	(rust_composite_type): Use type_align.
+
+2018-04-30  Tom Tromey  <tom@tromey.com>
+
 	* NEWS: Mention Type.align.
 	* python/py-type.c (typy_get_alignof): New function.
 	(type_object_getset): Add "alignof".
diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
index 5d1c0a7..ed03945 100644
--- a/gdb/rust-lang.c
+++ b/gdb/rust-lang.c
@@ -862,47 +862,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.  */
 
@@ -945,7 +904,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)
 	{


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]