aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Macleod <amacleod@redhat.com>2015-12-16 14:26:48 +0000
committerAndrew Macleod <amacleod@redhat.com>2015-12-16 14:26:48 +0000
commit7d25fbad2a93f90b8b4fc7a5100d876311e1f060 (patch)
tree18ae20ac353c4c67ba2d7b5bb5a64aa0f32f4501
parenteb8ef03b4e5260477cfc2139c27cfa4f69fba05b (diff)
patch 08 ttypeify attribute tables now
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/ttype-2015@231694 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ada/gcc-interface/gigi.h4
-rw-r--r--gcc/ada/gcc-interface/utils.c74
-rw-r--r--gcc/attribs.c16
-rw-r--r--gcc/c-family/c-common.c110
-rw-r--r--gcc/c-family/c-common.h4
-rw-r--r--gcc/c-family/c-format.c8
-rw-r--r--gcc/config/i386/i386.c73
-rw-r--r--gcc/config/mips/mips.c4
-rw-r--r--gcc/config/s390/s390.c6
-rw-r--r--gcc/cp/cp-tree.h6
-rw-r--r--gcc/cp/decl2.c6
-rw-r--r--gcc/cp/tree.c27
-rw-r--r--gcc/cp/typeck.c4
-rw-r--r--gcc/langhooks.h2
-rw-r--r--gcc/lto/lto-lang.c34
-rw-r--r--gcc/tree-core.h2
-rw-r--r--gcc/tree-inline.c43
-rw-r--r--gcc/tree-inline.h4
-rw-r--r--gcc/tree.c10
-rw-r--r--gcc/tree.h8
20 files changed, 234 insertions, 211 deletions
diff --git a/gcc/ada/gcc-interface/gigi.h b/gcc/ada/gcc-interface/gigi.h
index 6cb8c061ef6..1150988c180 100644
--- a/gcc/ada/gcc-interface/gigi.h
+++ b/gcc/ada/gcc-interface/gigi.h
@@ -533,10 +533,10 @@ extern tree gnat_type_for_mode (machine_mode mode, int unsignedp);
extern void gnat_write_global_declarations (void);
/* Return the unsigned version of a TYPE_NODE, a scalar type. */
-extern tree gnat_unsigned_type (tree type_node);
+extern ttype *gnat_unsigned_type (tree type_node);
/* Return the signed version of a TYPE_NODE, a scalar type. */
-extern tree gnat_signed_type (tree type_node);
+extern ttype *gnat_signed_type (tree type_node);
/* Return 1 if the types T1 and T2 are compatible, i.e. if they can be
transparently converted to each other. */
diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c
index 151c6cdd317..2c5f0a511b1 100644
--- a/gcc/ada/gcc-interface/utils.c
+++ b/gcc/ada/gcc-interface/utils.c
@@ -94,19 +94,19 @@ static tree handle_const_attribute (tree *, tree, tree, int, bool *);
static tree handle_nothrow_attribute (tree *, tree, tree, int, bool *);
static tree handle_pure_attribute (tree *, tree, tree, int, bool *);
static tree handle_novops_attribute (tree *, tree, tree, int, bool *);
-static tree handle_nonnull_attribute (tree *, tree, tree, int, bool *);
-static tree handle_sentinel_attribute (tree *, tree, tree, int, bool *);
+static tree handle_nonnull_attribute (ttype **, tree, tree, int, bool *);
+static tree handle_sentinel_attribute (ttype **, tree, tree, int, bool *);
static tree handle_noreturn_attribute (tree *, tree, tree, int, bool *);
static tree handle_leaf_attribute (tree *, tree, tree, int, bool *);
static tree handle_always_inline_attribute (tree *, tree, tree, int, bool *);
static tree handle_malloc_attribute (tree *, tree, tree, int, bool *);
-static tree handle_type_generic_attribute (tree *, tree, tree, int, bool *);
-static tree handle_vector_size_attribute (tree *, tree, tree, int, bool *);
-static tree handle_vector_type_attribute (tree *, tree, tree, int, bool *);
+static tree handle_type_generic_attribute (ttype **, tree, tree, int, bool *);
+static tree handle_vector_size_attribute (ttype **, tree, tree, int, bool *);
+static tree handle_vector_type_attribute (ttype **, tree, tree, int, bool *);
/* Fake handler for attributes we don't properly support, typically because
they'd require dragging a lot of the common-c front-end circuitry. */
-static tree fake_attribute_handler (tree *, tree, tree, int, bool *);
+static tree fake_attribute_handler (ttype **, tree, tree, int, bool *);
/* Table of machine-independent internal attributes for Ada. We support
this minimal set of attributes to accommodate the needs of builtins. */
@@ -3294,10 +3294,10 @@ gnat_type_for_mode (machine_mode mode, int unsignedp)
/* Return the unsigned version of a TYPE_NODE, a scalar type. */
-tree
+ttype *
gnat_unsigned_type (tree type_node)
{
- tree type = gnat_type_for_size (TYPE_PRECISION (type_node), 1);
+ ttype *type = gnat_type_for_size (TYPE_PRECISION (type_node), 1);
if (TREE_CODE (type_node) == INTEGER_TYPE && TYPE_MODULAR_P (type_node))
{
@@ -3317,10 +3317,10 @@ gnat_unsigned_type (tree type_node)
/* Return the signed version of a TYPE_NODE, a scalar type. */
-tree
+ttype *
gnat_signed_type (tree type_node)
{
- tree type = gnat_type_for_size (TYPE_PRECISION (type_node), 0);
+ ttype *type = gnat_type_for_size (TYPE_PRECISION (type_node), 0);
if (TREE_CODE (type_node) == INTEGER_TYPE && TYPE_MODULAR_P (type_node))
{
@@ -3630,7 +3630,7 @@ type_for_vector_element_p (tree type)
this is not possible. If ATTRIBUTE is non-zero, we are processing the
attribute declaration and want to issue error messages on failure. */
-static tree
+static ttype *
build_vector_type_for_size (tree inner_type, tree size, tree attribute)
{
unsigned HOST_WIDE_INT size_int, inner_size_int;
@@ -3641,7 +3641,7 @@ build_vector_type_for_size (tree inner_type, tree size, tree attribute)
base types, and this attribute is for binding implementors, not end
users, so we should never get there from legitimate explicit uses. */
if (!tree_fits_uhwi_p (size))
- return NULL_TREE;
+ return NULL;
size_int = tree_to_uhwi (size);
if (!type_for_vector_element_p (inner_type))
@@ -3649,7 +3649,7 @@ build_vector_type_for_size (tree inner_type, tree size, tree attribute)
if (attribute)
error ("invalid element type for attribute %qs",
IDENTIFIER_POINTER (attribute));
- return NULL_TREE;
+ return NULL;
}
inner_size_int = tree_to_uhwi (TYPE_SIZE_UNIT (inner_type));
@@ -3657,14 +3657,14 @@ build_vector_type_for_size (tree inner_type, tree size, tree attribute)
{
if (attribute)
error ("vector size not an integral multiple of component size");
- return NULL_TREE;
+ return NULL;
}
if (size_int == 0)
{
if (attribute)
error ("zero vector size");
- return NULL_TREE;
+ return NULL;
}
nunits = size_int / inner_size_int;
@@ -3672,7 +3672,7 @@ build_vector_type_for_size (tree inner_type, tree size, tree attribute)
{
if (attribute)
error ("number of components of vector not a power of two");
- return NULL_TREE;
+ return NULL;
}
return build_vector_type (inner_type, nunits);
@@ -3682,14 +3682,14 @@ build_vector_type_for_size (tree inner_type, tree size, tree attribute)
NULL_TREE if this is not possible. If ATTRIBUTE is non-zero, we are
processing the attribute and want to issue error messages on failure. */
-static tree
+static ttype *
build_vector_type_for_array (tree array_type, tree attribute)
{
- tree vector_type = build_vector_type_for_size (TREE_TYPE (array_type),
- TYPE_SIZE_UNIT (array_type),
- attribute);
+ ttype *vector_type = build_vector_type_for_size (TREE_TYPE (array_type),
+ TYPE_SIZE_UNIT (array_type),
+ attribute);
if (!vector_type)
- return NULL_TREE;
+ return NULL;
TYPE_REPRESENTATIVE_ARRAY (vector_type) = array_type;
return vector_type;
@@ -5296,11 +5296,11 @@ enum c_tree_index
CTI_MAX
};
-static tree c_global_trees[CTI_MAX];
+static ttype *c_global_types[CTI_MAX];
-#define signed_size_type_node c_global_trees[CTI_SIGNED_SIZE_TYPE]
-#define string_type_node c_global_trees[CTI_STRING_TYPE]
-#define const_string_type_node c_global_trees[CTI_CONST_STRING_TYPE]
+#define signed_size_type_node c_global_types[CTI_SIGNED_SIZE_TYPE]
+#define string_type_node c_global_types[CTI_STRING_TYPE]
+#define const_string_type_node c_global_types[CTI_CONST_STRING_TYPE]
/* ??? In addition some attribute handlers, we currently don't support a
(small) number of builtin-types, which in turns inhibits support for a
@@ -5688,11 +5688,11 @@ get_nonnull_operand (tree arg_num_expr, unsigned HOST_WIDE_INT *valp)
/* Handle the "nonnull" attribute. */
static tree
-handle_nonnull_attribute (tree *node, tree ARG_UNUSED (name),
+handle_nonnull_attribute (ttype **node, tree ARG_UNUSED (name),
tree args, int ARG_UNUSED (flags),
bool *no_add_attrs)
{
- tree type = *node;
+ ttype *type = *node;
unsigned HOST_WIDE_INT attr_arg_num;
/* If no arguments are specified, all pointer arguments should be
@@ -5762,7 +5762,7 @@ handle_nonnull_attribute (tree *node, tree ARG_UNUSED (name),
/* Handle a "sentinel" attribute. */
static tree
-handle_sentinel_attribute (tree *node, tree name, tree args,
+handle_sentinel_attribute (ttype **node, tree name, tree args,
int ARG_UNUSED (flags), bool *no_add_attrs)
{
if (!prototype_p (*node))
@@ -5898,7 +5898,7 @@ handle_malloc_attribute (tree *node, tree name, tree ARG_UNUSED (args),
/* Fake handler for attributes we don't properly support. */
tree
-fake_attribute_handler (tree * ARG_UNUSED (node),
+fake_attribute_handler (ttype ** ARG_UNUSED (node),
tree ARG_UNUSED (name),
tree ARG_UNUSED (args),
int ARG_UNUSED (flags),
@@ -5910,7 +5910,7 @@ fake_attribute_handler (tree * ARG_UNUSED (node),
/* Handle a "type_generic" attribute. */
static tree
-handle_type_generic_attribute (tree *node, tree ARG_UNUSED (name),
+handle_type_generic_attribute (ttype **node, tree ARG_UNUSED (name),
tree ARG_UNUSED (args), int ARG_UNUSED (flags),
bool * ARG_UNUSED (no_add_attrs))
{
@@ -5927,11 +5927,11 @@ handle_type_generic_attribute (tree *node, tree ARG_UNUSED (name),
struct attribute_spec.handler. */
static tree
-handle_vector_size_attribute (tree *node, tree name, tree args,
+handle_vector_size_attribute (ttype **node, tree name, tree args,
int ARG_UNUSED (flags), bool *no_add_attrs)
{
- tree type = *node;
- tree vector_type;
+ ttype *type = *node;
+ ttype *vector_type;
*no_add_attrs = true;
@@ -5945,7 +5945,7 @@ handle_vector_size_attribute (tree *node, tree name, tree args,
while (POINTER_TYPE_P (type)
|| TREE_CODE (type) == FUNCTION_TYPE
|| TREE_CODE (type) == ARRAY_TYPE)
- type = TREE_TYPE (type);
+ type = TREE_TTYPE (type);
vector_type = build_vector_type_for_size (type, TREE_VALUE (args), name);
if (!vector_type)
@@ -5961,11 +5961,11 @@ handle_vector_size_attribute (tree *node, tree name, tree args,
struct attribute_spec.handler. */
static tree
-handle_vector_type_attribute (tree *node, tree name, tree ARG_UNUSED (args),
+handle_vector_type_attribute (ttype **node, tree name, tree ARG_UNUSED (args),
int ARG_UNUSED (flags), bool *no_add_attrs)
{
- tree type = *node;
- tree vector_type;
+ ttype *type = *node;
+ ttype *vector_type;
*no_add_attrs = true;
diff --git a/gcc/attribs.c b/gcc/attribs.c
index 04db498507f..55936c76978 100644
--- a/gcc/attribs.c
+++ b/gcc/attribs.c
@@ -387,18 +387,16 @@ process_attribute_spec (tree a, int flags)
the parameters match those of type_attribute. */
static tree
-finalize_type_attribute (tree *node, const struct attribute_spec *spec,
+finalize_type_attribute (ttype **node, const struct attribute_spec *spec,
tree a, tree returned_attrs, int flags,
tree *decl_node = NULL)
{
bool no_add_attrs = 0;
int fn_ptr_quals = 0;
- tree fn_ptr_tmp = NULL_TREE;
+ ttype *fn_ptr_tmp = NULL;
tree name = get_attribute_name (a);
tree args = TREE_VALUE (a);
- tree *anode = node;
-
- gcc_checking_assert (TYPE_P (*node));
+ ttype **anode = node;
if (spec->function_type_required && TREE_CODE (*anode) != FUNCTION_TYPE
&& TREE_CODE (*anode) != METHOD_TYPE)
@@ -416,7 +414,7 @@ finalize_type_attribute (tree *node, const struct attribute_spec *spec,
This would all be simpler if attributes were part of the
declarator, grumble grumble. */
- fn_ptr_tmp = TREE_TYPE (*anode);
+ fn_ptr_tmp = TREE_TTYPE (*anode);
fn_ptr_quals = TYPE_QUALS (*anode);
anode = &fn_ptr_tmp;
flags &= ~(int) ATTR_FLAG_TYPE_IN_PLACE;
@@ -590,7 +588,7 @@ type_attributes (tree *node, tree attributes, int flags)
}
}
- returned_attrs = finalize_type_attribute (node, spec, a, returned_attrs,
+ returned_attrs = finalize_type_attribute (TTYPE_PTR (node), spec, a, returned_attrs,
flags);
}
@@ -691,9 +689,9 @@ decl_attributes (tree *node, tree attributes, int flags)
the decl's type in place here. */
if (spec->type_required)
{
- anode = &TREE_TYPE (*anode);
+ ttype **ttype_node = TREE_TTYPE_PTR (*anode);
flags &= ~(int) ATTR_FLAG_TYPE_IN_PLACE;
- returned_attrs = finalize_type_attribute (anode, spec, a,
+ returned_attrs = finalize_type_attribute (ttype_node, spec, a,
returned_attrs, flags,
node);
continue;
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index 45a89a5f1c2..c305ab5908b 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -309,7 +309,7 @@ static bool check_case_bounds (location_t, tree, tree, tree *, tree *,
bool *);
static tree handle_packed_decl_attribute (tree *, tree, tree, int, bool *);
-static tree handle_packed_type_attribute (tree *, tree, tree, int, bool *);
+static tree handle_packed_type_attribute (ttype**, tree, tree, int, bool *);
static tree handle_nocommon_attribute (tree *, tree, tree, int, bool *);
static tree handle_common_attribute (tree *, tree, tree, int, bool *);
static tree handle_noreturn_attribute (tree *, tree, tree, int, bool *);
@@ -334,7 +334,7 @@ static tree handle_flatten_attribute (tree *, tree, tree, int, bool *);
static tree handle_error_attribute (tree *, tree, tree, int, bool *);
static tree handle_used_attribute (tree *, tree, tree, int, bool *);
static tree handle_unused_decl_attribute (tree *, tree, tree, int, bool *);
-static tree handle_unused_type_attribute (tree *, tree, tree, int, bool *);
+static tree handle_unused_type_attribute (ttype **, tree, tree, int, bool *);
static tree handle_externally_visible_attribute (tree *, tree, tree, int,
bool *);
static tree handle_no_reorder_attribute (tree *, tree, tree, int,
@@ -342,13 +342,13 @@ static tree handle_no_reorder_attribute (tree *, tree, tree, int,
static tree handle_const_attribute (tree *, tree, tree, int, bool *);
static tree handle_transparent_union_decl_attribute (tree *, tree, tree,
int, bool *);
-static tree handle_transparent_union_type_attribute (tree *, tree, tree,
+static tree handle_transparent_union_type_attribute (ttype **, tree, tree,
int, bool *);
static tree handle_constructor_attribute (tree *, tree, tree, int, bool *);
static tree handle_destructor_attribute (tree *, tree, tree, int, bool *);
-static tree handle_mode_attribute (tree *, tree, tree, int, bool *);
+static tree handle_mode_attribute (ttype **, tree, tree, int, bool *);
static tree handle_section_attribute (tree *, tree, tree, int, bool *);
-static tree handle_aligned_type_attribute (tree *, tree, tree, int, bool *);
+static tree handle_aligned_type_attribute (ttype **, tree, tree, int, bool *);
static tree handle_aligned_decl_attribute (tree *, tree, tree, int, bool *);
static tree handle_weak_attribute (tree *, tree, tree, int, bool *) ;
static tree handle_noplt_attribute (tree *, tree, tree, int, bool *) ;
@@ -358,7 +358,7 @@ static tree handle_alias_attribute (tree *, tree, tree, int, bool *);
static tree handle_weakref_attribute (tree *, tree, tree, int, bool *) ;
static tree handle_visibility_decl_attribute (tree *, tree, tree, int,
bool *);
-static tree handle_visibility_type_attribute (tree *, tree, tree, int,
+static tree handle_visibility_type_attribute (ttype **, tree, tree, int,
bool *);
static tree handle_tls_model_attribute (tree *, tree, tree, int,
bool *);
@@ -370,39 +370,41 @@ static tree handle_no_limit_stack_attribute (tree *, tree, tree, int,
bool *);
static tree handle_pure_attribute (tree *, tree, tree, int, bool *);
static tree handle_tm_decl_attribute (tree *, tree, tree, int, bool *);
-static tree handle_tm_type_attribute (tree *, tree, tree, int, bool *);
+static tree handle_tm_type_attribute (ttype **, tree, tree, int, bool *);
static tree handle_tm_wrap_attribute (tree *, tree, tree, int, bool *);
static tree handle_novops_attribute (tree *, tree, tree, int, bool *);
-static tree handle_deprecated_type_attribute (tree *, tree, tree, int,
+static tree handle_deprecated_type_attribute (ttype **, tree, tree, int,
bool *);
static tree handle_deprecated_decl_attribute (tree *, tree, tree, int,
bool *);
-static tree handle_vector_size_attribute (tree *, tree, tree, int,
+static tree handle_vector_size_attribute (ttype **, tree, tree, int,
bool *);
-static tree handle_nonnull_attribute (tree *, tree, tree, int, bool *);
+static tree handle_nonnull_attribute (ttype **, tree, tree, int, bool *);
static tree handle_nothrow_attribute (tree *, tree, tree, int, bool *);
static tree handle_cleanup_attribute (tree *, tree, tree, int, bool *);
-static tree handle_warn_unused_result_attribute (tree *, tree, tree, int,
+static tree handle_warn_unused_result_attribute (ttype **, tree, tree, int,
bool *);
-static tree handle_sentinel_attribute (tree *, tree, tree, int, bool *);
-static tree handle_type_generic_attribute (tree *, tree, tree, int, bool *);
-static tree handle_alloc_size_attribute (tree *, tree, tree, int, bool *);
-static tree handle_alloc_align_attribute (tree *, tree, tree, int, bool *);
-static tree handle_assume_aligned_attribute (tree *, tree, tree, int, bool *);
+static tree handle_sentinel_attribute (ttype **, tree, tree, int, bool *);
+static tree handle_type_generic_attribute (ttype **, tree, tree, int, bool *);
+static tree handle_alloc_size_attribute (ttype **, tree, tree, int, bool *);
+static tree handle_alloc_align_attribute (ttype **, tree, tree, int, bool *);
+static tree handle_assume_aligned_attribute (ttype **, tree, tree, int, bool *);
static tree handle_target_attribute (tree *, tree, tree, int, bool *);
static tree handle_target_clones_attribute (tree *, tree, tree, int, bool *);
static tree handle_optimize_attribute (tree *, tree, tree, int, bool *);
-static tree ignore_attribute (tree *, tree, tree, int, bool *);
+static tree ignore_attribute (ttype **, tree, tree, int, bool *);
static tree handle_no_split_stack_attribute (tree *, tree, tree, int, bool *);
-static tree handle_fnspec_attribute (tree *, tree, tree, int, bool *);
+static tree handle_fnspec_attribute (ttype **, tree, tree, int, bool *);
static tree handle_warn_unused_decl_attribute (tree *, tree, tree, int, bool *);
-static tree handle_warn_unused_type_attribute (tree *, tree, tree, int, bool *);
-static tree handle_returns_nonnull_attribute (tree *, tree, tree, int, bool *);
+static tree handle_warn_unused_type_attribute (ttype **, tree, tree, int,
+ bool *);
+static tree handle_returns_nonnull_attribute (ttype **, tree, tree, int,
+ bool *);
static tree handle_omp_declare_simd_attribute (tree *, tree, tree, int,
bool *);
static tree handle_omp_declare_target_attribute (tree *, tree, tree, int,
bool *);
-static tree handle_designated_init_attribute (tree *, tree, tree, int, bool *);
+static tree handle_designated_init_attribute (ttype **, tree, tree, int, bool *);
static tree handle_bnd_variable_size_attribute (tree *, tree, tree, int, bool *);
static tree handle_bnd_legacy (tree *, tree, tree, int, bool *);
static tree handle_bnd_instrument (tree *, tree, tree, int, bool *);
@@ -7145,7 +7147,7 @@ handle_packed_decl_attribute (tree *node, tree name, tree ARG_UNUSED (args),
}
static tree
-handle_packed_type_attribute (tree *node, tree ARG_UNUSED (name),
+handle_packed_type_attribute (ttype **node, tree ARG_UNUSED (name),
tree ARG_UNUSED (args),
int flags, bool *ARG_UNUSED (no_add_attrs))
{
@@ -7613,7 +7615,7 @@ handle_unused_decl_attribute (tree *node, tree name, tree ARG_UNUSED (args),
static tree
-handle_unused_type_attribute (tree *node, tree ARG_UNUSED (name),
+handle_unused_type_attribute (ttype **node, tree ARG_UNUSED (name),
tree ARG_UNUSED (args), int flags,
bool *ARG_UNUSED (no_add_attrs))
{
@@ -7711,11 +7713,11 @@ handle_const_attribute (tree *node, tree name, tree ARG_UNUSED (args),
struct attribute_spec.handler. */
static tree
-handle_transparent_union_type_attribute (tree *node, tree name,
+handle_transparent_union_type_attribute (ttype **node, tree name,
tree ARG_UNUSED (args), int flags,
bool *no_add_attrs)
{
- tree type = *node;
+ ttype *type = *node;
*no_add_attrs = true;
if (TREE_CODE (type) == UNION_TYPE)
@@ -7765,7 +7767,7 @@ handle_transparent_union_decl_attribute (tree *node, tree name, tree args,
*no_add_attrs = true;
if (TREE_CODE (*node) == TYPE_DECL && !(flags & ATTR_FLAG_CXX11))
- return handle_transparent_union_type_attribute (&TREE_TYPE (*node), name,
+ return handle_transparent_union_type_attribute (TREE_TTYPE_PTR (*node), name,
args, flags, no_add_attrs);
warning (OPT_Wattributes, "%qE attribute ignored", name);
@@ -7932,10 +7934,10 @@ vector_mode_valid_p (machine_mode mode)
struct attribute_spec.handler. */
static tree
-handle_mode_attribute (tree *node, tree name, tree args,
+handle_mode_attribute (ttype **node, tree name, tree args,
int ARG_UNUSED (flags), bool *no_add_attrs)
{
- tree type = *node;
+ ttype *type = *node;
tree ident = TREE_VALUE (args);
*no_add_attrs = true;
@@ -7948,7 +7950,7 @@ handle_mode_attribute (tree *node, tree name, tree args,
const char *p = IDENTIFIER_POINTER (ident);
int len = strlen (p);
machine_mode mode = VOIDmode;
- tree typefm;
+ ttype *typefm;
bool valid_mode;
if (len > 4 && p[0] == '_' && p[1] == '_'
@@ -8058,9 +8060,9 @@ handle_mode_attribute (tree *node, tree name, tree args,
return NULL_TREE;
}
/* For fixed-point modes, we need to pass saturating info. */
- typefm = lang_hooks.types.type_for_mode (mode,
+ typefm = TTYPE (lang_hooks.types.type_for_mode (mode,
ALL_FIXED_POINT_MODE_P (mode) ? TYPE_SATURATING (type)
- : TYPE_UNSIGNED (type));
+ : TYPE_UNSIGNED (type)));
}
if (typefm == NULL_TREE)
@@ -8316,7 +8318,7 @@ get_align_expr (tree args)
/* Set the type alignment fields of NODE, based on FLAGS to I. */
static void
-handle_aligned_type (tree *node, int flags, int i)
+handle_aligned_type (ttype **node, int flags, int i)
{
if (!(flags & (int) ATTR_FLAG_TYPE_IN_PLACE))
*node = build_variant_type_copy (*node);
@@ -8329,8 +8331,8 @@ handle_aligned_type (tree *node, int flags, int i)
struct attribute_spec.handler. */
static tree
-handle_aligned_type_attribute (tree *node, tree ARG_UNUSED (name), tree args,
- int flags, bool *no_add_attrs)
+handle_aligned_type_attribute (ttype **node, tree ARG_UNUSED (name), tree args,
+ int flags, bool *no_add_attrs)
{
tree align_expr;
int i;
@@ -8363,7 +8365,7 @@ handle_aligned_decl_attribute (tree *node, tree ARG_UNUSED (name), tree args,
*no_add_attrs = true;
}
else if (TREE_CODE (*node) == TYPE_DECL)
- handle_aligned_type (&TREE_TYPE (*node), flags, i);
+ handle_aligned_type (TREE_TTYPE_PTR (*node), flags, i);
else if (! VAR_OR_FUNCTION_DECL_P (decl)
&& TREE_CODE (decl) != FIELD_DECL)
{
@@ -8695,7 +8697,7 @@ handle_visibility_decl_attribute (tree *node, tree name, tree args,
static tree
-handle_visibility_type_attribute (tree *node, tree name, tree args,
+handle_visibility_type_attribute (ttype **node, tree name, tree args,
int ARG_UNUSED (flags),
bool *ARG_UNUSED (no_add_attrs))
{
@@ -8713,7 +8715,7 @@ handle_visibility_type_attribute (tree *node, tree name, tree args,
else if (TYPE_FIELDS (*node))
{
error ("%qE attribute ignored because %qT is already defined",
- name, *node);
+ name, TREE_CAST (*node));
return NULL_TREE;
}
@@ -8877,7 +8879,7 @@ handle_malloc_attribute (tree *node, tree name, tree ARG_UNUSED (args),
struct attribute_spec.handler. */
static tree
-handle_alloc_size_attribute (tree *node, tree ARG_UNUSED (name), tree args,
+handle_alloc_size_attribute (ttype **node, tree ARG_UNUSED (name), tree args,
int ARG_UNUSED (flags), bool *no_add_attrs)
{
unsigned arg_count = type_num_arguments (*node);
@@ -8905,7 +8907,7 @@ handle_alloc_size_attribute (tree *node, tree ARG_UNUSED (name), tree args,
struct attribute_spec.handler. */
static tree
-handle_alloc_align_attribute (tree *node, tree, tree args, int,
+handle_alloc_align_attribute (ttype **node, tree, tree args, int,
bool *no_add_attrs)
{
unsigned arg_count = type_num_arguments (*node);
@@ -8929,7 +8931,7 @@ handle_alloc_align_attribute (tree *node, tree, tree args, int,
struct attribute_spec.handler. */
static tree
-handle_assume_aligned_attribute (tree *, tree, tree args, int,
+handle_assume_aligned_attribute (ttype **, tree, tree args, int,
bool *no_add_attrs)
{
for (; args; args = TREE_CHAIN (args))
@@ -8954,7 +8956,7 @@ handle_assume_aligned_attribute (tree *, tree, tree args, int,
struct attribute_spec.handler. */
static tree
-handle_fnspec_attribute (tree *node ATTRIBUTE_UNUSED, tree ARG_UNUSED (name),
+handle_fnspec_attribute (ttype **node ATTRIBUTE_UNUSED, tree ARG_UNUSED (name),
tree args, int ARG_UNUSED (flags),
bool *no_add_attrs ATTRIBUTE_UNUSED)
{
@@ -9016,7 +9018,7 @@ handle_bnd_instrument (tree *node, tree name, tree ARG_UNUSED (args),
struct attribute_spec.handler. */
static tree
-handle_warn_unused_type_attribute (tree *node ATTRIBUTE_UNUSED,
+handle_warn_unused_type_attribute (ttype **node ATTRIBUTE_UNUSED,
tree name ATTRIBUTE_UNUSED,
tree args ATTRIBUTE_UNUSED,
int flags ATTRIBUTE_UNUSED,
@@ -9274,7 +9276,7 @@ handle_tm_decl_attribute (tree *node, tree name, tree args,
processing given by function_type_required. */
static tree
-handle_tm_type_attribute (tree *node, tree name, tree args,
+handle_tm_type_attribute (ttype **node, tree name, tree args,
int flags, bool *no_add_attrs)
{
/* Only one path adds the attribute; others don't. */
@@ -9375,7 +9377,7 @@ handle_tm_wrap_attribute (tree *node, tree name, tree args,
overridden by the target, but is not used generically. */
static tree
-ignore_attribute (tree * ARG_UNUSED (node), tree ARG_UNUSED (name),
+ignore_attribute (ttype ** ARG_UNUSED (node), tree ARG_UNUSED (name),
tree ARG_UNUSED (args), int ARG_UNUSED (flags),
bool *no_add_attrs)
{
@@ -9400,7 +9402,7 @@ handle_novops_attribute (tree *node, tree ARG_UNUSED (name),
struct attribute_spec.handler. */
static tree
-handle_deprecated_type_attribute (tree *node, tree ARG_UNUSED (name),
+handle_deprecated_type_attribute (ttype **node, tree ARG_UNUSED (name),
tree args, int flags,
bool *no_add_attrs)
{
@@ -9467,7 +9469,7 @@ handle_deprecated_decl_attribute (tree *node, tree ARG_UNUSED (name),
struct attribute_spec.handler. */
static tree
-handle_vector_size_attribute (tree *node, tree name, tree args,
+handle_vector_size_attribute (ttype **node, tree name, tree args,
int ARG_UNUSED (flags),
bool *no_add_attrs)
{
@@ -9552,7 +9554,7 @@ handle_vector_size_attribute (tree *node, tree name, tree args,
/* Handle the "nonnull" attribute. */
static tree
-handle_nonnull_attribute (tree *node, tree ARG_UNUSED (name),
+handle_nonnull_attribute (ttype **node, tree ARG_UNUSED (name),
tree args, int ARG_UNUSED (flags),
bool *no_add_attrs)
{
@@ -9852,9 +9854,9 @@ handle_cleanup_attribute (tree *node, tree name, tree args,
/* Handle a "warn_unused_result" attribute. No special handling. */
static tree
-handle_warn_unused_result_attribute (tree *node, tree name,
- tree ARG_UNUSED (args),
- int ARG_UNUSED (flags), bool *no_add_attrs)
+handle_warn_unused_result_attribute (ttype **node, tree name,
+ tree ARG_UNUSED (args),
+ int ARG_UNUSED (flags), bool *no_add_attrs)
{
/* Ignore the attribute for functions not returning any value. */
if (VOID_TYPE_P (TREE_TYPE (*node)))
@@ -9869,7 +9871,7 @@ handle_warn_unused_result_attribute (tree *node, tree name,
/* Handle a "sentinel" attribute. */
static tree
-handle_sentinel_attribute (tree *node, tree name, tree args,
+handle_sentinel_attribute (ttype **node, tree name, tree args,
int ARG_UNUSED (flags), bool *no_add_attrs)
{
if (!prototype_p (*node))
@@ -9919,7 +9921,7 @@ handle_sentinel_attribute (tree *node, tree name, tree args,
/* Handle a "type_generic" attribute. */
static tree
-handle_type_generic_attribute (tree *node, tree ARG_UNUSED (name),
+handle_type_generic_attribute (ttype **node, tree ARG_UNUSED (name),
tree ARG_UNUSED (args), int ARG_UNUSED (flags),
bool * ARG_UNUSED (no_add_attrs))
{
@@ -10186,7 +10188,7 @@ handle_no_split_stack_attribute (tree *node, tree name,
struct attribute_spec.handler. */
static tree
-handle_returns_nonnull_attribute (tree *node, tree, tree, int,
+handle_returns_nonnull_attribute (ttype **node, tree, tree, int,
bool *no_add_attrs)
{
// Even without a prototype we still have a return type we can check.
@@ -10202,7 +10204,7 @@ handle_returns_nonnull_attribute (tree *node, tree, tree, int,
struct attribute_spec.handler. */
static tree
-handle_designated_init_attribute (tree *node, tree name, tree, int,
+handle_designated_init_attribute (ttype **node, tree name, tree, int,
bool *no_add_attrs)
{
if (TREE_CODE (*node) != RECORD_TYPE)
diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h
index dbb568ab667..919e3b8ce4f 100644
--- a/gcc/c-family/c-common.h
+++ b/gcc/c-family/c-common.h
@@ -799,8 +799,8 @@ extern void check_function_arguments_recurse (void (*)
unsigned HOST_WIDE_INT);
extern bool check_builtin_function_arguments (tree, int, tree *);
extern void check_function_format (tree, int, tree *);
-extern tree handle_format_attribute (tree *, tree, tree, int, bool *);
-extern tree handle_format_arg_attribute (tree *, tree, tree, int, bool *);
+extern tree handle_format_attribute (ttype **, tree, tree, int, bool *);
+extern tree handle_format_arg_attribute (ttype **, tree, tree, int, bool *);
extern bool attribute_takes_identifier_p (const_tree);
extern bool c_common_handle_option (size_t, const char *, int, int, location_t,
const struct cl_option_handlers *);
diff --git a/gcc/c-family/c-format.c b/gcc/c-family/c-format.c
index 96863594353..92bb7edfa3d 100644
--- a/gcc/c-family/c-format.c
+++ b/gcc/c-family/c-format.c
@@ -166,10 +166,10 @@ valid_stringptr_type_p (tree strref)
/* Handle a "format_arg" attribute; arguments as in
struct attribute_spec.handler. */
tree
-handle_format_arg_attribute (tree *node, tree ARG_UNUSED (name),
+handle_format_arg_attribute (ttype **node, tree ARG_UNUSED (name),
tree args, int flags, bool *no_add_attrs)
{
- tree type = *node;
+ ttype *type = *node;
tree format_num_expr = TREE_VALUE (args);
unsigned HOST_WIDE_INT format_num = 0;
@@ -3115,10 +3115,10 @@ cmp_attribs (const char *tattr_name, const char *attr_name)
/* Handle a "format" attribute; arguments as in
struct attribute_spec.handler. */
tree
-handle_format_attribute (tree *node, tree ARG_UNUSED (name), tree args,
+handle_format_attribute (ttype **node, tree ARG_UNUSED (name), tree args,
int flags, bool *no_add_attrs)
{
- tree type = *node;
+ ttype *type = *node;
function_format_info info;
#ifdef TARGET_FORMAT_TYPES
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 735f006afb3..3e14498a1a6 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -6718,7 +6718,7 @@ ix86_function_ok_for_sibcall (tree decl, tree exp)
arguments as in struct attribute_spec.handler. */
static tree
-ix86_handle_cconv_attribute (tree *node, tree name,
+ix86_handle_cconv_attribute (ttype **node, tree name,
tree args,
int,
bool *no_add_attrs)
@@ -6856,6 +6856,22 @@ ix86_handle_cconv_attribute (tree *node, tree name,
return NULL_TREE;
}
+
+static tree
+ix86_handle_tm_regparm_get_attr ()
+{
+ tree alt;
+ /* ??? Is there a better way to validate 32-bit windows? We have
+ cfun->machine->call_abi, but that seems to be set only for 64-bit. */
+ if (CHECK_STACK_LIMIT > 0)
+ alt = tree_cons (get_identifier ("fastcall"), NULL, NULL);
+ else
+ {
+ alt = tree_cons (NULL, build_int_cst (NULL, 2), NULL);
+ alt = tree_cons (get_identifier ("regparm"), alt, NULL);
+ }
+ return alt;
+}
/* The transactional memory builtins are implicitly regparm or fastcall
depending on the ABI. Override the generic do-nothing attribute that
these builtins were declared with, and replace it with one of the two
@@ -6867,26 +6883,33 @@ ix86_handle_tm_regparm_attribute (tree *node, tree, tree,
{
tree alt;
+ /* The 64-bit ABI is unchanged for transactional memory. */
+ if (TARGET_64BIT)
+ return NULL_TREE;
+
/* In no case do we want to add the placeholder attribute. */
*no_add_attrs = true;
+ alt = ix86_handle_tm_regparm_get_attr ();
+ decl_attributes (node, alt, flags);
+
+ return NULL_TREE;
+}
+
+
+static tree
+ix86_handle_tm_regparm_type_attribute (ttype **node, tree, tree,
+ int flags, bool *no_add_attrs)
+{
+ tree alt;
/* The 64-bit ABI is unchanged for transactional memory. */
if (TARGET_64BIT)
return NULL_TREE;
- /* ??? Is there a better way to validate 32-bit windows? We have
- cfun->machine->call_abi, but that seems to be set only for 64-bit. */
- if (CHECK_STACK_LIMIT > 0)
- alt = tree_cons (get_identifier ("fastcall"), NULL, NULL);
- else
- {
- alt = tree_cons (NULL, build_int_cst (NULL, 2), NULL);
- alt = tree_cons (get_identifier ("regparm"), alt, NULL);
- }
- if (TYPE_P (*node))
- type_attributes (node, alt, flags);
- else
- decl_attributes (node, alt, flags);
+ /* In no case do we want to add the placeholder attribute. */
+ *no_add_attrs = true;
+ alt = ix86_handle_tm_regparm_get_attr ();
+ type_attributes (TREE_PTR_CAST (node), alt, flags);
return NULL_TREE;
}
@@ -11894,7 +11917,7 @@ find_drap_reg (void)
/* Handle a "force_align_arg_pointer" attribute. */
static tree
-ix86_handle_force_align_arg_pointer_attribute (tree *node, tree name,
+ix86_handle_force_align_arg_pointer_attribute (ttype **node, tree name,
tree, int, bool *no_add_attrs)
{
if (TREE_CODE (*node) != FUNCTION_TYPE
@@ -44125,15 +44148,13 @@ x86_order_regs_for_local_alloc (void)
/* Handle a "callee_pop_aggregate_return" attribute; arguments as
in struct attribute_spec handler. */
static tree
-ix86_handle_callee_pop_aggregate_return (tree *node, tree name,
+ix86_handle_callee_pop_aggregate_return (ttype **node, tree name,
tree args,
int,
bool *no_add_attrs)
{
if (TREE_CODE (*node) != FUNCTION_TYPE
- && TREE_CODE (*node) != METHOD_TYPE
- && TREE_CODE (*node) != FIELD_DECL
- && TREE_CODE (*node) != TYPE_DECL)
+ && TREE_CODE (*node) != METHOD_TYPE)
{
warning (OPT_Wattributes, "%qE attribute only applies to functions",
name);
@@ -44177,13 +44198,11 @@ ix86_handle_callee_pop_aggregate_return (tree *node, tree name,
/* Handle a "ms_abi" or "sysv" attribute; arguments as in
struct attribute_spec.handler. */
static tree
-ix86_handle_abi_attribute (tree *node, tree name, tree, int,
+ix86_handle_abi_attribute (ttype **node, tree name, tree, int,
bool *no_add_attrs)
{
if (TREE_CODE (*node) != FUNCTION_TYPE
- && TREE_CODE (*node) != METHOD_TYPE
- && TREE_CODE (*node) != FIELD_DECL
- && TREE_CODE (*node) != TYPE_DECL)
+ && TREE_CODE (*node) != METHOD_TYPE)
{
warning (OPT_Wattributes, "%qE attribute only applies to functions",
name);
@@ -44217,7 +44236,7 @@ ix86_handle_abi_attribute (tree *node, tree name, tree, int,
/* Handle a "ms_struct" or "gcc_struct" attribute; arguments as in
struct attribute_spec.handler. */
static tree
-ix86_handle_struct_type_attribute (tree *type, tree name, tree, int,
+ix86_handle_struct_type_attribute (ttype **type, tree name, tree, int,
bool *no_add_attrs)
{
if (!(RECORD_OR_UNION_TYPE_P (*type)))
@@ -44244,7 +44263,7 @@ ix86_handle_struct_decl_attribute (tree *node, tree name, tree arg, int flags,
bool *no_add_attrs)
{
if (TREE_CODE (*node) == TYPE_DECL)
- return ix86_handle_struct_type_attribute (&(TREE_TYPE (*node)), name, arg,
+ return ix86_handle_struct_type_attribute (TREE_TTYPE_PTR (*node), name, arg,
flags, no_add_attrs);
warning (OPT_Wattributes, "%qE attribute ignored", name);
@@ -48242,8 +48261,8 @@ static const struct attribute_spec ix86_attribute_table[] =
/* The transactional memory builtins are implicitly regparm or fastcall
depending on the ABI. Override the generic do-nothing attribute that
these builtins were declared with. */
- { "*tm regparm", 0, 0, false, true, true, NULL,
- ix86_handle_tm_regparm_attribute, true },
+ { "*tm regparm", 0, 0, false, true, true, ix86_handle_tm_regparm_attribute,
+ ix86_handle_tm_regparm_type_attribute, true },
/* force_align_arg_pointer says this function realigns the stack at entry. */
{ (const char *)&ix86_force_align_arg_pointer_string, 0, 0, false,
true, true, NULL, ix86_handle_force_align_arg_pointer_attribute, false },
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 48c46c12f77..974cd867e2a 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -584,7 +584,7 @@ const enum reg_class mips_regno_to_class[FIRST_PSEUDO_REGISTER] = {
};
static tree mips_handle_interrupt_attr (tree *, tree, tree, int, bool *);
-static tree mips_handle_use_shadow_register_set_attr (tree *, tree, tree, int,
+static tree mips_handle_use_shadow_register_set_attr (ttype **, tree, tree, int,
bool *);
/* The value of TARGET_ATTRIBUTE_TABLE. */
@@ -1509,7 +1509,7 @@ mips_handle_interrupt_attr (tree *node ATTRIBUTE_UNUSED, tree name, tree args,
/* Handle a "use_shadow_register_set" attribute with an optional argument. */
static tree
-mips_handle_use_shadow_register_set_attr (tree *node ATTRIBUTE_UNUSED,
+mips_handle_use_shadow_register_set_attr (ttype **node ATTRIBUTE_UNUSED,
tree name, tree args,
int flags ATTRIBUTE_UNUSED,
bool *no_add_attrs)
diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index c4c8208b30d..785fb3c080a 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -1012,18 +1012,18 @@ s390_handle_hotpatch_attribute (tree *node, tree name, tree args,
/* Expand the s390_vector_bool type attribute. */
static tree
-s390_handle_vectorbool_attribute (tree *node, tree name ATTRIBUTE_UNUSED,
+s390_handle_vectorbool_attribute (ttype **node, tree name ATTRIBUTE_UNUSED,
tree args ATTRIBUTE_UNUSED,
int flags ATTRIBUTE_UNUSED, bool *no_add_attrs)
{
- tree type = *node, result = NULL_TREE;
+ ttype *type = *node, *result = NULL_TYPE;
machine_mode mode;
while (POINTER_TYPE_P (type)
|| TREE_CODE (type) == FUNCTION_TYPE
|| TREE_CODE (type) == METHOD_TYPE
|| TREE_CODE (type) == ARRAY_TYPE)
- type = TREE_TYPE (type);
+ type = TREE_TTYPE (type);
mode = TYPE_MODE (type);
switch (mode)
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 4e25f77610e..3979317965b 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -5764,7 +5764,7 @@ extern tree grokfield (const cp_declarator *, cp_decl_specifier_seq *,
tree, bool, tree, tree);
extern tree grokbitfield (const cp_declarator *, cp_decl_specifier_seq *,
tree, tree);
-extern tree cp_reconstruct_complex_type (tree, tree);
+extern ttype *cp_reconstruct_complex_type (tree, tree);
extern bool attributes_naming_typedef_ok (tree);
extern void cplus_decl_attributes (tree *, tree, int);
extern void finish_anon_union (tree);
@@ -6465,7 +6465,7 @@ extern tree maybe_dummy_object (tree, tree *);
extern int is_dummy_object (const_tree);
extern const struct attribute_spec cxx_attribute_table[];
extern tree make_ptrmem_cst (tree, tree);
-extern tree cp_build_type_attribute_variant (tree, tree);
+extern ttype *cp_build_type_attribute_variant (tree, tree);
extern tree cp_build_reference_type (tree, bool);
extern tree move (tree);
extern ttype *cp_build_qualified_type_real (tree, int, tsubst_flags_t);
@@ -6594,7 +6594,7 @@ extern tree build_ptrmemfunc (tree, tree, int, bool,
extern int cp_type_quals (const_tree);
extern int type_memfn_quals (const_tree);
extern cp_ref_qualifier type_memfn_rqual (const_tree);
-extern tree apply_memfn_quals (tree, cp_cv_quals, cp_ref_qualifier);
+extern ttype *apply_memfn_quals (tree, cp_cv_quals, cp_ref_qualifier);
extern bool cp_has_mutable_p (const_tree);
extern bool at_least_as_qualified_p (const_tree, const_tree);
extern void cp_apply_type_quals_to_decl (int, tree);
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 7e89d2b9c3a..2a913edc41f 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -1313,10 +1313,10 @@ attributes_naming_typedef_ok (tree attrs)
/* Like reconstruct_complex_type, but handle also template trees. */
-tree
+ttype *
cp_reconstruct_complex_type (tree type, tree bottom)
{
- tree inner, outer;
+ ttype *inner, *outer;
bool late_return_type_p = false;
if (TYPE_PTR_P (type))
@@ -1367,7 +1367,7 @@ cp_reconstruct_complex_type (tree type, tree bottom)
outer = build_offset_type (TYPE_OFFSET_BASETYPE (type), inner);
}
else
- return bottom;
+ return TTYPE (bottom);
if (TYPE_ATTRIBUTES (type))
outer = cp_build_type_attribute_variant (outer, TYPE_ATTRIBUTES (type));
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index e73f64a3209..57d671b4d8e 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -49,15 +49,15 @@ static tree build_local_temp (tree);
static tree handle_java_interface_decl_attribute (tree *, tree, tree, int,
bool *);
-static tree handle_java_interface_type_attribute (tree *, tree, tree, int,
+static tree handle_java_interface_type_attribute (ttype **, tree, tree, int,
bool *);
static tree handle_com_interface_decl_attribute (tree *, tree, tree, int,
bool *);
-static tree handle_com_interface_type_attribute (tree *, tree, tree, int,
+static tree handle_com_interface_type_attribute (ttype **, tree, tree, int,
bool *);
static tree handle_init_priority_attribute (tree *, tree, tree, int, bool *);
static tree handle_abi_tag_decl_attribute (tree *, tree, tree, int, bool *);
-static tree handle_abi_tag_type_attribute (tree *, tree, tree, int, bool *);
+static tree handle_abi_tag_type_attribute (ttype **, tree, tree, int, bool *);
/* If REF is an lvalue, returns the kind of lvalue that REF is.
Otherwise, returns clk_none. */
@@ -3446,7 +3446,7 @@ handle_com_interface_decl_attribute (tree* /*node*/, tree name, tree /*args*/,
/* Handle a "java_interface" attribute; arguments as in
struct attribute_spec.handler. */
static tree
-handle_java_interface_type_attribute (tree* node,
+handle_java_interface_type_attribute (ttype **node,
tree name,
tree /*args*/,
int flags,
@@ -3459,8 +3459,7 @@ handle_java_interface_type_attribute (tree* node,
*no_add_attrs = true;
return NULL_TREE;
}
- if (!(flags & (int) ATTR_FLAG_TYPE_IN_PLACE))
- *node = build_variant_type_copy (*node);
+ if (!(flags & (int) ATTR_FLAG_TYPE_IN_PLACE)) *node = build_variant_type_copy (*node);
TYPE_JAVA_INTERFACE (*node) = 1;
return NULL_TREE;
@@ -3469,7 +3468,7 @@ handle_java_interface_type_attribute (tree* node,
/* Handle a "com_interface" attribute; arguments as in
struct attribute_spec.handler. */
static tree
-handle_com_interface_type_attribute (tree* node,
+handle_com_interface_type_attribute (ttype **node,
tree name,
tree /*args*/,
int /*flags*/,
@@ -3692,7 +3691,7 @@ handle_abi_tag_decl_attribute (tree* node, tree name, tree args,
struct attribute_spec.handler. */
static tree
-handle_abi_tag_type_attribute (tree* node, tree name, tree args,
+handle_abi_tag_type_attribute (ttype ** node, tree name, tree args,
int flags, bool* no_add_attrs)
{
tree attributes, decl;
@@ -3702,27 +3701,27 @@ handle_abi_tag_type_attribute (tree* node, tree name, tree args,
if (!OVERLOAD_TYPE_P (*node))
{
error ("%qE attribute applied to non-class, non-enum type %qT",
- name, *node);
+ name, TREE_CAST (*node));
goto fail;
}
else if (!(flags & (int)ATTR_FLAG_TYPE_IN_PLACE))
{
error ("%qE attribute applied to %qT after its definition",
- name, *node);
+ name, TREE_CAST (*node));
goto fail;
}
else if (CLASS_TYPE_P (*node)
&& CLASSTYPE_TEMPLATE_INSTANTIATION (*node))
{
warning (OPT_Wattributes, "ignoring %qE attribute applied to "
- "template instantiation %qT", name, *node);
+ "template instantiation %qT", name, TREE_CAST (*node));
goto fail;
}
else if (CLASS_TYPE_P (*node)
&& CLASSTYPE_TEMPLATE_SPECIALIZATION (*node))
{
warning (OPT_Wattributes, "ignoring %qE attribute applied to "
- "template specialization %qT", name, *node);
+ "template specialization %qT", name, TREE_CAST (*node));
goto fail;
}
@@ -3761,10 +3760,10 @@ make_ptrmem_cst (tree type, tree member)
/* Build a variant of TYPE that has the indicated ATTRIBUTES. May
return an existing type if an appropriate type already exists. */
-tree
+ttype *
cp_build_type_attribute_variant (tree type, tree attributes)
{
- tree new_type;
+ ttype *new_type;
new_type = build_type_attribute_variant (type, attributes);
if (TREE_CODE (new_type) == FUNCTION_TYPE
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 0501e4ded95..48552d26de1 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -9085,14 +9085,14 @@ type_memfn_quals (const_tree type)
/* Returns the FUNCTION_TYPE TYPE with its function-cv-quals changed to
MEMFN_QUALS and its ref-qualifier to RQUAL. */
-tree
+ttype *
apply_memfn_quals (tree type, cp_cv_quals memfn_quals, cp_ref_qualifier rqual)
{
/* Could handle METHOD_TYPE here if necessary. */
gcc_assert (TREE_CODE (type) == FUNCTION_TYPE);
if (TYPE_QUALS (type) == memfn_quals
&& type_memfn_rqual (type) == rqual)
- return type;
+ return (TTYPE (type));
/* This should really have a different TYPE_MAIN_VARIANT, but that gets
complex. */
diff --git a/gcc/langhooks.h b/gcc/langhooks.h
index 1a835d3d66f..912efc25410 100644
--- a/gcc/langhooks.h
+++ b/gcc/langhooks.h
@@ -136,7 +136,7 @@ struct lang_hooks_for_types
we stripped off while looking for the inner type. Similarly for
return values from functions. The argument TYPE is the top of the
chain, and BOTTOM is the new type which we will point to. */
- tree (*reconstruct_complex_type) (tree, tree);
+ ttype *(*reconstruct_complex_type) (tree, tree);
/* Returns the tree that represents the underlying data type used to
implement the enumeration. The default implementation will just use
diff --git a/gcc/lto/lto-lang.c b/gcc/lto/lto-lang.c
index 75ec54f18ae..59631dc59d2 100644
--- a/gcc/lto/lto-lang.c
+++ b/gcc/lto/lto-lang.c
@@ -51,17 +51,17 @@ static tree handle_const_attribute (tree *, tree, tree, int, bool *);
static tree handle_malloc_attribute (tree *, tree, tree, int, bool *);
static tree handle_pure_attribute (tree *, tree, tree, int, bool *);
static tree handle_novops_attribute (tree *, tree, tree, int, bool *);
-static tree handle_nonnull_attribute (tree *, tree, tree, int, bool *);
+static tree handle_nonnull_attribute (ttype **, tree, tree, int, bool *);
static tree handle_nothrow_attribute (tree *, tree, tree, int, bool *);
-static tree handle_sentinel_attribute (tree *, tree, tree, int, bool *);
-static tree handle_type_generic_attribute (tree *, tree, tree, int, bool *);
-static tree handle_transaction_pure_attribute (tree *, tree, tree, int, bool *);
+static tree handle_sentinel_attribute (ttype **, tree, tree, int, bool *);
+static tree handle_type_generic_attribute (ttype **, tree, tree, int, bool *);
+static tree handle_transaction_pure_attribute (ttype **, tree, tree, int, bool *);
static tree handle_returns_twice_attribute (tree *, tree, tree, int, bool *);
-static tree ignore_attribute (tree *, tree, tree, int, bool *);
+static tree ignore_attribute (ttype **, tree, tree, int, bool *);
-static tree handle_format_attribute (tree *, tree, tree, int, bool *);
-static tree handle_fnspec_attribute (tree *, tree, tree, int, bool *);
-static tree handle_format_arg_attribute (tree *, tree, tree, int, bool *);
+static tree handle_format_attribute (ttype **, tree, tree, int, bool *);
+static tree handle_fnspec_attribute (ttype **, tree, tree, int, bool *);
+static tree handle_format_arg_attribute (ttype **, tree, tree, int, bool *);
/* Table of machine-independent attributes supported in GIMPLE. */
const struct attribute_spec lto_attribute_table[] =
@@ -354,11 +354,11 @@ get_nonnull_operand (tree arg_num_expr, unsigned HOST_WIDE_INT *valp)
/* Handle the "nonnull" attribute. */
static tree
-handle_nonnull_attribute (tree *node, tree ARG_UNUSED (name),
+handle_nonnull_attribute (ttype **node, tree ARG_UNUSED (name),
tree args, int ARG_UNUSED (flags),
bool * ARG_UNUSED (no_add_attrs))
{
- tree type = *node;
+ ttype *type = *node;
/* If no arguments are specified, all pointer arguments should be
non-null. Verify a full prototype is given so that the arguments
@@ -418,7 +418,7 @@ handle_nothrow_attribute (tree *node, tree ARG_UNUSED (name),
/* Handle a "sentinel" attribute. */
static tree
-handle_sentinel_attribute (tree *node, tree ARG_UNUSED (name), tree args,
+handle_sentinel_attribute (ttype **node, tree ARG_UNUSED (name), tree args,
int ARG_UNUSED (flags),
bool * ARG_UNUSED (no_add_attrs))
{
@@ -438,7 +438,7 @@ handle_sentinel_attribute (tree *node, tree ARG_UNUSED (name), tree args,
/* Handle a "type_generic" attribute. */
static tree
-handle_type_generic_attribute (tree *node, tree ARG_UNUSED (name),
+handle_type_generic_attribute (ttype **node, tree ARG_UNUSED (name),
tree ARG_UNUSED (args), int ARG_UNUSED (flags),
bool * ARG_UNUSED (no_add_attrs))
{
@@ -454,7 +454,7 @@ handle_type_generic_attribute (tree *node, tree ARG_UNUSED (name),
/* Handle a "transaction_pure" attribute. */
static tree
-handle_transaction_pure_attribute (tree *node, tree ARG_UNUSED (name),
+handle_transaction_pure_attribute (ttype **node, tree ARG_UNUSED (name),
tree ARG_UNUSED (args),
int ARG_UNUSED (flags),
bool * ARG_UNUSED (no_add_attrs))
@@ -484,7 +484,7 @@ handle_returns_twice_attribute (tree *node, tree ARG_UNUSED (name),
overridden by the target, but is not used generically. */
static tree
-ignore_attribute (tree * ARG_UNUSED (node), tree ARG_UNUSED (name),
+ignore_attribute (ttype ** ARG_UNUSED (node), tree ARG_UNUSED (name),
tree ARG_UNUSED (args), int ARG_UNUSED (flags),
bool *no_add_attrs)
{
@@ -496,7 +496,7 @@ ignore_attribute (tree * ARG_UNUSED (node), tree ARG_UNUSED (name),
struct attribute_spec.handler. */
static tree
-handle_format_attribute (tree * ARG_UNUSED (node), tree ARG_UNUSED (name),
+handle_format_attribute (ttype ** ARG_UNUSED (node), tree ARG_UNUSED (name),
tree ARG_UNUSED (args), int ARG_UNUSED (flags),
bool *no_add_attrs)
{
@@ -509,7 +509,7 @@ handle_format_attribute (tree * ARG_UNUSED (node), tree ARG_UNUSED (name),
struct attribute_spec.handler. */
tree
-handle_format_arg_attribute (tree * ARG_UNUSED (node), tree ARG_UNUSED (name),
+handle_format_arg_attribute (ttype ** ARG_UNUSED (node), tree ARG_UNUSED (name),
tree ARG_UNUSED (args), int ARG_UNUSED (flags),
bool *no_add_attrs)
{
@@ -522,7 +522,7 @@ handle_format_arg_attribute (tree * ARG_UNUSED (node), tree ARG_UNUSED (name),
struct attribute_spec.handler. */
static tree
-handle_fnspec_attribute (tree *node ATTRIBUTE_UNUSED, tree ARG_UNUSED (name),
+handle_fnspec_attribute (ttype **node ATTRIBUTE_UNUSED, tree ARG_UNUSED (name),
tree args, int ARG_UNUSED (flags),
bool *no_add_attrs ATTRIBUTE_UNUSED)
{
diff --git a/gcc/tree-core.h b/gcc/tree-core.h
index 11aa7b142f5..ba262434d1c 100644
--- a/gcc/tree-core.h
+++ b/gcc/tree-core.h
@@ -1830,7 +1830,7 @@ struct attribute_spec {
by the rest of this structure. */
tree (*decl_handler) (tree *node, tree name, tree args,
int flags, bool *no_add_attrs);
- tree (*type_handler) (tree *node, tree name, tree args,
+ tree (*type_handler) (ttype **node, tree name, tree args,
int flags, bool *no_add_attrs);
/* Specifies if attribute affects type's identity. */
bool affects_type_identity;
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 884131fc8f7..2600fba43a2 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -381,10 +381,10 @@ remap_decl (tree decl, copy_body_data *id)
return unshare_expr (*n);
}
-static tree
+static ttype *
remap_type_1 (tree type, copy_body_data *id)
{
- tree new_tree, t;
+ ttype *new_tree, *t;
/* We do need a copy. build and register it now. If this is a pointer or
reference type, remap the designated type and make a new pointer or
@@ -414,13 +414,13 @@ remap_type_1 (tree type, copy_body_data *id)
return new_tree;
}
else
- new_tree = copy_node (type);
+ new_tree = copy_node (TTYPE (type));
insert_decl_map (id, type, new_tree);
/* This is a new type, not a copy of an old type. Need to reassociate
variants. We can handle everything except the main variant lazily. */
- t = TYPE_MAIN_VARIANT (type);
+ t = TTYPE_MAIN_VARIANT (type);
if (type != t)
{
t = remap_type (t, id);
@@ -460,12 +460,12 @@ remap_type_1 (tree type, copy_body_data *id)
}
else
{
- t = TYPE_MIN_VALUE (new_tree);
- if (t && TREE_CODE (t) != INTEGER_CST)
+ tree tmp = TYPE_MIN_VALUE (new_tree);
+ if (tmp && TREE_CODE (tmp) != INTEGER_CST)
walk_tree (&TYPE_MIN_VALUE (new_tree), copy_tree_body_r, id, NULL);
- t = TYPE_MAX_VALUE (new_tree);
- if (t && TREE_CODE (t) != INTEGER_CST)
+ tmp = TYPE_MAX_VALUE (new_tree);
+ if (tmp && TREE_CODE (tmp) != INTEGER_CST)
walk_tree (&TYPE_MAX_VALUE (new_tree), copy_tree_body_r, id, NULL);
}
return new_tree;
@@ -511,10 +511,10 @@ remap_type_1 (tree type, copy_body_data *id)
for (f = TYPE_FIELDS (new_tree); f ; f = DECL_CHAIN (f))
{
- t = remap_decl (f, id);
- DECL_CONTEXT (t) = new_tree;
- DECL_CHAIN (t) = nf;
- nf = t;
+ tree tmp = remap_decl (f, id);
+ DECL_CONTEXT (tmp) = new_tree;
+ DECL_CHAIN (tmp) = nf;
+ nf = tmp;
}
TYPE_FIELDS (new_tree) = nreverse (nf);
}
@@ -544,25 +544,25 @@ remap_type_1 (tree type, copy_body_data *id)
return new_tree;
}
-tree
+ttype *
remap_type (tree type, copy_body_data *id)
{
tree *node;
- tree tmp;
+ ttype *tmp;
if (type == NULL)
- return type;
+ return NULL;
/* See if we have remapped this type. */
node = id->decl_map->get (type);
if (node)
- return *node;
+ return TTYPE (*node);
/* The type only needs remapping if it's variably modified. */
if (! variably_modified_type_p (type, id->src_fn))
{
insert_decl_map (id, type, type);
- return type;
+ return TTYPE (type);
}
id->remapping_type_depth++;
@@ -5932,10 +5932,11 @@ maybe_inline_call_in_expr (tree exp)
/* Duplicate a type, fields and all. */
-tree
+ttype *
build_duplicate_type (tree type)
{
struct copy_body_data id;
+ ttype *dup;
memset (&id, 0, sizeof (id));
id.src_fn = current_function_decl;
@@ -5945,15 +5946,15 @@ build_duplicate_type (tree type)
id.debug_map = NULL;
id.copy_decl = copy_decl_no_change;
- type = remap_type_1 (type, &id);
+ dup = remap_type_1 (type, &id);
delete id.decl_map;
if (id.debug_map)
delete id.debug_map;
- TYPE_CANONICAL (type) = type;
+ TYPE_CANONICAL (dup) = dup;
- return type;
+ return dup;
}
/* Unshare the entire DECL_SAVED_TREE of FN and return the remapped
diff --git a/gcc/tree-inline.h b/gcc/tree-inline.h
index b8fb2a2a38c..c1f6bb0b211 100644
--- a/gcc/tree-inline.h
+++ b/gcc/tree-inline.h
@@ -210,7 +210,7 @@ int estimate_num_insns_fn (tree, eni_weights *);
int estimate_num_insns_seq (gimple_seq, eni_weights *);
bool tree_versionable_function_p (tree);
extern tree remap_decl (tree decl, copy_body_data *id);
-extern tree remap_type (tree type, copy_body_data *id);
+extern ttype *remap_type (tree type, copy_body_data *id);
extern gimple_seq copy_gimple_seq_and_replace_locals (gimple_seq seq);
extern bool debug_find_tree (tree, tree);
extern tree copy_fn (tree, tree&, tree&);
@@ -218,6 +218,6 @@ extern const char *copy_forbidden (struct function *fun, tree fndecl);
/* This is in tree-inline.c since the routine uses
data structures from the inliner. */
-extern tree build_duplicate_type (tree);
+extern ttype *build_duplicate_type (tree);
#endif /* GCC_TREE_INLINE_H */
diff --git a/gcc/tree.c b/gcc/tree.c
index 1a3f9f42aef..39a80c800a3 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -6463,10 +6463,10 @@ handle_dll_decl_attribute (tree * pnode, tree name, tree args, int flags,
struct attribute_spec.handler. */
tree
-handle_dll_type_attribute (tree * pnode, tree name, tree args, int flags,
+handle_dll_type_attribute (ttype ** pnode, tree name, tree args, int flags,
bool *no_add_attrs)
{
- tree node = *pnode;
+ ttype *node = *pnode;
/* These attributes may apply to structure and union types being created,
but otherwise should pass to the declaration involved. */
@@ -10591,10 +10591,10 @@ build_common_builtin_nodes (void)
The argument TYPE is the top of the chain, and BOTTOM is the
new type which we will point to. */
-tree
+ttype *
reconstruct_complex_type (tree type, tree bottom)
{
- tree inner, outer;
+ ttype *inner, *outer;
if (TREE_CODE (type) == POINTER_TYPE)
{
@@ -10635,7 +10635,7 @@ reconstruct_complex_type (tree type, tree bottom)
outer = build_offset_type (TYPE_OFFSET_BASETYPE (type), inner);
}
else
- return bottom;
+ return TTYPE (bottom);
return build_type_attribute_qual_variant (outer, TYPE_ATTRIBUTES (type),
TYPE_QUALS (type));
diff --git a/gcc/tree.h b/gcc/tree.h
index 28b8610ea53..4aa3ea57e03 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -1988,6 +1988,7 @@ extern machine_mode element_mode (const_tree t);
TTYPE ((POINTER_TYPE_CHECK (NODE)->u.type_non_common.minval))
#define TTYPE_NEXT_REF_TO(NODE) \
TTYPE ((REFERENCE_TYPE_CHECK (NODE)->u.type_non_common.minval))
+
/* If non-NULL, this is an upper bound of the size (in bytes) of an
object of the given ARRAY_TYPE_NON_COMMON. This allows temporaries to be
allocated. */
@@ -4087,7 +4088,7 @@ extern tree merge_dllimport_decl_attributes (tree, tree);
/* Handle a "dllimport" or "dllexport" attribute. */
extern tree handle_dll_decl_attribute (tree *, tree, tree, int, bool *);
-extern tree handle_dll_type_attribute (tree *, tree, tree, int, bool *);
+extern tree handle_dll_type_attribute (ttype **, tree, tree, int, bool *);
/* Returns true iff unqualified CAND and BASE are equivalent. */
@@ -4626,7 +4627,7 @@ extern int chain_member (const_tree, const_tree);
extern void dump_tree_statistics (void);
extern void recompute_tree_invariant_for_addr_expr (tree);
extern bool needs_to_live_in_memory (const_tree);
-extern tree reconstruct_complex_type (tree, tree);
+extern ttype *reconstruct_complex_type (tree, tree);
extern int real_onep (const_tree);
extern int real_minus_onep (const_tree);
extern void init_ttree (void);
@@ -5255,5 +5256,8 @@ ttype *TTYPE (ttype *t) __attribute__((error(" Fix use of TTYPE(ttype *)"))) ;
#define TREE_TTYPE(NODE) (as_a <ttype *>(TREE_TYPE (NODE)))
#define TREE_CAST(NODE) ((tree)(NODE))
+#define TREE_PTR_CAST(NODE) ((tree *)(NODE))
+#define TTYPE_PTR(NODE) ((ttype **)(NODE))
+#define TREE_TTYPE_PTR(NODE) TTYPE_PTR (&TREE_TYPE (NODE))
#endif /* GCC_TREE_H */