From: Bernhard Reutner-Fischer <al...@gcc.gnu.org>

gcc/fortran/ChangeLog:

        * trans-array.cc (is_pointer_array): Use _P() defines from tree.h.
        (gfc_conv_scalarized_array_ref): Ditto.
        (gfc_conv_array_ref): Ditto.
        * trans-decl.cc (gfc_finish_decl): Ditto.
        (gfc_get_symbol_decl): Ditto.
        * trans-expr.cc (gfc_trans_pointer_assignment): Ditto.
        (gfc_trans_arrayfunc_assign): Ditto.
        (gfc_trans_assignment_1): Ditto.
        * trans-intrinsic.cc (gfc_conv_intrinsic_minmax): Ditto.
        (conv_intrinsic_ieee_value): Ditto.
        * trans-io.cc (gfc_convert_array_to_string): Ditto.
        * trans-openmp.cc (gfc_omp_is_optional_argument): Ditto.
        (gfc_trans_omp_clauses): Ditto.
        * trans-stmt.cc (gfc_conv_label_variable): Ditto.
        * trans.cc (gfc_build_addr_expr): Ditto.
        (get_array_span): Ditto.
---
 gcc/fortran/trans-array.cc     | 10 +++++-----
 gcc/fortran/trans-decl.cc      |  4 ++--
 gcc/fortran/trans-expr.cc      |  6 +++---
 gcc/fortran/trans-intrinsic.cc |  4 ++--
 gcc/fortran/trans-io.cc        |  2 +-
 gcc/fortran/trans-openmp.cc    |  7 +++----
 gcc/fortran/trans-stmt.cc      |  2 +-
 gcc/fortran/trans.cc           |  4 ++--
 8 files changed, 19 insertions(+), 20 deletions(-)

diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc
index 9f8aa09673a..15719845ca8 100644
--- a/gcc/fortran/trans-array.cc
+++ b/gcc/fortran/trans-array.cc
@@ -880,7 +880,7 @@ is_pointer_array (tree expr)
       || GFC_CLASS_TYPE_P (TREE_TYPE (expr)))
     return false;
 
-  if (TREE_CODE (expr) == VAR_DECL
+  if (VAR_P (expr)
       && GFC_DECL_PTR_ARRAY_P (expr))
     return true;
 
@@ -888,7 +888,7 @@ is_pointer_array (tree expr)
       && GFC_DECL_PTR_ARRAY_P (expr))
     return true;
 
-  if (TREE_CODE (expr) == INDIRECT_REF
+  if (INDIRECT_REF_P (expr)
       && GFC_DECL_PTR_ARRAY_P (TREE_OPERAND (expr, 0)))
     return true;
 
@@ -3803,7 +3803,7 @@ gfc_conv_scalarized_array_ref (gfc_se * se, gfc_array_ref 
* ar,
     {
       if (TREE_CODE (info->descriptor) == COMPONENT_REF)
        decl = info->descriptor;
-      else if (TREE_CODE (info->descriptor) == INDIRECT_REF)
+      else if (INDIRECT_REF_P (info->descriptor))
        decl = TREE_OPERAND (info->descriptor, 0);
 
       if (decl == NULL_TREE)
@@ -4057,7 +4057,7 @@ gfc_conv_array_ref (gfc_se * se, gfc_array_ref * ar, 
gfc_expr *expr,
     {
       if (TREE_CODE (se->expr) == COMPONENT_REF)
        decl = se->expr;
-      else if (TREE_CODE (se->expr) == INDIRECT_REF)
+      else if (INDIRECT_REF_P (se->expr))
        decl = TREE_OPERAND (se->expr, 0);
       else
        decl = se->expr;
@@ -4069,7 +4069,7 @@ gfc_conv_array_ref (gfc_se * se, gfc_array_ref * ar, 
gfc_expr *expr,
       if (GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (se->expr)))
        {
          decl = se->expr;
-         if (TREE_CODE (decl) == INDIRECT_REF)
+         if (INDIRECT_REF_P (decl))
            decl = TREE_OPERAND (decl, 0);
        }
       else
diff --git a/gcc/fortran/trans-decl.cc b/gcc/fortran/trans-decl.cc
index cd32542eb86..7f21dc2b09f 100644
--- a/gcc/fortran/trans-decl.cc
+++ b/gcc/fortran/trans-decl.cc
@@ -558,7 +558,7 @@ gfc_finish_decl (tree decl)
     return;
 
   if (DECL_SIZE (decl) == NULL_TREE
-      && TYPE_SIZE (TREE_TYPE (decl)) != NULL_TREE)
+      && COMPLETE_TYPE_P (TREE_TYPE (decl)))
     layout_decl (decl, 0);
 
   /* A few consistency checks.  */
@@ -1889,7 +1889,7 @@ gfc_get_symbol_decl (gfc_symbol * sym)
       length = fold_convert (gfc_charlen_type_node, length);
       gfc_finish_var_decl (length, sym);
       if (!sym->attr.associate_var
-         && TREE_CODE (length) == VAR_DECL
+         && VAR_P (length)
          && sym->value && sym->value->expr_type != EXPR_NULL
          && sym->value->ts.u.cl->length)
        {
diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc
index d902e8f3281..292aba76aaa 100644
--- a/gcc/fortran/trans-expr.cc
+++ b/gcc/fortran/trans-expr.cc
@@ -10246,7 +10246,7 @@ gfc_trans_pointer_assignment (gfc_expr * expr1, 
gfc_expr * expr2)
              gfc_conv_descriptor_data_set (&block, desc, data);
 
              /* Copy the span.  */
-             if (TREE_CODE (rse.expr) == VAR_DECL
+             if (VAR_P (rse.expr)
                  && GFC_DECL_PTR_ARRAY_P (rse.expr))
                span = gfc_conv_descriptor_span_get (rse.expr);
              else
@@ -10933,7 +10933,7 @@ gfc_trans_arrayfunc_assign (gfc_expr * expr1, gfc_expr 
* expr2)
     {
       tmp = sym->backend_decl;
       lhs = sym->backend_decl;
-      if (TREE_CODE (tmp) == INDIRECT_REF)
+      if (INDIRECT_REF_P (tmp))
        tmp = TREE_OPERAND (tmp, 0);
       sym->backend_decl = gfc_create_var (TREE_TYPE (tmp), "lhs");
       gfc_add_modify (&se.pre, sym->backend_decl, tmp);
@@ -11883,7 +11883,7 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr * 
expr2, bool init_flag,
   if (expr2->ts.type == BT_CHARACTER && !expr1->ts.deferred
       && !(VAR_P (rse.string_length)
           || TREE_CODE (rse.string_length) == PARM_DECL
-          || TREE_CODE (rse.string_length) == INDIRECT_REF))
+          || INDIRECT_REF_P (rse.string_length)))
     string_length = gfc_evaluate_now (rse.string_length, &rse.pre);
   else if (expr2->ts.type == BT_CHARACTER)
     {
diff --git a/gcc/fortran/trans-intrinsic.cc b/gcc/fortran/trans-intrinsic.cc
index e0c171d5f25..a0e1110c5e0 100644
--- a/gcc/fortran/trans-intrinsic.cc
+++ b/gcc/fortran/trans-intrinsic.cc
@@ -4112,7 +4112,7 @@ gfc_conv_intrinsic_minmax (gfc_se * se, gfc_expr * expr, 
enum tree_code op)
       /* Handle absent optional arguments by ignoring the comparison.  */
       if (argexpr->expr->expr_type == EXPR_VARIABLE
          && argexpr->expr->symtree->n.sym->attr.optional
-         && TREE_CODE (val) == INDIRECT_REF)
+         && INDIRECT_REF_P (val))
        {
          cond = fold_build2_loc (input_location,
                                NE_EXPR, logical_type_node,
@@ -10155,7 +10155,7 @@ conv_intrinsic_ieee_value (gfc_se *se, gfc_expr *expr)
   arg = gfc_evaluate_now (arg, &se->pre);
 
   type = gfc_typenode_for_spec (&expr->ts);
-  gcc_assert (TREE_CODE (type) == REAL_TYPE);
+  gcc_assert (SCALAR_FLOAT_TYPE_P (type));
   ret = gfc_create_var (type, NULL);
 
   gfc_init_block (&body);
diff --git a/gcc/fortran/trans-io.cc b/gcc/fortran/trans-io.cc
index 9b54d2f0d31..0c0e3332778 100644
--- a/gcc/fortran/trans-io.cc
+++ b/gcc/fortran/trans-io.cc
@@ -791,7 +791,7 @@ gfc_convert_array_to_string (gfc_se * se, gfc_expr * e)
        }
       else
        {
-         gcc_assert (TREE_CODE (se->expr) == INDIRECT_REF);
+         gcc_assert (INDIRECT_REF_P (se->expr));
          tree ptr = TREE_OPERAND (se->expr, 0);
 
          gcc_assert (TREE_CODE (ptr) == POINTER_PLUS_EXPR);
diff --git a/gcc/fortran/trans-openmp.cc b/gcc/fortran/trans-openmp.cc
index 96aecdd1cb3..16ffb74a0f7 100644
--- a/gcc/fortran/trans-openmp.cc
+++ b/gcc/fortran/trans-openmp.cc
@@ -73,7 +73,7 @@ static bool
 gfc_omp_is_optional_argument (const_tree decl)
 {
   /* Note: VAR_DECL can occur with BIND(C) and array descriptors.  */
-  return ((TREE_CODE (decl) == PARM_DECL || TREE_CODE (decl) == VAR_DECL)
+  return ((TREE_CODE (decl) == PARM_DECL || VAR_P (decl))
          && DECL_LANG_SPECIFIC (decl)
          && TREE_CODE (TREE_TYPE (decl)) == POINTER_TYPE
          && !VOID_TYPE_P (TREE_TYPE (TREE_TYPE (decl)))
@@ -3334,9 +3334,8 @@ gfc_trans_omp_clauses (stmtblock_t *block, 
gfc_omp_clauses *clauses,
                        }
                    }
                  else if (present
-                          && TREE_CODE (decl) == INDIRECT_REF
-                          && (TREE_CODE (TREE_OPERAND (decl, 0))
-                              == INDIRECT_REF))
+                          && INDIRECT_REF_P (decl)
+                          && INDIRECT_REF_P (TREE_OPERAND (decl, 0)))
                    {
                      /* A single indirectref is handled by the middle end.  */
                      gcc_assert (!POINTER_TYPE_P (TREE_TYPE (decl)));
diff --git a/gcc/fortran/trans-stmt.cc b/gcc/fortran/trans-stmt.cc
index 589f200162a..b5b82941b41 100644
--- a/gcc/fortran/trans-stmt.cc
+++ b/gcc/fortran/trans-stmt.cc
@@ -82,7 +82,7 @@ gfc_conv_label_variable (gfc_se * se, gfc_expr * expr)
   if (TREE_CODE (se->expr) == COMPONENT_REF)
     se->expr = TREE_OPERAND (se->expr, 1);
   /* Deals with dummy argument. Get the parameter declaration.  */
-  else if (TREE_CODE (se->expr) == INDIRECT_REF)
+  else if (INDIRECT_REF_P (se->expr))
     se->expr = TREE_OPERAND (se->expr, 0);
 }
 
diff --git a/gcc/fortran/trans.cc b/gcc/fortran/trans.cc
index f7745add045..0b32b6896cd 100644
--- a/gcc/fortran/trans.cc
+++ b/gcc/fortran/trans.cc
@@ -332,7 +332,7 @@ gfc_build_addr_expr (tree type, tree t)
   else
     natural_type = build_pointer_type (base_type);
 
-  if (TREE_CODE (t) == INDIRECT_REF)
+  if (INDIRECT_REF_P (t))
     {
       if (!type)
        type = natural_type;
@@ -365,7 +365,7 @@ get_array_span (tree type, tree decl)
   if (TREE_CODE (decl) == COMPONENT_REF
       && GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (decl)))
     return gfc_conv_descriptor_span_get (decl);
-  else if (TREE_CODE (decl) == INDIRECT_REF
+  else if (INDIRECT_REF_P (decl)
           && GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (decl)))
     return gfc_conv_descriptor_span_get (decl);
 
-- 
2.30.2

Reply via email to