From 64ff214bb84a576c9490b73fc373e31d2c15fe53 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Wed, 21 Jan 2015 10:01:26 -0500 Subject: [PATCH] macros: add NM_BACKPORT_SYMBOL() 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 | 14 ++++++++++++++ tools/check-exports.sh | 4 +--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/include/nm-macros-internal.h b/include/nm-macros-internal.h index 3767a13397..c65f9e0439 100644 --- a/include/nm-macros-internal.h +++ b/include/nm-macros-internal.h @@ -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__ */ diff --git a/tools/check-exports.sh b/tools/check-exports.sh index dfd882c15b..0022752280 100755 --- a/tools/check-exports.sh +++ b/tools/check-exports.sh @@ -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 }