]> sourceware.org Git - libabigail.git/commit
Make applying supp specs through pointer access look through typedefs
authorDodji Seketeli <dodji@redhat.com>
Fri, 31 Jul 2015 10:58:08 +0000 (12:58 +0200)
committerDodji Seketeli <dodji@redhat.com>
Sat, 1 Aug 2015 12:34:46 +0000 (14:34 +0200)
commita746f4afeee5c4c3992d0b7e2cff372b9159e835
tree0098f0b728f571a505ed42c0e622d79e94b3a67b
parentf0d319ab4228d4a173a5d382d9d38edbcb6c90dc
Make applying supp specs through pointer access look through typedefs

Consider the declaration of the exported function bar() below:

    struct _OpaqueType {int member;};

    typedef struct _OpaqueType Type;

    void bar(Type*);

Once the *definition of struct _OpaqueType and bar() are compiled into
a shared library, if a layout change happens to struct _OpaqueType,
then abidiff rightfully reports that bar() is impacted by the layout
change to struct _OpaqueType.

But then, the following suppression specification won't silence the
ABI change report:

    [suppress_type]
      name = _OpaqueType
      type_kind = struct
      accessed_through = pointer

This is because strictly speaking, it's not struct _OpaqueType that is
accessed through a pointer, from function bar(); it's the type 'Type',
(which is a typedef of struct _OpaqueType) that is accessed though a
pointer.

But then, as 'Type' and 'struct _OpaqueType' are the same type (modulo
the typedef), this behaviour is not super useful.  It would be more
interesting if the suppression specification could silence the ABI
change report.

And this is what this patch does.

* include/abg-comparison.h (type_suppression::suppresses_type):
Declare new member function.
(get_typedef_diff_underlying_type_diff): Declare new function.
* include/abg-fwd.h (get_typedef_underlying_type): Likewise.
* src/abg-comparison.cc (type_suppression::suppresses_type):
Define new member function.
(get_typedef_diff_underlying_type_diff): Define new function.
(type_suppression::suppresses_diff): After looking through the
different kind of access methods, use the new
type_suppression::suppresses_type(), rather than doing lots of
stuff ourselves here.  But then, if the suppression doesn't apply
to the subjects of the diff, look through typedefs and try to
apply the suppression again.
* src/abg-ir.cc (get_typedef_underlying_type): Define new
function.
* tests/data/test-diff-suppr/libtest25-typedef-v{0,1}.so: New
binary test input files.
* tests/data/test-diff-suppr/test25-typedef-v{0,1}.c: Source code
for the binary test input files above.
* tests/data/test-diff-suppr/test25-typedef-report-{0, 1}.txt: New test
input files.
* tests/data/test-diff-suppr/test25-typedef-suppr-0.txt: New test
input file.
* tests/data/Makefile.am: Add the new test material to the source
distribution.
* tests/test-diff-suppr.cc (in_out_specs): Add the test inputs
above to the set of test inputs this harness has to run over.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
13 files changed:
include/abg-comparison.h
include/abg-fwd.h
src/abg-comparison.cc
src/abg-ir.cc
tests/data/Makefile.am
tests/data/test-diff-suppr/libtest25-typedef-v0.so [new file with mode: 0755]
tests/data/test-diff-suppr/libtest25-typedef-v1.so [new file with mode: 0755]
tests/data/test-diff-suppr/test25-typedef-report-0.txt [new file with mode: 0644]
tests/data/test-diff-suppr/test25-typedef-report-1.txt [new file with mode: 0644]
tests/data/test-diff-suppr/test25-typedef-suppr-0.txt [new file with mode: 0644]
tests/data/test-diff-suppr/test25-typedef-v0.c [new file with mode: 0644]
tests/data/test-diff-suppr/test25-typedef-v1.c [new file with mode: 0644]
tests/test-diff-suppr.cc
This page took 0.035739 seconds and 5 git commands to generate.