From owner-freebsd-hackers@FreeBSD.ORG Sat Mar 6 17:06:44 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D8C5216A4CE for ; Sat, 6 Mar 2004 17:06:44 -0800 (PST) Received: from smtp4.server.rpi.edu (smtp4.server.rpi.edu [128.113.2.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id 80E8343D1D for ; Sat, 6 Mar 2004 17:06:44 -0800 (PST) (envelope-from drosih@rpi.edu) Received: from [128.113.24.47] (gilead.netel.rpi.edu [128.113.24.47]) by smtp4.server.rpi.edu (8.12.8/8.12.8) with ESMTP id i2716he0010364; Sat, 6 Mar 2004 20:06:43 -0500 Mime-Version: 1.0 X-Sender: drosih@mail.rpi.edu Message-Id: In-Reply-To: <404A320D.8090905@kientzle.com> References: <404A320D.8090905@kientzle.com> Date: Sat, 6 Mar 2004 20:06:42 -0500 To: Tim Kientzle , hackers@freebsd.org From: Garance A Drosihn Content-Type: text/plain; charset="us-ascii" ; format="flowed" X-Scanned-By: CanIt (www . canit . ca) Subject: Re: Style(9) and portability X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Mar 2004 01:06:45 -0000 At 12:18 PM -0800 3/6/04, Tim Kientzle wrote: >... I've been scratching my head over how to >deal with the version ID code that is supposed >to apear as the first two lines of any FreeBSD >source file: > >#include >__FBSDID("$FreeBSD$"); > >Clearly, I cannot reasonably assume that all >platforms define a __FBSDID macro in sys/cdefs.h. Really, you can't even assume that all platforms will *have* a sys/cdefs.h >The second option deals with the issue by pushing >it onto a header that encapsulates platform-specific >definitions. In particular, the local platform.h >header can include sys/cdefs.h on FreeBSD and >provide an alternative definition of __FBSDID >on other platforms. The drawback is, of course, >the requirement for a new local header file to >wrap platform-specific decisions: > >2) #include "platform.h" /* Platform-specific defines */ > __FBSDID("$FreeBSD$"); This is basically the tactic that I went with for everything under lpr. That works reasonably well for lpr, but I don't know if it makes sense for everything: #include "lp.cdefs.h" /* A cross-platform version of */ I intentionally have the comment about sys/defs.h, in case someone comes along later and scans for that string... -- Garance Alistair Drosehn = gad@gilead.netel.rpi.edu Senior Systems Programmer or gad@freebsd.org Rensselaer Polytechnic Institute or drosih@rpi.edu