diff options
Diffstat (limited to 'gcc/cp/contracts.cc')
-rw-r--r-- | gcc/cp/contracts.cc | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/gcc/cp/contracts.cc b/gcc/cp/contracts.cc index f2b126c..042524d 100644 --- a/gcc/cp/contracts.cc +++ b/gcc/cp/contracts.cc @@ -159,7 +159,7 @@ bool valid_configs[CCS_MAYBE + 1][CCS_MAYBE + 1] = { { 0, 1, 0, 0, 1, }, }; -void +static void validate_contract_role (contract_role *role) { gcc_assert (role); @@ -171,7 +171,7 @@ validate_contract_role (contract_role *role) "the %<default%> semantic"); } -contract_semantic +static contract_semantic lookup_concrete_semantic (const char *name) { if (strcmp (name, "ignore") == 0) @@ -210,7 +210,9 @@ role_name_equal (contract_role *role, const char *name) return role_name_equal (role->name, name); } -contract_role * +static void setup_default_contract_role (bool update = true); + +static contract_role * get_contract_role (const char *name) { for (int i = 0; i < max_custom_roles; ++i) @@ -227,12 +229,12 @@ get_contract_role (const char *name) return NULL; } -contract_role * +static contract_role * add_contract_role (const char *name, contract_semantic des, contract_semantic aus, contract_semantic axs, - bool update) + bool update = true) { for (int i = 0; i < max_custom_roles; ++i) { @@ -271,7 +273,7 @@ get_concrete_axiom_semantic () return flag_contract_assumption_mode ? CCS_ASSUME : CCS_IGNORE; } -void +static void setup_default_contract_role (bool update) { contract_semantic check = get_concrete_check (); @@ -491,6 +493,14 @@ handle_OPT_fcontract_semantic_ (const char *arg) validate_contract_role (role); } +/* Returns the default role. */ + +static contract_role * +get_default_contract_role () +{ + return get_contract_role ("default"); +} + /* Convert a contract CONFIG into a contract_mode. */ static contract_mode @@ -860,10 +870,17 @@ cp_contract_assertion_p (const_tree attr) void remove_contract_attributes (tree fndecl) { + if (!flag_contracts) + return; + tree list = NULL_TREE; for (tree p = DECL_ATTRIBUTES (fndecl); p; p = TREE_CHAIN (p)) if (!cxx_contract_attribute_p (p)) - list = tree_cons (TREE_PURPOSE (p), TREE_VALUE (p), list); + { + tree nl = copy_node (p); + TREE_CHAIN (nl) = list; + list = nl; + } DECL_ATTRIBUTES (fndecl) = nreverse (list); } |