Style(9) and portability
Marcel Moolenaar
marcel at xcllnt.net
Sat Mar 6 23:04:10 PST 2004
On Sat, Mar 06, 2004 at 12:18:21PM -0800, Tim Kientzle wrote:
> One of the recommendations in style(9) is
> inherently non-portable. I'm trying
> to ensure that the new code I'm writing
> for FreeBSD is portable to other systems,
> so 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.
Our compiler defines __FreeBSD__. You might be able to do:
#ifdef __FreeBSD__
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#endif
The advantage of something like this is that you don't spam the
library on non-FreeBSD systems. Just a thought...
--
Marcel Moolenaar USPA: A-39004 marcel at xcllnt.net
More information about the freebsd-hackers
mailing list