In gcc/cp/pt.cc, tsubst_* functions are using this pattern:

        #define RETURN(EXP) do { r = (EXP); goto out; } while(0)
etc.

It is done to restore input_location on exit from those functions.
A couple places missed the RETURN memo and were doing bare returns; I'm
reasonably sure those were all bugs.

This patch implements a RAII class to override input_location and converts
tsubst_* functions to use it. Also it replaces the use of RECUR macros with
lambdas, completely eliminating local macros from the functions. (Though
I'm not sure the recur thing is worth it to begin with.)

There's probably more code in GCC that could make use of this class,
so I put it in gcc/input.h right away.

GCC 17.0 successfully bootstraps with this. (Not that there's much
code in GCC itself to exercise pt.cc, let alone if we care about
input_location, but it is some testing.)

gcc/ChangeLog:

        * input.h: Add auto_saved_input_location.

gcc/cp/ChangeLog:

        * pt.cc: Convert tsubst_* functions to auto_saved_input_location,
        removing RETURN macros. Also replace adjacent RECUR macros with
        lambdas.

...in case this constitutes a copyrightable contribution,
Signed-off-by: Ivan Sokolov <[email protected]>
---
 gcc/cp/pt.cc | 863 ++++++++++++++++++++++++---------------------------
 gcc/input.h  |  18 ++
 2 files changed, 430 insertions(+), 451 deletions(-)

diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
index 6c8d0e2de71..0b87705b632 100644
--- a/gcc/cp/pt.cc
+++ b/gcc/cp/pt.cc
@@ -15960,9 +15960,6 @@ static tree
 tsubst_decl (tree t, tree args, tsubst_flags_t complain,
             bool use_spec_table /* = true */)
 {
-#define RETURN(EXP) do { r = (EXP); goto out; } while(0)
-  location_t saved_loc;
-  tree r = NULL_TREE;
   tree in_decl = t;
   hashval_t hash = 0;
 
@@ -15970,21 +15967,19 @@ tsubst_decl (tree t, tree args, tsubst_flags_t 
complain,
     return error_mark_node;
 
   /* Set the filename and linenumber to improve error-reporting.  */
-  saved_loc = input_location;
+  auto_saved_input_location saved_loc;
   input_location = DECL_SOURCE_LOCATION (t);
 
   switch (TREE_CODE (t))
     {
     case TEMPLATE_DECL:
-      r = tsubst_template_decl (t, args, complain,
+      return tsubst_template_decl (t, args, complain,
                                /*lambda_fntype=*/NULL_TREE,
                                /*lambda_tparms=*/NULL_TREE);
-      break;
 
     case FUNCTION_DECL:
-      r = tsubst_function_decl (t, args, complain, /*lambda*/NULL_TREE,
+      return tsubst_function_decl (t, args, complain, /*lambda*/NULL_TREE,
                                use_spec_table);
-      break;
 
     case PARM_DECL:
       {
@@ -16005,7 +16000,7 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain,
             if (spec
                 && TREE_CODE (spec) == PARM_DECL
                 && TREE_CODE (TREE_TYPE (spec)) != TYPE_PACK_EXPANSION)
-              RETURN (spec);
+              return spec;
 
             /* Expand the TYPE_PACK_EXPANSION that provides the types for
                the parameters in this function parameter pack.  */
@@ -16018,8 +16013,8 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain,
                 /* Zero-length parameter packs are boring. Just substitute
                    into the chain.  */
                if (len == 0 && !cp_unevaluated_operand)
-                  RETURN (tsubst (TREE_CHAIN (t), args, complain,
-                                 TREE_CHAIN (t)));
+                 return tsubst (TREE_CHAIN (t), args, complain,
+                                 TREE_CHAIN (t));
               }
             else
               {
@@ -16032,7 +16027,7 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain,
         /* Loop through all of the parameters we'll build. When T is
            a function parameter pack, LEN is the number of expanded
            types in EXPANDED_TYPES; otherwise, LEN is 1.  */
-        r = NULL_TREE;
+        tree r = NULL_TREE;
         for (i = 0; i < len; ++i)
           {
             prev_r = r;
@@ -16056,7 +16051,7 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain,
               type = tsubst (TREE_TYPE (t), args, complain, in_decl);
 
            if (type == error_mark_node && !(complain & tf_error))
-             RETURN (error_mark_node);
+             return error_mark_node;
 
             type = type_decays_to (type);
             TREE_TYPE (r) = type;
@@ -16099,17 +16094,17 @@ tsubst_decl (tree t, tree args, tsubst_flags_t 
complain,
            tree chain = tsubst (DECL_CHAIN (t), args,
                                 complain, DECL_CHAIN (t));
            if (chain == error_mark_node)
-             RETURN (error_mark_node);
+             return error_mark_node;
            DECL_CHAIN (r) = chain;
          }
 
         /* FIRST_R contains the start of the chain we've built.  */
-        r = first_r;
+        return first_r;
       }
-      break;
 
     case FIELD_DECL:
       {
+        tree r = NULL_TREE;
        tree type = NULL_TREE;
        tree vec = NULL_TREE;
        tree expanded_types = NULL_TREE;
@@ -16147,7 +16142,7 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain,
               type = tsubst (TREE_TYPE (t), args, complain, in_decl);
 
            if (type == error_mark_node)
-             RETURN (error_mark_node);
+             return error_mark_node;
            TREE_TYPE (r) = type;
            cp_apply_type_quals_to_decl (cp_type_quals (type), r);
 
@@ -16168,7 +16163,7 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain,
                      error_at (DECL_SOURCE_LOCATION (t),
                                "width of bit-field %qD has non-integral "
                                "type %qT", r, TREE_TYPE (width));
-                   RETURN (error_mark_node);
+                   return error_mark_node;
                  }
                DECL_BIT_FIELD_REPRESENTATIVE (r) = width;
              }
@@ -16196,8 +16191,8 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain,
 
        if (vec)
          r = vec;
+        return r;
       }
-      break;
 
     case USING_DECL:
       /* We reach here only for member using decls.  We also need to check
@@ -16231,10 +16226,7 @@ tsubst_decl (tree t, tree args, tsubst_flags_t 
complain,
              name = tsubst_pack_expansion (TREE_TYPE (name), args,
                                            complain, in_decl);
              if (name == error_mark_node)
-               {
-                 r = error_mark_node;
-                 break;
-               }
+               return error_mark_node;
              name = copy_node (name);
              for (tree& elt : tree_vec_range (name))
                elt = make_conv_op_name (elt);
@@ -16253,8 +16245,7 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain,
                {
                  error ("mismatched argument pack lengths (%d vs %d)",
                         TREE_VEC_LENGTH (scope), TREE_VEC_LENGTH (name));
-                 r = error_mark_node;
-                 break;
+                 return error_mark_node;
                }
              len = TREE_VEC_LENGTH (scope);
            }
@@ -16263,7 +16254,7 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain,
          else /* TREE_CODE (name) == TREE_VEC  */
            len = TREE_VEC_LENGTH (name);
 
-         r = make_tree_vec (len);
+         tree r = make_tree_vec (len);
          for (int i = 0; i < len; ++i)
            {
              tree escope = (TREE_CODE (scope) == TREE_VEC
@@ -16274,10 +16265,7 @@ tsubst_decl (tree t, tree args, tsubst_flags_t 
complain,
                            : name);
              tree elt = do_class_using_decl (escope, ename);
              if (!elt)
-               {
-                 r = error_mark_node;
-                 break;
-               }
+               return error_mark_node;
              TREE_PROTECTED (elt) = TREE_PROTECTED (t);
              TREE_PRIVATE (elt) = TREE_PRIVATE (t);
              TREE_VEC_ELT (r, i) = elt;
@@ -16285,13 +16273,14 @@ tsubst_decl (tree t, tree args, tsubst_flags_t 
complain,
 
          if (!variadic_p && r != error_mark_node)
            r = TREE_VEC_ELT (r, 0);
+          return r;
        }
       else
        {
-         r = copy_node (t);
+         tree r = copy_node (t);
          DECL_CHAIN (r) = NULL_TREE;
+         return r;
        }
-      break;
 
     case TYPE_DECL:
     case VAR_DECL:
@@ -16302,7 +16291,7 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain,
        tree type = NULL_TREE;
 
        if (TREE_TYPE (t) == error_mark_node)
-         RETURN (error_mark_node);
+         return error_mark_node;
 
        if (TREE_CODE (t) == TYPE_DECL
            && (TREE_CODE (TREE_TYPE (t)) == TU_LOCAL_ENTITY
@@ -16315,9 +16304,8 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain,
               we've copied the type for a typedef.  */
            type = tsubst (TREE_TYPE (t), args, complain, in_decl);
            if (type == error_mark_node)
-             RETURN (error_mark_node);
-           r = TYPE_NAME (type);
-           break;
+             return error_mark_node;
+           return TYPE_NAME (type);
          }
 
        /* Check to see if we already have the specialization we
@@ -16359,7 +16347,7 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain,
                  {
                    argvec = tsubst (DECL_TI_ARGS (t), args, complain, in_decl);
                    if (argvec == error_mark_node)
-                     RETURN (error_mark_node);
+                     return error_mark_node;
                    gen_tmpl = most_general_template (tmpl);
                    hash = spec_hasher::hash (gen_tmpl, argvec);
                    spec = retrieve_specialization (gen_tmpl, argvec, hash);
@@ -16388,10 +16376,7 @@ tsubst_decl (tree t, tree args, tsubst_flags_t 
complain,
        /* If we already have the specialization we need, there is
           nothing more to do.  */
        if (spec)
-         {
-           r = spec;
-           break;
-         }
+         return spec;
 
        /* Create a new node for the specialization we need.  */
        if (type == NULL_TREE)
@@ -16418,14 +16403,11 @@ tsubst_decl (tree t, tree args, tsubst_flags_t 
complain,
               same alias (c++/86171).  */
            if (use_spec_table && gen_tmpl && DECL_ALIAS_TEMPLATE_P (gen_tmpl)
                && (spec = retrieve_specialization (gen_tmpl, argvec, hash)))
-             {
-               r = spec;
-               break;
-             }
+             return spec;
          }
        if (type == error_mark_node && !(complain & tf_error))
-         RETURN (error_mark_node);
-       r = copy_decl (t);
+         return error_mark_node;
+       tree r = copy_decl (t);
        if (VAR_P (r))
          {
            DECL_INITIALIZED_P (r) = 0;
@@ -16490,7 +16472,7 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain,
                       /* R is not yet sufficiently initialized, so we
                          just use its name.  */
                       DECL_NAME (r));
-               RETURN (error_mark_node);
+               return error_mark_node;
              }
            type = complete_type (type);
            /* Wait until cp_finish_decl to set this again, to handle
@@ -16601,26 +16583,18 @@ tsubst_decl (tree t, tree args, tsubst_flags_t 
complain,
          DECL_NAME (r) = omp_mapper_id (DECL_NAME (t), TREE_TYPE (r));
 
        layout_decl (r, 0);
+        return r;
       }
-      break;
 
     case NAMESPACE_DECL:
       if (dependent_namespace_p (t))
-       r = tsubst_expr (ORIGINAL_NAMESPACE (t), args, complain, in_decl);
+       return tsubst_expr (ORIGINAL_NAMESPACE (t), args, complain, in_decl);
       else
-       r = t;
-      break;
+       return t;
 
     default:
       gcc_unreachable ();
     }
-#undef RETURN
-
- out:
-  /* Restore the file and line information.  */
-  input_location = saved_loc;
-
-  return r;
 }
 
 /* Substitute into the complete parameter type list PARMS.  */
@@ -19287,7 +19261,10 @@ static tree
 tsubst_copy_asm_operands (tree t, tree args, tsubst_flags_t complain,
                          tree in_decl)
 {
-#define RECUR(t) tsubst_copy_asm_operands (t, args, complain, in_decl)
+  auto recur = [&] (tree t)
+    {
+      return tsubst_copy_asm_operands (t, args, complain, in_decl);
+    };
 
   tree purpose, value, chain;
 
@@ -19302,12 +19279,12 @@ tsubst_copy_asm_operands (tree t, tree args, 
tsubst_flags_t complain,
 
   purpose = TREE_PURPOSE (t);
   if (purpose)
-    purpose = RECUR (purpose);
+    purpose = recur (purpose);
   value = TREE_VALUE (t);
   if (value)
     {
       if (TREE_CODE (value) != LABEL_DECL)
-       value = RECUR (value);
+       value = recur (value);
       else
        {
          value = lookup_label (DECL_NAME (value));
@@ -19317,9 +19294,8 @@ tsubst_copy_asm_operands (tree t, tree args, 
tsubst_flags_t complain,
     }
   chain = TREE_CHAIN (t);
   if (chain && chain != void_type_node)
-    chain = RECUR (chain);
+    chain = recur (chain);
   return tree_cons (purpose, value, chain);
-#undef RECUR
 }
 
 /* Used to temporarily communicate the list of #pragma omp parallel
@@ -19338,8 +19314,10 @@ tsubst_omp_for_iterator (tree t, int i, tree declv, 
tree &orig_declv,
                         tree initv, tree condv, tree incrv, tree *clauses,
                         tree args, tsubst_flags_t complain, tree in_decl)
 {
-#define RECUR(NODE)                            \
-  tsubst_stmt ((NODE), args, complain, in_decl)
+  auto recur = [&] (tree node)
+    {
+      return tsubst_stmt (node, args, complain, in_decl);
+    };
   tree decl, init, cond = NULL_TREE, incr = NULL_TREE;
   bool ret = false;
 
@@ -19404,7 +19382,7 @@ tsubst_omp_for_iterator (tree t, int i, tree declv, 
tree &orig_declv,
     {
       if (TREE_CODE (decl) == SCOPE_REF)
        {
-         decl = RECUR (decl);
+         decl = recur (decl);
          if (TREE_CODE (decl) == COMPONENT_REF)
            {
              tree v = decl;
@@ -19434,29 +19412,29 @@ tsubst_omp_for_iterator (tree t, int i, tree declv, 
tree &orig_declv,
            }
        }
       else
-       decl = RECUR (decl);
+       decl = recur (decl);
     }
   if (init && TREE_CODE (init) == TREE_VEC)
     {
       init = copy_node (init);
       TREE_VEC_ELT (init, 0)
        = tsubst_decl (TREE_VEC_ELT (init, 0), args, complain);
-      TREE_VEC_ELT (init, 1) = RECUR (TREE_VEC_ELT (init, 1));
-      TREE_VEC_ELT (init, 2) = RECUR (TREE_VEC_ELT (init, 2));
+      TREE_VEC_ELT (init, 1) = recur (TREE_VEC_ELT (init, 1));
+      TREE_VEC_ELT (init, 2) = recur (TREE_VEC_ELT (init, 2));
     }
   else
-    init = RECUR (init);
+    init = recur (init);
 
   if (orig_declv && OMP_FOR_ORIG_DECLS (t))
     {
       tree o = TREE_VEC_ELT (OMP_FOR_ORIG_DECLS (t), i);
       if (TREE_CODE (o) == TREE_LIST)
        TREE_VEC_ELT (orig_declv, i)
-         = tree_cons (RECUR (TREE_PURPOSE (o)),
-                      RECUR (TREE_VALUE (o)),
+         = tree_cons (recur (TREE_PURPOSE (o)),
+                      recur (TREE_VALUE (o)),
                       NULL_TREE);
       else
-       TREE_VEC_ELT (orig_declv, i) = RECUR (o);
+       TREE_VEC_ELT (orig_declv, i) = recur (o);
     }
 
   if (range_for)
@@ -19492,7 +19470,7 @@ tsubst_omp_for_iterator (tree t, int i, tree declv, 
tree &orig_declv,
          /* Declare the variable, but don't let that initialize it.  */
          tree init_sav = DECL_INITIAL (DECL_EXPR_DECL (decl_expr));
          DECL_INITIAL (DECL_EXPR_DECL (decl_expr)) = NULL_TREE;
-         RECUR (decl_expr);
+         recur (decl_expr);
          DECL_INITIAL (DECL_EXPR_DECL (decl_expr)) = init_sav;
        }
 
@@ -19502,27 +19480,27 @@ tsubst_omp_for_iterator (tree t, int i, tree declv, 
tree &orig_declv,
          if (COMPARISON_CLASS_P (cond)
              && TREE_CODE (TREE_OPERAND (cond, 1)) == TREE_VEC)
            {
-             tree lhs = RECUR (TREE_OPERAND (cond, 0));
+             tree lhs = recur (TREE_OPERAND (cond, 0));
              tree rhs = copy_node (TREE_OPERAND (cond, 1));
              TREE_VEC_ELT (rhs, 0)
                = tsubst_decl (TREE_VEC_ELT (rhs, 0), args, complain);
-             TREE_VEC_ELT (rhs, 1) = RECUR (TREE_VEC_ELT (rhs, 1));
-             TREE_VEC_ELT (rhs, 2) = RECUR (TREE_VEC_ELT (rhs, 2));
+             TREE_VEC_ELT (rhs, 1) = recur (TREE_VEC_ELT (rhs, 1));
+             TREE_VEC_ELT (rhs, 2) = recur (TREE_VEC_ELT (rhs, 2));
              cond = build2 (TREE_CODE (cond), TREE_TYPE (cond),
                             lhs, rhs);
            }
          else
-           cond = RECUR (cond);
+           cond = recur (cond);
          incr = TREE_VEC_ELT (OMP_FOR_INCR (t), i);
          if (TREE_CODE (incr) == MODIFY_EXPR)
            {
-             tree lhs = RECUR (TREE_OPERAND (incr, 0));
-             tree rhs = RECUR (TREE_OPERAND (incr, 1));
+             tree lhs = recur (TREE_OPERAND (incr, 0));
+             tree rhs = recur (TREE_OPERAND (incr, 1));
              incr = build_x_modify_expr (EXPR_LOCATION (incr), lhs,
                                          NOP_EXPR, rhs, NULL_TREE, complain);
            }
          else
-           incr = RECUR (incr);
+           incr = recur (incr);
          if (orig_declv && !OMP_FOR_ORIG_DECLS (t))
            TREE_VEC_ELT (orig_declv, i) = decl;
        }
@@ -19536,7 +19514,7 @@ tsubst_omp_for_iterator (tree t, int i, tree declv, 
tree &orig_declv,
   if (decl_expr)
     {
       /* Declare and initialize the variable.  */
-      RECUR (decl_expr);
+      recur (decl_expr);
       init = NULL_TREE;
     }
   else if (init)
@@ -19600,12 +19578,12 @@ tsubst_omp_for_iterator (tree t, int i, tree declv, 
tree &orig_declv,
   cond = TREE_VEC_ELT (OMP_FOR_COND (t), i);
   if (COMPARISON_CLASS_P (cond))
     {
-      tree op0 = RECUR (TREE_OPERAND (cond, 0));
-      tree op1 = RECUR (TREE_OPERAND (cond, 1));
+      tree op0 = recur (TREE_OPERAND (cond, 0));
+      tree op1 = recur (TREE_OPERAND (cond, 1));
       cond = build2 (TREE_CODE (cond), boolean_type_node, op0, op1);
     }
   else
-    cond = RECUR (cond);
+    cond = recur (cond);
   incr = TREE_VEC_ELT (OMP_FOR_INCR (t), i);
   switch (TREE_CODE (incr))
     {
@@ -19614,50 +19592,50 @@ tsubst_omp_for_iterator (tree t, int i, tree declv, 
tree &orig_declv,
     case POSTINCREMENT_EXPR:
     case POSTDECREMENT_EXPR:
       incr = build2 (TREE_CODE (incr), TREE_TYPE (decl),
-                    RECUR (TREE_OPERAND (incr, 0)), NULL_TREE);
+                    recur (TREE_OPERAND (incr, 0)), NULL_TREE);
       break;
     case MODIFY_EXPR:
       if (TREE_CODE (TREE_OPERAND (incr, 1)) == PLUS_EXPR
          || TREE_CODE (TREE_OPERAND (incr, 1)) == MINUS_EXPR)
        {
          tree rhs = TREE_OPERAND (incr, 1);
-         tree lhs = RECUR (TREE_OPERAND (incr, 0));
-         tree rhs0 = RECUR (TREE_OPERAND (rhs, 0));
-         tree rhs1 = RECUR (TREE_OPERAND (rhs, 1));
+         tree lhs = recur (TREE_OPERAND (incr, 0));
+         tree rhs0 = recur (TREE_OPERAND (rhs, 0));
+         tree rhs1 = recur (TREE_OPERAND (rhs, 1));
          incr = build2 (MODIFY_EXPR, TREE_TYPE (decl), lhs,
                         build2 (TREE_CODE (rhs), TREE_TYPE (decl),
                                 rhs0, rhs1));
        }
       else
-       incr = RECUR (incr);
+       incr = recur (incr);
       break;
     case MODOP_EXPR:
       if (TREE_CODE (TREE_OPERAND (incr, 1)) == PLUS_EXPR
          || TREE_CODE (TREE_OPERAND (incr, 1)) == MINUS_EXPR)
        {
-         tree lhs = RECUR (TREE_OPERAND (incr, 0));
+         tree lhs = recur (TREE_OPERAND (incr, 0));
          incr = build2 (MODIFY_EXPR, TREE_TYPE (decl), lhs,
                         build2 (TREE_CODE (TREE_OPERAND (incr, 1)),
                                 TREE_TYPE (decl), lhs,
-                                RECUR (TREE_OPERAND (incr, 2))));
+                                recur (TREE_OPERAND (incr, 2))));
        }
       else if (TREE_CODE (TREE_OPERAND (incr, 1)) == NOP_EXPR
               && (TREE_CODE (TREE_OPERAND (incr, 2)) == PLUS_EXPR
                   || (TREE_CODE (TREE_OPERAND (incr, 2)) == MINUS_EXPR)))
        {
          tree rhs = TREE_OPERAND (incr, 2);
-         tree lhs = RECUR (TREE_OPERAND (incr, 0));
-         tree rhs0 = RECUR (TREE_OPERAND (rhs, 0));
-         tree rhs1 = RECUR (TREE_OPERAND (rhs, 1));
+         tree lhs = recur (TREE_OPERAND (incr, 0));
+         tree rhs0 = recur (TREE_OPERAND (rhs, 0));
+         tree rhs1 = recur (TREE_OPERAND (rhs, 1));
          incr = build2 (MODIFY_EXPR, TREE_TYPE (decl), lhs,
                         build2 (TREE_CODE (rhs), TREE_TYPE (decl),
                                 rhs0, rhs1));
        }
       else
-       incr = RECUR (incr);
+       incr = recur (incr);
       break;
     default:
-      incr = RECUR (incr);
+      incr = recur (incr);
       break;
     }
 
@@ -19668,7 +19646,6 @@ tsubst_omp_for_iterator (tree t, int i, tree declv, 
tree &orig_declv,
   TREE_VEC_ELT (condv, i) = cond;
   TREE_VEC_ELT (incrv, i) = incr;
   return false;
-#undef RECUR
 }
 
 /* Helper function of tsubst_expr, find OMP_TEAMS inside
@@ -19830,18 +19807,18 @@ dependent_operand_p (tree t)
 static tree
 tsubst_stmt (tree t, tree args, tsubst_flags_t complain, tree in_decl)
 {
-#define RETURN(EXP) do { r = (EXP); goto out; } while(0)
-#define RECUR(NODE)                            \
-  tsubst_stmt ((NODE), args, complain, in_decl)
+  auto recur = [&] (tree node)
+    {
+      return tsubst_stmt (node, args, complain, in_decl);
+    };
 
   tree stmt, tmp;
   tree r;
-  location_t loc;
 
   if (t == NULL_TREE || t == error_mark_node)
     return t;
 
-  loc = input_location;
+  auto_saved_input_location saved_loc;
   if (location_t eloc = cp_expr_location (t))
     input_location = eloc;
   if (STATEMENT_CODE_P (TREE_CODE (t)))
@@ -19852,7 +19829,7 @@ tsubst_stmt (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
     case STATEMENT_LIST:
       {
        for (tree stmt : tsi_range (t))
-         RECUR (stmt);
+         recur (stmt);
        break;
       }
 
@@ -19862,15 +19839,15 @@ tsubst_stmt (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
       break;
 
     case RETURN_EXPR:
-      finish_return_stmt (RECUR (TREE_OPERAND (t, 0)));
+      finish_return_stmt (recur (TREE_OPERAND (t, 0)));
       break;
 
     case CO_RETURN_EXPR:
-      finish_co_return_stmt (input_location, RECUR (TREE_OPERAND (t, 0)));
+      finish_co_return_stmt (input_location, recur (TREE_OPERAND (t, 0)));
       break;
 
     case EXPR_STMT:
-      tmp = RECUR (EXPR_STMT_EXPR (t));
+      tmp = recur (EXPR_STMT_EXPR (t));
       if (EXPR_STMT_STMT_EXPR_RESULT (t))
        finish_stmt_expr_expr (tmp, cur_stmt_expr);
       else
@@ -19890,9 +19867,8 @@ tsubst_stmt (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
        r = tsubst_contract (NULL_TREE, t, args, complain, in_decl);
        if (r != error_mark_node)
          add_stmt (r);
-       RETURN (r);
+       return r;
       }
-      break;
 
     case DECL_EXPR:
       {
@@ -20064,15 +20040,15 @@ tsubst_stmt (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
 
     case FOR_STMT:
       stmt = begin_for_stmt (NULL_TREE, NULL_TREE);
-      RECUR (FOR_INIT_STMT (t));
+      recur (FOR_INIT_STMT (t));
       finish_init_stmt (stmt);
-      tmp = RECUR (FOR_COND (t));
+      tmp = recur (FOR_COND (t));
       finish_for_cond (tmp, stmt, false, 0, false);
-      tmp = RECUR (FOR_EXPR (t));
+      tmp = recur (FOR_EXPR (t));
       finish_for_expr (tmp, stmt);
       {
        bool prev = note_iteration_stmt_body_start ();
-       RECUR (FOR_BODY (t));
+       recur (FOR_BODY (t));
        note_iteration_stmt_body_end (prev);
       }
       finish_for_stmt (stmt);
@@ -20087,11 +20063,11 @@ tsubst_stmt (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
         stmt = (processing_template_decl
                ? begin_range_for_stmt (NULL_TREE, NULL_TREE)
                : begin_for_stmt (NULL_TREE, NULL_TREE));
-       RECUR (RANGE_FOR_INIT_STMT (t));
+       recur (RANGE_FOR_INIT_STMT (t));
         decl = RANGE_FOR_DECL (t);
         decl = tsubst (decl, args, complain, in_decl);
         maybe_push_decl (decl);
-        expr = RECUR (RANGE_FOR_EXPR (t));
+        expr = recur (RANGE_FOR_EXPR (t));
 
        cp_decomp decomp_d, *decomp = NULL;
        if (DECL_DECOMPOSITION_P (decl))
@@ -20101,7 +20077,7 @@ tsubst_stmt (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
                                        complain, in_decl, decomp);
          }
 
-       tree unroll = RECUR (RANGE_FOR_UNROLL (t));
+       tree unroll = recur (RANGE_FOR_UNROLL (t));
        if (unroll)
          unroll
            = cp_check_pragma_unroll (EXPR_LOCATION (RANGE_FOR_UNROLL (t)),
@@ -20121,7 +20097,7 @@ tsubst_stmt (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
                                       RANGE_FOR_NOVECTOR (t));
 
        bool prev = note_iteration_stmt_body_start ();
-        RECUR (RANGE_FOR_BODY (t));
+        recur (RANGE_FOR_BODY (t));
        note_iteration_stmt_body_end (prev);
         finish_for_stmt (stmt);
       }
@@ -20129,11 +20105,11 @@ tsubst_stmt (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
 
     case WHILE_STMT:
       stmt = begin_while_stmt ();
-      tmp = RECUR (WHILE_COND (t));
+      tmp = recur (WHILE_COND (t));
       finish_while_stmt_cond (tmp, stmt, false, 0, false);
       {
        bool prev = note_iteration_stmt_body_start ();
-       RECUR (WHILE_BODY (t));
+       recur (WHILE_BODY (t));
        note_iteration_stmt_body_end (prev);
       }
       finish_while_stmt (stmt);
@@ -20143,11 +20119,11 @@ tsubst_stmt (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
       stmt = begin_do_stmt ();
       {
        bool prev = note_iteration_stmt_body_start ();
-       RECUR (DO_BODY (t));
+       recur (DO_BODY (t));
        note_iteration_stmt_body_end (prev);
       }
       finish_do_body (stmt);
-      tmp = RECUR (DO_COND (t));
+      tmp = recur (DO_COND (t));
       finish_do_stmt (tmp, stmt, false, 0, false);
       break;
 
@@ -20158,8 +20134,8 @@ tsubst_stmt (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
                           NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE);
        TEMPLATE_FOR_SCOPE (stmt) = begin_template_for_scope (&init);
        TEMPLATE_FOR_INIT_STMT (stmt) = init;
-       RECUR (TEMPLATE_FOR_INIT_STMT (t));
-       TEMPLATE_FOR_EXPR (stmt) = RECUR (TEMPLATE_FOR_EXPR (t));
+       recur (TEMPLATE_FOR_INIT_STMT (t));
+       TEMPLATE_FOR_EXPR (stmt) = recur (TEMPLATE_FOR_EXPR (t));
        if (processing_template_decl)
          {
            tree orig_decl = TEMPLATE_FOR_DECL (t);
@@ -20199,7 +20175,7 @@ tsubst_stmt (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
            auto save_in_expansion_stmt = in_expansion_stmt;
            in_expansion_stmt = true;
            bool prev = note_iteration_stmt_body_start ();
-           RECUR (TEMPLATE_FOR_BODY (t));
+           recur (TEMPLATE_FOR_BODY (t));
            note_iteration_stmt_body_end (prev);
            in_expansion_stmt = save_in_expansion_stmt;
            TEMPLATE_FOR_BODY (stmt)
@@ -20224,7 +20200,7 @@ tsubst_stmt (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
       {
        tree cond = IF_COND (t);
        bool was_dep = dependent_operand_p (cond);
-       cond = RECUR (cond);
+       cond = recur (cond);
        warning_sentinel s1(warn_address, was_dep);
        tmp = finish_if_stmt_cond (cond, stmt);
       }
@@ -20249,7 +20225,7 @@ tsubst_stmt (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
        {
          bool save_in_consteval_if_p = in_consteval_if_p;
          in_consteval_if_p = true;
-         RECUR (THEN_CLAUSE (t));
+         recur (THEN_CLAUSE (t));
          in_consteval_if_p = save_in_consteval_if_p;
        }
       else
@@ -20258,7 +20234,7 @@ tsubst_stmt (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
          bool inhibit = integer_zerop (folded);
          if (inhibit)
            ++c_inhibit_evaluation_warnings;
-         RECUR (THEN_CLAUSE (t));
+         recur (THEN_CLAUSE (t));
          if (inhibit)
            --c_inhibit_evaluation_warnings;
        }
@@ -20273,7 +20249,7 @@ tsubst_stmt (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
          begin_else_clause (stmt);
          if (inhibit)
            ++c_inhibit_evaluation_warnings;
-         RECUR (ELSE_CLAUSE (t));
+         recur (ELSE_CLAUSE (t));
          if (inhibit)
            --c_inhibit_evaluation_warnings;
          finish_else_clause (stmt);
@@ -20289,7 +20265,7 @@ tsubst_stmt (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
        stmt = begin_compound_stmt (BIND_EXPR_TRY_BLOCK (t)
                                    ? BCS_TRY_BLOCK : 0);
 
-      RECUR (BIND_EXPR_BODY (t));
+      recur (BIND_EXPR_BODY (t));
 
       if (BIND_EXPR_BODY_BLOCK (t))
        finish_function_body (stmt);
@@ -20307,17 +20283,17 @@ tsubst_stmt (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
 
     case SWITCH_STMT:
       stmt = begin_switch_stmt ();
-      tmp = RECUR (SWITCH_STMT_COND (t));
+      tmp = recur (SWITCH_STMT_COND (t));
       finish_switch_cond (tmp, stmt);
-      RECUR (SWITCH_STMT_BODY (t));
+      recur (SWITCH_STMT_BODY (t));
       finish_switch_stmt (stmt);
       break;
 
     case CASE_LABEL_EXPR:
       {
        tree decl = CASE_LABEL (t);
-       tree low = RECUR (CASE_LOW (t));
-       tree high = RECUR (CASE_HIGH (t));
+       tree low = recur (CASE_LOW (t));
+       tree high = recur (CASE_HIGH (t));
        tree l = finish_case_label (EXPR_LOCATION (t), low, high);
        if (l && TREE_CODE (l) == CASE_LABEL_EXPR)
          {
@@ -20349,7 +20325,7 @@ tsubst_stmt (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
        /* Computed goto's must be tsubst'd into.  On the other hand,
           non-computed gotos must not be; the identifier in question
           will have no binding.  */
-       tmp = RECUR (tmp);
+       tmp = recur (tmp);
       else
        tmp = DECL_NAME (tmp);
       finish_goto_stmt (tmp);
@@ -20357,7 +20333,7 @@ tsubst_stmt (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
 
     case ASM_EXPR:
       {
-       tree string = RECUR (ASM_STRING (t));
+       tree string = recur (ASM_STRING (t));
        tree outputs = tsubst_copy_asm_operands (ASM_OUTPUTS (t), args,
                                                 complain, in_decl);
        tree inputs = tsubst_copy_asm_operands (ASM_INPUTS (t), args,
@@ -20383,9 +20359,9 @@ tsubst_stmt (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
       if (CLEANUP_P (t))
        {
          stmt = begin_try_block ();
-         RECUR (TRY_STMTS (t));
+         recur (TRY_STMTS (t));
          finish_cleanup_try_block (stmt);
-         finish_cleanup (RECUR (TRY_HANDLERS (t)), stmt);
+         finish_cleanup (recur (TRY_HANDLERS (t)), stmt);
        }
       else
        {
@@ -20396,14 +20372,14 @@ tsubst_stmt (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
          else
            stmt = begin_try_block ();
 
-         RECUR (TRY_STMTS (t));
+         recur (TRY_STMTS (t));
 
          if (FN_TRY_BLOCK_P (t))
            finish_function_try_block (stmt);
          else
            finish_try_block (stmt);
 
-         RECUR (TRY_HANDLERS (t));
+         recur (TRY_HANDLERS (t));
          if (FN_TRY_BLOCK_P (t))
            finish_function_handler_sequence (stmt, compound_stmt);
          else
@@ -20426,7 +20402,7 @@ tsubst_stmt (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
          }
        stmt = begin_handler ();
        finish_handler_parms (decl, stmt);
-       RECUR (HANDLER_BODY (t));
+       recur (HANDLER_BODY (t));
        finish_handler (stmt);
       }
       break;
@@ -20489,7 +20465,7 @@ tsubst_stmt (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
       tmp = tsubst_omp_clauses (OMP_CLAUSES (t), C_ORT_ACC_TARGET, args,
                                complain, in_decl);
       stmt = begin_omp_parallel ();
-      RECUR (OMP_BODY (t));
+      recur (OMP_BODY (t));
       finish_omp_construct (TREE_CODE (t), stmt, tmp);
       break;
 
@@ -20500,7 +20476,7 @@ tsubst_stmt (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
       if (OMP_PARALLEL_COMBINED (t))
        omp_parallel_combined_clauses = &tmp;
       stmt = begin_omp_parallel ();
-      RECUR (OMP_PARALLEL_BODY (t));
+      recur (OMP_PARALLEL_BODY (t));
       gcc_assert (omp_parallel_combined_clauses == NULL);
       OMP_PARALLEL_COMBINED (finish_omp_parallel (tmp, stmt))
        = OMP_PARALLEL_COMBINED (t);
@@ -20521,7 +20497,7 @@ tsubst_stmt (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
       tmp = tsubst_omp_clauses (OMP_TASK_CLAUSES (t), C_ORT_OMP, args,
                                complain, in_decl);
       stmt = begin_omp_task ();
-      RECUR (OMP_TASK_BODY (t));
+      recur (OMP_TASK_BODY (t));
       finish_omp_task (tmp, stmt);
       pop_omp_privatization_clauses (r);
       break;
@@ -20563,7 +20539,7 @@ tsubst_stmt (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
        stmt = begin_omp_structured_block ();
 
        pre_body = push_stmt_list ();
-       RECUR (OMP_FOR_PRE_BODY (t));
+       recur (OMP_FOR_PRE_BODY (t));
        pre_body = pop_stmt_list (pre_body);
 
        if (OMP_FOR_INIT (t) != NULL_TREE)
@@ -20600,7 +20576,7 @@ tsubst_stmt (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
          }
        else
          body = push_stmt_list ();
-       RECUR (OMP_FOR_BODY (t));
+       recur (OMP_FOR_BODY (t));
        if (any_range_for)
          body = finish_omp_structured_block (body);
        else
@@ -20660,13 +20636,13 @@ tsubst_stmt (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
        {
          keep_next_level (true);
          stmt = begin_omp_structured_block ();
-         RECUR (OMP_BODY (t));
+         recur (OMP_BODY (t));
          stmt = finish_omp_structured_block (stmt);
        }
       else
        {
          stmt = push_stmt_list ();
-         RECUR (OMP_BODY (t));
+         recur (OMP_BODY (t));
          stmt = pop_stmt_list (stmt);
        }
 
@@ -20677,7 +20653,7 @@ tsubst_stmt (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
          error_at (OMP_CLAUSE_LOCATION (tmp),
                    "%<#pragma omp critical%> with %<hint%> clause requires "
                    "a name, except when %<omp_sync_hint_none%> is used");
-         RETURN (error_mark_node);
+         return error_mark_node;
        }
       t = copy_node (t);
       OMP_BODY (t) = stmt;
@@ -20687,7 +20663,7 @@ tsubst_stmt (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
       break;
 
     case OMP_DEPOBJ:
-      r = RECUR (OMP_DEPOBJ_DEPOBJ (t));
+      r = recur (OMP_DEPOBJ_DEPOBJ (t));
       if (OMP_DEPOBJ_CLAUSES (t) && OMP_DEPOBJ_CLAUSES (t) != error_mark_node)
        {
          enum omp_clause_depend_kind kind = OMP_CLAUSE_DEPEND_INVALID;
@@ -20724,7 +20700,7 @@ tsubst_stmt (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
       keep_next_level (true);
       stmt = begin_omp_structured_block ();
 
-      RECUR (OMP_BODY (t));
+      recur (OMP_BODY (t));
       stmt = finish_omp_structured_block (stmt);
 
       t = copy_node (t);
@@ -20806,7 +20782,7 @@ tsubst_stmt (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
       if (OMP_BODY (t))
        {
          stmt = push_stmt_list ();
-         RECUR (OMP_BODY (t));
+         recur (OMP_BODY (t));
          stmt = pop_stmt_list (stmt);
        }
       else
@@ -20824,7 +20800,7 @@ tsubst_stmt (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
       /* FALLTHRU */
     case OMP_SECTION:
       stmt = push_stmt_list ();
-      RECUR (OMP_BODY (t));
+      recur (OMP_BODY (t));
       stmt = pop_stmt_list (stmt);
 
       t = copy_node (t);
@@ -20835,7 +20811,7 @@ tsubst_stmt (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
     case OMP_DISPATCH:
       tmp = tsubst_omp_clauses (OMP_DISPATCH_CLAUSES (t), C_ORT_OMP, args,
                                complain, in_decl);
-      stmt = RECUR (OMP_DISPATCH_BODY (t));
+      stmt = recur (OMP_DISPATCH_BODY (t));
       t = copy_node (t);
       OMP_DISPATCH_BODY (t) = stmt;
       OMP_DISPATCH_CLAUSES (t) = tmp;
@@ -20856,7 +20832,7 @@ tsubst_stmt (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
          tree lhs, rhs;
          if (TREE_CODE (op1) == COMPOUND_EXPR)
            {
-             rhs1 = RECUR (TREE_OPERAND (op1, 0));
+             rhs1 = recur (TREE_OPERAND (op1, 0));
              op1 = TREE_OPERAND (op1, 1);
            }
          if (TREE_CODE (op1) == COND_EXPR)
@@ -20865,18 +20841,18 @@ tsubst_stmt (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
              tree c = TREE_OPERAND (op1, 0);
              if (TREE_CODE (c) == MODIFY_EXPR)
                {
-                 r = RECUR (TREE_OPERAND (c, 0));
+                 r = recur (TREE_OPERAND (c, 0));
                  c = TREE_OPERAND (c, 1);
                }
              gcc_assert (TREE_CODE (c) == EQ_EXPR);
-             rhs = RECUR (TREE_OPERAND (c, 1));
-             lhs = RECUR (TREE_OPERAND (op1, 2));
-             rhs1 = RECUR (TREE_OPERAND (op1, 1));
+             rhs = recur (TREE_OPERAND (c, 1));
+             lhs = recur (TREE_OPERAND (op1, 2));
+             rhs1 = recur (TREE_OPERAND (op1, 1));
            }
          else
            {
-             lhs = RECUR (TREE_OPERAND (op1, 0));
-             rhs = RECUR (TREE_OPERAND (op1, 1));
+             lhs = recur (TREE_OPERAND (op1, 0));
+             rhs = recur (TREE_OPERAND (op1, 1));
            }
          finish_omp_atomic (EXPR_LOCATION (t), OMP_ATOMIC, TREE_CODE (op1),
                             lhs, rhs, NULL_TREE, NULL_TREE, rhs1, r,
@@ -20892,18 +20868,18 @@ tsubst_stmt (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
          enum tree_code opcode = NOP_EXPR;
          if (code == OMP_ATOMIC_READ)
            {
-             v = RECUR (TREE_OPERAND (op1, 0));
-             lhs = RECUR (TREE_OPERAND (TREE_OPERAND (op1, 1), 0));
+             v = recur (TREE_OPERAND (op1, 0));
+             lhs = recur (TREE_OPERAND (TREE_OPERAND (op1, 1), 0));
            }
          else if (code == OMP_ATOMIC_CAPTURE_OLD
                   || code == OMP_ATOMIC_CAPTURE_NEW)
            {
              tree op11 = TREE_OPERAND (TREE_OPERAND (op1, 1), 1);
-             v = RECUR (TREE_OPERAND (op1, 0));
-             lhs1 = RECUR (TREE_OPERAND (TREE_OPERAND (op1, 1), 0));
+             v = recur (TREE_OPERAND (op1, 0));
+             lhs1 = recur (TREE_OPERAND (TREE_OPERAND (op1, 1), 0));
              if (TREE_CODE (op11) == COMPOUND_EXPR)
                {
-                 rhs1 = RECUR (TREE_OPERAND (op11, 0));
+                 rhs1 = recur (TREE_OPERAND (op11, 0));
                  op11 = TREE_OPERAND (op11, 1);
                }
              if (TREE_CODE (op11) == COND_EXPR)
@@ -20912,18 +20888,18 @@ tsubst_stmt (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
                  tree c = TREE_OPERAND (op11, 0);
                  if (TREE_CODE (c) == MODIFY_EXPR)
                    {
-                     r = RECUR (TREE_OPERAND (c, 0));
+                     r = recur (TREE_OPERAND (c, 0));
                      c = TREE_OPERAND (c, 1);
                    }
                  gcc_assert (TREE_CODE (c) == EQ_EXPR);
-                 rhs = RECUR (TREE_OPERAND (c, 1));
-                 lhs = RECUR (TREE_OPERAND (op11, 2));
-                 rhs1 = RECUR (TREE_OPERAND (op11, 1));
+                 rhs = recur (TREE_OPERAND (c, 1));
+                 lhs = recur (TREE_OPERAND (op11, 2));
+                 rhs1 = recur (TREE_OPERAND (op11, 1));
                }
              else
                {
-                 lhs = RECUR (TREE_OPERAND (op11, 0));
-                 rhs = RECUR (TREE_OPERAND (op11, 1));
+                 lhs = recur (TREE_OPERAND (op11, 0));
+                 rhs = recur (TREE_OPERAND (op11, 1));
                }
              opcode = TREE_CODE (op11);
              if (opcode == MODIFY_EXPR)
@@ -20932,8 +20908,8 @@ tsubst_stmt (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
          else
            {
              code = OMP_ATOMIC;
-             lhs = RECUR (TREE_OPERAND (op1, 0));
-             rhs = RECUR (TREE_OPERAND (op1, 1));
+             lhs = recur (TREE_OPERAND (op1, 0));
+             rhs = recur (TREE_OPERAND (op1, 1));
            }
          finish_omp_atomic (EXPR_LOCATION (t), code, opcode, lhs, rhs, v,
                             lhs1, rhs1, r, tmp,
@@ -20962,12 +20938,12 @@ tsubst_stmt (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
                  continue;
              }
            s = push_stmt_list ();
-           RECUR (directive);
+           recur (directive);
            directive = pop_stmt_list (s);
            if (body)
              {
                s = push_stmt_list ();
-               RECUR (body);
+               recur (body);
                body = pop_stmt_list (s);
              }
            variants
@@ -21001,7 +20977,7 @@ tsubst_stmt (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
        OMP_DECLARE_MAPPER_DECL (t) = decl;
        OMP_DECLARE_MAPPER_CLAUSES (t) = clauses;
        cp_check_omp_declare_mapper (t);
-       RETURN (t);
+       return t;
       }
 
     case TRANSACTION_EXPR:
@@ -21022,15 +20998,15 @@ tsubst_stmt (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
                body = TREE_OPERAND (body, 0);
              }
             stmt = begin_transaction_stmt (input_location, NULL, flags);
-            RECUR (body);
-            finish_transaction_stmt (stmt, NULL, flags, RECUR (noex));
+            recur (body);
+            finish_transaction_stmt (stmt, NULL, flags, recur (noex));
           }
         else
           {
             stmt = build_transaction_expr (EXPR_LOCATION (t),
-                                          RECUR (TRANSACTION_EXPR_BODY (t)),
+                                          recur (TRANSACTION_EXPR_BODY (t)),
                                           flags, NULL_TREE);
-            RETURN (stmt);
+            return stmt;
           }
       }
       break;
@@ -21045,8 +21021,8 @@ tsubst_stmt (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
 
     case MUST_NOT_THROW_EXPR:
       {
-       tree op0 = RECUR (TREE_OPERAND (t, 0));
-       tree cond = RECUR (MUST_NOT_THROW_COND (t));
+       tree op0 = recur (TREE_OPERAND (t, 0));
+       tree cond = recur (MUST_NOT_THROW_COND (t));
        stmt = build_must_not_throw_expr (op0, cond);
        if (stmt && TREE_CODE (stmt) == MUST_NOT_THROW_EXPR)
          {
@@ -21054,29 +21030,29 @@ tsubst_stmt (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
            MUST_NOT_THROW_THROW_P (stmt) = MUST_NOT_THROW_THROW_P (t);
            MUST_NOT_THROW_CATCH_P (stmt) = MUST_NOT_THROW_CATCH_P (t);
          }
-       RETURN (stmt);
+       return stmt;
       }
 
     case EXPR_PACK_EXPANSION:
       error ("invalid use of pack expansion expression");
-      RETURN (error_mark_node);
+      return error_mark_node;
 
     case NONTYPE_ARGUMENT_PACK:
       error ("use %<...%> to expand argument pack");
-      RETURN (error_mark_node);
+      return error_mark_node;
 
     case COMPOUND_EXPR:
-      tmp = RECUR (TREE_OPERAND (t, 0));
+      tmp = recur (TREE_OPERAND (t, 0));
       if (tmp == NULL_TREE)
        /* If the first operand was a statement, we're done with it.  */
-       RETURN (RECUR (TREE_OPERAND (t, 1)));
-      RETURN (build_x_compound_expr (EXPR_LOCATION (t), tmp,
-                                   RECUR (TREE_OPERAND (t, 1)),
+       return recur (TREE_OPERAND (t, 1));
+      return build_x_compound_expr (EXPR_LOCATION (t), tmp,
+                                   recur (TREE_OPERAND (t, 1)),
                                    templated_operator_saved_lookups (t),
-                                   complain));
+                                   complain);
 
     case PREDICT_EXPR:
-      RETURN (add_stmt (copy_node (t)));
+      return add_stmt (copy_node (t));
 
     case ANNOTATE_EXPR:
       {
@@ -21084,29 +21060,24 @@ tsubst_stmt (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
           WHILE_COND, DO_COND or FOR_COND expressions, which are tsubsted
           using tsubst_stmt rather than tsubst_expr and can contain
           DECL_EXPRs.  */
-       tree op1 = RECUR (TREE_OPERAND (t, 0));
+       tree op1 = recur (TREE_OPERAND (t, 0));
        tree op2 = tsubst_expr (TREE_OPERAND (t, 1), args, complain, in_decl);
        tree op3 = tsubst_expr (TREE_OPERAND (t, 2), args, complain, in_decl);
        if (TREE_CODE (op2) == INTEGER_CST
            && wi::to_widest (op2) == (int) annot_expr_unroll_kind)
          op3 = cp_check_pragma_unroll (EXPR_LOCATION (TREE_OPERAND (t, 2)),
                                        op3);
-       RETURN (build3_loc (EXPR_LOCATION (t), ANNOTATE_EXPR,
-                           TREE_TYPE (op1), op1, op2, op3));
+       return build3_loc (EXPR_LOCATION (t), ANNOTATE_EXPR,
+                           TREE_TYPE (op1), op1, op2, op3);
       }
 
     default:
       gcc_assert (!STATEMENT_CODE_P (TREE_CODE (t)));
 
-      RETURN (tsubst_expr (t, args, complain, in_decl));
+      return tsubst_expr (t, args, complain, in_decl);
     }
 
-  RETURN (NULL_TREE);
- out:
-  input_location = loc;
-  return r;
-#undef RECUR
-#undef RETURN
+  return NULL_TREE;
 }
 
 /* Instantiate the special body of the artificial DECL_OMP_DECLARE_REDUCTION
@@ -21623,17 +21594,14 @@ tsubst_call_args (tree t, tree args, tsubst_flags_t 
complain,
 tree
 tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl)
 {
-#define RETURN(EXP) do { retval = (EXP); goto out; } while(0)
-#define RECUR(NODE)                                            \
-  tsubst_expr (NODE, args, complain, in_decl)
+  auto recur = [&](tree node) { return tsubst_expr (node, args, complain, 
in_decl); };
 
-  tree retval, op1;
-  location_t save_loc;
+  tree op1;
 
   if (t == NULL_TREE || t == error_mark_node)
     return t;
 
-  save_loc = input_location;
+  auto_saved_input_location save_loc;
   if (location_t eloc = cp_expr_location (t))
     input_location = eloc;
 
@@ -21648,7 +21616,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
   complain &= ~tf_no_name_lookup;
 
   if (instantiating_tu_local_entity (t))
-    RETURN (error_mark_node);
+    return error_mark_node;
 
   if (!no_name_lookup_flag)
     if (tree d = maybe_dependent_member_ref (t, args, complain, in_decl))
@@ -21672,7 +21640,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
          }
 
        if (no_name_lookup_flag)
-         RETURN (t);
+         return t;
 
        /* Look up the name.  */
        decl = lookup_name (t);
@@ -21701,7 +21669,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
              unqualified_name_lookup_error (decl);
            decl = error_mark_node;
          }
-       RETURN (decl);
+       return decl;
       }
 
     case TEMPLATE_ID_EXPR:
@@ -21719,34 +21687,34 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
        if (targs)
          targs = tsubst_template_args (targs, args, complain, in_decl);
        if (targs == error_mark_node)
-         RETURN (error_mark_node);
+         return error_mark_node;
 
        if (TREE_CODE (templ) == SCOPE_REF)
          {
            tree name = TREE_OPERAND (templ, 1);
            tree tid = lookup_template_function (name, targs);
            TREE_OPERAND (templ, 1) = tid;
-           RETURN (templ);
+           return templ;
          }
 
        if (concept_definition_p (templ))
          {
            tree check = build_concept_check (templ, targs, complain);
            if (check == error_mark_node)
-             RETURN (error_mark_node);
-           RETURN (check);
+             return error_mark_node;
+           return check;
          }
 
        if (variable_template_p (templ))
          {
            if (no_name_lookup_flag)
-             RETURN (lookup_template_variable (templ, targs, complain));
+             return lookup_template_variable (templ, targs, complain);
 
            tree r = lookup_and_finish_template_variable (templ, targs,
                                                          complain);
            r = convert_from_reference (r);
            r = maybe_wrap_with_location (r, EXPR_LOCATION (t));
-           RETURN (r);
+           return r;
          }
 
        if (TREE_CODE (templ) == COMPONENT_REF)
@@ -21761,24 +21729,24 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
        protected_set_expr_location (tid, EXPR_LOCATION (t));
 
        if (object)
-         RETURN (build3 (COMPONENT_REF, TREE_TYPE (tid),
-                        object, tid, NULL_TREE));
+         return build3 (COMPONENT_REF, TREE_TYPE (tid),
+                        object, tid, NULL_TREE);
        else if (no_name_lookup_flag)
-         RETURN (tid);
+         return tid;
        else if (identifier_p (templ))
          {
            /* C++20 P0846: we can encounter an IDENTIFIER_NODE here when
               name lookup found nothing when parsing the template name.  */
            gcc_assert (cxx_dialect >= cxx20 || seen_error ());
-           RETURN (tid);
+           return tid;
          }
        else
-         RETURN (baselink_for_fns (tid));
+         return baselink_for_fns (tid);
       }
 
     case INDIRECT_REF:
       {
-       tree r = RECUR (TREE_OPERAND (t, 0));
+       tree r = recur (TREE_OPERAND (t, 0));
 
        if (REFERENCE_REF_P (t))
          {
@@ -21795,54 +21763,53 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
        if (REF_PARENTHESIZED_P (t))
          r = force_paren_expr (r);
 
-       RETURN (r);
+       return r;
       }
 
     case MEM_REF:
       {
-       tree op0 = RECUR (TREE_OPERAND (t, 0));
-       tree op1 = RECUR (TREE_OPERAND (t, 0));
+       tree op0 = recur (TREE_OPERAND (t, 0));
+       tree op1 = recur (TREE_OPERAND (t, 0));
        tree new_type = tsubst (TREE_TYPE (t), args, complain, in_decl);
-       RETURN (build2_loc (EXPR_LOCATION (t), MEM_REF, new_type, op0, op1));
+       return build2_loc (EXPR_LOCATION (t), MEM_REF, new_type, op0, op1);
       }
 
     case NOP_EXPR:
       {
        tree type = tsubst (TREE_TYPE (t), args, complain, in_decl);
-       tree op0 = RECUR (TREE_OPERAND (t, 0));
-       RETURN (build_nop (type, op0));
+       tree op0 = recur (TREE_OPERAND (t, 0));
+       return build_nop (type, op0);
       }
 
     case IMPLICIT_CONV_EXPR:
       {
        tree type = tsubst (TREE_TYPE (t), args, complain, in_decl);
        if (type == error_mark_node)
-         RETURN (error_mark_node);
-       tree expr = RECUR (TREE_OPERAND (t, 0));
+         return error_mark_node;
+       tree expr = recur (TREE_OPERAND (t, 0));
        if (IMPLICIT_CONV_EXPR_NONTYPE_ARG (t))
          {
            tree r = (convert_nontype_argument_maybe_dependent
                      (type, expr, IMPLICIT_CONV_EXPR_FORCED (t), complain));
            if (r == NULL_TREE)
              r = error_mark_node;
-           RETURN (r);
+           return r;
          }
        int flags = LOOKUP_IMPLICIT;
        if (IMPLICIT_CONV_EXPR_DIRECT_INIT (t))
          flags = LOOKUP_NORMAL;
        if (IMPLICIT_CONV_EXPR_BRACED_INIT (t))
          flags |= LOOKUP_NO_NARROWING;
-       RETURN (perform_implicit_conversion_flags (type, expr, complain,
-                                                 flags));
+       return perform_implicit_conversion_flags (type, expr, complain, flags);
       }
 
     case CONVERT_EXPR:
       {
        tree type = tsubst (TREE_TYPE (t), args, complain, in_decl);
-       tree op0 = RECUR (TREE_OPERAND (t, 0));
+       tree op0 = recur (TREE_OPERAND (t, 0));
        if (op0 == error_mark_node)
-         RETURN (error_mark_node);
-       RETURN (build1 (CONVERT_EXPR, type, op0));
+         return error_mark_node;
+       return build1 (CONVERT_EXPR, type, op0);
       }
 
     case CAST_EXPR:
@@ -21859,7 +21826,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
          tcomplain |= tf_tst_ok;
        type = tsubst (TREE_TYPE (t), args, tcomplain, in_decl);
 
-       op = RECUR (TREE_OPERAND (t, 0));
+       op = recur (TREE_OPERAND (t, 0));
 
        warning_sentinel s(warn_useless_cast);
        warning_sentinel s2(warn_ignored_qualifiers);
@@ -21887,35 +21854,35 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
            gcc_unreachable ();
          }
 
-       RETURN (r);
+       return r;
       }
 
     case BIT_CAST_EXPR:
       {
        tree type = tsubst (TREE_TYPE (t), args, complain, in_decl);
-       tree op0 = RECUR (TREE_OPERAND (t, 0));
-       RETURN (cp_build_bit_cast (EXPR_LOCATION (t), type, op0, complain));
+       tree op0 = recur (TREE_OPERAND (t, 0));
+       return cp_build_bit_cast (EXPR_LOCATION (t), type, op0, complain);
       }
 
     case POSTDECREMENT_EXPR:
     case POSTINCREMENT_EXPR:
       op1 = tsubst_non_call_postfix_expression (TREE_OPERAND (t, 0),
                                                args, complain, in_decl);
-      RETURN (build_x_unary_op (input_location, TREE_CODE (t), op1,
-                               templated_operator_saved_lookups (t),
-                               complain|decltype_flag));
+      return build_x_unary_op (input_location, TREE_CODE (t), op1,
+                              templated_operator_saved_lookups (t),
+                              complain|decltype_flag);
 
     case BIT_NOT_EXPR:
       if (identifier_p (TREE_OPERAND (t, 0)))
        {
          gcc_checking_assert (no_name_lookup_flag);
-         RETURN (t);
+         return t;
        }
       else if (TYPE_P (TREE_OPERAND (t, 0)))
        {
          gcc_checking_assert (no_name_lookup_flag);
          tree op0 = tsubst (TREE_OPERAND (t, 0), args, complain, in_decl);
-         RETURN (build_min_nt_loc (EXPR_LOCATION (t), BIT_NOT_EXPR, op0));
+         return build_min_nt_loc (EXPR_LOCATION (t), BIT_NOT_EXPR, op0);
        }
       /* Fall through.  */
     case PREDECREMENT_EXPR:
@@ -21926,19 +21893,19 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
     case UNARY_PLUS_EXPR:  /* Unary + */
     case REALPART_EXPR:
     case IMAGPART_EXPR:
-      RETURN (build_x_unary_op (input_location, TREE_CODE (t),
-                               RECUR (TREE_OPERAND (t, 0)),
-                               templated_operator_saved_lookups (t),
-                               complain|decltype_flag));
+      return build_x_unary_op (input_location, TREE_CODE (t),
+                              recur (TREE_OPERAND (t, 0)),
+                              templated_operator_saved_lookups (t),
+                              complain|decltype_flag);
 
     case EXCESS_PRECISION_EXPR:
       {
        tree type = tsubst (TREE_TYPE (t), args, complain, in_decl);
-       tree op0 = RECUR (TREE_OPERAND (t, 0));
+       tree op0 = recur (TREE_OPERAND (t, 0));
        if (TREE_CODE (op0) == EXCESS_PRECISION_EXPR)
-         RETURN (op0);
-       RETURN (build1_loc (EXPR_LOCATION (t), EXCESS_PRECISION_EXPR,
-                           type, op0));
+         return op0;
+       return build1_loc (EXPR_LOCATION (t), EXCESS_PRECISION_EXPR,
+                          type, op0);
       }
 
     case FIX_TRUNC_EXPR:
@@ -21948,17 +21915,17 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
     case ADDR_EXPR:
       op1 = TREE_OPERAND (t, 0);
       if (TREE_CODE (op1) == LABEL_DECL)
-       RETURN (finish_label_address_expr (DECL_NAME (op1),
-                                         EXPR_LOCATION (op1)));
+       return finish_label_address_expr (DECL_NAME (op1),
+                                         EXPR_LOCATION (op1));
       if (TREE_CODE (op1) == SCOPE_REF)
        op1 = tsubst_qualified_id (op1, args, complain, in_decl,
                                   /*done=*/true, /*address_p=*/true);
       else
        op1 = tsubst_non_call_postfix_expression (op1, args, complain,
                                                  in_decl);
-      RETURN (build_x_unary_op (input_location, ADDR_EXPR, op1,
-                               templated_operator_saved_lookups (t),
-                               complain|decltype_flag));
+      return build_x_unary_op (input_location, ADDR_EXPR, op1,
+                              templated_operator_saved_lookups (t),
+                              complain|decltype_flag);
 
     case PLUS_EXPR:
     case MINUS_EXPR:
@@ -21997,8 +21964,8 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
        tree op1 = TREE_OPERAND (t, 1);
        const bool was_dep = (dependent_operand_p (op0)
                              || dependent_operand_p (op1));
-       op0 = RECUR (op0);
-       op1 = RECUR (op1);
+       op0 = recur (op0);
+       op1 = recur (op1);
 
        warning_sentinel s1(warn_type_limits, was_dep);
        warning_sentinel s2(warn_div_by_zero, was_dep);
@@ -22022,18 +21989,18 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
        if (EXPR_P (r))
          copy_warning (r, t);
 
-       RETURN (r);
+       return r;
       }
 
     case POINTER_PLUS_EXPR:
       {
-       tree op0 = RECUR (TREE_OPERAND (t, 0));
+       tree op0 = recur (TREE_OPERAND (t, 0));
        if (op0 == error_mark_node)
-         RETURN (error_mark_node);
-       tree op1 = RECUR (TREE_OPERAND (t, 1));
+         return error_mark_node;
+       tree op1 = recur (TREE_OPERAND (t, 1));
        if (op1 == error_mark_node)
-         RETURN (error_mark_node);
-       RETURN (fold_build_pointer_plus (op0, op1));
+         return error_mark_node;
+       return fold_build_pointer_plus (op0, op1);
       }
 
     case SCOPE_REF:
@@ -22041,16 +22008,16 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
        {
          tree op0 = tsubst_scope (TREE_OPERAND (t, 0), args, complain, 
in_decl);
          tree op1 = tsubst_name (TREE_OPERAND (t, 1), args, complain, in_decl);
-         RETURN (build_qualified_name (/*type=*/NULL_TREE, op0, op1,
-                                       QUALIFIED_NAME_IS_TEMPLATE (t)));
+         return build_qualified_name (/*type=*/NULL_TREE, op0, op1,
+                                      QUALIFIED_NAME_IS_TEMPLATE (t));
        }
       else
-       RETURN (tsubst_qualified_id (t, args, complain, in_decl, /*done=*/true,
-                                   /*address_p=*/false));
+       return tsubst_qualified_id (t, args, complain, in_decl, /*done=*/true,
+                                   /*address_p=*/false);
 
     case BASELINK:
-      RETURN (tsubst_baselink (t, current_nonlambda_class_type (),
-                              args, complain, in_decl));
+      return tsubst_baselink (t, current_nonlambda_class_type (),
+                             args, complain, in_decl);
 
     case ARRAY_REF:
       op1 = tsubst_non_call_postfix_expression (TREE_OPERAND (t, 0),
@@ -22073,31 +22040,31 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
            r = grok_array_decl (EXPR_LOCATION (t), op1,
                                 NULL_TREE, &index_exp_list,
                                 complain | decltype_flag);
-         RETURN (r);
+         return r;
        }
-      RETURN (build_x_array_ref (EXPR_LOCATION (t), op1,
-                                RECUR (TREE_OPERAND (t, 1)),
-                                complain|decltype_flag));
+      return build_x_array_ref (EXPR_LOCATION (t), op1,
+                               recur (TREE_OPERAND (t, 1)),
+                               complain|decltype_flag);
 
     case OMP_ARRAY_SECTION:
       {
-       tree op0 = RECUR (TREE_OPERAND (t, 0));
+       tree op0 = recur (TREE_OPERAND (t, 0));
        tree op1 = NULL_TREE, op2 = NULL_TREE;
        if (op0 == error_mark_node)
-         RETURN (error_mark_node);
+         return error_mark_node;
        if (TREE_OPERAND (t, 1))
          {
-           op1 = RECUR (TREE_OPERAND (t, 1));
+           op1 = recur (TREE_OPERAND (t, 1));
            if (op1 == error_mark_node)
-             RETURN (error_mark_node);
+             return error_mark_node;
          }
        if (TREE_OPERAND (t, 2))
          {
-           op2 = RECUR (TREE_OPERAND (t, 2));
+           op2 = recur (TREE_OPERAND (t, 2));
            if (op2 == error_mark_node)
-             RETURN (error_mark_node);
+             return error_mark_node;
          }
-       RETURN (build_omp_array_section (EXPR_LOCATION (t), op0, op1, op2));
+       return build_omp_array_section (EXPR_LOCATION (t), op0, op1, op2);
       }
 
     case OMP_DECLARE_MAPPER:
@@ -22115,7 +22082,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
        OMP_DECLARE_MAPPER_DECL (t) = decl;
        OMP_DECLARE_MAPPER_CLAUSES (t) = clauses;
        cp_check_omp_declare_mapper (t);
-       RETURN (t);
+       return t;
       }
 
     case SIZEOF_EXPR:
@@ -22170,7 +22137,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
            }
 
          if (expanded == error_mark_node)
-           RETURN (error_mark_node);
+           return error_mark_node;
          else if (PACK_EXPANSION_P (expanded)
                   || (TREE_CODE (expanded) == TREE_VEC
                       && pack_expansion_args_count (expanded)))
@@ -22182,18 +22149,18 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
                expanded = make_argument_pack (expanded);
 
              if (TYPE_P (expanded))
-               RETURN (cxx_sizeof_or_alignof_type (input_location,
-                                                   expanded, SIZEOF_EXPR,
-                                                   false,
-                                                   complain & tf_error));
+               return cxx_sizeof_or_alignof_type (input_location,
+                                                  expanded, SIZEOF_EXPR,
+                                                  false,
+                                                  complain & tf_error);
              else
-               RETURN (cxx_sizeof_or_alignof_expr (input_location,
-                                                   expanded, SIZEOF_EXPR,
-                                                   false,
-                                                   complain & tf_error));
+               return cxx_sizeof_or_alignof_expr (input_location,
+                                                  expanded, SIZEOF_EXPR,
+                                                  false,
+                                                  complain & tf_error);
            }
          else
-           RETURN (build_int_cst (size_type_node, len));
+           return build_int_cst (size_type_node, len);
        }
       /* Fall through */
 
@@ -22251,7 +22218,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
            SET_EXPR_LOCATION (r, EXPR_LOCATION (t));
            copy_warning (r, t);
          }
-       RETURN (r);
+       return r;
       }
 
     case AT_ENCODE_EXPR:
@@ -22262,7 +22229,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
        op1 = tsubst (op1, args, complain, in_decl);
        --cp_unevaluated_operand;
        --c_inhibit_evaluation_warnings;
-       RETURN (objc_build_encode_expr (op1));
+       return objc_build_encode_expr (op1);
       }
 
     case NOEXCEPT_EXPR:
@@ -22274,13 +22241,13 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
       --cp_unevaluated_operand;
       --c_inhibit_evaluation_warnings;
       --cp_noexcept_operand;
-      RETURN (finish_noexcept_expr (op1, complain));
+      return finish_noexcept_expr (op1, complain);
 
     case MODOP_EXPR:
       {
        warning_sentinel s(warn_div_by_zero);
-       tree lhs = RECUR (TREE_OPERAND (t, 0));
-       tree rhs = RECUR (TREE_OPERAND (t, 2));
+       tree lhs = recur (TREE_OPERAND (t, 0));
+       tree rhs = recur (TREE_OPERAND (t, 2));
 
        tree r = build_x_modify_expr
          (EXPR_LOCATION (t), lhs, TREE_CODE (TREE_OPERAND (t, 1)), rhs,
@@ -22295,7 +22262,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
        if (warning_suppressed_p (t, OPT_Wparentheses))
          suppress_warning (STRIP_REFERENCE_REF (r), OPT_Wparentheses);
 
-       RETURN (r);
+       return r;
       }
 
     case ARROW_EXPR:
@@ -22304,13 +22271,13 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
       /* Remember that there was a reference to this entity.  */
       if (DECL_P (op1)
          && !mark_used (op1, complain) && !(complain & tf_error))
-       RETURN (error_mark_node);
-      RETURN (build_x_arrow (input_location, op1, complain));
+       return error_mark_node;
+      return build_x_arrow (input_location, op1, complain);
 
     case NEW_EXPR:
       {
-       tree placement = RECUR (TREE_OPERAND (t, 0));
-       tree init = RECUR (TREE_OPERAND (t, 3));
+       tree placement = recur (TREE_OPERAND (t, 0));
+       tree init = recur (TREE_OPERAND (t, 3));
        vec<tree, va_gc> *placement_vec;
        vec<tree, va_gc> *init_vec;
        tree ret;
@@ -22319,7 +22286,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
        if (placement == NULL_TREE)
          placement_vec = NULL;
        else if (placement == error_mark_node)
-         RETURN (error_mark_node);
+         return error_mark_node;
        else
          {
            placement_vec = make_tree_vector ();
@@ -22336,7 +22303,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
        if (init == NULL_TREE && TREE_OPERAND (t, 3) == NULL_TREE)
          init_vec = NULL;
        else if (init == error_mark_node)
-         RETURN (error_mark_node);
+         return error_mark_node;
        else
          {
            init_vec = make_tree_vector ();
@@ -22353,7 +22320,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
        in_decl = NULL_TREE;
 
        tree op1 = tsubst (TREE_OPERAND (t, 1), args, complain, in_decl);
-       tree op2 = RECUR (TREE_OPERAND (t, 2));
+       tree op2 = recur (TREE_OPERAND (t, 2));
        ret = build_new (loc, &placement_vec, op1, op2,
                         &init_vec, NEW_EXPR_USE_GLOBAL (t),
                         complain);
@@ -22363,28 +22330,28 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
        if (init_vec != NULL)
          release_tree_vector (init_vec);
 
-       RETURN (ret);
+       return ret;
       }
 
     case DELETE_EXPR:
       {
-       tree op0 = RECUR (TREE_OPERAND (t, 0));
-       tree op1 = RECUR (TREE_OPERAND (t, 1));
-       RETURN (delete_sanity (input_location, op0, op1,
-                              DELETE_EXPR_USE_VEC (t),
-                              DELETE_EXPR_USE_GLOBAL (t),
-                              complain));
+       tree op0 = recur (TREE_OPERAND (t, 0));
+       tree op1 = recur (TREE_OPERAND (t, 1));
+       return delete_sanity (input_location, op0, op1,
+                             DELETE_EXPR_USE_VEC (t),
+                             DELETE_EXPR_USE_GLOBAL (t),
+                             complain);
       }
 
     case COMPOUND_EXPR:
       {
        tree op0 = tsubst_expr (TREE_OPERAND (t, 0), args,
                                complain & ~tf_decltype, in_decl);
-       RETURN (build_x_compound_expr (EXPR_LOCATION (t),
-                                      op0,
-                                      RECUR (TREE_OPERAND (t, 1)),
-                                      templated_operator_saved_lookups (t),
-                                      complain|decltype_flag));
+       return build_x_compound_expr (EXPR_LOCATION (t),
+                                     op0,
+                                     recur (TREE_OPERAND (t, 1)),
+                                     templated_operator_saved_lookups (t),
+                                     complain|decltype_flag);
       }
 
     case CALL_EXPR:
@@ -22398,7 +22365,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
        function = CALL_EXPR_FN (t);
        /* Internal function with no arguments.  */
        if (function == NULL_TREE && call_expr_nargs (t) == 0)
-         RETURN (t);
+         return t;
 
        /* When we parsed the expression, we determined whether or
           not Koenig lookup should be performed.  */
@@ -22432,7 +22399,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
              }
            else
              ret = build_int_cst (integer_type_node, type_to_class (type));
-           RETURN (ret);
+           return ret;
          }
        else if (koenig_p
                 && (identifier_p (function)
@@ -22532,7 +22499,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
            if (CLASS_TYPE_P (TREE_TYPE (ret)))
              CALL_EXPR_RETURN_SLOT_OPT (ret) = true;
 
-           RETURN (ret);
+           return ret;
          }
 
        /* We do not perform argument-dependent lookup if normal
@@ -22572,7 +22539,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
                   context.  */
                tree unq = tsubst_expr (function, args, complain, in_decl);
                if (unq == error_mark_node)
-                 RETURN (error_mark_node);
+                 return error_mark_node;
 
                if (unq != function)
                  {
@@ -22629,7 +22596,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
                                  "%qD declared here, later in the "
                                  "translation unit", fn);
                        if (strict)
-                         RETURN (error_mark_node);
+                         return error_mark_node;
                      }
 
                    function = unq;
@@ -22639,7 +22606,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
              {
                if (complain & tf_error)
                  unqualified_name_lookup_error (function);
-               RETURN (error_mark_node);
+               return error_mark_node;
              }
          }
 
@@ -22647,7 +22614,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
        if (function != NULL_TREE
            && DECL_P (function)
            && !mark_used (function, complain) && !(complain & tf_error))
-         RETURN (error_mark_node);
+         return error_mark_node;
 
        if (!maybe_fold_fn_template_args (function, complain))
          return error_mark_node;
@@ -22687,7 +22654,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
                                                  complain, in_decl),
                                          complain);
              if (TREE_CODE (ret) == VIEW_CONVERT_EXPR)
-               RETURN (ret);
+               return ret;
              break;
 
            case IFN_SHUFFLEVECTOR:
@@ -22695,7 +22662,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
                ret = build_x_shufflevector (input_location, call_args,
                                             complain);
                if (ret != error_mark_node)
-                 RETURN (ret);
+                 return ret;
                break;
              }
 
@@ -22706,7 +22673,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
                                                  CALL_EXPR_IFN (t), call_args,
                                                  complain);
                if (ret != error_mark_node)
-                 RETURN (ret);
+                 return ret;
                break;
              }
 
@@ -22730,7 +22697,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
                      break;
                    }
                  ret = build_assume_call (EXPR_LOCATION (t), arg);
-                 RETURN (ret);
+                 return ret;
                }
              break;
 
@@ -22739,7 +22706,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
                                                  IFN_GOMP_DISPATCH,
                                                  TREE_TYPE (call_args[0]), 1,
                                                  call_args[0]);
-             RETURN (ret);
+             return ret;
              break;
 
            default:
@@ -22808,12 +22775,12 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
              suppress_warning (ret, OPT_Wpessimizing_move);
          }
 
-       RETURN (ret);
+       return ret;
       }
 
     case COND_EXPR:
       {
-       tree cond = RECUR (TREE_OPERAND (t, 0));
+       tree cond = recur (TREE_OPERAND (t, 0));
        cond = mark_rvalue_use (cond);
        tree folded_cond = fold_non_dependent_expr (cond, complain);
        tree exp1, exp2;
@@ -22823,41 +22790,41 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
            if (integer_zerop (folded_cond))
              {
                ++c_inhibit_evaluation_warnings;
-               exp1 = RECUR (TREE_OPERAND (t, 1));
+               exp1 = recur (TREE_OPERAND (t, 1));
                --c_inhibit_evaluation_warnings;
-               exp2 = RECUR (TREE_OPERAND (t, 2));
+               exp2 = recur (TREE_OPERAND (t, 2));
              }
            else
              {
-               exp1 = RECUR (TREE_OPERAND (t, 1));
+               exp1 = recur (TREE_OPERAND (t, 1));
                ++c_inhibit_evaluation_warnings;
-               exp2 = RECUR (TREE_OPERAND (t, 2));
+               exp2 = recur (TREE_OPERAND (t, 2));
                --c_inhibit_evaluation_warnings;
              }
            cond = folded_cond;
          }
        else
          {
-           exp1 = RECUR (TREE_OPERAND (t, 1));
-           exp2 = RECUR (TREE_OPERAND (t, 2));
+           exp1 = recur (TREE_OPERAND (t, 1));
+           exp2 = recur (TREE_OPERAND (t, 2));
          }
 
        warning_sentinel s(warn_duplicated_branches);
-       RETURN (build_x_conditional_expr (EXPR_LOCATION (t),
-                                        cond, exp1, exp2, complain));
+       return build_x_conditional_expr (EXPR_LOCATION (t),
+                                        cond, exp1, exp2, complain);
       }
 
     case PSEUDO_DTOR_EXPR:
       {
-       tree op0 = RECUR (TREE_OPERAND (t, 0));
-       tree op1 = RECUR (TREE_OPERAND (t, 1));
+       tree op0 = recur (TREE_OPERAND (t, 0));
+       tree op1 = recur (TREE_OPERAND (t, 1));
        tree op2 = tsubst (TREE_OPERAND (t, 2), args, complain, in_decl);
-       RETURN (finish_pseudo_destructor_expr (op0, op1, op2,
-                                              input_location, complain));
+       return finish_pseudo_destructor_expr (op0, op1, op2,
+                                             input_location, complain);
       }
 
     case TREE_LIST:
-      RETURN (tsubst_tree_list (t, args, complain, in_decl));
+      return tsubst_tree_list (t, args, complain, in_decl);
 
     case COMPONENT_REF:
       {
@@ -22871,7 +22838,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
        /* Remember that there was a reference to this entity.  */
        if (DECL_P (object)
            && !mark_used (object, complain) && !(complain & tf_error))
-         RETURN (error_mark_node);
+         return error_mark_node;
        object_type = TREE_TYPE (object);
 
        member = TREE_OPERAND (t, 1);
@@ -22893,13 +22860,13 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
        else
          member = tsubst_name (member, args, complain, in_decl);
        if (member == error_mark_node)
-         RETURN (error_mark_node);
+         return error_mark_node;
 
        if (object_type && TYPE_PTRMEMFUNC_P (object_type)
            && TREE_CODE (member) == FIELD_DECL)
          {
            r = build_ptrmemfunc_access_expr (object, DECL_NAME (member));
-           RETURN (r);
+           return r;
          }
        else if (TREE_CODE (member) == FIELD_DECL)
          {
@@ -22914,7 +22881,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
            pop_deferring_access_checks ();
            if (REF_PARENTHESIZED_P (t))
              r = force_paren_expr (r);
-           RETURN (r);
+           return r;
          }
        else if (type_dependent_expression_p (object))
          /* We can't do much here.  */;
@@ -22934,8 +22901,8 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
                  {
                    dtor = TREE_OPERAND (dtor, 0);
                    if (TYPE_P (dtor))
-                     RETURN (finish_pseudo_destructor_expr
-                             (object, s, dtor, input_location, complain));
+                     return finish_pseudo_destructor_expr
+                             (object, s, dtor, input_location, complain);
                  }
              }
          }
@@ -22963,7 +22930,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
              {
                qualified_name_lookup_error (scope, tmpl, member,
                                             input_location);
-               RETURN (error_mark_node);
+               return error_mark_node;
              }
          }
        else if (TREE_CODE (member) == SCOPE_REF
@@ -22979,7 +22946,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
                  error ("%qD is not a class or namespace",
                         TREE_OPERAND (member, 0));
              }
-           RETURN (error_mark_node);
+           return error_mark_node;
          }
        else if (splice_p && BASELINK_P (member))
          /* We need to call adjust_result_of_qualified_name_lookup when
@@ -22994,12 +22961,12 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
                                             COMPONENT_REF_SPLICE_P (t));
        if (REF_PARENTHESIZED_P (t))
          r = force_paren_expr (r);
-       RETURN (r);
+       return r;
       }
 
     case THROW_EXPR:
-      RETURN (build_throw
-       (input_location, RECUR (TREE_OPERAND (t, 0)), complain));
+      return build_throw
+       (input_location, recur (TREE_OPERAND (t, 0)), complain);
 
     case CONSTRUCTOR:
       {
@@ -23016,7 +22983,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
          tcomplain |= tf_tst_ok;
        tree type = tsubst (TREE_TYPE (t), args, tcomplain, in_decl);
        if (type == error_mark_node)
-         RETURN (error_mark_node);
+         return error_mark_node;
 
        /* We do not want to process the index of aggregate
           initializers as they are identifier nodes which will be
@@ -23026,7 +22993,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
        if (null_member_pointer_value_p (t))
          {
            gcc_assert (same_type_p (type, TREE_TYPE (t)));
-           RETURN (t);
+           return t;
          }
 
        n = vec_safe_copy (CONSTRUCTOR_ELTS (t));
@@ -23037,7 +23004,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
                /* An identifier index is looked up in the type
                   being initialized, not the current scope.  */
                && TREE_CODE (ce->index) != IDENTIFIER_NODE)
-             ce->index = RECUR (ce->index);
+             ce->index = recur (ce->index);
 
             if (PACK_EXPANSION_P (ce->value))
               {
@@ -23061,7 +23028,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
                   }
               }
             else
-              ce->value = RECUR (ce->value);
+              ce->value = recur (ce->value);
          }
 
         if (need_copy_p)
@@ -23093,11 +23060,11 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
            fcl_t cl = fcl_functional;
            if (CONSTRUCTOR_C99_COMPOUND_LITERAL (t))
              cl = fcl_c99;
-           RETURN (finish_compound_literal (type, r, complain, cl));
+           return finish_compound_literal (type, r, complain, cl);
          }
 
        TREE_TYPE (r) = type;
-       RETURN (r);
+       return r;
       }
 
     case TYPEID_EXPR:
@@ -23106,7 +23073,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
        if (TYPE_P (operand_0))
          {
            operand_0 = tsubst (operand_0, args, complain, in_decl);
-           RETURN (get_typeid (operand_0, complain, TREE_TYPE (t)));
+           return get_typeid (operand_0, complain, TREE_TYPE (t));
          }
        else
          {
@@ -23118,17 +23085,17 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
            tree uneval;
            {
              cp_unevaluated u (/* typeid_operand= */ true);
-             uneval = RECUR (operand_0);
+             uneval = recur (operand_0);
            }
            /* If we're already within an unevaluated operand, everything
               in the subtree stays not potentially evaluated regardless
               of [expr.typeid]/4 ([basic.def.odr]/3), so the evaluated
               re-parse below can have nothing to do; skip it.  */
            if (!cp_unevaluated_operand && typeid_evaluated_p (uneval))
-             operand = RECUR (operand_0);
+             operand = recur (operand_0);
            else
              operand = uneval;
-           RETURN (build_typeid (operand, complain, TREE_TYPE (t)));
+           return build_typeid (operand, complain, TREE_TYPE (t));
          }
       }
 
@@ -23136,7 +23103,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
     case PARM_DECL:
     case VAR_DECL:
       if (!args)
-       RETURN (t);
+       return t;
       tree r;
       if (VAR_OR_FUNCTION_DECL_P (t)
          && DECL_LANG_SPECIFIC (t) && DECL_TEMPLATE_INFO (t))
@@ -23164,12 +23131,12 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
              /* We get here for a use of 'this' in an NSDMI.  */
              if (DECL_NAME (t) == this_identifier && current_class_ptr
                  && !LAMBDA_TYPE_P (TREE_TYPE (TREE_TYPE (current_class_ptr))))
-               RETURN (current_class_ptr);
+               return current_class_ptr;
 
              /* Parameters of non-templates map to themselves (e.g. in
                 expansion statement body).  */
              if (DECL_CONTEXT (t) && !uses_template_parms (DECL_CONTEXT (t)))
-               RETURN (t);
+               return t;
 
              /* This can happen for a parameter name used later in a function
                 declaration (such as in a late-specified return type).  Just
@@ -23194,7 +23161,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
                         even an OVERLOAD: just bail out and avoid ICEs and
                         duplicate diagnostics (c++/62207).  */
                      gcc_assert (seen_error ());
-                     RETURN (error_mark_node);
+                     return error_mark_node;
                    }
                  if (!is_capture_proxy (r))
                    {
@@ -23254,7 +23221,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
       else
        r = t;
       if (!mark_used (r, complain))
-       RETURN (error_mark_node);
+       return error_mark_node;
 
       if (!no_name_lookup_flag
          && (TREE_CODE (t) == PARM_DECL || TREE_CODE (t) == VAR_DECL))
@@ -23272,7 +23239,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
               the appropriate INDIRECT_REF.  */
            r = convert_from_reference (r);
        }
-      RETURN (r);
+      return r;
 
     case CONST_DECL:
       {
@@ -23280,9 +23247,9 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
        tree v;
 
        if (DECL_TEMPLATE_PARM_P (t))
-         RETURN (RECUR (DECL_INITIAL (t)));
+         return recur (DECL_INITIAL (t));
        if (!args || !uses_template_parms (DECL_CONTEXT (t)))
-         RETURN (t);
+         return t;
 
        /* Unfortunately, we cannot just call lookup_name here.
           Consider:
@@ -23300,13 +23267,13 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
             v != NULL_TREE;
             v = TREE_CHAIN (v))
          if (TREE_PURPOSE (v) == DECL_NAME (t))
-           RETURN (TREE_VALUE (v));
+           return TREE_VALUE (v);
 
          /* We didn't find the name.  That should never happen; if
             name-lookup found it during preliminary parsing, we
             should find it again here during instantiation.  */
        gcc_unreachable ();
-       RETURN (t);
+       return t;
       }
 
     case FIELD_DECL:
@@ -23323,26 +23290,26 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
                {
                  if (complain & tf_error)
                    error ("using invalid field %qD", t);
-                 RETURN (error_mark_node);
+                 return error_mark_node;
                }
-             RETURN (r);
+             return r;
            }
        }
-      RETURN (t);
+      return t;
 
     case OVERLOAD:
       if (modules_p ())
        for (tree ovl : lkp_range (t))
          if (instantiating_tu_local_entity (ovl))
-           RETURN (error_mark_node);
-      RETURN (t);
+           return error_mark_node;
+      return t;
 
     case TEMPLATE_DECL:
       if (DECL_TEMPLATE_TEMPLATE_PARM_P (t))
-       RETURN (tsubst (TREE_TYPE (DECL_TEMPLATE_RESULT (t)),
-                       args, complain, in_decl));
+       return tsubst (TREE_TYPE (DECL_TEMPLATE_RESULT (t)),
+                      args, complain, in_decl);
       else if (DECL_FUNCTION_TEMPLATE_P (t) && DECL_MEMBER_TEMPLATE_P (t))
-       RETURN (tsubst (t, args, complain, in_decl));
+       return tsubst (t, args, complain, in_decl);
       else if (DECL_CLASS_SCOPE_P (t)
               && uses_template_parms (DECL_CONTEXT (t)))
        {
@@ -23363,15 +23330,15 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
 
          tree context = tsubst_entering_scope (DECL_CONTEXT (t), args,
                                                complain, in_decl);
-         RETURN (lookup_field (context, DECL_NAME(t), 0, false));
+         return lookup_field (context, DECL_NAME(t), 0, false);
        }
       else
        /* Ordinary template template argument.  */
-       RETURN (t);
+       return t;
 
     case TEMPLATE_PARM_INDEX:
     case TYPE_DECL:
-      RETURN (tsubst (t, args, complain, in_decl));
+      return tsubst (t, args, complain, in_decl);
 
     case CLEANUP_POINT_EXPR:
       /* We shouldn't have built any of these during initial template
@@ -23390,31 +23357,31 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
           template is represented as a DOTSTAR_EXPR.  */
        gcc_checking_assert
          (same_type_p (TREE_TYPE (t), TREE_TYPE (TREE_OPERAND (t, 1))));
-       tree op0 = RECUR (TREE_OPERAND (t, 0));
-       tree op1 = RECUR (TREE_OPERAND (t, 1));
+       tree op0 = recur (TREE_OPERAND (t, 0));
+       tree op1 = recur (TREE_OPERAND (t, 1));
        tree type = TREE_TYPE (op1);
        r = build2 (OFFSET_REF, type, op0, op1);
        PTRMEM_OK_P (r) = PTRMEM_OK_P (t);
        if (!mark_used (op1, complain)
            && !(complain & tf_error))
-         RETURN (error_mark_node);
-       RETURN (r);
+         return error_mark_node;
+       return r;
       }
 
     case PACK_INDEX_EXPR:
-      RETURN (tsubst_pack_index (t, args, complain, in_decl));
+      return tsubst_pack_index (t, args, complain, in_decl);
 
     case EXPR_PACK_EXPANSION:
       error ("invalid use of pack expansion expression");
-      RETURN (error_mark_node);
+      return error_mark_node;
 
     case NONTYPE_ARGUMENT_PACK:
       error ("use %<...%> to expand argument pack");
-      RETURN (error_mark_node);
+      return error_mark_node;
 
     case VOID_CST:
       gcc_checking_assert (t == void_node && VOID_TYPE_P (TREE_TYPE (t)));
-      RETURN (t);
+      return t;
 
     case INTEGER_CST:
     case REAL_CST:
@@ -23425,7 +23392,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
        tree type = tsubst (TREE_TYPE (t), args, complain, in_decl);
        r = fold_convert (type, t);
        gcc_assert (TREE_CODE (r) == TREE_CODE (t));
-       RETURN (r);
+       return r;
       }
 
     case STRING_CST:
@@ -23437,7 +23404,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
            r = copy_node (t);
            TREE_TYPE (r) = type;
          }
-       RETURN (r);
+       return r;
       }
 
     case RAW_DATA_CST:
@@ -23445,59 +23412,59 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
        tree type = tsubst (TREE_TYPE (t), args, complain, in_decl);
        r = copy_node (t);
        TREE_TYPE (r) = type;
-       RETURN (r);
+       return r;
       }
 
     case PTRMEM_CST:
       /* These can sometimes show up in a partial instantiation, but never
         involve template parms.  */
       gcc_assert (!uses_template_parms (t));
-      RETURN (t);
+      return t;
 
     case UNARY_LEFT_FOLD_EXPR:
-      RETURN (tsubst_unary_left_fold (t, args, complain, in_decl));
+      return tsubst_unary_left_fold (t, args, complain, in_decl);
     case UNARY_RIGHT_FOLD_EXPR:
-      RETURN (tsubst_unary_right_fold (t, args, complain, in_decl));
+      return tsubst_unary_right_fold (t, args, complain, in_decl);
     case BINARY_LEFT_FOLD_EXPR:
-      RETURN (tsubst_binary_left_fold (t, args, complain, in_decl));
+      return tsubst_binary_left_fold (t, args, complain, in_decl);
     case BINARY_RIGHT_FOLD_EXPR:
-      RETURN (tsubst_binary_right_fold (t, args, complain, in_decl));
+      return tsubst_binary_right_fold (t, args, complain, in_decl);
     case PREDICT_EXPR:
-      RETURN (t);
+      return t;
 
     case DEBUG_BEGIN_STMT:
       /* ??? There's no point in copying it for now, but maybe some
         day it will contain more information, such as a pointer back
         to the containing function, inlined copy or so.  */
-      RETURN (t);
+      return t;
 
     case CO_YIELD_EXPR:
-      RETURN (finish_co_yield_expr (input_location,
-                                   RECUR (TREE_OPERAND (t, 0))));
+      return finish_co_yield_expr (input_location,
+                                   recur (TREE_OPERAND (t, 0)));
 
     case CO_AWAIT_EXPR:
-      RETURN (finish_co_await_expr (input_location,
-                                   RECUR (TREE_OPERAND (t, 0))));
+      return finish_co_await_expr (input_location,
+                                   recur (TREE_OPERAND (t, 0)));
 
     case VA_ARG_EXPR:
       {
-       tree op0 = RECUR (TREE_OPERAND (t, 0));
+       tree op0 = recur (TREE_OPERAND (t, 0));
        tree type = tsubst (TREE_TYPE (t), args, complain, in_decl);
-       RETURN (build_x_va_arg (EXPR_LOCATION (t), op0, type));
+       return build_x_va_arg (EXPR_LOCATION (t), op0, type);
       }
 
     case OFFSETOF_EXPR:
       {
        tree object_ptr
          = tsubst_expr (TREE_OPERAND (t, 1), args, complain, in_decl);
-       RETURN (finish_offsetof (object_ptr,
-                                RECUR (TREE_OPERAND (t, 0)),
-                                EXPR_LOCATION (t)));
+       return finish_offsetof (object_ptr,
+                               recur (TREE_OPERAND (t, 0)),
+                               EXPR_LOCATION (t));
       }
 
     case ADDRESSOF_EXPR:
-      RETURN (cp_build_addressof (EXPR_LOCATION (t),
-                                 RECUR (TREE_OPERAND (t, 0)), complain));
+      return cp_build_addressof (EXPR_LOCATION (t),
+                                recur (TREE_OPERAND (t, 0)), complain);
 
     case TRAIT_EXPR:
       {
@@ -23513,10 +23480,10 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
            && !processing_template_decl)
          /* __builtin_structured_binding_size handled separately
             to make it SFINAE friendly.  */
-         RETURN (finish_structured_binding_size (TRAIT_EXPR_LOCATION (t),
-                                                 type1, complain));
-       RETURN (finish_trait_expr (TRAIT_EXPR_LOCATION (t),
-                                  TRAIT_EXPR_KIND (t), type1, type2));
+         return finish_structured_binding_size (TRAIT_EXPR_LOCATION (t),
+                                                type1, complain);
+       return finish_trait_expr (TRAIT_EXPR_LOCATION (t),
+                                 TRAIT_EXPR_KIND (t), type1, type2);
       }
 
     case STMT_EXPR:
@@ -23534,66 +23501,66 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
        if (empty_expr_stmt_p (stmt_expr))
          stmt_expr = void_node;
 
-       RETURN (stmt_expr);
+       return stmt_expr;
       }
 
     case LAMBDA_EXPR:
       {
        tree r = tsubst_lambda_expr (t, args, complain, in_decl);
 
-       RETURN (build_lambda_object (r));
+       return build_lambda_object (r);
       }
 
     case TRANSACTION_EXPR:
       gcc_checking_assert (!TRANSACTION_EXPR_IS_STMT (t));
-      RETURN (tsubst_stmt (t, args, complain, in_decl));
+      return tsubst_stmt (t, args, complain, in_decl);
 
     case PAREN_EXPR:
       if (REF_PARENTHESIZED_P (t))
-       RETURN (finish_parenthesized_expr (RECUR (TREE_OPERAND (t, 0))));
+       return finish_parenthesized_expr (recur (TREE_OPERAND (t, 0)));
       else
        /* Recreate the PAREN_EXPR from __builtin_assoc_barrier.  */
        {
-         tree op0 = RECUR (TREE_OPERAND (t, 0));
-         RETURN (build1_loc (input_location, PAREN_EXPR,
-                             TREE_TYPE (op0), op0));
+         tree op0 = recur (TREE_OPERAND (t, 0));
+         return build1_loc (input_location, PAREN_EXPR,
+                            TREE_TYPE (op0), op0);
        }
 
     case VEC_PERM_EXPR:
       {
-       tree op0 = RECUR (TREE_OPERAND (t, 0));
-       tree op1 = RECUR (TREE_OPERAND (t, 1));
-       tree op2 = RECUR (TREE_OPERAND (t, 2));
-       RETURN (build_x_vec_perm_expr (input_location, op0, op1, op2,
-                                      complain));
+       tree op0 = recur (TREE_OPERAND (t, 0));
+       tree op1 = recur (TREE_OPERAND (t, 1));
+       tree op2 = recur (TREE_OPERAND (t, 2));
+       return build_x_vec_perm_expr (input_location, op0, op1, op2,
+                                     complain);
       }
 
     case REQUIRES_EXPR:
       {
        complain &= ~tf_warning_or_error;
        tree r = tsubst_requires_expr (t, args, complain, in_decl);
-       RETURN (r);
+       return r;
       }
 
     case RANGE_EXPR:
       /* No need to substitute further, a RANGE_EXPR will always be built
         with constant operands.  */
-      RETURN (t);
+      return t;
 
     case NON_LVALUE_EXPR:
     case VIEW_CONVERT_EXPR:
       {
-       tree op = RECUR (TREE_OPERAND (t, 0));
+       tree op = recur (TREE_OPERAND (t, 0));
 
        if (location_wrapper_p (t))
          /* We need to do this here as well as in tsubst_copy so we get the
             other tsubst_copy_and_build semantics for a PARM_DECL operand.  */
-         RETURN (maybe_wrap_with_location (op, EXPR_LOCATION (t)));
+         return maybe_wrap_with_location (op, EXPR_LOCATION (t));
 
        gcc_checking_assert (TREE_CODE (t) == VIEW_CONVERT_EXPR);
        if (REF_PARENTHESIZED_P (t))
          /* force_paren_expr can also create a VIEW_CONVERT_EXPR.  */
-         RETURN (finish_parenthesized_expr (op));
+         return finish_parenthesized_expr (op);
 
        check_param_in_postcondition (op, EXPR_LOCATION (t));
 
@@ -23621,7 +23588,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
                 another TEMPLATE_PARM_INDEX).  */
              op = build1 (VIEW_CONVERT_EXPR, type, op);
          }
-       RETURN (op);
+       return op;
       }
 
     case REFLECT_EXPR:
@@ -23647,30 +23614,24 @@ tsubst_expr (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
            /* [expr.reflect] The id-expression of a reflect-expression is
               an unevaluated operand.  */
            cp_unevaluated u;
-           h = RECUR (h);
+           h = recur (h);
          }
-       RETURN (get_reflection (EXPR_LOCATION (t), h, kind));
+       return get_reflection (EXPR_LOCATION (t), h, kind);
       }
 
     case SPLICE_EXPR:
-      RETURN (tsubst_splice_expr (t, args, complain, in_decl));
+      return tsubst_splice_expr (t, args, complain, in_decl);
 
     default:
       /* Handle Objective-C++ constructs, if appropriate.  */
       if (tree subst = objcp_tsubst_expr (t, args, complain, in_decl))
-       RETURN (subst);
+       return subst;
 
       /* We shouldn't get here, but keep going if !flag_checking.  */
       if (flag_checking)
        gcc_unreachable ();
-      RETURN (t);
+      return t;
     }
-
-#undef RECUR
-#undef RETURN
- out:
-  input_location = save_loc;
-  return retval;
 }
 
 /* Verify that the instantiated ARGS are valid. For type arguments,
diff --git a/gcc/input.h b/gcc/input.h
index f6aeff9db37..d0a76d0a18f 100644
--- a/gcc/input.h
+++ b/gcc/input.h
@@ -85,6 +85,24 @@ extern location_t expansion_point_location (location_t);
 
 extern location_t input_location;
 
+/* RAII class to temporarily override input_location. */
+class auto_saved_input_location
+{
+ public:
+  auto_saved_input_location()
+  {
+    m_saved_input_location = input_location;
+  }
+  ~auto_saved_input_location()
+  {
+    input_location = m_saved_input_location;
+  }
+  auto_saved_input_location(auto_saved_input_location&&) = delete;
+
+ private:
+  location_t m_saved_input_location;
+};
+
 extern location_t location_with_discriminator (location_t, int);
 extern bool has_discriminator (location_t);
 extern int get_discriminator_from_loc (location_t);
-- 
2.56.0

Reply via email to