aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Macleod <amacleod@redhat.com>2017-02-17 22:37:29 +0000
committerAndrew Macleod <amacleod@redhat.com>2017-02-17 22:37:29 +0000
commit22caa504fc38b576bf8257890f6f781a22581f7e (patch)
tree63092cdcde3ce5be50f1e1c9da1feb8de7564d56
parenta9ebbf3ed941c9cc22d69ca2a070cf539d539cbf (diff)
11-c-typeck-cfamily-c-commonttype-2017
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/ttype-2017@245554 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ada/gcc-interface/utils.c4
-rw-r--r--gcc/brig/brig-lang.c4
-rw-r--r--gcc/builtin-types.def10
-rw-r--r--gcc/c-family/array-notation-common.c6
-rw-r--r--gcc/c-family/c-common.c239
-rw-r--r--gcc/c-family/c-common.h61
-rw-r--r--gcc/c-family/c-objc.h2
-rw-r--r--gcc/c-family/stub-objc.c4
-rw-r--r--gcc/c/c-decl.c4
-rw-r--r--gcc/c/c-parser.c24
-rw-r--r--gcc/c/c-tree.h30
-rw-r--r--gcc/c/c-typeck.c579
-rw-r--r--gcc/c/gimple-parser.c4
-rw-r--r--gcc/cp/cp-tree.h4
-rw-r--r--gcc/cp/decl.c2
-rw-r--r--gcc/cp/tree.c7
-rw-r--r--gcc/cp/typeck.c22
-rw-r--r--gcc/fortran/f95-lang.c4
-rw-r--r--gcc/lto/lto-lang.c4
-rw-r--r--gcc/objc/objc-act.c11
20 files changed, 530 insertions, 495 deletions
diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c
index 4e88fbd743f..713ae479515 100644
--- a/gcc/ada/gcc-interface/utils.c
+++ b/gcc/ada/gcc-interface/utils.c
@@ -5542,11 +5542,11 @@ static ttype *c_global_types[CTI_MAX];
The later results in segfaults even when a decl using the type doesn't
get invoked. */
-static tree
+static ttype *
builtin_type_for_size (int size, bool unsignedp)
{
tree type = gnat_type_for_size (size, unsignedp);
- return type ? type : error_mark_node;
+ return TTYPE (type ? type : error_mark_node);
}
/* Build/push the elementary type decls that builtin functions/types
diff --git a/gcc/brig/brig-lang.c b/gcc/brig/brig-lang.c
index c05f97257fb..2b58209a397 100644
--- a/gcc/brig/brig-lang.c
+++ b/gcc/brig/brig-lang.c
@@ -479,11 +479,11 @@ def_fn_type (builtin_type def, builtin_type ret, bool var, int n, ...)
The later results in segfaults even when a decl using the type doesn't
get invoked. */
-static tree
+static ttype *
builtin_type_for_size (int size, bool unsignedp)
{
tree type = brig_langhook_type_for_size (size, unsignedp);
- return type ? type : error_mark_node;
+ return TTYPE (type ? type : error_mark_node);
}
/* Support for DEF_BUILTIN. */
diff --git a/gcc/builtin-types.def b/gcc/builtin-types.def
index b24aeade28a..91e1cdaa392 100644
--- a/gcc/builtin-types.def
+++ b/gcc/builtin-types.def
@@ -142,11 +142,11 @@ DEF_PRIMITIVE_TYPE (BT_DFLOAT128_PTR, dfloat128_ptr_type_node)
DEF_PRIMITIVE_TYPE (BT_VALIST_REF, va_list_ref_type_node)
DEF_PRIMITIVE_TYPE (BT_VALIST_ARG, va_list_arg_type_node)
-DEF_PRIMITIVE_TYPE (BT_I1, TTYPE (builtin_type_for_size (BITS_PER_UNIT*1, 1)))
-DEF_PRIMITIVE_TYPE (BT_I2, TTYPE (builtin_type_for_size (BITS_PER_UNIT*2, 1)))
-DEF_PRIMITIVE_TYPE (BT_I4, TTYPE (builtin_type_for_size (BITS_PER_UNIT*4, 1)))
-DEF_PRIMITIVE_TYPE (BT_I8, TTYPE (builtin_type_for_size (BITS_PER_UNIT*8, 1)))
-DEF_PRIMITIVE_TYPE (BT_I16, TTYPE (builtin_type_for_size (BITS_PER_UNIT*16, 1)))
+DEF_PRIMITIVE_TYPE (BT_I1, builtin_type_for_size (BITS_PER_UNIT*1, 1))
+DEF_PRIMITIVE_TYPE (BT_I2, builtin_type_for_size (BITS_PER_UNIT*2, 1))
+DEF_PRIMITIVE_TYPE (BT_I4, builtin_type_for_size (BITS_PER_UNIT*4, 1))
+DEF_PRIMITIVE_TYPE (BT_I8, builtin_type_for_size (BITS_PER_UNIT*8, 1))
+DEF_PRIMITIVE_TYPE (BT_I16, builtin_type_for_size (BITS_PER_UNIT*16, 1))
DEF_PRIMITIVE_TYPE (BT_BND, pointer_bounds_type_node)
diff --git a/gcc/c-family/array-notation-common.c b/gcc/c-family/array-notation-common.c
index 3b95332adad..b8970e4c987 100644
--- a/gcc/c-family/array-notation-common.c
+++ b/gcc/c-family/array-notation-common.c
@@ -398,7 +398,7 @@ replace_array_notations (tree *orig, bool ignore_builtin_fn,
vec<tree, va_gc> *array_operand)
{
size_t ii = 0;
- extern tree build_c_cast (location_t, tree, tree);
+ extern tree build_c_cast (location_t, ttype_p, tree);
tree node = NULL_TREE, node_replacement = NULL_TREE;
if (vec_safe_length (list) == 0)
@@ -562,7 +562,7 @@ contains_array_notation_expr (tree expr)
notation function. If so, then we will return its type to be the type of
the array notation inside. */
-tree
+ttype *
find_correct_array_notation_type (tree op)
{
tree fn_arg, return_type = NULL_TREE;
@@ -578,7 +578,7 @@ find_correct_array_notation_type (tree op)
return_type = TREE_TYPE (fn_arg);
}
}
- return return_type;
+ return TTYPE (return_type);
}
/* Extracts all the array notation triplet information from LIST and stores
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index e7b36a95219..2bcdc044ee9 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -48,6 +48,7 @@ along with GCC; see the file COPYING3. If not see
#include "gimplify.h"
#include "substring-locations.h"
#include "spellcheck.h"
+#include "ttype.h"
cpp_reader *parse_in; /* Declared in c-pragma.h. */
@@ -304,7 +305,7 @@ const struct fname_var_t fname_vars[] =
struct visibility_flags visibility_options;
static tree check_case_value (location_t, tree);
-static bool check_case_bounds (location_t, tree, tree, tree *, tree *,
+static bool check_case_bounds (location_t, ttype_p, ttype_p, tree *, tree *,
bool *);
@@ -734,7 +735,7 @@ fix_string_type (tree value)
{
int length = TREE_STRING_LENGTH (value);
int nchars;
- tree e_type, i_type, a_type;
+ ttype *e_type, *i_type, *a_type;
/* Compute the number of elements, for the array type. */
if (TREE_TYPE (value) == char_array_type_node || !TREE_TYPE (value))
@@ -824,7 +825,7 @@ get_cpp_ttype_from_string_type (tree string_type)
if (TREE_CODE (string_type) != ARRAY_TYPE)
return CPP_OTHER;
- tree element_type = TREE_TYPE (string_type);
+ ttype *element_type = TREE_TYPE (string_type);
if (TREE_CODE (element_type) != INTEGER_TYPE)
return CPP_OTHER;
@@ -903,7 +904,7 @@ bool_promoted_to_int_p (tree t)
each other without an explicit cast. Only returns true for opaque
vector types. */
bool
-vector_targets_convertible_p (const_tree t1, const_tree t2)
+vector_targets_convertible_p (const ttype_p t1, const ttype_p t2)
{
if (VECTOR_TYPE_P (t1) && VECTOR_TYPE_P (t2)
&& (TYPE_VECTOR_OPAQUE (t1) || TYPE_VECTOR_OPAQUE (t2))
@@ -930,7 +931,8 @@ vector_targets_convertible_p (const_tree t1, const_tree t2)
in effect, emit a note telling the user about that option if such
a note has not previously been emitted. */
bool
-vector_types_convertible_p (const_tree t1, const_tree t2, bool emit_lax_note)
+vector_types_convertible_p (const ttype_p t1, const ttype_p t2,
+ bool emit_lax_note)
{
static bool emitted_lax_note = false;
bool convertible_lax;
@@ -1099,13 +1101,13 @@ c_common_get_narrower (tree op, int *unsignedp_ptr)
Eg, (short)-1 | (unsigned short)-1 is (int)-1
but calculated in (unsigned short) it would be (unsigned short)-1.
*/
-tree
-shorten_binary_op (tree result_type, tree op0, tree op1, bool bitwise)
+ttype *
+shorten_binary_op (ttype_p result_type, tree op0, tree op1, bool bitwise)
{
int unsigned0, unsigned1;
tree arg0, arg1;
int uns;
- tree type;
+ ttype *type;
/* Cast OP0 and OP1 to RESULT_TYPE. Doing so prevents
excessive narrowing when we call get_narrower below. For
@@ -1196,7 +1198,8 @@ shorten_binary_op (tree result_type, tree op0, tree op1, bool bitwise)
real of type TO_TYPE. This is a helper function for unsafe_conversion_p. */
static bool
-int_safely_convertible_to_real_p (const_tree from_type, const_tree to_type)
+int_safely_convertible_to_real_p (const ttype_p from_type,
+ const ttype_p to_type)
{
tree type_low_bound = TYPE_MIN_VALUE (from_type);
tree type_high_bound = TYPE_MAX_VALUE (from_type);
@@ -1230,10 +1233,11 @@ int_safely_convertible_to_real_p (const_tree from_type, const_tree to_type)
to TYPE. */
enum conversion_safety
-unsafe_conversion_p (location_t loc, tree type, tree expr, bool produce_warns)
+unsafe_conversion_p (location_t loc, ttype_p type, tree expr,
+ bool produce_warns)
{
enum conversion_safety give_warning = SAFE_CONVERSION; /* is 0 or false */
- tree expr_type = TREE_TYPE (expr);
+ ttype *expr_type = TREE_TYPE (expr);
loc = expansion_point_location_if_in_system_header (loc);
if (TREE_CODE (expr) == REAL_CST || TREE_CODE (expr) == INTEGER_CST)
@@ -1448,8 +1452,8 @@ unsafe_conversion_p (location_t loc, tree type, tree expr, bool produce_warns)
{
/* Extract underlying types (i.e., type of real and imaginary
parts) of expr_type and type. */
- tree from_type = TREE_TYPE (expr_type);
- tree to_type = TREE_TYPE (type);
+ ttype *from_type = TREE_TYPE (expr_type);
+ ttype *to_type = TREE_TYPE (type);
/* Warn for real types converted to integer types. */
if (TREE_CODE (from_type) == REAL_TYPE
@@ -1504,7 +1508,7 @@ unsafe_conversion_p (location_t loc, tree type, tree expr, bool produce_warns)
i.e. because of language rules and not because of an explicit cast. */
tree
-convert_and_check (location_t loc, tree type, tree expr)
+convert_and_check (location_t loc, ttype_p type, tree expr)
{
tree result;
tree expr_for_warning;
@@ -1998,7 +2002,7 @@ check_case_value (location_t loc, tree value)
untouched) or false if the label is out of range. */
static bool
-check_case_bounds (location_t loc, tree type, tree orig_type,
+check_case_bounds (location_t loc, ttype_p type, ttype_p orig_type,
tree *case_low_p, tree *case_high_p,
bool *outside_range_p)
{
@@ -2007,7 +2011,7 @@ check_case_bounds (location_t loc, tree type, tree orig_type,
tree case_high = case_high_p ? *case_high_p : case_low;
/* If there was a problem with the original type, do nothing. */
- if (orig_type == error_mark_node)
+ if (orig_type == error_type_node)
return true;
min_value = TYPE_MIN_VALUE (orig_type);
@@ -2117,7 +2121,7 @@ c_common_type_for_size (unsigned int bits, int unsignedp)
that is unsigned if UNSIGNEDP is nonzero, otherwise signed;
and saturating if SATP is nonzero, otherwise not saturating. */
-tree
+ttype *
c_common_fixed_point_type_for_size (unsigned int ibit, unsigned int fbit,
int unsignedp, int satp)
{
@@ -2230,7 +2234,7 @@ c_common_type_for_mode (machine_mode mode, int unsignedp)
if (COMPLEX_MODE_P (mode))
{
machine_mode inner_mode;
- tree inner_type;
+ ttype *inner_type;
if (mode == TYPE_MODE (complex_float_type_node))
return complex_float_type_node;
@@ -2249,13 +2253,13 @@ c_common_type_for_mode (machine_mode mode, int unsignedp)
inner_mode = GET_MODE_INNER (mode);
inner_type = c_common_type_for_mode (inner_mode, unsignedp);
- if (inner_type != NULL_TREE)
+ if (inner_type != NULL)
return build_complex_type (inner_type);
}
else if (VECTOR_MODE_P (mode))
{
machine_mode inner_mode = GET_MODE_INNER (mode);
- tree inner_type = c_common_type_for_mode (inner_mode, unsignedp);
+ ttype *inner_type = c_common_type_for_mode (inner_mode, unsignedp);
if (inner_type != NULL_TREE)
return build_vector_type_for_mode (inner_type, mode);
}
@@ -2357,23 +2361,23 @@ c_common_type_for_mode (machine_mode mode, int unsignedp)
}
for (t = registered_builtin_types; t; t = TREE_CHAIN (t))
- if (TYPE_MODE (TREE_VALUE (t)) == mode
- && !!unsignedp == !!TYPE_UNSIGNED (TREE_VALUE (t)))
+ if (TYPE_MODE (TREE_VALUE_TYPE (t)) == mode
+ && !!unsignedp == !!TYPE_UNSIGNED (TREE_VALUE_TYPE (t)))
return TREE_VALUE_TYPE (t);
return 0;
}
-tree
-c_common_unsigned_type (tree type)
+ttype *
+c_common_unsigned_type (ttype_p type)
{
return c_common_signed_or_unsigned_type (1, type);
}
/* Return a signed type the same as TYPE in other respects. */
-tree
-c_common_signed_type (tree type)
+ttype *
+c_common_signed_type (ttype_p type)
{
return c_common_signed_or_unsigned_type (0, type);
}
@@ -2381,10 +2385,10 @@ c_common_signed_type (tree type)
/* Return a type the same as TYPE except unsigned or
signed according to UNSIGNEDP. */
-tree
-c_common_signed_or_unsigned_type (int unsignedp, tree type)
+ttype *
+c_common_signed_or_unsigned_type (int unsignedp, ttype_p type)
{
- tree type1;
+ ttype *type1;
int i;
/* This block of code emulates the behavior of the old
@@ -2704,9 +2708,9 @@ expr_original_type (tree expr)
tree
shorten_compare (location_t loc, tree *op0_ptr, tree *op1_ptr,
- tree *restype_ptr, enum tree_code *rescode_ptr)
+ ttype_pp restype_ptr, enum tree_code *rescode_ptr)
{
- tree type;
+ ttype *type;
tree op0 = *op0_ptr;
tree op1 = *op1_ptr;
int unsignedp0, unsignedp1;
@@ -3394,8 +3398,8 @@ c_common_truthvalue_conversion (location_t location, tree expr)
CASE_CONVERT:
{
- tree totype = TREE_TYPE (expr);
- tree fromtype = TREE_TYPE (TREE_OPERAND (expr, 0));
+ ttype *totype = TREE_TYPE (expr);
+ ttype *fromtype = TREE_TYPE (TREE_OPERAND (expr, 0));
if (POINTER_TYPE_P (totype)
&& !c_inhibit_evaluation_warnings
@@ -3489,7 +3493,7 @@ static void def_builtin_1 (enum built_in_function fncode,
void
c_apply_type_quals_to_decl (int type_quals, tree decl)
{
- tree type = TREE_TYPE (decl);
+ ttype *type = TREE_TYPE (decl);
if (type == error_mark_node)
return;
@@ -3518,10 +3522,10 @@ c_apply_type_quals_to_decl (int type_quals, tree decl)
}
}
-struct c_type_hasher : ggc_ptr_hash<tree_node>
+struct c_type_hasher : ggc_ptr_hash<ttype>
{
- static hashval_t hash (tree);
- static bool equal (tree, tree);
+ static hashval_t hash (ttype *);
+ static bool equal (ttype *, ttype *);
};
/* Hash function for the problem of multiple type definitions in
@@ -3530,7 +3534,7 @@ struct c_type_hasher : ggc_ptr_hash<tree_node>
on some of the simple stuff and leaves the details to comptypes. */
hashval_t
-c_type_hasher::hash (tree t)
+c_type_hasher::hash (ttype *t)
{
int n_elements;
int shift, size;
@@ -3572,7 +3576,7 @@ c_type_hasher::hash (tree t)
}
bool
-c_type_hasher::equal (tree t1, tree t2)
+c_type_hasher::equal (ttype *t1, ttype *t2)
{
return lang_hooks.types_compatible_p (t1, t2);
}
@@ -3583,21 +3587,17 @@ static GTY(()) hash_table<c_type_hasher> *type_hash_table;
or a type. Return -1 if we don't do anything special. */
alias_set_type
-c_common_get_alias_set (tree t)
+c_common_get_alias_set_type (ttype *t)
{
/* For VLAs, use the alias set of the element type rather than the
default of alias set 0 for types compared structurally. */
- if (TYPE_P (t) && TYPE_STRUCTURAL_EQUALITY_P (t))
+ if (TYPE_STRUCTURAL_EQUALITY_P (t))
{
if (TREE_CODE (t) == ARRAY_TYPE)
return get_alias_set (TREE_TYPE (t));
return -1;
}
- /* That's all the expressions we handle specially. */
- if (!TYPE_P (t))
- return -1;
-
/* The C standard guarantees that any object may be accessed via an
lvalue that has character type. */
if (t == char_type_node
@@ -3610,7 +3610,7 @@ c_common_get_alias_set (tree t)
variant as canonical. */
if (TREE_CODE (t) == INTEGER_TYPE && TYPE_UNSIGNED (t))
{
- tree t1 = c_common_signed_type (t);
+ ttype *t1 = c_common_signed_type (t);
/* t1 == t can happen for boolean nodes which are always unsigned. */
if (t1 != t)
@@ -3635,7 +3635,7 @@ c_common_get_alias_set (tree t)
needs special handling (below). */
if (TREE_CODE (t) == POINTER_TYPE)
{
- tree t2;
+ ttype *t2;
/* Find bottom type under any nested POINTERs. */
for (t2 = TREE_TYPE (t);
TREE_CODE (t2) == POINTER_TYPE;
@@ -3660,11 +3660,11 @@ c_common_get_alias_set (tree t)
alias set is recorded in the table. */
if (!type_hash_table)
type_hash_table = hash_table<c_type_hasher>::create_ggc (1021);
- tree *slot = type_hash_table->find_slot (t, INSERT);
+ ttype **slot = type_hash_table->find_slot (t, INSERT);
if (*slot != NULL)
{
- TYPE_ALIAS_SET (t) = TYPE_ALIAS_SET ((tree)*slot);
- return TYPE_ALIAS_SET ((tree)*slot);
+ TYPE_ALIAS_SET (t) = TYPE_ALIAS_SET (*slot);
+ return TYPE_ALIAS_SET (*slot);
}
else
/* Our caller will assign and record (in t) a new alias set; all we need
@@ -3673,6 +3673,15 @@ c_common_get_alias_set (tree t)
return -1;
}
+
+alias_set_type
+c_common_get_alias_set (tree t)
+{
+ if (TYPE_P (t))
+ return c_common_get_alias_set_type (TTYPE (t));
+
+ return -1;
+}
/* Compute the value of 'sizeof (TYPE)' or '__alignof__ (TYPE)', where
the IS_SIZEOF parameter indicates which operator is being applied.
@@ -3684,7 +3693,7 @@ c_common_get_alias_set (tree t)
tree
c_sizeof_or_alignof_type (location_t loc,
- tree type, bool is_sizeof, bool min_alignof,
+ ttype_p type, bool is_sizeof, bool min_alignof,
int complain)
{
const char *op_name;
@@ -3922,13 +3931,13 @@ def_fn_type (builtin_type def, builtin_type ret, bool var, int n, ...)
{
builtin_type a = (builtin_type) va_arg (list, int);
t = builtin_types[a];
- if (t == error_mark_node)
+ if (t == error_type_node)
goto egress;
args[i] = t;
}
t = builtin_types[ret];
- if (t == error_mark_node)
+ if (t == error_type_node)
goto egress;
if (var)
t = build_varargs_function_type_array (t, n, args);
@@ -4062,7 +4071,7 @@ c_get_ident (const char *id)
static inline ttype *
identifier_global_type (tree t)
{
- return TTYPE (TREE_TYPE (identifier_global_value (t)));
+ return TREE_TYPE (identifier_global_value (t));
}
/* Build tree nodes and builtin functions common to both C and C++ language
@@ -4183,7 +4192,7 @@ c_common_nodes_and_builtins (void)
TYPE_DECL, NULL_TREE,
widest_unsigned_literal_type_node));
- signed_size_type_node = TTYPE (c_common_signed_type (size_type_node));
+ signed_size_type_node = c_common_signed_type (size_type_node);
pid_type_node = identifier_global_type (get_identifier (PID_TYPE));
@@ -4480,8 +4489,7 @@ c_common_nodes_and_builtins (void)
default_function_type
= build_varargs_function_type_list (integer_type_node, NULL_TREE);
- unsigned_ptrdiff_type_node
- = TTYPE (c_common_unsigned_type (ptrdiff_type_node));
+ unsigned_ptrdiff_type_node = c_common_unsigned_type (ptrdiff_type_node);
lang_hooks.decls.pushdecl
(build_decl (UNKNOWN_LOCATION,
@@ -4491,9 +4499,11 @@ c_common_nodes_and_builtins (void)
{
int l;
const char *pname;
- tree ptype;
+ ttype *ptype;
- for (l = 0; targetm.enum_va_list_p (l, &pname, &ptype); ++l)
+ for (l = 0;
+ targetm.enum_va_list_p (l, &pname, TREE_PTR_CAST (&ptype));
+ ++l)
{
lang_hooks.decls.pushdecl
(build_decl (UNKNOWN_LOCATION,
@@ -4547,7 +4557,7 @@ set_compound_literal_name (tree decl)
TYPE and operand OP. */
static tree
-build_va_arg_1 (location_t loc, tree type, tree op)
+build_va_arg_1 (location_t loc, ttype *type, tree op)
{
tree expr = build1 (VA_ARG_EXPR, type, op);
SET_EXPR_LOCATION (expr, loc);
@@ -4558,23 +4568,23 @@ build_va_arg_1 (location_t loc, tree type, tree op)
va_arg (EXPR, TYPE) at source location LOC. */
tree
-build_va_arg (location_t loc, tree expr, tree type)
+build_va_arg (location_t loc, tree expr, ttype_p type)
{
- tree va_type = TREE_TYPE (expr);
- tree canon_va_type = (va_type == error_mark_node
- ? error_mark_node
- : targetm.canonical_va_list_type (va_type));
+ ttype *va_type = TREE_TYPE (expr);
+ ttype *canon_va_type = (va_type == error_type_node
+ ? error_type_node
+ : TTYPE (targetm.canonical_va_list_type (va_type)));
- if (va_type == error_mark_node
- || canon_va_type == NULL_TREE)
+ if (va_type == error_type_node
+ || canon_va_type == NULL)
{
- if (canon_va_type == NULL_TREE)
+ if (canon_va_type == NULL)
error_at (loc, "first argument to %<va_arg%> not of type %<va_list%>");
/* Let's handle things neutrallly, if expr:
- has undeclared type, or
- is not an va_list type. */
- return build_va_arg_1 (loc, type, error_mark_node);
+ return build_va_arg_1 (loc, type, error_type_node);
}
if (TREE_CODE (canon_va_type) != ARRAY_TYPE)
@@ -4650,8 +4660,8 @@ build_va_arg (location_t loc, tree expr, tree type)
expr);
/* Verify that &ap is still recognized as having va_list type. */
- tree canon_expr_type
- = targetm.canonical_va_list_type (TREE_TYPE (expr));
+ ttype *canon_expr_type
+ = TTYPE (targetm.canonical_va_list_type (TREE_TYPE (expr)));
gcc_assert (canon_expr_type != NULL_TREE);
}
else
@@ -4757,7 +4767,7 @@ def_builtin_1 (enum built_in_function fncode,
integral promotions defined in ISO C99 6.3.1.1/2. */
bool
-c_promoting_integer_type_p (const_tree t)
+c_promoting_integer_type_p (const ttype_p t)
{
switch (TREE_CODE (t))
{
@@ -4792,9 +4802,9 @@ self_promoting_args_p (const_tree parms)
const_tree t;
for (t = parms; t; t = TREE_CHAIN (t))
{
- tree type = TREE_VALUE (t);
+ ttype *type = TREE_VALUE_TYPE (t);
- if (type == error_mark_node)
+ if (type == error_type_node)
continue;
if (TREE_CHAIN (t) == 0 && type != void_type_node)
@@ -4813,8 +4823,8 @@ self_promoting_args_p (const_tree parms)
}
/* Recursively remove any '*' or '&' operator from TYPE. */
-tree
-strip_pointer_operator (tree t)
+ttype *
+strip_pointer_operator (ttype_p t)
{
while (POINTER_TYPE_P (t))
t = TREE_TYPE (t);
@@ -4822,8 +4832,8 @@ strip_pointer_operator (tree t)
}
/* Recursively remove pointer or array type from TYPE. */
-tree
-strip_pointer_or_array_types (tree t)
+ttype *
+strip_pointer_or_array_types (ttype_p t)
{
while (TREE_CODE (t) == ARRAY_TYPE || POINTER_TYPE_P (t))
t = TREE_TYPE (t);
@@ -4860,10 +4870,11 @@ case_compare (splay_tree_key k1, splay_tree_key k2)
created, or ERROR_MARK_NODE if no CASE_LABEL_EXPR is created. */
tree
-c_add_case_label (location_t loc, splay_tree cases, tree cond, tree orig_type,
- tree low_value, tree high_value, bool *outside_range_p)
+c_add_case_label (location_t loc, splay_tree cases, tree cond,
+ ttype_p orig_type, tree low_value, tree high_value,
+ bool *outside_range_p)
{
- tree type;
+ ttype *type;
tree label;
tree case_label;
splay_tree_node node;
@@ -5320,7 +5331,7 @@ check_function_nonnull (location_t loc, tree attrs, int nargs, tree *argarray)
array ARGARRAY. */
static void
-check_function_sentinel (const_tree fntype, int nargs, tree *argarray)
+check_function_sentinel (const ttype_p fntype, int nargs, tree *argarray)
{
tree attr = lookup_attribute ("sentinel", TYPE_ATTRIBUTES (fntype));
@@ -5610,7 +5621,7 @@ attribute_fallthrough_p (tree attr)
There are NARGS arguments in the array ARGARRAY. LOC should be used for
diagnostics. Return true if -Wnonnull warning has been diagnosed. */
bool
-check_function_arguments (location_t loc, const_tree fntype, int nargs,
+check_function_arguments (location_t loc, const ttype_p fntype, int nargs,
tree *argarray)
{
bool warned_p = false;
@@ -5653,7 +5664,7 @@ check_function_arguments_recurse (void (*callback)
if (TREE_CODE (param) == CALL_EXPR)
{
- tree type = TREE_TYPE (TREE_TYPE (CALL_EXPR_FN (param)));
+ ttype *type = TREE_TYPE (TREE_TYPE (CALL_EXPR_FN (param)));
tree attrs;
bool found_format_arg = false;
@@ -6351,9 +6362,10 @@ fold_offsetof (tree expr)
2 if INITIAL_VALUE was NULL, and 3 if INITIAL_VALUE was empty. */
int
-complete_array_type (tree *ptype, tree initial_value, bool do_default)
+complete_array_type (ttype_pp ptype, tree initial_value, bool do_default)
{
- tree maxindex, type, elt, unqual_elt;
+ tree maxindex;
+ ttype *type, *elt, *unqual_elt;
ttype *main_type;
int failure = 0, quals;
hashval_t hashcode = 0;
@@ -6483,7 +6495,7 @@ complete_array_type (tree *ptype, tree initial_value, bool do_default)
error ("size of array is too large");
/* If we proceed with the array type as it is, we'll eventually
crash in tree_to_[su]hwi(). */
- type = error_mark_node;
+ type = error_type_node;
}
*ptype = type;
@@ -6510,11 +6522,11 @@ c_common_mark_addressable_vec (tree t)
The later results in segfaults even when a decl using the type doesn't
get invoked. */
-tree
+ttype *
builtin_type_for_size (int size, bool unsignedp)
{
- tree type = c_common_type_for_size (size, unsignedp);
- return type ? type : error_mark_node;
+ ttype *type = c_common_type_for_size (size, unsignedp);
+ return type ? type : error_type_node;
}
/* A helper function for resolve_overloaded_builtin in resolving the
@@ -6528,9 +6540,9 @@ static int
sync_resolve_size (tree function, vec<tree, va_gc> *params, bool fetch)
{
/* Type of the argument. */
- tree argtype;
+ ttype *argtype;
/* Type the argument points to. */
- tree type;
+ ttype *type;
int size;
if (vec_safe_is_empty (params))
@@ -6564,7 +6576,7 @@ sync_resolve_size (tree function, vec<tree, va_gc> *params, bool fetch)
incompatible:
/* Issue the diagnostic only if the argument is valid, otherwise
it would be redundant at best and could be misleading. */
- if (argtype != error_mark_node)
+ if (argtype != error_type_node)
error ("operand type %qT is incompatible with argument %d of %qE",
argtype, 1, function);
return 0;
@@ -6580,7 +6592,7 @@ sync_resolve_params (location_t loc, tree orig_function, tree function,
vec<tree, va_gc> *params, bool orig_format)
{
function_args_iterator iter;
- tree ptype;
+ ttype *ptype;
unsigned int parmnum;
function_args_iter_init (&iter, TREE_TYPE (function));
@@ -6596,7 +6608,8 @@ sync_resolve_params (location_t loc, tree orig_function, tree function,
parmnum = 0;
while (1)
{
- tree val, arg_type;
+ tree val;
+ ttype *arg_type;
arg_type = function_args_iter_cond (&iter);
/* XXX void_type_node belies the abstraction. */
@@ -6652,8 +6665,8 @@ sync_resolve_params (location_t loc, tree orig_function, tree function,
static tree
sync_resolve_return (tree first_param, tree result, bool orig_format)
{
- tree ptype = TREE_TYPE (TREE_TYPE (first_param));
- tree rtype = TREE_TYPE (result);
+ ttype *ptype = TREE_TYPE (TREE_TYPE (first_param));
+ ttype *rtype = TREE_TYPE (result);
ptype = TYPE_MAIN_VARIANT (ptype);
/* New format doesn't require casting unless the types are the same size. */
@@ -6743,7 +6756,7 @@ get_atomic_generic_size (location_t loc, tree function,
for (x = 0; x < n_param - n_model; x++)
{
int size;
- tree type = TREE_TYPE ((*params)[x]);
+ ttype *type = TREE_TYPE ((*params)[x]);
/* __atomic_compare_exchange has a bool in the 4th position, skip it. */
if (n_param == 6 && x == 3)
continue;
@@ -6877,7 +6890,7 @@ resolve_overloaded_atomic_exchange (location_t loc, tree function,
vec<tree, va_gc> *params, tree *new_return)
{
tree p0, p1, p2, p3;
- tree I_type, I_type_ptr;
+ ttype *I_type, *I_type_ptr;
int n = get_atomic_generic_size (loc, function, params);
/* Size of 0 is an error condition. */
@@ -6942,7 +6955,7 @@ resolve_overloaded_atomic_compare_exchange (location_t loc, tree function,
tree *new_return)
{
tree p0, p1, p2;
- tree I_type, I_type_ptr;
+ ttype *I_type, *I_type_ptr;
int n = get_atomic_generic_size (loc, function, params);
/* Size of 0 is an error condition. */
@@ -7018,7 +7031,7 @@ resolve_overloaded_atomic_load (location_t loc, tree function,
vec<tree, va_gc> *params, tree *new_return)
{
tree p0, p1, p2;
- tree I_type, I_type_ptr;
+ ttype *I_type, *I_type_ptr;
int n = get_atomic_generic_size (loc, function, params);
/* Size of 0 is an error condition. */
@@ -7078,7 +7091,7 @@ resolve_overloaded_atomic_store (location_t loc, tree function,
vec<tree, va_gc> *params, tree *new_return)
{
tree p0, p1;
- tree I_type, I_type_ptr;
+ ttype *I_type, *I_type_ptr;
int n = get_atomic_generic_size (loc, function, params);
/* Size of 0 is an error condition. */
@@ -7325,7 +7338,7 @@ resolve_overloaded_builtin (location_t loc, tree function,
except for the element count. */
bool
-vector_types_compatible_elements_p (tree t1, tree t2)
+vector_types_compatible_elements_p (ttype_p t1, ttype_p t2)
{
bool opaque = TYPE_VECTOR_OPAQUE (t1) || TYPE_VECTOR_OPAQUE (t2);
t1 = TREE_TYPE (t1);
@@ -7356,9 +7369,9 @@ vector_types_compatible_elements_p (tree t1, tree t2)
attribute. */
bool
-check_missing_format_attribute (tree ltype, tree rtype)
+check_missing_format_attribute (ttype_p ltype, ttype_p rtype)
{
- tree const ttr = TREE_TYPE (rtype), ttl = TREE_TYPE (ltype);
+ const ttype *ttr = TREE_TYPE (rtype), *ttl = TREE_TYPE (ltype);
tree ra;
for (ra = TYPE_ATTRIBUTES (ttr); ra; ra = TREE_CHAIN (ra))
@@ -7426,10 +7439,10 @@ set_underlying_type (tree x)
if (TYPE_NAME (TREE_TYPE (x)) == 0)
TYPE_NAME (TREE_TYPE (x)) = x;
}
- else if (TREE_TYPE (x) != error_mark_node
+ else if (TREE_TYPE (x) != error_type_node
&& DECL_ORIGINAL_TYPE (x) == NULL_TREE)
{
- tree tt = TREE_TYPE (x);
+ ttype *tt = TREE_TYPE (x);
DECL_ORIGINAL_TYPE (x) = tt;
tt = build_variant_type_copy (tt);
TYPE_STUB_DECL (tt) = TYPE_STUB_DECL (DECL_ORIGINAL_TYPE (x));
@@ -7703,7 +7716,7 @@ convert_vector_to_array_for_subscript (location_t loc,
bool ret = false;
if (VECTOR_TYPE_P (TREE_TYPE (*vecp)))
{
- tree type = TREE_TYPE (*vecp);
+ ttype *type = TREE_TYPE (*vecp);
ret = !lvalue_p (*vecp);
@@ -7731,8 +7744,8 @@ enum stv_conv
scalar_to_vector (location_t loc, enum tree_code code, tree op0, tree op1,
bool complain)
{
- tree type0 = TREE_TYPE (op0);
- tree type1 = TREE_TYPE (op1);
+ ttype *type0 = TREE_TYPE (op0);
+ ttype *type1 = TREE_TYPE (op1);
bool integer_only_op = false;
enum stv_conv ret = stv_firstarg;
@@ -7862,7 +7875,7 @@ cxx_fundamental_alignment_p (unsigned align)
/* Return true if T is a pointer to a zero-sized aggregate. */
bool
-pointer_to_zero_sized_aggr_p (tree t)
+pointer_to_zero_sized_aggr_p (ttype_p t)
{
if (!POINTER_TYPE_P (t))
return false;
@@ -7914,9 +7927,9 @@ reject_gcc_builtin (const_tree expr, location_t loc /* = UNKNOWN_LOCATION */)
the name of the array, or NULL_TREE for unnamed arrays. */
bool
-valid_array_size_p (location_t loc, tree type, tree name)
+valid_array_size_p (location_t loc, ttype_p type, tree name)
{
- if (type != error_mark_node
+ if (type != error_type_node
&& COMPLETE_TYPE_P (type)
&& TREE_CODE (TYPE_SIZE_UNIT (type)) == INTEGER_CST
&& !valid_constant_size_p (TYPE_SIZE_UNIT (type)))
diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h
index 674bec0b245..d9b0f3e0438 100644
--- a/gcc/c-family/c-common.h
+++ b/gcc/c-family/c-common.h
@@ -599,8 +599,8 @@ extern tree add_stmt (tree);
extern void push_cleanup (tree, tree, bool);
extern tree pushdecl_top_level (tree);
extern tree pushdecl (tree);
-extern tree build_modify_expr (location_t, tree, tree, enum tree_code,
- location_t, tree, tree);
+extern tree build_modify_expr (location_t, tree, ttype_p, enum tree_code,
+ location_t, tree, ttype_p);
extern tree build_array_notation_expr (location_t, tree, tree, enum tree_code,
location_t, tree, tree);
extern tree build_array_notation_ref (location_t, tree, tree, tree, tree, tree);
@@ -816,7 +816,8 @@ extern const char *fname_as_string (int);
extern tree fname_decl (location_t, unsigned, tree);
extern int check_user_alignment (const_tree, bool);
-extern bool check_function_arguments (location_t loc, const_tree, int, tree *);
+extern bool check_function_arguments (location_t loc, const ttype_p, int,
+ tree *);
extern void check_function_arguments_recurse (void (*)
(void *, tree,
unsigned HOST_WIDE_INT),
@@ -833,14 +834,14 @@ extern bool c_common_handle_option (size_t, const char *, int, int, location_t,
extern bool default_handle_c_option (size_t, const char *, int);
extern ttype *c_common_type_for_mode (machine_mode, int);
extern ttype *c_common_type_for_size (unsigned int, int);
-extern tree c_common_fixed_point_type_for_size (unsigned int, unsigned int,
+extern ttype *c_common_fixed_point_type_for_size (unsigned int, unsigned int,
int, int);
-extern tree c_common_unsigned_type (tree);
-extern tree c_common_signed_type (tree);
-extern tree c_common_signed_or_unsigned_type (int, tree);
+extern ttype *c_common_unsigned_type (ttype_p);
+extern ttype *c_common_signed_type (ttype_p);
+extern ttype *c_common_signed_or_unsigned_type (int, ttype_p);
extern void c_common_init_ts (void);
extern tree c_build_bitfield_integer_type (unsigned HOST_WIDE_INT, int);
-extern enum conversion_safety unsafe_conversion_p (location_t, tree, tree,
+extern enum conversion_safety unsafe_conversion_p (location_t, ttype_p, tree,
bool);
extern bool decl_with_nonnull_addr_p (const_tree);
extern tree c_fully_fold (tree, bool, bool *);
@@ -848,15 +849,15 @@ extern tree c_wrap_maybe_const (tree, bool);
extern tree c_save_expr (tree);
extern tree c_common_truthvalue_conversion (location_t, tree);
extern void c_apply_type_quals_to_decl (int, tree);
-extern tree c_sizeof_or_alignof_type (location_t, tree, bool, bool, int);
+extern tree c_sizeof_or_alignof_type (location_t, ttype_p, bool, bool, int);
extern tree c_alignof_expr (location_t, tree);
/* Print an error message for invalid operands to arith operation CODE.
NOP_EXPR is used as a special case (see truthvalue_conversion). */
extern void binary_op_error (rich_location *, enum tree_code, tree, tree);
extern tree fix_string_type (tree);
-extern tree convert_and_check (location_t, tree, tree);
+extern tree convert_and_check (location_t, ttype_p, tree);
extern bool c_determine_visibility (tree);
-extern bool vector_types_compatible_elements_p (tree, tree);
+extern bool vector_types_compatible_elements_p (ttype_p, ttype_p);
extern void mark_valid_location_for_stdc_pragma (bool);
extern bool valid_location_for_stdc_pragma_p (void);
extern void set_float_const_decimal64 (void);
@@ -869,7 +870,7 @@ extern bool keyword_is_type_qualifier (enum rid);
extern bool keyword_is_decl_specifier (enum rid);
extern unsigned max_align_t_align (void);
extern bool cxx_fundamental_alignment_p (unsigned);
-extern bool pointer_to_zero_sized_aggr_p (tree);
+extern bool pointer_to_zero_sized_aggr_p (ttype_p);
extern bool bool_promoted_to_int_p (tree);
extern tree fold_for_warn (tree);
extern tree c_common_get_narrower (tree, int *);
@@ -879,19 +880,20 @@ extern bool get_nonnull_operand (tree, unsigned HOST_WIDE_INT *);
#define c_alignof(LOC, T) c_sizeof_or_alignof_type (LOC, T, false, false, 1)
/* Subroutine of build_binary_op, used for certain operations. */
-extern tree shorten_binary_op (tree result_type, tree op0, tree op1, bool bitwise);
+extern ttype *shorten_binary_op (ttype_p result_type, tree op0, tree op1,
+ bool bitwise);
/* Subroutine of build_binary_op, used for comparison operations.
See if the operands have both been converted from subword integer types
and, if so, perhaps change them both back to their original type. */
-extern tree shorten_compare (location_t, tree *, tree *, tree *,
+extern tree shorten_compare (location_t, tree *, tree *, ttype_pp,
enum tree_code *);
extern tree pointer_int_sum (location_t, enum tree_code, tree, tree,
bool = true);
/* Add qualifiers to a type, in the fashion for C. */
-extern tree c_build_qualified_type (tree, int, tree = NULL_TREE, size_t = 0);
+extern ttype *c_build_qualified_type (ttype_p, int, ttype_p = NULL_TYPE, size_t = 0);
/* Build tree nodes and builtin functions common to both C and C++ language
frontends. */
@@ -901,7 +903,7 @@ extern void disable_builtin_function (const char *);
extern void set_compound_literal_name (tree decl);
-extern tree build_va_arg (location_t, tree, tree);
+extern tree build_va_arg (location_t, tree, ttype_p);
extern const unsigned int c_family_lang_mask;
extern unsigned int c_common_option_lang_mask (void);
@@ -914,12 +916,13 @@ extern bool c_common_init (void);
extern void c_common_finish (void);
extern void c_common_parse_file (void);
extern FILE *get_dump_info (int, int *);
+extern alias_set_type c_common_get_type_alias_set (ttype *);
extern alias_set_type c_common_get_alias_set (tree);
extern void c_register_builtin_type (ttype_p, const char*);
-extern bool c_promoting_integer_type_p (const_tree);
+extern bool c_promoting_integer_type_p (const ttype_p);
extern int self_promoting_args_p (const_tree);
-extern tree strip_pointer_operator (tree);
-extern tree strip_pointer_or_array_types (tree);
+extern ttype *strip_pointer_operator (ttype_p);
+extern ttype *strip_pointer_or_array_types (ttype_p);
extern HOST_WIDE_INT c_common_to_target_charset (HOST_WIDE_INT);
/* This is the basic parsing function. */
@@ -980,7 +983,7 @@ extern tree default_conversion (tree);
/* Given two integer or real types, return the type for their sum.
Given two compatible ANSI C types, returns the merged type. */
-extern tree common_type (tree, tree);
+extern ttype *common_type (ttype_p, ttype_p);
extern tree decl_constant_value (tree);
@@ -989,7 +992,7 @@ extern tree boolean_increment (enum tree_code, tree);
extern int case_compare (splay_tree_key, splay_tree_key);
-extern tree c_add_case_label (location_t, splay_tree, tree, tree, tree, tree,
+extern tree c_add_case_label (location_t, splay_tree, tree, ttype_p, tree, tree,
bool *);
extern tree build_function_call (location_t, tree, tree);
@@ -1019,8 +1022,9 @@ enum lookup_name_fuzzy_kind {
};
extern const char *lookup_name_fuzzy (tree, enum lookup_name_fuzzy_kind);
-extern bool vector_targets_convertible_p (const_tree t1, const_tree t2);
-extern bool vector_types_convertible_p (const_tree t1, const_tree t2, bool emit_lax_note);
+extern bool vector_targets_convertible_p (const ttype_p t1, const ttype_p t2);
+extern bool vector_types_convertible_p (const ttype_p t1, const ttype_p t2,
+ bool emit_lax_note);
extern tree c_build_vec_perm_expr (location_t, tree, tree, tree, bool = true);
extern void init_c_lex (void);
@@ -1064,9 +1068,9 @@ extern void verify_sequence_points (tree);
extern tree fold_offsetof_1 (tree, tree_code ctx = ERROR_MARK);
extern tree fold_offsetof (tree);
-extern int complete_array_type (tree *, tree, bool);
+extern int complete_array_type (ttype_pp, tree, bool);
-extern tree builtin_type_for_size (int, bool);
+extern ttype *builtin_type_for_size (int, bool);
extern void c_common_mark_addressable_vec (tree);
@@ -1140,7 +1144,7 @@ extern void init_pp_output (FILE *);
extern void preprocess_file (cpp_reader *);
extern void pp_file_change (const line_map_ordinary *);
extern void pp_dir_change (cpp_reader *, const char *);
-extern bool check_missing_format_attribute (tree, tree);
+extern bool check_missing_format_attribute (ttype_p, ttype_p);
/* In c-omp.c */
struct omp_clause_mask
@@ -1451,7 +1455,7 @@ extern struct c_expr fix_array_notation_expr (location_t, enum tree_code,
extern bool contains_array_notation_expr (tree);
extern tree expand_array_notation_exprs (tree);
extern tree fix_conditional_array_notations (tree);
-extern tree find_correct_array_notation_type (tree);
+extern ttype *find_correct_array_notation_type (tree);
extern bool length_mismatch_in_expr_p (location_t, vec<vec<an_parts> >);
extern enum built_in_function is_cilkplus_reduce_builtin (tree);
extern bool find_rank (location_t, tree, tree, bool, size_t *);
@@ -1460,7 +1464,6 @@ extern void replace_array_notations (tree *, bool, vec<tree, va_gc> *,
vec<tree, va_gc> *);
extern tree find_inv_trees (tree *, int *, void *);
extern tree replace_inv_trees (tree *, int *, void *);
-extern tree find_correct_array_notation_type (tree op);
extern void cilkplus_extract_an_triplets (vec<tree, va_gc> *, size_t, size_t,
vec<vec<an_parts> > *);
extern vec <tree, va_gc> *fix_sec_implicit_args
@@ -1486,7 +1489,7 @@ extern tree cilk_for_number_of_iterations (tree);
extern bool check_no_cilk (tree, const char *, const char *,
location_t loc = UNKNOWN_LOCATION);
extern bool reject_gcc_builtin (const_tree, location_t = UNKNOWN_LOCATION);
-extern bool valid_array_size_p (location_t, tree, tree);
+extern bool valid_array_size_p (location_t, ttype_p, tree);
extern bool cilk_ignorable_spawn_rhs_op (tree);
extern bool cilk_recognize_spawn (tree, tree *);
diff --git a/gcc/c-family/c-objc.h b/gcc/c-family/c-objc.h
index dc5f08faaa2..ae7ec313ddd 100644
--- a/gcc/c-family/c-objc.h
+++ b/gcc/c-family/c-objc.h
@@ -37,7 +37,7 @@ extern tree objc_is_class_name (tree);
extern tree objc_is_object_ptr (tree);
extern void objc_check_decl (tree);
extern void objc_check_global_decl (tree);
-extern tree objc_common_type (tree, tree);
+extern ttype *objc_common_type (ttype_p, ttype_p);
extern bool objc_compare_types (tree, tree, int, tree);
extern bool objc_have_common_type (tree, tree, int, tree);
extern bool objc_diagnose_private_ivar (tree);
diff --git a/gcc/c-family/stub-objc.c b/gcc/c-family/stub-objc.c
index 33dc2a1abd6..86c1c993e9d 100644
--- a/gcc/c-family/stub-objc.c
+++ b/gcc/c-family/stub-objc.c
@@ -65,8 +65,8 @@ objc_check_global_decl (tree ARG_UNUSED (decl))
{
}
-tree
-objc_common_type (tree ARG_UNUSED (type1), tree ARG_UNUSED (type2))
+ttype *
+objc_common_type (ttype_p ARG_UNUSED (type1), ttype_p ARG_UNUSED (type2))
{
return 0;
}
diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c
index ed7ddfc6f73..968f6e81acf 100644
--- a/gcc/c/c-decl.c
+++ b/gcc/c/c-decl.c
@@ -4562,7 +4562,7 @@ add_flexible_array_elts_to_size (tree decl, tree init)
EXPR_CONST_OPERANDS not NULL, to indicate whether the type name may
appear in a constant expression. */
-tree
+ttype *
groktypename (struct c_type_name *type_name, tree *expr,
bool *expr_const_operands)
{
@@ -4578,7 +4578,7 @@ groktypename (struct c_type_name *type_name, tree *expr,
/* Apply attributes. */
type_attributes (&type, attrs, 0);
- return type;
+ return TTYPE (type);
}
/* Wrapper for decl_attributes that adds some implicit attributes
diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c
index 8f4f569bd4a..2a5ce59fcbd 100644
--- a/gcc/c/c-parser.c
+++ b/gcc/c/c-parser.c
@@ -3535,7 +3535,7 @@ c_parser_direct_declarator_inner (c_parser *parser, bool id_present,
struct c_expr dimen;
dimen.value = NULL_TREE;
dimen.original_code = ERROR_MARK;
- dimen.original_type = NULL_TREE;
+ dimen.original_type = NULL;
c_parser_consume_token (parser);
c_parser_declspecs (parser, quals_attrs, false, false, true,
false, false, cla_prefer_id);
@@ -5710,7 +5710,7 @@ c_parser_switch_statement (c_parser *parser, bool *if_p)
{
switch_cond_loc = UNKNOWN_LOCATION;
expr = error_mark_node;
- ce.original_type = error_mark_node;
+ ce.original_type = error_type_node;
}
c_start_case (switch_loc, switch_cond_loc, expr, explicit_cast_p);
save_break = c_break_label;
@@ -6534,12 +6534,12 @@ c_parser_conditional_expression (c_parser *parser, struct c_expr *after,
remember the enum types we started with. */
t1 = exp1.original_type ? exp1.original_type : TREE_TYPE (exp1.value);
t2 = exp2.original_type ? exp2.original_type : TREE_TYPE (exp2.value);
- ret.original_type = ((t1 != error_mark_node
- && t2 != error_mark_node
- && (TYPE_MAIN_VARIANT (t1)
- == TYPE_MAIN_VARIANT (t2)))
- ? t1
- : NULL);
+ ret.original_type = TTYPE (((t1 != error_mark_node
+ && t2 != error_mark_node
+ && (TYPE_MAIN_VARIANT (t1)
+ == TYPE_MAIN_VARIANT (t2)))
+ ? t1
+ : NULL));
}
set_c_expr_source_range (&ret, start, exp2.get_finish ());
return ret;
@@ -8495,7 +8495,7 @@ c_parser_postfix_expression_after_primary (c_parser *parser,
if (TREE_CODE (field) != FIELD_DECL)
expr.original_type = NULL;
else
- expr.original_type = DECL_BIT_FIELD_TYPE (field);
+ expr.original_type = TTYPE (DECL_BIT_FIELD_TYPE (field));
}
break;
case CPP_DEREF:
@@ -8535,7 +8535,7 @@ c_parser_postfix_expression_after_primary (c_parser *parser,
if (TREE_CODE (field) != FIELD_DECL)
expr.original_type = NULL;
else
- expr.original_type = DECL_BIT_FIELD_TYPE (field);
+ expr.original_type = TTYPE (DECL_BIT_FIELD_TYPE (field));
}
break;
case CPP_PLUS_PLUS:
@@ -8732,7 +8732,7 @@ c_parser_expr_list (c_parser *parser, bool convert_p, bool fold_p,
expr.value = c_fully_fold (expr.value, false, NULL);
vec_safe_push (ret, expr.value);
if (orig_types)
- vec_safe_push (orig_types, expr.original_type);
+ vec_safe_push (orig_types, TREE_CAST (expr.original_type));
if (locations)
locations->safe_push (loc);
if (++idx < 3
@@ -18071,7 +18071,7 @@ c_parser_transaction_expression (c_parser *parser, enum rid keyword)
if (c_parser_require (parser, CPP_OPEN_PAREN, "expected %<(%>"))
{
tree expr = c_parser_expression (parser).value;
- ret.original_type = TREE_TYPE (expr);
+ ret.original_type = TTYPE (TREE_TYPE (expr));
ret.value = build1 (TRANSACTION_EXPR, ret.original_type, expr);
if (this_in & TM_STMT_ATTR_RELAXED)
TRANSACTION_EXPR_RELAXED (ret.value) = 1;
diff --git a/gcc/c/c-tree.h b/gcc/c/c-tree.h
index f0ce63991f0..8a685b48040 100644
--- a/gcc/c/c-tree.h
+++ b/gcc/c/c-tree.h
@@ -131,7 +131,7 @@ struct c_expr
differ from the type of the value field for an enum constant.
The type of an enum constant is a plain integer type, but this
field will be the enum type. */
- tree original_type;
+ ttype *original_type;
/* The source range of this expression. This is redundant
for node values that have locations, but not all node kinds
@@ -542,7 +542,7 @@ extern struct c_arg_info *build_arg_info (void);
extern struct c_arg_info *get_parm_info (bool, tree);
extern tree grokfield (location_t, struct c_declarator *,
struct c_declspecs *, tree, tree *);
-extern tree groktypename (struct c_type_name *, tree *, bool *);
+extern ttype *groktypename (struct c_type_name *, tree *, bool *);
extern tree grokparm (const struct c_parm *, tree *);
extern tree implicitly_declare (location_t, tree);
extern void keep_next_level (void);
@@ -613,9 +613,9 @@ extern struct c_switch *c_switch_stack;
extern tree c_objc_common_truthvalue_conversion (location_t, tree);
extern tree require_complete_type (location_t, tree);
extern int same_translation_unit_p (const_tree, const_tree);
-extern int comptypes (tree, tree);
-extern int comptypes_check_different_types (tree, tree, bool *);
-extern bool c_vla_type_p (const_tree);
+extern int comptypes (ttype_p, ttype_p);
+extern int comptypes_check_different_types (ttype_p, ttype_p, bool *);
+extern bool c_vla_type_p (const ttype_p);
extern bool c_mark_addressable (tree);
extern void c_incomplete_type_error (location_t, const_tree, const ttype_p);
extern ttype *c_type_promotes_to (ttype_p);
@@ -626,10 +626,10 @@ extern struct c_expr default_function_array_read_conversion (location_t,
extern struct c_expr convert_lvalue_to_rvalue (location_t, struct c_expr,
bool, bool);
extern void mark_exp_read (tree);
-extern tree composite_type (tree, tree);
+extern ttype *composite_type (ttype_p, ttype_p);
extern tree build_component_ref (location_t, tree, tree, location_t);
extern tree build_array_ref (location_t, tree, tree);
-extern tree build_external_ref (location_t, tree, int, tree *);
+extern tree build_external_ref (location_t, tree, int, ttype_pp);
extern void pop_maybe_used (bool);
extern struct c_expr c_expr_sizeof_expr (location_t, struct c_expr);
extern struct c_expr c_expr_sizeof_type (location_t, struct c_type_name *);
@@ -638,16 +638,16 @@ extern struct c_expr parser_build_unary_op (location_t, enum tree_code,
extern struct c_expr parser_build_binary_op (location_t,
enum tree_code, struct c_expr,
struct c_expr);
-extern tree build_conditional_expr (location_t, tree, bool, tree, tree,
- tree, tree);
+extern tree build_conditional_expr (location_t, tree, bool, tree, ttype_p,
+ tree, ttype_p);
extern tree build_compound_expr (location_t, tree, tree);
extern tree c_cast_expr (location_t, struct c_type_name *, tree);
-extern tree build_c_cast (location_t, tree, tree);
-extern void store_init_value (location_t, tree, tree, tree);
+extern tree build_c_cast (location_t, ttype_p, tree);
+extern void store_init_value (location_t, tree, tree, ttype_p);
extern void maybe_warn_string_init (location_t, tree, struct c_expr);
extern void start_init (tree, tree, int, rich_location *);
extern void finish_init (void);
-extern void really_start_incremental_init (tree);
+extern void really_start_incremental_init (ttype_p);
extern void finish_implicit_inits (location_t, struct obstack *);
extern void push_init_level (location_t, int, struct obstack *);
extern struct c_expr pop_init_level (location_t, int, struct obstack *,
@@ -659,7 +659,7 @@ extern void process_init_element (location_t, struct c_expr, bool,
extern tree build_compound_literal (location_t, tree, tree, bool);
extern void check_compound_literal_type (location_t, struct c_type_name *);
extern tree c_start_case (location_t, location_t, tree, bool);
-extern void c_finish_case (tree, tree);
+extern void c_finish_case (tree, ttype *);
extern tree build_asm_expr (location_t, tree, tree, tree, tree, tree, bool);
extern tree build_asm_stmt (tree, tree);
extern int c_types_compatible_p (ttype_p, ttype_p);
@@ -671,7 +671,7 @@ extern tree c_begin_stmt_expr (void);
extern tree c_finish_stmt_expr (location_t, tree);
extern tree c_process_expr_stmt (location_t, tree);
extern tree c_finish_expr_stmt (location_t, tree);
-extern tree c_finish_return (location_t, tree, tree);
+extern tree c_finish_return (location_t, tree, ttype_p);
extern tree c_finish_bc_stmt (location_t, tree *, bool);
extern tree c_finish_goto_label (location_t, tree);
extern tree c_finish_goto_ptr (location_t, tree);
@@ -686,7 +686,7 @@ extern tree c_finish_omp_task (location_t, tree, tree);
extern void c_finish_omp_cancel (location_t, tree);
extern void c_finish_omp_cancellation_point (location_t, tree);
extern tree c_finish_omp_clauses (tree, enum c_omp_region_type);
-extern tree c_build_va_arg (location_t, tree, location_t, tree);
+extern tree c_build_va_arg (location_t, tree, location_t, ttype_p);
extern tree c_finish_transaction (location_t, tree, int);
extern bool c_tree_equal (tree, tree);
extern tree c_build_function_call_vec (location_t, vec<location_t>, tree,
diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c
index ce99b505959..120d3579e86 100644
--- a/gcc/c/c-typeck.c
+++ b/gcc/c/c-typeck.c
@@ -50,6 +50,7 @@ along with GCC; see the file COPYING3. If not see
#include "gomp-constants.h"
#include "spellcheck-tree.h"
#include "gcc-rich-location.h"
+#include "ttype.h"
/* Possible cases of implicit bad conversions. Used to select
diagnostic messages in convert_for_assignment. */
@@ -81,33 +82,34 @@ static int require_constant_value;
static int require_constant_elements;
static bool null_pointer_constant_p (const_tree);
-static tree qualify_type (tree, tree);
-static int tagged_types_tu_compatible_p (const_tree, const_tree, bool *,
+static ttype *qualify_type (ttype *, ttype *);
+static int tagged_types_tu_compatible_p (const ttype *, const ttype *, bool *,
bool *);
-static int comp_target_types (location_t, tree, tree);
-static int function_types_compatible_p (const_tree, const_tree, bool *,
+static int comp_target_types (location_t, ttype *, ttype *);
+static int function_types_compatible_p (const ttype *, const ttype *, bool *,
bool *);
static int type_lists_compatible_p (const_tree, const_tree, bool *, bool *);
-static tree lookup_field (tree, tree);
+static tree lookup_field (ttype *, tree);
static int convert_arguments (location_t, vec<location_t>, tree,
vec<tree, va_gc> *, vec<tree, va_gc> *, tree,
tree);
static tree pointer_diff (location_t, tree, tree);
-static tree convert_for_assignment (location_t, location_t, tree, tree, tree,
- enum impl_conv, bool, tree, tree, int);
+static tree convert_for_assignment (location_t, location_t, ttype *, tree,
+ ttype *, enum impl_conv, bool, tree, tree,
+ int);
static tree valid_compound_expr_initializer (tree, tree);
static void push_string (const char *);
static void push_member_name (tree);
static int spelling_length (void);
static char *print_spelling (char *);
static void warning_init (location_t, int, const char *);
-static tree digest_init (location_t, tree, tree, tree, bool, bool, int);
-static void output_init_element (location_t, tree, tree, bool, tree, tree, int,
- bool, struct obstack *);
+static tree digest_init (location_t, ttype *, tree, ttype *, bool, bool, int);
+static void output_init_element (location_t, tree, ttype *, bool, ttype *, tree,
+ int, bool, struct obstack *);
static void output_pending_init_elements (int, struct obstack *);
static int set_designator (location_t, int, struct obstack *);
static void push_range_stack (tree, struct obstack *);
-static void add_pending_init (location_t, tree, tree, tree, bool,
+static void add_pending_init (location_t, tree, tree, ttype *, bool,
struct obstack *);
static void set_nonincremental_init (struct obstack *);
static void set_nonincremental_init_from_string (tree, struct obstack *);
@@ -115,7 +117,7 @@ static tree find_init_member (tree, struct obstack *);
static void readonly_warning (tree, enum lvalue_use);
static int lvalue_or_else (location_t, const_tree, enum lvalue_use);
static void record_maybe_used_decl (tree);
-static int comptypes_internal (const_tree, const_tree, bool *, bool *);
+static int comptypes_internal (const ttype *, const ttype *, bool *, bool *);
/* Return true if EXP is a null pointer constant, false otherwise. */
@@ -124,7 +126,7 @@ null_pointer_constant_p (const_tree expr)
{
/* This should really operate on c_expr structures, but they aren't
yet available everywhere required. */
- tree type = TREE_TYPE (expr);
+ ttype *type = TREE_TYPE (expr);
return (TREE_CODE (expr) == INTEGER_CST
&& !TREE_OVERFLOW (expr)
&& integer_zerop (expr)
@@ -191,7 +193,7 @@ static void free_all_tagged_tu_seen_up_to (const struct tagged_tu_seen_cache *);
tree
require_complete_type (location_t loc, tree value)
{
- tree type = TREE_TYPE (value);
+ ttype *type = TREE_TYPE (value);
if (error_operand_p (value))
return error_mark_node;
@@ -212,7 +214,7 @@ require_complete_type (location_t loc, tree value)
void
c_incomplete_type_error (location_t loc, const_tree value, const ttype_p t)
{
- const_tree type = t;
+ const ttype *type = t;
/* Avoid duplicate error message. */
if (TREE_CODE (type) == ERROR_MARK)
return;
@@ -283,7 +285,7 @@ c_type_promotes_to (ttype_p type)
if (ret != NULL)
return (TYPE_ATOMIC (type)
- ? TTYPE (c_build_qualified_type (ret, TYPE_QUAL_ATOMIC))
+ ? c_build_qualified_type (ret, TYPE_QUAL_ATOMIC)
: ret);
return type;
@@ -318,8 +320,8 @@ addr_space_superset (addr_space_t as1, addr_space_t as2, addr_space_t *common)
/* Return a variant of TYPE which has all the type qualifiers of LIKE
as well as those of TYPE. */
-static tree
-qualify_type (tree type, tree like)
+static ttype *
+qualify_type (ttype *type, ttype *like)
{
addr_space_t as_type = TYPE_ADDR_SPACE (type);
addr_space_t as_like = TYPE_ADDR_SPACE (like);
@@ -343,7 +345,7 @@ qualify_type (tree type, tree like)
/* Return true iff the given tree T is a variable length array. */
bool
-c_vla_type_p (const_tree t)
+c_vla_type_p (const ttype_p t)
{
if (TREE_CODE (t) == ARRAY_TYPE
&& C_TYPE_VARIABLE_SIZE (t))
@@ -357,8 +359,8 @@ c_vla_type_p (const_tree t)
nonzero; if that isn't so, this may crash. In particular, we
assume that qualifiers match. */
-tree
-composite_type (tree t1, tree t2)
+ttype *
+composite_type (ttype_p t1, ttype_p t2)
{
enum tree_code code1;
enum tree_code code2;
@@ -369,9 +371,9 @@ composite_type (tree t1, tree t2)
if (t1 == t2) return t1;
/* If one type is nonsense, use the other. */
- if (t1 == error_mark_node)
+ if (t1 == error_type_node)
return t2;
- if (t2 == error_mark_node)
+ if (t2 == error_type_node)
return t1;
code1 = TREE_CODE (t1);
@@ -397,9 +399,9 @@ composite_type (tree t1, tree t2)
case POINTER_TYPE:
/* For two pointers, do this recursively on the target type. */
{
- tree pointed_to_1 = TREE_TYPE (t1);
- tree pointed_to_2 = TREE_TYPE (t2);
- tree target = composite_type (pointed_to_1, pointed_to_2);
+ ttype *pointed_to_1 = TREE_TYPE (t1);
+ ttype *pointed_to_2 = TREE_TYPE (t2);
+ ttype *target = composite_type (pointed_to_1, pointed_to_2);
t1 = build_pointer_type_for_mode (target, TYPE_MODE (t1), false);
t1 = build_type_attribute_variant (t1, attributes);
return qualify_type (t1, t2);
@@ -407,11 +409,11 @@ composite_type (tree t1, tree t2)
case ARRAY_TYPE:
{
- tree elt = composite_type (TREE_TYPE (t1), TREE_TYPE (t2));
+ ttype *elt = composite_type (TREE_TYPE (t1), TREE_TYPE (t2));
int quals;
- tree unqual_elt;
- tree d1 = TYPE_DOMAIN (t1);
- tree d2 = TYPE_DOMAIN (t2);
+ ttype *unqual_elt;
+ ttype *d1 = TYPE_DOMAIN (t1);
+ ttype *d2 = TYPE_DOMAIN (t2);
bool d1_variable, d2_variable;
bool d1_zero, d2_zero;
bool t1_complete, t2_complete;
@@ -492,7 +494,7 @@ composite_type (tree t1, tree t2)
/* Function types: prefer the one that specified arg types.
If both do, merge the arg types. Also merge the return types. */
{
- tree valtype = composite_type (TREE_TYPE (t1), TREE_TYPE (t2));
+ ttype *valtype = composite_type (TREE_TYPE (t1), TREE_TYPE (t2));
tree p1 = TYPE_ARG_TYPES (t1);
tree p2 = TYPE_ARG_TYPES (t2);
int len;
@@ -555,21 +557,21 @@ composite_type (tree t1, tree t2)
&& TREE_VALUE (p1) != TREE_VALUE (p2))
{
tree memb;
- tree mv2 = TREE_VALUE (p2);
- if (mv2 && mv2 != error_mark_node
+ ttype *mv2 = TREE_VALUE_TYPE (p2);
+ if (mv2 && mv2 != error_type_node
&& TREE_CODE (mv2) != ARRAY_TYPE)
mv2 = TYPE_MAIN_VARIANT (mv2);
- for (memb = TYPE_FIELDS (TREE_VALUE (p1));
+ for (memb = TYPE_FIELDS (TREE_VALUE_TYPE (p1));
memb; memb = DECL_CHAIN (memb))
{
- tree mv3 = TREE_TYPE (memb);
- if (mv3 && mv3 != error_mark_node
+ ttype *mv3 = TREE_TYPE (memb);
+ if (mv3 && mv3 != error_type_node
&& TREE_CODE (mv3) != ARRAY_TYPE)
mv3 = TYPE_MAIN_VARIANT (mv3);
if (comptypes (mv3, mv2))
{
TREE_VALUE (n) = composite_type (TREE_TYPE (memb),
- TREE_VALUE (p2));
+ TREE_VALUE_TYPE (p2));
pedwarn (input_location, OPT_Wpedantic,
"function types not truly compatible in ISO C");
goto parm_done;
@@ -580,28 +582,29 @@ composite_type (tree t1, tree t2)
&& TREE_VALUE (p2) != TREE_VALUE (p1))
{
tree memb;
- tree mv1 = TREE_VALUE (p1);
- if (mv1 && mv1 != error_mark_node
+ ttype *mv1 = TREE_VALUE_TYPE (p1);
+ if (mv1 && mv1 != error_type_node
&& TREE_CODE (mv1) != ARRAY_TYPE)
mv1 = TYPE_MAIN_VARIANT (mv1);
- for (memb = TYPE_FIELDS (TREE_VALUE (p2));
+ for (memb = TYPE_FIELDS (TREE_VALUE_TYPE (p2));
memb; memb = DECL_CHAIN (memb))
{
- tree mv3 = TREE_TYPE (memb);
- if (mv3 && mv3 != error_mark_node
+ ttype *mv3 = TREE_TYPE (memb);
+ if (mv3 && mv3 != error_type_node
&& TREE_CODE (mv3) != ARRAY_TYPE)
mv3 = TYPE_MAIN_VARIANT (mv3);
if (comptypes (mv3, mv1))
{
TREE_VALUE (n) = composite_type (TREE_TYPE (memb),
- TREE_VALUE (p1));
+ TREE_VALUE_TYPE (p1));
pedwarn (input_location, OPT_Wpedantic,
"function types not truly compatible in ISO C");
goto parm_done;
}
}
}
- TREE_VALUE (n) = composite_type (TREE_VALUE (p1), TREE_VALUE (p2));
+ TREE_VALUE (n) = composite_type (TREE_VALUE_TYPE (p1),
+ TREE_VALUE_TYPE (p2));
parm_done: ;
}
@@ -622,13 +625,13 @@ composite_type (tree t1, tree t2)
We assume that comp_target_types has already been done and returned
nonzero; if that isn't so, this may crash. */
-static tree
-common_pointer_type (tree t1, tree t2)
+static ttype *
+common_pointer_type (ttype *t1, ttype *t2)
{
tree attributes;
- tree pointed_to_1, mv1;
- tree pointed_to_2, mv2;
- tree target;
+ ttype *pointed_to_1, *mv1;
+ ttype *pointed_to_2, *mv2;
+ ttype *target;
unsigned target_quals;
addr_space_t as1, as2, as_common;
int quals1, quals2;
@@ -638,9 +641,9 @@ common_pointer_type (tree t1, tree t2)
if (t1 == t2) return t1;
/* If one type is nonsense, use the other. */
- if (t1 == error_mark_node)
+ if (t1 == error_type_node)
return t2;
- if (t2 == error_mark_node)
+ if (t2 == error_type_node)
return t1;
gcc_assert (TREE_CODE (t1) == POINTER_TYPE
@@ -694,16 +697,16 @@ common_pointer_type (tree t1, tree t2)
This is the type for the result of most arithmetic operations
if the operands have the given two types. */
-static tree
-c_common_type (tree t1, tree t2)
+static ttype *
+c_common_type (ttype *t1, ttype *t2)
{
enum tree_code code1;
enum tree_code code2;
/* If one type is nonsense, use the other. */
- if (t1 == error_mark_node)
+ if (t1 == error_type_node)
return t2;
- if (t2 == error_mark_node)
+ if (t2 == error_type_node)
return t1;
if (TYPE_QUALS (t1) != TYPE_UNQUALIFIED)
@@ -741,17 +744,17 @@ c_common_type (tree t1, tree t2)
if (code1 == VECTOR_TYPE || code2 == VECTOR_TYPE)
{
error ("can%'t mix operands of decimal float and vector types");
- return error_mark_node;
+ return error_type_node;
}
if (code1 == COMPLEX_TYPE || code2 == COMPLEX_TYPE)
{
error ("can%'t mix operands of decimal float and complex types");
- return error_mark_node;
+ return error_type_node;
}
if (code1 == REAL_TYPE && code2 == REAL_TYPE)
{
error ("can%'t mix operands of decimal float and other float types");
- return error_mark_node;
+ return error_type_node;
}
}
@@ -769,9 +772,9 @@ c_common_type (tree t1, tree t2)
required type. */
if (code1 == COMPLEX_TYPE || code2 == COMPLEX_TYPE)
{
- tree subtype1 = code1 == COMPLEX_TYPE ? TREE_TYPE (t1) : t1;
- tree subtype2 = code2 == COMPLEX_TYPE ? TREE_TYPE (t2) : t2;
- tree subtype = c_common_type (subtype1, subtype2);
+ ttype *subtype1 = code1 == COMPLEX_TYPE ? TREE_TYPE (t1) : t1;
+ ttype *subtype2 = code2 == COMPLEX_TYPE ? TREE_TYPE (t2) : t2;
+ ttype *subtype = c_common_type (subtype1, subtype2);
if (code1 == COMPLEX_TYPE && TREE_TYPE (t1) == subtype)
return t1;
@@ -977,8 +980,8 @@ c_common_type (tree t1, tree t2)
are allowed here and are converted to their compatible integer types.
BOOLEAN_TYPEs are allowed here and return either boolean_type_node or
preferably a non-Boolean type as the common type. */
-tree
-common_type (tree t1, tree t2)
+ttype *
+common_type (ttype_p t1, ttype_p t2)
{
if (TREE_CODE (t1) == ENUMERAL_TYPE)
t1 = c_common_type_for_size (TYPE_PRECISION (t1), 1);
@@ -1004,7 +1007,7 @@ common_type (tree t1, tree t2)
but a warning may be needed if you use them together. */
int
-comptypes (tree type1, tree type2)
+comptypes (ttype_p type1, ttype_p type2)
{
const struct tagged_tu_seen_cache * tagged_tu_seen_base1 = tagged_tu_seen_base;
int val;
@@ -1019,7 +1022,7 @@ comptypes (tree type1, tree type2)
compatible, it sets *ENUM_AND_INT_P to true. */
static int
-comptypes_check_enum_int (tree type1, tree type2, bool *enum_and_int_p)
+comptypes_check_enum_int (ttype *type1, ttype *type2, bool *enum_and_int_p)
{
const struct tagged_tu_seen_cache * tagged_tu_seen_base1 = tagged_tu_seen_base;
int val;
@@ -1034,7 +1037,7 @@ comptypes_check_enum_int (tree type1, tree type2, bool *enum_and_int_p)
sets *DIFFERENT_TYPES_P to true. */
int
-comptypes_check_different_types (tree type1, tree type2,
+comptypes_check_different_types (ttype_p type1, ttype_p type2,
bool *different_types_p)
{
const struct tagged_tu_seen_cache * tagged_tu_seen_base1 = tagged_tu_seen_base;
@@ -1060,11 +1063,11 @@ comptypes_check_different_types (tree type1, tree type2,
types. */
static int
-comptypes_internal (const_tree type1, const_tree type2, bool *enum_and_int_p,
- bool *different_types_p)
+comptypes_internal (const ttype *type1, const ttype *type2,
+ bool *enum_and_int_p, bool *different_types_p)
{
- const_tree t1 = type1;
- const_tree t2 = type2;
+ const ttype *t1 = type1;
+ const ttype *t2 = type2;
int attrval, val;
/* Suppress errors caused by previously reported errors. */
@@ -1165,8 +1168,8 @@ comptypes_internal (const_tree type1, const_tree type2, bool *enum_and_int_p,
case ARRAY_TYPE:
{
- tree d1 = TYPE_DOMAIN (t1);
- tree d2 = TYPE_DOMAIN (t2);
+ ttype *d1 = TYPE_DOMAIN (t1);
+ ttype *d2 = TYPE_DOMAIN (t2);
bool d1_variable, d2_variable;
bool d1_zero, d2_zero;
val = 1;
@@ -1250,12 +1253,12 @@ comptypes_internal (const_tree type1, const_tree type2, bool *enum_and_int_p,
subset of the other. */
static int
-comp_target_types (location_t location, tree ttl, tree ttr)
+comp_target_types (location_t location, ttype *ttl, ttype *ttr)
{
int val;
int val_ped;
- tree mvl = TREE_TYPE (ttl);
- tree mvr = TREE_TYPE (ttr);
+ ttype *mvl = TREE_TYPE (ttl);
+ ttype *mvr = TREE_TYPE (ttr);
addr_space_t asl = TYPE_ADDR_SPACE (mvl);
addr_space_t asr = TYPE_ADDR_SPACE (mvr);
addr_space_t as_common;
@@ -1316,7 +1319,7 @@ same_translation_unit_p (const_tree t1, const_tree t2)
case tcc_declaration:
t1 = DECL_CONTEXT (t1); break;
case tcc_type:
- t1 = TYPE_CONTEXT (t1); break;
+ t1 = TYPE_CONTEXT (TTYPE (t1)); break;
case tcc_exceptional:
t1 = BLOCK_SUPERCONTEXT (t1); break; /* assume block */
default: gcc_unreachable ();
@@ -1328,7 +1331,7 @@ same_translation_unit_p (const_tree t1, const_tree t2)
case tcc_declaration:
t2 = DECL_CONTEXT (t2); break;
case tcc_type:
- t2 = TYPE_CONTEXT (t2); break;
+ t2 = TYPE_CONTEXT (TTYPE (t2)); break;
case tcc_exceptional:
t2 = BLOCK_SUPERCONTEXT (t2); break; /* assume block */
default: gcc_unreachable ();
@@ -1389,7 +1392,7 @@ free_all_tagged_tu_seen_up_to (const struct tagged_tu_seen_cache *tu_til)
comptypes_internal. */
static int
-tagged_types_tu_compatible_p (const_tree t1, const_tree t2,
+tagged_types_tu_compatible_p (const ttype *t1, const ttype *t2,
bool *enum_and_int_p, bool *different_types_p)
{
tree s1, s2;
@@ -1613,14 +1616,14 @@ tagged_types_tu_compatible_p (const_tree t1, const_tree t2,
ENUM_AND_INT_P and DIFFERENT_TYPES_P are as in comptypes_internal. */
static int
-function_types_compatible_p (const_tree f1, const_tree f2,
+function_types_compatible_p (const ttype *f1, const ttype *f2,
bool *enum_and_int_p, bool *different_types_p)
{
tree args1, args2;
/* 1 if no need for warning yet, 2 if warning cause has been seen. */
int val = 1;
int val1;
- tree ret1, ret2;
+ ttype *ret1, *ret2;
ret1 = TREE_TYPE (f1);
ret2 = TREE_TYPE (f2);
@@ -1694,21 +1697,21 @@ type_lists_compatible_p (const_tree args1, const_tree args2,
while (1)
{
- tree a1, mv1, a2, mv2;
+ ttype *a1, *mv1, *a2, *mv2;
if (args1 == 0 && args2 == 0)
return val;
/* If one list is shorter than the other,
they fail to match. */
if (args1 == 0 || args2 == 0)
return 0;
- mv1 = a1 = TREE_VALUE (args1);
- mv2 = a2 = TREE_VALUE (args2);
- if (mv1 && mv1 != error_mark_node && TREE_CODE (mv1) != ARRAY_TYPE)
+ mv1 = a1 = TREE_VALUE_TYPE (args1);
+ mv2 = a2 = TREE_VALUE_TYPE (args2);
+ if (mv1 && mv1 != error_type_node && TREE_CODE (mv1) != ARRAY_TYPE)
mv1 = (TYPE_ATOMIC (mv1)
? c_build_qualified_type (TYPE_MAIN_VARIANT (mv1),
TYPE_QUAL_ATOMIC)
: TYPE_MAIN_VARIANT (mv1));
- if (mv2 && mv2 != error_mark_node && TREE_CODE (mv2) != ARRAY_TYPE)
+ if (mv2 && mv2 != error_type_node && TREE_CODE (mv2) != ARRAY_TYPE)
mv2 = (TYPE_ATOMIC (mv2)
? c_build_qualified_type (TYPE_MAIN_VARIANT (mv2),
TYPE_QUAL_ATOMIC)
@@ -1752,8 +1755,8 @@ type_lists_compatible_p (const_tree args1, const_tree args2,
for (memb = TYPE_FIELDS (a1);
memb; memb = DECL_CHAIN (memb))
{
- tree mv3 = TREE_TYPE (memb);
- if (mv3 && mv3 != error_mark_node
+ ttype *mv3 = TREE_TYPE (memb);
+ if (mv3 && mv3 != error_type_node
&& TREE_CODE (mv3) != ARRAY_TYPE)
mv3 = (TYPE_ATOMIC (mv3)
? c_build_qualified_type (TYPE_MAIN_VARIANT (mv3),
@@ -1777,8 +1780,8 @@ type_lists_compatible_p (const_tree args1, const_tree args2,
for (memb = TYPE_FIELDS (a2);
memb; memb = DECL_CHAIN (memb))
{
- tree mv3 = TREE_TYPE (memb);
- if (mv3 && mv3 != error_mark_node
+ ttype *mv3 = TREE_TYPE (memb);
+ if (mv3 && mv3 != error_type_node
&& TREE_CODE (mv3) != ARRAY_TYPE)
mv3 = (TYPE_ATOMIC (mv3)
? c_build_qualified_type (TYPE_MAIN_VARIANT (mv3),
@@ -1810,7 +1813,7 @@ type_lists_compatible_p (const_tree args1, const_tree args2,
for that. */
static tree
-c_size_in_bytes (const_tree type)
+c_size_in_bytes (const ttype *type)
{
enum tree_code code = TREE_CODE (type);
@@ -1855,7 +1858,7 @@ array_to_pointer_conversion (location_t loc, tree exp)
tree orig_exp = exp;
tree type = TREE_TYPE (exp);
tree adr;
- tree restype = TREE_TYPE (type);
+ ttype *restype = TREE_TYPE (type);
tree ptrtype;
gcc_assert (TREE_CODE (type) == ARRAY_TYPE);
@@ -2042,8 +2045,9 @@ convert_lvalue_to_rvalue (location_t loc, struct c_expr exp,
if (really_atomic_lvalue (exp.value))
{
vec<tree, va_gc> *params;
- tree nonatomic_type, tmp, tmp_addr, fndecl, func_call;
- tree expr_type = TREE_TYPE (exp.value);
+ ttype *nonatomic_type;
+ tree tmp, tmp_addr, fndecl, func_call;
+ ttype *expr_type = TREE_TYPE (exp.value);
tree expr_addr = build_unary_op (loc, ADDR_EXPR, exp.value, false);
tree seq_cst = build_int_cst (integer_type_node, MEMMODEL_SEQ_CST);
@@ -2084,7 +2088,7 @@ convert_lvalue_to_rvalue (location_t loc, struct c_expr exp,
tree
perform_integral_promotions (tree exp)
{
- tree type = TREE_TYPE (exp);
+ ttype *type = TREE_TYPE (exp);
enum tree_code code = TREE_CODE (type);
gcc_assert (INTEGRAL_TYPE_P (type));
@@ -2134,7 +2138,7 @@ tree
default_conversion (tree exp)
{
tree orig_exp;
- tree type = TREE_TYPE (exp);
+ ttype *type = TREE_TYPE (exp);
enum tree_code code = TREE_CODE (type);
tree promoted_type;
@@ -2187,7 +2191,7 @@ default_conversion (tree exp)
unions, the list steps down the chain to the component. */
static tree
-lookup_field (tree type, tree component)
+lookup_field (ttype *type, tree component)
{
tree field;
@@ -2293,7 +2297,7 @@ lookup_field (tree type, tree component)
/* Recursively append candidate IDENTIFIER_NODEs to CANDIDATES. */
static void
-lookup_field_fuzzy_find_candidates (tree type, tree component,
+lookup_field_fuzzy_find_candidates (ttype *type, tree component,
vec<tree> *candidates)
{
tree field;
@@ -2313,7 +2317,7 @@ lookup_field_fuzzy_find_candidates (tree type, tree component,
rather than returning a TREE_LIST for an exact match. */
static tree
-lookup_field_fuzzy (tree type, tree component)
+lookup_field_fuzzy (ttype *type, tree component)
{
gcc_assert (TREE_CODE (component) == IDENTIFIER_NODE);
@@ -2362,7 +2366,7 @@ tree
build_component_ref (location_t loc, tree datum, tree component,
location_t component_loc)
{
- tree type = TREE_TYPE (datum);
+ ttype *type = TREE_TYPE (datum);
enum tree_code code = TREE_CODE (type);
tree field = NULL;
tree ref;
@@ -2431,10 +2435,10 @@ build_component_ref (location_t loc, tree datum, tree component,
{
tree subdatum = TREE_VALUE (field);
int quals;
- tree subtype;
+ ttype *subtype;
bool use_datum_quals;
- if (TREE_TYPE (subdatum) == error_mark_node)
+ if (TREE_TYPE (subdatum) == error_type_node)
return error_mark_node;
/* If this is an rvalue, it does not have qualifiers in C
@@ -2500,7 +2504,7 @@ tree
build_indirect_ref (location_t loc, tree ptr, ref_operator errstring)
{
tree pointer = default_conversion (ptr);
- tree type = TREE_TYPE (pointer);
+ ttype *type = TREE_TYPE (pointer);
tree ref;
if (TREE_CODE (type) == POINTER_TYPE)
@@ -2527,7 +2531,7 @@ build_indirect_ref (location_t loc, tree ptr, ref_operator errstring)
}
else
{
- tree t = TREE_TYPE (type);
+ ttype *t = TREE_TYPE (type);
ref = build1 (INDIRECT_REF, t, pointer);
@@ -2584,8 +2588,8 @@ build_array_ref (location_t loc, tree array, tree index)
{
tree ret;
bool swapped = false;
- if (TREE_TYPE (array) == error_mark_node
- || TREE_TYPE (index) == error_mark_node)
+ if (TREE_TYPE (array) == error_type_node
+ || TREE_TYPE (index) == error_type_node)
return error_mark_node;
if (flag_cilkplus && contains_array_notation_expr (index))
@@ -2645,7 +2649,8 @@ build_array_ref (location_t loc, tree array, tree index)
if (TREE_CODE (TREE_TYPE (array)) == ARRAY_TYPE)
{
- tree rval, type;
+ tree rval;
+ ttype *type;
/* An array that is indexed by a non-constant
cannot be stored in a register; we must be able to do
@@ -2734,7 +2739,7 @@ build_array_ref (location_t loc, tree array, tree index)
for CONST_DECLs defined as enum constants. If the type of the
identifier is not available, *TYPE is set to NULL. */
tree
-build_external_ref (location_t loc, tree id, int fun, tree *type)
+build_external_ref (location_t loc, tree id, int fun, ttype_pp type)
{
tree ref;
tree decl = lookup_name (id);
@@ -2762,7 +2767,7 @@ build_external_ref (location_t loc, tree id, int fun, tree *type)
return error_mark_node;
}
- if (TREE_TYPE (ref) == error_mark_node)
+ if (TREE_TYPE (ref) == error_type_node)
return error_mark_node;
if (TREE_DEPRECATED (ref))
@@ -2932,7 +2937,7 @@ c_expr_sizeof_expr (location_t loc, struct c_expr expr)
struct c_expr
c_expr_sizeof_type (location_t loc, struct c_type_name *t)
{
- tree type;
+ ttype *type;
struct c_expr ret;
tree type_expr = NULL_TREE;
bool type_expr_const = true;
@@ -2957,7 +2962,7 @@ c_expr_sizeof_type (location_t loc, struct c_type_name *t)
type_expr, ret.value);
C_MAYBE_CONST_EXPR_NON_CONST (ret.value) = !type_expr_const;
}
- pop_maybe_used (type != error_mark_node
+ pop_maybe_used (type != error_type_node
? C_TYPE_VARIABLE_SIZE (type) : false);
return ret;
}
@@ -3004,7 +3009,8 @@ build_function_call_vec (location_t loc, vec<location_t> arg_loc,
tree function, vec<tree, va_gc> *params,
vec<tree, va_gc> *origtypes)
{
- tree fntype, fundecl = 0;
+ tree fundecl = 0;
+ ttype *fntype;
tree name = NULL_TREE, result;
tree tem;
int nargs;
@@ -3087,7 +3093,7 @@ build_function_call_vec (location_t loc, vec<location_t> arg_loc,
&& TREE_CODE (tem = TREE_OPERAND (tem, 0)) == FUNCTION_DECL
&& !comptypes (fntype, TREE_TYPE (tem)))
{
- tree return_type = TREE_TYPE (fntype);
+ ttype *return_type = TREE_TYPE (fntype);
/* This situation leads to run-time undefined behavior. We can't,
therefore, simply error unless we can prove that all possible
@@ -3263,8 +3269,8 @@ convert_arguments (location_t loc, vec<location_t> arg_loc, tree typelist,
values && values->iterate (parmnum, &val);
++parmnum)
{
- tree type = typetail ? TREE_VALUE (typetail) : 0;
- tree valtype = TREE_TYPE (val);
+ ttype *type = typetail ? TREE_VALUE_TYPE (typetail) : 0;
+ ttype *valtype = TREE_TYPE (val);
tree rname = function;
int argnum = parmnum + 1;
const char *invalid_func_diag;
@@ -3341,7 +3347,7 @@ convert_arguments (location_t loc, vec<location_t> arg_loc, tree typelist,
{
/* Formal parm type is specified by a function prototype. */
- if (type == error_mark_node || !COMPLETE_TYPE_P (type))
+ if (type == error_type_node || !COMPLETE_TYPE_P (type))
{
error_at (ploc, "type of formal parameter %d is incomplete",
parmnum + 1);
@@ -3349,7 +3355,7 @@ convert_arguments (location_t loc, vec<location_t> arg_loc, tree typelist,
}
else
{
- tree origtype;
+ ttype *origtype;
/* Optionally warn about conversions that
differ from the default conversions. */
@@ -3442,7 +3448,7 @@ convert_arguments (location_t loc, vec<location_t> arg_loc, tree typelist,
&& INTEGRAL_TYPE_P (valtype))
{
tree would_have_been = default_conversion (val);
- tree type1 = TREE_TYPE (would_have_been);
+ ttype *type1 = TREE_TYPE (would_have_been);
if (TREE_CODE (type) == ENUMERAL_TYPE
&& (TYPE_MAIN_VARIANT (type)
@@ -3491,7 +3497,7 @@ convert_arguments (location_t loc, vec<location_t> arg_loc, tree typelist,
sake of better warnings from convert_and_check. */
if (excess_precision)
val = build1 (EXCESS_PRECISION_EXPR, valtype, val);
- origtype = (!origtypes) ? NULL_TREE : (*origtypes)[parmnum];
+ origtype = (!origtypes) ? NULL : TTYPE ((*origtypes)[parmnum]);
parmval = convert_for_assignment (loc, ploc, type,
val, origtype, ic_argpass,
npc, fundecl, function,
@@ -3624,12 +3630,12 @@ parser_build_binary_op (location_t location, enum tree_code code,
enum tree_code code1 = arg1.original_code;
enum tree_code code2 = arg2.original_code;
- tree type1 = (arg1.original_type
- ? arg1.original_type
- : TREE_TYPE (arg1.value));
- tree type2 = (arg2.original_type
- ? arg2.original_type
- : TREE_TYPE (arg2.value));
+ ttype *type1 = (arg1.original_type
+ ? arg1.original_type
+ : TREE_TYPE (arg1.value));
+ ttype *type2 = (arg2.original_type
+ ? arg2.original_type
+ : TREE_TYPE (arg2.value));
result.value = build_binary_op (location, code,
arg1.value, arg2.value, 1);
@@ -3772,12 +3778,12 @@ parser_build_binary_op (location_t location, enum tree_code code,
static tree
pointer_diff (location_t loc, tree op0, tree op1)
{
- tree restype = ptrdiff_type_node;
+ ttype *restype = ptrdiff_type_node;
tree result, inttype;
addr_space_t as0 = TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (op0)));
addr_space_t as1 = TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (op1)));
- tree target_type = TREE_TYPE (TREE_TYPE (op0));
+ ttype *target_type = TREE_TYPE (TREE_TYPE (op0));
tree orig_op1 = op1;
/* If the operands point into different address spaces, we need to
@@ -3898,16 +3904,17 @@ build_atomic_assign (location_t loc, tree lhs, enum tree_code modifycode,
{
tree fndecl, func_call;
vec<tree, va_gc> *params;
- tree val, nonatomic_lhs_type, nonatomic_rhs_type, newval, newval_addr;
+ tree val, newval, newval_addr;
+ ttype *nonatomic_lhs_type, *nonatomic_rhs_type;
tree old, old_addr;
tree compound_stmt;
tree stmt, goto_stmt;
tree loop_label, loop_decl, done_label, done_decl;
- tree lhs_type = TREE_TYPE (lhs);
+ ttype *lhs_type = TREE_TYPE (lhs);
tree lhs_addr = build_unary_op (loc, ADDR_EXPR, lhs, false);
tree seq_cst = build_int_cst (integer_type_node, MEMMODEL_SEQ_CST);
- tree rhs_type = TREE_TYPE (rhs);
+ ttype *rhs_type = TREE_TYPE (rhs);
gcc_assert (TYPE_ATOMIC (lhs_type));
@@ -4091,7 +4098,7 @@ cas_loop:
rhs = build_binary_op (loc, modifycode, old, val, 1);
rhs = c_fully_fold (rhs, false, NULL);
rhs = convert_for_assignment (loc, UNKNOWN_LOCATION, nonatomic_lhs_type,
- rhs, NULL_TREE, ic_assign, false, NULL_TREE,
+ rhs, NULL, ic_assign, false, NULL_TREE,
NULL_TREE, 0);
if (rhs != error_mark_node)
{
@@ -4159,11 +4166,11 @@ build_unary_op (location_t location, enum tree_code code, tree xarg,
{
/* No default_conversion here. It causes trouble for ADDR_EXPR. */
tree arg = xarg;
- tree argtype = 0;
+ ttype *argtype = NULL;
enum tree_code typecode;
tree val;
tree ret = error_mark_node;
- tree eptype = NULL_TREE;
+ ttype *eptype = NULL;
const char *invalid_op_diag;
bool int_operands;
@@ -4816,8 +4823,8 @@ c_mark_addressable (tree exp)
the usual ones because of excess precision. */
static tree
-ep_convert_and_check (location_t loc, tree type, tree expr,
- tree semantic_type)
+ep_convert_and_check (location_t loc, ttype *type, tree expr,
+ ttype *semantic_type)
{
if (TREE_TYPE (expr) == type)
return expr;
@@ -4845,15 +4852,15 @@ ep_convert_and_check (location_t loc, tree type, tree expr,
tree
build_conditional_expr (location_t colon_loc, tree ifexp, bool ifexp_bcp,
- tree op1, tree op1_original_type, tree op2,
- tree op2_original_type)
+ tree op1, ttype_p op1_original_type, tree op2,
+ ttype_p op2_original_type)
{
- tree type1;
- tree type2;
+ ttype *type1;
+ ttype *type2;
enum tree_code code1;
enum tree_code code2;
- tree result_type = NULL;
- tree semantic_result_type = NULL;
+ ttype *result_type = NULL;
+ ttype *semantic_result_type = NULL;
tree orig_op1 = op1, orig_op2 = op2;
bool int_const, op1_int_operands, op2_int_operands, int_operands;
bool ifexp_int_operands;
@@ -4924,8 +4931,10 @@ build_conditional_expr (location_t colon_loc, tree ifexp, bool ifexp_bcp,
if (warn_cxx_compat)
{
- tree t1 = op1_original_type ? op1_original_type : TREE_TYPE (orig_op1);
- tree t2 = op2_original_type ? op2_original_type : TREE_TYPE (orig_op2);
+ ttype *t1 = op1_original_type ? TTYPE (op1_original_type)
+ : TREE_TYPE (orig_op1);
+ ttype *t2 = op2_original_type ? TTYPE (op2_original_type)
+ : TREE_TYPE (orig_op2);
if (TREE_CODE (t1) == ENUMERAL_TYPE
&& TREE_CODE (t2) == ENUMERAL_TYPE
@@ -5167,11 +5176,11 @@ build_conditional_expr (location_t colon_loc, tree ifexp, bool ifexp_bcp,
/* Need to convert condition operand into a vector mask. */
if (VECTOR_TYPE_P (TREE_TYPE (ifexp)))
{
- tree vectype = TREE_TYPE (ifexp);
- tree elem_type = TREE_TYPE (vectype);
+ ttype *vectype = TREE_TYPE (ifexp);
+ ttype *elem_type = TREE_TYPE (vectype);
tree zero = build_int_cst (elem_type, 0);
tree zero_vec = build_vector_from_val (vectype, zero);
- tree cmp_type = build_same_sized_truth_vector_type (vectype);
+ ttype *cmp_type = build_same_sized_truth_vector_type (vectype);
ifexp = build2 (NE_EXPR, cmp_type, ifexp, zero_vec);
}
@@ -5215,7 +5224,7 @@ tree
build_compound_expr (location_t loc, tree expr1, tree expr2)
{
bool expr1_int_operands, expr2_int_operands;
- tree eptype = NULL_TREE;
+ ttype *eptype = NULL;
tree ret;
if (flag_cilkplus
@@ -5310,10 +5319,10 @@ build_compound_expr (location_t loc, tree expr1, tree expr2)
in different warnings. */
static void
-handle_warn_cast_qual (location_t loc, tree type, tree otype)
+handle_warn_cast_qual (location_t loc, ttype *type, ttype *otype)
{
- tree in_type = type;
- tree in_otype = otype;
+ ttype *in_type = type;
+ ttype *in_otype = otype;
int added = 0;
int discarded = 0;
bool is_const;
@@ -5400,7 +5409,7 @@ handle_warn_cast_qual (location_t loc, tree type, tree otype)
LOC is the location of the cast-- typically the open paren of the cast. */
tree
-build_c_cast (location_t loc, tree type, tree expr)
+build_c_cast (location_t loc, ttype_p type, tree expr)
{
tree value;
@@ -5409,7 +5418,7 @@ build_c_cast (location_t loc, tree type, tree expr)
value = expr;
- if (type == error_mark_node || expr == error_mark_node)
+ if (type == error_type_node || expr == error_mark_node)
return error_mark_node;
/* The ObjC front-end uses TYPE_MAIN_VARIANT to tie together types differing
@@ -5453,7 +5462,7 @@ build_c_cast (location_t loc, tree type, tree expr)
tree field;
for (field = TYPE_FIELDS (type); field; field = DECL_CHAIN (field))
- if (TREE_TYPE (field) != error_mark_node
+ if (TREE_TYPE (field) != error_type_node
&& comptypes (TYPE_MAIN_VARIANT (TREE_TYPE (field)),
TYPE_MAIN_VARIANT (TREE_TYPE (value))))
break;
@@ -5469,7 +5478,7 @@ build_c_cast (location_t loc, tree type, tree expr)
if (!maybe_const)
t = c_wrap_maybe_const (t, true);
t = digest_init (loc, type, t,
- NULL_TREE, false, true, 0);
+ NULL, false, true, 0);
TREE_CONSTANT (t) = TREE_CONSTANT (value);
return t;
}
@@ -5478,7 +5487,8 @@ build_c_cast (location_t loc, tree type, tree expr)
}
else
{
- tree otype, ovalue;
+ ttype *otype;
+ tree ovalue;
if (type == void_type_node)
{
@@ -5637,7 +5647,7 @@ build_c_cast (location_t loc, tree type, tree expr)
tree
c_cast_expr (location_t loc, struct c_type_name *type_name, tree expr)
{
- tree type;
+ ttype *type;
tree type_expr = NULL_TREE;
bool type_expr_const = true;
tree ret;
@@ -5690,16 +5700,16 @@ c_cast_expr (location_t loc, struct c_type_name *type_name, tree expr)
RHS_LOC is the location of the RHS. */
tree
-build_modify_expr (location_t location, tree lhs, tree lhs_origtype,
+build_modify_expr (location_t location, tree lhs, ttype_p lhs_origtype,
enum tree_code modifycode,
- location_t rhs_loc, tree rhs, tree rhs_origtype)
+ location_t rhs_loc, tree rhs, ttype_p rhs_origtype)
{
tree result;
tree newrhs;
tree rhseval = NULL_TREE;
- tree rhs_semantic_type = NULL_TREE;
- tree lhstype = TREE_TYPE (lhs);
- tree olhstype = lhstype;
+ ttype *rhs_semantic_type = NULL;
+ ttype *lhstype = TREE_TYPE (lhs);
+ ttype *olhstype = lhstype;
bool npc;
bool is_atomic_op;
@@ -5772,7 +5782,7 @@ build_modify_expr (location_t location, tree lhs, tree lhs_origtype,
/* The original type of the right hand side is no longer
meaningful. */
- rhs_origtype = NULL_TREE;
+ rhs_origtype = NULL;
}
}
@@ -5830,10 +5840,10 @@ build_modify_expr (location_t location, tree lhs, tree lhs_origtype,
&& lhs_origtype != lhstype
&& TREE_CODE (lhs_origtype) == ENUMERAL_TYPE)
{
- tree checktype = (rhs_origtype != NULL_TREE
- ? rhs_origtype
- : TREE_TYPE (rhs));
- if (checktype != error_mark_node
+ ttype *checktype = (rhs_origtype != NULL
+ ? TTYPE (rhs_origtype)
+ : TREE_TYPE (rhs));
+ if (checktype != error_type_node
&& (TYPE_MAIN_VARIANT (checktype) != TYPE_MAIN_VARIANT (lhs_origtype)
|| (is_atomic_op && modifycode != NOP_EXPR)))
warning_at (location, OPT_Wc___compat,
@@ -5913,7 +5923,7 @@ return_result:
This is used to implement -fplan9-extensions. */
static bool
-find_anonymous_field_with_type (tree struct_type, tree type)
+find_anonymous_field_with_type (ttype *struct_type, ttype *type)
{
tree field;
bool found;
@@ -5924,10 +5934,10 @@ find_anonymous_field_with_type (tree struct_type, tree type)
field != NULL_TREE;
field = TREE_CHAIN (field))
{
- tree fieldtype = (TYPE_ATOMIC (TREE_TYPE (field))
- ? c_build_qualified_type (TREE_TYPE (field),
- TYPE_QUAL_ATOMIC)
- : TYPE_MAIN_VARIANT (TREE_TYPE (field)));
+ ttype *fieldtype = (TYPE_ATOMIC (TREE_TYPE (field))
+ ? c_build_qualified_type (TREE_TYPE (field),
+ TYPE_QUAL_ATOMIC)
+ : TYPE_MAIN_VARIANT (TREE_TYPE (field)));
if (DECL_NAME (field) == NULL
&& comptypes (type, fieldtype))
{
@@ -5953,9 +5963,9 @@ find_anonymous_field_with_type (tree struct_type, tree type)
returns NULL if no conversion could be found. */
static tree
-convert_to_anonymous_field (location_t location, tree type, tree rhs)
+convert_to_anonymous_field (location_t location, ttype *type, tree rhs)
{
- tree rhs_struct_type, lhs_main_type;
+ ttype *rhs_struct_type, *lhs_main_type;
tree field, found_field;
bool found_sub_field;
tree ret;
@@ -5979,10 +5989,10 @@ convert_to_anonymous_field (location_t location, tree type, tree rhs)
if (DECL_NAME (field) != NULL_TREE
|| !RECORD_OR_UNION_TYPE_P (TREE_TYPE (field)))
continue;
- tree fieldtype = (TYPE_ATOMIC (TREE_TYPE (field))
- ? c_build_qualified_type (TREE_TYPE (field),
- TYPE_QUAL_ATOMIC)
- : TYPE_MAIN_VARIANT (TREE_TYPE (field)));
+ ttype *fieldtype = (TYPE_ATOMIC (TREE_TYPE (field))
+ ? c_build_qualified_type (TREE_TYPE (field),
+ TYPE_QUAL_ATOMIC)
+ : TYPE_MAIN_VARIANT (TREE_TYPE (field)));
if (comptypes (lhs_main_type, fieldtype))
{
if (found_field != NULL_TREE)
@@ -6121,14 +6131,14 @@ maybe_warn_string_init (location_t loc, tree type, struct c_expr expr)
PARMNUM is the number of the argument, for printing in error messages. */
static tree
-convert_for_assignment (location_t location, location_t expr_loc, tree type,
- tree rhs, tree origtype, enum impl_conv errtype,
+convert_for_assignment (location_t location, location_t expr_loc, ttype *type,
+ tree rhs, ttype *origtype, enum impl_conv errtype,
bool null_pointer_constant, tree fundecl,
tree function, int parmnum)
{
enum tree_code codel = TREE_CODE (type);
tree orig_rhs = rhs;
- tree rhstype;
+ ttype *rhstype;
enum tree_code coder;
tree rname = NULL_TREE;
bool objc_ok = false;
@@ -6279,8 +6289,8 @@ convert_for_assignment (location_t location, location_t expr_loc, tree type,
if (warn_cxx_compat)
{
- tree checktype = origtype != NULL_TREE ? origtype : rhstype;
- if (checktype != error_mark_node
+ ttype *checktype = origtype != NULL ? origtype : rhstype;
+ if (checktype != error_type_node
&& TREE_CODE (type) == ENUMERAL_TYPE
&& TYPE_MAIN_VARIANT (checktype) != TYPE_MAIN_VARIANT (type))
{
@@ -6386,7 +6396,7 @@ convert_for_assignment (location_t location, location_t expr_loc, tree type,
for (memb = TYPE_FIELDS (type); memb ; memb = DECL_CHAIN (memb))
{
- tree memb_type = TREE_TYPE (memb);
+ ttype *memb_type = TREE_TYPE (memb);
if (comptypes (TYPE_MAIN_VARIANT (memb_type),
TYPE_MAIN_VARIANT (rhstype)))
@@ -6397,8 +6407,8 @@ convert_for_assignment (location_t location, location_t expr_loc, tree type,
if (coder == POINTER_TYPE)
{
- tree ttl = TREE_TYPE (memb_type);
- tree ttr = TREE_TYPE (rhstype);
+ ttype *ttl = TREE_TYPE (memb_type);
+ ttype *ttr = TREE_TYPE (rhstype);
/* Any non-function converts to a [const][volatile] void *
and vice versa; otherwise, targets must be the same.
@@ -6438,8 +6448,8 @@ convert_for_assignment (location_t location, location_t expr_loc, tree type,
{
/* We have only a marginally acceptable member type;
it needs a warning. */
- tree ttl = TREE_TYPE (TREE_TYPE (marginal_memb));
- tree ttr = TREE_TYPE (rhstype);
+ ttype *ttl = TREE_TYPE (TREE_TYPE (marginal_memb));
+ ttype *ttr = TREE_TYPE (rhstype);
/* Const and volatile mean something different for function
types, so the usual warnings are not appropriate. */
@@ -6498,10 +6508,10 @@ convert_for_assignment (location_t location, location_t expr_loc, tree type,
else if ((codel == POINTER_TYPE || codel == REFERENCE_TYPE)
&& (coder == codel))
{
- tree ttl = TREE_TYPE (type);
- tree ttr = TREE_TYPE (rhstype);
- tree mvl = ttl;
- tree mvr = ttr;
+ ttype *ttl = TREE_TYPE (type);
+ ttype *ttr = TREE_TYPE (rhstype);
+ ttype *mvl = ttl;
+ ttype *mvr = ttr;
bool is_opaque_pointer;
int target_cmp = 0; /* Cache comp_target_types () result. */
addr_space_t asl;
@@ -6858,9 +6868,10 @@ valid_compound_expr_initializer (tree value, tree endtype)
INIT_LOC is the location of the initial value. */
void
-store_init_value (location_t init_loc, tree decl, tree init, tree origtype)
+store_init_value (location_t init_loc, tree decl, tree init, ttype_p origtype)
{
- tree value, type;
+ tree value;
+ ttype *type;
bool npc = false;
/* If variable's type was invalidly declared, just ignore it. */
@@ -6910,7 +6921,7 @@ store_init_value (location_t init_loc, tree decl, tree init, tree origtype)
/* For int foo[] = (int [3]){1}; we need to set array size
now since later on array initializer will be just the
brace enclosed list of the compound literal. */
- tree etype = strip_array_types (TREE_TYPE (decl));
+ ttype *etype = strip_array_types (TREE_TYPE (decl));
type = build_distinct_type_copy (TYPE_MAIN_VARIANT (type));
TYPE_DOMAIN (type) = TYPE_DOMAIN (TREE_TYPE (cldecl));
layout_type (type);
@@ -7061,16 +7072,16 @@ print_spelling (char *buffer)
elements are seen. */
static tree
-digest_init (location_t init_loc, tree type, tree init, tree origtype,
+digest_init (location_t init_loc, ttype *type, tree init, ttype *origtype,
bool null_pointer_constant, bool strict_string,
int require_constant)
{
enum tree_code code = TREE_CODE (type);
tree inside_init = init;
- tree semantic_type = NULL_TREE;
+ ttype *semantic_type = NULL;
bool maybe_const = true;
- if (type == error_mark_node
+ if (type == error_type_node
|| !init
|| error_operand_p (init))
return error_mark_node;
@@ -7091,7 +7102,7 @@ digest_init (location_t init_loc, tree type, tree init, tree origtype,
if (code == ARRAY_TYPE && inside_init
&& TREE_CODE (inside_init) == STRING_CST)
{
- tree typ1
+ ttype *typ1
= (TYPE_ATOMIC (TREE_TYPE (type))
? c_build_qualified_type (TYPE_MAIN_VARIANT (TREE_TYPE (type)),
TYPE_QUAL_ATOMIC)
@@ -7109,7 +7120,7 @@ digest_init (location_t init_loc, tree type, tree init, tree origtype,
if (char_array || wchar_array || char16_array || char32_array)
{
struct c_expr expr;
- tree typ2 = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (inside_init)));
+ ttype *typ2 = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (inside_init)));
expr.value = inside_init;
expr.original_code = (strict_string ? STRING_CST : ERROR_MARK);
expr.original_type = NULL;
@@ -7372,7 +7383,7 @@ digest_init (location_t init_loc, tree type, tree init, tree origtype,
/* Type of object we are accumulating a constructor for.
This type is always a RECORD_TYPE, UNION_TYPE or ARRAY_TYPE. */
-static tree constructor_type;
+static ttype *constructor_type;
/* For a RECORD_TYPE or UNION_TYPE, this is the chain of fields
left to fill. */
@@ -7431,7 +7442,7 @@ struct init_node
int balance;
tree purpose;
tree value;
- tree origtype;
+ ttype *origtype;
};
/* Tree of pending elements at this constructor level.
@@ -7471,7 +7482,7 @@ struct constructor_range_stack;
struct constructor_stack
{
struct constructor_stack *next;
- tree type;
+ ttype *type;
tree fields;
tree index;
tree max_index;
@@ -7633,7 +7644,7 @@ finish_init (void)
For an initializer for a decl, TYPE is zero. */
void
-really_start_incremental_init (tree type)
+really_start_incremental_init (ttype_p type)
{
struct constructor_stack *p = XNEW (struct constructor_stack);
@@ -7944,7 +7955,7 @@ push_init_level (location_t loc, int implicit,
}
else
{
- if (constructor_type != error_mark_node)
+ if (constructor_type != error_type_node)
warning_init (input_location, 0, "braces around scalar initializer");
constructor_fields = constructor_type;
constructor_unfilled_fields = constructor_type;
@@ -8005,7 +8016,7 @@ pop_init_level (location_t loc, int implicit,
/* Silently discard empty initializations. The parser will
already have pedwarned for empty brackets. */
if (integer_zerop (constructor_unfilled_index))
- constructor_type = NULL_TREE;
+ constructor_type = NULL;
else
{
gcc_assert (!TYPE_SIZE (constructor_type));
@@ -8020,7 +8031,7 @@ pop_init_level (location_t loc, int implicit,
of a flexible array member not at the end of the structure.
Discard the initializer so that we do not die later. */
if (DECL_CHAIN (constructor_fields) != NULL_TREE)
- constructor_type = NULL_TREE;
+ constructor_type = NULL;
}
}
@@ -8167,7 +8178,7 @@ static int
set_designator (location_t loc, int array,
struct obstack *braced_init_obstack)
{
- tree subtype;
+ ttype *subtype;
enum tree_code subcode;
/* Don't die if an entire brace-pair level is superfluous
@@ -8200,7 +8211,7 @@ set_designator (location_t loc, int array,
case RECORD_TYPE:
case UNION_TYPE:
subtype = TREE_TYPE (constructor_fields);
- if (subtype != error_mark_node)
+ if (subtype != error_type_node)
subtype = TYPE_MAIN_VARIANT (subtype);
break;
case ARRAY_TYPE:
@@ -8408,7 +8419,7 @@ set_init_label (location_t loc, tree fieldname, location_t fieldname_loc,
existing initializer. */
static void
-add_pending_init (location_t loc, tree purpose, tree value, tree origtype,
+add_pending_init (location_t loc, tree purpose, tree value, ttype *origtype,
bool implicit, struct obstack *braced_init_obstack)
{
struct init_node *p, **q, *r;
@@ -8654,7 +8665,7 @@ set_nonincremental_init (struct obstack * braced_init_obstack)
return;
FOR_EACH_CONSTRUCTOR_ELT (constructor_elements, ix, index, value)
- add_pending_init (input_location, index, value, NULL_TREE, true,
+ add_pending_init (input_location, index, value, NULL, true,
braced_init_obstack);
constructor_elements = NULL;
if (TREE_CODE (constructor_type) == RECORD_TYPE)
@@ -8685,7 +8696,8 @@ static void
set_nonincremental_init_from_string (tree str,
struct obstack * braced_init_obstack)
{
- tree value, purpose, type;
+ tree value, purpose;
+ ttype *type;
HOST_WIDE_INT val[2];
const char *p, *end;
int byte, wchar_bytes, charwidth, bitpos;
@@ -8751,7 +8763,7 @@ set_nonincremental_init_from_string (tree str,
value = wide_int_to_tree (type,
wide_int::from_array (val, 2,
HOST_BITS_PER_WIDE_INT * 2));
- add_pending_init (input_location, purpose, value, NULL_TREE, true,
+ add_pending_init (input_location, purpose, value, NULL, true,
braced_init_obstack);
}
@@ -8833,15 +8845,15 @@ find_init_member (tree field, struct obstack * braced_init_obstack)
existing initializer. */
static void
-output_init_element (location_t loc, tree value, tree origtype,
- bool strict_string, tree type, tree field, int pending,
+output_init_element (location_t loc, tree value, ttype *origtype,
+ bool strict_string, ttype *type, tree field, int pending,
bool implicit, struct obstack * braced_init_obstack)
{
- tree semantic_type = NULL_TREE;
+ ttype *semantic_type = NULL;
bool maybe_const = true;
bool npc;
- if (type == error_mark_node || value == error_mark_node)
+ if (type == error_type_node || value == error_mark_node)
{
constructor_erroneous = 1;
return;
@@ -8935,8 +8947,8 @@ output_init_element (location_t loc, tree value, tree origtype,
!= TYPE_MAIN_VARIANT (type))
&& TREE_CODE (DECL_BIT_FIELD_TYPE (field)) == ENUMERAL_TYPE)
{
- tree checktype = origtype != NULL_TREE ? origtype : TREE_TYPE (value);
- if (checktype != error_mark_node
+ ttype *checktype = origtype != NULL ? origtype : TREE_TYPE (value);
+ if (checktype != error_type_node
&& (TYPE_MAIN_VARIANT (checktype)
!= TYPE_MAIN_VARIANT (DECL_BIT_FIELD_TYPE (field))))
warning_init (loc, OPT_Wc___compat,
@@ -8946,7 +8958,7 @@ output_init_element (location_t loc, tree value, tree origtype,
/* If this field is empty (and not at the end of structure),
don't do anything other than checking the initializer. */
if (field
- && (TREE_TYPE (field) == error_mark_node
+ && (TREE_TYPE (field) == error_type_node
|| (COMPLETE_TYPE_P (TREE_TYPE (field))
&& integer_zerop (TYPE_SIZE (TREE_TYPE (field)))
&& (TREE_CODE (constructor_type) == ARRAY_TYPE
@@ -9282,7 +9294,7 @@ process_init_element (location_t loc, struct c_expr value, bool implicit,
if (TREE_CODE (value.value) != COMPOUND_LITERAL_EXPR
|| !require_constant_value)
{
- tree semantic_type = NULL_TREE;
+ ttype *semantic_type = NULL;
if (TREE_CODE (value.value) == EXCESS_PRECISION_EXPR)
{
semantic_type = TREE_TYPE (value.value);
@@ -9299,7 +9311,7 @@ process_init_element (location_t loc, struct c_expr value, bool implicit,
{
if (TREE_CODE (constructor_type) == RECORD_TYPE)
{
- tree fieldtype;
+ ttype *fieldtype;
enum tree_code fieldcode;
if (constructor_fields == 0)
@@ -9309,7 +9321,7 @@ process_init_element (location_t loc, struct c_expr value, bool implicit,
}
fieldtype = TREE_TYPE (constructor_fields);
- if (fieldtype != error_mark_node)
+ if (fieldtype != error_type_node)
fieldtype = TYPE_MAIN_VARIANT (fieldtype);
fieldcode = TREE_CODE (fieldtype);
@@ -9412,7 +9424,7 @@ process_init_element (location_t loc, struct c_expr value, bool implicit,
}
else if (TREE_CODE (constructor_type) == UNION_TYPE)
{
- tree fieldtype;
+ ttype *fieldtype;
enum tree_code fieldcode;
if (constructor_fields == 0)
@@ -9423,7 +9435,7 @@ process_init_element (location_t loc, struct c_expr value, bool implicit,
}
fieldtype = TREE_TYPE (constructor_fields);
- if (fieldtype != error_mark_node)
+ if (fieldtype != error_type_node)
fieldtype = TYPE_MAIN_VARIANT (fieldtype);
fieldcode = TREE_CODE (fieldtype);
@@ -9482,7 +9494,7 @@ process_init_element (location_t loc, struct c_expr value, bool implicit,
}
else if (TREE_CODE (constructor_type) == ARRAY_TYPE)
{
- tree elttype = TYPE_MAIN_VARIANT (TREE_TYPE (constructor_type));
+ ttype *elttype = TYPE_MAIN_VARIANT (TREE_TYPE (constructor_type));
enum tree_code eltcode = TREE_CODE (elttype);
/* Accept a string constant to initialize a subarray. */
@@ -9535,7 +9547,7 @@ process_init_element (location_t loc, struct c_expr value, bool implicit,
}
else if (VECTOR_TYPE_P (constructor_type))
{
- tree elttype = TYPE_MAIN_VARIANT (TREE_TYPE (constructor_type));
+ ttype *elttype = TYPE_MAIN_VARIANT (TREE_TYPE (constructor_type));
/* Do a basic check of initializer size. Note that vectors
always have a fixed size derived from their type. */
@@ -9570,7 +9582,7 @@ process_init_element (location_t loc, struct c_expr value, bool implicit,
/* Handle the sole element allowed in a braced initializer
for a scalar variable. */
- else if (constructor_type != error_mark_node
+ else if (constructor_type != error_type_node
&& constructor_fields == 0)
{
pedwarn_init (loc, 0,
@@ -9831,9 +9843,10 @@ c_finish_goto_ptr (location_t loc, tree expr)
is the original type of RETVAL. */
tree
-c_finish_return (location_t loc, tree retval, tree origtype)
+c_finish_return (location_t loc, tree retval, ttype_p origtype)
{
- tree valtype = TREE_TYPE (TREE_TYPE (current_function_decl)), ret_stmt;
+ ttype *valtype = TREE_TYPE (TREE_TYPE (current_function_decl));
+ tree ret_stmt;
bool no_warning = false;
bool npc = false;
size_t rank = 0;
@@ -9867,7 +9880,7 @@ c_finish_return (location_t loc, tree retval, tree origtype)
}
if (retval)
{
- tree semantic_type = NULL_TREE;
+ ttype *semantic_type = NULL;
npc = null_pointer_constant_p (retval);
if (TREE_CODE (retval) == EXCESS_PRECISION_EXPR)
{
@@ -10022,7 +10035,7 @@ struct c_switch {
/* The original type of the testing expression, i.e. before the
default conversion is applied. */
- tree orig_type;
+ ttype *orig_type;
/* A splay-tree mapping the low element of a case range to the high
element, or NULL_TREE if there is no high element. Used to
@@ -10065,7 +10078,7 @@ c_start_case (location_t switch_loc,
location_t switch_cond_loc,
tree exp, bool explicit_cast_p)
{
- tree orig_type = error_mark_node;
+ ttype *orig_type = error_type_node;
bool bool_cond_p = false;
struct c_switch *cs;
@@ -10075,16 +10088,16 @@ c_start_case (location_t switch_loc,
if (!INTEGRAL_TYPE_P (orig_type))
{
- if (orig_type != error_mark_node)
+ if (orig_type != error_type_node)
{
error_at (switch_cond_loc, "switch quantity not an integer");
- orig_type = error_mark_node;
+ orig_type = error_type_node;
}
exp = integer_zero_node;
}
else
{
- tree type = TYPE_MAIN_VARIANT (orig_type);
+ ttype *type = TYPE_MAIN_VARIANT (orig_type);
tree e = exp;
/* Warn if the condition has boolean value. */
@@ -10179,7 +10192,7 @@ do_case (location_t loc, tree low_value, tree high_value)
controlling expression of the switch, or NULL_TREE. */
void
-c_finish_case (tree body, tree type)
+c_finish_case (tree body, ttype *type)
{
struct c_switch *cs = c_switch_stack;
location_t switch_location;
@@ -10439,7 +10452,7 @@ c_process_expr_stmt (location_t loc, tree expr)
if (warn_sequence_point)
verify_sequence_points (expr);
- if (TREE_TYPE (expr) != error_mark_node
+ if (TREE_TYPE (expr) != error_type_node
&& !COMPLETE_OR_VOID_TYPE_P (TREE_TYPE (expr))
&& TREE_CODE (TREE_TYPE (expr)) != ARRAY_TYPE)
error_at (loc, "expression statement has incomplete type");
@@ -10514,8 +10527,9 @@ c_begin_stmt_expr (void)
tree
c_finish_stmt_expr (location_t loc, tree body)
{
- tree last, type, tmp, val;
+ tree last, tmp, val;
tree *last_p;
+ ttype *type;
body = c_end_compound_stmt (loc, body, true);
@@ -10685,12 +10699,12 @@ push_cleanup (tree decl, tree cleanup, bool eh_only)
into a value of TYPE type. Comparison is done via VEC_COND_EXPR. */
static tree
-build_vec_cmp (tree_code code, tree type,
+build_vec_cmp (tree_code code, ttype *type,
tree arg0, tree arg1)
{
tree zero_vec = build_zero_cst (type);
tree minus_one_vec = build_minus_one_cst (type);
- tree cmp_type = build_same_sized_truth_vector_type (type);
+ ttype *cmp_type = build_same_sized_truth_vector_type (type);
tree cmp = build2 (code, cmp_type, arg0, arg1);
return build3 (VEC_COND_EXPR, type, cmp, minus_one_vec, zero_vec);
}
@@ -10715,8 +10729,8 @@ tree
build_binary_op (location_t location, enum tree_code code,
tree orig_op0, tree orig_op1, int convert_p)
{
- tree type0, type1, orig_type0, orig_type1;
- tree eptype;
+ ttype *type0, *type1, *orig_type0, *orig_type1;
+ ttype *eptype;
enum tree_code code0, code1;
tree op0, op1;
tree ret = error_mark_node;
@@ -10731,11 +10745,11 @@ build_binary_op (location_t location, enum tree_code code,
/* Data type in which the computation is to be performed.
In the simplest cases this is the common type of the arguments. */
- tree result_type = NULL;
+ ttype *result_type = NULL;
/* When the computation is in excess precision, the type of the
final EXCESS_PRECISION_EXPR. */
- tree semantic_result_type = NULL;
+ ttype *semantic_result_type = NULL;
/* Nonzero means operands have already been type-converted
in whatever way is necessary.
@@ -10744,11 +10758,11 @@ build_binary_op (location_t location, enum tree_code code,
/* Nonzero means create the expression with this type, rather than
RESULT_TYPE. */
- tree build_type = 0;
+ ttype *build_type = NULL;
/* Nonzero means after finally constructing the expression
convert it to this type. */
- tree final_type = 0;
+ ttype *final_type = 0;
/* Nonzero if this is an operation like MIN or MAX which can
safely be computed in short if both args are promoted shorts.
@@ -11254,7 +11268,7 @@ build_binary_op (location_t location, enum tree_code code,
case NE_EXPR:
if (code0 == VECTOR_TYPE && code1 == VECTOR_TYPE)
{
- tree intt;
+ ttype *intt;
if (!vector_types_compatible_elements_p (type0, type1))
{
error_at (location, "comparing vectors with different "
@@ -11348,8 +11362,8 @@ build_binary_op (location_t location, enum tree_code code,
}
else if (code0 == POINTER_TYPE && code1 == POINTER_TYPE)
{
- tree tt0 = TREE_TYPE (type0);
- tree tt1 = TREE_TYPE (type1);
+ ttype *tt0 = TREE_TYPE (type0);
+ ttype *tt1 = TREE_TYPE (type1);
addr_space_t as0 = TYPE_ADDR_SPACE (tt0);
addr_space_t as1 = TYPE_ADDR_SPACE (tt1);
addr_space_t as_common = ADDR_SPACE_GENERIC;
@@ -11413,7 +11427,7 @@ build_binary_op (location_t location, enum tree_code code,
case GT_EXPR:
if (code0 == VECTOR_TYPE && code1 == VECTOR_TYPE)
{
- tree intt;
+ ttype *intt;
if (!vector_types_compatible_elements_p (type0, type1))
{
error_at (location, "comparing vectors with different "
@@ -11567,7 +11581,7 @@ build_binary_op (location_t location, enum tree_code code,
"to match other operand of binary "
"expression",
location);
- if (result_type == error_mark_node)
+ if (result_type == error_type_node)
return error_mark_node;
}
@@ -11583,7 +11597,7 @@ build_binary_op (location_t location, enum tree_code code,
handled specially, but the language-independent code can
more easily optimize the plain complex arithmetic if
-fno-signed-zeros. */
- tree real_type = TREE_TYPE (result_type);
+ ttype *real_type = TREE_TYPE (result_type);
tree real, imag;
if (type0 != orig_type0 || type1 != orig_type1)
{
@@ -11714,7 +11728,8 @@ build_binary_op (location_t location, enum tree_code code,
from being kept in a register.
Instead, make copies of the our local variables and
pass the copies by reference, then copy them back afterward. */
- tree xop0 = op0, xop1 = op1, xresult_type = result_type;
+ tree xop0 = op0, xop1 = op1;
+ ttype *xresult_type = result_type;
enum tree_code xresultcode = resultcode;
tree val
= shorten_compare (location, &xop0, &xop1, &xresult_type,
@@ -12098,7 +12113,7 @@ c_finish_omp_cancel (location_t loc, tree clauses)
tree ifc = omp_find_clause (clauses, OMP_CLAUSE_IF);
if (ifc != NULL_TREE)
{
- tree type = TREE_TYPE (OMP_CLAUSE_IF_EXPR (ifc));
+ ttype *type = TREE_TYPE (OMP_CLAUSE_IF_EXPR (ifc));
ifc = fold_build2_loc (OMP_CLAUSE_LOCATION (ifc), NE_EXPR,
boolean_type_node, OMP_CLAUSE_IF_EXPR (ifc),
build_zero_cst (type));
@@ -12160,11 +12175,12 @@ c_finish_omp_cancellation_point (location_t loc, tree clauses)
case though, as some lengths could be zero. */
static tree
-handle_omp_array_sections_1 (tree c, tree t, vec<tree> &types,
+handle_omp_array_sections_1 (tree c, tree t, vec<ttype *> &types,
bool &maybe_zero_len, unsigned int &first_non_one,
enum c_omp_region_type ort)
{
- tree ret, low_bound, length, type;
+ tree ret, low_bound, length;
+ ttype *type;
if (TREE_CODE (t) != TREE_LIST)
{
if (error_operand_p (t))
@@ -12310,7 +12326,7 @@ handle_omp_array_sections_1 (tree c, tree t, vec<tree> &types,
if (TREE_CODE (type) == ARRAY_TYPE)
{
if (length == NULL_TREE
- && (TYPE_DOMAIN (type) == NULL_TREE
+ && (TYPE_DOMAIN (type) == NULL
|| TYPE_MAX_VALUE (TYPE_DOMAIN (type)) == NULL_TREE))
{
error_at (OMP_CLAUSE_LOCATION (c),
@@ -12482,7 +12498,7 @@ handle_omp_array_sections (tree c, enum c_omp_region_type ort)
{
bool maybe_zero_len = false;
unsigned int first_non_one = 0;
- auto_vec<tree, 10> types;
+ auto_vec<ttype *, 10> types;
tree first = handle_omp_array_sections_1 (c, OMP_CLAUSE_DECL (c), types,
maybe_zero_len, first_non_one,
ort);
@@ -12608,7 +12624,7 @@ handle_omp_array_sections (tree c, enum c_omp_region_type ort)
else if (size == NULL_TREE)
{
size = size_in_bytes (TREE_TYPE (types[i]));
- tree eltype = TREE_TYPE (types[num - 1]);
+ ttype *eltype = TREE_TYPE (types[num - 1]);
while (TREE_CODE (eltype) == ARRAY_TYPE)
eltype = TREE_TYPE (eltype);
if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_REDUCTION)
@@ -12639,12 +12655,12 @@ handle_omp_array_sections (tree c, enum c_omp_region_type ort)
{
size = size_binop (MINUS_EXPR, size, size_one_node);
size = c_fully_fold (size, false, NULL);
- tree index_type = build_index_type (size);
- tree eltype = TREE_TYPE (first);
+ ttype *index_type = build_index_type (size);
+ ttype *eltype = TREE_TYPE (first);
while (TREE_CODE (eltype) == ARRAY_TYPE)
eltype = TREE_TYPE (eltype);
- tree type = build_array_type (eltype, index_type);
- tree ptype = build_pointer_type (eltype);
+ ttype *type = build_array_type (eltype, index_type);
+ ttype *ptype = build_pointer_type (eltype);
if (TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE)
t = build_fold_addr_expr (t);
tree t2 = build_fold_addr_expr (first);
@@ -12776,7 +12792,8 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
{
bitmap_head generic_head, firstprivate_head, lastprivate_head;
bitmap_head aligned_head, map_head, map_field_head, oacc_reduction_head;
- tree c, t, type, *pc;
+ tree c, t, *pc;
+ ttype *type;
tree simdlen = NULL_TREE, safelen = NULL_TREE;
bool branch_seen = false;
bool copyprivate_seen = false;
@@ -12846,7 +12863,7 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
type = TREE_TYPE (type);
if (TREE_CODE (type) == ARRAY_TYPE)
{
- tree oatype = type;
+ ttype *oatype = type;
gcc_assert (TREE_CODE (t) != MEM_REF);
while (TREE_CODE (type) == ARRAY_TYPE)
type = TREE_TYPE (type);
@@ -12869,9 +12886,9 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
break;
}
size = size_binop (MINUS_EXPR, size, size_one_node);
- tree index_type = build_index_type (size);
- tree atype = build_array_type (type, index_type);
- tree ptype = build_pointer_type (type);
+ ttype *index_type = build_index_type (size);
+ ttype *atype = build_array_type (type, index_type);
+ ttype *ptype = build_pointer_type (type);
if (TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE)
t = build_fold_addr_expr (t);
t = build2 (MEM_REF, atype, t, build_int_cst (ptype, 0));
@@ -13879,19 +13896,19 @@ c_finish_transaction (location_t loc, tree block, int flags)
preserve information about the typedef name from which an array
type was derived). */
-tree
-c_build_qualified_type (tree type, int type_quals, tree orig_qual_type,
+ttype *
+c_build_qualified_type (ttype_p type, int type_quals, ttype_p orig_qual_type,
size_t orig_qual_indirect)
{
- if (type == error_mark_node)
+ if (type == error_type_node)
return type;
if (TREE_CODE (type) == ARRAY_TYPE)
{
- tree t;
- tree element_type = c_build_qualified_type (TREE_TYPE (type),
- type_quals, orig_qual_type,
- orig_qual_indirect - 1);
+ ttype *t;
+ ttype *element_type = c_build_qualified_type (TREE_TYPE (type),
+ type_quals, orig_qual_type,
+ orig_qual_indirect - 1);
/* See if we already have an identically qualified type. */
if (orig_qual_type && orig_qual_indirect == 0)
@@ -13908,7 +13925,7 @@ c_build_qualified_type (tree type, int type_quals, tree orig_qual_type,
}
if (!t)
{
- tree domain = TYPE_DOMAIN (type);
+ ttype *domain = TYPE_DOMAIN (type);
t = build_variant_type_copy (type);
TREE_TYPE (t) = element_type;
@@ -13919,10 +13936,10 @@ c_build_qualified_type (tree type, int type_quals, tree orig_qual_type,
else if (TYPE_CANONICAL (element_type) != element_type
|| (domain && TYPE_CANONICAL (domain) != domain))
{
- tree unqualified_canon
+ ttype *unqualified_canon
= build_array_type (TYPE_CANONICAL (element_type),
domain? TYPE_CANONICAL (domain)
- : NULL_TREE);
+ : NULL);
if (TYPE_REVERSE_STORAGE_ORDER (type))
{
unqualified_canon
@@ -13949,8 +13966,8 @@ c_build_qualified_type (tree type, int type_quals, tree orig_qual_type,
type_quals &= ~TYPE_QUAL_RESTRICT;
}
- tree var_type = (orig_qual_type && orig_qual_indirect == 0
- ? orig_qual_type
+ ttype *var_type = (orig_qual_type && orig_qual_indirect == 0
+ ? TTYPE (orig_qual_type)
: build_qualified_type (type, type_quals));
/* A variant type does not inherit the list of incomplete vars from the
type main variant. */
@@ -13963,7 +13980,7 @@ c_build_qualified_type (tree type, int type_quals, tree orig_qual_type,
/* Build a VA_ARG_EXPR for the C parser. */
tree
-c_build_va_arg (location_t loc1, tree expr, location_t loc2, tree type)
+c_build_va_arg (location_t loc1, tree expr, location_t loc2, ttype_p type)
{
if (error_operand_p (type))
return error_mark_node;
@@ -14180,7 +14197,7 @@ c_tree_equal (tree t1, tree t2)
}
case tcc_type:
- return comptypes (t1, t2);
+ return comptypes (TTYPE (t1), TTYPE (t2));
default:
gcc_unreachable ();
}
diff --git a/gcc/c/gimple-parser.c b/gcc/c/gimple-parser.c
index e167e420150..70bf893880b 100644
--- a/gcc/c/gimple-parser.c
+++ b/gcc/c/gimple-parser.c
@@ -977,7 +977,7 @@ c_parser_gimple_postfix_expression_after_primary (c_parser *parser,
if (TREE_CODE (field) != FIELD_DECL)
expr.original_type = NULL;
else
- expr.original_type = DECL_BIT_FIELD_TYPE (field);
+ expr.original_type = TTYPE (DECL_BIT_FIELD_TYPE (field));
}
break;
}
@@ -1017,7 +1017,7 @@ c_parser_gimple_postfix_expression_after_primary (c_parser *parser,
if (TREE_CODE (field) != FIELD_DECL)
expr.original_type = NULL;
else
- expr.original_type = DECL_BIT_FIELD_TYPE (field);
+ expr.original_type = TTYPE (DECL_BIT_FIELD_TYPE (field));
}
break;
}
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 6e715cd6bc0..23e215c8c2b 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -6790,8 +6790,8 @@ extern tree cp_build_compound_expr (tree, tree, tsubst_flags_t);
extern tree build_static_cast (tree, tree, tsubst_flags_t);
extern tree build_reinterpret_cast (tree, tree, tsubst_flags_t);
extern tree build_const_cast (tree, tree, tsubst_flags_t);
-extern tree build_c_cast (location_t, tree, tree);
-extern cp_expr build_c_cast (location_t loc, tree type,
+extern tree build_c_cast (location_t, ttype_p, tree);
+extern cp_expr build_c_cast (location_t loc, ttype_p type,
cp_expr expr);
extern tree cp_build_c_cast (tree, tree, tsubst_flags_t);
extern cp_expr build_x_modify_expr (location_t, tree,
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index ad3f4307f5d..ec0f2d3a751 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -4915,7 +4915,7 @@ groktypename (cp_decl_specifier_seq *type_specifiers,
else
cplus_decl_attributes (&type, attrs, 0);
}
- return type;
+ return TTYPE (type);
}
/* Process a DECLARATOR for a function-scope variable declaration,
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index db1e118320f..efb89ed53c7 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -1087,11 +1087,12 @@ move (tree expr)
/* Used by the C++ front end to build qualified array types. However,
the C version of this function does not properly maintain canonical
types (which are not used in C). */
-tree
-c_build_qualified_type (tree type, int type_quals, tree /* orig_qual_type */,
+ttype *
+c_build_qualified_type (ttype_p type, int type_quals,
+ ttype_p /* orig_qual_type */,
size_t /* orig_qual_indirect */)
{
- return cp_build_qualified_type (type, type_quals);
+ return TTYPE (cp_build_qualified_type (type, type_quals));
}
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 032178c5caa..e884f782589 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -936,16 +936,16 @@ strip_array_domain (tree type)
been applied, and enumerated types converted to their compatible
integer types. */
-tree
-common_type (tree t1, tree t2)
+ttype *
+common_type (ttype_p t1, ttype_p t2)
{
/* If one type is nonsense, use the other */
- if (t1 == error_mark_node)
+ if (t1 == error_type_node)
return t2;
- if (t2 == error_mark_node)
+ if (t2 == error_type_node)
return t1;
- return cp_common_type (t1, t2);
+ return TTYPE (cp_common_type (t1, t2));
}
/* Return the common type of two pointer types T1 and T2. This is the
@@ -4100,7 +4100,7 @@ cp_build_binary_op (location_t location,
/* Data type in which the computation is to be performed.
In the simplest cases this is the common type of the arguments. */
- tree result_type = NULL;
+ ttype_p result_type = NULL_TYPE;
/* Nonzero means operands have already been type-converted
in whatever way is necessary.
@@ -4109,7 +4109,7 @@ cp_build_binary_op (location_t location,
/* Nonzero means create the expression with this type, rather than
RESULT_TYPE. */
- tree build_type = 0;
+ ttype_p build_type = NULL_TYPE;
/* Nonzero means after finally constructing the expression
convert it to this type. */
@@ -7408,7 +7408,7 @@ build_const_cast (tree type, tree expr, tsubst_flags_t complain)
/* Like cp_build_c_cast, but for the c-common bits. */
tree
-build_c_cast (location_t /*loc*/, tree type, tree expr)
+build_c_cast (location_t /*loc*/, ttype_p type, tree expr)
{
return cp_build_c_cast (type, expr, tf_warning_or_error);
}
@@ -7418,7 +7418,7 @@ build_c_cast (location_t /*loc*/, tree type, tree expr)
support it. */
cp_expr
-build_c_cast (location_t loc, tree type, cp_expr expr)
+build_c_cast (location_t loc, ttype_p type, cp_expr expr)
{
cp_expr result = cp_build_c_cast (type, expr, tf_warning_or_error);
result.set_location (loc);
@@ -7551,10 +7551,10 @@ cp_build_c_cast (tree type, tree expr, tsubst_flags_t complain)
/* For use from the C common bits. */
tree
build_modify_expr (location_t location,
- tree lhs, tree /*lhs_origtype*/,
+ tree lhs, ttype_p /*lhs_origtype*/,
enum tree_code modifycode,
location_t /*rhs_location*/, tree rhs,
- tree /*rhs_origtype*/)
+ ttype_p /*rhs_origtype*/)
{
return cp_build_modify_expr (location, lhs, modifycode, rhs,
tf_warning_or_error);
diff --git a/gcc/fortran/f95-lang.c b/gcc/fortran/f95-lang.c
index 16a757224b3..decfdd9def9 100644
--- a/gcc/fortran/f95-lang.c
+++ b/gcc/fortran/f95-lang.c
@@ -589,11 +589,11 @@ build_builtin_fntypes (tree *fntype, tree type)
}
-static tree
+static ttype *
builtin_type_for_size (int size, bool unsignedp)
{
tree type = gfc_type_for_size (size, unsignedp);
- return type ? type : error_mark_node;
+ return TTYPE (type ? type : error_mark_node);
}
/* Initialization of builtin function nodes. */
diff --git a/gcc/lto/lto-lang.c b/gcc/lto/lto-lang.c
index ff4aec53162..cc49bfbbde6 100644
--- a/gcc/lto/lto-lang.c
+++ b/gcc/lto/lto-lang.c
@@ -568,11 +568,11 @@ def_fn_type (builtin_type def, builtin_type ret, bool var, int n, ...)
The later results in segfaults even when a decl using the type doesn't
get invoked. */
-static tree
+static ttype *
builtin_type_for_size (int size, bool unsignedp)
{
tree type = lang_hooks.types.type_for_size (size, unsignedp);
- return type ? type : error_mark_node;
+ return TTYPE (type ? type : error_mark_node);
}
/* Support for DEF_BUILTIN. */
diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c
index 5f70961e7d7..151fbab23b6 100644
--- a/gcc/objc/objc-act.c
+++ b/gcc/objc/objc-act.c
@@ -2339,10 +2339,11 @@ objc_compare_protocols (tree lcls, tree ltyp, tree rcls, tree rtyp, bool warn)
Both TYPE1 and TYPE2 must be pointers, and already determined to be
compatible by objc_compare_types() below. */
-tree
-objc_common_type (tree type1, tree type2)
+ttype *
+objc_common_type (ttype_p type1, ttype_p type2)
{
- tree inner1 = TREE_TYPE (type1), inner2 = TREE_TYPE (type2);
+ ttype_p inner1 = TREE_TYPE (type1);
+ ttype_p inner2 = TREE_TYPE (type2);
while (POINTER_TYPE_P (inner1))
{
@@ -2358,10 +2359,10 @@ objc_common_type (tree type1, tree type2)
/* If both types are 'Class', return 'Class'. */
if (objc_is_class_id (inner1) && objc_is_class_id (inner2))
- return objc_class_type;
+ return TTYPE (objc_class_type);
/* Otherwise, return 'id'. */
- return objc_object_type;
+ return TTYPE (objc_object_type);
}
/* Determine if it is permissible to assign (if ARGNO is greater than -3)