[vlc-commits] Add VLC_WEAK wrapper

Rémi Denis-Courmont git at videolan.org
Mon Feb 12 18:45:49 CET 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Feb 12 19:09:11 2018 +0200| [40b92a1446e6f253badba0d9d22bd34703a18225] | committer: Rémi Denis-Courmont

Add VLC_WEAK wrapper

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=40b92a1446e6f253badba0d9d22bd34703a18225
---

 include/vlc_common.h | 12 ++++++++++++
 src/modules/bank.c   |  6 +-----
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/include/vlc_common.h b/include/vlc_common.h
index 5e8b979e3b..c347b9ac0c 100644
--- a/include/vlc_common.h
+++ b/include/vlc_common.h
@@ -185,6 +185,18 @@
 # define VLC_USED
 #endif
 
+#ifdef __ELF__
+# define VLC_WEAK __attribute__((weak))
+#else
+/**
+ * Weak symbol annotation
+ *
+ * Use this macro before an external identifier \b definition to mark it as a
+ * weak symbol. A weak symbol can be overriden by another symbol of the same
+ * name at the link time.
+ */
+# define VLC_WEAK
+#endif
 
 /* Branch prediction */
 #if defined (__GNUC__) || defined (__clang__)
diff --git a/src/modules/bank.c b/src/modules/bank.c
index 2e67a0d07e..693e514a29 100644
--- a/src/modules/bank.c
+++ b/src/modules/bank.c
@@ -173,11 +173,7 @@ static vlc_plugin_t *module_InitStatic(vlc_plugin_cb entry)
 }
 
 #if defined(__ELF__) || !HAVE_DYNAMIC_PLUGINS
-# ifdef __GNUC__
-__attribute__((weak))
-# else
-#  pragma weak vlc_static_modules
-# endif
+VLC_WEAK
 extern vlc_plugin_cb vlc_static_modules[];
 
 static void module_InitStaticModules(void)



More information about the vlc-commits mailing list