[12/14] go: use _P() defines from tree.h

Message ID 20230513232321.279733-13-rep.dot.nop@gmail.com
State Accepted
Headers
Series use _P() defines from tree.h |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Bernhard Reutner-Fischer May 13, 2023, 11:23 p.m. UTC
  From: Bernhard Reutner-Fischer <aldot@gcc.gnu.org>

gcc/go/ChangeLog:

	* go-gcc.cc (Gcc_backend::fill_in_array): Use _P() defines from tree.h.
	(Gcc_backend::named_type): Ditto.
	(Gcc_backend::convert_expression): Ditto.
	(operator_to_tree_code): Ditto.
	(Gcc_backend::init_statement): Ditto.

gcc/ChangeLog:

	* godump.cc (go_format_type): Ditto.
	(go_output_typedef): Ditto.
---
 gcc/go/go-gcc.cc | 10 +++++-----
 gcc/godump.cc    |  4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)
  

Patch

diff --git a/gcc/go/go-gcc.cc b/gcc/go/go-gcc.cc
index 41ae9f83731..ad001a9044a 100644
--- a/gcc/go/go-gcc.cc
+++ b/gcc/go/go-gcc.cc
@@ -1168,7 +1168,7 @@  Gcc_backend::fill_in_array(Btype* fill, Btype* element_type,
   if (element_type_tree == error_mark_node || length_tree == error_mark_node)
     return this->error_type();
 
-  gcc_assert(TYPE_SIZE(element_type_tree) != NULL_TREE);
+  gcc_assert (COMPLETE_TYPE_P (element_type_tree));
 
   length_tree = fold_convert(sizetype, length_tree);
 
@@ -1347,7 +1347,7 @@  Gcc_backend::named_type(const std::string& name, Btype* btype,
   if (TYPE_NAME(type) == NULL_TREE
       && location.gcc_location() == BUILTINS_LOCATION
       && (TREE_CODE(type) == INTEGER_TYPE
-	  || TREE_CODE(type) == REAL_TYPE
+	  || SCALAR_FLOAT_TYPE_P (type)
 	  || TREE_CODE(type) == COMPLEX_TYPE
 	  || TREE_CODE(type) == BOOLEAN_TYPE))
     {
@@ -1670,7 +1670,7 @@  Gcc_backend::convert_expression(Btype* type, Bexpression* expr,
     }
   else if (TREE_CODE(type_tree) == INTEGER_TYPE)
     ret = fold(convert_to_integer(type_tree, expr_tree));
-  else if (TREE_CODE(type_tree) == REAL_TYPE)
+  else if (SCALAR_FLOAT_TYPE_P (type_tree))
     ret = fold(convert_to_real(type_tree, expr_tree));
   else if (TREE_CODE(type_tree) == COMPLEX_TYPE)
     ret = fold(convert_to_complex(type_tree, expr_tree));
@@ -1880,7 +1880,7 @@  operator_to_tree_code(Operator op, tree type)
       code = MULT_EXPR;
       break;
     case OPERATOR_DIV:
-      if (TREE_CODE(type) == REAL_TYPE || TREE_CODE(type) == COMPLEX_TYPE)
+      if (SCALAR_FLOAT_TYPE_P (type) || TREE_CODE (type) == COMPLEX_TYPE)
 	code = RDIV_EXPR;
       else
 	code = TRUNC_DIV_EXPR;
@@ -2223,7 +2223,7 @@  Gcc_backend::init_statement(Bfunction*, Bvariable* var, Bexpression* init)
   tree init_tree = init->get_tree();
   if (var_tree == error_mark_node || init_tree == error_mark_node)
     return this->error_statement();
-  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
diff --git a/gcc/godump.cc b/gcc/godump.cc
index 0893d5fbc97..1a62753af12 100644
--- a/gcc/godump.cc
+++ b/gcc/godump.cc
@@ -791,7 +791,7 @@  go_format_type (class godump_container *container, tree type,
 	tree real_type;
 
 	real_type = TREE_TYPE (type);
-	if (TREE_CODE (real_type) == REAL_TYPE)
+	if (SCALAR_FLOAT_TYPE_P (real_type))
 	  {
 	    switch (TYPE_PRECISION (real_type))
 	      {
@@ -1100,7 +1100,7 @@  go_output_typedef (class godump_container *container, tree decl)
   if (TREE_CODE (TREE_TYPE (decl)) == ENUMERAL_TYPE
       && TYPE_SIZE (TREE_TYPE (decl)) != 0
       && !container->decls_seen.contains (TREE_TYPE (decl))
-      && (TYPE_CANONICAL (TREE_TYPE (decl)) == NULL_TREE
+      && (TYPE_STRUCTURAL_EQUALITY_P (TREE_TYPE (decl))
 	  || !container->decls_seen.contains
 				    (TYPE_CANONICAL (TREE_TYPE (decl)))))
     {