public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/28492] -Wmissing-format-attribute causes warning for vsnprintf()
[not found] <bug-28492-4@http.gcc.gnu.org/bugzilla/>
@ 2012-04-17 22:19 ` manu at gcc dot gnu.org
2024-01-09 13:23 ` [Bug c/28492] -Wmissing-format-attribute points to vsnprintf() or related functions instead of the function that needs the attribute added manu at gcc dot gnu.org
2024-06-21 22:50 ` [Bug c/28492] -Wsuggest-attribute=format " egallager at gcc dot gnu.org
2 siblings, 0 replies; 5+ messages in thread
From: manu at gcc dot gnu.org @ 2012-04-17 22:19 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28492
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |diagnostic
Status|UNCONFIRMED |NEW
Last reconfirmed| |2012-04-17
CC| |manu at gcc dot gnu.org
Ever Confirmed|0 |1
--- Comment #3 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-04-17 22:17:01 UTC ---
OK, I see that the warning is misleading, because it points to the call of
vsnprintf instead of pointing to vsnprintf_one.
ttest.c: In function ‘vsnprintf_one’:
ttest.c:826:5: warning: function might be possible candidate for ‘gnu_printf’
format attribute [-Wmissing-format-attribute]
vsnprintf(self, 2, "%c", arglist);
^
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/28492] -Wmissing-format-attribute points to vsnprintf() or related functions instead of the function that needs the attribute added
[not found] <bug-28492-4@http.gcc.gnu.org/bugzilla/>
2012-04-17 22:19 ` [Bug c/28492] -Wmissing-format-attribute causes warning for vsnprintf() manu at gcc dot gnu.org
@ 2024-01-09 13:23 ` manu at gcc dot gnu.org
2024-06-21 22:50 ` [Bug c/28492] -Wsuggest-attribute=format " egallager at gcc dot gnu.org
2 siblings, 0 replies; 5+ messages in thread
From: manu at gcc dot gnu.org @ 2024-01-09 13:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=28492
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed|2012-04-17 00:00:00 |2024-1-9
--- Comment #6 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
The option is called now -Wsuggest-attribute=format
See also https://gcc.gnu.org/pipermail/gcc/2024-January/243120.html for a
real-world case.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/28492] -Wsuggest-attribute=format points to vsnprintf() or related functions instead of the function that needs the attribute added
[not found] <bug-28492-4@http.gcc.gnu.org/bugzilla/>
2012-04-17 22:19 ` [Bug c/28492] -Wmissing-format-attribute causes warning for vsnprintf() manu at gcc dot gnu.org
2024-01-09 13:23 ` [Bug c/28492] -Wmissing-format-attribute points to vsnprintf() or related functions instead of the function that needs the attribute added manu at gcc dot gnu.org
@ 2024-06-21 22:50 ` egallager at gcc dot gnu.org
2 siblings, 0 replies; 5+ messages in thread
From: egallager at gcc dot gnu.org @ 2024-06-21 22:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=28492
Eric Gallager <egallager at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|-Wmissing-format-attribute |-Wsuggest-attribute=format
|points to vsnprintf() or |points to vsnprintf() or
|related functions instead |related functions instead
|of the function that needs |of the function that needs
|the attribute added |the attribute added
--- Comment #7 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to Manuel López-Ibáñez from comment #6)
> The option is called now -Wsuggest-attribute=format
OK, I fixed this part of the title now, too
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/28492] -Wmissing-format-attribute causes warning for vsnprintf()
2006-07-26 13:39 [Bug c/28492] New: -Wmissing-format-attribute causes warning for vsnprintf() llundin at eso dot org
2007-01-13 18:40 ` [Bug c/28492] " h dot b dot furuseth at usit dot uio dot no
@ 2010-04-04 15:08 ` bernard dot van dot duijnen at oracle dot com
1 sibling, 0 replies; 5+ messages in thread
From: bernard dot van dot duijnen at oracle dot com @ 2010-04-04 15:08 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from bernard dot van dot duijnen at oracle dot com 2010-04-04 15:08 -------
The message may be unclear, but is in itself correct.
Your function vsnprintf_one needs an annotation because
its first argument is a format string that can be checked itself
to be a valid format. As there are no arguments to compare to, the
first-to-check should be zero.
static void vsnprintf_one(char *self, va_list arglist)
__attribute__ ((format (printf, 1, 0)));
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28492
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/28492] -Wmissing-format-attribute causes warning for vsnprintf()
2006-07-26 13:39 [Bug c/28492] New: -Wmissing-format-attribute causes warning for vsnprintf() llundin at eso dot org
@ 2007-01-13 18:40 ` h dot b dot furuseth at usit dot uio dot no
2010-04-04 15:08 ` bernard dot van dot duijnen at oracle dot com
1 sibling, 0 replies; 5+ messages in thread
From: h dot b dot furuseth at usit dot uio dot no @ 2007-01-13 18:40 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from h dot b dot furuseth at usit dot uio dot no 2007-01-13 18:40 -------
The warning is a bit misleading,
"function might be possible candidate for 'printf' format attribute"
means the _calling_ function might be such a candidate, not the function
being called on the line it warns about.
The warning is still spurious in this case though, and gcc could tell that:
A function cannot be such a candidate if it has a prototype without variable
arguments. Here is another example of such a spurious warning:
Hallvard
--
h dot b dot furuseth at usit dot uio dot no changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |h dot b dot furuseth at usit
| |dot uio dot no
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28492
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-06-21 22:50 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-28492-4@http.gcc.gnu.org/bugzilla/>
2012-04-17 22:19 ` [Bug c/28492] -Wmissing-format-attribute causes warning for vsnprintf() manu at gcc dot gnu.org
2024-01-09 13:23 ` [Bug c/28492] -Wmissing-format-attribute points to vsnprintf() or related functions instead of the function that needs the attribute added manu at gcc dot gnu.org
2024-06-21 22:50 ` [Bug c/28492] -Wsuggest-attribute=format " egallager at gcc dot gnu.org
2006-07-26 13:39 [Bug c/28492] New: -Wmissing-format-attribute causes warning for vsnprintf() llundin at eso dot org
2007-01-13 18:40 ` [Bug c/28492] " h dot b dot furuseth at usit dot uio dot no
2010-04-04 15:08 ` bernard dot van dot duijnen at oracle dot com
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).