public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Sandra Loosemore <sandra@codesourcery.com>
To: <gcc-patches@gcc.gnu.org>
Subject: [COMMITTED] More precise documentation for cleanup attribute [PR110029]
Date: Thu, 18 Jan 2024 19:11:51 -0700	[thread overview]
Message-ID: <20240119021151.2801615-1-sandra@codesourcery.com> (raw)

gcc/ChangeLog
	PR c/110029
	* doc/extend.texi (Common Variable Attributes): Explain what
	happens when multiple variables with cleanups are in the same scope.
---
 gcc/doc/extend.texi | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 616e26d47dc..0bc586d120e 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -7782,6 +7782,11 @@ with static storage duration.  The function must take one parameter,
 a pointer to a type compatible with the variable.  The return value
 of the function (if any) is ignored.
 
+When multiple variables in the same scope have @code{cleanup}
+attributes, at exit from the scope their associated cleanup functions
+are run in reverse order of definition (last defined, first
+cleanup).
+
 If @option{-fexceptions} is enabled, then @var{cleanup_function}
 is run during the stack unwinding that happens during the
 processing of the exception.  Note that the @code{cleanup} attribute
-- 
2.31.1


                 reply	other threads:[~2024-01-19  2:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240119021151.2801615-1-sandra@codesourcery.com \
    --to=sandra@codesourcery.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).