summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2009-06-07 14:20:36 -0400
committerSimo Sorce <idra@samba.org>2009-06-15 16:31:12 -0400
commite83f4b868b208724a732b45a0aa4f6ee8a08b115 (patch)
tree069ee993c7174df542899fe08227289a2a9d0cca /lib
parent7aee9f92e7c3e3eb48c0456d821125b60f8d8259 (diff)
downloadsamba-e83f4b868b208724a732b45a0aa4f6ee8a08b115.tar.gz
samba-e83f4b868b208724a732b45a0aa4f6ee8a08b115.tar.bz2
samba-e83f4b868b208724a732b45a0aa4f6ee8a08b115.zip
Add exports file and abi checker for talloc
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 talloc.h contents and the gcc -aux-info option
Diffstat (limited to 'lib')
-rw-r--r--lib/talloc/Makefile.in6
-rwxr-xr-xlib/talloc/abi_checks.sh32
-rw-r--r--lib/talloc/configure.ac15
-rw-r--r--lib/talloc/libtalloc.m45
-rw-r--r--lib/talloc/rules.mk2
-rw-r--r--lib/talloc/talloc.exports61
-rw-r--r--lib/talloc/talloc.mk1
-rw-r--r--lib/talloc/talloc.signatures56
8 files changed, 169 insertions, 9 deletions
diff --git a/lib/talloc/Makefile.in b/lib/talloc/Makefile.in
index c28693e2db..a45f72bede 100644
--- a/lib/talloc/Makefile.in
+++ b/lib/talloc/Makefile.in
@@ -24,13 +24,17 @@ tallocdir = @tallocdir@
LIBOBJ = $(TALLOC_OBJ) @LIBREPLACEOBJ@
+SONAMEFLAG = @SONAMEFLAG@
+VERSIONSCRIPT = @VERSIONSCRIPT@
+EXPORTSFILE = @EXPORTSFILE@
+
all:: showflags $(EXTRA_TARGETS)
include $(tallocdir)/rules.mk
include $(tallocdir)/talloc.mk
$(TALLOC_SOLIB): $(LIBOBJ)
- $(SHLD) $(SHLD_FLAGS) -o $@ $(LIBOBJ) @SONAMEFLAG@$(TALLOC_SONAME)
+ $(SHLD) $(SHLD_FLAGS) -o $@ $(LIBOBJ) $(VERSIONSCRIPT) $(EXPORTSFILE) $(SONAMEFLAG)$(TALLOC_SONAME)
shared-build: all
${INSTALLCMD} -d $(sharedbuilddir)/lib
diff --git a/lib/talloc/abi_checks.sh b/lib/talloc/abi_checks.sh
new file mode 100755
index 0000000000..432cc87745
--- /dev/null
+++ b/lib/talloc/abi_checks.sh
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+make clean
+
+mkdir abi
+ABI_CHECKS="-aux-info abi/\$@.X"
+make ABI_CHECK="$ABI_CHECKS"
+
+for i in abi/*.X; do cat $i | grep 'talloc\.h'; done | sort | uniq | awk -F "extern " '{ print $2 }' > abi/signatures
+
+cat > abi/exports << EOF
+{
+ global:
+EOF
+cat abi/signatures | awk -F '(' '{ print $1 }' | awk -F ' ' '{ print " "$NF";" }' | tr -d '*' | sort >> abi/exports
+cat >> abi/exports << EOF
+
+ local: *;
+};
+EOF
+
+rm -fr abi/*.X
+
+diff -u talloc.signatures abi/signatures
+if [ "$?" != "0" ]; then
+ echo "WARNING: Possible ABI Change!!"
+fi
+
+diff -u talloc.exports abi/exports
+if [ "$?" != "0" ]; then
+ echo "WARNING: Export file may be outdated!!"
+fi
diff --git a/lib/talloc/configure.ac b/lib/talloc/configure.ac
index 00e8242d4e..a644f6d800 100644
--- a/lib/talloc/configure.ac
+++ b/lib/talloc/configure.ac
@@ -1,11 +1,18 @@
AC_PREREQ(2.50)
-AC_INIT(talloc, 1.3.0)
+AC_INIT(talloc, 1.3.1)
AC_CONFIG_SRCDIR([talloc.c])
AC_SUBST(datarootdir)
AC_CONFIG_HEADER(config.h)
AC_LIBREPLACE_ALL_CHECKS
+AC_LD_PICFLAG
+AC_LD_SHLIBEXT
+AC_LD_SONAMEFLAG
+AC_LD_VERSIONSCRIPT
+AC_LIBREPLACE_SHLD
+AC_LIBREPLACE_SHLD_FLAGS
+
m4_include(libtalloc.m4)
AC_PATH_PROG(XSLTPROC,xsltproc)
@@ -15,12 +22,6 @@ if test -n "$XSLTPROC"; then
fi
AC_SUBST(DOC_TARGET)
-AC_LD_PICFLAG
-AC_LD_SHLIBEXT
-AC_LD_SONAMEFLAG
-AC_LIBREPLACE_SHLD
-AC_LIBREPLACE_SHLD_FLAGS
-
m4_include(build_macros.m4)
BUILD_WITH_SHARED_BUILD_DIR
diff --git a/lib/talloc/libtalloc.m4 b/lib/talloc/libtalloc.m4
index e6830fbef6..4b22c8e41a 100644
--- a/lib/talloc/libtalloc.m4
+++ b/lib/talloc/libtalloc.m4
@@ -31,3 +31,8 @@ if test $ac_cv_sizeof_size_t -lt $ac_cv_sizeof_void_p; then
AC_WARN([sizeof(void *) = $ac_cv_sizeof_void_p])
AC_ERROR([sizeof(size_t) < sizeof(void *)])
fi
+
+if test x"$VERSIONSCRIPT" != "x"; then
+ EXPORTSFILE=talloc.exports
+ AC_SUBST(EXPORTSFILE)
+fi
diff --git a/lib/talloc/rules.mk b/lib/talloc/rules.mk
index 1c83e7b63f..00c909ee2b 100644
--- a/lib/talloc/rules.mk
+++ b/lib/talloc/rules.mk
@@ -6,7 +6,7 @@ showflags::
@echo ' LIBS = $(LIBS)'
.c.o:
- $(CC) $(PICFLAG) -o $@ -c $< $(CFLAGS)
+ $(CC) $(PICFLAG) $(ABI_CHECK) -o $@ -c $< $(CFLAGS)
.3.xml.3:
-test -z "$(XSLTPROC)" || $(XSLTPROC) -o $@ http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
diff --git a/lib/talloc/talloc.exports b/lib/talloc/talloc.exports
new file mode 100644
index 0000000000..b7878453cf
--- /dev/null
+++ b/lib/talloc/talloc.exports
@@ -0,0 +1,61 @@
+{
+ global:
+ _talloc;
+ _talloc_array;
+ talloc_asprintf;
+ talloc_asprintf_append;
+ talloc_asprintf_append_buffer;
+ talloc_autofree_context;
+ talloc_check_name;
+ talloc_disable_null_tracking;
+ talloc_enable_leak_report;
+ talloc_enable_leak_report_full;
+ talloc_enable_null_tracking;
+ talloc_find_parent_byname;
+ talloc_free;
+ talloc_free_children;
+ talloc_get_name;
+ talloc_get_size;
+ _talloc_get_type_abort;
+ talloc_increase_ref_count;
+ talloc_init;
+ talloc_is_parent;
+ _talloc_memdup;
+ _talloc_move;
+ talloc_named;
+ talloc_named_const;
+ talloc_parent;
+ talloc_parent_name;
+ talloc_pool;
+ _talloc_realloc;
+ _talloc_realloc_array;
+ talloc_realloc_fn;
+ _talloc_reference;
+ talloc_reference_count;
+ talloc_report;
+ talloc_report_depth_cb;
+ talloc_report_depth_file;
+ talloc_report_full;
+ talloc_set_abort_fn;
+ _talloc_set_destructor;
+ talloc_set_name;
+ talloc_set_name_const;
+ talloc_show_parents;
+ _talloc_steal;
+ talloc_strdup;
+ talloc_strdup_append;
+ talloc_strdup_append_buffer;
+ talloc_strndup;
+ talloc_strndup_append;
+ talloc_strndup_append_buffer;
+ talloc_total_blocks;
+ talloc_total_size;
+ talloc_unlink;
+ talloc_vasprintf;
+ talloc_vasprintf_append;
+ talloc_vasprintf_append_buffer;
+ _talloc_zero;
+ _talloc_zero_array;
+
+ local: *;
+};
diff --git a/lib/talloc/talloc.mk b/lib/talloc/talloc.mk
index ce7784c8a2..fb57e44c4b 100644
--- a/lib/talloc/talloc.mk
+++ b/lib/talloc/talloc.mk
@@ -30,6 +30,7 @@ doc:: talloc.3 talloc.3.html
clean::
rm -f *~ $(LIBOBJ) $(TALLOC_SOLIB) $(TALLOC_STLIB) testsuite testsuite.o testsuite_main.o *.gc?? talloc.3 talloc.3.html
+ rm -fr abi
test:: testsuite
./testsuite
diff --git a/lib/talloc/talloc.signatures b/lib/talloc/talloc.signatures
new file mode 100644
index 0000000000..e2fc8aee43
--- /dev/null
+++ b/lib/talloc/talloc.signatures
@@ -0,0 +1,56 @@
+void *_talloc (const void *, size_t);
+void *talloc_pool (const void *, size_t);
+void _talloc_set_destructor (const void *, int (*) (void *));
+int talloc_increase_ref_count (const void *);
+size_t talloc_reference_count (const void *);
+void *_talloc_reference (const void *, const void *);
+int talloc_unlink (const void *, void *);
+const char *talloc_set_name (const void *, const char *, ...);
+void talloc_set_name_const (const void *, const char *);
+void *talloc_named (const void *, size_t, const char *, ...);
+void *talloc_named_const (const void *, size_t, const char *);
+const char *talloc_get_name (const void *);
+void *talloc_check_name (const void *, const char *);
+void *_talloc_get_type_abort (const void *, const char *, const char *);
+void *talloc_parent (const void *);
+const char *talloc_parent_name (const void *);
+void *talloc_init (const char *, ...);
+int talloc_free (void *);
+void talloc_free_children (void *);
+void *_talloc_realloc (const void *, void *, size_t, const char *);
+void *_talloc_steal (const void *, const void *);
+void *_talloc_move (const void *, const void *);
+size_t talloc_total_size (const void *);
+size_t talloc_total_blocks (const void *);
+void talloc_report_depth_cb (const void *, int, int, void (*) (const void *, int, int, int, void *), void *);
+void talloc_report_depth_file (const void *, int, int, FILE *);
+void talloc_report_full (const void *, FILE *);
+void talloc_report (const void *, FILE *);
+void talloc_enable_null_tracking (void);
+void talloc_disable_null_tracking (void);
+void talloc_enable_leak_report (void);
+void talloc_enable_leak_report_full (void);
+void *_talloc_zero (const void *, size_t, const char *);
+void *_talloc_memdup (const void *, const void *, size_t, const char *);
+void *_talloc_array (const void *, size_t, unsigned int, const char *);
+void *_talloc_zero_array (const void *, size_t, unsigned int, const char *);
+void *_talloc_realloc_array (const void *, void *, size_t, unsigned int, const char *);
+void *talloc_realloc_fn (const void *, void *, size_t);
+void *talloc_autofree_context (void);
+size_t talloc_get_size (const void *);
+void *talloc_find_parent_byname (const void *, const char *);
+void talloc_show_parents (const void *, FILE *);
+int talloc_is_parent (const void *, const void *);
+char *talloc_strdup (const void *, const char *);
+char *talloc_strdup_append (char *, const char *);
+char *talloc_strdup_append_buffer (char *, const char *);
+char *talloc_strndup (const void *, const char *, size_t);
+char *talloc_strndup_append (char *, const char *, size_t);
+char *talloc_strndup_append_buffer (char *, const char *, size_t);
+char *talloc_vasprintf (const void *, const char *, __va_list_tag *);
+char *talloc_vasprintf_append (char *, const char *, __va_list_tag *);
+char *talloc_vasprintf_append_buffer (char *, const char *, __va_list_tag *);
+char *talloc_asprintf (const void *, const char *, ...);
+char *talloc_asprintf_append (char *, const char *, ...);
+char *talloc_asprintf_append_buffer (char *, const char *, ...);
+void talloc_set_abort_fn (void (*) (const char *));