macros: add NM_BACKPORT_SYMBOL()
authorDan Winship <danw@redhat.com>
Wed, 21 Jan 2015 15:01:26 +0000 (10:01 -0500)
committerThomas Haller <thaller@redhat.com>
Fri, 26 Jun 2015 14:28:33 +0000 (16:28 +0200)
Add a macro to insert the necessary compiler/linker magic to add a
copy of an existing symbol to an older version. Also, update
check-exports.sh to be able to check for such symbols by listed them
commented-out in the appropriate section.

[thaller@redhat.com: patch modified]

Related: https://bugzilla.gnome.org/show_bug.cgi?id=742993

include/nm-macros-internal.h
tools/check-exports.sh

index 3767a13..c65f9e0 100644 (file)
@@ -236,4 +236,18 @@ nm_clear_g_source (guint *id)
 
 /*****************************************************************************/
 
+#define _NM_BACKPORT_SYMBOL_IMPL(VERSION, RETURN_TYPE, ORIG_FUNC, VERSIONED_FUNC, ARGS_TYPED, ARGS) \
+RETURN_TYPE VERSIONED_FUNC ARGS_TYPED; \
+RETURN_TYPE VERSIONED_FUNC ARGS_TYPED \
+{ \
+    return ORIG_FUNC ARGS; \
+} \
+RETURN_TYPE ORIG_FUNC ARGS_TYPED; \
+__asm__(".symver "G_STRINGIFY(VERSIONED_FUNC)", "G_STRINGIFY(ORIG_FUNC)"@"G_STRINGIFY(VERSION))
+
+#define NM_BACKPORT_SYMBOL(VERSION, RETURN_TYPE, FUNC, ARGS_TYPED, ARGS) \
+_NM_BACKPORT_SYMBOL_IMPL(VERSION, RETURN_TYPE, FUNC, _##FUNC##_##VERSION, ARGS_TYPED, ARGS)
+
+/*****************************************************************************/
+
 #endif /* __NM_MACROS_INTERNAL_H__ */
index dfd882c..0022752 100755 (executable)
@@ -18,9 +18,7 @@ get_syms() {
 }
 
 get_syms_from_def() {
-    # be strict and only parse entries that start with one \t and end with a ';'
-    sed -n 's/^\t\([_a-zA-Z0-9]\+\);$/\1/p' "$1" |
-    grep '^\*$' -v |
+    sed -n 's/^\t\(\([_a-zA-Z0-9]\+\)\|#\s*\([_a-zA-Z0-9]\+@@\?[_a-zA-Z0-9]\+\)\);$/\2\3/p' "$1" |
     sort
 }