diff mbox series

c++: Remove CHECK_CONSTR

Message ID Zp7E0vVFcxi067tb@tucnak
State New
Headers show
Series c++: Remove CHECK_CONSTR | expand

Commit Message

Jakub Jelinek July 22, 2024, 8:45 p.m. UTC
Hi!

On Mon, Jul 22, 2024 at 11:48:51AM -0400, Patrick Palka wrote:
> FWIW this tree code seems to be a vestige of the initial Concepts TS
> implementation and is effectively unused, we can remove it outright.

Here is a patch which removes that.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2024-07-22  Jakub Jelinek  <jakub@redhat.com>

	* cp-tree.def (CHECK_CONSTR): Remove.
	* cp-tree.h (CHECK_CONSTR_CONCEPT, CHECK_CONSTR_ARGS): Remove.
	* cp-objcp-common.cc (cp_common_init_ts): Don't handle CHECK_CONSTR.
	* tree.cc (cp_tree_equal): Likewise.
	* error.cc (dump_expr): Likewise.
	* cxx-pretty-print.cc (cxx_pretty_printer::expression): Likewise.
	(pp_cxx_check_constraint): Remove.
	(pp_cxx_constraint): Don't handle CHECK_CONSTR.



	Jakub

Comments

Jason Merrill July 22, 2024, 10:11 p.m. UTC | #1
On 7/22/24 4:45 PM, Jakub Jelinek wrote:
> Hi!
> 
> On Mon, Jul 22, 2024 at 11:48:51AM -0400, Patrick Palka wrote:
>> FWIW this tree code seems to be a vestige of the initial Concepts TS
>> implementation and is effectively unused, we can remove it outright.
> 
> Here is a patch which removes that.
> 
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

OK.

> 2024-07-22  Jakub Jelinek  <jakub@redhat.com>
> 
> 	* cp-tree.def (CHECK_CONSTR): Remove.
> 	* cp-tree.h (CHECK_CONSTR_CONCEPT, CHECK_CONSTR_ARGS): Remove.
> 	* cp-objcp-common.cc (cp_common_init_ts): Don't handle CHECK_CONSTR.
> 	* tree.cc (cp_tree_equal): Likewise.
> 	* error.cc (dump_expr): Likewise.
> 	* cxx-pretty-print.cc (cxx_pretty_printer::expression): Likewise.
> 	(pp_cxx_check_constraint): Remove.
> 	(pp_cxx_constraint): Don't handle CHECK_CONSTR.
> 
> --- gcc/cp/cp-tree.def.jj	2024-07-22 19:47:05.203574999 +0200
> +++ gcc/cp/cp-tree.def	2024-07-22 19:53:09.732019421 +0200
> @@ -538,14 +538,6 @@ DEFTREECODE (ATOMIC_CONSTR, "atomic_cons
>   DEFTREECODE (CONJ_CONSTR, "conj_constr", tcc_expression, 2)
>   DEFTREECODE (DISJ_CONSTR, "disj_constr", tcc_expression, 2)
>   
> -/* A check constraint represents the checking of a concept
> -   C. It has two operands: the template defining the concept
> -   and a sequence of template arguments.
> -
> -   CHECK_CONSTR_CONCEPT has the concept definition
> -   CHECK_CONSTR_ARGS are the template arguments.   */
> -DEFTREECODE (CHECK_CONSTR, "check_constr", tcc_expression, 2)
> -
>   /* The co_await expression is used to support coroutines.
>   
>     Op 0 is the cast expresssion (potentially modified by the
> --- gcc/cp/cp-tree.h.jj	2024-07-19 17:22:59.337097913 +0200
> +++ gcc/cp/cp-tree.h	2024-07-22 19:53:26.371811471 +0200
> @@ -1723,14 +1723,6 @@ check_constraint_info (tree t)
>   #define ATOMIC_CONSTR_EXPR(NODE) \
>     CONSTR_EXPR (ATOMIC_CONSTR_CHECK (NODE))
>   
> -/* The concept of a concept check. */
> -#define CHECK_CONSTR_CONCEPT(NODE) \
> -  TREE_OPERAND (TREE_CHECK (NODE, CHECK_CONSTR), 0)
> -
> -/* The template arguments of a concept check. */
> -#define CHECK_CONSTR_ARGS(NODE) \
> -  TREE_OPERAND (TREE_CHECK (NODE, CHECK_CONSTR), 1)
> -
>   /* Whether a PARM_DECL represents a local parameter in a
>      requires-expression.  */
>   #define CONSTRAINT_VAR_P(NODE) \
> --- gcc/cp/cp-objcp-common.cc.jj	2024-03-08 09:29:30.142749440 +0100
> +++ gcc/cp/cp-objcp-common.cc	2024-07-22 19:52:52.840230521 +0200
> @@ -701,7 +701,6 @@ cp_common_init_ts (void)
>     MARK_TS_EXP (UNARY_RIGHT_FOLD_EXPR);
>   
>     /* Constraints.  */
> -  MARK_TS_EXP (CHECK_CONSTR);
>     MARK_TS_EXP (COMPOUND_REQ);
>     MARK_TS_EXP (CONJ_CONSTR);
>     MARK_TS_EXP (DISJ_CONSTR);
> --- gcc/cp/tree.cc.jj	2024-07-19 17:22:59.345097812 +0200
> +++ gcc/cp/tree.cc	2024-07-22 19:55:10.048515803 +0200
> @@ -4116,11 +4116,6 @@ cp_tree_equal (tree t1, tree t2)
>         return cp_tree_equal (CI_ASSOCIATED_CONSTRAINTS (t1),
>                               CI_ASSOCIATED_CONSTRAINTS (t2));
>   
> -    case CHECK_CONSTR:
> -      return (CHECK_CONSTR_CONCEPT (t1) == CHECK_CONSTR_CONCEPT (t2)
> -              && comp_template_args (CHECK_CONSTR_ARGS (t1),
> -				     CHECK_CONSTR_ARGS (t2)));
> -
>       case TREE_VEC:
>         /* These are template args.  Really we should be getting the
>   	 caller to do this as it knows it to be true.  */
> --- gcc/cp/error.cc.jj	2024-07-18 09:20:31.683542931 +0200
> +++ gcc/cp/error.cc	2024-07-22 19:54:52.860730603 +0200
> @@ -3095,7 +3095,6 @@ dump_expr (cxx_pretty_printer *pp, tree
>         break;
>   
>       case ATOMIC_CONSTR:
> -    case CHECK_CONSTR:
>       case CONJ_CONSTR:
>       case DISJ_CONSTR:
>         {
> --- gcc/cp/cxx-pretty-print.cc.jj	2024-06-14 19:45:07.918797635 +0200
> +++ gcc/cp/cxx-pretty-print.cc	2024-07-22 19:53:58.374411535 +0200
> @@ -1257,7 +1257,6 @@ cxx_pretty_printer::expression (tree t)
>         break;
>   
>       case ATOMIC_CONSTR:
> -    case CHECK_CONSTR:
>       case CONJ_CONSTR:
>       case DISJ_CONSTR:
>         pp_cxx_constraint (this, t);
> @@ -2815,29 +2814,6 @@ pp_cxx_nested_requirement (cxx_pretty_pr
>     pp_cxx_semicolon (pp);
>   }
>   
> -void
> -pp_cxx_check_constraint (cxx_pretty_printer *pp, tree t)
> -{
> -  tree decl = CHECK_CONSTR_CONCEPT (t);
> -  tree tmpl = DECL_TI_TEMPLATE (decl);
> -  tree args = CHECK_CONSTR_ARGS (t);
> -  tree id = build_nt (TEMPLATE_ID_EXPR, tmpl, args);
> -
> -  if (TREE_CODE (decl) == CONCEPT_DECL)
> -    pp->expression (id);
> -  else if (VAR_P (decl))
> -    pp->expression (id);
> -  else if (TREE_CODE (decl) == FUNCTION_DECL)
> -    {
> -      tree call = build_vl_exp (CALL_EXPR, 2);
> -      TREE_OPERAND (call, 0) = integer_two_node;
> -      TREE_OPERAND (call, 1) = id;
> -      pp->expression (call);
> -    }
> -  else
> -    gcc_unreachable ();
> -}
> -
>   /* Output the "[with ...]" clause for a parameter mapping of an atomic
>      constraint.   */
>   
> @@ -2917,10 +2893,6 @@ pp_cxx_constraint (cxx_pretty_printer *p
>         pp_cxx_atomic_constraint (pp, t);
>         break;
>   
> -    case CHECK_CONSTR:
> -      pp_cxx_check_constraint (pp, t);
> -      break;
> -
>       case CONJ_CONSTR:
>         pp_cxx_conjunction (pp, t);
>         break;
> 
> 
> 	Jakub
>
diff mbox series

Patch

--- gcc/cp/cp-tree.def.jj	2024-07-22 19:47:05.203574999 +0200
+++ gcc/cp/cp-tree.def	2024-07-22 19:53:09.732019421 +0200
@@ -538,14 +538,6 @@  DEFTREECODE (ATOMIC_CONSTR, "atomic_cons
 DEFTREECODE (CONJ_CONSTR, "conj_constr", tcc_expression, 2)
 DEFTREECODE (DISJ_CONSTR, "disj_constr", tcc_expression, 2)
 
-/* A check constraint represents the checking of a concept
-   C. It has two operands: the template defining the concept
-   and a sequence of template arguments.
-
-   CHECK_CONSTR_CONCEPT has the concept definition
-   CHECK_CONSTR_ARGS are the template arguments.   */
-DEFTREECODE (CHECK_CONSTR, "check_constr", tcc_expression, 2)
-
 /* The co_await expression is used to support coroutines.
 
   Op 0 is the cast expresssion (potentially modified by the
--- gcc/cp/cp-tree.h.jj	2024-07-19 17:22:59.337097913 +0200
+++ gcc/cp/cp-tree.h	2024-07-22 19:53:26.371811471 +0200
@@ -1723,14 +1723,6 @@  check_constraint_info (tree t)
 #define ATOMIC_CONSTR_EXPR(NODE) \
   CONSTR_EXPR (ATOMIC_CONSTR_CHECK (NODE))
 
-/* The concept of a concept check. */
-#define CHECK_CONSTR_CONCEPT(NODE) \
-  TREE_OPERAND (TREE_CHECK (NODE, CHECK_CONSTR), 0)
-
-/* The template arguments of a concept check. */
-#define CHECK_CONSTR_ARGS(NODE) \
-  TREE_OPERAND (TREE_CHECK (NODE, CHECK_CONSTR), 1)
-
 /* Whether a PARM_DECL represents a local parameter in a
    requires-expression.  */
 #define CONSTRAINT_VAR_P(NODE) \
--- gcc/cp/cp-objcp-common.cc.jj	2024-03-08 09:29:30.142749440 +0100
+++ gcc/cp/cp-objcp-common.cc	2024-07-22 19:52:52.840230521 +0200
@@ -701,7 +701,6 @@  cp_common_init_ts (void)
   MARK_TS_EXP (UNARY_RIGHT_FOLD_EXPR);
 
   /* Constraints.  */
-  MARK_TS_EXP (CHECK_CONSTR);
   MARK_TS_EXP (COMPOUND_REQ);
   MARK_TS_EXP (CONJ_CONSTR);
   MARK_TS_EXP (DISJ_CONSTR);
--- gcc/cp/tree.cc.jj	2024-07-19 17:22:59.345097812 +0200
+++ gcc/cp/tree.cc	2024-07-22 19:55:10.048515803 +0200
@@ -4116,11 +4116,6 @@  cp_tree_equal (tree t1, tree t2)
       return cp_tree_equal (CI_ASSOCIATED_CONSTRAINTS (t1),
                             CI_ASSOCIATED_CONSTRAINTS (t2));
 
-    case CHECK_CONSTR:
-      return (CHECK_CONSTR_CONCEPT (t1) == CHECK_CONSTR_CONCEPT (t2)
-              && comp_template_args (CHECK_CONSTR_ARGS (t1),
-				     CHECK_CONSTR_ARGS (t2)));
-
     case TREE_VEC:
       /* These are template args.  Really we should be getting the
 	 caller to do this as it knows it to be true.  */
--- gcc/cp/error.cc.jj	2024-07-18 09:20:31.683542931 +0200
+++ gcc/cp/error.cc	2024-07-22 19:54:52.860730603 +0200
@@ -3095,7 +3095,6 @@  dump_expr (cxx_pretty_printer *pp, tree
       break;
 
     case ATOMIC_CONSTR:
-    case CHECK_CONSTR:
     case CONJ_CONSTR:
     case DISJ_CONSTR:
       {
--- gcc/cp/cxx-pretty-print.cc.jj	2024-06-14 19:45:07.918797635 +0200
+++ gcc/cp/cxx-pretty-print.cc	2024-07-22 19:53:58.374411535 +0200
@@ -1257,7 +1257,6 @@  cxx_pretty_printer::expression (tree t)
       break;
 
     case ATOMIC_CONSTR:
-    case CHECK_CONSTR:
     case CONJ_CONSTR:
     case DISJ_CONSTR:
       pp_cxx_constraint (this, t);
@@ -2815,29 +2814,6 @@  pp_cxx_nested_requirement (cxx_pretty_pr
   pp_cxx_semicolon (pp);
 }
 
-void
-pp_cxx_check_constraint (cxx_pretty_printer *pp, tree t)
-{
-  tree decl = CHECK_CONSTR_CONCEPT (t);
-  tree tmpl = DECL_TI_TEMPLATE (decl);
-  tree args = CHECK_CONSTR_ARGS (t);
-  tree id = build_nt (TEMPLATE_ID_EXPR, tmpl, args);
-
-  if (TREE_CODE (decl) == CONCEPT_DECL)
-    pp->expression (id);
-  else if (VAR_P (decl))
-    pp->expression (id);
-  else if (TREE_CODE (decl) == FUNCTION_DECL)
-    {
-      tree call = build_vl_exp (CALL_EXPR, 2);
-      TREE_OPERAND (call, 0) = integer_two_node;
-      TREE_OPERAND (call, 1) = id;
-      pp->expression (call);
-    }
-  else
-    gcc_unreachable ();
-}
-
 /* Output the "[with ...]" clause for a parameter mapping of an atomic
    constraint.   */
 
@@ -2917,10 +2893,6 @@  pp_cxx_constraint (cxx_pretty_printer *p
       pp_cxx_atomic_constraint (pp, t);
       break;
 
-    case CHECK_CONSTR:
-      pp_cxx_check_constraint (pp, t);
-      break;
-
     case CONJ_CONSTR:
       pp_cxx_conjunction (pp, t);
       break;