aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2007-11-29 12:41:41 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2007-11-29 12:41:41 +0000
commita6dcb051e93cdf2b5280a11a9f4225d6cc46b434 (patch)
treeb9c209179e868e9dec41ead2db3a311487b18c43
parent17a15a5c4ac6cf9c43584cd76a825e843c09c4f9 (diff)
downloadgcc-a6dcb051e93cdf2b5280a11a9f4225d6cc46b434.zip
gcc-a6dcb051e93cdf2b5280a11a9f4225d6cc46b434.tar.gz
gcc-a6dcb051e93cdf2b5280a11a9f4225d6cc46b434.tar.bz2
decl.c (make_packable_type): Retrieve the real name of the type.
* decl.c (make_packable_type): Retrieve the real name of the type. (maybe_pad_type): Simplify similar code. From-SVN: r130512
-rw-r--r--gcc/ada/ChangeLog5
-rw-r--r--gcc/ada/decl.c16
2 files changed, 16 insertions, 5 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 4c81d84..c65713b 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,8 @@
+2007-11-29 Eric Botcazou <ebotcazou@adacore.com>
+
+ * decl.c (make_packable_type): Retrieve the real name of the type.
+ (maybe_pad_type): Simplify similar code.
+
2007-11-28 Samuel Tardieu <sam@rfc1149.net>
PR ada/15803
diff --git a/gcc/ada/decl.c b/gcc/ada/decl.c
index 8cac29a..876b159 100644
--- a/gcc/ada/decl.c
+++ b/gcc/ada/decl.c
@@ -5198,13 +5198,17 @@ static tree
make_packable_type (tree type)
{
tree new_type = make_node (TREE_CODE (type));
+ tree name = TYPE_NAME (type);
tree field_list = NULL_TREE;
tree old_field;
+ if (name && TREE_CODE (name) == TYPE_DECL)
+ name = DECL_NAME (name);
+
/* Copy the name and flags from the old type to that of the new and set
the alignment to try for an integral type. For QUAL_UNION_TYPE,
also copy the size. */
- TYPE_NAME (new_type) = TYPE_NAME (type);
+ TYPE_NAME (new_type) = name;
TYPE_JUSTIFIED_MODULAR_P (new_type)
= TYPE_JUSTIFIED_MODULAR_P (type);
TYPE_CONTAINS_TEMPLATE_P (new_type) = TYPE_CONTAINS_TEMPLATE_P (type);
@@ -5394,16 +5398,18 @@ maybe_pad_type (tree type, tree size, unsigned int align,
/* Unless debugging information isn't being written for the input type,
write a record that shows what we are a subtype of and also make a
variable that indicates our size, if variable. */
- if (TYPE_NAME (record) && AGGREGATE_TYPE_P (type)
+ if (TYPE_NAME (record)
+ && AGGREGATE_TYPE_P (type)
&& (TREE_CODE (TYPE_NAME (type)) != TYPE_DECL
|| !DECL_IGNORED_P (TYPE_NAME (type))))
{
tree marker = make_node (RECORD_TYPE);
- tree name = (TREE_CODE (TYPE_NAME (record)) == TYPE_DECL
- ? DECL_NAME (TYPE_NAME (record))
- : TYPE_NAME (record));
+ tree name = TYPE_NAME (record);
tree orig_name = TYPE_NAME (type);
+ if (TREE_CODE (name) == TYPE_DECL)
+ name = DECL_NAME (name);
+
if (TREE_CODE (orig_name) == TYPE_DECL)
orig_name = DECL_NAME (orig_name);