Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 6 Mar 2004 20:06:42 -0500
From:      Garance A Drosihn <drosih@rpi.edu>
To:        Tim Kientzle <tim@kientzle.com>, hackers@freebsd.org
Subject:   Re: Style(9) and portability
Message-ID:  <p060204cebc702460b7d5@[128.113.24.47]>
In-Reply-To: <404A320D.8090905@kientzle.com>
References:  <404A320D.8090905@kientzle.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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 <sys/cdefs.h>
>__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 <sys/cdefs.h> */

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



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