From: Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
gcc/rust/ChangeLog:
* backend/rust-compile-expr.cc (CompileExpr::type_cast_expression): Use
_P() defines from tree.h
* backend/rust-tree.cc (build_cplus_array_type): Ditto.
* backend/rust-tree.h (ARITHMETIC_TYPE_P): Ditto.
(gnu_vector_type_p): Ditto.
* checks/lints/rust-lint-unused-var.cc (check_decl): Ditto.
* rust-gcc.cc (Gcc_backend::fill_in_array): Ditto.
(Gcc_backend::named_type): Ditto.
(Gcc_backend::convert_expression): Ditto.
(Gcc_backend::init_statement): Ditto.
---
gcc/rust/backend/rust-compile-expr.cc | 2 +-
gcc/rust/backend/rust-tree.cc | 2 +-
gcc/rust/backend/rust-tree.h | 4 ++--
gcc/rust/checks/lints/rust-lint-unused-var.cc | 2 +-
gcc/rust/rust-gcc.cc | 8 ++++----
5 files changed, 9 insertions(+), 9 deletions(-)
@@ -2267,7 +2267,7 @@ CompileExpr::type_cast_expression (tree type_to_cast_to, tree expr_tree,
// FIXME check for TREE_OVERFLOW?
return cast;
}
- else if (TREE_CODE (type_to_cast_to) == REAL_TYPE)
+ else if (SCALAR_FLOAT_TYPE_P (type_to_cast_to))
{
tree cast = convert_to_real (type_to_cast_to, expr_tree);
// FIXME
@@ -2404,7 +2404,7 @@ build_cplus_array_type (tree elt_type, tree index_type, int dependent)
}
/* Avoid spurious warnings with VLAs (c++/54583). */
- if (TYPE_SIZE (t) && EXPR_P (TYPE_SIZE (t)))
+ if (CAN_HAVE_LOCATION_P (TYPE_SIZE (t)))
suppress_warning (TYPE_SIZE (t), OPT_Wunused);
/* Push these needs up to the ARRAY_TYPE so that initialization takes
@@ -54,7 +54,7 @@
Keep these checks in ascending code order. */
#define ARITHMETIC_TYPE_P(TYPE) \
- (RS_INTEGRAL_TYPE_P (TYPE) || TREE_CODE (TYPE) == REAL_TYPE \
+ (RS_INTEGRAL_TYPE_P (TYPE) || SCALAR_FLOAT_TYPE_P (TYPE) \
|| TREE_CODE (TYPE) == COMPLEX_TYPE)
/* True iff TYPE is cv decltype(nullptr). */
@@ -3250,7 +3250,7 @@ identifier_p (tree t)
inline bool
gnu_vector_type_p (const_tree type)
{
- return TREE_CODE (type) == VECTOR_TYPE && !TYPE_INDIVISIBLE_P (type);
+ return VECTOR_TYPE_P (type) && !TYPE_INDIVISIBLE_P (type);
}
extern vec<tree, va_gc> *
@@ -25,7 +25,7 @@ namespace Analysis {
static void
check_decl (tree *t)
{
- rust_assert (TREE_CODE (*t) == VAR_DECL || TREE_CODE (*t) == PARM_DECL
+ rust_assert (VAR_P (*t) || TREE_CODE (*t) == PARM_DECL
|| TREE_CODE (*t) == CONST_DECL);
tree var_name = DECL_NAME (*t);
@@ -886,7 +886,7 @@ Gcc_backend::fill_in_array (tree fill, tree element_type, tree length_tree)
if (element_type == error_mark_node || length_tree == error_mark_node)
return error_mark_node;
- gcc_assert (TYPE_SIZE (element_type) != NULL_TREE);
+ gcc_assert (COMPLETE_TYPE_P (element_type));
length_tree = fold_convert (sizetype, length_tree);
@@ -923,7 +923,7 @@ Gcc_backend::named_type (const std::string &name, tree type, Location location)
// give it whatever Rust name we have at this point.
if (TYPE_NAME (type) == NULL_TREE
&& location.gcc_location () == BUILTINS_LOCATION
- && (TREE_CODE (type) == INTEGER_TYPE || TREE_CODE (type) == REAL_TYPE
+ && (TREE_CODE (type) == INTEGER_TYPE || SCALAR_FLOAT_TYPE_P (type)
|| TREE_CODE (type) == COMPLEX_TYPE
|| TREE_CODE (type) == BOOLEAN_TYPE))
{
@@ -1173,7 +1173,7 @@ Gcc_backend::convert_expression (tree type_tree, tree expr_tree,
}
else if (TREE_CODE (type_tree) == INTEGER_TYPE)
ret = convert_to_integer (type_tree, expr_tree);
- else if (TREE_CODE (type_tree) == REAL_TYPE)
+ else if (SCALAR_FLOAT_TYPE_P (type_tree))
ret = convert_to_real (type_tree, expr_tree);
else if (TREE_CODE (type_tree) == COMPLEX_TYPE)
ret = convert_to_complex (type_tree, expr_tree);
@@ -1935,7 +1935,7 @@ Gcc_backend::init_statement (tree, Bvariable *var, tree init_tree)
tree var_tree = var->get_decl ();
if (var_tree == error_mark_node || init_tree == error_mark_node)
return error_mark_node;
- gcc_assert (TREE_CODE (var_tree) == VAR_DECL);
+ gcc_assert (VAR_P (var_tree));
// To avoid problems with GNU ld, we don't make zero-sized
// externally visible variables. That might lead us to doing an