From owner-cvs-all Tue Sep 4 18: 7:18 2001 Delivered-To: cvs-all@freebsd.org Received: from peter3.wemm.org (c1315225-a.plstn1.sfba.home.com [24.14.150.180]) by hub.freebsd.org (Postfix) with ESMTP id 99F9D37B405; Tue, 4 Sep 2001 18:07:07 -0700 (PDT) Received: from overcee.netplex.com.au (overcee.wemm.org [10.0.0.3]) by peter3.wemm.org (8.11.0/8.11.0) with ESMTP id f85177M40004; Tue, 4 Sep 2001 18:07:07 -0700 (PDT) (envelope-from peter@wemm.org) Received: from wemm.org (localhost [127.0.0.1]) by overcee.netplex.com.au (Postfix) with ESMTP id E279F390C; Tue, 4 Sep 2001 18:07:06 -0700 (PDT) (envelope-from peter@wemm.org) X-Mailer: exmh version 2.3.1 01/18/2001 with nmh-1.0.4 To: Matt Dillon Cc: "David O'Brien" , Kris Kennaway , "Andrey A. Chernov" , Mark Peek , 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) In-Reply-To: <200109042205.f84M5YM95627@earth.backplane.com> Date: Tue, 04 Sep 2001 18:07:06 -0700 From: Peter Wemm Message-Id: <20010905010706.E279F390C@overcee.netplex.com.au> Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Matt Dillon wrote: > > : > :On Tue, Sep 04, 2001 at 02:22:38PM -0700, Matt Dillon wrote: > :> #include > :> > :> ... > :> > :> __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