From owner-freebsd-audit Thu Nov 30 19:36:21 2000 Delivered-To: freebsd-audit@freebsd.org Received: from odin.ac.hmc.edu (Odin.AC.HMC.Edu [134.173.32.75]) by hub.freebsd.org (Postfix) with ESMTP id 0F15737B400 for ; Thu, 30 Nov 2000 19:36:20 -0800 (PST) Received: (from brdavis@localhost) by odin.ac.hmc.edu (8.11.0/8.11.0) id eB13a0X06210; Thu, 30 Nov 2000 19:36:00 -0800 Date: Thu, 30 Nov 2000 19:36:00 -0800 From: Brooks Davis To: Peter Jeremy Cc: Steve Kargl , audit@FreeBSD.ORG Subject: Re: gcc __attributes for format strings Message-ID: <20001130193600.A4439@Odin.AC.HMC.Edu> References: <20001126222048.A46809@citusc17.usc.edu> <200011271604.eARG49V29464@troutmask.apl.washington.edu> <20001201134903.H1474@gsmx07.alcatel.com.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2i In-Reply-To: <20001201134903.H1474@gsmx07.alcatel.com.au>; from peter.jeremy@alcatel.com.au on Fri, Dec 01, 2000 at 01:49:03PM +1100 Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Fri, Dec 01, 2000 at 01:49:03PM +1100, Peter Jeremy wrote: > In general, gcc attributes are not directly put in the code. Rather > there are a series of macros in which map 4.4BSD > attributes onto compiler-specific attributes. If we move to a > different compiler, we just need to change cdefs.h Too bad this won't work in general. As far as I can tell, Solaris and IRIX use magic comments like so [from IRIX 6.4]: /* PRINTFLIKE2 */ extern int fprintf(FILE *, const char *, ...); /* SCANFLIKE2 */ extern int fscanf(FILE *, const char *, ...); They don't appear to have any support for __dead2 like declerations on non-returning functions though. MSVC++ has __declspec(blah) before the function decleration, but they don't seem to have any printf verification support, just noreturn. ISO should pull it's head out of it's ass and declare a standard. This information is just too useful for a compiler not to have access to it when trying to catch stupid user tricks. Of the options I found last week when I was looking, I like gcc's __attribute__ best. The current state of the world pretty much sucks. -- Brooks -- Any statement of the form "X is the one, true Y" is FALSE. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message