This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/39438] Can't compile a wrapper around strftime with -Werror=format-nonliteral
- From: "tss at iki dot fi" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 10 Jan 2012 20:38:44 +0000
- Subject: [Bug c/39438] Can't compile a wrapper around strftime with -Werror=format-nonliteral
- Auto-submitted: auto-generated
- References: <bug-39438-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39438
Timo Sirainen <tss at iki dot fi> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tss at iki dot fi
--- Comment #3 from Timo Sirainen <tss at iki dot fi> 2012-01-10 20:38:44 UTC ---
I ran into this as well. I tried two ways, neither of which works with strftime
(both work with printf):
static void __attribute__((format (strftime, 1, 0)))
test1(const char *fmt, const struct tm *tm)
{
char buf[100];
strftime(buf, sizeof(buf), fmt, tm);
}
static const char *__attribute__((format_arg (1)))
helper(const char *fmt)
{
return fmt;
}
static void
test2(const char *fmt, const struct tm *tm)
{
char buf[100];
strftime(buf, sizeof(buf), helper(fmt), tm);
}