From owner-freebsd-audit Thu Nov 30 20:11:39 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 AEE8137B400 for ; Thu, 30 Nov 2000 20:11:35 -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 PAA24762; Fri, 1 Dec 2000 15:11:30 +1100 (EDT) Received: from gsmx07.alcatel.com.au by cim.alcatel.com.au (PMDF V5.2-32 #37641) with ESMTP id <01JX70CP9UG0E7XCIK@cim.alcatel.com.au>; Fri, 1 Dec 2000 15:11:25 +1100 Received: (from jeremyp@localhost) by gsmx07.alcatel.com.au (8.11.0/8.11.0) id eB14BLW03530; Fri, 01 Dec 2000 15:11:21 +1100 (EST envelope-from jeremyp) Content-return: prohibited Date: Fri, 01 Dec 2000 15:11:21 +1100 From: Peter Jeremy Subject: Re: gcc __attributes for format strings In-reply-to: <20001130193600.A4439@Odin.AC.HMC.Edu>; from brooks@one-eyed-alien.net on Thu, Nov 30, 2000 at 07:36:00PM -0800 To: Brooks Davis Cc: audit@FreeBSD.ORG Mail-followup-to: Brooks Davis , audit@FreeBSD.ORG Message-id: <20001201151121.J1474@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> <200011271604.eARG49V29464@troutmask.apl.washington.edu> <20001201134903.H1474@gsmx07.alcatel.com.au> <20001130193600.A4439@Odin.AC.HMC.Edu> Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On 2000-Nov-30 19:36:00 -0800, Brooks Davis wrote: >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. I know. The ANSI standard reserved #pragma for these sorts of compiler hints. Unfortunately, #pragma is totally useless for portable code. The GCC documentation says it best: " Some people object to the `__attribute__' feature, suggesting that ANSI C's `#pragma' should be used instead. There are two reasons for not doing this. 1. It is impossible to generate `#pragma' commands from a macro. 2. There is no telling what the same `#pragma' might mean in another compiler. These two reasons apply to almost any application that might be proposed for `#pragma'. It is basically a mistake to use `#pragma' for _anything_." > ISO should pull it's head out of it's ass and declare a standard. It needs to declare a standard that is useful and extensible. #pragma only achieves the latter but by having a null set of standard meanings and not allowing macros, it totally fails to be useful. Using magic comment strings has a fairly long history, but is similarly useless due to its inability to be used with macros. Peter To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message