public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/c++-contracts] remove remove_contracts_from_specialization
@ 2022-11-04 14:08 Jason Merrill
0 siblings, 0 replies; only message in thread
From: Jason Merrill @ 2022-11-04 14:08 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:43ff4caa5cc32475a4a7411e2e454fbc1626a4cf
commit 43ff4caa5cc32475a4a7411e2e454fbc1626a4cf
Author: Jason Merrill <jason@redhat.com>
Date: Thu Nov 3 21:16:50 2022 -0400
remove remove_contracts_from_specialization
Diff:
---
gcc/cp/pt.cc | 31 +++----------------------------
1 file changed, 3 insertions(+), 28 deletions(-)
diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
index 4b7dae821cf..633a040e4ab 100644
--- a/gcc/cp/pt.cc
+++ b/gcc/cp/pt.cc
@@ -2754,31 +2754,6 @@ warn_spec_missing_attributes (tree tmpl, tree spec, tree attrlist)
pp_formatted_text (&str));
}
-/* Rebuild the attribute list for DECL so that it excludes contracts.
-
- The function register_specialization() has a tendency to copy attributes
- from the template being specialized. However, declared specializations can
- have contracts unrelated to the more general template. */
-
-static void
-remove_contracts_from_specialization (tree decl)
-{
- if (decl == error_mark_node)
- return;
-
- if (TREE_CODE (decl) == TEMPLATE_DECL)
- decl = DECL_TEMPLATE_RESULT (decl);
-
- tree p = NULL_TREE;
- for (tree a = DECL_ATTRIBUTES (decl); a; a = TREE_CHAIN (a))
- {
- if (!cxx_contract_attribute_p (a))
- p = tree_cons (TREE_PURPOSE (a), TREE_VALUE (a), p);
- }
- nreverse (p);
- DECL_ATTRIBUTES (decl) = p;
-}
-
/* Check to see if the function just declared, as indicated in
DECLARATOR, and in DECL, is a specialization of a function
template. We may also discover that the declaration is an explicit
@@ -3197,7 +3172,7 @@ check_explicit_specialization (tree declarator,
}
decl = register_specialization (tmpl, gen_tmpl, targs,
is_friend, 0);
- remove_contracts_from_specialization (decl);
+ remove_contract_attributes (result);
return decl;
}
@@ -3301,7 +3276,7 @@ check_explicit_specialization (tree declarator,
/* If this is a specialization, splice any contracts that may have
been inherited from the template, removing them. */
if (decl != error_mark_node && DECL_TEMPLATE_SPECIALIZATION (decl))
- remove_contracts_from_specialization (decl);
+ remove_contract_attributes (decl);
/* A 'structor should already have clones. */
gcc_assert (decl == error_mark_node
@@ -26373,7 +26348,7 @@ regenerate_decl_from_template (tree decl, tree tmpl, tree args)
tree tmpl = DECL_TI_TEMPLATE (decl);
if (DECL_TEMPLATE_SPECIALIZATION (tmpl))
{
- remove_contracts_from_specialization (decl);
+ remove_contract_attributes (decl);
copy_contract_attributes (decl, code_pattern);
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-11-04 14:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-04 14:08 [gcc/devel/c++-contracts] remove remove_contracts_from_specialization Jason Merrill
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).