platform/upstream/libabigail.git
5 years agoUpdate NEWS file for 1.5
Dodji Seketeli [Thu, 25 Oct 2018 12:17:24 +0000 (14:17 +0200)]
Update NEWS file for 1.5

* NEWS: Update for 1.5

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
5 years agoBug rhbz1638554 - assertion failed in is_mostly_distinct_diff
Dodji Seketeli [Thu, 18 Oct 2018 13:52:12 +0000 (15:52 +0200)]
Bug rhbz1638554 - assertion failed in is_mostly_distinct_diff

* src/abg-comp-filter.cc (is_mostly_distinct_diff): Handle the
case of the type diff of the function parameter diff being a
distinct diff.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
5 years agoDefine UINT64_MAX when it's not defined
Dodji Seketeli [Wed, 17 Oct 2018 08:41:35 +0000 (10:41 +0200)]
Define UINT64_MAX when it's not defined

It looks like GCC 4.4.x does not define UINT64_MAX so define it for
those platforms.

* src/abg-dwarf-reader.cc: Define UINT64_MAX when it's not defined.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
5 years agoBetter support array with unknown upper bound
Dodji Seketeli [Tue, 16 Oct 2018 08:59:37 +0000 (10:59 +0200)]
Better support array with unknown upper bound

It can happen that arrays are described in DWARF with an unknown upper
bound.  In those cases, if the array is the type of a global variable,
the ELF object corresponding to that global variable should have a
size.  It's that ELF object size that should be taken into account
when comparing versions of that global variable and its type.

This patch fixes issues in the detection and representation of array
subranges with unknown size so that we behave like presented above.

* include/abg-comparison.h
(BENIGN_INFINITE_ARRAY_CHANGE_CATEGORY): A new enumerator in the
diff_category enum.
(EVERYTHING_CATEGORY): Adjust.
* src/abg-comparison.cc (get_default_harmless_categories_bitmap):
Adjust.
(operator<<(ostream& o, diff_category)): Likewise.
* include/abg-ir.h (array_type_def::subrange_type::is_infinite):
Declare new member function.
* src/abg-ir.cc (array_type_def::subrange_type::priv::infinite_):
New data member.
(array_type_def::subrange_type::priv::priv): Initialize it.
(array_type_def::subrange_type::get_length): Better support
unknown sized subrange.
(array_type_def::subrange_type::is_infinite): Define new member
function.
* src/abg-comp-filter.cc (has_benign_infinite_array_change):
Define new static function.
(categorize_harmless_diff_node): Use the new
has_benign_infinite_array_change above.
* src/abg-dwarf-reader.cc (build_subrange_type): Better recognize a
subrange type with unknown upper bound.  Represent that with the
new array_type_def::subrange_type::is_infinite member property.
* src/abg-reader.cc (build_subrange_type): Likewise.
* tests/data/test-abidiff/test-PR18166-libtirpc.so.abi: Adjust.
* tests/data/test-annotate/libtest23.so.abi: Likewise.
* 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/test14-pr18893.so.abi: Likewise.
* tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi:
Likewise.
* tests/data/test-annotate/test7.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/test10-pr18818-gcc.so.abi: Likewise.
* tests/data/test-read-dwarf/test11-pr18828.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/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>
6 years agoAdd default suppression specification for the libvirt project
Dodji Seketeli [Thu, 11 Oct 2018 08:59:54 +0000 (10:59 +0200)]
Add default suppression specification for the libvirt project

* default.abignore: Suppress changes on functions with symbol
version LIBVIRT_PRIVATE in libvirt.so.* shared objects.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoAdd default suppression specification for the krb5 project
Dodji Seketeli [Thu, 11 Oct 2018 08:53:45 +0000 (10:53 +0200)]
Add default suppression specification for the krb5 project

* default.abignore: Ignore changes about functions starting with
krb5int_.*.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoMisc comment fix
Dodji Seketeli [Wed, 3 Oct 2018 09:43:19 +0000 (11:43 +0200)]
Misc comment fix

* src/abg-suppression.cc (type_suppression::suppresses_diff): Fix
comment.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoBug 23708 - categorize void* to pointer change as harmless
Dodji Seketeli [Wed, 3 Oct 2018 09:24:42 +0000 (11:24 +0200)]
Bug 23708 - categorize void* to pointer change as harmless

Changing a void* pointer into another pointer of the same size is a
change that is harmless in terms of data layout.

This commit thus categorizes such a change as harmless.

* include/abg-comparison.h (VOID_PTR_TO_PTR_CHANGE_CATEGORY): New
enumerator in the diff_category enum.  Also, adjust the
EVERYTHING_CATEGORY enumerator.
* include/abg-fwd.h (is_void_pointer_type): Declare new function.
* src/abg-comp-filter.cc (has_void_ptr_to_ptr_change): Define new
static function and ...
(categorize_harmless_diff_node): ... use it here.
* src/abg-comparison.cc (get_default_harmless_categories_bitmap):
Add the new abigail::comparison::VOID_PTR_TO_PTR_CHANGE_CATEGORY
category in here.
(operator<<(ostream& o, diff_category c)): Add support for the new
VOID_PTR_TO_PTR_CHANGE_CATEGORY.
* src/abg-ir.cc (is_void_pointer_type): Define new function.
* tests/data/Makefile.am: Add the new test material below to source distribution.
* tests/data/test-diff-filter/test47-filter-void-ptr-change-report-0.txt:
New test reference output.
* tests/data/test-diff-filter/test47-filter-void-ptr-change-v{0,1}.c:
Source code of the new binary test input below.
* tests/data/test-diff-filter/test47-filter-void-ptr-change-v{0,1}.o:
New binary test input.
* tests/test-diff-filter.cc: Add the test input/output above to
test harness.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoCategorize CV qualifier changes on fn return types as harmless
Dodji Seketeli [Tue, 2 Oct 2018 11:49:55 +0000 (13:49 +0200)]
Categorize CV qualifier changes on fn return types as harmless

This partially fixes PR23700.

A change in the CV qualifiers of a function return value type should
be categorized as harmless.  And this is what this patch does.

* include/abg-comparison.h (FN_RETURN_TYPE_CV_CHANGE_CATEGORY):
New enumerator for diff_category.
(EVERYTHING_CATEGORY): Update.
* src/abg-comp-filter.cc (type_diff_has_cv_qual_change_only):
Factorize this function out of ...
(has_fn_parm_type_cv_qual_change): ... this one.
(has_fn_return_type_cv_qual_change): Define new static function.
(categorize_harmless_diff_node): Use the new
has_fn_return_type_cv_qual_change.
* src/abg-comparison.cc (get_default_harmless_categories_bitmap):
Adjust to add the new FN_RETURN_TYPE_CV_CHANGE_CATEGORY category.
(operator<<(ostream& o, diff_category c)): Support the new
FN_RETURN_TYPE_CV_CHANGE_CATEGORY.
* tests/data/Makefile.am: Add the new test material below to
source distribution.
* tests/data/test-diff-filter/test46-fn-return-qual-change-report-0.txt:
New reference output for the new input test.
* tests/data/test-diff-filter/test46-fn-return-qual-change-v{0,1}.c:
New source code for the new binary test input.
* tests/data/test-diff-filter/test46-fn-return-qual-change-v{0,1}.o:
New binary test input files.
* tests/test-diff-filter.cc: Add the new test input above to test
harness.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoFix propagation of private type suppression category
Dodji Seketeli [Mon, 1 Oct 2018 14:14:50 +0000 (16:14 +0200)]
Fix propagation of private type suppression category

This is a partial fix of PR23700.

Conceptually, there are two kinds of type suppression specifications:

1/ a generic user-provided suppression specification that is meant to
suppress changes on types specified by the user

2/ a private type suppression specification that is automatically
generated from the path to public header files provided by the user.

Technically, one difference between 1 and 2 lays in the way we
propagate categories of changes matched by those suppression
specifications.

If a class type change of category SUPPRESSED_CATEGORY is referenced
in a typedef change, then the typedef change is also considered to be
of category SUPPRESSED_CATEGORY.  In other words, the
SUPPRESSED_CATEGORY category is propagated to the typedef change.
That means that if a change to a class type is suppressed, a (changed)
typedef to that class is considered to be suppressed too.

But then that is not true if the class type was changed because it's
private.  In that, a typedef to that class can be *public*, because
the said typedef is defined in a public header.  In that case the
typedef change should *NOT* be considered suppressed just because the
class type change was suppressed.

The problem we have here is that we don't make any difference between
1/ and 2/.  So we need to introduce different propagation rules for 1/
and 2/.

So this patch introduces a new PRIVATE_TYPE_CATEGORY category for
types suppression specification that are automatically generated for
private types.  That new category has its own propagation rule which
is basically "no propagation"; every type must be matched by the
private type suppression specification to be considered as private.

* include/abg-comp-filter.h (has_harmful_name_change): Declare new
function overloads.
* include/abg-comparison.h (PRIVATE_TYPE_CATEGORY): New enumerator
for diff_category;
(EVERYTHING_CATEGORY): Adjust this enumerator in diff_category;
(is_suppressed): Take an output parameter to say if the
suppression is a private type suppression.
* include/abg-suppression.h (is_private_type_suppr_spec): Take a
const reference parameter and add an overload for a shared
pointer.
* src/abg-comp-filter.cc (has_harmful_name_change): Define new
function.
* src/abg-comparison-priv.h (diff::priv::is_filtered_out): Diffs
of category PRIVATE_TYPE_CATEGORY are also considered filtered
out.
* src/abg-comparison.cc (diff::is_filtered_out): Adjust to account
for canonical diffs of category PRIVATE_TYPE_CATEGORY.
(diff::is_suppressed): Add an overload that takes a
is_private_type output parameter.  Re-write the old overload in
terms of the new one.
(operator<<(ostream& o, diff_category c)): Handle
PRIVATE_TYPE_CATEGORY.
(category_propagation_visitor::visit_end):  Do not propagate
PRIVATE_TYPE_CATEGORY here. Do not propagate
HARMLESS_DECL_NAME_CHANGE_CATEGORY either, when the class does
have a harmful decl name change.
(suppression_categorization_visitor::visit_begin): Set the new
PRIVATE_TYPE_CATEGORY category but do not propagate it.
(suppression_categorization_visitor::visit_end): Add some
comments.
* src/abg-default-reporter.cc (default_reporter::report): Avoid
reporting typedef underlying types that are in the
PRIVATE_TYPE_CATEGORY category.
* src/abg-suppression.cc (type_suppression::suppresses_diff): Do
not peel typedefs if we are a private type suppression.
(is_private_type_suppr_spec): Take a const reference.
* tests/data/Makefile.am: Add the new test material below to
source distribution.
* tests/test-diff-suppr.cc: Use new test binary input.
* tests/data/test-diff-filter/test7-report.txt: Adjust.
* tests/data/test-diff-suppr/test39-opaque-type-report-0.txt: New
test reference output.
* tests/data/test-diff-suppr/test39-opaque-type-v{0,1}.c: Source
code of new test binary input.
* tests/data/test-diff-suppr/test39-opaque-type-v{0,1}.o: New test
binary input.
* tests/data/test-diff-suppr/test39-public-headers-dir/test39-header-v{0,1}.h:
Source code of new test binary input.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoPR23641 - confusion when a type definition DIE is matched by a supprspec and its...
Dodji Seketeli [Tue, 25 Sep 2018 10:17:52 +0000 (12:17 +0200)]
PR23641 - confusion when a type definition DIE is matched by a supprspec and its decl DIEs aren't

This is a followup of the patch with commit hash 90b4e76.

It turns out that in some cases, when we see a suppressed private
class definition, we haven't *previously* seen any declaration-only
instance of it.  So we cannot use any pre-existing declaration-only
instance as an opaque type for the private type that is suppressed.

In that case, this patch creates (and uses) a declaration-only
instance for the suppressed private type definition.

* src/abg-dwarf-reader.cc (get_opaque_version_of_type): If no
pre-existing opaque version was found, a new one is created and
returned.  Take a needed "where_offset" parameter.
(build_ir_node_from_die): Adjust the call to
get_opaque_version_of_type.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoPR23641 - Type definition DIE matched by a supprspec but not its decl
Dodji Seketeli [Fri, 21 Sep 2018 12:33:19 +0000 (14:33 +0200)]
PR23641 - Type definition DIE matched by a supprspec but not its decl

Suppose we have two versions of a library which are almost identical.
Suppose the difference between the two binaries is a slight difference of
ordering in how the linker put together what the DWARF describes.

Then, while processing the debug info of the first library, libabigail
first comes across the forward declaration of a type T.  Suppose that
declaration is not matched by any private type suppression
specification.  Libabigail is going to keep the declaration of T and
build an internal representation (IR) for it.  It's also going to
build an IR for types and decls using T like "T*" or "T* var".

Now suppose that while processing the debug info of the second
library, libabigail first comes across the *definition* of T --
because in this second library, that definition comes first.  Suppose
that the definition is matched by a private type suppression
specification, unlike the declaration in the first library.  In this
case, T is going to be dropped, and no IR is going to be built for it.
If other types or decl like 'T*' or 'T *var" refer to this
*definition* of T, they will be dropped too.

We'll end up with those two libraries that are identical (modulo the
order in which libabigail sees type declarations and their
definitions) and are considered different when a suppression
specification makes us drop T: the second library appears to
libabigail as if T was removed from it.

This is the problem addressed by this patch.

When the definition of a type T is suppressed because it's considered
private then we look if there was a forward declaration for it
elsewhere, that is not matched by the private type suppression
specification.  If we encountered such a type declaration then it
means that declaration is in effect an "opaque" version of T.  So
rather than just dropping T altogether, we keep (and build an IR) for
its opaque version only.  And we drop the definition of T.

This seems to fix the issue.

I can't seem to reproduce the slight re-ordering of DIEs descriptions that
uncover the issue so I'll rely on integration tests to catch future
regressions on this issue, rather than on unit tests.  Sigh.

* include/abg-tools-utils.h (PRIVATE_TYPES_SUPPR_SPEC_NAME):
Remove this extern constant definition.
* src/abg-dwarf-reader.cc (type_is_suppressed): Add an overload
that takes an additional type_is_private output parameter.
(get_opaque_version_of_type): New static function.
(build_ir_node_from_die): For class types, get the opaque version
for suppressed private types rather than dropping them altogether.
* src/abg-reader.cc (type_is_suppressed): Adjust.
* src/abg-suppression-priv.h (type_is_suppressed): Add an overload
that takes a type_is_private output parameter.
* include/abg-suppression.h (get_private_types_suppr_spec_label)
(is_private_type_suppr_spec): Declare new functions.
* src/abg-suppression.cc
(get_private_types_suppr_spec_label, is_private_type_suppr_spec):
Define new functions.
(suppression_matches_type_name_or_location): Use the new
get_private_types_suppr_spec_label rather than a global extern
variable.
* src/abg-tools-utils.cc (handle_fts_entry): Adjust to use the new
get_private_types_suppr_spec_label.
(gen_suppr_spec_from_headers): Handle the case or an empty headers
root dir.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoAdd option to avoid walking abigail::ir nodes twice
Dodji Seketeli [Mon, 3 Sep 2018 09:10:25 +0000 (11:10 +0200)]
Add option to avoid walking abigail::ir nodes twice

When the ir_traversable_base::traverse() walks the IR graph, it
happens that it can visit a type node that was already visited before.
For instance, it visits the 'struct S' once and later, as part of its
visit of struct S*, it can visit struct S again.

There are use cases where we want the walker to avoid visiting a given
type node again.  This patch adds the option to do so.

Basically the ir_node_visitor class can now be configured to tell the
walker to avoid re-visiting a node.

The test-ir-walker.cc example is amended to avoid re-visiting type nodes
as well.

* include/abg-ir.h (struct ir_node_visitor): Make this be a class.
Add a private data member to it, following the 'pimpl' idiom.
(ir_node_visitor::{allow_visiting_already_visited_type_node,
mark_type_node_as_visited, forget_visited_type_nodes,
type_node_has_been_visited}): Declare new member functions.
* src/abg-ir.cc ({type_base, type_decl, scope_type_decl,
qualified_type_decl, pointer_type_def, reference_type_def,
array_type_def, enum_type_decl, typedef_decl, class_or_union,
class_decl, union_decl}::traverse): Avoid re-visiting the type
node if the visitor was configured as such.
(struct ir_node_visitor::priv): Define new struct.
(ir_node_visitor::{allow_visiting_already_visited_type_node,
mark_type_node_as_visited, forget_visited_type_nodes,
type_node_has_been_visited}): Define new member functions.
* tests/test-ir-walker.cc
(name_printing_visitor::name_printing_visitor): Avoid visiting a
type node twice.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoFix apidoc of dwarf_reader::get_soname_of_elf_file
Dodji Seketeli [Fri, 31 Aug 2018 07:31:41 +0000 (09:31 +0200)]
Fix apidoc of dwarf_reader::get_soname_of_elf_file

It turned out the first parameter of
abigail::dwarf_reader::get_soname_of_elf_file was not documented.
Fixed thus.

* src/abg-dwarf-reader.cc (get_soname_of_elf_file): Document the
first parameter.  Remove bogus documentation of the previous 'elf'
parameter.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoBug 23533 - Accept '=' in ini property values
Dodji Seketeli [Thu, 30 Aug 2018 08:54:33 +0000 (10:54 +0200)]
Bug 23533 - Accept '=' in ini property values

It appears that it's not possible to write a suppression specification
like the below at the moment:

  [suppress_file]
  label = Libabigail can't handle libgfortran.so (https://sourceware.org/bugzilla/show_bug.cgi?id=23492)
  file_name_regexp = libgfortran\\.so.*

This is because the ini parser won't accept the '=' character in the
URL as a valid character for ini property values.

So the entire [suppress_file] section is ignored by the suppression
specification engine.

This patch fixes that by making the equal character valid in property
values.

* src/abg-ini.cc (char_is_delimiter): Take a new include_equal
flag to control is the equal character should be considered as a
delimiter or not.
(char_is_property_value_char): Accept the equal character as a
valid property value character.
* tests/Makefile.am: Build a new runtestini test from the new
tests/test-ini.cc source file.
* tests/data/Makefile.am: Add the two new test inputs below to
source distribution.
* tests/data/test-ini/test01-equal-in-property-string.{abignore,
abignore.expected}: New test inputs.
* tests/test-ini.cc: New test harness.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoMake test-ir-walker work on ELF binaries directly
Dodji Seketeli [Mon, 6 Aug 2018 08:28:06 +0000 (10:28 +0200)]
Make test-ir-walker work on ELF binaries directly

The tests/test-ir-walker.cc example was working on abixml files
resulting from abidw.  This commit changes that to make it work on
ELF input files directly.  The commit also adds some comments to make
it easier to understand the concepts.

* test-ir-walker.cc (main): Load an ABI corpus from an elf file
and walk its translation units.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoAllow use of python even when fedabipkgdiff is disabled
Dodji Seketeli [Tue, 17 Jul 2018 10:11:02 +0000 (12:11 +0200)]
Allow use of python even when fedabipkgdiff is disabled

It turns out that when we disable fedabipkgdiff, we also disable
detection of python and the setting of the proper environment
variables that are expected by some makefiles down the road.  The
leads to the runtestdefaultsupprs.py test to be blocked at runtime
because the environement variable PYTHON is not defined.  This patch
fixes that.

* configure.ac: Detect the presence and version of python even
when fedabipkgdiff is disabled.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoBump version number to 1.5
Dodji Seketeli [Mon, 16 Jul 2018 07:33:28 +0000 (09:33 +0200)]
Bump version number to 1.5

* configure.ac: Bump version number to 1.5

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoUpdate ChangeLog for 1.4 release libabigail-1.4
Dodji Seketeli [Fri, 13 Jul 2018 14:06:58 +0000 (16:06 +0200)]
Update ChangeLog for 1.4 release

* ChangeLog: Update this using make update-changelog

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoUpdate NEWS file for 1.4 release
Dodji Seketeli [Fri, 13 Jul 2018 14:04:49 +0000 (16:04 +0200)]
Update NEWS file for 1.4 release

* NEWS: Added 1.4 entries

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoProperly add test materials for test-diff-suppr/test38-char-class-in-ini*
Dodji Seketeli [Fri, 13 Jul 2018 08:13:09 +0000 (10:13 +0200)]
Properly add test materials for test-diff-suppr/test38-char-class-in-ini*

While adding test materials for
test-diff-suppr/test38-char-class-in-ini* to source distribution, I
got the paths wrong.  Fixing thus.

* tests/data/Makefile.am: Add proper path for
test-diff-suppr/test38-char-class-in-ini*.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoAllow square brackets in ini property values
Dodji Seketeli [Thu, 12 Jul 2018 11:47:08 +0000 (13:47 +0200)]
Allow square brackets in ini property values

Sometimes, one wants to be able to write suppression specifications
like:

    [suppress_function]
     filename_regexp = ^test38-char-class-in-ini-v[[:digit:]].*
     symbol_name_regexp = bar
     change_kind = added-function

without having to escape the square brackets in the regexp.  Normally,
one has to escape the '[' and the ']' because these characters are
used to define ini section names (e.g, [suppress_function]).

This patch allows the presence of the square bracket characters in a
property value, making the suppression specification above valid.

* src/abg-ini.cc (char_is_delimiter): Possibly disallow square
bracket characters into the set of delimiters.
* tests/data/test-diff-suppr/test38-char-class-in-ini-report-0.txt:
New reference output.
* tests/data/test-diff-suppr/test38-char-class-in-ini-v{0,1}.c:
Source code new test binaries.
* tests/data/test-diff-suppr/test38-char-class-in-ini-v{0,1}.o:
New test binaries.
* tests/data/test-diff-suppr/test38-char-class-in-ini.abignore:
New test abi suppression file.
* tests/data/Makefile.am: Add the new test materials above to
source distribution.
* tests/test-diff-suppr.cc: Add the test materials above to the
set of tests to run.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoFix race between runtestdefaultsupprs{py3.sh,.py}
Dodji Seketeli [Tue, 10 Jul 2018 12:08:19 +0000 (14:08 +0200)]
Fix race between runtestdefaultsupprs{py3.sh,.py}

runtestdefaultsupprspy3.sh just runs runtestdefaultsupprs.py using
python3.  So when both run in parallel, it can happen that they step
on their toes as they emit content into some files.

This patch commits makes it so that runtestdefaultsupprspy3.sh is
executed only if we are in the python3 mode, otherwise we just run
runtestdefaultsupprs.py, fixing the occasional failure that we see on
either runtestdefaultsupprs.py or runtestdefaultsupprspy3.sh.

* tests/Makefile.am: Run runtestdefaultsupprspy3.sh if we are in
python3 mode otherwise run runtestdefaultsupprs.py.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoEnsure die_function_type_is_method_type returns a class type die
Dodji Seketeli [Fri, 29 Jun 2018 10:32:02 +0000 (12:32 +0200)]
Ensure die_function_type_is_method_type returns a class type die

When die_function_type_is_method returns true, it meanins that the
function die it's looking at is a member function.  In that case,
die_function_type_is_method must also return the class of which the
function is a member.  It appears that there are cases where this
die_function_type_is_method returns a *typedef* DIE (to a class DIE),
rather than a class DIE.

This results in the assertion violation below when loading the file
/usr/lib/libreoffice/program/libanalysislo.so from, e.g, the
libreoffice-calc-5.3.6.1-10.el7.i686 package:

    /home/dodji/git/libabigail/master/src/abg-dwarf-reader.cc:13846: abigail::ir::function_type_sptr abigail::dwarf_reader::build_function_type(abigail::dwarf_reader::read_context&, Dwarf_Die*, abigail::ir::class_or_union_sptr, size_t): Assertion `klass_type' failed.

This patch fixes that by peeling off the potential typedefs that might
be there.

* src/abg-dwarf-reader.cc (die_peel_typedef): Define new static
function.
(die_function_type_is_method_type): Use the function above to peel
the class die from potential typedefs wrapping it.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoMisc style adjustements
Dodji Seketeli [Thu, 28 Jun 2018 10:58:28 +0000 (12:58 +0200)]
Misc style adjustements

* include/abg-suppression.h
(function_suppression::ADDED_FUNCTION_CHANGE_KIND): Fix the
comment of this enumerator.
(suppresses_variable): Cleanup parameter name.
* src/abg-comparison.cc: Remove useless horizontal space.
* src/abg-suppression.cc
(variable_suppression::suppresses_variable): Fix typo.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoInitial basic support of union type in suppression specifications
Dodji Seketeli [Thu, 28 Jun 2018 10:56:02 +0000 (12:56 +0200)]
Initial basic support of union type in suppression specifications

* src/abg-suppression.cc (suppression_matches_type_no_name):
Support union types.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoFilter out changes like type to const type
Dodji Seketeli [Thu, 28 Jun 2018 10:33:13 +0000 (12:33 +0200)]
Filter out changes like type to const type

For too long now changes to parameter types like "const char*" to
"char*" have been reported by libabigail by default.  Those are not
really meaningful ABI changes, at least not in C.  This patch makes
filters out those changes by default.

* include/abg-comparison.h (FN_PARM_TYPE_CV_CHANGE_CATEGORY): Add
this new enumerator to the diff_category enum.  Also, OR this to
the value of the EVERYTHING_CATEGORY enumerator.
* src/abg-comp-filter.cc (has_fn_parm_type_top_cv_qual_change):
Rename has_fn_parm_type_cv_qual_change into this.
(has_fn_parm_type_cv_qual_change): New function.
(categorize_harmless_diff_node): Categorize cv qual changes as
being of category FN_PARM_TYPE_CV_CHANGE_CATEGORY.
* src/abg-comparison.cc (get_default_harmless_categories_bitmap):
Add FN_PARM_TYPE_CV_CHANGE_CATEGORY to the default harmless
categories.
* 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.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoFix redundancy detection through fn ptr and typedef paths
Dodji Seketeli [Thu, 28 Jun 2018 08:11:18 +0000 (10:11 +0200)]
Fix redundancy detection through fn ptr and typedef paths

When analyzing the libfreetype.so binary, it appears that
libabigail's diff node redundancy marking pass is failing to detect a
redundant diff node in cases were the node is recursively referencing
itself through a path that involves function type and typedef diff
nodes.

So it is only at reporting time that we'd detect that the node is
redundant so we emit messages like "this change was reported
earlier".  But When the earlier change in question is suppressed due
to, e.g, a suppression specification resulting from the user providing
abidiff with the --headers-dir{1,2} command line option, then the
change report becomes confusing, at best.

The right behaviour is to detect the node is redundant and mark it as
such, so that the reporting pass can avoid reporting it altogether.

This is what this patch does.

This patch changes the output of the runtestdiffpkg regression test.
To update the reference output, we need an additional patch to handle
a separate (but somewhat related) issue.  That is going to be done in
the subsequent commit which title is:

    "Filter out changes like type to const type"

* include/abg-comparison.h
(is_function_type_diff_with_local_changes)
(is_reference_or_pointer_diff_to_non_basic_distinct_types)
(peel_typedef_diff): Declare new functions.
* src/abg-comparison.cc
(is_function_type_diff_with_local_changes)
(is_reference_or_ptr_diff_to_non_basic_nor_distinct_types)
(peel_typedef_diff): Define new functions.
(is_reference_or_pointer_diff): Peel typedefs before operating.
(redundancy_marking_visitor::visit_begin): Only sibbling parameter
diff node that carry basic type changes (or distinct type changes)
are *not* marked as redundant.  All other kinds of sibbling
parameter diff nodes are markes redundant.  Also, rather than
never marking function type diffs as redundant by fear of missing
local changes on these, just avoid marking function type diff
nodes with local changes.  It's possible to be that precise now
that we can detect that a diff node carries local changes.
* tests/data/test-diff-suppr/test37-opaque-type-v{0,1}.o: New
binary tests input.
* tests/data/test-diff-suppr/test37-opaque-type-v{0,1}.c: Source
code of the binary tests input above.
* tests/data/test-diff-suppr/test37-opaque-type-header-dir/test37-opaque-type-header-v{0,1}.h:
Headers of the binary tests input above.
* tests/data/test-diff-suppr/test37-opaque-type-report-0.txt:
Reference output for this new test.
* 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>
6 years agoFix indentation of help string in abipkgdiff
Dodji Seketeli [Fri, 8 Jun 2018 03:08:59 +0000 (05:08 +0200)]
Fix indentation of help string in abipkgdiff

* tools/abipkgdiff.cc (display_usage): Fix indentation of help
string.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoIdentify a function using its symbol name and version
Dodji Seketeli [Fri, 8 Jun 2018 02:40:07 +0000 (04:40 +0200)]
Identify a function using its symbol name and version

When a function symbol S has several versions and several different
functions with different names have those different versions of S as
underlying symbols, libabigail could mistakenly take one function for
another.  This is because there are cases where libabigail identifies
the function using its symbol name without taking the version name
into account.

This patch fixes that.

* src/abg-default-reporter.cc (default_reporter::report): In C,
tell the user about the underlying function symbol name only if
said symbol name is different from the name of the function.
* src/abg-ir.cc (function_decl::get_id): If the function has an
underlying symbol, use the symbol name and version as the function
ID.  But if the function symbol has an alias then use the linkage
name as the ID.
* tests/data/test-diff-pkg/elfutils-debuginfo-0.170-4.el7.x86_64.rpm:
New binary test input.
* tests/data/test-diff-pkg/elfutils-debuginfo-0.171-1.el7.x86_64.rpm: Likewise.
* tests/data/test-diff-pkg/elfutils-devel-0.170-4.el7.x86_64.rpm: Likewise.
* tests/data/test-diff-pkg/elfutils-devel-0.171-1.el7.x86_64.rpm: Likewise.
* tests/data/test-diff-pkg/elfutils-libs-0.170-4.el7.x86_64.rpm: Likewise.
* tests/data/test-diff-pkg/elfutils-libs-0.171-1.el7.x86_64.rpm: Likewise.
* tests/data/test-diff-pkg/elfutils-libs-0.170-4.el7.x86_64-multiple-sym-vers-report-0.txt:
New reference test output.
* tests/data/Makefile.am: Add the new test material above to
source distribution.
* tests/test-diff-pkg.cc (in_out_specs): Integrate the new test
inputs above into the harness.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoBump version to 1.4
Dodji Seketeli [Wed, 6 Jun 2018 12:02:27 +0000 (14:02 +0200)]
Bump version to 1.4

* configure.ac: Bump version to 1.4

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoExplicitely detect anonymous data member changes
Dodji Seketeli [Wed, 6 Jun 2018 10:05:10 +0000 (12:05 +0200)]
Explicitely detect anonymous data member changes

This patch detects when a data member becomes anonymous or when an
anonymous data member becomes non anonymous and emits an explicit
message.

* include/abg-comp-filter.h (has_anonymous_data_member_change):
Add new function declaration.
* include/abg-fwd.h (is_data_member, is_anonymous_data_member):
declare new overloads.
* src/abg-comp-filter.cc (has_anonymous_data_member_change):
Define new overloads.
* src/abg-ir.cc (is_data_member, is_anonymous_data_member): Define
new overloads.
* src/abg-reporter-priv.cc (represent): In the var_diff overload,
detect when we have anonymous data member changes and emit
explicit error messages then.
* tests/data/test-diff-dwarf/test45-anon-dm-change-report-0.txt:
New test material.
* tests/data/test-diff-dwarf/test45-anon-dm-change-v0.cc: Likewise.
* tests/data/test-diff-dwarf/test45-anon-dm-change-v0.o: Likewise.
* tests/data/test-diff-dwarf/test45-anon-dm-change-v1.cc: Likewise.
* tests/data/test-diff-dwarf/test45-anon-dm-change-v1.o: Likewise.
* tests/data/Makefile.am: Add the new test material above to source
distribution.
* tests/test-diff-dwarf.cc (in_out_specs): Add the new test
material above to the test harness.
* tests/data/test-diff-filter/test30-pr18904-rvalueref-report0.txt: Adjust.
* 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.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoAdd test44-anon-struct-union-v{0,1}.o to source distribution
Dodji Seketeli [Tue, 5 Jun 2018 11:49:37 +0000 (13:49 +0200)]
Add test44-anon-struct-union-v{0,1}.o to source distribution

In the previous commit, I forgot to add the files
test-diff-dwarf/test44-anon-struct-union-v{0,1}.o to source
distribution.  This commit fixes that.

* tests/data/Makefile.am: Add
test-diff-dwarf/test44-anon-struct-union-v{0,1}.o files to source
distribution.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoUse the flat representation for anonymous struct/unions
Dodji Seketeli [Mon, 4 Jun 2018 15:17:27 +0000 (17:17 +0200)]
Use the flat representation for anonymous struct/unions

When referring to an anonymous struct or union, libabigail used to
name it __anonymous_struct__ or __anonymous_union__.

Now, with this patch, libabigail rather uses the flat representation
of the struct/union, e.g, struct {int foo; char bar;}.

* src/abg-ir.cc (get_class_or_union_flat_representation): Take a
const class_or_union* (like what the declaration in the header
file says), rather than just a class_or_union*.
({class,union}_decl::get_pretty_representation): For anonymous
classes and unions, use the flat representation.
* 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/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-diff-dwarf/test43-PR22913-report-0.txt: Likewise.
* tests/data/test-diff-dwarf/test44-anon-struct-union-report-0.txt:
New test reference output.
* tests/data/test-diff-dwarf/test44-anon-struct-union-v{0,1}.cc:
Source code of new test binary outputs.
* tests/data/test-diff-dwarf/test44-anon-struct-union-v{0,1}.o:
New test binary outputs.
* tests/data/Makefile.am: Add the new test materials above to
source districution.
* tests/test-diff-dwarf.cc (in_out_specs): Add the new test
material above to the test harness here.
* tests/data/test-diff-filter/test30-pr18904-rvalueref-report0.txt: Adjust.
* 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-diff-pkg/libcdio-0.94-1.fc26.x86_64--libcdio-0.94-2.fc26.x86_64-report.1.txt: Likewise.
* tests/data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-2.txt: Likewise.
* tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoBetter detect when pointer and qualified types carry local changes
Dodji Seketeli [Fri, 1 Jun 2018 12:49:46 +0000 (14:49 +0200)]
Better detect when pointer and qualified types carry local changes

This is a fixup of the previous commit entitled:

    "Better detect when diff nodes only carry local type changes"

In that previous commit, I missed some things about pointer, reference
and qualified types, as far as local changes detection and management
is concerned.

This commit handles those points.

* src/abg-comparison.cc
(leaf_diff_node_marker_visitor::visit_begin): Do not mark
qualified types as leaf diff nodes.
(redundancy_marking_visitor::visit_end): Changes to qualified type
are never considered local.  This is just as for pointer and
reference types.
* src/abg-default-reporter.cc
(default_reporter::report_local_reference_type_changes): Display
structural changes of the pointed-to type.
(default_reporter::report): In the overload for reference_diff,
better detect and handle when we have local changes, or not.
* src/abg-ir.cc (equals): In the overload for qualified_type_def
and reference_type_de, report local type changes of the underlying
type as local changes.  Add comments in the overload for pointer
type, and make it look like the the overload for reference_type.
* src/abg-leaf-reporter.cc (leaf_reporter::report): In the
overload for pointer_diff, remove end of line.
* tests/data/test-diff-filter/libtest45-basic-type-change-report-1.txt: Adjust.
* 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.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoBetter detect when diff nodes only carry local type changes
Dodji Seketeli [Wed, 23 May 2018 09:43:29 +0000 (11:43 +0200)]
Better detect when diff nodes only carry local type changes

For some fine grain redundancy filtering, we need to know when a diff
node carries *only* a basic type change.  This is because basic type
changes should not be marked as redundant; we want to see all of them
-- unlike for class or union (user defined) type changes.

And so to know if a diff node carries only a basic type change, we
need to know if a diff node only carries a local type change.  If it
carries only a type change, we can safely just look at that type
change and see if it's a basic type change or not.

So, we then need to know what kind of local changes a diff node
carries: type change or non-type change.  That way, we can analyze the
local changes a node carries and infer that it only carries a local
type change or if it also carries a non-type change.

This patch thus changes the diff::has_local_changes() pure virtual member
function to make it return the enum change_kind bitmask, which
describes the different kinds of local changes the diff node has.

Note that two new bit values were added to that enum:
LOCAL_TYPE_CHANGE_KIND and LOCAL_NON_TYPE_CHANGE_KIND.  The first one
says that the diff node carries a local type change, while the second
one says that the diff node carries a local non-type change kind.

The various implementations of that interface are thus amended to make
them return the right bitmask.  To do this, the patch updates the
various 'equals' overloads to make them return the proper enum
change_kind bitmap with the LOCAL_TYPE_CHANGE_KIND and
LOCAL_NON_TYPE_CHANGE_KIND set, if need be.

* include/abg-comparison.h ({diff, type_diff_base, decl_diff_base,
distinct_diff, var_diff, pointer_diff, reference_diff, array_diff,
qualified_type, enum_diff, class_or_union_diff, class_diff,
base_diff, scope_diff, fn_parm_diff, function_type_diff,
function_decl_diff, typedef_diff,
translation_unit_diff}::has_local_changes): Return an enum
change_kind, rather than just a bool.
(is_diff_of_basic_type): Declare an overload that takes a boolean
flag.
(is_qualified_type_diff, peel_pointer_diff, peel_reference_diff)
(peel_qualified_type, peel_pointer_or_qualified_type): Declare new
functions
* include/abg-fwd.h (peel_qualified_type):
* include/abg-ir.h (enum change_kind::{LOCAL_TYPE_CHANGE_KIND,
LOCAL_NON_TYPE_CHANGE_KIND, ALL_LOCAL_CHANGES_MASK}): Add these
three new enumerators.
* src/abg-comparison.cc ({distinct_diff, var_diff, pointer_diff,
array_diff, reference_diff, qualified_type_diff, enum_diff,
class_or_union_diff, class_diff, base_diff, scope_diff,
fn_parm_diff, function_type_diff, function_decl_diff,
type_decl_diff, typedef_diff,
translation_unit_diff}::has_local_changes): Adjust to return an
enum change_kind, rather than just a bool.
(has_local_type_change_only): Define new functions.
(has_basic_type_change_only): Use the new
has_local_type_change_only function and the new overload for
is_diff_of_basic_type.
(is_diff_of_basic_type): Define an overload that takes a boolean
flag.
(is_qualified_type_diff, peel_pointer_diff, peel_reference_diff)
(peel_qualified_type, peel_pointer_or_qualified_type): Define new
functions.
* src/abg-ir.cc (equals): In the overloads for decl_base,
scope_decl, type_base, qualified_type_diff, pointer_type_def,
reference_type_def, array_type_def, enum_type_decl, typedef_decl,
var_decl, function_type, function_decl, function_decl::parameter,
class_or_union, class_decl::base_spec and class_decl, properly set
the new abigail::ir::{LOCAL_CHANGE_KIND,
LOCAL_NON_TYPE_CHANGE_KIND, LOCAL_TYPE_CHANGE_KIND} bits.
(types_have_similar_structure): Peel qualified types and typedefs
off, first thing.
(peel_qualified_or_typedef_type): Define new function.
* 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/libtest45-basic-type-change-report-{0,1}.txt:
New reference test reports.
* tests/data/test-diff-filter/libtest45-basic-type-change-v{0,1}.so:
New input test binaries.
* tests/data/test-diff-filter/test45-basic-type-change-v{0,1}.cc:
Source code of the input test binaries above.
* tests/data/Makefile.am: Add the new test file above to source
distribution.
* tests/test-diff-filter.cc: Add the test input above to the test
harness.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoImprove detection of local *type* changes
Dodji Seketeli [Fri, 18 May 2018 08:18:45 +0000 (10:18 +0200)]
Improve detection of local *type* changes

For variables and data member, we are quite gross in the way we detect
a local type change.  Basically, if a textual representation of the
variable (and thus of its type) changes, then we consider that the
variable has a local (possibly type) change.

This leads us to (wrongly) report changes like this:

'struct S1 at test-44-anonymous-data-member-v0.c:1:1' changed:
  type size hasn't changed
  there are data member changes:
   anonymous data member at offset 32 (in bits) changed from:
     union {int b; float c;}
   to:
     union {int b; float c; char e;}

Here, you see that the textual representation of the anonymous data
member (of union type) changed from:

    union {int b; float c;}
to:
    union {int b; float c; char e;}

You see that although the textual representation of the type changed,
the *structure* of the type hasn't really changed.  I am using the
"vague" term structure, on purpose.  Here, in the case of a union, the
structure hasn't change because the size of the union hasn't changed.

This patch thus introduces the concept of "similarity of type
structures".  That is, even if two types are different, if "their
structure is similar", then the type change is not a local type
change.

More precisely, here is what we mean by type similarity:

    Two indirect types (pointers, references) have similar structure
    if their underlying types are of the same kind and have the same
    name.  In this indirect types case, the size of the underlying
    type does not matter.

    Two direct types (i.e, non indirect) have a similar structure if
    they have the same kind, name and size.  Two class types have
    similar structure if they have the same name, size, and if their
    data members have similar types.

This patch then uses that similarity concept to detect local type
changes.

* include/abg-fwd.h (is_type_decl): Declare new overload for
type_base*.
(types_have_similar_structure): Declare new function.
* src/abg-comparison.cc
(class_or_union_diff::priv::count_filtered_changed_dm): Even when
looking at local changes only, do not forget to count nodes that
were filtered out.
* src/abg-ir.cc (types_have_similar_structure): Define new
function.
(is_type_decl): Define new overload for
type_base*.
(is_enum_type):
(equals): In the overload for var_decl, use the new
types_have_similar_structure function to detect local (type)
changes.
* src/abg-reporter-priv.cc (represent): In the overload for
var_decl, use the diff::has_local_changes function to detect local
changes, now that we can better detect local changes.
* tests/data/test-diff-filter/test44-anonymous-data-member-report-1.txt:
Adjust.
* tests/data/test-diff-suppr/test36-leaf-report-0.txt: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoRemove references, arrays and fn parms from leaf diff nodes
Dodji Seketeli [Wed, 16 May 2018 07:30:31 +0000 (09:30 +0200)]
Remove references, arrays and fn parms from leaf diff nodes

It doesn't make sense to report about I leaf diff nodes that are
either references, arrays of function parameters.  It makes more sense
to have these be reported as part of their containing diff nodes.

This patch fixes that.

* src/abg-comparison.cc
(leaf_diff_node_marker_visitor::visit_begin): Do not mark
references, array and fn parms diff nodes as leaf nodes.
* 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.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoFix typo in tests/runtestdefaultsupprs.py
Dodji Seketeli [Wed, 23 May 2018 15:58:08 +0000 (17:58 +0200)]
Fix typo in tests/runtestdefaultsupprs.py

* tests/runtestdefaultsupprs.py.in: Fix typo.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoUpdate ChangeLog libabigail-1.3
Dodji Seketeli [Thu, 17 May 2018 08:51:26 +0000 (10:51 +0200)]
Update ChangeLog

* ChangeLog: Update this file automatically by running the "make
update-changelog" command.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoUpdate NEWS file for 1.3 release
Dodji Seketeli [Thu, 17 May 2018 08:38:09 +0000 (10:38 +0200)]
Update NEWS file for 1.3 release

* NEWS: Update for 1.3.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoDon't bail because "rpm" issued an error
Dodji Seketeli [Wed, 16 May 2018 15:52:17 +0000 (17:52 +0200)]
Don't bail because "rpm" issued an error

It turns out that the "rpm -qp --provides <rpm>" can issue an error on
el6 (on the RPMs that we feed it) and still provide us with the output
we want.  So we shouldn't just fail in that case.

This patch handles that case.

* src/abg-tools-utils.cc (get_dsos_provided_by_rpm): Do not fail
when the rpm command issues an error.  Rather rely on the presence
of a valid output or not.  Also, make sure to filter out error
outputs so that they don't appear in the general output of tools
using this function.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoHandle cases where no python2 interpreter is found
Dodji Seketeli [Wed, 16 May 2018 12:28:08 +0000 (14:28 +0200)]
Handle cases where no python2 interpreter is found

If no python2 interpreter is found and only a python3 one is found,
then use that one rather than just bailing.

* configure.ac: When no python2 is found and only python3 is
found, then use python3.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoUse the correct python interpreter in runtestdefaultsupprs.py
Dodji Seketeli [Wed, 16 May 2018 12:24:31 +0000 (14:24 +0200)]
Use the correct python interpreter in runtestdefaultsupprs.py

* configure.ac: Make the PYTHON environemnt variable usable in
auto-generated files.
* tests/runtestdefaultsupprs.py.in: Use the python interpreter
detected by configure.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoUse the dynamically selected python for Koji configure tests
Dodji Seketeli [Wed, 16 May 2018 06:59:26 +0000 (08:59 +0200)]
Use the dynamically selected python for Koji configure tests

When doing the Koji version tests at configure time, use the version
of the python interpreter that was selected by configure, not the one
first (randomly) found in the current PATH.

* configure.ac: Use the python interpreter that was selected by
the configure script for the Koji version test.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoSort the output of the leaf reporter
Dodji Seketeli [Mon, 14 May 2018 08:02:56 +0000 (10:02 +0200)]
Sort the output of the leaf reporter

It turned out we were not sorting the output of the leaf report.  This
patch fixes that.

* include/abg-comparison.h (diff_ptrs_type): Define new typedef.
* src/abg-comparison-priv.h (sort_string_diff_ptr_map): Declare
new function.
* src/abg-comparison.cc (sort_string_diff_sptr_map): Update
comment.
(sort_string_diff_ptr_map): Define new function.
* src/abg-leaf-reporter.cc (report_diffs): Sort the diff nodes
before reporting about them.
* tests/data/test-diff-suppr/test36-leaf-report-0.txt: Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoShow data member offsets in bytes too
Dodji Seketeli [Mon, 14 May 2018 05:04:54 +0000 (07:04 +0200)]
Show data member offsets in bytes too

I forgot to express data members in bytes (if the user wants it) when
the feature got initially baked.  This patch fixes it.

* src/abg-reporter-priv.cc (represent): In the overload for
var_diff_sptr, use the function show_offset_or_size, rather than
emit_num_value.
* tests/data/test-diff-filter/test31-pr18535-libstdc++-report-0.txt: Adjust.
* tests/data/test-diff-filter/test31-pr18535-libstdc++-report-1.txt: Adjust.
* tests/data/test-diff-filter/test44-anonymous-data-member-report-0.txt: Adjust.
* tests/data/test-diff-filter/test44-anonymous-data-member-report-1.txt: Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoInitial support of anonymous data members
Dodji Seketeli [Wed, 9 May 2018 06:51:50 +0000 (08:51 +0200)]
Initial support of anonymous data members

An anonymous data member is a data member of a struct or a union which
has no name.  The type of such data member is either a struct or a
union.  For instance:

    struct foo {
      int a;
      struct { // <-- this is an anonymous data member
char a;
char b;
      };
      int c;
    };

In DWARF (as emitted by GCC at least), an anonymous data member is
represented as a data member with an empty name.  Libabigail sees it
just fine, but then when representing *changes* to that kind of data
member, it needs special treatment, otherwise users cannot make sense
of the reports.

This patch adds initial support to represent changes to anonymous data
members.

* include/abg-comparison.h (is_class_or_union_diff)
(is_anonymous_class_or_union_diff): Declare new functions.
* include/abg-fwd.h (is_class_type): Declare new overload for
type_or_decl_base&.
(is_data_member): Declare new overload for decl_base*.
(is_anonymous_data_member)
(anonymous_data_member_to_class_or_union)
(get_class_or_union_flat_representation)
(data_member_has_anonymous_type): Declare new functions.
(is_at_class_scope): Return the class or union scope.
* include/abg-ir.h (var_decl::get_qualified_name): New virtual
data member which overloads decl_base::get_qualified_name.
* src/abg-comparison.cc (is_class_or_union_diff)
(is_anonymous_class_or_union_diff): Define new functions
(leaf_diff_node_marker_visitor::visit_begin): Don't mark anonymous
class or union diff nodes as diff nodes.
* src/abg-ir.cc (is_data_member): Define new overload for
decl_base*.
(is_class_type, is_union_type): Define new overload for type_or_decl_base&.
(is_anonymous_data_member)
(anonymous_data_member_to_class_or_union)
(get_class_or_union_flat_representation)
(data_member_has_anonymous_type): Define new function overloads.
(var_decl::get_qualified_name): Define new virtual member
function.
(is_at_class_scope): Return the class or union scope.
(var_decl::get_pretty_representation): Support anonymous data
members.
(equals): In the overload for class_or_union_diff, mark data
member textual representation changes as local changes.
* src/abg-reporter-priv.cc (represent): In the overload for
var_diff, support changes to anonymous data members.
* src/abg-leaf-reporter.cc (leaf_reporter::report): Report sorted
-- by offset -- data member changes before the ones that are
sorted by other things.
* tests/data/test-diff-filter/libtest44-anonymous-data-member-v{0,1}.so:
New binary test input
* tests/data/test-diff-filter/test44-anonymous-data-member-report-{0,1}.txt:
New reference test outputs.
* tests/data/test-diff-filter/test44-anonymous-data-member-v{0,1}.c:
Source code of the new binary test output above.
* tests/data/Makefile.am: Add the new test files above to the
source distribution.
* tests/data/test-annotate/libtest23.so.abi: Adjust test reference
output.
* 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/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-diff-dwarf/test43-PR22913-report-0.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-pkg/libcdio-0.94-1.fc26.x86_64--libcdio-0.94-2.fc26.x86_64-report.1.txt: Likewise.
* tests/data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-2.txt: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoRepresent sizes and offsets in bytes and hexadecimal values
Dodji Seketeli [Fri, 20 Apr 2018 15:31:35 +0000 (17:31 +0200)]
Represent sizes and offsets in bytes and hexadecimal values

In current change reports, sizes and offsets are represented in bits,
and as decimal values.  Some users prefer having those offsets be in
bytes and as hexadecimal values.

This commits adds 4 new options to let users see sizes and offsets be
represented either in bits, bytes, decimal or hexadecimal values.

* doc/manuals/abidiff.rst: Add documentation for the new
--show-bits, --show-bytes, --show-hex and --show-dec options.
* doc/manuals/abipkgdiff.rst: Likewise.
* doc/manuals/kmidiff.rst: Likewise.
* include/abg-comparison.h (diff_context::{show_hex_values,
show_offsets_sizes_in_bits}): Declare new member functions.
* src/abg-comparison-priv.h (diff_context::priv::{hex_values_,
show_offsets_sizes_in_bits_}): Declare new data members.
(diff_context::priv::priv): Initialize them.
* src/abg-comparison.cc (diff_context::{show_hex_values,
show_offsets_sizes_in_bits}): Define new member functions.
* src/abg-default-reporter.cc (default_reporter::report): Adjust
the call to maybe_report_diff_for_symbol.
* src/abg-leaf-reporter.cc (leaf_reporter::report): Likewise.
* src/abg-reporter-priv.h (convert_bits_to_bytes)
(maybe_convert_bits_to_bytes, emit_num_value, show_offset_or_size)
(show_numerical_change): Declare new functions.
(maybe_report_diff_for_symbol): Take a diff_context in parameter.
* src/abg-reporter-priv.cc (convert_bits_to_bytes, emit_num_value)
(maybe_convert_bits_to_bytes, show_numerical_change)
(show_offset_or_size): Define new functions.
(represent): In the overload for method_decl, var_decl, use the
new emit_num_value function.
(represent_data_member): Use the new show_offset_or_size function.
(maybe_show_relative_offset_change): Use the new
convert_bits_to_bytes, diff_context::show_offsets_sizes_in_bits,
emit_num_value functions.
(maybe_show_relative_offset_change): Likewise.
(report_size_and_alignment_changes): Use the new emit_num_value
and show_numerical_change functions.
(maybe_report_diff_for_symbol): Tak a diff_context in argument.
Use the new show_numerical_change function.
* tests/test-diff-filter.cc (in_out_spec): Add a new entry to test
hexa and bytes output.
* tools/abidiff.cc (options::{show_hexadecimal_values,
show_offsets_sizes_in_bits}): New data members.
(options::options): Initialize them.
(display_usage): New help strings for the new
--show{bytes,bits,hex,dec} options.
(parse_command_line): Parse the new --show{bytes,bits,hex,dec} options.
(set_diff_context_from_opts) Set the diff context wrt hex and
bytes values.
* tools/abipkgdiff.cc (options::{show_hexadecimal_values,
show_offsets_sizes_in_bits}): New data members.
(options::options): Initialize them.
(display_usage): New help strings for the new
--show{bytes,bits,hex,dec} options.
(set_diff_context_from_opts): Set the diff context wrt hex and
bytes values.
(parse_command_line): Parse the new --show{bytes,bits,hex,dec}
options.
* tools/kmidiff.cc (options::{show_hexadecimal_values,
show_offsets_sizes_in_bits}): New data members.
(options::options): Initialize them.
(display_usage):New help strings for the new
--show{bytes,bits,hex,dec} options.
(parse_command_line): Parse the new --show{bytes,bits,hex,dec}
options.
(set_diff_context): Set the diff context wrt hex and bytes values.
* tests/data/test-diff-filter/test30-pr18904-rvalueref-report2.txt:
New reference test output.
* tests/data/Makefile.am: Add the new reference test output above
to source distribution.
* tests/data/test-abicompat/test0-fn-changed-report-0.txt: Adjust.
* tests/data/test-abicompat/test0-fn-changed-report-2.txt: Likewise.
* tests/data/test-abicompat/test5-fn-changed-report-0.txt: Likewise.
* tests/data/test-abicompat/test5-fn-changed-report-1.txt: Likewise.
* tests/data/test-abicompat/test6-var-changed-report-0.txt: Likewise.
* tests/data/test-abicompat/test6-var-changed-report-1.txt: Likewise.
* tests/data/test-abicompat/test7-fn-changed-report-0.txt: Likewise.
* tests/data/test-abicompat/test7-fn-changed-report-1.txt: Likewise.
* tests/data/test-abicompat/test7-fn-changed-report-2.txt: Likewise.
* tests/data/test-abicompat/test8-fn-changed-report-0.txt: Likewise.
* tests/data/test-abicompat/test9-fn-changed-report-0.txt: Likewise.
* tests/data/test-abidiff/test-PR18791-report0.txt: Likewise.
* tests/data/test-abidiff/test-qual-type0-report.txt: Likewise.
* tests/data/test-abidiff/test-struct0-report.txt: Likewise.
* tests/data/test-abidiff/test-struct1-report.txt: Likewise.
* tests/data/test-abidiff/test-var0-report.txt: Likewise.
* tests/data/test-diff-dwarf/test0-report.txt: Likewise.
* tests/data/test-diff-dwarf/test1-report.txt: Likewise.
* tests/data/test-diff-dwarf/test10-report.txt: Likewise.
* tests/data/test-diff-dwarf/test11-report.txt: Likewise.
* tests/data/test-diff-dwarf/test13-report.txt: Likewise.
* tests/data/test-diff-dwarf/test21-redundant-fn-report-0.txt: Likewise.
* tests/data/test-diff-dwarf/test22-changed-parm-c-report-0.txt: Likewise.
* tests/data/test-diff-dwarf/test26-added-parms-before-variadic-report.txt: Likewise.
* tests/data/test-diff-dwarf/test27-local-base-diff-report.txt: Likewise.
* tests/data/test-diff-dwarf/test3-report.txt: Likewise.
* tests/data/test-diff-dwarf/test32-fnptr-changes-report-0.txt: Likewise.
* tests/data/test-diff-dwarf/test33-fnref-changes-report-0.txt: Likewise.
* tests/data/test-diff-dwarf/test34-pr19173-libfoo-report-0.txt: Likewise.
* tests/data/test-diff-dwarf/test35-pr19173-libfoo-long-clang-report-0.txt: Likewise.
* tests/data/test-diff-dwarf/test35-pr19173-libfoo-long-gcc-report-0.txt: Likewise.
* tests/data/test-diff-dwarf/test36-ppc64-aliases-report-0.txt: Likewise.
* tests/data/test-diff-dwarf/test37-union-report-0.txt: Likewise.
* tests/data/test-diff-dwarf/test39-union-report-0.txt: Likewise.
* tests/data/test-diff-dwarf/test40-report-0.txt: Likewise.
* tests/data/test-diff-dwarf/test43-PR22913-report-0.txt: Likewise.
* tests/data/test-diff-dwarf/test8-report.txt: Likewise.
* tests/data/test-diff-dwarf/test9-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/test1-report.txt: Likewise.
* tests/data/test-diff-filter/test10-report.txt: Likewise.
* tests/data/test-diff-filter/test11-report.txt: Likewise.
* tests/data/test-diff-filter/test13-report.txt: Likewise.
* tests/data/test-diff-filter/test14-0-report.txt: Likewise.
* tests/data/test-diff-filter/test14-1-report.txt: Likewise.
* tests/data/test-diff-filter/test15-0-report.txt: Likewise.
* tests/data/test-diff-filter/test15-1-report.txt: Likewise.
* tests/data/test-diff-filter/test16-report-2.txt: Likewise.
* tests/data/test-diff-filter/test16-report.txt: Likewise.
* tests/data/test-diff-filter/test17-0-report.txt: Likewise.
* tests/data/test-diff-filter/test17-1-report.txt: Likewise.
* tests/data/test-diff-filter/test2-report.txt: Likewise.
* tests/data/test-diff-filter/test27-redundant-and-filtered-children-nodes-report-0.txt: Likewise.
* tests/data/test-diff-filter/test27-redundant-and-filtered-children-nodes-report-1.txt: Likewise.
* tests/data/test-diff-filter/test27-redundant-and-filtered-children-nodes-report-2.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/test29-finer-redundancy-marking-report-0.txt: Likewise.
* tests/data/test-diff-filter/test3-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/test31-pr18535-libstdc++-report-0.txt: Likewise.
* tests/data/test-diff-filter/test31-pr18535-libstdc++-report-1.txt: Likewise.
* tests/data/test-diff-filter/test32-ppc64le-struct-change-report0.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/test37-report-0.txt: Likewise.
* tests/data/test-diff-filter/test39/test39-report-0.txt: Likewise.
* tests/data/test-diff-filter/test42-leaf-report-output-0.txt: Likewise.
* tests/data/test-diff-filter/test6-report.txt: Likewise.
* tests/data/test-diff-filter/test9-report.txt: Likewise.
* tests/data/test-diff-pkg/dirpkg-1-report-1.txt: Likewise.
* tests/data/test-diff-pkg/dirpkg-3-report-1.txt: Likewise.
* tests/data/test-diff-pkg/dirpkg-3-report-2.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/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/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-2.txt: Likewise.
* tests/data/test-diff-pkg/symlink-dir-test1-report0.txt: Likewise.
* tests/data/test-diff-pkg/tarpkg-0-report-0.txt: Likewise.
* tests/data/test-diff-pkg/tarpkg-1-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/test0-type-suppr-report-0.txt: Likewise.
* tests/data/test-diff-suppr/test0-type-suppr-report-3.txt: Likewise.
* tests/data/test-diff-suppr/test0-type-suppr-report-5.txt: Likewise.
* tests/data/test-diff-suppr/test0-type-suppr-report-7.txt: Likewise.
* tests/data/test-diff-suppr/test1-typedef-suppr-report-0.txt: Likewise.
* tests/data/test-diff-suppr/test1-typedef-suppr-report-2.txt: Likewise.
* tests/data/test-diff-suppr/test11-add-data-member-report-0.txt: Likewise.
* tests/data/test-diff-suppr/test12-add-data-member-report-0.txt: Likewise.
* tests/data/test-diff-suppr/test12-add-data-member-report-2.txt: Likewise.
* tests/data/test-diff-suppr/test13-suppr-through-pointer-report-0.txt: Likewise.
* tests/data/test-diff-suppr/test13-suppr-through-pointer-report-1.txt: Likewise.
* tests/data/test-diff-suppr/test14-suppr-non-redundant-report-0.txt: Likewise.
* tests/data/test-diff-suppr/test14-suppr-non-redundant-report-1.txt: Likewise.
* tests/data/test-diff-suppr/test15-suppr-added-fn-report-0.txt: Likewise.
* tests/data/test-diff-suppr/test15-suppr-added-fn-report-1.txt: Likewise.
* tests/data/test-diff-suppr/test15-suppr-added-fn-report-5.txt: Likewise.
* tests/data/test-diff-suppr/test16-suppr-removed-fn-report-0.txt: Likewise.
* tests/data/test-diff-suppr/test16-suppr-removed-fn-report-2.txt: Likewise.
* tests/data/test-diff-suppr/test17-suppr-added-var-report-0.txt: Likewise.
* tests/data/test-diff-suppr/test17-suppr-added-var-report-2.txt: Likewise.
* tests/data/test-diff-suppr/test17-suppr-added-var-report-5.txt: Likewise.
* tests/data/test-diff-suppr/test18-suppr-removed-var-report-0.txt: Likewise.
* tests/data/test-diff-suppr/test18-suppr-removed-var-report-2.txt: Likewise.
* tests/data/test-diff-suppr/test18-suppr-removed-var-report-5.txt: Likewise.
* tests/data/test-diff-suppr/test2-struct-suppr-report-0.txt: Likewise.
* tests/data/test-diff-suppr/test23-alias-filter-report-0.txt: Likewise.
* tests/data/test-diff-suppr/test23-alias-filter-report-2.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/test25-typedef-report-0.txt: Likewise.
* tests/data/test-diff-suppr/test26-loc-suppr-report-0.txt: Likewise.
* tests/data/test-diff-suppr/test26-loc-suppr-report-3.txt: Likewise.
* tests/data/test-diff-suppr/test29-soname-report-3.txt: Likewise.
* tests/data/test-diff-suppr/test29-soname-report-6.txt: Likewise.
* tests/data/test-diff-suppr/test29-soname-report-8.txt: Likewise.
* tests/data/test-diff-suppr/test3-struct-suppr-report-0.txt: Likewise.
* tests/data/test-diff-suppr/test3-struct-suppr-report-1.txt: Likewise.
* tests/data/test-diff-suppr/test3-struct-suppr-report-2.txt: Likewise.
* tests/data/test-diff-suppr/test30-report-0.txt: Likewise.
* tests/data/test-diff-suppr/test31-report-1.txt: Likewise.
* tests/data/test-diff-suppr/test32-report-0.txt: Likewise.
* tests/data/test-diff-suppr/test32-report-1.txt: Likewise.
* tests/data/test-diff-suppr/test33-report-0.txt: Likewise.
* tests/data/test-diff-suppr/test35-leaf-report-0.txt: Likewise.
* tests/data/test-diff-suppr/test36-leaf-report-0.txt: Likewise.
* tests/data/test-diff-suppr/test4-local-suppr-report-0.txt: Likewise.
* tests/data/test-diff-suppr/test4-local-suppr-report-1.txt: Likewise.
* tests/data/test-diff-suppr/test5-fn-suppr-report-0.txt: Likewise.
* tests/data/test-diff-suppr/test5-fn-suppr-report-1.txt: Likewise.
* tests/data/test-diff-suppr/test5-fn-suppr-report-2.txt: Likewise.
* tests/data/test-diff-suppr/test5-fn-suppr-report-3.txt: Likewise.
* tests/data/test-diff-suppr/test5-fn-suppr-report-4.txt: Likewise.
* tests/data/test-diff-suppr/test5-fn-suppr-report-5.txt: Likewise.
* tests/data/test-diff-suppr/test6-fn-suppr-report-0-1.txt: Likewise.
* tests/data/test-diff-suppr/test6-fn-suppr-report-0.txt: Likewise.
* tests/data/test-diff-suppr/test6-fn-suppr-report-1.txt: Likewise.
* tests/data/test-diff-suppr/test6-fn-suppr-report-2.txt: Likewise.
* tests/data/test-diff-suppr/test6-fn-suppr-report-3.txt: Likewise.
* tests/data/test-diff-suppr/test7-var-suppr-report-0.txt: Likewise.
* tests/data/test-diff-suppr/test7-var-suppr-report-1.txt: Likewise.
* tests/data/test-diff-suppr/test7-var-suppr-report-2.txt: Likewise.
* tests/data/test-diff-suppr/test7-var-suppr-report-3.txt: Likewise.
* tests/data/test-diff-suppr/test7-var-suppr-report-4.txt: Likewise.
* tests/data/test-diff-suppr/test7-var-suppr-report-7.txt: Likewise.
* tests/data/test-diff-suppr/test7-var-suppr-report-8.txt: Likewise.
* tests/data/test-diff-suppr/test8-redundant-fn-report-0.txt: Likewise.
* tests/data/test-diff-suppr/test8-redundant-fn-report-1.txt: Likewise.
* tests/data/test-diff-suppr/test9-changed-parm-c-report-0.txt: Likewise.
* tests/data/test-diff-suppr/test9-changed-parm-c-report-1.txt: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoUse absolute builddir paths in automake test files
Dodji Seketeli [Wed, 18 Apr 2018 08:18:58 +0000 (10:18 +0200)]
Use absolute builddir paths in automake test files

When switching to a more recent automake version on EL7, I realized
that @top_builddir@ wasn't being resolved to an absolute path anymore,
leading to errors when tests/runtestdefaultsupprs.py wasn't being run
in the "right" directory.  This is annoying.

So this patches uses the absolute build path, explicitely.

* tests/runtestdefaultsupprs.py.in: Use abs_top_builddir rather
than top_builddir.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoUse std::string::substr instead of appending single chars
Jonathan Wakely [Tue, 10 Apr 2018 14:22:59 +0000 (15:22 +0100)]
Use std::string::substr instead of appending single chars

* src/abg-ini.cc (trim_white_space): Use std::string::substr
instead of appending single chars.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoRename misleading remove_trailing_white_spaces functions
Jonathan Wakely [Tue, 10 Apr 2018 14:22:58 +0000 (15:22 +0100)]
Rename misleading remove_trailing_white_spaces functions

Trailing implies only whitespace at the end is removed, but these
functions also remove leading whitespace.

* include/abg-tools-utils.h (trim_white_space): Renamed
remove_trailing_white_spaces into this.
* src/abg-ini.cc (trim_white_space): Likewise.
* src/abg-tools-utils.cc (get_dsos_provided_by_rpm): Adjust.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoRemove unused local set<string> variables
Jonathan Wakely [Tue, 10 Apr 2018 14:22:57 +0000 (15:22 +0100)]
Remove unused local set<string> variables

* src/abg-tools-utils.cc (get_dsos_provided_by_rpm): Remove unsed
set<string> variable.
* tools/abipkgdiff.cc (maybe_create_public_dso_sonames_set):
Likewise.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoRemove assertion with side-effects
Jonathan Wakely [Tue, 10 Apr 2018 14:22:56 +0000 (15:22 +0100)]
Remove assertion with side-effects

Calling assert(split_string(...)) won't do anything when NDEBUG is
defined, but the split_string call can be avoided anyway.

Since only the first result from the split string is needed, and
remove_trailing_white_spaces will trim white space anyway, the overhead
of parsing it into a vector can be avoided by using std::string::substr
directly. Additionally, calling std::string::find with a single char is
more efficient than with a string.

* src/abg-tools-utils.cc (get_dsos_provided_by_rpm): Fix
std::string::sbustr and remove assert with side effect.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoMisc style changes
Dodji Seketeli [Fri, 13 Apr 2018 08:39:14 +0000 (10:39 +0200)]
Misc style changes

* src/abg-comparison.cc (category_propagation_visitor): Adjust comment.
* src/abg-default-reporter.cc
(default_reporter::report_local_function_type_changes): Remove
useless new line.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoUpdate tests for the "better leaf mode redundancy management" patchset
Dodji Seketeli [Fri, 13 Apr 2018 08:45:42 +0000 (10:45 +0200)]
Update tests for the "better leaf mode redundancy management" patchset

This commit is the last of the set whose commit titles are:

    Do not show decl-only-to-def changes in the leaf reporter
    Overhaul of the report diff stats summary
    Do not mark "distinct" diff nodes as being redundant
    Fix meaning of "harmless name change" to avoid overfiltering
    Better handle category propagation of pointer changes
    Improve function changes reporting in leaf and default mode
    Don't filter out typedef changes with redundant underlying type changes
    Only show leaf type changes in the leaf type changes section
    Fix leaf report of class data member changes
    Always show redundant changes in leaf mode
    Avoid reporting an enum change if it has already been reported
    When we say an a change was reported earlier give its source location
    [abipkgdiff]: in leaf mode we always show redundant changes
    Update tests for the "better leaf mode redundancy management" patchset

This commit updates the tests reference output files for that
patchset.

* tests/data/test-abidiff-exit/test1-voffset-change-report1.txt: Adjust.
* tests/data/test-abidiff/test-PR18791-report0.txt: Likewise.
* tests/data/test-abidiff/test-enum0-report.txt: Likewise.
* tests/data/test-abidiff/test-enum1-report.txt: Likewise.
* tests/data/test-diff-filter/test1-report.txt: Likewise.
* tests/data/test-diff-filter/test14-0-report.txt: Likewise.
* tests/data/test-diff-filter/test15-0-report.txt: Likewise.
* tests/data/test-diff-filter/test17-0-report.txt: Likewise.
* tests/data/test-diff-filter/test27-redundant-and-filtered-children-nodes-report-0.txt: Likewise.
* tests/data/test-diff-filter/test28-redundant-and-filtered-children-nodes-report-0.txt: Likewise.
* tests/data/test-diff-filter/test3-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/test32-ppc64le-struct-change-report0.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/test42-leaf-report-output-0.txt: Likewise.
* tests/data/test-diff-pkg/dirpkg-3-report-1.txt: Likewise.
* tests/data/test-diff-pkg/dirpkg-3-report-2.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/libcdio-0.94-1.fc26.x86_64--libcdio-0.94-2.fc26.x86_64-report.1.txt: Likewise.
* tests/data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-0.txt: Likewise.
* tests/data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-1.txt: Likewise.
* tests/data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-2.txt: Likewise.
* tests/data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-3.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-suppr/test1-typedef-suppr-report-1.txt: Likewise.
* tests/data/test-diff-suppr/test1-typedef-suppr-report-2.txt: Likewise.
* tests/data/test-diff-suppr/test13-suppr-through-pointer-report-1.txt: Likewise.
* tests/data/test-diff-suppr/test14-suppr-non-redundant-report-0.txt: Likewise.
* tests/data/test-diff-suppr/test14-suppr-non-redundant-report-1.txt: Likewise.
* tests/data/test-diff-suppr/test15-suppr-added-fn-report-1.txt: Likewise.
* tests/data/test-diff-suppr/test15-suppr-added-fn-report-2.txt: Likewise.
* tests/data/test-diff-suppr/test15-suppr-added-fn-report-3.txt: Likewise.
* tests/data/test-diff-suppr/test15-suppr-added-fn-report-4.txt: Likewise.
* tests/data/test-diff-suppr/test16-suppr-removed-fn-report-1.txt: Likewise.
* tests/data/test-diff-suppr/test16-suppr-removed-fn-report-2.txt: Likewise.
* tests/data/test-diff-suppr/test16-suppr-removed-fn-report-3.txt: Likewise.
* tests/data/test-diff-suppr/test16-suppr-removed-fn-report-4.txt: Likewise.
* tests/data/test-diff-suppr/test17-suppr-added-var-report-1.txt: Likewise.
* tests/data/test-diff-suppr/test17-suppr-added-var-report-2.txt: Likewise.
* tests/data/test-diff-suppr/test17-suppr-added-var-report-3.txt: Likewise.
* tests/data/test-diff-suppr/test17-suppr-added-var-report-4.txt: Likewise.
* tests/data/test-diff-suppr/test18-suppr-removed-var-report-1.txt: Likewise.
* tests/data/test-diff-suppr/test18-suppr-removed-var-report-3.txt: Likewise.
* tests/data/test-diff-suppr/test18-suppr-removed-var-report-4.txt: Likewise.
* tests/data/test-diff-suppr/test2-struct-suppr-report-0.txt: Likewise.
* tests/data/test-diff-suppr/test2-struct-suppr-report-1.txt: Likewise.
* tests/data/test-diff-suppr/test25-typedef-report-1.txt: Likewise.
* tests/data/test-diff-suppr/test27-add-aliased-function-report-1.txt: Likewise.
* tests/data/test-diff-suppr/test27-add-aliased-function-report-2.txt: Likewise.
* tests/data/test-diff-suppr/test27-add-aliased-function-report-5.txt: Likewise.
* tests/data/test-diff-suppr/test28-add-aliased-function-report-3.txt: Likewise.
* tests/data/test-diff-suppr/test28-add-aliased-function-report-6.txt: Likewise.
* tests/data/test-diff-suppr/test30-report-1.txt: Likewise.
* tests/data/test-diff-suppr/test34-report-0.txt: Likewise.
* tests/data/test-diff-suppr/test35-leaf-report-0.txt: Likewise.
* tests/data/test-diff-suppr/test36-leaf-report-0.txt: Likewise.
* tests/data/test-diff-suppr/test5-fn-suppr-report-1.txt: Likewise.
* tests/data/test-diff-suppr/test5-fn-suppr-report-2.txt: Likewise.
* tests/data/test-diff-suppr/test5-fn-suppr-report-3.txt: Likewise.
* tests/data/test-diff-suppr/test5-fn-suppr-report-4.txt: Likewise.
* tests/data/test-diff-suppr/test5-fn-suppr-report-5.txt: Likewise.
* tests/data/test-diff-suppr/test7-var-suppr-report-1.txt: Likewise.
* tests/data/test-diff-suppr/test7-var-suppr-report-2.txt: Likewise.
* tests/data/test-diff-suppr/test7-var-suppr-report-3.txt: Likewise.
* tests/data/test-diff-suppr/test7-var-suppr-report-4.txt: Likewise.
* tests/data/test-diff-suppr/test7-var-suppr-report-5.txt: Likewise.
* tests/data/test-diff-suppr/test7-var-suppr-report-6.txt: Likewise.
* tests/data/test-diff-suppr/test7-var-suppr-report-7.txt: Likewise.
* tests/data/test-diff-suppr/test7-var-suppr-report-9.txt: Likewise.
* tests/data/test-diff-suppr/test8-redundant-fn-report-0.txt: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years ago[abipkgdiff]: in leaf mode we always show redundant changes
Dodji Seketeli [Fri, 13 Apr 2018 08:52:15 +0000 (10:52 +0200)]
[abipkgdiff]: in leaf mode we always show redundant changes

In leaf mode we always show redundant changes, by construction.  So
this program should not mess with that.

This patch is part of the set of patches whose titles are:

    Do not show decl-only-to-def changes in the leaf reporter
    Overhaul of the report diff stats summary
    Do not mark "distinct" diff nodes as being redundant
    Fix meaning of "harmless name change" to avoid overfiltering
    Better handle category propagation of pointer changes
    Improve function changes reporting in leaf and default mode
    Don't filter out typedef changes with redundant underlying type changes
    Only show leaf type changes in the leaf type changes section
    Fix leaf report of class data member changes
    Always show redundant changes in leaf mode
    Avoid reporting an enum change if it has already been reported
    When we say an a change was reported earlier give its source location
    [abipkgdiff]: in leaf mode we always show redundant changes
    Update tests for the "better leaf mode redundancy management" patchset

* tools/abipkgdiff.cc (set_diff_context_from_opts):
diff_context::show_leaf_changes_only automatically makes us show
redundant changes.  So do not try to show redundant changes in
that case.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoWhen we say an a change was reported earlier give its source location
Dodji Seketeli [Fri, 13 Apr 2018 08:37:07 +0000 (10:37 +0200)]
When we say an a change was reported earlier give its source location

This patch is part of the set of patches whose titles are:

    Do not show decl-only-to-def changes in the leaf reporter
    Overhaul of the report diff stats summary
    Do not mark "distinct" diff nodes as being redundant
    Fix meaning of "harmless name change" to avoid overfiltering
    Better handle category propagation of pointer changes
    Improve function changes reporting in leaf and default mode
    Don't filter out typedef changes with redundant underlying type changes
    Only show leaf type changes in the leaf type changes section
    Fix leaf report of class data member changes
    Always show redundant changes in leaf mode
    Avoid reporting an enum change if it has already been reported
    When we say an a change was reported earlier give its source location
    [abipkgdiff]: in leaf mode we always show redundant changes
    Update tests for the "better leaf mode redundancy management" patchset

* src/abg-reporter-priv.h
(RETURN_IF_BEING_REPORTED_OR_WAS_REPORTED_EARLIER2)
(RETURN_IF_BEING_REPORTED_OR_WAS_REPORTED_EARLIER3): Report the
location of the artifact.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoAvoid reporting an enum change if it has already been reported
Dodji Seketeli [Fri, 13 Apr 2018 08:34:00 +0000 (10:34 +0200)]
Avoid reporting an enum change if it has already been reported

In the default report mode, if an enum change has already been
reported, do not report it again; just like what we do for class
types.

This patch is part of the set of patches whose titles are:

    Do not show decl-only-to-def changes in the leaf reporter
    Overhaul of the report diff stats summary
    Do not mark "distinct" diff nodes as being redundant
    Fix meaning of "harmless name change" to avoid overfiltering
    Better handle category propagation of pointer changes
    Improve function changes reporting in leaf and default mode
    Don't filter out typedef changes with redundant underlying type changes
    Only show leaf type changes in the leaf type changes section
    Fix leaf report of class data member changes
    Always show redundant changes in leaf mode
    Avoid reporting an enum change if it has already been reported
    When we say an a change was reported earlier give its source location
    [abipkgdiff]: in leaf mode we always show redundant changes
    Update tests for the "better leaf mode redundancy management" patchset

* src/abg-default-reporter.cc (default_reporter::report): In the
enum_diff overload, do not report a node if it's always been
reported; rather, say that it has been reported earlier.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoAlways show redundant changes in leaf mode
Dodji Seketeli [Fri, 13 Apr 2018 08:16:58 +0000 (10:16 +0200)]
Always show redundant changes in leaf mode

When in leaf report mode, do not take redundancy into account when
showing changes.  Leaf type changes are shown just once anyway.  So we
want, for instance, all function (return type, parameters) changes to
be shown.  I think.

So for now, this patch allows redundant changes to be shown in leaf
mode.

This patch is part of the set of patches whose titles are:

    Do not show decl-only-to-def changes in the leaf reporter
    Overhaul of the report diff stats summary
    Do not mark "distinct" diff nodes as being redundant
    Fix meaning of "harmless name change" to avoid overfiltering
    Better handle category propagation of pointer changes
    Improve function changes reporting in leaf and default mode
    Don't filter out typedef changes with redundant underlying type changes
    Only show leaf type changes in the leaf type changes section
    Fix leaf report of class data member changes
    Always show redundant changes in leaf mode
    Avoid reporting an enum change if it has already been reported
    When we say an a change was reported earlier give its source location
    [abipkgdiff]: in leaf mode we always show redundant changes
    Update tests for the "better leaf mode redundancy management" patchset

* src/abg-comparison.cc (diff_context::show_leaf_changes_only):
Show redundant changes when in leaf mode.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoFix leaf report of class data member changes
Dodji Seketeli [Thu, 12 Apr 2018 14:15:48 +0000 (16:15 +0200)]
Fix leaf report of class data member changes

There is a certain number of issues with class data member change
reports in leaf mode.

First, the header of data member changes can be emitted twice.  It
needs to be emitted just once.

Second, some data member changes are not shown, even though they
involve changes in the textual representation of said data members.

This patch addresses both isses.

This patch is part of the set of patches whose titles are:

    Do not show decl-only-to-def changes in the leaf reporter
    Overhaul of the report diff stats summary
    Do not mark "distinct" diff nodes as being redundant
    Fix meaning of "harmless name change" to avoid overfiltering
    Better handle category propagation of pointer changes
    Improve function changes reporting in leaf and default mode
    Don't filter out typedef changes with redundant underlying type changes
    Only show leaf type changes in the leaf type changes section
    Fix leaf report of class data member changes
    Always show redundant changes in leaf mode
    Avoid reporting an enum change if it has already been reported
    When we say an a change was reported earlier give its source location
    [abipkgdiff]: in leaf mode we always show redundant changes
    Update tests for the "better leaf mode redundancy management" patchset

* src/abg-leaf-reporter.cc (leaf_reporter::report): In the
class_or_uion_diff overload, do not emit the data member changes
header twice.
* src/abg-reporter-priv.cc (represent): In the var_diff_sptr
overload, show data member changes when its textual representation
changed.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoOnly show leaf type changes in the leaf type changes section
Dodji Seketeli [Thu, 12 Apr 2018 14:06:56 +0000 (16:06 +0200)]
Only show leaf type changes in the leaf type changes section

The leaf report is somewhat messy in that we show all kinds of leaf
artifact changes in the section where we should only show leaf type
changes.

This commit fixes that.

This patch is part of the set of patches whose titles are:

    Do not show decl-only-to-def changes in the leaf reporter
    Overhaul of the report diff stats summary
    Do not mark "distinct" diff nodes as being redundant
    Fix meaning of "harmless name change" to avoid overfiltering
    Better handle category propagation of pointer changes
    Improve function changes reporting in leaf and default mode
    Don't filter out typedef changes with redundant underlying type changes
    Only show leaf type changes in the leaf type changes section
    Fix leaf report of class data member changes
    Always show redundant changes in leaf mode
    Avoid reporting an enum change if it has already been reported
    When we say an a change was reported earlier give its source location
    [abipkgdiff]: in leaf mode we always show redundant changes
    Update tests for the "better leaf mode redundancy management" patchset

* src/abg-leaf-reporter.cc (report_type_changes_from_diff_maps):
Split this out from leaf_reporter::report_changes_from_diff_maps
and make it report only about leaf *type* changes.
(leaf_reporter::report_changes_from_diff_maps): Use the new
report_type_changes_from_diff_maps function.
(leaf_reporter::report): In the overload for corpus_diff, use the
new report_type_changes_from_diff_maps function, instead of the
report_changes_from_diff_maps function.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoDon't filter out typedef changes with redundant underlying type changes
Dodji Seketeli [Thu, 12 Apr 2018 13:16:09 +0000 (15:16 +0200)]
Don't filter out typedef changes with redundant underlying type changes

Sometimes, the underlying type of typedef changes its textual
representation, in a redundant way.  In that case, we still want to
show the underlying type change as part of the typedef change.

This is what this patch does.

This patch is part of the set of patches whose titles are:

    Do not show decl-only-to-def changes in the leaf reporter
    Overhaul of the report diff stats summary
    Do not mark "distinct" diff nodes as being redundant
    Fix meaning of "harmless name change" to avoid overfiltering
    Better handle category propagation of pointer changes
    Improve function changes reporting in leaf and default mode
    Don't filter out typedef changes with redundant underlying type changes
    Only show leaf type changes in the leaf type changes section
    Fix leaf report of class data member changes
    Always show redundant changes in leaf mode
    Avoid reporting an enum change if it has already been reported
    When we say an a change was reported earlier give its source location
    [abipkgdiff]: in leaf mode we always show redundant changes
    Update tests for the "better leaf mode redundancy management" patchset

* src/abg-default-reporter.cc (default_reporter::report): In the
overload for typedef, report underlying type changes een when they
are redundant, if the whole typedef change needs to be repoted.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoImprove function changes reporting in leaf and default mode
Dodji Seketeli [Thu, 12 Apr 2018 12:51:00 +0000 (14:51 +0200)]
Improve function changes reporting in leaf and default mode

There are cases where we wrongly miss reporting function changes:
  - redundant parameter type changes parameters and return type
  - changes where the textual type representation changed.  This is
    relevant to the leaf change report mode.
  - changed functions are simply not reported in the leaf reporting
    mode, oops.

This patch fixes each one of the cases above.

This patch is part of the set of patches whose titles are:

    Do not show decl-only-to-def changes in the leaf reporter
    Overhaul of the report diff stats summary
    Do not mark "distinct" diff nodes as being redundant
    Fix meaning of "harmless name change" to avoid overfiltering
    Better handle category propagation of pointer changes
    Improve function changes reporting in leaf and default mode
    Don't filter out typedef changes with redundant underlying type changes
    Only show leaf type changes in the leaf type changes section
    Fix leaf report of class data member changes
    Always show redundant changes in leaf mode
    Avoid reporting an enum change if it has already been reported
    When we say an a change was reported earlier give its source location
    [abipkgdiff]: in leaf mode we always show redundant changes
    Update tests for the "better leaf mode redundancy management" patchset

* src/abg-default-reporter.cc (default_reporter::report): In the
overload for fn_parm_diff, consider that parameter type changes are
never redundant.
* src/abg-ir.cc (equals): In the overload for function_type,
consider that if the textual representation of the function return
type or a function parameter changed, then that's a local change
for the current instance of function_type.  Likewise, in the
overload for  function_decl, consider that a change in the textual
representation of the function_decl is a local change.  Likewise,
in the overload of function_decl::parameter, consider that a
change in the textual representation of the parameter type is a
local change.
* src/abg-leaf-reporter.cc (leaf_reporter::report): Report leaf
changes to functions.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoBetter handle category propagation of pointer changes
Dodji Seketeli [Thu, 12 Apr 2018 09:14:33 +0000 (11:14 +0200)]
Better handle category propagation of pointer changes

When a pointed-to type changes in a way that is local (i.e, we don't
consider indirect changes) that change should be reported when we look
at the pointer change diff node.  In other words, local changes to the
pointed-to type should be considered as a local change to the pointer.
Until this patch, pointer diff nodes couldn't have local changes.

This commit does precisely this by changing the meaning of a local
change, for pointer changes.

The commit updates the redundancy and suppression category propagation
rules to propagate pointed-to type changes to the parent pointer diff
node, even if the pointer diff node has local changes.

This patch is part of the set of patches whose titles are:

    Do not show decl-only-to-def changes in the leaf reporter
    Overhaul of the report diff stats summary
    Do not mark "distinct" diff nodes as being redundant
    Fix meaning of "harmless name change" to avoid overfiltering
    Better handle category propagation of pointer changes
    Improve function changes reporting in leaf and default mode
    Don't filter out typedef changes with redundant underlying type changes
    Only show leaf type changes in the leaf type changes section
    Fix leaf report of class data member changes
    Always show redundant changes in leaf mode
    Avoid reporting an enum change if it has already been reported
    When we say an a change was reported earlier give its source location
    [abipkgdiff]: in leaf mode we always show redundant changes
    Update tests for the "better leaf mode redundancy management" patchset

* src/abg-comparison.cc
(leaf_diff_node_marker_visitor::visit_begin): Do not consider
local pointer changes as being leaf changes.
(suppression_categorization_visitor::visit_end):
Allow propagation of the SUPPRESSED_CATEGORY category to pointer
diff nodes.
(redundancy_marking_visitor::visit_end): Allow propagation of the
REDUNDANT_CATEGORY category to pointer diff nodes.
* src/abg-ir.cc (equals): In the pointer_type_def overload,
consider changes where the textual representation of the
pointed-to changed as being local to the pointer type.
* src/abg-leaf-reporter.cc (leaf_reporter::report): In the
pointer_diff overload, report the change in the textual
representation of the pointer.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoFix meaning of "harmless name change" to avoid overfiltering
Dodji Seketeli [Wed, 11 Apr 2018 12:34:47 +0000 (14:34 +0200)]
Fix meaning of "harmless name change" to avoid overfiltering

Whenever a typedef or enum changes its name, we seem to wrongly
qualify that chane as being "harmless" and thus, we tend to filter the
change out, by default.  We do this even when e.g, the enum change
also contain other changes that might be meaningful to show.

This commit fixes the issue by "tightening" the qualification of a
harmless name change for typedefs and enums.

For typedefs, a name change is harmless only if there is no change in
the textual representation of the underlying type.

For enums, a name change is harmless only if there is no other change
in the enum, like on the enumerators or on the underlying type of the
enum.

This patch is part of the set of patches whose titles are:

    Do not show decl-only-to-def changes in the leaf reporter
    Overhaul of the report diff stats summary
    Do not mark "distinct" diff nodes as being redundant
    Fix meaning of "harmless name change" to avoid overfiltering
    Better handle category propagation of pointer changes
    Improve function changes reporting in leaf and default mode
    Don't filter out typedef changes with redundant underlying type changes
    Only show leaf type changes in the leaf type changes section
    Fix leaf report of class data member changes
    Always show redundant changes in leaf mode
    Avoid reporting an enum change if it has already been reported
    When we say an a change was reported earlier give its source location
    [abipkgdiff]: in leaf mode we always show redundant changes
    Update tests for the "better leaf mode redundancy management" patchset

* include/abg-ir.h (enum_has_non_name_change): Declare new
* function.  Make it a friend of class enum_type_decl.
* src/abg-comp-filter.cc (has_harmless_name_change): A typedef
 name change cannot be harmless if the textual representation of
the underlying type changes too.  Also, use the new
enum_has_non_name_change to tighten the harmless name change
definition for an enum.
* src/abg-default-reporter.cc
(default_reporter::report_local_typedef_changes): If the name of
the typedef changed, report it no matter what.
* src/abg-ir.cc (enum_has_non_name_change): Define new function.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoDo not mark "distinct" diff nodes as being redundant
Dodji Seketeli [Wed, 11 Apr 2018 10:45:25 +0000 (12:45 +0200)]
Do not mark "distinct" diff nodes as being redundant

When a char is changed into a const char several times in different
spots of the type graph, we want to see all the occurence of those
changes.  Generalizing this in Abigail parlance, we'd say that we want
to see all occurences of distinct diff nodes, so we don't want to mark
them as being redundant.

Right now, libabigail will only show the first occurence of that
change will flag subsequent onces as being redundant, by virtue of the
redundancy marking pass.

This patch avoids marking distinct diff nodes as being redundant.

This patch is part of the set of patches whose titles are:

    Do not show decl-only-to-def changes in the leaf reporter
    Overhaul of the report diff stats summary
    Do not mark "distinct" diff nodes as being redundant
    Fix meaning of "harmless name change" to avoid overfiltering
    Better handle category propagation of pointer changes
    Improve function changes reporting in leaf and default mode
    Don't filter out typedef changes with redundant underlying type changes
    Only show leaf type changes in the leaf type changes section
    Fix leaf report of class data member changes
    Always show redundant changes in leaf mode
    Avoid reporting an enum change if it has already been reported
    When we say an a change was reported earlier give its source location
    [abipkgdiff]: in leaf mode we always show redundant changes
    Update tests for the "better leaf mode redundancy management" patchset

* include/abg-comp-filter.h (is_mostly_distinct_diff): Declare new
function.
* include/abg-fwd.h (peel_typedef_pointer_or_reference_type): Take
a boolean to decide to peel qualified types or not.
* src/abg-comp-filter.cc (is_mostly_distinct_diff): Define this function.
* src/abg-comparison.cc (redundancy_marking_visitor::visit_begin):
Do not mark distinct_diff nodes as being redundant.
* src/abg-ir.cc (peel_typedef_pointer_or_reference_type):
Implement taking a boolean to decide to peel qualified types or
not.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoOverhaul of the report diff stats summary
Dodji Seketeli [Wed, 11 Apr 2018 08:54:14 +0000 (10:54 +0200)]
Overhaul of the report diff stats summary

The leaf report diff stats summary had several shortcomings.

When referring to "artifact changes", it was only talking about type
changes.  It should have been talked about added/removed/changed
functions and variables as well.
It wasn't taking changed functions and variables into account.

This commit fixes all that.

The commit also fixes some little errors in the default report diff
stats summary.

Note that at some point, we'll have to make each reporter to actually
handles its own diff stats, rather that having it be done globally.

Also note that that the commit doesn't update test outputs as it has
an impact on lots and lots of them.  Rather, test output updates will
come in the last commit of the patch set that this commit introduces.

This patch is part of the set of patches whose titles are:

    Do not show decl-only-to-def changes in the leaf reporter
    Overhaul of the report diff stats summary
    Do not mark "distinct" diff nodes as being redundant
    Fix meaning of "harmless name change" to avoid overfiltering
    Better handle category propagation of pointer changes
    Improve function changes reporting in leaf and default mode
    Don't filter out typedef changes with redundant underlying type changes
    Only show leaf type changes in the leaf type changes section
    Fix leaf report of class data member changes
    Always show redundant changes in leaf mode
    Avoid reporting an enum change if it has already been reported
    When we say an a change was reported earlier give its source location
    [abipkgdiff]: in leaf mode we always show redundant changes
    Update tests for the "better leaf mode redundancy management" patchset

* include/abg-comparison.h
(corpus_diff::diff_stats::{num_leaf_type_changes,
num_leaf_type_changes_filtered_out, net_num_leaf_type_changes,
num_leaf_func_changes, num_leaf_func_changes_filtered_out,
net_num_leaf_func_changes, num_leaf_var_changes,
num_leaf_var_changes_filtered_out, net_num_leaf_var_changes}):
Declare new member functions.
* src/abg-comparison-priv.h
(corpus_diff::priv::count_leaf_type_changes): Declare new member
function.
* src/abg-comparison.cc
(corpus_diff::diff_stats::net_num_leaf_changes): Fix comment.
(corpus_diff::diff_stats::{num_leaf_type_changes,
num_leaf_type_changes_filtered_out, net_num_leaf_type_changes,
num_leaf_func_changes, num_leaf_func_changes_filtered_out,
net_num_leaf_func_changes, num_leaf_var_changes,
num_leaf_var_changes_filtered_out, net_num_leaf_var_changes}):
Define these member functions.
(do_count_diff_map_changes): Move this macro out of ...
(corpus_diff::priv::count_leaf_changes): ... this.  Also, use
the new function corpus_diff::priv::count_leaf_type_changes.
(corpus_diff::priv::count_leaf_type_changes): Splitted this out of
the previous corpus_diff::priv::count_leaf_changes function.
(corpus_diff::priv::apply_filters_and_compute_diff_stats): Account
for (filtered) types, functions and variables, in a leaf change
manner.
(corpus_diff::priv::emit_diff_stats): Emit a better stat summary
that takes into account leaf-changed types, functions and
variables.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoDo not show decl-only-to-def changes in the leaf reporter
Dodji Seketeli [Tue, 10 Apr 2018 16:06:25 +0000 (18:06 +0200)]
Do not show decl-only-to-def changes in the leaf reporter

As an introduction, this patch is the first one of a patchset which
improves the handling of the leaf reporting mode.  The patchset
focuses mainly on handling redundancy filtering when in leaf reporting
mode, but it doesn't do only that.  It also fixes other issues that
are related to the leaf reported mode.

Note that there are so many changes that we couldn't not possibly
update the reference outputs of the regression tests in each change.
Rather we update the reference test outputs in on patch, at the end of
the set.

Here are the titles of the patches of the set:

    Do not show decl-only-to-def changes in the leaf reporter
    Overhaul of the report diff stats summary
    Do not mark "distinct" diff nodes as being redundant
    Fix meaning of "harmless name change" to avoid overfiltering
    Better handle category propagation of pointer changes
    Improve function changes reporting in leaf and default mode
    Don't filter out typedef changes with redundant underlying type changes
    Only show leaf type changes in the leaf type changes section
    Fix leaf report of class data member changes
    Always show redundant changes in leaf mode
    Avoid reporting an enum change if it has already been reported
    When we say an a change was reported earlier give its source location
    [abipkgdiff]: in leaf mode we always show redundant changes
    Update tests for the "better leaf mode redundancy management" patchset

And below is is the definition of what this first patch does.

In the leaf reporter, we are current showing decl-only-classes to
def-only-classes changes in the leaf reporter.  We should not, as it
might be considered as noise.

This patch fixes that.

* include/abg-comp-filter.h (has_class_decl_only_def_change):
Declare this function.
* src/abg-comp-filter.cc (has_class_decl_only_def_change): Make
this function be non-static.
* src/abg-comparison.cc
(leaf_diff_node_marker_visitor::visit_begin): Use it to avoid
marking class-decl-only-def changes as being leaf changes.
* libtest43-decl-only-def-change-leaf-report-v0.so: New test input file.
* libtest43-decl-only-def-change-leaf-report-v1.so: Likewise.
* test43-decl-only-def-change-leaf-report-0.txt: Likewise.
* test43-decl-only-def-change-leaf-report-v0.cc: Likewise.
* test43-decl-only-def-change-leaf-report-v1.cc: Likewise.
* tests/test-diff-filter.cc (in_out_specs): Run the test over the
new test input.
* tests/data/Makefile.am: Add the new test materials to source
distribution.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoDon't possibly forget type definition when reading a CorpusGroup
Dodji Seketeli [Fri, 30 Mar 2018 14:22:28 +0000 (16:22 +0200)]
Don't possibly forget type definition when reading a CorpusGroup

Suppose type T was declared in the main corpus of a group, and suppose
it's a declaration-only type.  Later, when loading another corpus of
the group, we see a definition of T.  We should load the definition of
T and not just say that we have already seen T from the main corpus
and we just keep its declaration and never get its definition.

This is what this patch does.

* src/abg-dwarf-reader.cc (add_or_update_class_type): Look for
declaration-only-ness to determine if we've already seen the same
type from the main corpus of the group.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoDon't crash when invoking kmidiff with no debug info root dir
Dodji Seketeli [Fri, 30 Mar 2018 11:49:23 +0000 (13:49 +0200)]
Don't crash when invoking kmidiff with no debug info root dir

* tools/kmidiff.cc (main): Do not crash on empty debug info root
dir.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoDo not enable fedabipkgdiff tests if fedabipkgdiff itself is disabled
Dodji Seketeli [Fri, 30 Mar 2018 08:38:23 +0000 (10:38 +0200)]
Do not enable fedabipkgdiff tests if fedabipkgdiff itself is disabled

Fix tests/Makefile.am to avoid enabling fedabipkgdiff tests when
fedabipkgdiff itself is disabled because, e.g, of missing
dependencies.

* tests/Makefile.am: Run runtestfedabipkgdiff{py3?}.py only if
fedabipkgdiff itself is enabled.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoBug 22722 - Make fedabipkgdiff and its tests support both python 3 and 2
Chenxiong Qi [Sun, 25 Mar 2018 07:34:59 +0000 (15:34 +0800)]
Bug 22722 - Make fedabipkgdiff and its tests support both python 3 and 2

This patch makes fedabipkgdiff Python 3 compatible.  All tests written
in Python are updated and compatible with Python 3 as well.

The patch looks for a Python 3 interperter.  If it finds one then it
runs the tests using that interpreter.  Otherwise it just tries to use
the Python 2 interpreter.

This behaviour can be disabled by the new --disable-python3 option.

* configure.ac: Add new option --enable-python3. Add new
test runner file tests/runtestdefaultsupprs-py3 and
tests/runtestfedabipkgdiffpy3.sh. Add required six Python module.
* tests/Makefile.am: Add new test files
tests/runtestdefaultsupprspy3.sh and
tests/runtestfedabipkgdiffpy3.sh accordingly.
* tests/mockfedabipkgdiff.in: Convert print statement to
six.print_. Replace call to function filter with list
comprehension. Replace basestring with six.string_types.
* tests/runtestdefaultsupprspy3.sh.in: New shell script to run
test runtestdefaultsupprs with Python 3.
* tests/runtestdefaultsupprs.py.in: Repalce a few tabs with
proper number of spaces which is detected by Python 3
interpreter.
* tests/runtestfedabipkgdiffpy3.sh.in: New shell script to run
test runtestfedabipkgdiff with Python 3.
* tests/runtestfedabipkgdiff.py.in: Use python from env in
shebang instead of a fixed path to a Python interpreter.
* tools/fedabipkgdiff: Globally replace print statement with a
function call to print which is available by importing
print_function from __future__ module. Use six.print_ to output
string to stderr instead. Convert function call to map to
for-loop. (cmp_nvr): Change argument to handle a Koji build
mapping instead of only the nvr. (Brew.listBuilds): use the new
cmp_nvr to sort builds.

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoDetect the presence of 'rpm' as it's now needed by abipkgdiff
Dodji Seketeli [Thu, 29 Mar 2018 11:28:29 +0000 (13:28 +0200)]
Detect the presence of 'rpm' as it's now needed by abipkgdiff

If the rpm program is not installed, then we disable tests that
require it.

* configure.ac: Detect that the 'rpm' is present. Otherwise,
disable rpm support.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoMake abipkgdiff avoid comparing private DSOs from RPMs
Dodji Seketeli [Wed, 28 Mar 2018 12:22:35 +0000 (14:22 +0200)]
Make abipkgdiff avoid comparing private DSOs from RPMs

When an RPM contains a DSO which SONAME is not listed in the
"provides" property of the package, abipkgdiff ought to consider that
DSO as private to the RPM.  It should thus *NOT* consider that DSO
when comparing ABIs, at least, by default.

This is as per the discussion that was held at
https://pagure.io/task-abicheck/issue/8 and that led to the proposal
https://pagure.io/task-abicheck/issue/8#comment-492466.

This patch implements that scheme.

Basically, the patch looks at the SONAMEs listed in the "provides"
property of the RPM and consider them as the SONAMEs of the set of
"public" DSOs of the RPM.

Thus, if the RPM has a DSO that has no SONAME of one that is not
listed in the set of public SONAMEs of the package, then that DSO is
not considered for ABI comparison.

The patch also introduces a new --private-dso option that disables
this behaviour and compares all DSOs, including those that would be
meant to be private.

* doc/manuals/abipkgdiff.rst: Add documentation for the new
--private-dso option.
* include/abg-tools-utils.h (execute_command_and_get_output)
(execute_command_and_get_output, remove_trailing_white_spaces):
Declare new functions.
* src/abg-tools-utils.cc (execute_command_and_get_output)
(get_dsos_provided_by_rpm, remove_trailing_white_spaces): Define
new functions.
* tests/test-diff-pkg.cc (in_out_specs): Add the new --private-dso
option where it makes sense.
* tools/abipkgdiff.cc (options::compare_private_dsos): Add new
data member.
(options::options): Initialize it.
(package::public_dso_sonames_): Add new data member.
(package::public_dso_sonames): Add new accessors pair.
(display_usage): Add a help string for the new --private-dso
option.
(maybe_create_public_dso_sonames_set)
(must_compare_public_dso_only): Define new static functions.
(create_maps_of_package_content): Call the new
maybe_create_public_dso_sonames_set.  Skip packages which SONAME
is not in the set of public SONAMES.
(parse_command_line): Parse the new --private-dso option.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoSkip changes to function *types* in the leaf reporter
Dodji Seketeli [Fri, 16 Mar 2018 13:49:24 +0000 (14:49 +0100)]
Skip changes to function *types* in the leaf reporter

In the leaf reporter, it doesn't make sense to report changes about
function types, as function types are a concept that is internal-only
to Libabigail.

* src/abg-leaf-reporter.cc
(leaf_reporter::report_changes_from_diff_maps): Don't report
function type changes.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoReport change locations in leaf reports
Dodji Seketeli [Fri, 16 Mar 2018 13:43:14 +0000 (14:43 +0100)]
Report change locations in leaf reports

While working on something else, I noticed that in the leaf report,
source locations of changed ABI artifacts are not reported, even when
they should.

This patch fixes that.

* src/abg-leaf-reporter.cc (report_diffs): Report the source
location of the diff.
* tests/data/test-diff-filter/test42-leaf-report-output-0.txt:
Update test reference output.
* tests/data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-3.txt:
Likewise.
* tests/data/test-diff-suppr/test35-leaf-report-0.txt: Likewise.
* tests/data/test-diff-suppr/test36-leaf-report-0.txt: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoMake the "upload-release" target be usable in parallel
Dodji Seketeli [Tue, 6 Mar 2018 17:08:22 +0000 (18:08 +0100)]
Make the "upload-release" target be usable in parallel

* Makefile.am: Re-arrange the upload-release target to make it
usable with 'make upload-release -jN'.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoBump version number to 1.3
Dodji Seketeli [Tue, 6 Mar 2018 17:07:19 +0000 (18:07 +0100)]
Bump version number to 1.3

* configure.ac: Now that 1.2 is out of the door, bump version
number to 1.3

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoUpdate website for 1.2
Dodji Seketeli [Tue, 6 Mar 2018 17:06:36 +0000 (18:06 +0100)]
Update website for 1.2

* doc/website/mainpage.txt: Update link to download the tarball,
for 1.2.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoUpdate ChangeLog for 1.2 libabigail-1.2
Dodji Seketeli [Tue, 6 Mar 2018 14:16:02 +0000 (15:16 +0100)]
Update ChangeLog for 1.2

* ChangeLog: Updated automatically by running make update-changelog.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoUpdate NEWS file for 1.2
Dodji Seketeli [Tue, 6 Mar 2018 14:13:31 +0000 (15:13 +0100)]
Update NEWS file for 1.2

* NEWS: Update for 1.2

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoFix typo in abipkgdiff documenation
Dodji Seketeli [Wed, 31 Jan 2018 17:20:41 +0000 (18:20 +0100)]
Fix typo in abipkgdiff documenation

* doc/manuals/abipkgdiff.rst: Fix a typo

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoUpdate abipkgdiff documentation wrt suppression specifications
Dodji Seketeli [Wed, 31 Jan 2018 17:16:39 +0000 (18:16 +0100)]
Update abipkgdiff documentation wrt suppression specifications

* doc/manuals/abipkgdiff.rst: Mention the .abignore file that is
read by the tool and considered as a suppression specification
file.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoFix indentation in the DWARF reader
Dodji Seketeli [Tue, 6 Mar 2018 14:25:01 +0000 (15:25 +0100)]
Fix indentation in the DWARF reader

* src/abg-dwarf-reader.cc (build_subrange_type): Fix indentation.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoFix the output indentation of abidiff --help
Dodji Seketeli [Fri, 2 Mar 2018 15:47:20 +0000 (16:47 +0100)]
Fix the output indentation of abidiff --help

* tools/abidiff.cc (display_usage): Fix indentation of the help
string for the --drop-private-types option.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoBug 22913 - Correctly de-duplicate pointers to anonymous structs inside a given
Dodji Seketeli [Fri, 2 Mar 2018 14:47:15 +0000 (15:47 +0100)]
Bug 22913 - Correctly de-duplicate pointers to anonymous structs inside a given

During type DIE canonicalization, libabigail performs an optimization
while comparing two types defined in the same translation unit.  That
is, inside a given translation unit two pointers that point to a type
named T (that is, two T*) are considered equal.  They are considered
equal without having to structurally compare the two types named T.

This generally makes sense, because if two types of the same kind,
defined in the same translation unit, have the same name then we can
safely conclude that they are actually the same type.  Unless the two
T are anonymous structs.

If the two T are anonymous structs defined in the same translation
unit, we really need to compare them structurally to know if they are
equal or not.

This is what this patch does.

* src/abg-dwarf-reader.cc
(pointer_or_qual_die_of_anonymous_class_type)
(die_is_qualified_type): Define new functions.
(compare_dies): If pointers, reference or qualified type have an
anonymous struct as their underlying type, then we need to
structurally compare the underlying anonymous struct.
* tests/data/test-diff-dwarf/libtest43-PR22913-v{0,1}.so: New
binary test input files.
* tests/data/test-diff-dwarf/test43-PR22913-report-0.txt: New
reference output of the comparison of the two binaries above.
* tests/data/test-diff-dwarf/test43-PR22913-v{0,1}.c: Source code
of the binaries above.
* tests/test-diff-dwarf.cc (in_out_specs): Make the test harness
compare the two binaries above.
* tests/data/Makefile.am: Add the new test files above to the
source distribution.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoInitial support for Ada ranges
Dodji Seketeli [Tue, 27 Feb 2018 17:10:55 +0000 (18:10 +0100)]
Initial support for Ada ranges

In order for abipkgdiff to handle the gnat sub-packages GCC,
Libabigail needs to understand some Ada-specific constructs.  So far,
the only unsupported construct that was problematic is the Ada Range
type.  This patch thus adds support for that Range type and so makes
it possible to handle the gnat sub-packages of GCC.

In Ada, the range type is emitted as a DW_TAG_subrange_type that is
not necessarily emitted as a property of an array type.  In C and C++
however, that DW_TAG_subrange_type is always a property of an array
type.  So the patch adds support for a so-called "free-form"
DW_TAG_subrange_type.

First, in the IR, the abigail::array_type_def::subrange_types is now a
real full blown type which can have a name and an underlying type.
That type can now be created by the both the DWARF and abixml readers.
It can also be serialized by the abixml writer.

Note that changes in the underlying type and on the name of the range
are not yet reported by the reporting engine.  That would have to be
added in a subsequent patch set.

* include/abg-ir.h (type_maps::subrange_types): Declare new
accessors.
(is_ada_language, is_subrange_type): Declare new functions.
(class array_type_def::subrange_type): Make this extend type_base
and decl_base.
(array_type_def::subrange_type::{get_language, operator==,
get_pretty_representation, traverse}): Declare new member
functions.
(ir_node_visitor::visit_begin): Add new overloads for
array_type::def::subrange_type.
* src/abg-dwarf-reader.cc (build_subrange_type): Define new static
function.
(build_subranges_from_array_type_die): Cleanup the parameters of
this function.
(build_array_type): Adjust.
(build_ir_node_from_die): Support free-form DW_TAG_subrange_type.
(read_context::odr_is_relevant): Handle Ada.
(die_qualified_type_name): Support DW_TAG_subrange_type.
(die_pretty_print_type): Likewise.  Make the handling of
DW_TAG_subrange_type use die_qualified_type_name.  Adjust the use
of build_subranges_from_array_type_die.
(get_scope_die): a DW_TAG_array_type cannot be a scope.  Rather,
it's its scope that can be a scope.
* src/abg-ir.cc (type_maps::priv::subrange_types_): New data
member.
(type_maps::empty): Adjust.
(type_maps::subrange_types): Define new accessors.
(is_ada_language, is_subrange_type): Define new functions.
(odr_is_relevant): Support Ada.
(maybe_update_types_lookup_map): Add an overload for
array_type_def::subrange_type.  In the decl_base_sptr overload,
add support for the array_type_def::subrange_type type.
(struct array_type_def::subrange_type::priv::location_): Remove
this as it's now carried by the parent decl_base type.
(array_type_def::subrange_type::subrange_type): Adjust.  Take an
environement pointer, a name, an underlying type and a language.
(array_type_def::subrange_type::{g,s}et_underlying_type): Define
new accessors.
(array_type_def::subrange_type::{get_language,
get_pretty_representation, traverse}): Define new member
functions.
(array_type_def::subrange_type::as_string): Add a representation
for Ada.
(equals): Define new overload for array_type_def::subrange_type.
(array_type_def::subrange_type::operator==): Define three new
overloads for decl_base, type_base and subrange_type.
(array_type_def::subrange_type::operator!=): Define new operator.
(get_type_representation): In the overload for array_type_def,
support Ada.
(array_type_def::get_language): Define new member function.
(ir_node_visitor::visit_{begin,end}): Define new overloads for
array_type_def::subrange_type.
* src/abg-reader.cc (build_subrange_type): Adjust documentation.
Support the new 'id', 'name', and 'type-id' properties.
* src/abg-writer.cc (write_array_subrange_type): Define new static
function.
(write_array_type_def): Use the new write_array_subrange_type
function.
* tests/data/test-abidiff/test-PR18166-libtirpc.so.abi: Adjust.
* tests/data/test-annotate/libtest23.so.abi: Likewise.
* 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/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-annotate/test7.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/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/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/test7.so.abi: Likewise.
* tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise.
* tests/data/test-read-write/test25.xml: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoAdd newline at end of version string display
Dodji Seketeli [Tue, 6 Feb 2018 09:11:13 +0000 (10:11 +0100)]
Add newline at end of version string display

I screwed up version string display by forgetting to add a newline
after it.  Oops.  Fixed thus.

* tools/abidiff.cc (main): Add a newline at the end of the version
string line.
* tools/abidw.cc (main): Likewise.
* tools/abipkgdiff.cc (main): Likewise.
* tools/kmidiff.cc (main): Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoBump version number to 1.2
Dodji Seketeli [Wed, 31 Jan 2018 09:09:24 +0000 (10:09 +0100)]
Bump version number to 1.2

* configure.ac: Bump version number to 1.2

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoUpdate website for 1.1 libabigail-1.1
Dodji Seketeli [Thu, 25 Jan 2018 15:14:06 +0000 (16:14 +0100)]
Update website for 1.1

* doc/website/mainpage.txt: Update for 1.1.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoUpdate ChangeLog for 1.1
Dodji Seketeli [Thu, 25 Jan 2018 14:47:23 +0000 (15:47 +0100)]
Update ChangeLog for 1.1

* ChangeLog: Automatically update using 'make update-changelog'.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoUpdate NEWS file for 1.1
Dodji Seketeli [Thu, 25 Jan 2018 14:42:00 +0000 (15:42 +0100)]
Update NEWS file for 1.1

* NEWS: Update for 1.1

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoCorrectly link with pthread
Dodji Seketeli [Mon, 29 Jan 2018 10:57:21 +0000 (11:57 +0100)]
Correctly link with pthread

We were not correctly linking with libpthread.  Fix thus.

* src/Makefile.am: use -lpthread, not -pthread.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoSkip class types with changed names in leaf reports
Dodji Seketeli [Thu, 18 Jan 2018 13:20:01 +0000 (14:20 +0100)]
Skip class types with changed names in leaf reports

In leaf reports, a class type which is said to have changed name
should not be reported because it doesn't make sense there.  In the
full report however, a class sub-type of a type foo changed name is
worth mentioning.

This patch detects name changes of class types in the context of leaf
reports and avoid reporting impacted types.

* include/abg-comp-filter.h (has_class_or_union_type_name_change)
(has_basic_or_class_type_name_change): Declare new functions.
* include/abg-comparison.h (is_diff_of_class_or_union_type):
Likewise.
* src/abg-comp-filter.cc (has_class_or_union_type_name_change)
(has_basic_or_class_type_name_change):
* src/abg-comparison.cc
(leaf_diff_node_marker_visitor::visit_begin): Use the new
filtering::has_basic_or_class_type_name_change to test if a basic
or class/union diff type carries a name change.  Update comment.
* 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.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoOnly consider local changes when filtering subtype changes
Dodji Seketeli [Tue, 16 Jan 2018 15:10:59 +0000 (16:10 +0100)]
Only consider local changes when filtering subtype changes

In the leaf reporter, when counting subtype changes of struct/unions,
we forget that we should be looking at *local* changes (filtered or
not) only.  This leads to some weird change reports like this, when
comparing RHEL 7.0 and RHEL 7.1 kernels:

    'struct pmu' changed:
      type size changed from 1408 to 1536 bits
      2 data member insertions:
'module* pmu::module', at offset 1408 (in bits) at perf_event.h:282:1
'int pmu::capabilities', at offset 1472 (in bits) at perf_event.h:287:1
      there are data member changes:

In the report above, you see that the reporter thinks that there are
further changes to be reported, but then none of them are actually
reported.

This is due to the fact that when the reporter determines if there are
data member changes or not, it considers all changes, not just local
changes.  But then when it's time to actually report the changes, then
it only considers local changes.  So there is a difference in there.

This patch makes the leaf reporter to consider local changes only,
when it determines if there are data member changes.

* src/abg-comparison-priv.h
(class_or_union_diff::priv::{count_filtered_subtype_changed_dm,
count_filtered_changed_dm}): Take an additional flag.
* src/abg-comparison.cc
(class_or_union_diff::priv::{count_filtered_subtype_changed_dm,
count_filtered_changed_dm}): Likewise.  When asked, only consider
local changes.
* src/abg-leaf-reporter.cc (leaf_reporter::report): Consider
reporting only the *net local* data member changes.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoMake kmidiff show the wrong option when it complains about it
Dodji Seketeli [Tue, 16 Jan 2018 15:07:32 +0000 (16:07 +0100)]
Make kmidiff show the wrong option when it complains about it

When the user gives a wrong option to kmidiff, the tool was failing to
tell what that wrong option was.  This patch fixes that.

* tools/kmidiff.cc (parse_command_line): Don't forget to record
the wrong option in options::wrong_option.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoFix typo in abipkgdiff.cc
Dodji Seketeli [Fri, 12 Jan 2018 15:18:04 +0000 (16:18 +0100)]
Fix typo in abipkgdiff.cc

* tools/abipkgdiff.cc (compare_task::perform): Fix a typo in a
comment.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoSuppress duplicates when listing package content
Dodji Seketeli [Fri, 12 Jan 2018 15:07:53 +0000 (16:07 +0100)]
Suppress duplicates when listing package content

Now that we resolve symlinks fully, there can be several elements
of a given package that have the same path.

This patch deals with that redundancy.

* tools/abipkgdiff.cc (maybe_update_package_content): Rename
maybe_update_vector_of_package_content into this.  Take a set of
strings, rather than a vector of strings.
(get_interesting_files_under_dir): Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoFix symlinks paths handling in abipkgdiff
Dodji Seketeli [Fri, 12 Jan 2018 12:38:01 +0000 (13:38 +0100)]
Fix symlinks paths handling in abipkgdiff

When elements of an RPMs are referred to using a path that contains
symlinks, we need to resolve the symlinks in order to be able to
compare those paths.  We are not doing this fully and so we are
hitting corner cases where things break down in subtle ways.

This patch fixes that.

* include/abg-tools-utils.h (real_path): Declare new function.
* src/abg-tools-utils.cc (real_path): Define it.
* tools/abipkgdiff.cc (package::convert_path_to_relative): Use the
new real_path function to consider real path (where symlinks are
resolved) of the extraction directory of the package.
(get_interesting_files_under_dir): Similarly, use the new
real_path function to consider the real path of the directory we
are exploring.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>