diff options
author | Jason Merrill <jason@redhat.com> | 2022-11-30 14:22:03 -0500 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2022-11-30 22:46:05 -0500 |
commit | 4304e09a1617bcf1c87f5bc96017ae5017379d75 (patch) | |
tree | ea3d7c8715a87b686240adfa369ba853ed536653 /gcc/cp/contracts.cc | |
parent | cda29c540037fbcf00a377196050953aab1d3d5b (diff) | |
download | gcc-4304e09a1617bcf1c87f5bc96017ae5017379d75.zip gcc-4304e09a1617bcf1c87f5bc96017ae5017379d75.tar.gz gcc-4304e09a1617bcf1c87f5bc96017ae5017379d75.tar.bz2 |
c++: small contracts fixes
The first is an actual bug: remove_contract_attributes was only keeping one
attribute. The second just helps flow analysis in optimizers and static
analyzers.
gcc/cp/ChangeLog:
* contracts.cc (remove_contract_attributes): Actually prepend
to the list.
* pt.cc (tsubst_contract): Only look for a postcondition if type is
nonnull.
Diffstat (limited to 'gcc/cp/contracts.cc')
-rw-r--r-- | gcc/cp/contracts.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/cp/contracts.cc b/gcc/cp/contracts.cc index a909701..45f52b2 100644 --- a/gcc/cp/contracts.cc +++ b/gcc/cp/contracts.cc @@ -869,7 +869,7 @@ remove_contract_attributes (tree fndecl) 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), NULL_TREE); + list = tree_cons (TREE_PURPOSE (p), TREE_VALUE (p), list); DECL_ATTRIBUTES (fndecl) = nreverse (list); } |