From 5bf117ddc5cde066d367c4316316866b21149dfe Mon Sep 17 00:00:00 2001 From: peter Date: Wed, 5 Sep 2001 02:50:32 +0000 Subject: Attempt to refine the __IDSTRING() macros so that they dont collide with each other. This will allow multiple __RCSID() entries in the same file and even __RCSID() in headers. **HOWEVER**, the usefulness of this in headers is somewhat marginal in non-ELF since they would go into the data section where they cannot be easily compressed or stripped. It (id's in headers) is also not useful in the non-GCC case since it is hard to generate unique variable names. I have an idea on that though. Now for mcs: http://mirrors.ccs.neu.edu/cgi-bin/unixhelp/man-cgi?mcs+1 --- sys/sys/cdefs.h | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'sys') diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h index f8d864c..eca1bd4 100644 --- a/sys/sys/cdefs.h +++ b/sys/sys/cdefs.h @@ -192,22 +192,30 @@ #endif /* __ELF__ */ #endif /* __GNUC__ */ -#if defined(__GNUC__) && defined(__ELF__) +#ifdef __GNUC__ +#ifdef __ELF__ #define __IDSTRING(name,string) __asm__(".ident\t\"" string "\"") #else +#define __IDSTRING(name,string) __asm__(".data\n\t.asciz\t\"" string "\"\n\t.previous") +#endif +#else +/* + * This doesn't work in header files. But it may be better than nothing. + * The alternative is: #define __IDSTRING(name,string) /* nothing */ + */ #define __IDSTRING(name,string) static const char name[] __unused = 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 -- cgit v1.1