From: Peter Johnson Date: Wed, 19 Sep 2001 09:06:54 +0000 (-0000) Subject: Pull in GCC and ELF alternatives for RCSID() if available. X-Git-Tag: v0.1.0~321 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1284d8d8af612d401a20df419e519588a9f4d8f3;p=yasm Pull in GCC and ELF alternatives for RCSID() if available. Idea from: sys/cdefs.h on FreeBSD. svn path=/trunk/yasm/; revision=197 --- diff --git a/libyasm/util.h b/libyasm/util.h index d5984ea0..0d56e213 100644 --- a/libyasm/util.h +++ b/libyasm/util.h @@ -61,7 +61,15 @@ int strncasecmp(const char *s1, const char *s2, size_t n); #ifdef __RCSID # define RCSID(s) __RCSID(s) #else -# define RCSID(s) static const char rcsid[] = s +# ifdef __GNUC__ +# ifdef __ELF__ +# define RCSID(s) __asm__(".ident\t\"" s "\"") +# else +# define RCSID(s) static const char rcsid[] __unused = s +# endif +# else +# define RCSID(s) static const char rcsid[] = s +# endif #endif #endif diff --git a/src/util.h b/src/util.h index d5984ea0..0d56e213 100644 --- a/src/util.h +++ b/src/util.h @@ -61,7 +61,15 @@ int strncasecmp(const char *s1, const char *s2, size_t n); #ifdef __RCSID # define RCSID(s) __RCSID(s) #else -# define RCSID(s) static const char rcsid[] = s +# ifdef __GNUC__ +# ifdef __ELF__ +# define RCSID(s) __asm__(".ident\t\"" s "\"") +# else +# define RCSID(s) static const char rcsid[] __unused = s +# endif +# else +# define RCSID(s) static const char rcsid[] = s +# endif #endif #endif diff --git a/util.h b/util.h index d5984ea0..0d56e213 100644 --- a/util.h +++ b/util.h @@ -61,7 +61,15 @@ int strncasecmp(const char *s1, const char *s2, size_t n); #ifdef __RCSID # define RCSID(s) __RCSID(s) #else -# define RCSID(s) static const char rcsid[] = s +# ifdef __GNUC__ +# ifdef __ELF__ +# define RCSID(s) __asm__(".ident\t\"" s "\"") +# else +# define RCSID(s) static const char rcsid[] __unused = s +# endif +# else +# define RCSID(s) static const char rcsid[] = s +# endif #endif #endif