]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
m2: use _P() defines from tree.h
authorBernhard Reutner-Fischer <aldot@gcc.gnu.org>
Sat, 13 May 2023 22:45:35 +0000 (00:45 +0200)
committerBernhard Reutner-Fischer <aldot@gcc.gnu.org>
Thu, 18 May 2023 19:49:02 +0000 (21:49 +0200)
gcc/m2/ChangeLog:

* gm2-gcc/m2builtins.cc (doradix): Use _P defines from tree.h.
(doplaces): Ditto.
(doexponentmin): Ditto.
(doexponentmax): Ditto.
(dolarge): Ditto.
(dosmall): Ditto.
(dogUnderflow): Ditto.
* gm2-gcc/m2convert.cc (unsafe_conversion_p): Ditto.
* gm2-gcc/m2expr.cc (m2expr_build_unary_op_check): Ditto.
(m2expr_build_binary_op_check): Ditto.
* gm2-gcc/m2tree.cc (m2tree_is_var): Ditto.
* gm2-gcc/m2treelib.cc (build_modify_expr): Ditto.
* gm2-gcc/m2type.cc (gm2_finish_decl): Ditto.
* m2pp.cc (hextree): Ditto.
(m2pp_call_expr): Ditto.

gcc/m2/gm2-gcc/m2builtins.cc
gcc/m2/gm2-gcc/m2convert.cc
gcc/m2/gm2-gcc/m2expr.cc
gcc/m2/gm2-gcc/m2tree.cc
gcc/m2/gm2-gcc/m2treelib.cc
gcc/m2/gm2-gcc/m2type.cc
gcc/m2/m2pp.cc

index 8d104c41a1ee319ffe44468cf7170013f31f11ab..3d13e2018d7f4c894560032eb7f966efe47ba9a0 100644 (file)
@@ -552,7 +552,7 @@ m2builtins_GetBuiltinTypeInfo (location_t location, tree type,
 static tree
 doradix (location_t location ATTRIBUTE_UNUSED, tree type)
 {
-  if (TREE_CODE (type) == REAL_TYPE)
+  if (SCALAR_FLOAT_TYPE_P (type))
     {
       enum machine_mode mode = TYPE_MODE (type);
       int radix = REAL_MODE_FORMAT (mode)->b;
@@ -568,7 +568,7 @@ doradix (location_t location ATTRIBUTE_UNUSED, tree type)
 static tree
 doplaces (location_t location ATTRIBUTE_UNUSED, tree type)
 {
-  if (TREE_CODE (type) == REAL_TYPE)
+  if (SCALAR_FLOAT_TYPE_P (type))
     {
       /* Taken from c-family/c-cppbuiltin.cc.  */
       /* The number of decimal digits, q, such that any floating-point
@@ -592,7 +592,7 @@ doplaces (location_t location ATTRIBUTE_UNUSED, tree type)
 static tree
 doexponentmin (location_t location ATTRIBUTE_UNUSED, tree type)
 {
-  if (TREE_CODE (type) == REAL_TYPE)
+  if (SCALAR_FLOAT_TYPE_P (type))
     {
       enum machine_mode mode = TYPE_MODE (type);
       int emin = REAL_MODE_FORMAT (mode)->emin;
@@ -607,7 +607,7 @@ doexponentmin (location_t location ATTRIBUTE_UNUSED, tree type)
 static tree
 doexponentmax (location_t location ATTRIBUTE_UNUSED, tree type)
 {
-  if (TREE_CODE (type) == REAL_TYPE)
+  if (SCALAR_FLOAT_TYPE_P (type))
     {
       enum machine_mode mode = TYPE_MODE (type);
       int emax = REAL_MODE_FORMAT (mode)->emax;
@@ -640,7 +640,7 @@ computeLarge (tree type)
 static tree
 dolarge (location_t location ATTRIBUTE_UNUSED, tree type)
 {
-  if (TREE_CODE (type) == REAL_TYPE)
+  if (SCALAR_FLOAT_TYPE_P (type))
     return computeLarge (type);
   return NULL_TREE;
 }
@@ -667,7 +667,7 @@ computeSmall (tree type)
 static tree
 dosmall (location_t location ATTRIBUTE_UNUSED, tree type)
 {
-  if (TREE_CODE (type) == REAL_TYPE)
+  if (SCALAR_FLOAT_TYPE_P (type))
     return computeSmall (type);
   return NULL_TREE;
 }
@@ -735,7 +735,7 @@ dorounds (location_t location ATTRIBUTE_UNUSED, tree type ATTRIBUTE_UNUSED)
 static tree
 dogUnderflow (location_t location ATTRIBUTE_UNUSED, tree type)
 {
-  if (TREE_CODE (type) == REAL_TYPE)
+  if (SCALAR_FLOAT_TYPE_P (type))
     {
       enum machine_mode mode = TYPE_MODE (type);
       const struct real_format *fmt = REAL_MODE_FORMAT (mode);
index f806669dc3927f35147780031195a237baf9f5de..5d35bcee23970d37e099bed6c45cdaf5ede85978 100644 (file)
@@ -91,7 +91,7 @@ unsafe_conversion_p (location_t loc, tree type, tree expr, bool produce_warns)
 
       /* Warn for real constant that is not an exact integer converted to
          integer type.  */
-      if (TREE_CODE (expr_type) == REAL_TYPE
+      if (SCALAR_FLOAT_TYPE_P (expr_type)
           && TREE_CODE (type) == INTEGER_TYPE)
         {
           if (!real_isinteger (TREE_REAL_CST_PTR (expr),
@@ -121,7 +121,7 @@ unsafe_conversion_p (location_t loc, tree type, tree expr, bool produce_warns)
           else
             give_warning = UNSAFE_OTHER;
         }
-      else if (TREE_CODE (type) == REAL_TYPE)
+      else if (SCALAR_FLOAT_TYPE_P (type))
         {
           /* Warn for an integer constant that does not fit into real type.  */
           if (TREE_CODE (expr_type) == INTEGER_TYPE)
@@ -133,7 +133,7 @@ unsafe_conversion_p (location_t loc, tree type, tree expr, bool produce_warns)
 
           /* Warn for a real constant that does not fit into a smaller real
           type.  */
-          else if (TREE_CODE (expr_type) == REAL_TYPE
+         else if (SCALAR_FLOAT_TYPE_P (expr_type)
                    && TYPE_PRECISION (type) < TYPE_PRECISION (expr_type))
             {
               REAL_VALUE_TYPE a = TREE_REAL_CST (expr);
@@ -145,7 +145,7 @@ unsafe_conversion_p (location_t loc, tree type, tree expr, bool produce_warns)
   else
     {
       /* Warn for real types converted to integer types.  */
-      if (TREE_CODE (expr_type) == REAL_TYPE
+      if (SCALAR_FLOAT_TYPE_P (expr_type)
           && TREE_CODE (type) == INTEGER_TYPE)
         give_warning = UNSAFE_REAL;
 
index e46d894d6366660f437fe9fba1bbd7ec5faadd45..8021eb006717d3c4caa160e6fac35c52732a231e 100644 (file)
@@ -1041,7 +1041,7 @@ m2expr_build_unary_op_check (location_t location, enum tree_code code,
   if (check != NULL)
     result = build2 (COMPOUND_EXPR, argtype, check, result);
 
-  if (TREE_CODE (argtype) == REAL_TYPE)
+  if (SCALAR_FLOAT_TYPE_P (argtype))
     m2expr_checkRealOverflow (location, code, result);
 
   return m2expr_FoldAndStrip (result);
@@ -2594,7 +2594,7 @@ m2expr_build_binary_op_check (location_t location, enum tree_code code,
   if (check != NULL)
     result = build2 (COMPOUND_EXPR, TREE_TYPE (result), check, result);
 
-  if (TREE_CODE (type1) == REAL_TYPE)
+  if (SCALAR_FLOAT_TYPE_P (type1))
     m2expr_checkRealOverflow (location, code, result);
   return result;
 }
index 0fc2fe57b6322b5a217fad8b5ca24b704340ba98..994051232908a5dd3eabd6c6ed280b415b1a31d3 100644 (file)
@@ -29,7 +29,7 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 bool
 m2tree_is_var (tree var)
 {
-  return TREE_CODE (var) == VAR_DECL;
+  return VAR_P (var);
 }
 
 bool
index 9ec095d5284077babf768ecf8ee0ced7581bdb17..6694af66d8b424308d62144f806ff601d526aa08 100644 (file)
@@ -99,7 +99,7 @@ build_modify_expr (location_t location, tree lhs, enum tree_code modifycode,
   if (TREE_CODE (lhs) == COMPONENT_REF
       && (TREE_CODE (lhstype) == INTEGER_TYPE
           || TREE_CODE (lhstype) == BOOLEAN_TYPE
-          || TREE_CODE (lhstype) == REAL_TYPE
+         || SCALAR_FLOAT_TYPE_P (lhstype)
           || TREE_CODE (lhstype) == ENUMERAL_TYPE))
     lhstype = TREE_TYPE (get_unwidened (lhs, 0));
 
index 2808ddf8b8a5accc8522a57c10c8fcdcf033d8e2..eeee3557c626e69515c159723bce007e8daa0151 100644 (file)
@@ -1247,7 +1247,7 @@ gm2_finish_decl (location_t location, tree decl)
   int was_incomplete = (DECL_SIZE (decl) == 0);
 
   m2assert_AssertLocation (location);
-  if (TREE_CODE (decl) == VAR_DECL)
+  if (VAR_P (decl))
     {
       if (DECL_SIZE (decl) == 0 && TREE_TYPE (decl) != error_mark_node
           && COMPLETE_TYPE_P (TREE_TYPE (decl)))
@@ -1278,7 +1278,7 @@ gm2_finish_decl (location_t location, tree decl)
      functions, unless the type is an undefined structure or union.  If
      not, it will get done when the type is completed.  */
 
-  if (TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == FUNCTION_DECL)
+  if (VAR_P (decl) || TREE_CODE (decl) == FUNCTION_DECL)
     {
       if (DECL_FILE_SCOPE_P (decl))
         {
index 21d1cb9dce73bae6e8f6a6c56b0ec2b8dd9be74e..52a29384e8dfbc0744db87f36d4ca96fcae26465 100644 (file)
@@ -579,7 +579,7 @@ hextree (tree t)
       hextree (DECL_INITIAL (t));
       hextree (DECL_SAVED_TREE (t));
     }
-  if (TREE_CODE (t) == VAR_DECL)
+  if (VAR_P (t))
     {
       pretty *state = initPretty (FALSE);
 
@@ -2364,7 +2364,7 @@ m2pp_call_expr (pretty *s, tree t)
   int has_return_type = TRUE;
   tree proc;
 
-  if (type && (TREE_CODE (type) == VOID_TYPE))
+  if (type && VOID_TYPE_P (type))
     has_return_type = FALSE;
 
   if (TREE_CODE (call) == ADDR_EXPR || TREE_CODE (call) == NON_LVALUE_EXPR)