summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2001-09-05 02:50:32 +0000
committerpeter <peter@FreeBSD.org>2001-09-05 02:50:32 +0000
commit5bf117ddc5cde066d367c4316316866b21149dfe (patch)
tree1d01133b994a388171fb146935916c909932f289 /sys
parent409662ce9f9069cc54d18f371f525c1f2e82cb58 (diff)
downloadFreeBSD-src-5bf117ddc5cde066d367c4316316866b21149dfe.zip
FreeBSD-src-5bf117ddc5cde066d367c4316316866b21149dfe.tar.gz
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
Diffstat (limited to 'sys')
-rw-r--r--sys/sys/cdefs.h16
1 files changed, 12 insertions, 4 deletions
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
OpenPOWER on IntegriCloud