summaryrefslogtreecommitdiff
path: root/lib/tdb/abi_checks.sh
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2009-06-15 16:19:19 -0400
committerSimo Sorce <idra@samba.org>2009-06-15 16:31:12 -0400
commit7aee9f92e7c3e3eb48c0456d821125b60f8d8259 (patch)
treefa8be2b7149db8d8806d7f54d818b98ea5d34af7 /lib/tdb/abi_checks.sh
parentf518e37c0912a54d5434f7639ba44f53d3455582 (diff)
downloadsamba-7aee9f92e7c3e3eb48c0456d821125b60f8d8259.tar.gz
samba-7aee9f92e7c3e3eb48c0456d821125b60f8d8259.tar.bz2
samba-7aee9f92e7c3e3eb48c0456d821125b60f8d8259.zip
Add exports file and abi checker for tdb
This is a first attempt at exporting symbols only for public functions We also provide a rudimentary ABI checker that tries to check that function signatures are not changed by mistake. Given our use of macros this is not an API checker. It's all based on tdb.h contents and the gcc -aux-info option
Diffstat (limited to 'lib/tdb/abi_checks.sh')
-rwxr-xr-xlib/tdb/abi_checks.sh35
1 files changed, 35 insertions, 0 deletions
diff --git a/lib/tdb/abi_checks.sh b/lib/tdb/abi_checks.sh
new file mode 100755
index 0000000000..042b0f3374
--- /dev/null
+++ b/lib/tdb/abi_checks.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+make clean
+
+mkdir -p abi/common
+mkdir -p abi/tools
+ABI_CHECKS="-aux-info abi/\$@.X"
+make ABI_CHECK="$ABI_CHECKS" CC="/usr/bin/gcc"
+
+for i in abi/*/*.X; do cat $i | grep 'tdb\.h'; done | sort | uniq | awk -F "extern " '{ print $2 }' > abi/signatures
+grep '^extern' include/tdb.h | grep -v '"C"' | sort | uniq | awk -F "extern " '{ print $2 }' >> abi/signatures
+
+cat > abi/exports << EOF
+{
+ global:
+EOF
+#Functions
+cat abi/signatures | grep "(" | awk -F '(' '{ print $1 }' | awk -F ' ' '{ print " "$NF";" }' | tr -d '*' | sort >> abi/exports
+#global vars
+cat abi/signatures | grep -v "(" | awk -F ';' '{print $1 }' | awk -F ' ' '{ print " "$NF";" }' | tr -d '*' | sort >> abi/exports
+cat >> abi/exports << EOF
+
+ local: *;
+};
+EOF
+
+diff -u tdb.signatures abi/signatures
+if [ "$?" != "0" ]; then
+ echo "WARNING: Possible ABI Change!!"
+fi
+
+diff -u tdb.exports abi/exports
+if [ "$?" != "0" ]; then
+ echo "WARNING: Export file may be outdated!!"
+fi