aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2025-04-24 05:15:01 -0400
committerJason Merrill <jason@redhat.com>2025-04-24 12:01:24 -0400
commit3e448005c51320801c0e2fa6ddf577da51cec7c7 (patch)
treecb92923b669327d3cd2846fbd6e3941c9c9d8af1 /gcc
parentfa61afef18a8566d1907a5ae0e7754e1eac207d9 (diff)
downloadgcc-3e448005c51320801c0e2fa6ddf577da51cec7c7.zip
gcc-3e448005c51320801c0e2fa6ddf577da51cec7c7.tar.gz
gcc-3e448005c51320801c0e2fa6ddf577da51cec7c7.tar.bz2
c++: attribute duplication [PR116954]
As a followup to the previous patch for 116954, there's no reason to do anything in remove_contract_attributes if contracts aren't enabled. PR c++/116954 gcc/cp/ChangeLog: * contracts.cc (remove_contract_attributes): Return early if not enabled.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/contracts.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/cp/contracts.cc b/gcc/cp/contracts.cc
index 3ca2102..d0cfd2e 100644
--- a/gcc/cp/contracts.cc
+++ b/gcc/cp/contracts.cc
@@ -860,6 +860,9 @@ 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))