summaryrefslogtreecommitdiff
path: root/qpid/cpp/src/check-abi
blob: 6742ce8253e4bc9c0bf0fb1886b3f07b1e2e56fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#! /bin/bash

rc=0
syms_desired=$(mktemp)
syms_library=$(mktemp)
syms_missing=$(mktemp)
syms_extra=$(mktemp)

trap 'rm $syms_desired $syms_library $syms_missing $syms_extra' EXIT

# Extract exported symbols from library
nm -DC --defined-only -f s $1 | cut -f1 -d'|' -s | sort -u > $syms_library

# Process API syms (substitute in some typedefs etc.)
sed $2 -e '
    s/uint64_t/unsigned long/
    s/uint32_t/unsigned int/
    s/uint16_t/unsigned short/
    s/uint8_t/unsigned char/
    s/size_t/unsigned long/
    s/int64_t/long/
    s/int32_t/int/
    s/int16_t/short/
    s/int8_t/signed char/
    s/qpid::types::Variant::Map/std::map<std::string, qpid::types::Variant, std::less<std::string>, std::allocator<std::pair<std::string const, qpid::types::Variant> > >/
    s/qpid::types::Variant::List/std::list<qpid::types::Variant, std::allocator<qpid::types::Variant> >/
    /^$/d
    /^#.*$/d
' | sort -u > $syms_desired

comm -23 $syms_desired $syms_library > $syms_missing
comm -13 $syms_desired $syms_library > $syms_extra

if [ -n "$(cat $syms_missing)" ] ; then
  (echo "Not exported from library (should be)"
   echo "====================================="
   cat $syms_missing ) 1>&2
   rc=1
fi


if [ -n "$(cat $syms_extra)" ]; then
  (echo "Exported by library but not in spec"
   echo "==================================="
   cat $syms_extra ) 1>&2
fi

exit $rc