Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 01 Dec 2000 13:55:05 +1100
From:      Peter Jeremy <peter.jeremy@alcatel.com.au>
To:        Kris Kennaway <kris@FreeBSD.ORG>
Cc:        audit@FreeBSD.ORG
Subject:   Re: gcc __attributes for format strings
Message-ID:  <20001201135505.I1474@gsmx07.alcatel.com.au>
In-Reply-To: <20001126222048.A46809@citusc17.usc.edu>; from kris@FreeBSD.ORG on Sun, Nov 26, 2000 at 10:20:48PM -0800
References:  <20001126222048.A46809@citusc17.usc.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2000-Nov-26 22:20:48 -0800, Kris Kennaway <kris@FreeBSD.ORG> wrote:
>+static void msgDebug(char *, ...) __printf0like(1,0);

Should be
+static void msgDebug(char *, ...) __printf0like(1,2);

`2' indicates that the first format argument is argument 2.
`0' indicates that the format arguments are passed as a va_list, eg

int fprintf(FILE *, const char *, ...) __printflike(2,3);
int vfprintf(FILE *, const char *, va_list) __printflike(2,0);

Note that (at least with older gcc's), the attribute only works on
the function declaration (prototype), not on the definition.

I think doing this throughout the source would be an excellent idea
(but fairly time-consuming).

Peter


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-audit" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20001201135505.I1474>