aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2004-08-23 08:41:57 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2004-08-23 08:41:57 +0000
commit8dd16ecc7d71b9f1e1bdc4d870cf2436db9594a9 (patch)
tree21e04c3973bfdab79a845ae2282b15da19d7926c /gcc
parente8bf0f3bacc5f3f4ae892f4df794cc23e41519b9 (diff)
downloadgcc-8dd16ecc7d71b9f1e1bdc4d870cf2436db9594a9.zip
gcc-8dd16ecc7d71b9f1e1bdc4d870cf2436db9594a9.tar.gz
gcc-8dd16ecc7d71b9f1e1bdc4d870cf2436db9594a9.tar.bz2
tree.h (build_distinct_type_copy): New.
* tree.h (build_distinct_type_copy): New. (build_type_copy): ... here. Rename to ... (build_variant_type_copy): ... here. * tree.c (build_qualified_type): Rename build_type_copy call. (build_distinct_type_copy): New, broken out of ... (build_type_copy): ... here. Rename to ... (build_variant_type_copy): ... here. Use build_distinct_type_copy. (build_common_tree_nodes_2): Rename build_type_copy call. * c-common.c (c_common_nodes_and_builtins): Rename build_type_copy call. (handle_packed_attribute, handle_unused_attribute, handle_transparanet_union_attribute, handle_aligned_attribute, handle_deprecated_attribute): Likewise. * c-decl.c (clone_underlying_type, store_parm_decls_oldstyle): Likewise. * config/arm/arm.c (arm_handle_isr_attribyte): Likewise. * config/rs6000/rs6000.c (rs6000_init_builtins): Use build_distinct_type_copy. * cp/name-lookup.c (pushdecl): Rename build_type_copy call. * cp/tree.c (cp_build_qualified_type_real, build_exception_variant, handle_java_interface_attribute): Likewise. From-SVN: r86421
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog22
-rw-r--r--gcc/c-common.c14
-rw-r--r--gcc/c-decl.c4
-rw-r--r--gcc/config/arm/arm.c2
-rw-r--r--gcc/config/rs6000/rs6000.c12
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/name-lookup.c2
-rw-r--r--gcc/cp/tree.c6
-rw-r--r--gcc/tree.c35
-rw-r--r--gcc/tree.h3
10 files changed, 74 insertions, 32 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 08c8713..d700176 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,25 @@
+2004-08-23 Nathan Sidwell <nathan@codesourcery.com>
+
+ * tree.h (build_distinct_type_copy): New.
+ (build_type_copy): ... here. Rename to ...
+ (build_variant_type_copy): ... here.
+ * tree.c (build_qualified_type): Rename build_type_copy call.
+ (build_distinct_type_copy): New, broken out of ...
+ (build_type_copy): ... here. Rename to ...
+ (build_variant_type_copy): ... here. Use
+ build_distinct_type_copy.
+ (build_common_tree_nodes_2): Rename build_type_copy call.
+ * c-common.c (c_common_nodes_and_builtins): Rename build_type_copy
+ call.
+ (handle_packed_attribute, handle_unused_attribute,
+ handle_transparanet_union_attribute, handle_aligned_attribute,
+ handle_deprecated_attribute): Likewise.
+ * c-decl.c (clone_underlying_type, store_parm_decls_oldstyle):
+ Likewise.
+ * config/arm/arm.c (arm_handle_isr_attribyte): Likewise.
+ * config/rs6000/rs6000.c (rs6000_init_builtins): Use
+ build_distinct_type_copy.
+
2004-08-23 Richard Sandiford <rsandifo@redhat.com>
* config/mips/mips.md (mfhilo_[sd]i): Redefine using :GPR. Add mode
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 663e2c1..7306cdf 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -2997,7 +2997,7 @@ c_common_nodes_and_builtins (void)
if (c_dialect_cxx ())
/* For C++, make fileptr_type_node a distinct void * type until
FILE type is defined. */
- fileptr_type_node = build_type_copy (ptr_type_node);
+ fileptr_type_node = build_variant_type_copy (ptr_type_node);
record_builtin_type (RID_VOID, NULL, void_type_node);
@@ -3925,7 +3925,7 @@ handle_packed_attribute (tree *node, tree name, tree ARG_UNUSED (args),
if (TYPE_P (*node))
{
if (!(flags & (int) ATTR_FLAG_TYPE_IN_PLACE))
- *node = build_type_copy (*node);
+ *node = build_variant_type_copy (*node);
TYPE_PACKED (*node) = 1;
if (TYPE_MAIN_VARIANT (*node) == *node)
{
@@ -4114,7 +4114,7 @@ handle_unused_attribute (tree *node, tree name, tree ARG_UNUSED (args),
else
{
if (!(flags & (int) ATTR_FLAG_TYPE_IN_PLACE))
- *node = build_type_copy (*node);
+ *node = build_variant_type_copy (*node);
TREE_USED (*node) = 1;
}
@@ -4176,7 +4176,7 @@ handle_transparent_union_attribute (tree *node, tree name,
&& TYPE_MODE (*type) == DECL_MODE (TYPE_FIELDS (*type)))))
{
if (!(flags & (int) ATTR_FLAG_TYPE_IN_PLACE))
- *type = build_type_copy (*type);
+ *type = build_variant_type_copy (*type);
TYPE_TRANSPARENT_UNION (*type) = 1;
}
else if (decl != 0 && TREE_CODE (decl) == PARM_DECL
@@ -4451,14 +4451,14 @@ handle_aligned_attribute (tree *node, tree ARG_UNUSED (name), tree args,
&& DECL_ORIGINAL_TYPE (decl) == NULL_TREE)
{
tree tt = TREE_TYPE (decl);
- *type = build_type_copy (*type);
+ *type = build_variant_type_copy (*type);
DECL_ORIGINAL_TYPE (decl) = tt;
TYPE_NAME (*type) = decl;
TREE_USED (*type) = TREE_USED (decl);
TREE_TYPE (decl) = *type;
}
else if (!(flags & (int) ATTR_FLAG_TYPE_IN_PLACE))
- *type = build_type_copy (*type);
+ *type = build_variant_type_copy (*type);
TYPE_ALIGN (*type) = (1 << i) * BITS_PER_UNIT;
TYPE_USER_ALIGN (*type) = 1;
@@ -4805,7 +4805,7 @@ handle_deprecated_attribute (tree *node, tree name,
else if (TYPE_P (*node))
{
if (!(flags & (int) ATTR_FLAG_TYPE_IN_PLACE))
- *node = build_type_copy (*node);
+ *node = build_variant_type_copy (*node);
TREE_DEPRECATED (*node) = 1;
type = *node;
}
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 9220194..ccf2cb7 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -1843,7 +1843,7 @@ clone_underlying_type (tree x)
{
tree tt = TREE_TYPE (x);
DECL_ORIGINAL_TYPE (x) = tt;
- tt = build_type_copy (tt);
+ tt = build_variant_type_copy (tt);
TYPE_NAME (tt) = x;
TREE_USED (tt) = TREE_USED (x);
TREE_TYPE (x) = tt;
@@ -6198,7 +6198,7 @@ store_parm_decls_oldstyle (tree fndecl, tree arg_info)
will be a variant of the main variant of the original function
type. */
- TREE_TYPE (fndecl) = build_type_copy (TREE_TYPE (fndecl));
+ TREE_TYPE (fndecl) = build_variant_type_copy (TREE_TYPE (fndecl));
TYPE_ACTUAL_ARG_TYPES (TREE_TYPE (fndecl)) = actual;
}
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 19a63bf..96a71f6 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -2625,7 +2625,7 @@ arm_handle_isr_attribute (tree *node, tree name, tree args, int flags,
|| TREE_CODE (TREE_TYPE (*node)) == METHOD_TYPE)
&& arm_isr_value (args) != ARM_FT_UNKNOWN)
{
- *node = build_type_copy (*node);
+ *node = build_variant_type_copy (*node);
TREE_TYPE (*node) = build_type_attribute_variant
(TREE_TYPE (*node),
tree_cons (name, args, TYPE_ATTRIBUTES (TREE_TYPE (*node))));
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 528d5e6..16bf38b 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -7249,14 +7249,10 @@ rs6000_init_builtins (void)
types, especially in C++ land. Similarly, 'vector pixel' is distinct from
'vector unsigned short'. */
- bool_char_type_node = copy_node (unsigned_intQI_type_node);
- TYPE_MAIN_VARIANT (bool_char_type_node) = bool_char_type_node;
- bool_short_type_node = copy_node (unsigned_intHI_type_node);
- TYPE_MAIN_VARIANT (bool_short_type_node) = bool_short_type_node;
- bool_int_type_node = copy_node (unsigned_intSI_type_node);
- TYPE_MAIN_VARIANT (bool_int_type_node) = bool_int_type_node;
- pixel_type_node = copy_node (unsigned_intHI_type_node);
- TYPE_MAIN_VARIANT (pixel_type_node) = pixel_type_node;
+ bool_char_type_node = build_distinct_type_copy (unsigned_intQI_type_node);
+ bool_short_type_node = build_distinct_type_copy (unsigned_intHI_type_node);
+ bool_int_type_node = build_distinct_type_copy (unsigned_intSI_type_node);
+ pixel_type_node = build_distinct_type_copy (unsigned_intHI_type_node);
(*lang_hooks.decls.pushdecl) (build_decl (TYPE_DECL,
get_identifier ("__bool char"),
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index e2b3212..8c74bc2 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2004-08-23 Nathan Sidwell <nathan@codesourcery.com>
+
+ * name-lookup.c (pushdecl): Rename build_type_copy call.
+ * tree.c (cp_build_qualified_type_real,
+ build_exception_variant, handle_java_interface_attribute): Likewise.
+
2004-08-22 Andrew Pinski <apinski@apple.com>
PR c++/14029
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index ccef113..6fec6eb 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -850,7 +850,7 @@ pushdecl (tree x)
|| TYPE_NAME (type) != DECL_ABSTRACT_ORIGIN (x)))
{
DECL_ORIGINAL_TYPE (x) = type;
- type = build_type_copy (type);
+ type = build_variant_type_copy (type);
TYPE_STUB_DECL (type) = TYPE_STUB_DECL (DECL_ORIGINAL_TYPE (x));
TYPE_NAME (type) = x;
TREE_TYPE (x) = type;
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 703d963..017693b 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -465,7 +465,7 @@ cp_build_qualified_type_real (tree type,
{
/* Make a new array type, just like the old one, but with the
appropriately qualified element type. */
- t = build_type_copy (type);
+ t = build_variant_type_copy (type);
TREE_TYPE (t) = element_type;
}
@@ -942,7 +942,7 @@ build_exception_variant (tree type, tree raises)
return v;
/* Need to build a new variant. */
- v = build_type_copy (type);
+ v = build_variant_type_copy (type);
TYPE_RAISES_EXCEPTIONS (v) = raises;
return v;
}
@@ -1776,7 +1776,7 @@ handle_java_interface_attribute (tree* node,
return NULL_TREE;
}
if (!(flags & (int) ATTR_FLAG_TYPE_IN_PLACE))
- *node = build_type_copy (*node);
+ *node = build_variant_type_copy (*node);
TYPE_JAVA_INTERFACE (*node) = 1;
return NULL_TREE;
diff --git a/gcc/tree.c b/gcc/tree.c
index cd298e8..e2cf0c0 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -3126,22 +3126,21 @@ build_qualified_type (tree type, int type_quals)
/* If not, build it. */
if (!t)
{
- t = build_type_copy (type);
+ t = build_variant_type_copy (type);
set_type_quals (t, type_quals);
}
return t;
}
-/* Create a new variant of TYPE, equivalent but distinct.
- This is so the caller can modify it. */
+/* Create a new distinct copy of TYPE. The new type is made its own
+ MAIN_VARIANT. */
tree
-build_type_copy (tree type)
+build_distinct_type_copy (tree type)
{
- tree t, m = TYPE_MAIN_VARIANT (type);
-
- t = copy_node (type);
+ tree t = copy_node (type);
+
if (TYPE_CACHED_VALUES_P(t))
{
/* Do not copy the values cache. */
@@ -3154,9 +3153,27 @@ build_type_copy (tree type)
TYPE_POINTER_TO (t) = 0;
TYPE_REFERENCE_TO (t) = 0;
- /* Add this type to the chain of variants of TYPE. */
+ /* Make it its own variant. */
+ TYPE_MAIN_VARIANT (t) = t;
+ TYPE_NEXT_VARIANT (t) = 0;
+
+ return t;
+}
+
+/* Create a new variant of TYPE, equivalent but distinct.
+ This is so the caller can modify it. */
+
+tree
+build_variant_type_copy (tree type)
+{
+ tree t, m = TYPE_MAIN_VARIANT (type);
+
+ t = build_distinct_type_copy (type);
+
+ /* Add the new type to the chain of variants of TYPE. */
TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (m);
TYPE_NEXT_VARIANT (m) = t;
+ TYPE_MAIN_VARIANT (t) = m;
return t;
}
@@ -5494,7 +5511,7 @@ build_common_tree_nodes_2 (int short_double)
don't copy record types and let c_common_nodes_and_builtins()
declare the type to be __builtin_va_list. */
if (TREE_CODE (t) != RECORD_TYPE)
- t = build_type_copy (t);
+ t = build_variant_type_copy (t);
va_list_type_node = t;
}
diff --git a/gcc/tree.h b/gcc/tree.h
index c8f3c5e..6e381a6 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -2961,7 +2961,8 @@ extern tree build_qualified_type (tree, int);
/* Make a copy of a type node. */
-extern tree build_type_copy (tree);
+extern tree build_distinct_type_copy (tree);
+extern tree build_variant_type_copy (tree);
/* Finish up a builtin RECORD_TYPE. Give it a name and provide its
fields. Optionally specify an alignment, and then lay it out. */