]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++: attribute duplication [PR116954]
authorJason Merrill <jason@redhat.com>
Thu, 24 Apr 2025 09:15:01 +0000 (05:15 -0400)
committerJason Merrill <jason@redhat.com>
Thu, 24 Apr 2025 16:01:24 +0000 (12:01 -0400)
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.

gcc/cp/contracts.cc

index 3ca2102e86633e814fce4222f9564b980407b69f..d0cfd2efd552647a873397ce14af0d7d3b1ad4ae 100644 (file)
@@ -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))