[glib] gmacros: Clarify G_GNUC_[PRINTF|SCANF] macro documentation
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] gmacros: Clarify G_GNUC_[PRINTF|SCANF] macro documentation
- Date: Wed, 9 Nov 2016 15:13:06 +0000 (UTC)
commit d8acf9b956e23143f6463d7a632699d4a7761f4e
Author: Philip Withnall <philip withnall collabora co uk>
Date: Wed Nov 9 15:11:53 2016 +0000
gmacros: Clarify G_GNUC_[PRINTF|SCANF] macro documentation
Clarify that the arguments parameter can be zero if the function being
annotated just accepts a string format argument, and no varargs for it
(for example, if it takes a va_list of arguments instead).
Add some links to the GCC documentation for the `format` attribute.
glib/docs.c | 18 ++++++++++++------
1 files changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/glib/docs.c b/glib/docs.c
index 781869d..5ac7354 100644
--- a/glib/docs.c
+++ b/glib/docs.c
@@ -2237,8 +2237,9 @@
/**
* G_GNUC_PRINTF:
* @format_idx: the index of the argument corresponding to the
- * format string (The arguments are numbered from 1)
- * @arg_idx: the index of the first of the format arguments
+ * format string (the arguments are numbered from 1)
+ * @arg_idx: the index of the first of the format arguments, or 0 if
+ * there are no format arguments
*
* Expands to the GNU C format function attribute if the compiler is gcc.
* This is used for declaring functions which take a variable number of
@@ -2248,7 +2249,9 @@
* Place the attribute after the function declaration, just before the
* semicolon.
*
- * See the GNU C documentation for more details.
+ * See the
+ * [GNU C
documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-Wformat-3288)
+ * for more details.
*
* |[<!-- language="C" -->
* gint g_snprintf (gchar *string,
@@ -2261,15 +2264,18 @@
/**
* G_GNUC_SCANF:
* @format_idx: the index of the argument corresponding to
- * the format string (The arguments are numbered from 1)
- * @arg_idx: the index of the first of the format arguments
+ * the format string (the arguments are numbered from 1)
+ * @arg_idx: the index of the first of the format arguments, or 0 if
+ * there are no format arguments
*
* Expands to the GNU C format function attribute if the compiler is gcc.
* This is used for declaring functions which take a variable number of
* arguments, with the same syntax as scanf(). It allows the compiler
* to type-check the arguments passed to the function.
*
- * See the GNU C documentation for details.
+ * See the
+ * [GNU C
documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-Wformat-3288)
+ * for details.
*/
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]