[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha8-1300-gc7d9617
simo
idra at samba.org
Sat Aug 29 17:35:37 MDT 2009
Thanks Michael!
Very well done!
Simo.
On Sat, 2009-08-29 at 17:52 -0500, Michael Adam wrote:
> The branch, master has been updated
> via c7d9617259bafddd1ce26a5c336885e2d3c6771a (commit)
> via d9b193189afb83f02ba68e6360f34cd8c6f59873 (commit)
> via fe0b5234ba8ea1cdf0657e8ef1fbe970f82df6cd (commit)
> via 4e9a06d601a20fb714ffbf2ed6fd2b6f2d931b30 (commit)
> via cbc75c11fd45174da90ec61f000228a39905b171 (commit)
> via f1b386a894afd3917e7c0532918e27ad755c8d74 (commit)
> via 4579c0546292e57d03cb925a83fab2363af42895 (commit)
> via e896f9188d8c44a24dcc8961bafd2667080ffd37 (commit)
> from 2774a02f64a57d981924e0fc65b23060803cc469 (commit)
>
> http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
>
>
> - Log -----------------------------------------------------------------
> commit c7d9617259bafddd1ce26a5c336885e2d3c6771a
> Author: Michael Adam <obnox at samba.org>
> Date: Fri Aug 28 16:04:47 2009 +0200
>
> talloc: move the original abi_checks script to script/abi_checks_gcc.sh
>
> Michael
>
> commit d9b193189afb83f02ba68e6360f34cd8c6f59873
> Author: Michael Adam <obnox at samba.org>
> Date: Sun Aug 30 00:06:58 2009 +0200
>
> talloc: remove talloc_free from the exports
>
> Michael
>
> commit fe0b5234ba8ea1cdf0657e8ef1fbe970f82df6cd
> Author: Michael Adam <obnox at samba.org>
> Date: Sun Aug 30 00:16:36 2009 +0200
>
> talloc: run abi_checks as part of "make test"
>
> Michael
>
> commit 4e9a06d601a20fb714ffbf2ed6fd2b6f2d931b30
> Author: Michael Adam <obnox at samba.org>
> Date: Sun Aug 30 00:25:24 2009 +0200
>
> talloc: remove files generated by "make abi_check" in "make clean"
>
> Michael
>
> commit cbc75c11fd45174da90ec61f000228a39905b171
> Author: Michael Adam <obnox at samba.org>
> Date: Fri Aug 28 16:03:06 2009 +0200
>
> talloc: add a target "abi_checks" to talloc.
>
> Simply run "make abi_checks" to call the abi check script appropriately.
>
> Michael
>
> commit f1b386a894afd3917e7c0532918e27ad755c8d74
> Author: Michael Adam <obnox at samba.org>
> Date: Fri Aug 28 15:53:12 2009 +0200
>
> talloc: add script/abi_checks.sh. check for abi changes without gcc magic.
>
> USAGE: abi_checks.sh LIBRARY_NAME header1 [header2 ...]
>
> This creates symbol signature lists using the mksyms and mksigs scripts
> and compares them with the checked in lists.
>
> Michael
>
> commit 4579c0546292e57d03cb925a83fab2363af42895
> Author: Michael Adam <obnox at samba.org>
> Date: Fri Aug 28 15:08:19 2009 +0200
>
> talloc: add script to extract signatures from header files.
>
> This produces output like the output gcc produces when
> invoked with the -aux-info switch.
>
> Run like this: cat talloc.h | ./script/mksigs.pl
>
> This simple parser is probably too coarse to handle all possible
> header files, but it does treat talloc.h correctly.
>
> Michael
>
> commit e896f9188d8c44a24dcc8961bafd2667080ffd37
> Author: Michael Adam <obnox at samba.org>
> Date: Fri Aug 28 15:01:17 2009 +0200
>
> talloc: add scripts to extract library symbols (exports file) from headers
>
> Michael
>
> -----------------------------------------------------------------------
>
> Summary of changes:
> lib/talloc/script/abi_checks.sh | 91 ++++++++++
> .../{abi_checks.sh => script/abi_checks_gcc.sh} | 0
> lib/talloc/script/mksigs.pl | 178 ++++++++++++++++++++
> {source3 => lib/talloc}/script/mksyms.awk | 0
> {source3 => lib/talloc}/script/mksyms.sh | 0
> lib/talloc/talloc.exports | 1 -
> lib/talloc/talloc.mk | 8 +
> 7 files changed, 277 insertions(+), 1 deletions(-)
> create mode 100755 lib/talloc/script/abi_checks.sh
> rename lib/talloc/{abi_checks.sh => script/abi_checks_gcc.sh} (100%)
> create mode 100755 lib/talloc/script/mksigs.pl
> copy {source3 => lib/talloc}/script/mksyms.awk (100%)
> copy {source3 => lib/talloc}/script/mksyms.sh (100%)
>
>
> Changeset truncated at 500 lines:
>
> diff --git a/lib/talloc/script/abi_checks.sh b/lib/talloc/script/abi_checks.sh
> new file mode 100755
> index 0000000..c34a659
> --- /dev/null
> +++ b/lib/talloc/script/abi_checks.sh
> @@ -0,0 +1,91 @@
> +#!/bin/sh
> +
> +#
> +# abi_checks.sh - check for possible abi changes
> +#
> +# Copyright (C) 2009 Micheal Adam <obnox at samba.org>
> +#
> +# This program is free software; you can redistribute it and/or modify it
> +# under the terms of the GNU General Public License as published by the Free
> +# Software Foundation; either version 3 of the License, or (at your option)
> +# any later version.
> +#
> +# This program is distributed in the hope that it will be useful, but WITHOUT
> +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
> +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
> +# more details.
> +#
> +# You should have received a copy of the GNU General Public License along with
> +# this program; if not, see <http://www.gnu.org/licenses/>.
> +#
> +
> +#
> +# USAGE: abi_checks.sh LIBNAME header1 [header2 ...]
> +#
> +# This script creates symbol and signature lists from the provided header
> +# files with the aid of the mksyms.sh and mksigs.pl scripts (saved as
> +# $LIBNAME.exports.check and $LIBNAME.sigatures.check). It then compares
> +# the resulting files with the files $LIBNAME.exports and $LIBNME.signatures
> +# which it expects to find in the current directory.
> +#
> +
> +LANG=C; export LANG
> +LC_ALL=C; export LC_ALL
> +LC_COLLATE=C; export LC_COLLATE
> +
> +script=$0
> +dir_name=$(dirname ${script})
> +
> +if test x"$1" = "x" ; then
> + echo "USAGE: ${script} libname header [header ...]"
> + exit 1
> +fi
> +
> +libname="$1"
> +shift
> +
> +if test x"$1" = "x" ; then
> + echo "USAGE: ${script} libname header [header ...]"
> + exit 1
> +fi
> +
> +headers="$*"
> +
> +exports_file=${libname}.exports
> +exports_file_check=${exports_file}.check
> +signatures_file=${libname}.signatures
> +signatures_file_check=${signatures_file}.check
> +
> +
> +${dir_name}/mksyms.sh awk ${exports_file_check} ${headers} 2>&1 > /dev/null
> +
> +cat ${headers} | ${dir_name}/mksigs.pl > ${signatures_file_check} 2> /dev/null
> +
> +normalize_exports_file() {
> + filename=$1
> + cat ${filename} \
> + | sed -e 's/^[ \t]*//g' \
> + | sed -e 's/^$//g' \
> + | sed -e 's/^#.*$//g' \
> + | sort | uniq > ${filename}.sort
> +}
> +
> +normalize_exports_file ${exports_file}
> +normalize_exports_file ${exports_file_check}
> +
> +normalize_exports_file ${signatures_file}
> +normalize_exports_file ${signatures_file_check}
> +
> +diff -u ${exports_file}.sort ${exports_file_check}.sort
> +if test "x$?" != "x0" ; then
> + echo "WARNING: possible ABI change detected in exports!"
> +else
> + echo "exports check: OK"
> +fi
> +
> +diff -u ${signatures_file}.sort ${signatures_file_check}.sort
> +if test "x$?" != "x0" ; then
> + echo "WARNING: possible ABI change detected in signatures!"
> +else
> + echo "signatures check: OK"
> +fi
> diff --git a/lib/talloc/abi_checks.sh b/lib/talloc/script/abi_checks_gcc.sh
> similarity index 100%
> rename from lib/talloc/abi_checks.sh
> rename to lib/talloc/script/abi_checks_gcc.sh
> diff --git a/lib/talloc/script/mksigs.pl b/lib/talloc/script/mksigs.pl
> new file mode 100755
> index 0000000..28a2e74
> --- /dev/null
> +++ b/lib/talloc/script/mksigs.pl
> @@ -0,0 +1,178 @@
> +#!/usr/bin/perl
> +
> +# mksigs.pl - extract signatures from C headers
> +#
> +# Copyright (C) Michael Adam 2009
> +#
> +# This program is free software; you can redistribute it and/or modify it
> +# under the terms of the GNU General Public License as published by the Free
> +# Software Foundation; either version 3 of the License, or (at your option)
> +# any later version.
> +#
> +# This program is distributed in the hope that it will be useful, but WITHOUT
> +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
> +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
> +# more details.
> +#
> +# You should have received a copy of the GNU General Public License along with
> +# this program; if not, see <http://www.gnu.org/licenses/>.
> +
> +# USAGE: cat $header_files | mksigs.pl > $signature_file
> +#
> +# The header files to parse are read from stdin.
> +# The output is in a form as produced by gcc with the -aux-info switch
> +# and printed to stdout.
> +
> +use strict;
> +use warnings;
> +
> +my $in_comment = 0;
> +my $extern_C_block = 0;
> +
> +while (my $LINE = <>) {
> + # find end of started multi-line-comment
> + if ($in_comment) {
> + if ($LINE =~ /^.*?\*\/(.*)$/) {
> + $LINE = $1;
> + $in_comment = 0;
> + } else {
> + # whole line within comment
> + next;
> + }
> + }
> +
> + # strip C++-style comments
> + $LINE =~ s/^(.*?)\/\/.*$/$1/;
> +
> + # strip in-line-comments:
> + while ($LINE =~ /\/\*.*?\*\//) {
> + $LINE =~ s/\/\*.*?\*\///;
> + }
> +
> + # find starts of multi-line-comments
> + if ($LINE =~ /^(.*)\/\*/) {
> + $in_comment = 1;
> + $LINE = $1;
> + }
> +
> + # skip empty lines
> + next if $LINE =~ /^\s*$/;
> +
> + # remove leading spaces
> + $LINE =~ s/^\s*(.*)$/$1/;
> +
> + # concatenate lines split with "\" (usually macro defines)
> + while ($LINE =~ /^(.*?)\s+\\$/) {
> + my $LINE2 = <>;
> + $LINE = $1;
> + $LINE2 =~ s/^\s*(.*)$/$1/;
> + $LINE .= " " . $LINE2;
> + }
> +
> + # remove all preprocessor directives
> + next if ($LINE =~ /^#/);
> +
> + if ($LINE =~ /^extern\s+"C"\s+\{/) {
> + $extern_C_block = 1;
> + next;
> + }
> +
> + if (($LINE =~ /^[^\{]*\}/) and $extern_C_block) {
> + $extern_C_block = 0;
> + next;
> + }
> +
> + $LINE =~ s/^extern\s//;
> +
> + # concatenate braces stretched over multiple lines
> + # (from structs or enums)
> + my $REST = $LINE;
> + my $braces = 0;
> + while (($REST =~ /[\{\}]/) or ($braces)) {
> + while ($REST =~ /[\{\}]/) {
> + # collect opening
> + while ($REST =~ /^[^\{\}]*\{(.*)$/) {
> + $braces++;
> + $REST = $1;
> + }
> +
> + # collect closing
> + while ($REST =~ /^[^\{\}]*\}(.*)$/) {
> + $braces--;
> + $REST = $1;
> + }
> + }
> +
> + # concatenate if not balanced
> + if ($braces) {
> + if (my $LINE2 = <>) {
> + $LINE2 =~ s/^\s*(.*)$/$1/;
> + chomp($LINE);
> + $LINE .= " " . $LINE2;
> + chomp $REST;
> + $REST .= " " . $LINE2;
> + } else {
> + print "ERROR: unbalanced braces ($braces)\n";
> + last;
> + }
> + }
> + }
> +
> + next if ($LINE =~ /^typedef\s/);
> + next if ($LINE =~ /^enum\s+[^\{\(]+\s+\{/);
> + next if ($LINE =~ /^struct\s+[^\{\(]+\s+\{.*\}\s*;/);
> +
> + # concetenate function prototypes that stretch over multiple lines
> + $REST = $LINE;
> + my $parenthesis = 0;
> + while (($REST =~ /[\(\)]/) or ($parenthesis)) {
> + while ($REST =~ /[\(\)]/) {
> + # collect opening
> + while ($REST =~ /^[^\(\)]*\((.*)$/) {
> + $parenthesis++;
> + $REST = $1;
> + }
> +
> + # collect closing
> + while ($REST =~ /^[^\(\)]*\)(.*)$/) {
> + $parenthesis--;
> + $REST = $1;
> + }
> + }
> +
> + # concatenate if not balanced
> + if ($parenthesis) {
> + if (my $LINE2 = <>) {
> + $LINE2 =~ s/^\s*(.*)$/$1/;
> + chomp($LINE);
> + $LINE .= " " . $LINE2;
> + chomp($REST);
> + $REST .= " " . $LINE2;
> + } else {
> + print "ERROR: unbalanced parantheses ($parenthesis)\n";
> + last;
> + }
> + }
> + }
> +
> + # remove trailing spaces
> + $LINE =~ s/(.*?)\s*$/$1/;
> +
> + $LINE =~ s/^(.*\))\s+PRINTF_ATTRIBUTE\(.*\);$/$1;/;
> +
> + # remove parameter names - slightly too coarse probably
> + $LINE =~ s/([\s\(]\*?)[_0-9a-zA-Z]+\s*([,\)])/$1$2/g;
> +
> + # remedy (void) from last line
> + $LINE =~ s/\(\)/(void)/g;
> +
> + # normalize spaces
> + $LINE =~ s/\s*\)\s*/)/g;
> + $LINE =~ s/\s*\(\s*/ (/g;
> + $LINE =~ s/\s*,\s*/, /g;
> +
> + # normalize unsigned
> + $LINE =~ s/([\s,\(])unsigned([,\)])/$1unsigned int$2/g;
> +
> + print $LINE . "\n";
> +}
> diff --git a/source3/script/mksyms.awk b/lib/talloc/script/mksyms.awk
> similarity index 100%
> copy from source3/script/mksyms.awk
> copy to lib/talloc/script/mksyms.awk
> diff --git a/source3/script/mksyms.sh b/lib/talloc/script/mksyms.sh
> similarity index 100%
> copy from source3/script/mksyms.sh
> copy to lib/talloc/script/mksyms.sh
> diff --git a/lib/talloc/talloc.exports b/lib/talloc/talloc.exports
> index c1db67b..75134c0 100644
> --- a/lib/talloc/talloc.exports
> +++ b/lib/talloc/talloc.exports
> @@ -61,7 +61,6 @@
> talloc_version_minor;
> _talloc_zero;
> _talloc_zero_array;
> - talloc_free;
>
> local: *;
> };
> diff --git a/lib/talloc/talloc.mk b/lib/talloc/talloc.mk
> index 2a2e110..a563d61 100644
> --- a/lib/talloc/talloc.mk
> +++ b/lib/talloc/talloc.mk
> @@ -31,9 +31,17 @@ 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
> + rm -f talloc.exports.sort talloc.exports.check talloc.exports.check.sort
> + rm -f talloc.signatures.sort talloc.signatures.check talloc.signatures.check.sort
>
> test:: testsuite
> ./testsuite
>
> +abi_checks::
> + @echo ABI checks:
> + @./script/abi_checks.sh talloc talloc.h
> +
> +test:: abi_checks
> +
> gcov::
> gcov talloc.c
>
>
--
Simo Sorce
Samba Team GPL Compliance Officer <simo at samba.org>
Principal Software Engineer at Red Hat, Inc. <simo at redhat.com>
More information about the samba-technical
mailing list