From owner-freebsd-audit Thu Nov 30 18:55:15 2000 Delivered-To: freebsd-audit@freebsd.org Received: from netau1.alcanet.com.au (ntp.alcanet.com.au [203.62.196.27]) by hub.freebsd.org (Postfix) with ESMTP id 98D5A37B400; Thu, 30 Nov 2000 18:55:12 -0800 (PST) Received: from mfg1.cim.alcatel.com.au (mfg1.cim.alcatel.com.au [139.188.23.1]) by netau1.alcanet.com.au (8.9.3 (PHNE_18979)/8.9.3) with ESMTP id NAA15122; Fri, 1 Dec 2000 13:55:09 +1100 (EDT) Received: from gsmx07.alcatel.com.au by cim.alcatel.com.au (PMDF V5.2-32 #37641) with ESMTP id <01JX6XO5XP7KE7XDDI@cim.alcatel.com.au>; Fri, 1 Dec 2000 13:55:07 +1100 Received: (from jeremyp@localhost) by gsmx07.alcatel.com.au (8.11.0/8.11.0) id eB12t5b03254; Fri, 01 Dec 2000 13:55:05 +1100 (EST envelope-from jeremyp) Content-return: prohibited Date: Fri, 01 Dec 2000 13:55:05 +1100 From: Peter Jeremy Subject: Re: gcc __attributes for format strings In-reply-to: <20001126222048.A46809@citusc17.usc.edu>; from kris@FreeBSD.ORG on Sun, Nov 26, 2000 at 10:20:48PM -0800 To: Kris Kennaway Cc: audit@FreeBSD.ORG Mail-followup-to: Kris Kennaway , audit@FreeBSD.ORG Message-id: <20001201135505.I1474@gsmx07.alcatel.com.au> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-disposition: inline User-Agent: Mutt/1.2.5i References: <20001126222048.A46809@citusc17.usc.edu> Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On 2000-Nov-26 22:20:48 -0800, Kris Kennaway 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