Better handle decl-only classes being different from their definition
authorDodji Seketeli <dodji@redhat.com>
Mon, 3 Jul 2017 11:31:32 +0000 (13:31 +0200)
committerDodji Seketeli <dodji@redhat.com>
Tue, 4 Jul 2017 14:47:43 +0000 (16:47 +0200)
commit6f7d84e5087c02550d39adf69f79dc230059f6ca
treebffb8a290346c8d928a0d8ddd2410d215255ab03
parent91e3240231f2e352991c9462226a8a279a4b2e79
Better handle decl-only classes being different from their definition

Sincea little while, libabigail can now handle the presence of several
different class types definition that have the same name.

To handle that, we settled that for types originating from C, a
decl-only class would be considered different from a definition of
that class.  Especially during type canonicalization.

Now it seems that it's wrong to consider this only for C types.  That
is because the same class type foo, defined in a C header, can be
compile either into a C++ compilation unit, or a C one, in the same
binary.  That is, in the same binary, a struct type foo can be seen
defined in a C compilation unit *and* in a C++ compilation unit.

So rigth now, the C++ struct type foo would compare equal to a
decl-only struct foo, but the C struct type foo would compare
different to a decl-only struct foo.  This leads to spurious change
reports, especiall in the nmap and mariadb package from Fedora 25,
when we run selfcheck.py on fc25 critpath packages.

This patch makes libabigail always consider -- during type
canonicalization -- that a decl-only class is different from a
definition of that class.  Not only for C.

* src/abg-comparison.cc (function_decl_diff::report): Don't report
possible vtable changes between a decl-only class and its
definition.
* src/abg-ir.cc (type_base::get_canonical_type_for): Consider that
a decl-only class is different from its definition when comparing
types for the purpose of type canonicalization.
(equals): In the class_or_union overload, only consider the global
decl_only_class_equals_definition() property to know when to
consider that a decl-only class is different from its definition
when comparing two classes.
* src/abg-reader.cc (build_class_decl): Read the size property of
a class, even if it's a decl-only class.
* src/abg-writer.cc (write_class_decl_opening_tag): Write size
property of types even if the types are decl-only classes.
* tests/data/test-annotate/test13-pr18894.so.abi: Adjust.
* tests/data/test-annotate/test14-pr18893.so.abi: Likewise.
* tests/data/test-annotate/test15-pr18892.so.abi: Likewise.
* tests/data/test-annotate/test17-pr19027.so.abi: Likewise.
* tests/data/test-annotate/test18-pr19037-libvtkRenderingLIC-6.1.so.abi:
Likewise.
* tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi:
Likewise.
* tests/data/test-annotate/test20-pr19025-libvtkParallelCore-6.1.so.abi:
Likewise.
* tests/data/test-annotate/test21-pr19092.so.abi: Likewise.
* tests/data/test-diff-dwarf-abixml/test0-pr19026-libvtkIOSQL-6.1.so.1.abi:
Likewise.
* tests/data/test-diff-filter/test31-pr18535-libstdc++-report-0.txt:
Likewise.
* tests/data/test-diff-filter/test31-pr18535-libstdc++-report-1.txt:
Likewise.
* tests/data/test-read-dwarf/test12-pr18844.so.abi: Likewise.
* tests/data/test-read-dwarf/test13-pr18894.so.abi: Likewise.
* tests/data/test-read-dwarf/test14-pr18893.so.abi: Likewise.
* tests/data/test-read-dwarf/test15-pr18892.so.abi: Likewise.
* tests/data/test-read-dwarf/test17-pr19027.so.abi: Likewise.
* tests/data/test-read-dwarf/test18-pr19037-libvtkRenderingLIC-6.1.so.abi:
Likewise.
* tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi:
Likewise.
* tests/data/test-read-dwarf/test20-pr19025-libvtkParallelCore-6.1.so.abi:
Likewise.
* tests/data/test-read-dwarf/test21-pr19092.so.abi: Likewise.
* tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi:
Likewise.
* tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
26 files changed:
src/abg-comparison.cc
src/abg-ir.cc
src/abg-reader.cc
src/abg-writer.cc
tests/data/test-annotate/test13-pr18894.so.abi
tests/data/test-annotate/test14-pr18893.so.abi
tests/data/test-annotate/test15-pr18892.so.abi
tests/data/test-annotate/test17-pr19027.so.abi
tests/data/test-annotate/test18-pr19037-libvtkRenderingLIC-6.1.so.abi
tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi
tests/data/test-annotate/test20-pr19025-libvtkParallelCore-6.1.so.abi
tests/data/test-annotate/test21-pr19092.so.abi
tests/data/test-diff-dwarf-abixml/test0-pr19026-libvtkIOSQL-6.1.so.1.abi
tests/data/test-diff-filter/test31-pr18535-libstdc++-report-0.txt
tests/data/test-diff-filter/test31-pr18535-libstdc++-report-1.txt
tests/data/test-read-dwarf/test12-pr18844.so.abi
tests/data/test-read-dwarf/test13-pr18894.so.abi
tests/data/test-read-dwarf/test14-pr18893.so.abi
tests/data/test-read-dwarf/test15-pr18892.so.abi
tests/data/test-read-dwarf/test17-pr19027.so.abi
tests/data/test-read-dwarf/test18-pr19037-libvtkRenderingLIC-6.1.so.abi
tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi
tests/data/test-read-dwarf/test20-pr19025-libvtkParallelCore-6.1.so.abi
tests/data/test-read-dwarf/test21-pr19092.so.abi
tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi
tests/data/test-read-dwarf/test9-pr18818-clang.so.abi