Commit Graph

679 Commits

Author SHA1 Message Date
Dodji Seketeli
b918ec8f77 tests/catch.hpp: Add SPDX header back
* tests/lib/catch.hpp: Add SPDX header back.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2021-03-08 11:33:56 +01:00
Dodji Seketeli
e3aa28ac7b dwarf-reader: Keep stable order when de-duplicating class definitions
During de-duplication of class definition while resolving decl-only
classes to their definition, the order in which classes of the same
name are compared is not always the same.  That results in an
instability of the particular class being kept.  This can have an
impact when some classes have member types because member types are
not meaningful during comparison; so in the end that can lead to
spurious order instability during ABIXML serialization.

	* src/abg-dwarf-reader.cc
	(read_context::resolve_declaration_only_classes): Compare the
	classes that have the same name across several TU, always in the
	same order.
	* tests/data/test-annotate/test15-pr18892.so.abi: Adjust.
	* tests/data/test-read-dwarf/test15-pr18892.so.abi: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2021-03-01 10:34:38 +01:00
Dodji Seketeli
f022e3e993 Better sorting of (anonymous) types in ABIXML files
I am still seeing in some cases, some instability in type sorting in
ABIXML.

It looks related to anonymous types sorting, so this patch tries
harder to have anonymous types have names more suitable for internal
matters this.

	* src/abg-writer.cc (type_ptr_cmp::operator()): Use the internal
	pretty representation of types, for comparison.
	* tests/data/test-read-dwarf/PR22015-libboost_iostreams.so.abi:
	Adjust.
	* tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Likewise.
	* tests/data/test-read-dwarf/PR25007-sdhci.ko.abi: Likewise.
	* tests/data/test-read-dwarf/PR25042-libgdbm-clang-dwarf5.so.6.0.0.abi:
	Likewise.
	* tests/data/test-read-dwarf/test-libandroid.so.abi: Likewise.
	* tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: 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/test16-pr18904.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.
	* tests/data/test-annotate/test13-pr18894.so.abi: Likewise.
	* 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.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2021-03-01 10:34:26 +01:00
Dodji Seketeli
8ae8dcb8d5 tests: Update to catch.hpp v2.13.4 and fix #2178
This patch is about fixing a compilation error that we are seeing on
Fedora Rawhide with glibc 2.33.9000, which makes MINSIGSTKSZ not be a
constant value anymore.  Thus, the sigStackSize variable that is
declared constexpr cannot use that MINSIGSTKSZ as initializer anymore.

So as suggested in the issue
https://github.com/catchorg/Catch2/issues/2178 filed against
'catchorg' for this purpose, I am hardwiring the initialization value
of sigStackSize for now.

	* tests/lib/catch.hpp: Update to v2.13.4 and initialize
	sigStackSize to 32768 for now, as suggested by
	https://github.com/catchorg/Catch2/issues/2178.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2021-02-24 09:12:06 +01:00
Dodji Seketeli
77bc4b7b15 Don't consider type name when comparing typedefs
This is from a problem report originating from Red Hat bugzilla at
https://bugzilla.redhat.com/show_bug.cgi?id=1925876

I some C programs, the same type can be defined more than once in a
binary, as there is no "One Definition Rule[1]" in C.

    [1]: https://en.wikipedia.org/wiki/One_Definition_Rule

The definition of those two types can be slightly different and yet be
equivalent.

For instance, the data member of a struct S might be defined once as
having a type which is a typedef Foo of, say, "long int" and that
struct S might be defined again elsewhere with a data member of type
typedef Bar of "long int" as well.

With the current code, because Foo and Bar have different names, they
are are going to compare different; so the two struct S are doing to
compare different even though they are equivalent.

Down the road, this is likely going to imply that the several 'struct
S' that are declaration-only will not be resolved as being
declarations of the definition of "struct S", because they is more
than one such definition, and those definitions are different.

This is going to lead to spurious (and hard to debug) type differences
that are going to be detected and reported by libabigail later down
the road.

This patch addresses the problem by not taking typedef names into
account when comparing typedefs before canonicalization.  That allows
the comparison of classes and structs that happens during the
resolution of declaration-only classes to correctly deduce their
equivalence even in cases like the one exposed above.  It thus reduces
the amount of declaration-only classes that are unnecessarily
considered to be different from the definition they ought to equal.

	* include/abg-ir.h (maybe_compare_as_member_decls): Declare new
	function.  Make it a friend of class decl_base.
	* src/abg-dwarf-reader.cc (maybe_canonicalize_type): Don't early
	canonicalize typedefs because they can be "part" of a type that is
	not yet completed, especially considering that class declaration
	resolution is part of type building, stricto sensu.
	* src/abg-ir.cc (maybe_compare_as_member_decls): Factorize this
	out of ...
	(equals): ... the overload for decl_base.  Use it in the overload
	for typedef_decl.
	* tests/data/test-diff-pkg/nmap-7.70-5.el8_testjcc.x86_64-self-check-report-0.txt:
	New test reference output.
	* tests/data/test-diff-pkg/nmap-7.70-5.el8_testjcc.x86_64.rpm: New
	binary input.
	* tests/data/test-diff-pkg/nmap-debuginfo-7.70-5.el8_testjcc.x86_64.rpm: Likewise.
	* tests/data/Makefile.am: Add these new testing material to source
	distribution.
 	* tests/test-diff-pkg.cc (in_out_specs): Add the new test input to
	the harness.
	* tests/data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-0.txt:
	Adjust.
	* tests/data/test-diff-suppr/test39-opaque-type-report-0.txt:
	Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2021-02-11 17:23:42 +01:00
Dodji Seketeli
a8c0199df5 Use generic internal type name to canonicalize anonymous enums
This is from the problem report in Red Hat bugzilla

    https://bugzilla.redhat.com/show_bug.cgi?id=1924624
    "comparing 'libpinyin.so.13.0.0' to itself wrongly yielded result"

During the canonicalization of an anonymous enum, the algorithm uses
its internal pretty representation to limit the number of types to
compare it to.  That internal pretty representation is based on its
type name.

For anonymous types, the type name is not unique; it's constructed for
internal purposes that are different from the purpose of
canonicalization.  So using that in the pretty representation might
negatively impact the accuracy of the canonicalization; it might make
it so that two anonymous in the same namespace types might wrongly be
considered canonically different.

To fix that, this change makes the internal pretty representation of
anonymous enum types essentially be "enum
<namespace-name>::__anonymous_enum__".

This is on part with what is done for unions and classes in commit:
    005ab5c9 Use flat representation to canonicalize anonymous classes and unions

	* src/abg-ir.cc (has_generic_anonymous_internal_type_name) :
	Define new static function.
	(get_generic_anonymous_internal_type_name): Use it here.
	(decl_base::get_pretty_representation): For internal purposes,
	build an anonymous name that is stable.
	* tests/data/test-annotate/test21-pr19092.so.abi: Adjust.
	* tests/data/test-diff-pkg/PR24690/PR24690-report-0.txt: Adjust.
	* tests/data/test-diff-pkg/nss-3.23.0-1.0.fc23.x86_64-report-0.txt: Adjust.
	* tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Adjust.
	* tests/data/test-read-dwarf/test-libandroid.so.abi: Adjust.
	* tests/data/test-read-dwarf/test21-pr19092.so.abi: Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2021-02-10 20:03:11 +01:00
Giuliano Procida
89de572d7b abidiff: do not qualify member names in diff report
Bug 26012 - abidiff: do not emit qualified name for data members

The enclosing struct (or union or class) is given by the surrounding
diff context. This change eliminates a lot of repetition in the diff
report.

	* src/abg-reporter-priv.cc (represent_data_member): Do not
	qualify member names. (represent): Do not qualify member names.
	* tests/data/test-abicompat/test0-fn-changed-report-0.txt: Refresh.
	* tests/data/test-abicompat/test0-fn-changed-report-2.txt: Refresh.
	* tests/data/test-abicompat/test5-fn-changed-report-0.txt: Refresh.
	* tests/data/test-abicompat/test5-fn-changed-report-1.txt: Refresh.
	* tests/data/test-abicompat/test6-var-changed-report-0.txt: Refresh.
	* tests/data/test-abicompat/test6-var-changed-report-1.txt: Refresh.
	* tests/data/test-abicompat/test7-fn-changed-report-0.txt: Refresh.
	* tests/data/test-abicompat/test7-fn-changed-report-1.txt: Refresh.
	* tests/data/test-abicompat/test7-fn-changed-report-2.txt: Refresh.
	* tests/data/test-abicompat/test8-fn-changed-report-0.txt: Refresh.
	* tests/data/test-abicompat/test9-fn-changed-report-0.txt: Refresh.
	* tests/data/test-abidiff-exit/qualifier-typedef-array-report-1.txt:
	Refresh.
	* tests/data/test-abidiff-exit/test-fun-param-report.txt: Refresh.
	* tests/data/test-abidiff-exit/test-headers-dirs/test-headers-dir-report-2.txt:
	Refresh.
	* tests/data/test-abidiff-exit/test-leaf-cxx-members-report.txt:
	Refresh.
	* tests/data/test-abidiff-exit/test-leaf-peeling-report.txt: Refresh.
	* tests/data/test-abidiff-exit/test-leaf-redundant-report.txt: Refresh.
	* tests/data/test-abidiff-exit/test-member-size-report0.txt: Refresh.
	* tests/data/test-abidiff-exit/test-member-size-report1.txt: Refresh.
	* tests/data/test-abidiff-exit/test-net-change-report0.txt: Refresh.
	* tests/data/test-abidiff/test-PR18791-report0.txt: Refresh.
	* tests/data/test-abidiff/test-qual-type0-report.txt: Refresh.
	* tests/data/test-abidiff/test-struct0-report.txt: Refresh.
	* tests/data/test-abidiff/test-struct1-report.txt: Refresh.
	* tests/data/test-diff-dwarf/PR25058-liblttng-ctl-report-1.txt:
	Refresh.
	* tests/data/test-diff-dwarf/test0-report.txt: Refresh.
	* tests/data/test-diff-dwarf/test1-report.txt: Refresh.
	* tests/data/test-diff-dwarf/test10-report.txt: Refresh.
	* tests/data/test-diff-dwarf/test11-report.txt: Refresh.
	* tests/data/test-diff-dwarf/test13-report.txt: Refresh.
	* tests/data/test-diff-dwarf/test21-redundant-fn-report-0.txt: Refresh.
	* tests/data/test-diff-dwarf/test27-local-base-diff-report.txt:
	Refresh.
	* tests/data/test-diff-dwarf/test3-report.txt: Refresh.
	* tests/data/test-diff-dwarf/test32-fnptr-changes-report-0.txt:
	Refresh.
	* tests/data/test-diff-dwarf/test33-fnref-changes-report-0.txt:
	Refresh.
	* tests/data/test-diff-dwarf/test36-ppc64-aliases-report-0.txt:
	Refresh.
	* tests/data/test-diff-dwarf/test37-union-report-0.txt: Refresh.
	* tests/data/test-diff-dwarf/test38-union-report-0.txt: Refresh.
	* tests/data/test-diff-dwarf/test39-union-report-0.txt: Refresh.
	* tests/data/test-diff-dwarf/test4-report.txt: Refresh.
	* tests/data/test-diff-dwarf/test40-report-0.txt: Refresh.
	* tests/data/test-diff-dwarf/test44-anon-struct-union-report-0.txt:
	Refresh.
	* tests/data/test-diff-dwarf/test45-anon-dm-change-report-0.txt:
	Refresh.
	* tests/data/test-diff-dwarf/test46-rust-report-0.txt: Refresh.
	* tests/data/test-diff-dwarf/test5-report.txt: Refresh.
	* tests/data/test-diff-dwarf/test8-report.txt: Refresh.
	* tests/data/test-diff-filter/libtest45-basic-type-change-report-0.txt:
	Refresh.
	* tests/data/test-diff-filter/test-PR26739-2-report-0.txt: Refresh.
	* tests/data/test-diff-filter/test0-report.txt: Refresh.
	* tests/data/test-diff-filter/test01-report.txt: Refresh.
	* tests/data/test-diff-filter/test1-report.txt: Refresh.
	* tests/data/test-diff-filter/test10-report.txt: Refresh.
	* tests/data/test-diff-filter/test11-report.txt: Refresh.
	* tests/data/test-diff-filter/test13-report.txt: Refresh.
	* tests/data/test-diff-filter/test14-0-report.txt: Refresh.
	* tests/data/test-diff-filter/test14-1-report.txt: Refresh.
	* tests/data/test-diff-filter/test15-0-report.txt: Refresh.
	* tests/data/test-diff-filter/test15-1-report.txt: Refresh.
	* tests/data/test-diff-filter/test16-report-2.txt: Refresh.
	* tests/data/test-diff-filter/test16-report.txt: Refresh.
	* tests/data/test-diff-filter/test17-0-report.txt: Refresh.
	* tests/data/test-diff-filter/test17-1-report.txt: Refresh.
	* tests/data/test-diff-filter/test18-report.txt: Refresh.
	* tests/data/test-diff-filter/test2-report.txt: Refresh.
	* tests/data/test-diff-filter/test25-cyclic-type-report-0.txt: Refresh.
	* tests/data/test-diff-filter/test25-cyclic-type-report-1.txt: Refresh.
	* tests/data/test-diff-filter/test26-qualified-redundant-node-report-0.txt:
	Refresh.
	* tests/data/test-diff-filter/test26-qualified-redundant-node-report-1.txt:
	Refresh.
	* tests/data/test-diff-filter/test27-redundant-and-filtered-children-nodes-report-0.txt:
	Refresh.
	* tests/data/test-diff-filter/test27-redundant-and-filtered-children-nodes-report-1.txt:
	Refresh.
	* tests/data/test-diff-filter/test27-redundant-and-filtered-children-nodes-report-2.txt:
	Refresh.
	* tests/data/test-diff-filter/test28-redundant-and-filtered-children-nodes-report-0.txt:
	Refresh.
	* tests/data/test-diff-filter/test28-redundant-and-filtered-children-nodes-report-1.txt:
	Refresh.
	* tests/data/test-diff-filter/test29-finer-redundancy-marking-report-0.txt:
	Refresh.
	* tests/data/test-diff-filter/test3-report.txt: Refresh.
	* tests/data/test-diff-filter/test30-pr18904-rvalueref-report0.txt:
	Refresh.
	* tests/data/test-diff-filter/test30-pr18904-rvalueref-report1.txt:
	Refresh.
	* tests/data/test-diff-filter/test30-pr18904-rvalueref-report2.txt:
	Refresh.
	* tests/data/test-diff-filter/test31-pr18535-libstdc++-report-0.txt:
	Refresh.
	* tests/data/test-diff-filter/test31-pr18535-libstdc++-report-1.txt:
	Refresh.
	* tests/data/test-diff-filter/test32-ppc64le-struct-change-report0.txt:
	Refresh.
	* tests/data/test-diff-filter/test35-pr18754-no-added-syms-report-0.txt:
	Refresh.
	* tests/data/test-diff-filter/test36-report-0.txt: Refresh.
	* tests/data/test-diff-filter/test37-report-0.txt: Refresh.
	* tests/data/test-diff-filter/test39/test39-report-0.txt: Refresh.
	* tests/data/test-diff-filter/test42-leaf-report-output-0.txt: Refresh.
	* tests/data/test-diff-filter/test44-anonymous-data-member-report-0.txt:
	Refresh.
	* tests/data/test-diff-filter/test44-anonymous-data-member-report-1.txt:
	Refresh.
	* tests/data/test-diff-filter/test9-report.txt: Refresh.
	* tests/data/test-diff-pkg/GtkAda-gl-2.24.2-29.fc29.x86_64--2.24.2-30.fc30.x86_64-report-0.txt:
	Refresh.
	* tests/data/test-diff-pkg/PR24690/PR24690-report-0.txt: Refresh.
	* tests/data/test-diff-pkg/dirpkg-1-report-1.txt: Refresh.
	* tests/data/test-diff-pkg/dirpkg-3-report-1.txt: Refresh.
	* tests/data/test-diff-pkg/dirpkg-3-report-2.txt: Refresh.
	* tests/data/test-diff-pkg/libICE-1.0.6-1.el6.x86_64.rpm--libICE-1.0.9-2.el7.x86_64.rpm-report-0.txt:
	Refresh.
	* tests/data/test-diff-pkg/libcdio-0.94-1.fc26.x86_64--libcdio-0.94-2.fc26.x86_64-report.1.txt:
	Refresh.
	* tests/data/test-diff-pkg/libsigc++-2.0-0c2a_2.4.0-1_amd64--libsigc++-2.0-0v5_2.4.1-1ubuntu2_amd64-report-0.txt:
	Refresh.
	* tests/data/test-diff-pkg/nss-3.23.0-1.0.fc23.x86_64-report-0.txt:
	Refresh.
	* tests/data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-2.txt:
	Refresh.
	* tests/data/test-diff-pkg/symlink-dir-test1-report0.txt: Refresh.
	* tests/data/test-diff-pkg/tarpkg-0-report-0.txt: Refresh.
	* tests/data/test-diff-pkg/tarpkg-1-report-0.txt: Refresh.
	* tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-0.txt:
	Refresh.
	* tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-1.txt:
	Refresh.
	* tests/data/test-diff-suppr/libtest48-soname-abixml-report-1.txt:
	Refresh.
	* tests/data/test-diff-suppr/test0-type-suppr-report-0.txt: Refresh.
	* tests/data/test-diff-suppr/test0-type-suppr-report-3.txt: Refresh.
	* tests/data/test-diff-suppr/test0-type-suppr-report-5.txt: Refresh.
	* tests/data/test-diff-suppr/test0-type-suppr-report-7.txt: Refresh.
	* tests/data/test-diff-suppr/test1-typedef-suppr-report-0.txt: Refresh.
	* tests/data/test-diff-suppr/test1-typedef-suppr-report-2.txt: Refresh.
	* tests/data/test-diff-suppr/test11-add-data-member-report-0.txt:
	Refresh.
	* tests/data/test-diff-suppr/test12-add-data-member-report-0.txt:
	Refresh.
	* tests/data/test-diff-suppr/test12-add-data-member-report-2.txt:
	Refresh.
	* tests/data/test-diff-suppr/test13-suppr-through-pointer-report-0.txt:
	Refresh.
	* tests/data/test-diff-suppr/test13-suppr-through-pointer-report-1.txt:
	Refresh.
	* tests/data/test-diff-suppr/test14-suppr-non-redundant-report-0.txt:
	Refresh.
	* tests/data/test-diff-suppr/test14-suppr-non-redundant-report-1.txt:
	Refresh.
	* tests/data/test-diff-suppr/test15-suppr-added-fn-report-0.txt:
	Refresh.
	* tests/data/test-diff-suppr/test15-suppr-added-fn-report-1.txt:
	Refresh.
	* tests/data/test-diff-suppr/test15-suppr-added-fn-report-5.txt:
	Refresh.
	* tests/data/test-diff-suppr/test16-suppr-removed-fn-report-0.txt:
	Refresh.
	* tests/data/test-diff-suppr/test16-suppr-removed-fn-report-2.txt:
	Refresh.
	* tests/data/test-diff-suppr/test16-suppr-removed-fn-report-5.txt:
	Refresh.
	* tests/data/test-diff-suppr/test17-suppr-added-var-report-0.txt:
	Refresh.
	* tests/data/test-diff-suppr/test17-suppr-added-var-report-2.txt:
	Refresh.
	* tests/data/test-diff-suppr/test17-suppr-added-var-report-5.txt:
	Refresh.
	* tests/data/test-diff-suppr/test18-suppr-removed-var-report-0.txt:
	Refresh.
	* tests/data/test-diff-suppr/test18-suppr-removed-var-report-2.txt:
	Refresh.
	* tests/data/test-diff-suppr/test18-suppr-removed-var-report-5.txt:
	Refresh.
	* tests/data/test-diff-suppr/test2-struct-suppr-report-0.txt: Refresh.
	* tests/data/test-diff-suppr/test23-alias-filter-report-0.txt: Refresh.
	* tests/data/test-diff-suppr/test23-alias-filter-report-2.txt: Refresh.
	* tests/data/test-diff-suppr/test24-soname-report-1.txt: Refresh.
	* tests/data/test-diff-suppr/test24-soname-report-10.txt: Refresh.
	* tests/data/test-diff-suppr/test24-soname-report-12.txt: Refresh.
	* tests/data/test-diff-suppr/test24-soname-report-14.txt: Refresh.
	* tests/data/test-diff-suppr/test24-soname-report-16.txt: Refresh.
	* tests/data/test-diff-suppr/test24-soname-report-4.txt: Refresh.
	* tests/data/test-diff-suppr/test25-typedef-report-0.txt: Refresh.
	* tests/data/test-diff-suppr/test26-loc-suppr-report-0.txt: Refresh.
	* tests/data/test-diff-suppr/test26-loc-suppr-report-3.txt: Refresh.
	* tests/data/test-diff-suppr/test29-soname-report-3.txt: Refresh.
	* tests/data/test-diff-suppr/test29-soname-report-6.txt: Refresh.
	* tests/data/test-diff-suppr/test29-soname-report-8.txt: Refresh.
	* tests/data/test-diff-suppr/test3-struct-suppr-report-0.txt: Refresh.
	* tests/data/test-diff-suppr/test3-struct-suppr-report-1.txt: Refresh.
	* tests/data/test-diff-suppr/test3-struct-suppr-report-2.txt: Refresh.
	* tests/data/test-diff-suppr/test30-report-0.txt: Refresh.
	* tests/data/test-diff-suppr/test31-report-1.txt: Refresh.
	* tests/data/test-diff-suppr/test33-report-0.txt: Refresh.
	* tests/data/test-diff-suppr/test35-leaf-report-0.txt: Refresh.
	* tests/data/test-diff-suppr/test36-leaf-report-0.txt: Refresh.
	* tests/data/test-diff-suppr/test4-local-suppr-report-0.txt: Refresh.
	* tests/data/test-diff-suppr/test4-local-suppr-report-1.txt: Refresh.
	* tests/data/test-diff-suppr/test42-negative-suppr-type-report-0.txt:
	Refresh.
	* tests/data/test-diff-suppr/test42-negative-suppr-type-report-1.txt:
	Refresh.
	* tests/data/test-diff-suppr/test46-PR25128-report-1.txt: Refresh.
	* tests/data/test-diff-suppr/test46-PR25128-report-2.txt: Refresh.
	* tests/data/test-diff-suppr/test47-non-reachable-types-report-1.txt:
	Refresh.
	* tests/data/test-diff-suppr/test47-non-reachable-types-report-2.txt:
	Refresh.
	* tests/data/test-diff-suppr/test47-non-reachable-types-report-4.txt:
	Refresh.
	* tests/data/test-diff-suppr/test47-non-reachable-types-report-7.txt:
	Refresh.
	* tests/data/test-diff-suppr/test5-fn-suppr-report-0.txt: Refresh.
	* tests/data/test-diff-suppr/test5-fn-suppr-report-1.txt: Refresh.
	* tests/data/test-diff-suppr/test5-fn-suppr-report-2.txt: Refresh.
	* tests/data/test-diff-suppr/test5-fn-suppr-report-3.txt: Refresh.
	* tests/data/test-diff-suppr/test5-fn-suppr-report-4.txt: Refresh.
	* tests/data/test-diff-suppr/test5-fn-suppr-report-5.txt: Refresh.
	* tests/data/test-diff-suppr/test6-fn-suppr-report-0-1.txt: Refresh.
	* tests/data/test-diff-suppr/test6-fn-suppr-report-0.txt: Refresh.
	* tests/data/test-diff-suppr/test6-fn-suppr-report-1.txt: Refresh.
	* tests/data/test-diff-suppr/test6-fn-suppr-report-2.txt: Refresh.
	* tests/data/test-diff-suppr/test6-fn-suppr-report-3.txt: Refresh.
	* tests/data/test-diff-suppr/test6-fn-suppr-report-4.txt: Refresh.
	* tests/data/test-diff-suppr/test7-var-suppr-report-0.txt: Refresh.
	* tests/data/test-diff-suppr/test7-var-suppr-report-1.txt: Refresh.
	* tests/data/test-diff-suppr/test7-var-suppr-report-2.txt: Refresh.
	* tests/data/test-diff-suppr/test7-var-suppr-report-3.txt: Refresh.
	* tests/data/test-diff-suppr/test7-var-suppr-report-4.txt: Refresh.
	* tests/data/test-diff-suppr/test7-var-suppr-report-7.txt: Refresh.
	* tests/data/test-diff-suppr/test7-var-suppr-report-8.txt: Refresh.
	* tests/data/test-diff-suppr/test8-redundant-fn-report-0.txt: Refresh.
	* tests/data/test-diff-suppr/test8-redundant-fn-report-1.txt: Refresh.

Signed-off-by: Giuliano Procida <gprocida@google.com>
2021-02-08 16:29:13 +01:00
Dodji Seketeli
e5c7fd3400 Bug 27267 - Better support for opaque enum types
Upon a request to build the IR for a opaque enum type,
get_opaque_version_of_type wrongly returns a nil type even though the
code is in there to construct an opaque variant of the enum.

This patch cleans up that code to let it build an opaque enum type.
It also ensures the opaque enum type is properly added to its lexical
scope to ensure proper life cycle management.

	* src/abg-dwarf-reader.cc (get_opaque_version_of_type): Do not
	quit early for enum types, because the code that comes a bit later
	can handle enums.  Add the newly built enum to its scope for
	proper life cycle management.
	* tests/data/test-diff-suppr/PR27267/include-dir-v{0,1}/include.h: New
	include files for the input test library.
	* tests/data/test-diff-suppr/PR27267/libtestpr27267-v{0,1}.so: New
	input test library.
	* tests/data/test-diff-suppr/PR27267/report-1.txt: New reference
	output for the comparison.
	* tests/data/test-diff-suppr/PR27267/v{0,1}.c: Source code for the
	new input test library.
	* tests/data/Makefile.am: Add the new test material above to
	source distribution.
	* tests/test-diff-suppr.cc (in_out_specs): Add the new test input
	above to the test harness.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2021-02-04 09:26:05 +01:00
Dodji Seketeli
013a19c5fe Bug 27331 - Data member offset change not considered local
The comparison code fails to consider that a data member which offset
changed (and which type didn't change) constitutes a local change of
the enclosing class type.

Fixed thus.

	* src/abg-ir.cc (equals): In the overload of class_or_union, when
	a data member changes without having its type change, then
	consider the data change as being local.
	* tests/data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-3.txt:
	Adjust.
	* tests/data/test-diff-filter/test-PR27331-report-0.txt: New
	reference output.
	* tests/data/test-diff-filter/test-PR27331-v{0,1}.c: New test
	source files.
	* tests/data/test-diff-filter/test-PR27331-v{0,1}.o: New test
	binary inputs.
	* tests/data/Makefile.am: Add these new test material to source
	distribution.
	* tests/test-diff-filter.cc (in_out_specs): Add the tests above to
	the harness.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2021-02-03 13:55:38 +01:00
Dodji Seketeli
271e3afaf6 Bug 27165 - Better support multi-language binaries
In some binaries, a DIE named I originating from a compilation unit
written in the C++ language can be an implementation of a DIE named S
(linked through the DW_AT_specification attribute on I) originating
from a compilation unit written in, say, the C language.

In that case, when are we looking at I and try to get the scope of S
(which the DWARF reader considers as the logical scope of I)
get_scope_for_die needs to look at the DW_AT_language attribute
carried by the compilation unit DIE of S.  At the moment, we wrongly
look at the DW_AT_language carried by the compilation unit DIE of I
and we deduce the wrong language (C++ instead of C).

This patch fixes that.

	* src/abg-dwarf-reader.cc (get_scope_for_die): Get the language of
	the DIE from the compilation unit of the DIE itself.
	* tests/data/test-types-stability/PR27165-libzmq.so.5.2.3: New
	test input.
	* tests/data/test-types-stability/PR27165-libzmq.so.5.2.3.debug:
	Debug information for the new test input.
	* tests/data/Makefile.am: Add the test inputs above to the source
	distribution.
	* tests/test-types-stability.cc (elf_paths): Add the new test
	inputs to this test harness.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2021-02-02 16:15:29 +01:00
Dodji Seketeli
23046152e0 Bump ABIXML format version to 2.0
After fixing the interpretation of the DW_AT_bit_offset attribute for
offset of bit field data members, serialized abixml might now be
incompatible with versions of Libabigail that use the previous
interpretation.

That means that comparing an abixml file generated with previous
versions of Libabigail against a corpus resulting from an analysis
performed with the current version of libabigail might yield spurious
changes due to the differences in the way we now interpret the
DW_AT_bit_offset.

Hence, this patch bumps the version of abixml files emitted from now
on to "2.0".  This version is deemed incompatible with the previous
"1.0" version.

Subsequently, an abixml file of the "1.0" format cannot be compared
against an abixml file of the "2.0" format, or against a binary
analyzed with a current version of Libabigail.

It's thus advised that abixml files of the "1.0" format version should
be re-generated with a current version of Libabigail, bumping their
format version number to the new "2.0".

	* include/abg-corpus.h (corpus::init_format_version): Declare new
	private method.
	(corpus::set_environment): Make this non-const.
	(corpus::{get,set}_format_{major,minor}_version_number): Declare
	new accessors.
	* src/abg-corpus.cc (corpus::init_format_version): Define new
	method.
	(corpus::set_environment): By default, initialize the format
	version number of the corpus to the one supported by Libabigail.
	(corpus::{get,set}_format_{major,minor}_version_number): Define
	new accessors.
	* include/abg-ir.h: Include abg-config.h to use the
	abigail::config.
	(environment::get_config): Declare new accessor.
	* src/abg-ir.cc (environment::priv::config_): Add new data member.
	(environment::get_config): Define new accessor.
	* src/abg-config.cc (config::config): Bump the format
	version number to "2.0".
	* src/abg-corpus-priv.h
	(corpus::priv::format_{major,minor}_version_number_): Add new data members.
	* src/abg-reader.cc (handle_version_attribute): Define new static
	function.
	(read_corpus_from_input, read_corpus_group_from_input): Use it to
	read the value of the "version" attribute and set the format
	version number of the corpus and corpus group accordingly.
	* src/abg-writer.cc (write_context::m_config): Remove the config
	object because we can now get it from the environment.
	(write_context::get_config): Get the config object from the
	environment.
	(write_translation_unit): Do not emit the version attribute on the
	translation unit element anymore.
	(write_version_info): Define static function.
	(write_corpus, write_corpus_group): Use it to emit version
	attribute on both the corpus and corpus group elements.
	* tools/abidiff.cc
	(emit_incomptatible_format_version_error_message): Define new
	static function.
	(main): Ensure that corpora and corpus groups being compared have
	the same major version number.
	* tests/update-test-output.py: Adjust syntax for python3.
	* tests/data/test-annotate/libtest23.so.abi: Adjust.
	* tests/data/test-annotate/libtest24-drop-fns-2.so.abi: Likewise.
	* tests/data/test-annotate/libtest24-drop-fns.so.abi: Likewise.
	* tests/data/test-annotate/test-anonymous-members-0.o.abi:
	Likewise.
	* tests/data/test-annotate/test0.abi: Likewise.
	* tests/data/test-annotate/test1.abi: Likewise.
	* tests/data/test-annotate/test13-pr18894.so.abi: Likewise.
	* 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/test2.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-annotate/test3.so.abi: Likewise.
	* tests/data/test-annotate/test4.so.abi: Likewise.
	* tests/data/test-annotate/test5.o.abi: Likewise.
	* tests/data/test-annotate/test6.so.abi: Likewise.
	* tests/data/test-annotate/test7.so.abi: Likewise.
	* tests/data/test-annotate/test8-qualified-this-pointer.so.abi:
	Likewise.
	* tests/data/test-diff-dwarf-abixml/PR25409-librte_bus_dpaa.so.20.0.abi:
	Likewise.
	* tests/data/test-diff-dwarf-abixml/test0-pr19026-libvtkIOSQL-6.1.so.1-report-0.txt:
	Likewise.
	* tests/data/test-diff-dwarf-abixml/test0-pr19026-libvtkIOSQL-6.1.so.1.abi:
	Likewise.
	* tests/data/test-diff-suppr/libtest48-soname-abixml-v0.so.abi:
	Likewise.
	* tests/data/test-diff-suppr/libtest48-soname-abixml-v1.so.abi:
	Likewise.
	* tests/data/test-read-dwarf/PR22015-libboost_iostreams.so.abi:
	Likewise.
	* tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Likewise.
	* tests/data/test-read-dwarf/PR24378-fn-is-not-scope.abi:
	Likewise.
	* tests/data/test-read-dwarf/PR25007-sdhci.ko.abi: Likewise.
	* tests/data/test-read-dwarf/PR25042-libgdbm-clang-dwarf5.so.6.0.0.abi:
	Likewise.
	* tests/data/test-read-dwarf/PR26261/PR26261-exe.abi: Likewise.
	* tests/data/test-read-dwarf/libtest23.so.abi: Likewise.
	* tests/data/test-read-dwarf/libtest24-drop-fns-2.so.abi:
	Likewise.
	* tests/data/test-read-dwarf/libtest24-drop-fns.so.abi: Likewise.
	* tests/data/test-read-dwarf/test-PR26568-1.o.abi: Likewise.
	* tests/data/test-read-dwarf/test-PR26568-2.o.abi: Likewise.
	* tests/data/test-read-dwarf/test0.abi: Likewise.
	* tests/data/test-read-dwarf/test0.hash.abi: Likewise.
	* tests/data/test-read-dwarf/test1.abi: Likewise.
	* tests/data/test-read-dwarf/test1.hash.abi: Likewise.
	* tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Likewise.
	* tests/data/test-read-dwarf/test11-pr18828.so.abi: 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/test16-pr18904.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/test2.so.abi: Likewise.
	* tests/data/test-read-dwarf/test2.so.hash.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/test3.so.abi: Likewise.
	* tests/data/test-read-dwarf/test3.so.hash.abi: Likewise.
	* tests/data/test-read-dwarf/test4.so.abi: Likewise.
	* tests/data/test-read-dwarf/test4.so.hash.abi: Likewise.
	* tests/data/test-read-dwarf/test5.o.abi: Likewise.
	* tests/data/test-read-dwarf/test5.o.hash.abi: Likewise.
	* tests/data/test-read-dwarf/test6.so.abi: Likewise.
	* tests/data/test-read-dwarf/test6.so.hash.abi: Likewise.
	* tests/data/test-read-dwarf/test7.so.abi: Likewise.
	* tests/data/test-read-dwarf/test7.so.hash.abi: Likewise.
	* tests/data/test-read-dwarf/test8-qualified-this-pointer.so.abi:
	Likewise.
	* tests/data/test-read-dwarf/test8-qualified-this-pointer.so.hash.abi:
	Likewise.
	* tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise.
	* tests/data/test-read-write/test0.xml: Likewise.
	* tests/data/test-read-write/test1.xml: Likewise.
	* tests/data/test-read-write/test10.xml: Likewise.
	* tests/data/test-read-write/test11.xml: Likewise.
	* tests/data/test-read-write/test12.xml: Likewise.
	* tests/data/test-read-write/test13.xml: Likewise.
	* tests/data/test-read-write/test14.xml: Likewise.
	* tests/data/test-read-write/test15.xml: Likewise.
	* tests/data/test-read-write/test16.xml: Likewise.
	* tests/data/test-read-write/test17.xml: Likewise.
	* tests/data/test-read-write/test18.xml: Likewise.
	* tests/data/test-read-write/test19.xml: Likewise.
	* tests/data/test-read-write/test2.xml: Likewise.
	* tests/data/test-read-write/test20.xml: Likewise.
	* tests/data/test-read-write/test21.xml: Likewise.
	* tests/data/test-read-write/test22.xml: Likewise.
	* tests/data/test-read-write/test23.xml: Likewise.
	* tests/data/test-read-write/test24.xml: Likewise.
	* tests/data/test-read-write/test25.xml: Likewise.
	* tests/data/test-read-write/test26.xml: Likewise.
	* tests/data/test-read-write/test27.xml: Likewise.
	* tests/data/test-read-write/test28-without-std-fns-ref.xml:
	Likewise.
	* tests/data/test-read-write/test28-without-std-vars-ref.xml:
	Likewise.
	* tests/data/test-read-write/test3.xml: Likewise.
	* tests/data/test-read-write/test4.xml: Likewise.
	* tests/data/test-read-write/test5.xml: Likewise.
	* tests/data/test-read-write/test6.xml: Likewise.
	* tests/data/test-read-write/test7.xml: Likewise.
	* tests/data/test-read-write/test8.xml: Likewise.
	* tests/data/test-read-write/test9.xml: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2021-02-01 14:09:29 +01:00
Dodji Seketeli
6ef9dafdd9 Bug 26684 - Support DW_AT_data_bit_offset attribute
This patch adds support for the DW_AT_data_bit_offset DWARF 5
attribute.  Note that this attribute has been introduced in prior
versions of DWARF, but since the version 5, it supersedes the
DW_AT_bit_offset attribute.

Note that Libabigail was wrongly interpreting the DW_AT_bit_offset
attribute.  It was considering it as the offset of the bit field data
member, starting from the least significant bit of the containing
structure.  That is not the case on little endian machines,
unfortunately.

So this patch fixes that mistake.

So with this patch, we can now compare a binary using DW_AT_bit_offset
against a binary using DW_AT_data_bit_offset and expect things to work
correctly.

The problem is that abixml files generated with Libabigail versions
prior to this patch contain bit field data member offset values that
are not compatible with those contained in abixml files generated with
this version, onward.

So I guess a subsequent patch is needed to introduce a new abixml
version string (maybe "2.0") that would be deemed incompatible with
the previous "1.0" one.  That way, we can prevent comparing 2.0 abixml
files against 1.0 ones in abidiff, for instance.

For now, the patch adjusts the various abixml files to make them
reflect the proper representation of DW_AT_bit_offset on little endian
machines.

	* src/abg-dwarf-reader.cc (read_and_convert_DW_at_bit_offset):
	Define new static function.
	(die_member_offset): Primarily use DW_AT_data_bit_offset if its
	present.  Otherwise, look for DW_AT_bit_offset.  Use the new
	read_and_convert_DW_at_bit_offset function to properly interpret
	DW_AT_bit_offset if its present.  Update comment.
	* tests/data/test-diff-filter/test-PR26684-dwarf{4,5}.o: New
	binary test inputs.
	* tests/data/test-diff-filter/test-PR26684.c: Source code of the
	new binary test inputs above.
	* tests/data/test-diff-filter/test-PR26684-report-0.txt: New
	reference test output.
	* tests/data/Makefile.am: Add the new test material above to
	source distribution.
	* tests/test-diff-filter.cc (in_out_specs): Add the test inputs
	above to this test harness.
	* tests/data/test-annotate/test13-pr18894.so.abi: Adjust.
	* tests/data/test-annotate/test15-pr18892.so.abi: Adjust.
	* tests/data/test-annotate/test17-pr19027.so.abi: Adjust.
	* tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi:
	Adjust.
	* tests/data/test-annotate/test21-pr19092.so.abi: Adjust.
	* tests/data/test-diff-dwarf-abixml/PR25409-librte_bus_dpaa.so.20.0.abi:
	Adjust.
	* tests/data/test-diff-pkg/libcdio-0.94-1.fc26.x86_64--libcdio-0.94-2.fc26.x86_64-report.1.txt:
	Adjust.
	* tests/data/test-read-dwarf/PR25007-sdhci.ko.abi: Adjust.
	* tests/data/test-read-dwarf/PR25042-libgdbm-clang-dwarf5.so.6.0.0.abi:
	Adjust.
	* tests/data/test-read-dwarf/test13-pr18894.so.abi: Adjust.
	* tests/data/test-read-dwarf/test15-pr18892.so.abi: Adjust.
	* tests/data/test-read-dwarf/test16-pr18904.so.abi: Adjust.
	* tests/data/test-read-dwarf/test17-pr19027.so.abi: Adjust.
	* tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi:
	Adjust.
	* tests/data/test-read-dwarf/test21-pr19092.so.abi: Adjust.
	* tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi:
	Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2021-01-29 18:28:25 +01:00
Dodji Seketeli
4dab7cd970 dwarf-reader: Support fast DW_FORM_line_strp string comparison
When running Libabigail on Fedora 34 it appeared that we don't support
DW_FORM_line_strp in the fast string comparison scheme, during DIE
de-duplication.

This patch fixes that.

	* src/abg-dwarf-reader.cc (compare_dies_string_attribute_value):
	Support DW_FORM_line_strp.
	* tests/data/test-diff-pkg/sshpass-1.07-1.fc34.x86_64-self-check-report-0.txt:
	New reference test output.
	* tests/data/test-diff-pkg/sshpass-1.07-1.fc34.x86_64.rpm: New
	test input.
	* tests/data/test-diff-pkg/sshpass-debuginfo-1.07-1.fc34.x86_64.rpm:
	Likewise.
	* tests/data/Makefile.am: Add the new testing material above to
	source distribution.
	* tests/test-diff-pkg.cc (in_out_specs): Add the test input above
	to this harness.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2021-01-26 19:19:01 +01:00
Dodji Seketeli
40709acdd5 Bug 27232 - fedabipkgdiff fails on gawk from Fedora 33
When running fedabipkgdiff on the gawk-5.1.0-2.fc33.aarch64.rpm
package we get this error message:

    Error encountered while running fedabipkgdiff with error message:

That is not a very useful error message to say the least.

The issue is that abipkgdiff returns with an "unknown error" which is
due to the fact that the gawk package contains a directory that is
owned by root.  As abipkgdiff tries to write temporary files into that
directory, it fails to do so.

The patch now writes the temporary ABIXML file into a sub-directory
that is not owned the package where we should have write privileges.

It also improves error reporting.

	* tools/abipkgdiff.cc (options::pkg{1,2}): Add new data members to
	store the packages to compare and have them available for the
	various functions that may need them down the road.
	(package::create_abi_file_path): Add new function.
	(compare_to_self): Use the new package::create_abi_file_path to
	create the path to the ABI file in a directory not owned by the
	package.  That should increase our chances of having the rights to
	write that one.  Make sure to emit error message when the
	comparison against self fails.
	({compare_task, self_compare_task}::perform): During the process
	of comparison if an internal error happens, report it.  Cleanup
	the existing reporting a little bit.
	(pkg_extraction_task::perform): Fix comment.
	* tests/data/test-diff-pkg/libxfce4ui-devel-4.12.1-8.fc27.ppc64-self-report-0.txt:
	Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2021-01-26 17:41:33 +01:00
Dodji Seketeli
e9bcf8634f Bug 27236 - Pointer comparison wrongly fails because of typedef change
Support we have a type struct S and a type T defined as:
  typedef struct S T;

Today, Libabigail considers that the two pointers "struct S*" and "T*"
are different.

The problem is that this can cause spurious change reports (as
reported by (abidw --abidiff) in binaries where we have the same type
defined more than once, each time using a different various around
this theme.

This patch make libabigail to now consider that "struct S*" and "T*"
are equal.  It does the same for references and arrays.

	 * src/abg-ir.cc (equals): In the overloads for pointer_type_def,
	reference_type_def and array_type_def, compare the pointed-to-type
	modulo typedefs.
	* tests/data/test-diff-dwarf/test42-PR21296-clanggcc-report0.txt: Adjust.
	* tests/data/test-diff-pkg/libICE-1.0.6-1.el6.x86_64.rpm--libICE-1.0.9-2.el7.x86_64.rpm-report-0.txt:
	Adjust.
	* tests/data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-2.txt:
	Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2021-01-26 04:48:20 +01:00
Dodji Seketeli
9a0c823df4 Ignore duplicated functions and those not associated with ELF symbols
While looking at several ABIXML files I noticed that several (member)
functions didn't have any associated ELF symbol and that in some cases,
there were even duplicated member functions.  Those are the source of
some spurious changes sometimes reported by abidiff.

In DWARF the same function F can be represented several times.  One
representation of F has some properties and other representations of F
might have properties that complement the properties carried by the
former representations.  It's the unions of the properties of all
representations of F that constitute the properties of F.

An example of that "linked" nature is how DWARF represents inlined
functions.  A function F can be inlined somewhere else.  That inlined
version is called F', for instance.  The DWARF representation of F'
will carry a DW_AT_abstract_origin attribute that points back to F to
signify that F' is the concrete inlined version of the abstract F.

F' will carry properties that are specific to its "inlined nature"
whereas F will carry properties that are more generic and independent
from all its various potential inlined forms.

So when Libabigail sees the DWARF representation of F, if it's
associated with an ELF symbol, then it must wait to encounter an F'
representation that is associated with an ELF symbol before adding an
internal representation (IR) of F into the final IR graph.  Otherwise
the IR of F can be unnecessarily duplicated, with some instances
having an associated ELF symbol and others not.

This is what this patch does, in essence.  While working on this, I
encountered some tangential issues that needed to be fixed altogether
for the whole to function.  A lot of regression tests output had to be
adjusted.

In the end, a number of spurious change reports could be fixed;
notably reports about removal of destructors like STR::~STR(int).
Note how that destructor has a parameter; it's a GCC-specific
implementation detail that should not appear at this level, I believe.

	* include/abg-ir.h (class_or_union::string_mem_fn_sptr_map_type):
	Add a typedef for unordered_map<string, method_decl_sptr>.
	(class_or_union::find_member_function_sptr): Declare new function.
	* src/abg-ir.cc (class_or_union::priv::mem_fns_map_): Change the
	type of this to string_mem_fn_sptr_map_type, so that shared
	pointers to functions can be stored in the map, instead of bare
	pointers to functions.  This is useful to implement
	class_or_union::find_member_function_sptr which returns a shared
	pointer to function.
	(class_or_union::find_member_function_sptr): Define new function.
	(class_or_union::find_member_function): Adjust.
	(method_decl::set_linkage_name): Use a non-deleting shared pointer
	to store the current instance of member function into
	class_or_union::priv::mem_fns_map_.
	(hash_as_canonical_type_or_constant): As we are seeing more
	function types, it appears that some function types are not
	canonicalized.  I am not sure why exactly, but let's loosen the
	assert here for now, I'll chase the root of this later.
	* src/abg-dwarf-reader.cc (finish_member_function_reading):
	Improve detection of member function 'static-ness' by handling
	cases where a this pointer can be const.  Also support
	DW_AT_object_pointer when it's present.  This fixes the occurrence
	of spurious change reports about loss of 'static-ness' of member
	functions.
	(potential_member_fn_should_be_dropped): Define new static
	function and ...
	(build_ir_node_from_die): ... use it here.  When a function DIE
	has the same linkage name as an existing function IR, do not
	create a new IR for it.  Rather, re-use the existing one to
	complete it with the properties found on the function DIE.  If a
	new function doesn't seem to have an associated ELF symbol and is
	not meant to be a virtual member function then drop its IR on the
	floor as well.
	* tests/data/test-annotate/libtest23.so.abi: Adjust.
	* tests/data/test-annotate/libtest24-drop-fns-2.so.abi: Likewise.
	* tests/data/test-annotate/libtest24-drop-fns.so.abi: Likewise.
	* tests/data/test-annotate/test0.abi: Likewise.
	* tests/data/test-annotate/test1.abi: Likewise.
	* 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-annotate/test6.so.abi: Likewise.
	* tests/data/test-annotate/test8-qualified-this-pointer.so.abi: Likewise.
	* tests/data/test-diff-dwarf-abixml/PR25409-librte_bus_dpaa.so.20.0.abi: Likewise.
	* tests/data/test-diff-dwarf-abixml/test0-pr19026-libvtkIOSQL-6.1.so.1.abi: Likewise.
	* tests/data/test-diff-dwarf/test0-report.txt: Likewise.
	* tests/data/test-diff-dwarf/test28-vtable-changes-report-0.txt: Likewise.
	* tests/data/test-diff-dwarf/test42-PR21296-clanggcc-report0.txt: Likewise.
	* tests/data/test-diff-filter/test0-report.txt: Likewise.
	* tests/data/test-diff-filter/test01-report.txt: Likewise.
	* tests/data/test-diff-filter/test10-report.txt: Likewise.
	* tests/data/test-diff-filter/test30-pr18904-rvalueref-report0.txt: Likewise.
	* tests/data/test-diff-filter/test30-pr18904-rvalueref-report1.txt: Likewise.
	* tests/data/test-diff-filter/test30-pr18904-rvalueref-report2.txt: 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-diff-filter/test35-pr18754-no-added-syms-report-0.txt: Likewise.
	* tests/data/test-diff-filter/test35-pr18754-no-added-syms-report-1.txt: Likewise.
	* tests/data/test-diff-filter/test41-report-0.txt: Likewise.
	* tests/data/test-diff-filter/test9-report.txt: Likewise.
	* tests/data/test-diff-pkg/libsigc++-2.0-0c2a_2.4.0-1_amd64--libsigc++-2.0-0v5_2.4.1-1ubuntu2_amd64-report-0.txt: Likewise.
	* tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-0.txt: Likewise.
	* tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-1.txt: Likewise.
	* tests/data/test-diff-suppr/test24-soname-report-1.txt: Likewise.
	* tests/data/test-diff-suppr/test24-soname-report-10.txt: Likewise.
	* tests/data/test-diff-suppr/test24-soname-report-12.txt: Likewise.
	* tests/data/test-diff-suppr/test24-soname-report-14.txt: Likewise.
	* tests/data/test-diff-suppr/test24-soname-report-16.txt: Likewise.
	* tests/data/test-diff-suppr/test24-soname-report-4.txt: Likewise.
	* tests/data/test-diff-suppr/test31-report-1.txt: Likewise.
	* tests/data/test-read-dwarf/PR22015-libboost_iostreams.so.abi: Likewise.
	* tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Likewise.
	* tests/data/test-read-dwarf/libtest23.so.abi: Likewise.
	* tests/data/test-read-dwarf/libtest24-drop-fns-2.so.abi: Likewise.
	* tests/data/test-read-dwarf/libtest24-drop-fns.so.abi: Likewise.
	* tests/data/test-read-dwarf/test-libandroid.so.abi: Likewise.
	* tests/data/test-read-dwarf/test0.abi: Likewise.
	* tests/data/test-read-dwarf/test0.hash.abi: Likewise.
	* tests/data/test-read-dwarf/test1.abi: Likewise.
	* tests/data/test-read-dwarf/test1.hash.abi: Likewise.
	* tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Likewise.
	* tests/data/test-read-dwarf/test11-pr18828.so.abi: Likewise.
	* tests/data/test-read-dwarf/test12-pr18844.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/test16-pr18904.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/test6.so.abi: Likewise.
	* tests/data/test-read-dwarf/test6.so.hash.abi: Likewise.
	* tests/data/test-read-dwarf/test8-qualified-this-pointer.so.abi: Likewise.
	* tests/data/test-read-dwarf/test8-qualified-this-pointer.so.hash.abi: Likewise.
	* tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2021-01-23 16:36:15 +01:00
Dodji Seketeli
1dcdd54d54 Bug 27204 - potential loss of some aliased ELF function symbols
Sometimes when a symbol S' of a function F' aliases the symbol S of a function
F, the ABIXML reader might not add F' back into the set of exported
functions of the ABI corpus (as the DWARF reader has done initially).
That results in the apparent 'loss' of F' (and S') from the corpus.

This is due to the way F' is identified, using function_decl::get_id.
In the case where the symbol S' of F' has aliases,
function_decl::get_id (wrongly) uses the linkage name of F' as the
identifier.  If F' and F happen to have the same linkage name and if F
is already in the set of exported functions of the corpus then F'
won't be added into that set.

To solve that problem, this patch makes function_decl::get_id
construct an ID that ensures that F and F' always have different IDs.

	* src/abg-ir.cc (function_decl::get_id): If the elf symbol has
	aliases, make the function name be part of the ID so that this ID
	differs from the one of the other functions that share a symbol
	alias with this one.
	* tests/data/test-abidiff/test-PR18791-report0.txt: Adjust.
	* tests/data/test-diff-dwarf/test42-PR21296-clanggcc-report0.txt: 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-diff-filter/test41-report-0.txt: Likewise.
	* tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Likewise.
	* tests/data/test-read-dwarf/test16-pr18904.so.abi: Likewise.
	* tests/data/test-diff-pkg/glibc-2.32-3.fc33.aarch64-self-check-report-0.txt:
	New test reference output.
	* tests/data/test-diff-pkg/glibc-2.32-3.fc33.aarch64.rpm: New test
	input RPM.
	* tests/data/test-diff-pkg/glibc-debuginfo-2.32-3.fc33.aarch64.rpm:
	Likewise.
	* tests/data/Makefile.am: Add the new test material to source
	distribution.
	* tests/test-diff-pkg.cc (in_out_specs): Add the new test input
	RPMs to this test harness.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2021-01-23 16:35:11 +01:00
Dodji Seketeli
625d0903c2 Bug 26992 - Try harder to resolve declaration-only classes
When a declaration of a class, named H, matches more than one
definition (let's call them D) of H (in several other translation
units of the abi corpus) then H is left unresolved; that is, H is
considered as being a declaration-only class.  Note that down the
road, H will compare different to all those Ds.

However when those Ds are all equal, it turns out that this can lead
to issues down the road.  This is because conceptually, H equals D.
But then by not resolving H to D (and there are several Ds), we
artificially create a situation where H is different from D.  We can
even create situations where those Ds are different among themselves.
So doing comparisons inevitably leads to spurious changes.

This is the root cause of the issue described in this bug at
https://sourceware.org/bugzilla/show_bug.cgi?id=26992.

To fix the issue, this patch thus resolves H to D when the different
Ds are all equal.

Note that a similar thing should be done for the process of resolving
declaration-only enums as well.  But I don't have an issue reproducer
at hand involving enums at the moment, so I am adding a comment to
read_context::resolve_declaration_only_enums for now.

I have also filled the enhancement request
https://sourceware.org/bugzilla/show_bug.cgi?id=27189 to track a task
that would do away with read_context::resolve_declaration_only_enums
altogether by factorizing out the resolution of declaration-only
abigail::ir::decl_base.

	* src/abg-dwarf-reader.cc
	(read_context::compare_before_canonicalisation): Define new member
	function.
	(read_context::resolve_declaration_only_classes): When there are
	more than one definition that can resolve a given declaration, if
	all those definitions are equal, then resolve the declaration to
	those definitions.
	(read_context::resolve_declaration_only_enums): Add a comment to
	update similarly update this function (or do away with it
	completely) later.
	* tests/data/test-annotate/test15-pr18892.so.abi: Adjust.
	* tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise.
	* tests/data/test-read-dwarf/test15-pr18892.so.abi: Likewise.
	* tests/data/test-diff-pkg/cogl-1.22.8-2.fc33.x86_64.rpm: Add new
	test input.
	* tests/data/test-diff-pkg/cogl-debuginfo-1.22.8-2.fc33.x86_64.rpm:
	Likewise.
	* tests/data/test-diff-pkg/cogl-1.22.8-2.fc33.x86_64.self-check-report-0.txt:
	Likewise.
	* tests/test-diff-pkg.cc (in_out_specs): Add the new test inputs
	to the test harness.
	* tests/data/Makefile.am: Add the new test input files to source
	distribution.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2021-01-15 18:01:56 +01:00
Matthias Maennich
9fc16dbc7d Update catch2 testing framework: v1.12.2 -> v2.13.3
We can now use the latest upstream stable version since we bumped up our
minimum C++ standard version.

	* tests/lib/catch.hpp: update to v2.13.3
	* tests/test-symtab.cc (TEST_CASE("Symtab::SimpleSymtabs")): Use
	the corpus variable to avoid unused variable warnings.

Signed-off-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2020-12-15 11:20:58 +01:00
Giuliano Procida
1b62e39f53 Refresh ABI cross check test files
The test file test0-pr19026-libvtkIOSQL-6.1.so.1 is intended to be
used to check that diffing a binary entity against its ABI
representation results in an empty diff.  In this case, the ABI of the
library is also under revision control and so the test also functions
to a certain extent as check on whether the generated ABI is stable
between revisions of libabigail.

Recent changes have affected attributes and ordering of elements. The
result is that there is now a non-empty diff between the library and
the saved ABI, albeit all "harmless" changes.

This commit refreshes the revision-controlled ABI, eliminating the
differences.

	* tests/data/test-diff-dwarf-abixml/test0-pr19026-libvtkIOSQL-6.1.so.1.abi:
	Refreshed ABI.
	* tests/data/test-diff-dwarf-abixml/test0-pr19026-libvtkIOSQL-6.1.so.1-report-0.txt:
	File now empty.

Signed-off-by: Giuliano Procida <gprocida@google.com>
2020-12-15 09:49:13 +01:00
Matthias Maennich
c458e00db9 Drop unneccessary includes of abg-cxx-compat.h
Remove the unneccessary includes of abg-cxx-compat.h as users have been
migrated to use the corresponding standard includes.

	* include/abg-comparison.h: Remove include of abg-cxx-compat.h.
	* include/abg-diff-utils.h: Likewise.
	* include/abg-fwd.h: Likewise.
	* include/abg-ini.h: Likewise.
	* include/abg-interned-str.h: Likewise.
	* include/abg-ir.h: Likewise.
	* include/abg-libxml-utils.h: Likewise.
	* include/abg-libzip-utils.h: Likewise.
	* include/abg-regex.h: Likewise.
	* include/abg-reporter.h: Likewise.
	* include/abg-sptr-utils.h: Likewise.
	* include/abg-suppression.h: Likewise.
	* include/abg-tools-utils.h: Likewise.
	* include/abg-workers.h: Likewise.
	* src/abg-comp-filter.cc: Likewise.
	* src/abg-comparison-priv.h: Likewise.
	* src/abg-corpus.cc: Likewise.
	* src/abg-dwarf-reader.cc: Likewise.
	* src/abg-hash.cc: Likewise.
	* src/abg-ir.cc: Likewise.
	* src/abg-reader.cc: Likewise.
	* src/abg-suppression.cc: Likewise.
	* src/abg-tools-utils.cc: Likewise.
	* src/abg-writer.cc: Likewise.
	* tests/test-diff-suppr.cc: Likewise.
	* tests/test-read-write.cc: Likewise.
	* tools/abicompat.cc: Likewise.
	* tools/abidw.cc: Likewise.
	* tools/abilint.cc: Likewise.
	* tools/abipkgdiff.cc: Likewise.

Signed-off-by: Matthias Maennich <maennich@google.com>
2020-12-15 09:23:44 +01:00
Matthias Maennich
5d669e0126 Remove <unordered_set> usages from abg_compat
std::unordered_set is now provided through the language standard, hence
remove the compatibility code for <unordered_set> and adjust all users
accordingly.

	* include/abg-cxx-compat.h: Drop compatibility for <unordered_set>.
	* include/abg-comparison.h: migrate abg_compat use to std.
	* include/abg-interned-str.h: Likewise.
	* include/abg-suppression.h: Likewise.
	* src/abg-comparison-priv.h: Likewise.
	* src/abg-dwarf-reader.cc: Likewise.
	* tests/test-diff-suppr.cc: Likewise.
	* tools/abipkgdiff.cc: Likewise.

Signed-off-by: Matthias Maennich <maennich@google.com>
2020-12-15 09:21:38 +01:00
Matthias Maennich
de344c0122 Remove <memory> usages from abg_compat
std::shared_ptr, std::weak_ptr, std::dynamic_pointer_cast,
std::static_pointer_cast are now provided through the language standard,
hence remove the compatibility code for <memory> and adjust all users
accordingly.

	* include/abg-cxx-compat.h: Drop compatibility layer for <memory>.
	* include/abg-diff-utils.h: migrate abg_compat use to std.
	* include/abg-fwd.h: Likewise.
	* include/abg-ini.h: Likewise.
	* include/abg-interned-str.h: Likewise.
	* include/abg-libxml-utils.h: Likewise.
	* include/abg-libzip-utils.h: Likewise.
	* include/abg-regex.h: Likewise.
	* include/abg-reporter.h: Likewise.
	* include/abg-sptr-utils.h: Likewise.
	* include/abg-tools-utils.h: Likewise.
	* include/abg-workers.h: Likewise.
	* src/abg-comp-filter.cc: Likewise.
	* src/abg-comparison-priv.h: Likewise.
	* src/abg-dwarf-reader.cc: Likewise.
	* src/abg-ir.cc: Likewise.
	* src/abg-reader.cc: Likewise.
	* src/abg-suppression.cc: Likewise.
	* src/abg-tools-utils.cc: Likewise.
	* src/abg-writer.cc: Likewise.
	* tests/test-diff-filter.cc: Likewise.
	* tests/test-diff-pkg.cc: Likewise.
	* tests/test-diff-suppr.cc: Likewise.
	* tests/test-read-dwarf.cc: Likewise.
	* tests/test-read-write.cc: Likewise.
	* tests/test-types-stability.cc: Likewise.
	* tests/test-write-read-archive.cc: Likewise.
	* tools/abicompat.cc: Likewise.
	* tools/abidiff.cc: Likewise.
	* tools/abidw.cc: Likewise.
	* tools/abilint.cc: Likewise.
	* tools/abipkgdiff.cc: Likewise.

Signed-off-by: Matthias Maennich <maennich@google.com>
2020-12-15 09:08:52 +01:00
Giuliano Procida
04690d216a Add qualifier / typedef / array / pointer test
This change adds a test which exercises libabigail's handling of
qualified typedefs of arrays. The base type in the test case is an
array of pointers (chosen so we can also use restrict).

Various typedefs and (indirect) qualifications of this type are
created. In all cases, the resulting type should be an array of
qualified pointers.

However, abidiff reports things like

  'const volatile void* const'

changed to

  'restrict const volatile volatile void* const'

I've not attempted to check whether DWARF and ABI XML faithfully
reflect the source types. There may be trouble there as well.

For the record, these are the expected v0 types:

A = void *[7]
B = void *[7]
C = void *const[7]
D = void *const[7]
E = void *const volatile[7]
F = void *const volatile[7]
G = void *const volatile restrict[7]
H = void *const volatile restrict[7]

The v1 types should be these plus others with extra pointer
qualifiers.

	* tests/data/Makefile.am: Add new test files
	* tests/data/test-abidiff-exit/qualifier-typedef-array-v0.c:
	New test file.
	* tests/data/test-abidiff-exit/qualifier-typedef-array-v0.o:
	New test file.
	* tests/data/test-abidiff-exit/qualifier-typedef-array-v1.c:
	New test file.
	* tests/data/test-abidiff-exit/qualifier-typedef-array-v1.o:
	New test file.
	* tests/data/test-abidiff-exit/qualifier-typedef-array-report-0.txt:
	Plain diff report.
	* tests/data/test-abidiff-exit/qualifier-typedef-array-report-1.txt:
	Harmless diff report.
	* tests/data/test-abidiff-exit/qualifier-typedef-array-report-2.txt:
	Leaf changes report.
	* tests/data/test-abidiff-exit/qualifier-typedef-array-report-3.txt:
	Harmless leaf changes report.
	* tests/test-abidiff-exit.cc: Run new test.

Signed-off-by: Giuliano Procida <gprocida@google.com>
2020-12-10 10:04:17 +01:00
Giuliano Procida
d068f26701 ir: Arrays are indirect types for type structure similarity purposes
As described in the comments of types_have_similar_structure:

    "Two indirect types have similar structure if their underlying
    types are of the same kind and have the same name. [...] The size
    of their underlying type does not matter"

Yet, the size of array elements (a.k.a the underlying type of an array
type) is wrongly considered to matter when assessing the "type
structure similarity" relationship for arrays.

This patch fixes that.

	* src/abg-ir.cc (types_have_similar_structure): When examining
	array types, always treat element types as being underlying types
	of an indirect type.
	* tests/data/Makefile.am: Add new test case files.
	* tests/data/test-abidiff-exit/test-non-leaf-array-report.txt:
	New test case showing correct --leaf-changes-only reporting.
	* tests/data/test-abidiff-exit/test-non-leaf-array-v0.c:
	Likewise.
	* tests/data/test-abidiff-exit/test-non-leaf-array-v0.o:
	Likewise.
	* tests/data/test-abidiff-exit/test-non-leaf-array-v1.c:
	Likewise.
	* tests/data/test-abidiff-exit/test-non-leaf-array-v1.o:
	Likewise.
	* tests/test-abidiff-exit.cc: Run new test case.

Signed-off-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2020-12-05 11:04:01 +01:00
Dodji Seketeli
4f8c9b170d Use C++11 for the code base
As the Enterprise Linux 6 platform has now essentially reached it's
end of life for what it's worth (the Fedora EPEL6 distribution is not
maintained anymore) nothing ties us to using C++03 only anymore.

So, I think it makes sense to move the code base to the C++11
standard.

Why C++11 and not, say, C++14 or more?  Well, the more direct reason I
see is that we need to support long life cycle platforms, the older
one being Enterprise Linux 7 currently.  This is the Fedora EPEL7
distribution, in concrete terms.  And in that distribution, the
compiler is GCC 4.8.x.  And it supports C++11.

In practise, nothing changes in the code that is already there.

The new code however can use C++11 constructs just fine.

I have updated the CONTRIBUTING file to write down some of the
unwritten cultural biases of the current code base.  Hopefully these
few lines will help to shed some light on the choices made so far.

The update to that file also enacts the use of C++11 and sets some
limits to what we expects in terms of what the code base would look
like.

configure.ac is modified to unconditionally pass -std=c++11 to the
compiler and express that in the configuration text displayed at the
end of the configuration stage.

Some Makefile.am files are updated accordingly.

	* CONTRIBUTING: Enact use of c++11. Also, we favor those who
	read/debug/maintain the code as opposed to those who write it ;-)
	* configure.ac: Switch to c++11 unconditionally.
	* src/Makefile.am: Adjust.
	* tests/Makefile.am: Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2020-12-03 14:04:23 +01:00
Dodji Seketeli
c80f79271a Re-license the project to Apache v2 With LLVM Exception
Thanks to the previous work done, changing the license is just a
matter of changing the SPDX identifer from "LGPL-3.0-or-later" to
"Apache-2.0 WITH LLVM-exception".  Note that for the abigail.m4,
tests/test-dot.cc and tests/test-svg.cc the change was from
"GPL-3.0-or-later WITH GCC-exception-3.1" to "Apache-2.0 WITH
LLVM-exception".  include/abg-cxx-compat.h was changed from
"LGPL-2.0-or-later" to "Apache-2.0 WITH LLVM-exception".  Source code
of programs (as opposed to source code of the library) where generally
licensed under GPL-3.0-or-later; they are also now licensed
"Apache-2.0 WITH LLVM-exception".

This is what this patch does.

	* abigail.m4: Change the SPDX identifier from "GPL-3.0-or-later
	WITH GCC-exception-3.1" to "Apache-2.0 WITH LLVM-exception"
	* include/abg-cxx-compat.h: Change the SPDX identifier from
	"LGPL-2.0-or-later" to "Apache-2.0 WITH LLVM-exception".
	* .clang-format: Change the SPDX identifier from
	  "LGPL-3.0-or-later" to "Apache-2.0 WITH LLVM-exception".
	* Makefile.am: Likewise.
	* bash-completion/Makefile.am: Likewise.
	* bash-completion/abicompat: Likewise.
	* bash-completion/abidiff: Likewise.
	* bash-completion/abidw: Likewise.
	* bash-completion/abilint: Likewise.
	* bash-completion/abinilint: Likewise.
	* bash-completion/abipkgdiff: Likewise.
	* bash-completion/abisym: Likewise.
	* bash-completion/fedabipkgdiff: Likewise.
	* configure.ac: Likewise.
	* default.abignore: Likewise.
	* doc/Makefile.am: Likewise.
	* doc/api/libabigail.doxy: Likewise.
	* doc/manuals/Makefile.am: Likewise.
	* doc/website/libabigail-website.doxy: Likewise.
	* include/Makefile.am: Likewise.
	* include/abg-comp-filter.h: Likewise.
	* include/abg-comparison.h: Likewise.
	* include/abg-config.h: Likewise.
	* include/abg-corpus.h: Likewise.
	* include/abg-diff-utils.h: Likewise.
	* include/abg-dwarf-reader.h: Likewise.
	* include/abg-fwd.h: Likewise.
	* include/abg-hash.h: Likewise.
	* include/abg-ini.h: Likewise.
	* include/abg-interned-str.h: Likewise.
	* include/abg-ir.h: Likewise.
	* include/abg-libxml-utils.h: Likewise.
	* include/abg-libzip-utils.h: Likewise.
	* include/abg-reader.h: Likewise.
	* include/abg-regex.h: Likewise.
	* include/abg-reporter.h: Likewise.
	* include/abg-sptr-utils.h: Likewise.
	* include/abg-suppression.h: Likewise.
	* include/abg-tools-utils.h: Likewise.
	* include/abg-traverse.h: Likewise.
	* include/abg-version.h.in: Likewise.
	* include/abg-viz-common.h: Likewise.
	* include/abg-viz-dot.h: Likewise.
	* include/abg-viz-svg.h: Likewise.
	* include/abg-workers.h: Likewise.
	* include/abg-writer.h: Likewise.
	* scripts/dot_to_png.sh: Likewise.
	* scripts/dot_to_svg.sh: Likewise.
	* scripts/make-verbose.sh: Likewise.
	* scripts/svg_to_plain_svg.sh: Likewise.
	* scripts/svg_to_png_and_pdf.sh: Likewise.
	* src/Makefile.am: Likewise.
	* src/abg-comp-filter.cc: Likewise.
	* src/abg-comparison-priv.h: Likewise.
	* src/abg-comparison.cc: Likewise.
	* src/abg-config.cc: Likewise.
	* src/abg-corpus-priv.h: Likewise.
	* src/abg-corpus.cc: Likewise.
	* src/abg-default-reporter.cc: Likewise.
	* src/abg-diff-utils.cc: Likewise.
	* src/abg-dwarf-reader.cc: Likewise.
	* src/abg-elf-helpers.cc: Likewise.
	* src/abg-elf-helpers.h: Likewise.
	* src/abg-hash.cc: Likewise.
	* src/abg-ini.cc: Likewise.
	* src/abg-internal.h: Likewise.
	* src/abg-ir-priv.h: Likewise.
	* src/abg-ir.cc: Likewise.
	* src/abg-leaf-reporter.cc: Likewise.
	* src/abg-libxml-utils.cc: Likewise.
	* src/abg-libzip-utils.cc: Likewise.
	* src/abg-reader.cc: Likewise.
	* src/abg-regex.cc: Likewise.
	* src/abg-reporter-priv.cc: Likewise.
	* src/abg-reporter-priv.h: Likewise.
	* src/abg-suppression-priv.h: Likewise.
	* src/abg-suppression.cc: Likewise.
	* src/abg-tools-utils.cc: Likewise.
	* src/abg-traverse.cc: Likewise.
	* src/abg-viz-common.cc: Likewise.
	* src/abg-viz-dot.cc: Likewise.
	* src/abg-viz-svg.cc: Likewise.
	* src/abg-workers.cc: Likewise.
	* src/abg-writer.cc: Likewise.
	* tests/Makefile.am: Likewise.
	* tests/data/Makefile.am: Likewise.
	* tests/lib/catch.cc: Likewise.
	* tests/mockfedabipkgdiff.in: Likewise.
	* tests/print-diff-tree.cc: Likewise.
	* tests/runtestcanonicalizetypes.sh.in: Likewise.
	* tests/runtestdefaultsupprs.py.in: Likewise.
	* tests/runtestdefaultsupprspy3.sh.in: Likewise.
	* tests/runtestfedabipkgdiff.py.in: Likewise.
	* tests/runtestfedabipkgdiffpy3.sh.in: Likewise.
	* tests/test-abicompat.cc: Likewise.
	* tests/test-abidiff-exit.cc: Likewise.
	* tests/test-abidiff.cc: Likewise.
	* tests/test-alt-dwarf-file.cc: Likewise.
	* tests/test-annotate.cc: Likewise.
	* tests/test-core-diff.cc: Likewise.
	* tests/test-cxx-compat.cc: Likewise.
	* tests/test-diff-dwarf-abixml.cc: Likewise.
	* tests/test-diff-dwarf.cc: Likewise.
	* tests/test-diff-filter.cc: Likewise.
	* tests/test-diff-pkg.cc: Likewise.
	* tests/test-diff-suppr.cc: Likewise.
	* tests/test-diff2.cc: Likewise.
	* tests/test-dot.cc: Change the SPDX identifier from
	"GPL-3.0-or-later WITH GCC-exception-3.1" to "Apache-2.0 WITH
	LLVM-exception"
	* tests/test-elf-helpers.cc: Change the SPDX identifier from
	"LGPL-3.0-or-later" to "Apache-2.0 WITH LLVM-exception"
	* tests/test-ini.cc: Likewise.
	* tests/test-ir-walker.cc: Likewise.
	* tests/test-kmi-whitelist.cc: Likewise.
	* tests/test-lookup-syms.cc: Likewise.
	* tests/test-read-dwarf.cc: Likewise.
	* tests/test-read-write.cc: Likewise.
	* tests/test-svg.cc: Change the SPDX identifier from
	"GPL-3.0-or-later WITH GCC-exception-3.1" to "Apache-2.0 WITH
	LLVM-exception".
	* tests/test-symtab.cc: Change the SPDX identifier from
	"LGPL-3.0-or-later" to "Apache-2.0 WITH LLVM-exception"
	* tests/test-tools-utils.cc: Likewise.
	* tests/test-types-stability.cc: Likewise.
	* tests/test-utils.cc: Likewise.
	* tests/test-utils.h: Likewise.
	* tests/test-write-read-archive.cc: Likewise.
	* tests/update-test-output.py: Likewise.
	* tools/Makefile.am: Likewise.
	* tools/abiar.cc: Likewise.
	* tools/abicompat.cc: Likewise.
	* tools/abidiff.cc: Likewise.
	* tools/abidw.cc: Likewise.
	* tools/abilint.cc: Likewise.
	* tools/abipkgdiff.cc: Likewise.
	* tools/abisym.cc: Likewise.
	* tools/binilint.cc: Likewise.
	* tools/fedabipkgdiff: Likewise.
	* tools/kmidiff.cc: Likewise.
	* update-copyright.sh: Likewise.

Signed-off-by: Benjamin De Kosnik <bkoz@gnu.org>
Signed-off-by: Ben Woodard <woodard@redhat.com>
Signed-off-by: Chenxiong Qi <cqi@redhat.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Signed-off-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Jessica Yu <jeyu@kernel.org>
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Mark Wielaard <mark@klomp.org>
Signed-off-by: Matthias Klose <doko@ubuntu.com>
Signed-off-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Ondrej Oprala <ondrej.oprala@gmail.com>
Signed-off-by: Roland McGrath <roland@hack.frob.com>
Signed-off-by: Sinny Kumari <ksinny@gmail.com>
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
2020-12-02 11:49:13 +01:00
Dodji Seketeli
be6bf58308 Add missing SPDX headers to source files not specifying any license
Default to the project's defautl - LGPLv3+ - for those.

	* Makefile.am: Add a LGPL-3.0-or-later SPDX header prefixed
	with '##' so that that the header doesn't get emitted in the
	resulting Makefile.in file.  Note that the license of Makefile.in
	files is "FSF All Permissible License", which virtually compatible
	with anything.
	* bash-completion/Makefile.am: Likewise.
	* doc/Makefile.am: Likewise
	* doc/manuals/Makefile.am: Likewise
	* include/Makefile.am: Likewise
	* src/Makefile.am: Likewise
	* tests/Makefile.am: Likewise
	* tests/data/Makefile.am: Likewise
	* tools/Makefile.am: Likewise
	* .clang-format: Add a LGPL-3.0-or-later SPDX header.
	* bash-completion/abicompat: Likewise.
	* bash-completion/abidiff: Likewise.
	* bash-completion/abidw: Likewise.
	* bash-completion/abilint: Likewise.
	* bash-completion/abinilint: Likewise.
	* bash-completion/abipkgdiff: Likewise.
	* bash-completion/abisym: Likewise.
	* bash-completion/fedabipkgdiff: Likewise.
	* configure.ac: Likewise.
	* default.abignore: Likewise.
	* doc/api/libabigail.doxy: Likewise.
	* doc/website/libabigail-website.doxy: Likewise.
	* include/abg-version.h.in: Likewise.
	* scripts/dot_to_png.sh: Likewise.
	* scripts/dot_to_svg.sh: Likewise.
	* scripts/make-verbose.sh: Likewise.
	* scripts/svg_to_plain_svg.sh: Likewise.
	* scripts/svg_to_png_and_pdf.sh: Likewise.
	* tests/runtestcanonicalizetypes.sh.in: Likewise.
	* tests/runtestdefaultsupprs.py.in: Likewise.
	* tests/runtestdefaultsupprspy3.sh.in: Likewise.
	* tests/runtestfedabipkgdiffpy3.sh.in: Likewise.
	* tests/update-test-output.py: Likewise.
	* update-copyright.sh: Likewise.

Signed-off-by: Benjamin De Kosnik <bkoz@gnu.org>
Signed-off-by: Ben Woodard <woodard@redhat.com>
Signed-off-by: Chenxiong Qi <cqi@redhat.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Signed-off-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Jessica Yu <jeyu@kernel.org>
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Mark Wielaard <mark@klomp.org>
Signed-off-by: Matthias Klose <doko@ubuntu.com>
Signed-off-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Ondrej Oprala <ondrej.oprala@gmail.com>
Signed-off-by: Roland McGrath <roland@hack.frob.com>
Signed-off-by: Sinny Kumari <ksinny@gmail.com>
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
2020-12-02 11:44:56 +01:00
Matthias Maennich
58488c5f31 Replace individual license references with SPDX Identifiers
This patch replaces license headers with SPDX identifiers in all files
containing license headers.  For each file, the SPDX identifier
formally represents its current license.  Note that the list of SPDX
identifiers is available on the SPDX web site at
https://spdx.org/licenses.

For autoconf-archive/ax_prog_python_version.m4 however, there is a
little catch.  Dodji Seketeli wrote this ax_check_python_modules.m4.
Just like the other autoconf-archive macros, it makes sense to have it
under the FSF All Permissive license.  Actually, the terms of that
license was already in the file but then the license header was
wrongly set to GPLv2 with autoconf exception.  So I fixed that in this
commit by setting the SPDX identifier to FSFAP.

	* abigail.m4: Replace the license header with the SPDX identifier
	GPL-3.0-or-later WITH GCC-exception-3.1
	* autoconf-archive/ax_check_python_modules.m4: Correctly set the
	SPDX identifier to FSFAP.
	* autoconf-archive/ax_compare_version.m4: Replace the license
	header with the SPDX identifier FSFAP.
	* autoconf-archive/ax_prog_python_version.m4: Likewise.
	header with the SPDX identifier FSFAP.
	* autoconf-archive/ax_valgrind_check.m4: Likewise.
	* gen-changelog.py: Replace the license header with the SPDX
	identifier LGPL-2.0-or-later.
	* include/abg-comp-filter.h: Replace the license header with the
	SPDX identifier LGPL-3.0-or-later.
	* include/abg-comparison.h: Likewise.
	* include/abg-config.h: Likewise.
	* include/abg-corpus.h: Likewise.
	* include/abg-cxx-compat.h: Replace the license header with the
	SPDX identifier LGPL-2.0-or-later.
	* include/abg-diff-utils.h: Replace the license header with the
	SPDX identifier LGPL-3.0-or-later
	* include/abg-dwarf-reader.h: Likewise.
	* include/abg-fwd.h: Likewise.
	* include/abg-hash.h: Likewise.
	* include/abg-ini.h: Likewise.
	* include/abg-interned-str.h: Likewise.
	* include/abg-ir.h: Likewise.
	* include/abg-libxml-utils.h: Likewise.
	* include/abg-libzip-utils.h: Likewise.
	* include/abg-reader.h: Likewise.
	* include/abg-regex.h: Likewise.
	* include/abg-reporter.h: Likewise.
	* include/abg-sptr-utils.h: Likewise.
	* include/abg-suppression.h: Likewise.
	* include/abg-tools-utils.h: Likewise.
	* include/abg-traverse.h: Likewise.
	* include/abg-viz-common.h: Likewise.
	* include/abg-viz-dot.h: Likewise.
	* include/abg-viz-svg.h: Likewise.
	* include/abg-workers.h: Likewise.
	* include/abg-writer.h: Likewise.
	* install-sh: Replace the license header with the SPDX identifier MIT.
	* ltmain.sh: Replace the license header with the SPDX identifier
	GPL-2.0-or-later.  Note that this file has the libtool special
	exception which allows us to redistribute it under the general
	license of the project.
	* src/abg-comp-filter.cc: Replace the license header with the SPDX
	* src/abg-comparison-priv.h: Likewise.
	* src/abg-comparison.cc: Likewise.
	* src/abg-config.cc: Likewise.
	* src/abg-corpus-priv.h: Likewise.
	* src/abg-corpus.cc: Likewise.
	* src/abg-default-reporter.cc: Likewise.
	* src/abg-diff-utils.cc: Likewise.
	* src/abg-dwarf-reader.cc: Likewise.
	* src/abg-elf-helpers.cc: Likewise.
	* src/abg-elf-helpers.h: Likewise.
	* src/abg-regex.cc: Likewise.
	* src/abg-hash.cc: Likewise.
	* src/abg-ini.cc: Likewise.
	* src/abg-internal.h: Likewise.
	* src/abg-ir-priv.h: Likewise.
	* src/abg-ir.cc: Likewise.
	* src/abg-leaf-reporter.cc: Likewise.
	* src/abg-libxml-utils.cc: Likewise.
	* src/abg-libzip-utils.cc: Likewise.
	* src/abg-reader.cc: Likewise.
	* src/abg-reporter-priv.cc: Likewise.
	* src/abg-reporter-priv.h: Likewise.
	* src/abg-sptr-utils.cc: Likewise.
	* src/abg-suppression-priv.h: Likewise.
	* src/abg-suppression.cc: Likewise.
	* src/abg-tools-utils.cc: Likewise.
	* src/abg-traverse.cc: Likewise.
	* src/abg-viz-common.cc: Likewise.
	* src/abg-viz-dot.cc: Likewise.
	* src/abg-viz-svg.cc: Likewise.
	* src/abg-workers.cc: Likewise.
	* src/abg-writer.cc: Likewise.
	* tests/lib/catch.cc: Likewise.
	* tests/lib/catch.hpp: Add an SPDX identifier BSL-1.0.
	* tests/mockfedabipkgdiff.in: Replace the license header with the
	SPDX identifier GPL-3.0-or-later.
	* tests/print-diff-tree.cc: Likewise.
	* tests/runtestfedabipkgdiff.py.in: Replaace the license header
	with the SPDW identifier GPL-3.0-or-later.
	* tests/test-abicompat.cc: Replace the license header with the
	SPDX identifier LGPL-3.0-or-later.
	* tests/test-abidiff-exit.cc: Likewise.
	* tests/test-abidiff.cc: Likewise.
	* tests/test-alt-dwarf-file.cc: Likewise.
	* tests/test-annotate.cc: Likewise.
	* tests/test-cxx-compat.cc: Likewise.
	* tests/test-core-diff.cc: Likewise.
	* tests/test-diff-dwarf-abixml.cc: Likewise.
	* tests/test-diff-dwarf.cc: Likewise.
	* tests/test-diff-filter.cc: Likewise.
	* tests/test-diff-pkg.cc: Likewise.
	* tests/test-diff-suppr.cc: Likewise.
	* tests/test-diff2.cc: Likewise.
	* tests/test-dot.cc: Replace the license header with the
	SPDX identifier GPL-3.0-with-GCC-exception.
	* tests/test-elf-helpers.cc: Replace the license header with the
	SPDX identifier LGPL-3.0-or-later.
	* tests/test-ini.cc: Likewise.
	* tests/test-ir-walker.cc: Likewise.
	* tests/test-kmi-whitelist.cc: Likewise.
	* tests/test-lookup-syms.cc: Likewise.
	* tests/test-read-dwarf.cc: Likewise.
	* tests/test-read-write.cc: Likewise.
	* tests/test-svg.cc: Replace the license header with the SPDX
	identifier GPL-3.0-with-GCC-exception.
	* tests/test-symtab.cc: Replace the license header with the SPDX
	identifier LGPL-3.0-or-later.
	* tests/test-tools-utils.cc: Likewise.
	* tests/test-types-stability.cc: Likewise.
	* tests/test-utils.cc: Likewise.
	* tests/test-utils.h: Likewise.
	* tests/test-write-read-archive.cc: Likewise.
	* tools/abiar.cc: Likewise.
	* tools/abicompat.cc: Likewise.
	* tools/abidiff.cc: Likewise.
	* tools/abidw.cc: Likewise.
	* tools/abilint.cc: Likewise.
	* tools/abipkgdiff.cc: Likewise.
	* tools/abisym.cc: Likewise.
	* tools/binilint.cc: Likewise.
	* tools/fedabipkgdiff: Replace the license header with the
	SPDX identifier GPL-3.0-or-later.
	* tools/kmidiff.cc: Likewise.

Signed-off-by: Benjamin De Kosnik <bkoz@gnu.org>
Signed-off-by: Ben Woodard <woodard@redhat.com>
Signed-off-by: Chenxiong Qi <cqi@redhat.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Signed-off-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Jessica Yu <jeyu@kernel.org>
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Mark Wielaard <mark@klomp.org>
Signed-off-by: Matthias Klose <doko@ubuntu.com>
Signed-off-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Ondrej Oprala <ondrej.oprala@gmail.com>
Signed-off-by: Roland McGrath <roland@hack.frob.com>
Signed-off-by: Sinny Kumari <ksinny@gmail.com>
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
2020-12-02 11:44:13 +01:00
Dodji Seketeli
95c53c89f3 dwarf-reader: Avoid having several functions with the same symbol
In the DWARF debug info, a C++ class can be represented by pieces
throughout a given binary.

In this picture, a given virtual member function can be represented
several times; each time in one different piece of the C++ class.  In
a given piece of the class, a virtual member function can be
represented with its ELF symbol set.  In another one, the same virtual
member function can be represented without that ELF symbol set.  And
there can also be pieces of the class that don't have a given virtual
function.

To handle this, the DWARF reader constructs one class from all its
pieces scattered around.  It adds each virtual member function to the
class as it comes across them while scanning the DWARF.

Then there is a pass at the end of the process that sets ELF symbols
to the (virtual) member functions that need it.

The problem with that pass is that it sometimes sets the same ELF
symbol to more than one virtual member function.  Those virtual member
functions all have the same mangled name that correspond to the ELF
symbol; but only one of them is meant to be associated with the ELF
symbol.  In essence, that one is the one that is exported by the ELF
binary.

This patch teaches the pass that sets the ELF symbols of function to
avoid setting the same ELF symbol to more than one function.

The patch also avoids build_function_decl to set symbol to a function
if that symbol was already set to an existing function.

This patch thus fixes a class of issues what arise when comparing a
binary against its own ABIXML representation.  Those several functions
having the same ELF symbol would cause spurious changes in that
context.

	* src/abg-dwarf-reader.cc
	(read_context::symbol_already_belongs_to_a_function): Define new
	member function.
	(read_context::fixup_functions_with_no_symbols): Use the new
	symbol_already_belongs_to_a_function function to avoid setting a
	symbol that already belongs to a function.
	* tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Adjust.
	* tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Likewise.
	* tests/data/test-read-dwarf/test16-pr18904.so.abi: Likewise.
	* tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi:
	Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2020-11-27 16:56:25 +01:00
Dodji Seketeli
a07fce3669 ir: Introduce internal pretty representation for anonymous classes
There are two views for internal pretty representation of anonymous
classes.

1/ When we look at the anonymous class itself, we use its 'flat
representation' i.e:

    'class {int blah; char bleh;}'

2/ When we look at a pointer or a reference to the anonymous class we
use its generic anonymous internal name, i.e:

   '__anonymous_struct__*'

As a general rule, libabigail always use the keyword 'class' to prefix
the name of classes for internal purposes, independent from the fact
that the type is a struct or a class.  That is a pre-requisite to be
able to canonicalize classes and structs together.  In other words, if
a class and a struct are structurally equal, they are going to be
considered equivalent by the canonicalization process.

Currently however, in the view 1/ of the pretty representation of
anonymous classes, a struct and a class will have different
representations.  For instance, and empty anonymous struct would be
represented as 'struct {}', whereas an empty anonymous class would be
represented as 'class {}'.  This prevents these two be considered
equivalent by the canonicalization process.  This leads to spurious
change reports later down the road.

In the view 2/ we have a similar but different problem: the qualified
names of the anonymous classes are not taken into account when
representing pointer or references to said anonymous classes.  Only
their unqualified generic anonymous internal names are taken into
account in the representation.  This leads to pointers/references to
anonymous classes being wrongly considered equivalent even when they
belong to different namespaces.

This patch corrects the issues related to both views 1/ and 2/.  It
should make libabigail correctly consider some anonymous classes as
equivalent (view 1) and correctly consider pointers/references to
anonymous classes as different when they belong to different
namespaces (view 2).

A number of reference tests are adjusted accordingly.

	* include/abg-fwd.h (get_class_or_union_flat_representation):
	Introduce an "internal" parameter.
	* src/abg-ir.cc (get_class_or_union_flat_representation):
	Introduce an "internal" parameter.  In the flat representation of
	a class for internal purposes, always use the prefix "class" even
	if this is a struct.
	(get_type_name): To build an internal name for a
	reference or pointer to an anonymous type, consider the namespace
	name of said type.
	(equals): In the overload for decl_base, take the namespace name
	of anonymous decls into account when comparing them.
	({var_decl, union_decl}::get_pretty_representation): Adjust calls
	to get_class_or_union_flat_representation to pass a proper
	"internal" argument.
	* src/abg-default-reporter.cc (default_reporter::report): Adjust
	the call to get_class_or_union_flat_representation to pass an
	"internal" argument set to 'false'.
	* tests/data/test-annotate/libtest23.so.abi: Adjust.
	* tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Likewise.
	* tests/data/test-read-dwarf/libtest23.so.abi: Likewise.
	* tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Likewise.
	* tests/data/test-read-dwarf/test11-pr18828.so.abi: Likewise.
	* tests/data/test-read-dwarf/test12-pr18844.so.abi: Likewise.
	* tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise.
	* tests/data/test-read-dwarf/test-libandroid.so.abi: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2020-11-27 13:53:15 +01:00
Dodji Seketeli
35162bd4e3 writer: Emit definitions of declarations when they are present
Libabigail goes a long way to resolve declaration-only classes
to their definitions when it's possible.

The ABIXML writer however sometimes forgets to emit the definition of
such declarations that have been "resolved".

Later, when the binary is compared to its own ABIXML representation,
the reporting engine thus reports that the definition is lost.

This patch fixes that.

	* src/abg-writer.cc (write_class_decl, write_union_decl): Get the
	definition of the declaration if it exists and emit that.
	* tests/data/test-read-dwarf/test13-pr18894.so.abi: Adjust.
	* tests/data/test-read-dwarf/test15-pr18892.so.abi: Likewise.
	* tests/data/test-read-dwarf/test21-pr19092.so.abi: Likewise.
	* tests/data/test-annotate/test13-pr18894.so.abi: Likewise.
	* tests/data/test-annotate/test15-pr18892.so.abi: Likewise.
	* tests/data/test-annotate/test21-pr19092.so.abi: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2020-11-27 13:53:15 +01:00
Dodji Seketeli
b553802af8 Bug 26780 - Fix array subrange bounds (de)serialization
When serializing subrange bounds to ABIXML today the writer omits the
lower and upper bounds.  Only the length is emitted.  The reader thus
assumes that the lower bound of an array subrange is always 0.  In
Fortran however, that is not true, as the lower bound is 1.

This patch instructs the writer to emits the lower bound whenever it's
different from zero.  It also emits the upper bound in that case.  The
reader is updated accordingly to take the lower and upper bounds into
account whenever they are present.  It they are not, then the
lower bound is assumed to be zero and the upper bound is deduced from
the length, as was already the case until now.

	* src/abg-reader.cc (build_subrange_type): Read lower-bound
	attribute if present.  Then try to read upper-bound attribute as
	well.  If this is not an infinite subrange assert that the length
	must be equal to the difference between the bounds.
	* src/abg-writer.cc (write_array_subrange_type): Write the
	lower-bound if it's present and not zero.  In that case, write the
	upper-bound as well.
	* tests/data/test-diff-pkg/hdf5-1.10.6-2.fc33.x86_64.rpm: Add new
	binary test input.
	* tests/data/test-diff-pkg/hdf5-debuginfo-1.10.6-2.fc33.x86_64.rpm:
	Likewise.
	* tests/data/test-diff-pkg/hdf5-1.10.6-2.fc33.x86_64.self-check-report-0.txt:
	Add new reference output.
	* tests/data/Makefile.am: Add the new test material above to
	source distribution.
	* tests/test-diff-pkg.cc (in_out_specs): Add the binary test input
	to the set of --self-check tests.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2020-11-27 13:50:47 +01:00
Dodji Seketeli
33223963bd tests/data/test-fedabipkgdiff: Update reference output
Instances of self_compare_task don't wrongly shadow task comparison
arguments anymore.  Instead, they properly use the task comparison
arguments of the parent class compare_task.

So in the sorting function elf_size_is_greater, we now always have
proper elf binaries size.  It follows that the sorting can now yield a
consistent result, always.

It thus appears that the reference output recorded for the
"self-comparison" test of runtestfedabipkgdiffpy3.sh was wrong.  This
patch updates it.

	* tests/data/test-fedabipkgdiff/test7-self-compare-from-fc23-dbus-glib-report-0.txt:
	Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2020-11-25 13:15:18 +01:00
Dodji Seketeli
c2ce1a38c6 dwarf-reader: support artificially generated translation units
When GCC 10 artificially generates a translation unit, the path/name
of the translation unit as given by the DW_AT_name attribute of the
translation unit DIE is the string "<artificial>".

Libabigail expects that translation units have unique file paths so
having several artificially generated translation units like this one
with the same name makes hell break loose down the road.

This patch suffixes the name of artificial DIE with their die offset
number to have a unique path name for artificially generated
translation units.

	* configure.ac: Detect if we are running on RPM >= 4.15.  If yes,
	then define the preprocessor macro RPM_4_15.  If that macro is
	defined then test-diff-pkg.cc can support RPMs from Fedora >= 31
	as those are compressed with zstd.  Earlier RPM versions don't
	support that compression scheme.
	* src/abg-dwarf-reader.cc (build_translation_unit_and_add_to_ir):
	Suffix the offset of the translation unit to its name when that
	name is "<artificial>".
	* tests/data/test-diff-pkg/mesa-libGLU-9.0.1-3.fc33.x86_64.rpm:
	New binary test input.
	* tests/data/test-diff-pkg/mesa-libGLU-debuginfo-9.0.1-3.fc33.x86_64.rpm: Likewise.
	* tests/data/test-diff-pkg/mesa-libGLU-9.0.1-3.fc33.x86_64.self-check-report-0.txt:
	New reference output for the binary test input above.
	* tests/data/Makefile.am: Add the new test inputs above to source
	distribution.
	* tests/test-diff-pkg.cc (in_out_specs): Add the binary test
	inputs above to source distribution if we are running on an RPM
	version >= 4.15.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2020-11-24 05:04:06 +01:00
Dodji Seketeli
ddead98a51 fedabipkgdiff: make --self-compare use abipkgdiff --self-check
Now that the abipkgdiff program supports the --self-check option to
make it compare the binaries in an RPM against their own ABIXML
representation, make the --self-compare option of fedabipkgdiff use
the abipkgdiff --self-check.

	* tools/fedabipkgdiff (abipkgdiff): If the user provides the
	--self-compare options, generate the abipkgdiff command by using
	the --self-check option.
	(run_abipkgdiff): Each return value of the abipkgidiff runs can be
	negative because they are unsigned values in essence, but as
	python doesn't seem to have a unsigned integer type.  So we need
	to consider the max of the absolute value of the return codes
	here.
	* tests/data/test-fedabipkgdiff/test7-self-compare-from-fc23-dbus-glib-report-0.txt:
	Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2020-11-23 17:50:06 +01:00
Dodji Seketeli
cac59a176a Bug 26769 - Fix missing types in abixml output
The symptom of the issue at hand is that sometimes there can be types
missing from the abixml output.  This happens when analysing some C++
code bases.

The core of the issue is the following.  Support we have a type
"struct S" defined somewhere as:

    struct S // #0
    {
      int  dm1;
      char dm2;
    };

    S s;

Suppose that in another translation unit, we have the class 'S' being
extended to add a member type to it:

    struct S // #1
    {
      typedef int dm1_type;
    };

    typedef S::dm1_type Integer;
    Integer something;

When emitting the abixml for the codebase, the definition of the
typedef S::dm1_type can be missing.

Note that in location #1, struct S is considered declaration-only.
It's definition is in another translation unit, in location #0.

So the abixml writer emits the 'struct S' defined in location #0, but
forgets to emit the 'struct S' in #1, which is indirectly used for the
sole purpose of using its member type S::dm1_type.

This patch emits the S::dm1_type type that is mistakenly forgotten
today.

Now that the "struct S" of #1 is also emitted, a tangent problem is
uncovered: S in #0 can be wrongly thought to be equivalent to S in #1,
for ABI purposes
This is because of an ODR-based optimization that is used for C++.
That is, the two struct S can be wrongly considered equivalent just
because they have the same name.  Note that ODR means "One Definition Rule[1]"

This patch removes the ODR-based optimization and thus fixes many of
the issues uncovered by the previous changes.

The patch also uncovered that some non-static variables were sometimes wrongly
being added to the set of exported variables, while libabigail reads
corpora from abixml.  The patch fixes this as well.

[1]: One Definition Rule: https://en.wikipedia.org/wiki/One_Definition_Rule

	* include/abg-corpus.h (corpus::{record_canonical_type,
	lookup_canonical_type}): Remove function declarations.
	* src/abg-corpus-priv.h (corpus::priv::canonical_types_): Remove
	data member.
	* src/abg-corpus.cc (corpus::{record_canonical_type,
	lookup_canonical_type}): Remove functions.
	* src/abg-ir.cc (type_eligible_for_odr_based_comparison): Remove
	static function.
	(type_base::get_canonical_type_for): Don't perform the ODR-based
	optimization for C++ anymore.
	* src/abg-reader.cc
	(read_context&::maybe_add_var_to_exported_decls): Don't add a
	variable that hasn't been added to its scope.  Otherwise, it means
	we added a variable that wasn't yet properly constructed.  Also
	add a new overload for var_decl_sptr&.
	(build_var_decl): Do not add the var to its the set of exported
	declaration before we are sure it has been fully constructed and
	added to the scope it belongs.
	(build_class_decl): Only add *static* data members to the list of
	exported declarations.
	(handle_var_decl): A var decl seen here is a global variable
	declaration.  Add it to the list of exported declarations.
	* src/abg-writer.cc (write_context::decl_only_type_is_emitted):
	Constify parameter.
	(write_translation_unit): Do not forget to emit referenced types
	that were maybe not canonicalized.  Also, avoid using noop_deleter
	when it's not necessary.
	(write_namespace_decl): Do not forget to emit canonicalized types
	that are present in namespaces other than the global namespace.
	* tests/runtestslowselfcompare.sh.in: New test that compares
	libabigail.so against its own ABIXML representation.
	* tests/Makefile.am: Add the new test runtestslowselfcompare.sh to
	source distribution.  This test is too slow to be run during the
	course of 'make check'.  It takes more than 5 minutes on my slow
	box here.  Rather, it can be run using 'make check-self-compare'.
	I plan to run this before releases now.
	* tests/data/test-annotate/libtest24-drop-fns-2.so.abi: Adjust.
	* tests/data/test-annotate/libtest24-drop-fns.so.abi: Likewise.
	* tests/data/test-annotate/test0.abi: Likewise.
	* tests/data/test-annotate/test13-pr18894.so.abi: Likewise.
	* 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-read-dwarf/PR22015-libboost_iostreams.so.abi:
	Likewise.
	* tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Likewise.
	* tests/data/test-read-dwarf/PR25042-libgdbm-clang-dwarf5.so.6.0.0.abi:
	Likewise.
	* tests/data/test-read-dwarf/PR26261/PR26261-exe.abi: Likewise.
	* tests/data/test-read-dwarf/libtest24-drop-fns-2.so.abi:
	Likewise.
	* tests/data/test-read-dwarf/libtest24-drop-fns.so.abi: Likewise.
	* tests/data/test-read-dwarf/test-libandroid.so.abi: Likewise.
	* tests/data/test-read-dwarf/test0.abi: Likewise.
	* tests/data/test-read-dwarf/test0.hash.abi: Likewise.
	* tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Likewise.
	* tests/data/test-read-dwarf/test11-pr18828.so.abi: Likewise.
	* tests/data/test-read-dwarf/test12-pr18844.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/test16-pr18904.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.
	* tests/data/test-read-write/test28-without-std-fns-ref.xml:
	Likewise.
	* tests/data/test-read-write/test28-without-std-vars-ref.xml:
	Likewise.
	* tests/data/test-read-write/test6.xml: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2020-11-23 13:02:34 +01:00
Dodji Seketeli
de5de7b447 Make sure to canonicalize all types but decl-only classes
While looking at the remaining potential sources of instability in the
generation of type ids at abixml generation time, it occurred to me
that we still had several non canonicalized types in the system.

When a given type T is not canonicalized,
hash_as_canonical_type_or_constant later hashes it as an arbitrary
constant.  So in the ID hash map of the abixml writer, all the
non-canonicalized types will tend to end-up in the same hash map
bucket, so to speak.  More precisely, if T is equivalent to another
type T' which is canonicalized, then T and T' will end-up in different
buckets (in the same hash map) because they will have different hash
values as returned by hash_as_canonical_type_or_constant.  They will
thus end-up having different type-ids because they are in different
buckets.

The solution is to make sure that T is *also* canonicalized.  That
way, if T and T' are equivalent, they'll end-up in the same bucket and
they will have the same type-id.

In other words, all types should be canonicalized now.

The only exception to that rule is declaration-only classes and
unions.  The reason why a declaration-only type 'struct foo' needs to
stay non-canonicalized is that it must equal all the definitions of
'struct foo' that can be found elsewhere.

This patch thus canonicalizes all types that were not still not being
canonicalized.  It also adds an assert in
hash_as_canonical_type_or_constant to ensure that only
declaration-only class_or_union types are not canonicalized.

	* include/abg-fwd.h (is_declaration_only_class_or_union_type):
	Declare new ...
	* src/abg-ir.cc (is_declaration_only_class_or_union_type):
	... function.
	(clone_array): Add the cloned array subrange to
	its scope so that it can later be canonicalized.
	(synthesize_type_from_translation_unit)
	(synthesize_function_type_from_translation_unit): Canonicalize the
	synthesized types.
	(hash_as_canonical_type_or_constant): Ensure that all types are
	canonicalized.
	* src/abg-dwarf-reader.cc (maybe_canonicalize_type): Remove
	useless overload.
	(build_ir_node_for_variadic_parameter_type)
	(schedule_array_tree_for_late_canonicalization): Define new static
	functions.
	(maybe_strip_qualification): Schedule type canonicalization for
	types cloned prior to editing.
	(build_function_type): Use the new
	build_ir_node_for_variadic_parameter_type.  It takes care of
	canonicalizing variadic parameter types.
	(build_function_decl): Canonicalize the function type that is
	created here.
	(build_ir_node_from_die): Use the overload of
	maybe_canonicalize_type which canonicalizes class_or_union nodes
	directly, rather than the one which handles DIE offsets.  The
	latter was used as an optimization to reduce the size of the array
	of types scheduled for canonicalization, as DIE offsets take less
	space than pointers to IR types.  Now that we have DIE
	de-duplication, my bet is that we can do away with the former.
	And that also ensures that we miss no type for canonicalization
	purposes.
	* src/abg-reader.cc (build_array_type_def): Canonicalize the
	subrange types of the array.
	(build_type): Canonicalize all types.
	* tests/data/test-annotate/libtest23.so.abi: Adjust.
	* tests/data/test-annotate/libtest24-drop-fns-2.so.abi: Likewise.
	* tests/data/test-annotate/libtest24-drop-fns.so.abi: Likewise.
	* tests/data/test-annotate/test0.abi: Likewise.
	* tests/data/test-annotate/test13-pr18894.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-filter/test30-pr18904-rvalueref-report0.txt:
	Likewise.
	* tests/data/test-diff-filter/test30-pr18904-rvalueref-report1.txt:
	Likewise.
	* tests/data/test-diff-filter/test30-pr18904-rvalueref-report2.txt:
	Likewise.
	* tests/data/test-diff-filter/test35-pr18754-no-added-syms-report-0.txt:
	Likewise.
	* tests/data/test-read-dwarf/PR22015-libboost_iostreams.so.abi:
	Likewise.
	* tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Likewise.
	* tests/data/test-read-dwarf/PR25042-libgdbm-clang-dwarf5.so.6.0.0.abi:
	Likewise.
	* tests/data/test-read-dwarf/libtest23.so.abi: Likewise.
	* tests/data/test-read-dwarf/libtest24-drop-fns-2.so.abi:
	Likewise.
	* tests/data/test-read-dwarf/libtest24-drop-fns.so.abi: Likewise.
	* tests/data/test-read-dwarf/test-libandroid.so.abi: Likewise.
	* tests/data/test-read-dwarf/test0.abi: Likewise.
	* tests/data/test-read-dwarf/test0.hash.abi: Likewise.
	* tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Likewise.
	* tests/data/test-read-dwarf/test11-pr18828.so.abi: 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/test15-pr18892.so.abi: Likewise.
	* tests/data/test-read-dwarf/test16-pr18904.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>
2020-11-16 09:16:09 +01:00
Dodji Seketeli
2cc1ab7ee8 writer: Sort decls and fix topological sorting for types
When emitting the declarations of a given translation unit, those
declarations are not sorted.  Ooops.  This patch adds topological
sorting for those declarations, making the decls defined first to be
emitted first.  When the decls are defined at the same location then
the pretty representation is used for lexicographic sorting instead.

It turns out that during the topological sorting for types there was
some uncertainty when the declarations of the types had the same
definition location.  This patch re-uses the declaration sorting above
for the declarations of these types.

	* include/abg-ir.h (scope_decl::get_sorted_member_decls): Declare
	new member function.
	* src/abg-ir.cc (struct decl_topo_comp): New sorting functor.
	(type_topo_comp::operator()): Re-use the decl_topo_comp to sort
	type declarations.
	(scope_decl::priv::sorted_members_): Add new data member.
	(scope_decl::get_sorted_member_decls): Define new member function.
	* src/abg-writer.cc (write_translation_unit): Use the new
	scope_decl::get_sorted_member_decls.
	* tests/data/test-annotate/libtest23.so.abi: Adjust.
	* 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-read-dwarf/libtest23.so.abi: Likewise.
	* tests/data/test-read-dwarf/test-libandroid.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-write/test2.xml: Likewise.
	* tests/data/test-read-write/test28-without-std-fns-ref.xml:
	Likewise.
	* tests/data/test-read-write/test28-without-std-vars-ref.xml:
	Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2020-11-12 16:37:30 +01:00
Dodji Seketeli
3c87247cb4 Bug PR26739 - Handle qualified typedef array types
CV-qualifiers of a typedef of an array type apply to the elements of
the array.  So this can be transformed into a typedef of array type
which element type is similarly CV-qualified.

That transformation helps avoiding spurious changes that might occur
when comparing the latter form against the former even though both are
equivalent.

This patch performs that transformation, just like we already do for
CV-qualified array types which are transformed into an array of
similarly CV-qualified elements.

Performing that transformation amounts to editing the type of the
array elements.  As those types might be used by other parts of the
type graph (type node sharing), the patch "clones" the type sub-tree
of interest and edits the cloned version.  That way, the shared type
nodes are not edited.  It appears that in the existing version of
maybe_strip_qualification, the transformation of CV-qualified arrays
into arrays of CV-qualified elements was unfortunately editing shared
type nodes.  The patch fixes that and re-works the logic of*
maybe_strip_qualification to make it handle this new case and the
previous one in a somewhat generic manner.

	* include/abg-fwd.h (is_typedef_of_array, clone_array)
	(clone_typedef, clone_qualified_type, clone_array_tree): Declare
	new functions.
	(peel_qualified_or_typedef_type): Declare new overload.
	(is_array_of_qualified_element): Constify the parameter.
	* include/abg-ir.h ({qualified_type,
	typedef}_def::set_underlying_type): Add new member functions.
	(array_type_def::subrange_type::subrange_type): Make constify the
	reference to the underlying type parameter.
	* src/abg-ir.cc (is_array_of_qualified_element): Constify the
	parameter.
	(peel_qualified_or_typedef_type): Define new
	overload for type_base_sptr.
	(clone_typedef_array_qualified_type): Define static function.
	(clone_array clone_typedef, clone_qualified_type)
	(clone_array_tree, is_typedef_of_array): Define new functions.
	(qualified_type_def::get_underlying_type): Rename the return type
	shared_ptr<type_base> into type_base_sptr.
	({typedef, qualified_type}_def::set_underlying_type): Define new
	member function.
	(array_type_def::subrange_type::priv::priv): Initialize the
	'infinite_' data member.
	* src/abg-dwarf-reader.cc (maybe_strip_qualification): Handle
	qualified typedef of arrays.  Merge this with the handling of
	qualified arrays.  Note that before editing the elements of the
	array to make the array (or typedef) qualifier apply to the
	element the sub-tree is cloned to make its type nodes be
	'un-shared'.  This prevents us from editing type nodes that are
	shared by other type expressions.
	* tests/data/test-diff-filter/test-PR26739-report-0.txt: New
	reference test output.
	* tests/data/test-diff-filter/test-PR26739-2-report-0.txt: Likewise.
	* tests/data/test-diff-filter/test-PR26739-v{0,1}.c: Source code
	of new binary test input.
	* tests/data/test-diff-filter/test-PR26739-2-v{0,1}.c: Likewise.
	* tests/data/test-diff-filter/test-PR26739-v{0,1}.o: New binary
	test inputs.
	* tests/data/test-diff-filter/test-PR26739-2-v{0,1}.o: Likewise.
	* tests/data/Makefile.am: Add the new test material above to
	source distribution.
	* tests/test-diff-filter.cc (in_out_specs): Add the test inputs
	above to this harness.
	* tests/data/test-annotate/test15-pr18892.so.abi: Adjust.
	* tests/data/test-annotate/test17-pr19027.so.abi: Likewise.
	* tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi:
	Likewise.
	* tests/data/test-annotate/test21-pr19092.so.abi: Likewise.
	* tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Likewise.
	* tests/data/test-read-dwarf/test12-pr18844.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/test19-pr19023-libtcmalloc_and_profiler.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.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2020-11-12 10:53:40 +01:00
Dodji Seketeli
baee817d3e Update test-libandroid.so.abi
Update this test reference output as per the commit below:

  b7ad7f2b Bug 26770 - Spurious declaration-only-ness induces spurious type changes

	* tests/data/test-read-dwarf/test-libandroid.so.abi: Update.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2020-11-03 08:47:26 +01:00
Matthias Maennich
38e72b262d dwarf-reader: Ignore zero length location expressions from DW_AT_location
Location expressions might occasionally be of length 0. E.g. a reason
for that are thread local variables that do not exactly have a
location to refer to. Compilers/Linkers may choose an empty location
description. E.g.  see the dwarfdump output for the added testcase
based on libandroid.so (from AOSP).

$ dwarfdump libandroid.so|egrep -B9 "gChoreographerE$"

LOCAL_SYMBOLS:
< 1><0x00000022> DW_TAG_namespace
                   DW_AT_name           android
< 2><0x00000027>   DW_TAG_variable
                     DW_AT_name           gChoreographer
                     DW_AT_type           <0x00000b65>
                     DW_AT_decl_file      0x00000003 .../choreographer.cpp
                     DW_AT_decl_line      0x00000059
                     DW_AT_location       len 0x0000: :
                     DW_AT_linkage_name   _ZN7androidL14gChoreographerE

The DW_AT_location is properly read by elfutils' dwarf_location(), but
is not useful for us to proceed with. Hence early exit on this.

	* src/abg-dwarf-reader.cc (die_location_expr): Ignore zero
	  length location expressions.
	* tests/data/Makefile.am: Add new test files.
	* tests/data/test-read-dwarf/test-libandroid.so: New test file.
	* tests/data/test-read-dwarf/test-libandroid.so.abi: Likewise.
	* tests/test-read-dwarf.cc: Add new test case.

Reported-by: Dan Albert <danalbert@google.com>
Reviewed-by: Giuliano Procida <gprocida@google.com>
Cc: Mark Wielaard <mark@klomp.org>
Signed-off-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2020-11-02 18:07:01 +01:00
Giuliano Procida
8a0825e319 Improve enum synthetic type names
The ordering of canonical types (in an abi-instr XML element) appears
to be sensitive to the particular C++ library used and the presence of
other threads doing heap allocation. This patch forces distinct
synthetic enum-underlying types to have distinct names, which ensures
deterministic XML output order.

	* src/abg-dwarf-reader.cc
	(build_internal_underlying_enum_type_name): Add a size
	argument (and don't default is_anonymous argument). Append
	size of type to synthetic type name.
	(build_enum_underlying_type): Pass type size to
	build_internal_underlying_enum_type_name.
	* tests/data/test-abidiff-exit/test-decl-enum-report-3.txt:
	Update. Note that there may be an issue with leaf-mode
	reporting of pointer type changes.
	* tests/data/test-diff-dwarf-abixml/PR25409-librte_bus_dpaa.so.20.0.abi:
	Regenerate this (catching up with various abidw updates).
	* tests/data/test-annotate/test-anonymous-members-0.o.abi:
	Refresh with new type names.
	* tests/data/test-annotate/test0.abi: Likewise.
	* tests/data/test-annotate/test13-pr18894.so.abi: Likewise.
	* 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-read-dwarf/PR22015-libboost_iostreams.so.abi:
	Likewise.
	* tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Likewise.
	* tests/data/test-read-dwarf/PR25007-sdhci.ko.abi: Likewise.
	* tests/data/test-read-dwarf/PR25042-libgdbm-clang-dwarf5.so.6.0.0.abi:
	Likewise.
	* tests/data/test-read-dwarf/test0.abi: Likewise.
	* tests/data/test-read-dwarf/test0.hash.abi: Likewise.
	* tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Likewise.
	* tests/data/test-read-dwarf/test11-pr18828.so.abi: 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/test16-pr18904.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: Giuliano Procida <gprocida@google.com>
Signed-off-by: Matthias Maennich <maennich@google.com>
2020-11-02 17:37:42 +01:00
Giuliano Procida
32343f8091 Improve and stabilise sort of member functions
The functor virtual_member_function_less_than did not take into
account linkage name which can be the only difference when multiple
destructors with differing mangled names are present.

This change adds a check for linkage names and also flattens the
control flow in the comparison method to make the logic clearer.

Lastly, this change also uses std::stable_sort, in case all that
remains is insertion order.

	* src/abg-ir.cc
	(virtual_member_function_less_than::operator()): Name
	temporaries like offsets and symbols to reduce repetition;
	test each pair of elements (including symbol presence) and
	return immediately if there's a difference; add a comparison
	of linkage name just after comparing symbol names.
	(sort_virtual_member_functions): Use stable_sort instead of
	sort.
	* tests/data/test-read-dwarf/PR22015-libboost_iostreams.so.abi:
	Update with new ordering of member functions.
	* tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi:
	Likewise.

Signed-off-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Matthias Maennich <maennich@google.com>
2020-11-02 16:27:33 +01:00
Dodji Seketeli
b4ec62929c update-test-output.py: Update syntax
* tests/update-test-output.py: Update syntax for python3.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2020-11-01 14:30:00 +01:00
Dodji Seketeli
b7ad7f2b2d Bug 26770 - Spurious declaration-only-ness induces spurious type changes
Sometimes when amending a C++ class to add new members or properties
to it as directed by the DWARF debug information, we can end-up with
discrepancies related to declaration-only-ness.  That is, an instances
of a given type Foo can be wrongly assigned declaration-only-ness that
should have been only carried by another instance Foo.  Then, later,
comparing two pointers to Foo might wrongly lead to spurious reported
changes due to the spurious differences of declaration-only-ness in
two instances of Foo.

By fixing the setting of the declaration-only-ness, especially when
amending a C++ class this patch fixes that spurious change detected.

	* src/abg-dwarf-reader.cc (add_or_update_class_type): When
	creating a class, set declaration-only-ness unconditionally.  When
	updating the class however, only set the declaration-only-ness
	when the current one is not consistent with the size of the class.
	* tests/data/test-annotate/test14-pr18893.so.abi: Adjust.
	* 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-read-dwarf/test14-pr18893.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/test22-pr19097-libstdc++.so.6.0.17.so.abi: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2020-11-01 14:29:51 +01:00
Dodji Seketeli
fd0f3ac341 Fix redundancy detection in the diff graph
A recent change[1] triggered a variation in the ABI changes reported,
depending on the platform.

It turned out the change made the redundancy detector walk more diff
nodes (like inserted/deleted virtual member functions and their
implicit parameter type) and that uncovered several underlying issues
that has been latent for a long time.

First, we were not walking the inserted/deleted virtual member
functions in a deterministic manner at reporting time.  Rather than
walking the unordered maps containing those functions, this patch now
walk them in lexicographic order.  The patch also does something
similar for the changed data members, but this time during the diff
graph analysis.  That order affects how we consider a given type
change to be redundant.

Second, when looking a diff node named N, if another diff node N'
equivalent to N has already been marked redundant (and thus filtered
out already), we were sometimes wrongly failing to detect and mark N
as redundant.  This patch fixes that.

I realized that some code was now unnecessary so I removed it.

A lot of reference output of tests are adjusted by this patch.
Mostly, these were cases we were failing to properly detect (and
filter out) as redundant reports.  So the change reports should
hopefully look more concise and to the point now.

[1] the recent change is this one:
    2f92777d Consider the implicit 'this' parameter when comparing methods

	* src/abg-comparison-priv.h
	(diff_context::priv::last_visited_diff_node_): Remove unnecessary
	data member.
	(class_or_union_diff::priv::sorted_{deleted,inserted}_member_functions_):
	Add new data members.
	(sort_string_member_function_sptr_map): Declare new function.
	* src/abg-comparison.cc (sort_string_member_function_sptr_map):
	Define new function.
	(redundancy_marking_visitor::visit_begin): If the current diff
	node is equivalent to another one that has been already marked
	redundant, then consider the current diff node as redundant as
	well.  Considering the fact an ancestor node has been filtered out
	is now useless because if that's the case then the current
	descendant node wouldn't even be walked at reporting time.  So
	remove the call to diff_has_ancestor_filtered_out.
	(categorize_redundancy): Remove useless call here as well.
	(diff_has_ancestor_filtered_out, diff_has_ancestor_filtered_out)
	(diff_context::{mark_last_diff_visited_per_class_of_equivalence,
	clear_last_diffs_visited_per_class_of_equivalence,
	get_last_visited_diff_of_class_of_equivalence}): Remove
	unnecessary functions.
	(redundancy_marking_visitor::visit_end): Add comment.
	(class_diff::ensure_lookup_tables_populated): Lexicographically
	sort inserted/deleted member functions.
	(class_or_union_diff::chain_into_hierarchy): Chain changed data
	members diff nodes in a sorted manner.
	* src/abg-default-reporter.cc (default_reporter::report): Report
	deleted/inserted member functions in lexicographic order.
	* tests/data/test-diff-filter/test31-pr18535-libstdc++-report-0.txt:
	Adjust.
	* tests/data/test-diff-filter/test31-pr18535-libstdc++-report-1.txt:
	Likewise.
	* tests/data/test-diff-pkg/libICE-1.0.6-1.el6.x86_64.rpm--libICE-1.0.9-2.el7.x86_64.rpm-report-0.txt:
	Likewise.
	* tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-0.txt:
	Likewise.
	* tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-1.txt:
	Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2020-10-12 16:34:56 +02:00
Dodji Seketeli
2f92777dc8 Consider the implicit 'this' parameter when comparing methods
Since 2013 the implicit 'this' parameter has been excluded from the
function parameters taken into account while comparing class member
functions.  This was an early measure to avoid infinite recursion that
would then occur when comparing classes (and thus their member
functions that are referenced in their vtable).  But since then, we've
built descent infrastructure to prevent this kind of recursion in a
more generic manner.

This patch thus removes that restriction and should therefore lift the
concerns expressed in the bug
https://sourceware.org/bugzilla/show_bug.cgi?id=26672.

Namely, changes to (data members of) a class should now be detected
when comparing member functions of that class.

With this change, the reference output of several comparison
regression tests changed because, obviously, some impacted member
functions are now reported along with detecting changes in data
membrers of classes.  The patch thus adjusts those reference ouputs.

The patch also adjust the behaviour of the predicate:
  "accessed_through = pointer|reference|reference-or-pointer"
The idea is to make the predicate work on qualified version of a type.

	* include/abg-ir.h (function_type::get_first_parm): Declare new
	accessor.
	* src/abg-ir.cc (function_type::get_first_parm): Define new
	accessor.
	(equals): In the overload for function_type,
	always take the implicit "this" parameter into account in
	parameter comparisons.
	(function_type::get_first_non_implicit_parm): Adjust comment.
	* src/abg-comp-filter.cc (function_name_changed_but_not_symbol):
	Avoid potential NULL pointer dereferencing.
	* src/abg-comparison.cc
	(function_type_diff::ensure_lookup_tables_populated): Always take
	the changes to the implicit 'this' parameter into account in the
	function type diff.
	(compute_diff): In the overload for function_type, Always compare
	the implicit 'this' parameter when comparing function parameters.
	* src/abg-default-reporter.cc (default_reporter::report): Refer to
	"implicit parameter" when reporting changes on parameters
	artificially generated by the compiler.
	* src/abg-suppression.cc (type_suppression::suppresses_diff): Make
	the 'access_through' predicate work on a qualified version of type
	'S', even if it was meant to work on type 'S'.  This allows it to
	work on 'const S', especially when S is accessed through 'pointer
	to const S', which happens when we consider the implicit 'this'
	parameter of a const member function.
	* tests/data/test-abicompat/test5-fn-changed-report-0.txt: Adjust.
	* tests/data/test-abicompat/test5-fn-changed-report-1.txt: Likewise.
	* tests/data/test-abidiff-exit/test1-voffset-change-report0.txt:
	Likewise.
	* tests/data/test-abidiff/test-PR18791-report0.txt: Likewise.
	* tests/data/test-abidiff/test-struct1-report.txt: Likewise.
	* tests/data/test-diff-dwarf-abixml/test0-pr19026-libvtkIOSQL-6.1.so.1-report-0.txt:
	Likewise.
	* tests/data/test-diff-dwarf/test0-report.txt: Likewise.
	* tests/data/test-diff-dwarf/test28-vtable-changes-report-0.txt: Likewise.
	* tests/data/test-diff-dwarf/test29-vtable-changes-report-0.txt: Likewise.
	* tests/data/test-diff-dwarf/test30-vtable-changes-report-0.txt: Likewise.
	* tests/data/test-diff-dwarf/test31-vtable-changes-report-0.txt: Likewise.
	* tests/data/test-diff-dwarf/test36-ppc64-aliases-report-0.txt: Likewise.
	* tests/data/test-diff-dwarf/test41-PR20476-hidden-report-0.txt: Likewise.
	* tests/data/test-diff-dwarf/test42-PR21296-clanggcc-report0.txt: Likewise.
	* tests/data/test-diff-dwarf/test5-report.txt: Likewise.
	* tests/data/test-diff-dwarf/test8-report.txt: Likewise.
	* tests/data/test-diff-filter/test0-report.txt: Likewise.
	* tests/data/test-diff-filter/test01-report.txt: Likewise.
	* tests/data/test-diff-filter/test10-report.txt: Likewise.
	* tests/data/test-diff-filter/test13-report.txt: Likewise.
	* tests/data/test-diff-filter/test2-report.txt: Likewise.
	* tests/data/test-diff-filter/test28-redundant-and-filtered-children-nodes-report-0.txt:
	Likewise.
	* tests/data/test-diff-filter/test28-redundant-and-filtered-children-nodes-report-1.txt:
	Likewise.
	* tests/data/test-diff-filter/test30-pr18904-rvalueref-report0.txt:
	Likewise.
	* tests/data/test-diff-filter/test30-pr18904-rvalueref-report1.txt:
	Likewise.
	* tests/data/test-diff-filter/test30-pr18904-rvalueref-report2.txt:
	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-diff-filter/test35-pr18754-no-added-syms-report-0.txt:
	Likewise.
	* tests/data/test-diff-filter/test35-pr18754-no-added-syms-report-1.txt:
	Likewise.
	* tests/data/test-diff-filter/test4-report.txt: Likewise.
	* tests/data/test-diff-filter/test41-report-0.txt: Likewise.
	* tests/data/test-diff-filter/test9-report.txt: Likewise.
	* tests/data/test-diff-pkg/libsigc++-2.0-0c2a_2.4.0-1_amd64--libsigc++-2.0-0v5_2.4.1-1ubuntu2_amd64-report-0.txt:
	Likewise.
	* tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-0.txt:
	Likewise.
	* tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-1.txt:
	Likewise.
	* tests/data/test-diff-suppr/test24-soname-report-0.txt: Likewise.
	* tests/data/test-diff-suppr/test24-soname-report-1.txt: Likewise.
	* tests/data/test-diff-suppr/test24-soname-report-10.txt: Likewise.
	* tests/data/test-diff-suppr/test24-soname-report-11.txt: Likewise.
	* tests/data/test-diff-suppr/test24-soname-report-12.txt: Likewise.
	* tests/data/test-diff-suppr/test24-soname-report-13.txt: Likewise.
	* tests/data/test-diff-suppr/test24-soname-report-14.txt: Likewise.
	* tests/data/test-diff-suppr/test24-soname-report-15.txt: Likewise.
	* tests/data/test-diff-suppr/test24-soname-report-16.txt: Likewise.
	* tests/data/test-diff-suppr/test24-soname-report-2.txt: Likewise.
	* tests/data/test-diff-suppr/test24-soname-report-3.txt: Likewise.
	* tests/data/test-diff-suppr/test24-soname-report-4.txt: Likewise.
	* tests/data/test-diff-suppr/test24-soname-report-5.txt: Likewise.
	* tests/data/test-diff-suppr/test24-soname-report-6.txt: Likewise.
	* tests/data/test-diff-suppr/test24-soname-report-7.txt: Likewise.
	* tests/data/test-diff-suppr/test24-soname-report-8.txt: Likewise.
	* tests/data/test-diff-suppr/test24-soname-report-9.txt: Likewise.
	* tests/data/test-diff-suppr/test31-report-1.txt: Likewise.
	* tests/data/test-diff-suppr/test33-report-0.txt: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2020-10-09 11:05:23 +02:00
Giuliano Procida
b96040e5b3 Fix two wrongs in test suppression regex
The suppression specification in test38-char-class-in-ini.abignore was
introduced in commit 1478d9cc1c.

Unfortunately it contains two errors. One causes the file name not to
match as the string is the full path, not the base name. The other is
a typo that causes the file name match not to even be attempted. The
two mistakes cancel in the test, but result in a suppression
specification that is broader than intended.

	* tests/data/test-diff-suppr/test38-char-class-in-ini.abignore:
	Don't anchor regex match to beginning of file name.
	Change "filename_regexp" to "file_name_regexp".

Signed-off-by: Giuliano Procida <gprocida@google.com>
2020-10-01 16:42:27 +02:00
Giuliano Procida
1ab36e02e5 Add missing newlines to end of test files.
Various test files were missing terminal newlines.

	* tests/data/test-diff-suppr/test0-type-suppr-2.suppr: Add
	final new line.
	* tests/data/test-diff-suppr/test22-suppr-removed-var-sym-4.suppr:
	Likewise.
	* tests/data/test-diff-suppr/test23-alias-filter-0.suppr:
	Likewise.
	* tests/data/test-diff-suppr/test23-alias-filter-4.suppr:
	Likewise.
	* tests/data/test-diff-suppr/test28-add-aliased-function-1.suppr:
	Likewise.
	* tests/data/test-diff-suppr/test28-add-aliased-function-2.suppr:
	Likewise.
	* tests/data/test-diff-suppr/test28-add-aliased-function-3.suppr:
	Likewise.
	* tests/data/test-diff-suppr/test28-add-aliased-function-4.suppr:
	Likewise.
	* tests/data/test-diff-suppr/test41-enumerator-changes-0.suppr:
	Likewise.
	* tests/data/test-diff-suppr/test7-var-suppr-7.suppr:
	Likewise.
	* tests/data/test-ini/test01-equal-in-property-string.abignore:
	Likewise.

Signed-off-by: Giuliano Procida <gprocida@google.com>
2020-10-01 16:11:29 +02:00