From b55b02ead474ab1f68fa066a65a3896664d83412 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Sat, 27 Jun 2015 10:40:21 +0000 Subject: [PATCH] call.c: Use VECTOR_TYPE_P. * call.c: Use VECTOR_TYPE_P. * constexpr.c: Likewise. * cvt.c: Likewise. * decl.c: Likewise. * decl2.c: Likewise. * init.c: Likewise. * semantics.c: Likewise. * tree.c: Likewise. * typeck.c: Likewise. * typeck2.c: Likewise. From-SVN: r225099 --- gcc/cp/ChangeLog | 13 +++++++++++++ gcc/cp/call.c | 7 +++---- gcc/cp/constexpr.c | 8 ++++---- gcc/cp/cvt.c | 2 +- gcc/cp/decl.c | 8 ++++---- gcc/cp/decl2.c | 2 +- gcc/cp/init.c | 2 +- gcc/cp/semantics.c | 2 +- gcc/cp/tree.c | 3 +-- gcc/cp/typeck.c | 20 ++++++++++---------- gcc/cp/typeck2.c | 6 +++--- 11 files changed, 42 insertions(+), 31 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c93ef3a338e..4a3b2d8a071 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,16 @@ +2015-06-27 Marek Polacek + + * call.c: Use VECTOR_TYPE_P. + * constexpr.c: Likewise. + * cvt.c: Likewise. + * decl.c: Likewise. + * decl2.c: Likewise. + * init.c: Likewise. + * semantics.c: Likewise. + * tree.c: Likewise. + * typeck.c: Likewise. + * typeck2.c: Likewise. + 2015-06-27 Marek Polacek * call.c (set_up_extended_ref_temp): Use VAR_P. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index e5ed53b8959..b8469194f70 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -4559,8 +4559,8 @@ build_conditional_expr_1 (location_t loc, tree arg1, tree arg2, tree arg3, arg2_type = TREE_TYPE (arg2); arg3_type = TREE_TYPE (arg3); - if (TREE_CODE (arg2_type) != VECTOR_TYPE - && TREE_CODE (arg3_type) != VECTOR_TYPE) + if (!VECTOR_TYPE_P (arg2_type) + && !VECTOR_TYPE_P (arg3_type)) { /* Rely on the error messages of the scalar version. */ tree scal = build_conditional_expr_1 (loc, integer_one_node, @@ -4612,8 +4612,7 @@ build_conditional_expr_1 (location_t loc, tree arg1, tree arg2, tree arg3, arg3_type = vtype; } - if ((TREE_CODE (arg2_type) == VECTOR_TYPE) - != (TREE_CODE (arg3_type) == VECTOR_TYPE)) + if (VECTOR_TYPE_P (arg2_type) != VECTOR_TYPE_P (arg3_type)) { enum stv_conv convert_flag = scalar_to_vector (loc, VEC_COND_EXPR, arg2, arg3, diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c index 4fce5e0506e..a122ded0a26 100644 --- a/gcc/cp/constexpr.c +++ b/gcc/cp/constexpr.c @@ -61,7 +61,7 @@ bool literal_type_p (tree t) { if (SCALAR_TYPE_P (t) - || TREE_CODE (t) == VECTOR_TYPE + || VECTOR_TYPE_P (t) || TREE_CODE (t) == REFERENCE_TYPE || (VOID_TYPE_P (t) && cxx_dialect >= cxx14)) return true; @@ -2101,7 +2101,7 @@ cxx_eval_bare_aggregate (const constexpr_ctx *ctx, tree t, /* We're done building this CONSTRUCTOR, so now we can interpret an element without an explicit initializer as value-initialized. */ CONSTRUCTOR_NO_IMPLICIT_ZERO (t) = false; - if (TREE_CODE (TREE_TYPE (t)) == VECTOR_TYPE) + if (VECTOR_TYPE_P (TREE_TYPE (t))) t = fold (t); return t; } @@ -2289,7 +2289,7 @@ cxx_fold_indirect_ref (location_t loc, tree type, tree op0, bool *empty_base) (type, TREE_TYPE (optype)))) return fold_build1_loc (loc, REALPART_EXPR, type, op); /* *(foo *)&vectorfoo => BIT_FIELD_REF */ - else if (TREE_CODE (optype) == VECTOR_TYPE + else if (VECTOR_TYPE_P (optype) && (same_type_ignoring_top_level_qualifiers_p (type, TREE_TYPE (optype)))) { @@ -2335,7 +2335,7 @@ cxx_fold_indirect_ref (location_t loc, tree type, tree op0, bool *empty_base) op00type = TREE_TYPE (op00); /* ((foo*)&vectorfoo)[1] => BIT_FIELD_REF */ - if (TREE_CODE (op00type) == VECTOR_TYPE + if (VECTOR_TYPE_P (op00type) && (same_type_ignoring_top_level_qualifiers_p (type, TREE_TYPE (op00type)))) { diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c index d29c64b4c4e..a2776781d98 100644 --- a/gcc/cp/cvt.c +++ b/gcc/cp/cvt.c @@ -708,7 +708,7 @@ ocp_convert (tree type, tree expr, int convtype, int flags, conversion. */ else if (TREE_CODE (type) == COMPLEX_TYPE) return fold_if_not_in_template (convert_to_complex (type, e)); - else if (TREE_CODE (type) == VECTOR_TYPE) + else if (VECTOR_TYPE_P (type)) return fold_if_not_in_template (convert_to_vector (type, e)); else if (TREE_CODE (e) == TARGET_EXPR) { diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 959422341b2..0683f26b7a0 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -5392,7 +5392,7 @@ reshape_init_vector (tree type, reshape_iter *d, tsubst_flags_t complain) { tree max_index = NULL_TREE; - gcc_assert (TREE_CODE (type) == VECTOR_TYPE); + gcc_assert (VECTOR_TYPE_P (type)); if (COMPOUND_LITERAL_P (d->cur->value)) { @@ -5409,7 +5409,7 @@ reshape_init_vector (tree type, reshape_iter *d, tsubst_flags_t complain) } /* For a vector, we initialize it as an array of the appropriate size. */ - if (TREE_CODE (type) == VECTOR_TYPE) + if (VECTOR_TYPE_P (type)) max_index = size_int (TYPE_VECTOR_SUBPARTS (type) - 1); return reshape_init_array_1 (TREE_TYPE (type), max_index, d, complain); @@ -5717,7 +5717,7 @@ reshape_init_r (tree type, reshape_iter *d, bool first_initializer_p, return reshape_init_class (type, d, first_initializer_p, complain); else if (TREE_CODE (type) == ARRAY_TYPE) return reshape_init_array (type, d, complain); - else if (TREE_CODE (type) == VECTOR_TYPE) + else if (VECTOR_TYPE_P (type)) return reshape_init_vector (type, d, complain); else gcc_unreachable(); @@ -5919,7 +5919,7 @@ check_initializer (tree decl, tree init, int flags, vec **cleanups) "not by %<{...}%>", decl); } - else if (TREE_CODE (type) == VECTOR_TYPE && TYPE_VECTOR_OPAQUE (type)) + else if (VECTOR_TYPE_P (type) && TYPE_VECTOR_OPAQUE (type)) { error ("opaque vector types cannot be initialized"); init = error_mark_node; diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index da531fa1292..a7a6efb25f2 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -395,7 +395,7 @@ grok_array_decl (location_t loc, tree array_expr, tree index_exp, It is a little-known fact that, if `a' is an array and `i' is an int, you can write `i[a]', which means the same thing as `a[i]'. */ - if (TREE_CODE (type) == ARRAY_TYPE || TREE_CODE (type) == VECTOR_TYPE) + if (TREE_CODE (type) == ARRAY_TYPE || VECTOR_TYPE_P (type)) p1 = array_expr; else p1 = build_expr_type_conversion (WANT_POINTER, array_expr, false); diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 530dad484c3..871ddb5e686 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -280,7 +280,7 @@ build_zero_init_1 (tree type, tree nelts, bool static_storage_p, /* Build a constructor to contain the initializations. */ init = build_constructor (type, v); } - else if (TREE_CODE (type) == VECTOR_TYPE) + else if (VECTOR_TYPE_P (type)) init = build_zero_cst (type); else gcc_assert (TREE_CODE (type) == REFERENCE_TYPE); diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 6a746483211..4b8ce3b35ce 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -7357,7 +7357,7 @@ finish_decltype_type (tree expr, bool id_expression_or_member_access_p, gcc_assert (TREE_CODE (type) != REFERENCE_TYPE); /* For vector types, pick a non-opaque variant. */ - if (TREE_CODE (type) == VECTOR_TYPE) + if (VECTOR_TYPE_P (type)) type = strip_typedefs (type); if (clk != clk_none && !(clk & clk_class)) diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 272fb2c99b2..f1f5e533c7a 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -3239,8 +3239,7 @@ scalarish_type_p (const_tree t) if (t == error_mark_node) return 1; - return (SCALAR_TYPE_P (t) - || TREE_CODE (t) == VECTOR_TYPE); + return (SCALAR_TYPE_P (t) || VECTOR_TYPE_P (t)); } /* Returns true iff T requires non-trivial default initialization. */ diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 5b3fdfbf76b..2d03d758448 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -293,10 +293,10 @@ cp_common_type (tree t1, tree t2) /* FIXME: Attributes. */ gcc_assert (ARITHMETIC_TYPE_P (t1) - || TREE_CODE (t1) == VECTOR_TYPE + || VECTOR_TYPE_P (t1) || UNSCOPED_ENUM_P (t1)); gcc_assert (ARITHMETIC_TYPE_P (t2) - || TREE_CODE (t2) == VECTOR_TYPE + || VECTOR_TYPE_P (t2) || UNSCOPED_ENUM_P (t2)); /* If one type is complex, form the common type of the non-complex @@ -441,10 +441,10 @@ tree type_after_usual_arithmetic_conversions (tree t1, tree t2) { gcc_assert (ARITHMETIC_TYPE_P (t1) - || TREE_CODE (t1) == VECTOR_TYPE + || VECTOR_TYPE_P (t1) || UNSCOPED_ENUM_P (t1)); gcc_assert (ARITHMETIC_TYPE_P (t2) - || TREE_CODE (t2) == VECTOR_TYPE + || VECTOR_TYPE_P (t2) || UNSCOPED_ENUM_P (t2)); /* Perform the integral promotions. We do not promote real types here. */ @@ -6979,9 +6979,9 @@ build_reinterpret_cast_1 (tree type, tree expr, bool c_cast_p, "is conditionally-supported"); return fold_if_not_in_template (build_nop (type, expr)); } - else if (TREE_CODE (type) == VECTOR_TYPE) + else if (VECTOR_TYPE_P (type)) return fold_if_not_in_template (convert_to_vector (type, expr)); - else if (TREE_CODE (intype) == VECTOR_TYPE + else if (VECTOR_TYPE_P (intype) && INTEGRAL_OR_ENUMERATION_TYPE_P (type)) return fold_if_not_in_template (convert_to_integer (type, expr)); else @@ -8115,7 +8115,7 @@ convert_for_assignment (tree type, tree rhs, rhstype = TREE_TYPE (rhs); coder = TREE_CODE (rhstype); - if (TREE_CODE (type) == VECTOR_TYPE && coder == VECTOR_TYPE + if (VECTOR_TYPE_P (type) && coder == VECTOR_TYPE && vector_types_convertible_p (type, rhstype, true)) { rhs = mark_rvalue_use (rhs); @@ -8819,7 +8819,7 @@ comp_ptr_ttypes_real (tree to, tree from, int constp) constp &= TYPE_READONLY (to); } - if (TREE_CODE (to) == VECTOR_TYPE) + if (VECTOR_TYPE_P (to)) is_opaque_pointer = vector_targets_convertible_p (to, from); if (!TYPE_PTR_P (to) && !TYPE_PTRDATAMEM_P (to)) @@ -8900,7 +8900,7 @@ ptr_reasonably_similar (const_tree to, const_tree from) COMPARE_BASE | COMPARE_DERIVED)) continue; - if (TREE_CODE (to) == VECTOR_TYPE + if (VECTOR_TYPE_P (to) && vector_types_convertible_p (to, from, false)) return true; @@ -8942,7 +8942,7 @@ comp_ptr_ttypes_const (tree to, tree from) TYPE_OFFSET_BASETYPE (to))) continue; - if (TREE_CODE (to) == VECTOR_TYPE) + if (VECTOR_TYPE_P (to)) is_opaque_pointer = vector_targets_convertible_p (to, from); if (!TYPE_PTR_P (to)) diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index c670879108b..ea0ae64b4e8 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -1083,7 +1083,7 @@ digest_init_r (tree type, tree init, bool nested, int flags, /* Come here only for aggregates: records, arrays, unions, complex numbers and vectors. */ gcc_assert (TREE_CODE (type) == ARRAY_TYPE - || TREE_CODE (type) == VECTOR_TYPE + || VECTOR_TYPE_P (type) || TREE_CODE (type) == RECORD_TYPE || TREE_CODE (type) == UNION_TYPE || TREE_CODE (type) == COMPLEX_TYPE); @@ -1236,7 +1236,7 @@ process_init_constructor_array (tree type, tree init, vec *v = CONSTRUCTOR_ELTS (init); gcc_assert (TREE_CODE (type) == ARRAY_TYPE - || TREE_CODE (type) == VECTOR_TYPE); + || VECTOR_TYPE_P (type)); if (TREE_CODE (type) == ARRAY_TYPE) { @@ -1572,7 +1572,7 @@ process_init_constructor (tree type, tree init, tsubst_flags_t complain) gcc_assert (BRACE_ENCLOSED_INITIALIZER_P (init)); - if (TREE_CODE (type) == ARRAY_TYPE || TREE_CODE (type) == VECTOR_TYPE) + if (TREE_CODE (type) == ARRAY_TYPE || VECTOR_TYPE_P (type)) flags = process_init_constructor_array (type, init, complain); else if (TREE_CODE (type) == RECORD_TYPE) flags = process_init_constructor_record (type, init, complain); -- 2.30.2