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            =   [EMAIL PROTECTED]
Senior Systems Programmer           or  [EMAIL PROTECTED]
Rensselaer Polytechnic Institute    or  [EMAIL PROTECTED]
_______________________________________________
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to