summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaroslav Kysela <perex@perex.cz>2023-05-16 09:14:46 +0200
committerJaroslav Kysela <perex@perex.cz>2023-05-16 09:16:12 +0200
commit55cdf2fd639534be97d2eb6d8b5aa2f7c4ad0bb6 (patch)
tree60d7a4f9b410cca1ed780f8937ae31d293983c56
parent3661bdae35961e4a4dd67a60682550e30b878207 (diff)
downloadalsa-lib-55cdf2fd639534be97d2eb6d8b5aa2f7c4ad0bb6.tar.gz
include: fix SND_DLSYM_BUILD_VERSION() for static build
Correct the dlsym_name string for nested macros. See Fixes:. Fixes: https://github.com/alsa-project/alsa-lib/issues/316 Signed-off-by: Jaroslav Kysela <perex@perex.cz>
-rw-r--r--include/global.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/include/global.h b/include/global.h
index 71a1b12f..dfe9bc2b 100644
--- a/include/global.h
+++ b/include/global.h
@@ -71,6 +71,11 @@ struct snd_dlsym_link {
extern struct snd_dlsym_link *snd_dlsym_start;
+#ifndef __STRING
+/** \brief Return 'x' argument as string */
+#define __STRING(x) #x
+#endif
+
/** \hideinitializer \brief Helper macro for #SND_DLSYM_BUILD_VERSION. */
#define __SND_DLSYM_VERSION(prefix, name, version) _ ## prefix ## name ## version
/**
@@ -82,18 +87,13 @@ extern struct snd_dlsym_link *snd_dlsym_start;
void __SND_DLSYM_VERSION(snd_dlsym_constructor_, name, version) (void) __attribute__ ((constructor)); \
void __SND_DLSYM_VERSION(snd_dlsym_constructor_, name, version) (void) { \
__SND_DLSYM_VERSION(snd_dlsym_, name, version).next = snd_dlsym_start; \
- __SND_DLSYM_VERSION(snd_dlsym_, name, version).dlsym_name = # name; \
+ __SND_DLSYM_VERSION(snd_dlsym_, name, version).dlsym_name = __STRING(name); \
__SND_DLSYM_VERSION(snd_dlsym_, name, version).dlsym_ptr = (void *)&name; \
snd_dlsym_start = &__SND_DLSYM_VERSION(snd_dlsym_, name, version); \
}
#endif
-#ifndef __STRING
-/** \brief Return 'x' argument as string */
-#define __STRING(x) #x
-#endif
-
/** \brief Returns the version of a dynamic symbol as a string. */
#define SND_DLSYM_VERSION(version) __STRING(version)