diff options
author | Martin Sebor <msebor@redhat.com> | 2018-10-12 01:42:08 +0000 |
---|---|---|
committer | Martin Sebor <msebor@gcc.gnu.org> | 2018-10-11 19:42:08 -0600 |
commit | bf142d157096d4a5eb3e327ae7e4ffed7147d7b8 (patch) | |
tree | c31a5128fa84154ce79529f9a01772580c51a541 /gcc | |
parent | ccd20ab69148e4be14f0fa23aabae3c16e9fee46 (diff) | |
download | gcc-bf142d157096d4a5eb3e327ae7e4ffed7147d7b8.zip gcc-bf142d157096d4a5eb3e327ae7e4ffed7147d7b8.tar.gz gcc-bf142d157096d4a5eb3e327ae7e4ffed7147d7b8.tar.bz2 |
PR middle-end/87593 - conflicting format_arg attributes on a declaration accepted
gcc/ChangeLog:
* doc/extend.texi (attribute format_arg): Discuss using multiple
attributes on a single function.
From-SVN: r265073
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/doc/extend.texi | 14 |
2 files changed, 17 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 307d64a..de3f30c7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-10-11 Martin Sebor <msebor@redhat.com> + + PR middle-end/87593 + * doc/extend.texi (attribute format_arg): Discuss using multiple + attributes on a single function. + 2018-10-11 Giuliano Belinassi <giuliano.belinassi@usp.br> PR tree-optimization/86829 diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 0d9b99f..47a987f 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -2698,13 +2698,15 @@ Target Machines}. @item format_arg (@var{string-index}) @cindex @code{format_arg} function attribute @opindex Wformat-nonliteral -The @code{format_arg} attribute specifies that a function takes a format -string for a @code{printf}, @code{scanf}, @code{strftime} or +The @code{format_arg} attribute specifies that a function takes one or +more format strings for a @code{printf}, @code{scanf}, @code{strftime} or @code{strfmon} style function and modifies it (for example, to translate it into another language), so the result can be passed to a @code{printf}, @code{scanf}, @code{strftime} or @code{strfmon} style function (with the remaining arguments to the format function the same -as they would have been for the unmodified string). For example, the +as they would have been for the unmodified string). Multiple +@code{format_arg} attributes may be applied to the same function, each +designating a distinct parameter as a format string. For example, the declaration: @smallexample @@ -2724,6 +2726,12 @@ string argument is not constant; this would generate a warning when @option{-Wformat-nonliteral} is used, but the calls could not be checked without the attribute. +In calls to a function declared with more than one @code{format_arg} +attribute, each with a distinct argument value, the corresponding +actual function arguments are checked against all format strings +designated by the attributes. This capability is designed to support +the GNU @code{ngettext} family of functions. + The parameter @var{string-index} specifies which argument is the format string argument (starting from one). Since non-static C++ methods have an implicit @code{this} argument, the arguments of such methods should |