Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 04 Sep 2001 14:31:54 -0700
From:      Peter Wemm <peter@wemm.org>
To:        Matt Dillon <dillon@earth.backplane.com>
Cc:        "David O'Brien" <obrien@FreeBSD.org>, Kris Kennaway <kris@obsecurity.org>, "Andrey A. Chernov" <ache@nagual.pp.ru>, Mark Peek <mark@whistle.com>, cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   Re: macro recommendation (Was Re: cvs commit: src/lib/libc/stdlib strtol.3 strtol.c strtoll.c strtoq.c strtoul.3 strtoul.c strtoull.c strtouq.c) 
Message-ID:  <20010904213154.2A652390B@overcee.netplex.com.au>
In-Reply-To: <200109042122.f84LMcm95136@earth.backplane.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
Matt Dillon wrote:
>     How about this:
> 
>     blah.c:
> 
> 	#include <rcsid.h>
> 
> 	...
> 
> 	__RCSID("$FreeBSD$");
> 
>     (where CVS will expand the $FreeBSD$ part when a file is checked in).

Uhh. why not this:

#include <sys/cdefs.h>
__RCSID("$FreeBSD$);

After all, we already *have* it.  And as a bonus it works on NetBSD and
OpenBSD too.

peter@daintree[2:30pm]~-135> cat c.c
#include <sys/cdefs.h>
__RCSID("$FreeBSD: Foo 1.1 $");
peter@daintree[2:30pm]~-136> cc -ansi -pedantic -c c.c
peter@daintree[2:30pm]~-137> ident c.o
c.o:
     $FreeBSD: Foo 1.1 $

>     And we create a new header file, <rcsid.h>, to hold the macro?  I looked
>     at a bunch of libc and there is no single pre-existing header file that
>     they all #include.  This is a simple, short, and straightforward way of
>     doing it.
> 
>     The macro will simply generate the static const rcsid[] array as a
>     default.  I'll add a make.conf option to allow people to have the 
>     macro turn into a nop.
> 
>     If people agree, I'd be happy to commit the rcsid.h file and start 
>     working on library code (hopefully a bunch of people would work on
>     the library code in parallel!).  With two or three people working on
>     it we could have everything instrumented in -current in a few days,
>     and MFC it to -stable after the release (it should be easy to patch).
> 
>     We could also standardize older identifiers... for example, we could
>     turn the SCCSID stuff from:
> 
> 	#if defined(LIBC_SCCS) && !defined(lint)
> 	static char sccsid[] = "@(#)lseek.c     8.1 (Berkeley) 6/17/93";
> 	#endif /* LIBC_SCCS and not lint */
> 
>     To:
> 
> 	__SCCSID("@(#)lseek.c     8.1 (Berkeley) 6/17/93");
> 
>     And other embedded id's would work the same. __NETBSDID, __OPENBSDID,
>     etc...  All very simple macros.
> 
> 						-Matt
> 
> 
> 

Cheers,
-Peter
--
Peter Wemm - peter@FreeBSD.org; peter@yahoo-inc.com; peter@netplex.com.au
"All of this is for nothing if we don't go to the stars" - JMS/B5


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




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