]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: build contract_violation object directly
authorJason Merrill <jason@redhat.com>
Thu, 27 Oct 2022 14:31:28 +0000 (10:31 -0400)
committerJason Merrill <jason@redhat.com>
Fri, 28 Oct 2022 20:36:00 +0000 (16:36 -0400)
commit6f047a4540277fe70d0fe73b2e2db24659093ec5
tree17910e7bdca9bfe3d3d3d61ae69ae4dc8419c491
parentce5faeb1f533e2cdd4b0f45f18770e0a26f05182
c++: build contract_violation object directly

The __on_contract_violation function was an awkward library dependency;
instead, let's build up a temporary contract_violation and call
handle_contract_violation directly.

gcc/cp/ChangeLog:

* cp-tree.h (enum cp_tree_index): Remove
CPTI_ON_CONTRACT_VIOLATION*, add CPTI_PSEUDO_CONTRACT_VIOLATION.
(pseudo_contract_violation_type): New.
(on_contract_violation_fn)
(on_contract_violation_never_fn): Remove.
* contracts.cc (get_pseudo_contract_violation_type): New.
(build_contract_violation): New.
(declare_handle_contract_violation): New.
  (build_contract_handler_call): Use them.
(build_contract_check): Call terminate here.
(init_contract_processing): Remove.
* decl.cc (cxx_init_decl_processing): Don't call it.

libstdc++-v3/ChangeLog:

* src/experimental/contract.cc (__on_contract_violation): Remove.
* include/experimental/contract: Remove its comment.

gcc/testsuite/ChangeLog:

* g++.dg/contracts/contracts14.C
* g++.dg/contracts/contracts15.C: Remove __on_contract_violation.
gcc/cp/contracts.cc
gcc/cp/cp-tree.h
gcc/cp/decl.cc
gcc/testsuite/g++.dg/contracts/contracts-post6.C
gcc/testsuite/g++.dg/contracts/contracts14.C
gcc/testsuite/g++.dg/contracts/contracts15.C
libstdc++-v3/include/experimental/contract
libstdc++-v3/src/experimental/contract.cc