From: Jonny Grant <jg@jguk.org>
To: gcc-patches@gcc.gnu.org
Subject: Bugzilla 88860 - Clarify gcc online manual attribute format printf example
Date: Mon, 26 Dec 2022 21:04:31 +0000 [thread overview]
Message-ID: <750917f3-555a-a5b8-9d55-261b0883153f@jguk.org> (raw)
2022-12-26 Jonathan Grant <jg@jguk.org>
* gcc/doc/extend.texi: Bugzilla 88860 - Add attribute format printf example
From 1668dc58206428ee92ff142bafb5f545dba029ae Mon Sep 17 00:00:00 2001
From: Jonathan Grant <jg@jguk.org>
Date: Mon, 26 Dec 2022 21:02:35 +0000
Subject: [PATCH] Bugzilla 88860 - Clarify gcc online manual attribute format
printf example
Signed-off-by: Jonathan Grant <jg@jguk.org>
---
gcc/doc/extend.texi | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 88fc625050b..9b200c6f3a0 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -9353,6 +9353,13 @@ __attribute__((noreturn)) void d0 (void),
the @code{noreturn} attribute applies to all the functions
declared; the @code{format} attribute only applies to @code{d1}.
+@noindent
+The following __attribute__ causes gcc to check run printf argument checks on argument '3' which is 'const char * string format' (when visible at compile time), against argument '4' the '...' variadic ellipsis. In the example below, arguments '1' and '2' are not checked.
+
+@smallexample
+void string_format(const char * prefix, size_t line, const char * const format, ...) __attribute__ ((format (printf,3,4)));
+@end smallexample
+
An attribute specifier list may appear immediately before the comma,
@code{=} or semicolon terminating the declaration of an identifier other
than a function definition. Such attribute specifiers apply
--
2.37.2
reply other threads:[~2022-12-26 21:04 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=750917f3-555a-a5b8-9d55-261b0883153f@jguk.org \
--to=jg@jguk.org \
--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).