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.
This commit is contained in:
Philip Withnall 2016-11-09 15:11:53 +00:00
parent 1f36189aa5
commit d8acf9b956

View File

@ -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.
*/
/**