public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
To: gcc-patches@gcc.gnu.org
Cc: Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
Subject: [PATCH 09/14] rust: use _P() defines from tree.h
Date: Sun, 14 May 2023 01:23:16 +0200	[thread overview]
Message-ID: <20230513232321.279733-10-rep.dot.nop@gmail.com> (raw)
In-Reply-To: <20230513232321.279733-1-rep.dot.nop@gmail.com>

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(-)

diff --git a/gcc/rust/backend/rust-compile-expr.cc b/gcc/rust/backend/rust-compile-expr.cc
index d7945dbf26b..3dc34828e32 100644
--- a/gcc/rust/backend/rust-compile-expr.cc
+++ b/gcc/rust/backend/rust-compile-expr.cc
@@ -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
diff --git a/gcc/rust/backend/rust-tree.cc b/gcc/rust/backend/rust-tree.cc
index 8243d4cf5c6..7e11e6584ae 100644
--- a/gcc/rust/backend/rust-tree.cc
+++ b/gcc/rust/backend/rust-tree.cc
@@ -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
diff --git a/gcc/rust/backend/rust-tree.h b/gcc/rust/backend/rust-tree.h
index 284fd873c1c..6d243b7f86e 100644
--- a/gcc/rust/backend/rust-tree.h
+++ b/gcc/rust/backend/rust-tree.h
@@ -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> *
diff --git a/gcc/rust/checks/lints/rust-lint-unused-var.cc b/gcc/rust/checks/lints/rust-lint-unused-var.cc
index ba5ffb9372b..2cf5cd60f15 100644
--- a/gcc/rust/checks/lints/rust-lint-unused-var.cc
+++ b/gcc/rust/checks/lints/rust-lint-unused-var.cc
@@ -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);
diff --git a/gcc/rust/rust-gcc.cc b/gcc/rust/rust-gcc.cc
index cf20b5b98e0..b1995bdb56a 100644
--- a/gcc/rust/rust-gcc.cc
+++ b/gcc/rust/rust-gcc.cc
@@ -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
-- 
2.30.2


  parent reply	other threads:[~2023-05-13 23:23 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-13 23:23 [PATCH 00/14] " Bernhard Reutner-Fischer
2023-05-13 23:23 ` [PATCH 01/14] ada: " Bernhard Reutner-Fischer
2023-05-14 23:03   ` Jeff Law
2023-05-18 19:59     ` Bernhard Reutner-Fischer
2023-05-15 10:05   ` Eric Botcazou
2023-05-18 19:53     ` Bernhard Reutner-Fischer
2023-05-13 23:23 ` [PATCH 02/14] analyzer: " Bernhard Reutner-Fischer
2023-05-13 23:23 ` [PATCH 03/14] gcc/config/*: " Bernhard Reutner-Fischer
2023-05-14  8:21   ` Iain Sandoe
2023-05-15  7:46     ` Richard Biener
2023-05-13 23:23 ` [PATCH 04/14] c++: " Bernhard Reutner-Fischer
2023-06-01 15:24   ` Patrick Palka
2023-06-01 16:33     ` Bernhard Reutner-Fischer
2023-06-01 18:10       ` Bernhard Reutner-Fischer
2023-08-02 16:51         ` Patrick Palka
2023-08-08 20:31           ` Jason Merrill
2023-11-15 17:42             ` Bernhard Reutner-Fischer
2023-05-13 23:23 ` [PATCH 05/14] m2: " Bernhard Reutner-Fischer
2023-05-14  1:44   ` Gaius Mulley
2023-05-14  1:47   ` Gaius Mulley
2023-05-13 23:23 ` [PATCH 06/14] lto: " Bernhard Reutner-Fischer
2023-05-15  7:45   ` Richard Biener
2023-05-13 23:23 ` [PATCH 07/14] d: " Bernhard Reutner-Fischer
2023-05-13 23:23 ` [PATCH 08/14] fortran: " Bernhard Reutner-Fischer
2023-05-14 13:10   ` Mikael Morin
2023-05-18 15:18     ` Bernhard Reutner-Fischer
2023-05-18 19:20       ` Mikael Morin
2023-05-19 19:19         ` Bernhard Reutner-Fischer
2023-05-13 23:23 ` Bernhard Reutner-Fischer [this message]
2023-05-13 23:23 ` [PATCH 10/14] c: " Bernhard Reutner-Fischer
2023-05-13 23:23 ` [PATCH 11/14] objc: " Bernhard Reutner-Fischer
2023-05-14  8:13   ` Iain Sandoe
2023-05-13 23:23 ` [PATCH 12/14] go: " Bernhard Reutner-Fischer
2023-05-13 23:23 ` [PATCH 13/14] omp: " Bernhard Reutner-Fischer
2023-05-13 23:23 ` [PATCH 14/14] gcc: " Bernhard Reutner-Fischer
2023-05-15  7:45   ` Richard Biener

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230513232321.279733-10-rep.dot.nop@gmail.com \
    --to=rep.dot.nop@gmail.com \
    --cc=aldot@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).