mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-20 08:44:33 +00:00
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
This commit is contained in:
parent
eda54d6828
commit
ea06a038a5
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=83049
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue