public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "tss at iki dot fi" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/39438] Can't compile a wrapper around strftime with -Werror=format-nonliteral
Date: Tue, 10 Jan 2012 20:39:00 -0000	[thread overview]
Message-ID: <bug-39438-4-5YuTUiSfLU@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <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);
}


       reply	other threads:[~2012-01-10 20:39 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-39438-4@http.gcc.gnu.org/bugzilla/>
2012-01-10 20:39 ` tss at iki dot fi [this message]
2014-05-10 16:47 ` hugh at mimosa dot com
2014-05-12 12:26 ` manu at gcc dot gnu.org
2014-05-12 14:58 ` hugh at mimosa dot com
2014-05-12 15:38 ` manu at gcc dot gnu.org
2014-05-12 15:52 ` manu at gcc dot gnu.org
2014-05-12 19:33 ` hugh at mimosa dot com
2015-02-27 16:43 ` manu at gcc dot gnu.org
2024-06-03  1:48 ` peter0x44 at disroot dot org
2009-03-11 22:57 [Bug c/39438] New: " 4tmuelle at informatik dot uni-hamburg dot de
2009-03-12  9:40 ` [Bug c/39438] " rguenth at gcc dot gnu dot org
2009-03-12  9:58 ` 4tmuelle at informatik dot uni-hamburg dot de

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-39438-4-5YuTUiSfLU@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).