Date: Tue, 04 Sep 2001 18:07:06 -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: <20010905010706.E279F390C@overcee.netplex.com.au> In-Reply-To: <200109042205.f84M5YM95627@earth.backplane.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Matt Dillon wrote:
>
> :
> :On Tue, Sep 04, 2001 at 02:22:38PM -0700, Matt Dillon wrote:
> :> #include <rcsid.h>
> :>
> :> ...
> :>
> :> __RCSID("$FreeBSD$");
> :>
> :> (where CVS will expand the $FreeBSD$ part when a file is checked in).
> :
> :Please! I already have a prototype in works. I'm sure there are other
> :things for people to work on.
>
> sys/cdefs.h ? I think it's perfect, lets use it... I don't understand
> why you haven't instrumented all the library source files already,
> though, or at least more then have been, or asked people to help out
> instrumenting it. Barely 33 files use RCSID and it's been in the tree
> for almost half a year! And nobody seems to know it exists except a
> handful of people. The stuff is only so much fluff if it isn't used.
I regenerated a diff I've had on a local tree for over a month now. It
solves the problem of using multiple __XXXID() in the same file. This
is just a refinement. It can deal with __XXXID() in *.h headers except
for the non-gcc case.
Index: cdefs.h
===================================================================
RCS file: /home/ncvs/src/sys/sys/cdefs.h,v
retrieving revision 1.33
diff -u -r1.33 cdefs.h
--- cdefs.h 2001/06/02 17:35:50 1.33
+++ cdefs.h 2001/09/05 00:52:19
@@ -192,22 +192,27 @@
#endif /* __ELF__ */
#endif /* __GNUC__ */
-#if defined(__GNUC__) && defined(__ELF__)
+#if defined(__GNUC__)
+#if defined(__ELF__)
#define __IDSTRING(name,string) __asm__(".ident\t\"" string "\"")
#else
+#define __IDSTRING(name,string) __asm__(".data\n\t.asciz\t\"" string "\"\n\t.previous")
+#else
+/* You're out of luck, but this is about the best we can do without asm() */
#define __IDSTRING(name,string) static const char name[] __unused = string
+/* Alternative: #define __IDSTRING(name,string) */
#endif
#ifndef __RCSID
-#define __RCSID(s) __IDSTRING(rcsid,s)
+#define __RCSID(s) __IDSTRING(__CONCAT(__rcsid_,__LINE__),s)
#endif
#ifndef __RCSID_SOURCE
-#define __RCSID_SOURCE(s) __IDSTRING(rcsid_source,s)
+#define __RCSID_SOURCE(s) __IDSTRING(__CONCAT(__rcsid_source_,__LINE__),s)
#endif
#ifndef __COPYRIGHT
-#define __COPYRIGHT(s) __IDSTRING(copyright,s)
+#define __COPYRIGHT(s) __IDSTRING(__CONCAT(__copyright_,__LINE__),s)
#endif
#ifndef __DECONST
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?20010905010706.E279F390C>
