public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Jason Merrill <jason@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/c++-contracts] c++: move contracts init to contracts.cc Date: Fri, 21 Oct 2022 01:23:57 +0000 (GMT) [thread overview] Message-ID: <20221021012357.3398F3858425@sourceware.org> (raw) https://gcc.gnu.org/g:de497a4f4b03e13c7a1084491de7afcc923f90f1 commit de497a4f4b03e13c7a1084491de7afcc923f90f1 Author: Jason Merrill <jason@redhat.com> Date: Tue Oct 18 16:56:06 2022 -0400 c++: move contracts init to contracts.cc gcc/cp/ChangeLog: * cp-tree.h (init_contract_processing): Declare. * decl.cc (cxx_init_decl_processing): Call it. * contracts.cc (init_contract_processing): Move from... * except.cc (init_exception_processing): ...here. Diff: --- gcc/cp/cp-tree.h | 1 + gcc/cp/contracts.cc | 23 +++++++++++++++++++++++ gcc/cp/decl.cc | 3 +++ gcc/cp/except.cc | 16 ---------------- 4 files changed, 27 insertions(+), 16 deletions(-) diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 29d49466525..f011231acb3 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -7751,6 +7751,7 @@ enum contract_matching_context cmc_override }; +extern void init_contract_processing (); extern tree invalidate_contract (tree); extern tree make_postcondition_variable (cp_expr); extern tree make_postcondition_variable (cp_expr, tree); diff --git a/gcc/cp/contracts.cc b/gcc/cp/contracts.cc index b1cf2875ce4..0bc8305570d 100644 --- a/gcc/cp/contracts.cc +++ b/gcc/cp/contracts.cc @@ -1967,4 +1967,27 @@ apply_postcondition_to_return (tree expr) return call; } +/* Set up built-ins for contracts. */ + +void +init_contract_processing (void) +{ + /* std::contract_violation */ + tree tmp = build_function_type_list (integer_type_node, + boolean_type_node, + integer_type_node, + const_string_type_node, + const_string_type_node, + const_string_type_node, + const_string_type_node, + const_string_type_node, + integer_type_node, + NULL_TREE); + on_contract_violation_fn = + build_cp_library_fn_ptr ("__on_contract_violation", tmp, ECF_COLD); + on_contract_violation_never_fn = + build_cp_library_fn_ptr ("__on_contract_violation", tmp, + ECF_COLD | ECF_NORETURN); +} + #include "gt-cp-contracts.h" diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc index 1384358d079..edd57ee5d23 100644 --- a/gcc/cp/decl.cc +++ b/gcc/cp/decl.cc @@ -5025,6 +5025,9 @@ cxx_init_decl_processing (void) if (flag_exceptions) init_exception_processing (); + if (flag_contracts) + init_contract_processing (); + if (modules_p ()) init_modules (parse_in); diff --git a/gcc/cp/except.cc b/gcc/cp/except.cc index c5636b5d53a..2677a9b7678 100644 --- a/gcc/cp/except.cc +++ b/gcc/cp/except.cc @@ -60,22 +60,6 @@ init_exception_processing (void) && TREE_NOTHROW (terminate_fn)); pop_nested_namespace (std_node); - tmp = build_function_type_list (integer_type_node, - boolean_type_node, - integer_type_node, - const_string_type_node, - const_string_type_node, - const_string_type_node, - const_string_type_node, - const_string_type_node, - integer_type_node, - NULL_TREE); - on_contract_violation_fn = - build_cp_library_fn_ptr ("__on_contract_violation", tmp, ECF_COLD); - on_contract_violation_never_fn = - build_cp_library_fn_ptr ("__on_contract_violation", tmp, - ECF_COLD | ECF_NORETURN); - /* void __cxa_call_unexpected(void *); */ tmp = build_function_type_list (void_type_node, ptr_type_node, NULL_TREE); call_unexpected_fn
reply other threads:[~2022-10-21 1:23 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20221021012357.3398F3858425@sourceware.org \ --to=jason@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).