public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Bugzilla 88860 - Clarify gcc online manual attribute format printf example
@ 2022-12-26 21:04 Jonny Grant
  0 siblings, 0 replies; only message in thread
From: Jonny Grant @ 2022-12-26 21:04 UTC (permalink / raw)
  To: gcc-patches

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-12-26 21:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-26 21:04 Bugzilla 88860 - Clarify gcc online manual attribute format printf example Jonny Grant

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).