This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Format string wrapper and -Wformat-nonliteral
- From: "Kevin P. Fleming" <kpfleming at digium dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Sat, 28 Feb 2009 10:59:03 -0600
- Subject: Re: Format string wrapper and -Wformat-nonliteral
- Openpgp: id=05FB8DB2
- References: <49A96972.5060004@informatik.uni-hamburg.de>
Tobias Mueller wrote:
> I think I want to make gcc
> * know that the wrapper is not responsible for the format string and
> thus the call to strftime is allowed
> * pass the responsibility up to the callers and thus check whether they
> call the wrapper with "good" strings.
>
>
> And I don't know how to do that. Do you have any advices?
<snip>
>
> size_t my_strftime(char *s, size_t max, const char *fmt,
> const struct tm *tm)
Add "__attribute__((format (strftime, 3, 0)))" to your function declaration.
--
Kevin P. Fleming
Digium, Inc. | Director of Software Technologies
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
skype: kpfleming | jabber: kpfleming@digium.com
Check us out at www.digium.com & www.asterisk.org