diff options
author | Dan Winship <danw@redhat.com> | 2015-01-21 10:01:26 -0500 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2015-06-26 16:28:33 +0200 |
commit | 64ff214bb84a576c9490b73fc373e31d2c15fe53 (patch) | |
tree | e7c7bc6f5dce36ca212888bded9ec7bb4d6a98d1 | |
parent | 8a1f4beb65111b88b1114afac96c33a9970301c5 (diff) | |
download | NetworkManager-64ff214bb84a576c9490b73fc373e31d2c15fe53.tar.gz |
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
-rw-r--r-- | include/nm-macros-internal.h | 14 | ||||
-rwxr-xr-x | 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 } |