platform/upstream/libabigail.git
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>
6 years agoFix logic in common_prefix
Dodji Seketeli [Fri, 12 Jan 2018 12:09:21 +0000 (13:09 +0100)]
Fix logic in common_prefix

Fix a logic error in the abigail::tools_utils::common_prefix function.

* src/abg-tools-utils.cc (common_prefix): Fix logic error.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoabipkgdiff --verbose shouldn't trigger --fail-no-dbg
Dodji Seketeli [Fri, 12 Jan 2018 12:04:49 +0000 (13:04 +0100)]
abipkgdiff --verbose shouldn't trigger --fail-no-dbg

--verbose was triggering --fail-no-dbg.  This patch fixes that.

* tools/abipkgdiff.cc (compare): In the overload for elf_files,
separate the effect of --verbose from the one of --fail-no-dbg.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoBug 22692 - Consider Java as a language that supports the ODR
Dodji Seketeli [Wed, 10 Jan 2018 11:25:34 +0000 (12:25 +0100)]
Bug 22692 - Consider Java as a language that supports the ODR

While comparing libgcj.so, it turned out that we are trying to
canonicalize a DW_TAG_class_type DIE expressing a Java type.

Right now, we don't canonicalize DW_TAG_class_type yet because
languages that emit those DIEs (like C++) do respect the One
Definition Rule.  So in theory, we do not need to canonicalize the
DW_TAG_class_type by using structural comparison.  We only perform DIE
canonicalization of DIEs originating from the C language as that
language does not respect the ODR.

We were assuming that only C++ actually respects the ODR.  In
practise, Java does also, so this patch now assumes that C++ and Java
respect the ODR.  So when facing DIEs originating from those
languages, we don't try (yet) to canonicalize their DIEs.

In the future though, we need to canonicalize all DIEs, irrespective
of the language they originated from.  And for that, we need to
support structural comparison of DW_TAG_class_type DIEs, among others.

* include/abg-ir.h (is_java_language): Declare new function.
* src/abg-dwarf-reader.cc (odr_is_relevant): Adjust to consider
that Java also respects the ODR.
* src/abg-ir.cc (is_java_language): Define new function.
(odr_is_relevant): Adjust to consider that Java also respects the
ODR.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoFix version revision number printing in tools --help option
Dodji Seketeli [Tue, 9 Jan 2018 17:03:42 +0000 (18:03 +0100)]
Fix version revision number printing in tools --help option

The revision number of the version string is junk since 1.0.  This
patch fixes that.

The patch also comes up with a function that returns a version string,
rather than having client code constructing the version string on
their own.

* configure.ac: Properly set the VERSION_REVISION macro.
* include/abg-tools-utils.h (get_library_version_string): Declare
new function.
* src/abg-tools-utils.cc (get_library_version_string): Define the
new function.
(gen_suppr_spec_from_kernel_abi_whitelist): Dis-ambiguate the use
of the 'config' type.
* tools/abicompat.cc (main): Use the new
abigail::tools_utils::get_library_version_string function.
* tools/abidiff.cc (main): Likewise.
* tools/abidw.cc (main): Likewise.
* tools/abilint.cc (main): Likewise.
* tools/abipkgdiff.cc (main): Likewise.
* tools/abisym.cc (main): Likewise.
* tools/kmidiff.cc (main): Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoBug 22684 - Add --d{1,2} options to kmidiff
Dodji Seketeli [Tue, 9 Jan 2018 15:12:13 +0000 (16:12 +0100)]
Bug 22684 - Add --d{1,2} options to kmidiff

kmidiff lacks options specifying where to find split debug info for
the Linux kernel binaries it's comparing.

This patch adds those options.

* doc/manuals/kmidiff.rst: Add documentation for the new options.
* tools/kmidiff.cc (options::{di_root_path{1,2}): New data
members.
(display_usage): Add help strings for the new options.
(parse_command_line): Parse the new options.
(main): Pass the debug info root directory to
build_corpus_group_from_kernel_dist_under.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoUpdate copyright notice for all source files
Dodji Seketeli [Mon, 8 Jan 2018 16:54:56 +0000 (17:54 +0100)]
Update copyright notice for all source files

Happy New Year 2018, I guess :-)

* update-copyright.sh: New sed-based script to update the year
in the copyright notice.
* include/abg-comp-filter.h: Updated the year in the copyright
notice.
* include/abg-comparison.h: Likewise.
* include/abg-config.h: Likewise.
* include/abg-corpus.h: Likewise.
* include/abg-diff-utils.h: Likewise.
* include/abg-dwarf-reader.h: Likewise.
* include/abg-fwd.h: Likewise.
* include/abg-hash.h: Likewise.
* include/abg-ini.h: Likewise.
* include/abg-interned-str.h: Likewise.
* include/abg-ir.h: Likewise.
* include/abg-libxml-utils.h: Likewise.
* include/abg-libzip-utils.h: Likewise.
* include/abg-reader.h: Likewise.
* include/abg-reporter.h: Likewise.
* include/abg-sptr-utils.h: Likewise.
* include/abg-suppression.h: Likewise.
* include/abg-tools-utils.h: Likewise.
* include/abg-traverse.h: Likewise.
* include/abg-viz-common.h: Likewise.
* include/abg-viz-dot.h: Likewise.
* include/abg-viz-svg.h: Likewise.
* include/abg-workers.h: Likewise.
* include/abg-writer.h: Likewise.
* src/abg-comp-filter.cc: Likewise.
* src/abg-comparison-priv.h: Likewise.
* src/abg-comparison.cc: Likewise.
* src/abg-config.cc: Likewise.
* src/abg-corpus-priv.h: Likewise.
* src/abg-corpus.cc: Likewise.
* src/abg-default-reporter.cc: Likewise.
* src/abg-diff-utils.cc: Likewise.
* src/abg-dwarf-reader.cc: Likewise.
* src/abg-hash.cc: Likewise.
* src/abg-ini.cc: Likewise.
* src/abg-internal.h: Likewise.
* src/abg-ir-priv.h: Likewise.
* src/abg-ir.cc: Likewise.
* src/abg-leaf-reporter.cc: Likewise.
* src/abg-libxml-utils.cc: Likewise.
* src/abg-libzip-utils.cc: Likewise.
* src/abg-reader.cc: Likewise.
* src/abg-reporter-priv.cc: Likewise.
* src/abg-reporter-priv.h: Likewise.
* src/abg-sptr-utils.cc: Likewise.
* src/abg-suppression-priv.h: Likewise.
* src/abg-suppression.cc: Likewise.
* src/abg-tools-utils.cc: Likewise.
* src/abg-traverse.cc: Likewise.
* src/abg-viz-common.cc: Likewise.
* src/abg-viz-dot.cc: Likewise.
* src/abg-viz-svg.cc: Likewise.
* src/abg-workers.cc: Likewise.
* src/abg-writer.cc: Likewise.
* tests/print-diff-tree.cc: Likewise.
* tests/test-abicompat.cc: Likewise.
* tests/test-abidiff-exit.cc: Likewise.
* tests/test-abidiff.cc: Likewise.
* tests/test-alt-dwarf-file.cc: Likewise.
* tests/test-core-diff.cc: Likewise.
* tests/test-diff-dwarf-abixml.cc: Likewise.
* tests/test-diff-dwarf.cc: Likewise.
* tests/test-diff-filter.cc: Likewise.
* tests/test-diff-pkg.cc: Likewise.
* tests/test-diff-suppr.cc: Likewise.
* tests/test-diff2.cc: Likewise.
* tests/test-ir-walker.cc: Likewise.
* tests/test-lookup-syms.cc: Likewise.
* tests/test-read-dwarf.cc: Likewise.
* tests/test-read-write.cc: Likewise.
* tests/test-types-stability.cc: Likewise.
* tests/test-utils.cc: Likewise.
* tests/test-utils.h: Likewise.
* tests/test-write-read-archive.cc: Likewise.
* tools/abiar.cc: Likewise.
* tools/abicompat.cc: Likewise.
* tools/abidiff.cc: Likewise.
* tools/abidw.cc: Likewise.
* tools/abilint.cc: Likewise.
* tools/abipkgdiff.cc: Likewise.
* tools/abisym.cc: Likewise.
* tools/binilint.cc: Likewise.
* tools/kmidiff.cc: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoBug 22437 - Make fedabipkgdiff use all debug info RPMs of a sub-RPM
Dodji Seketeli [Fri, 15 Dec 2017 15:10:34 +0000 (16:10 +0100)]
Bug 22437 - Make fedabipkgdiff use all debug info RPMs of a sub-RPM

On ppc64, at least, it can happen that a devel RPM foo-devel.rpm needs
not only the foo-devel-debuginfo.rpm but also the foo-debuginfo.rpm.
In other words, the devel sub-package needs all the debug info RPMs of
foo.rpm.

To make things general, this patch modifies fedabipkgdiff so that all
debuginfo packages are taken into account when looking at a devel
package.  This is done on all architectures, not just ppc64.

* tools/fedabipkgdiff (RPM::get_all_debuginfo_rpms): Define new
member function.
(RPM::generate_comparison_halves): The ancillary debuginfo RPM of
a given RPM now has a list type; there can be more than one
debuginfo RPM associated to a given RPM, especially if the RPM is
a devel one.
(format_debug_info_pkg_options): Define new function.
(abipkgdiff): Use the new function above.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoImprove comments wording in fedabipkgdiff
Dodji Seketeli [Fri, 15 Dec 2017 10:00:51 +0000 (11:00 +0100)]
Improve comments wording in fedabipkgdiff

While looking at something else, it struck me that we could use some
better wording in the comments for the RPM class.

* tools/fedabipkgdiff (class RPM): Fix wording.
(RPM::__init__): Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoUpdate & cleanup the tools manuals summary
Dodji Seketeli [Mon, 11 Dec 2017 13:30:04 +0000 (14:30 +0100)]
Update & cleanup the tools manuals summary

* doc/manuals/abidw.rst: Use the same header structure as or the
other tools manual.
* doc/manuals/kmidiff.rst: Likewise.
* doc/manuals/libabigail-tools.rst: Add the new kmidiff tool to
the summary.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoBug 22488 - Make abipkgdiff handle different binaries with same basename
Dodji Seketeli [Fri, 1 Dec 2017 13:52:23 +0000 (14:52 +0100)]
Bug 22488 - Make abipkgdiff handle different binaries with same basename

Some packages might have different binaries with the same soname and
basename, but at different paths.  In that case, abipkgdiff messes
things up because it only either consider the soname or the basename
of the binary.

This patch makes abipkgdiff to always consider the full path of the
binary inside the package.

* include/abg-tools-utils.h (string_suffix)
(sorted_strings_common_prefix): Declare new functions.
(dir_name): Take a new keep_separator_at_end parameter at the end.
* src/abg-tools-utils.cc (dir_name): Take a new
keep_separator_at_end parameter at the end.  Add a comment for it
and update.
(string_suffix, sorted_strings_common_prefix): Define new
functions.
(common_prefix): Define new static function.
* tools/abipkgdiff.cc (get_interesting_files_under_dir): Forward
declare this pre-existing static function.
(package::{common_paths_prefix_, elf_file_paths_}): New data
members.
(package::{common_paths_prefix, elf_file_paths,
convert_path_to_relative, convert_path_to_unique_suffix,
load_elf_file_paths}): New member functions.
(create_maps_of_package_content): Use the new
package::{load_elf_file_paths, convert_path_to_unique_suffix}
functions.
(compare_prepared_userspace_packages): Show relative paths of
package elements in reported.
* tests/data/test-diff-pkg/dbus-glib-0.104-3.fc23.x86_64--dbus-glib-0.104-3.fc23.armv7hl-report-0.txt:
Update test ouptut.
* tests/data/test-diff-pkg/libxfce4ui-devel-4.12.1-8.fc27.ppc64-self-report-0.txt:
Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoFully report diagnostic about alternate debug info file not found
Dodji Seketeli [Fri, 1 Dec 2017 13:49:11 +0000 (14:49 +0100)]
Fully report diagnostic about alternate debug info file not found

While looking at something else, it occured to me that we forget to
emit textual diagnostic for when a required alternate debug info file
was not found.  The facility in question is mainly used by the
abipkgdiff tool for now.

* src/abg-dwarf-reader.cc (status_to_diagnostic_string): Report
textual diagnostic for the STATUS_ALT_DEBUG_INFO_NOT_FOUND case
too.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoBug 22436 - make abipkgdiff accept several debuginfo packages
Dodji Seketeli [Mon, 27 Nov 2017 14:45:47 +0000 (15:45 +0100)]
Bug 22436 - make abipkgdiff accept several debuginfo packages

Sometimes, the debug information for one given package P can have been
split into several packages.  In that case, we need abipkgdiff to
consider several debug info packages for a given input binary package.

This patch makes abipkgdiff to accept several --d{1,2} <debug-info-package>
option, for a given input package.

* doc/manuals/abipkgdiff.rst: Document the fact that --d{1,2} can
be provided several times on the command line.
* tools/abipkgdiff.cc (options::debug_packages{1,2}): Rename the
debug_package{1,2} data members into this, and make them be vector
of strings, rather than just strings.
(package::debug_info_packages_): Renamed
package::debug_info_package_ into this and make it be a vector of
package_sptr, rather than just a package_sptr.
(package::debug_info_packages): Renamed the method
package::debug_info_package into this and -- for the getter
overload -- make it return a vector of package_sptr, rather than
just a package_sptr.  Likewise for the setter overload.  Add a
non-const getter overload.
(package::erase_extraction_directories)
(extract_package_and_map_its_content): Adjust.
(extract_rpm, extract_deb): Do not erase the content of the
extraction directory (if it was pre-existing) prior to extracting
the RPM/deb into it.
(pkg_extraction::pkgs): Renamed pkg_extraction::pkg into this and
make it be a vector of packages, rather than just a package.
(pkg_extraction::pkg_extraction): Adjust to take a package_sptr
rather than just a package.  Add an overload to take a vector of
packages_sptr.
(pkg_extraction::perform): Extract the vector of package that the
task is not responsible for, not just one random package.
(extract_package_and_map_its_content): Adjust.
(prepare_packages): Take smart pointers to package rather than
just packages.  Adjust accordingly.
(compare_prepared_package): Make the overload that takes two
packages to take two smart pointers of packages.
(compare): Make the overload that takes two package take two
package_sptr.
(parse_command_line): Parse having --d{1,2} several times for a
given input package.
(main): Take several debug info packages for one input file.
* include/abg-tools-utils.h (split_string): Declare ...
* src/abg-tools-utils.cc (split_string): ... new function.
* tests/data/test-diff-pkg/libxfce4ui-debuginfo-4.12.1-8.fc27.ppc64.rpm:
Add a new RPM test input file.
* tests/data/test-diff-pkg/libxfce4ui-devel-4.12.1-8.fc27.ppc64-self-report-ok-0.txt:
new reference output file.
* tests/data/Makefile.am: Add the new test input files above to source
distribution.
* tests/test-diff-pkg.cc (in_out_spec): Add new test entry to
specify two debug info packages for one input package.
(test_task::perform): Support having several debug info package
paths in the IntOutSpec::{first,second}_in_debug_package_path data
member.  The debug info packages paths are separated by either a
white space or commas.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoUpdate version number to 1.1
Dodji Seketeli [Wed, 22 Nov 2017 16:31:48 +0000 (17:31 +0100)]
Update version number to 1.1

* configure.ac: Update version number to 1.1

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoBug 22076 - Disable fedabipkgdiff for old koji clients
Dodji Seketeli [Wed, 22 Nov 2017 16:27:02 +0000 (17:27 +0100)]
Bug 22076 - Disable fedabipkgdiff for old koji clients

On some platforms, the koji client is so old that the koji object
doesn't have the .read_config method that we need.

Unfortunately, the koji client library module doesn't come with a
__version__ variable that carries its version number.  So we cannot
use the version of the library.  This patch thus tries to invoke the
koji.read_config method and see if it works.  If it does, the koji
client is deemed recent enough.  Otherwise the fedabipkgdiff feature
is disabled.

* configure.ac: Try to invoke the koji.read_config method.  If it
fails then disable the fedabipkgdiff feature.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoUpdate the release text template after 1.0
Dodji Seketeli [Wed, 22 Nov 2017 14:53:32 +0000 (15:53 +0100)]
Update the release text template after 1.0

* release-text-template.txt: Update some wording.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoUpdate website for 1.0
Dodji Seketeli [Wed, 22 Nov 2017 14:54:41 +0000 (15:54 +0100)]
Update website for 1.0

* doc/website/mainpage.txt: Update after 1.0 release.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoUpdate NEWS file for 1.0 libabigail-1.0
Dodji Seketeli [Tue, 21 Nov 2017 15:13:34 +0000 (16:13 +0100)]
Update NEWS file for 1.0

* NEWS: Update for 1.0

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoAutomatically Update ChangeLog for 1.0
Dodji Seketeli [Tue, 21 Nov 2017 14:58:08 +0000 (15:58 +0100)]
Automatically Update ChangeLog for 1.0

* ChangeLog: Automatically update for 1.0

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
6 years agoBug 22438 - Emit a clear message when debug info is not found
Dodji Seketeli [Tue, 21 Nov 2017 10:09:00 +0000 (11:09 +0100)]
Bug 22438 - Emit a clear message when debug info is not found

The alternate debug info file referred to a binary can be missing,
even though the rest of the debug info is not.  In that case,
libabigail starts loading the debug info and then it crashes when
trying to get DIEs that are part of the missing alternate debug info.

This patch detects when the alternate debug info is missing, so that
abidiff and abipkgdiff can gracefully bail out, yielding a meaningful
error message.

* include/abg-dwarf-reader.h (enum abigail::dwarf_reader::status):
Add a new STATUS_ALT_DEBUG_INFO_NOT_FOUND enumerator there.
(refers_to_alt_debug_info): Declare new function.
* src/abg-dwarf-reader.cc (read_corpus_from_elf): Detect when the
referred-to alternate debug info file is not found and flip the
STATUS_ALT_DEBUG_INFO_NOT_FOUND bit of the status accordingly.  If
the debug info was found but not the alternate debug info, then do
not try to read the debug info at all.
(refers_to_alt_debug_info): Define new function.
* tools/abidiff.cc (handle_error): Define new static function.
(main): Use it, rather than handling errors preventing libabigail
from reading the corpus on a case by case basis.
tools/abipkgdiff.cc (compare): Handle the case where no alternate
debug info was found.
* tests/data/test-diff-pkg/libxfce4ui-devel-4.12.1-8.fc27.ppc64-self-report-0.txt:
New test output reference.
* tests/data/test-diff-pkg/libxfce4ui-devel-4.12.1-8.fc27.ppc64.rpm:
New test input RPM.
* tests/data/test-diff-pkg/libxfce4ui-devel-debuginfo-4.12.1-8.fc27.ppc64.rpm:
Likewise.
* tests/data/Makefile.am: Add the new test files above to source
distribution.
* tests/test-diff-pkg.cc (in_out_specs): Add a new test case from
the new input files above.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
7 years agoSupport systems where fts.h can't be used with _FILE_OFFSET_BITS set
Dodji Seketeli [Mon, 13 Nov 2017 11:52:07 +0000 (12:52 +0100)]
Support systems where fts.h can't be used with _FILE_OFFSET_BITS set

On some 32 systems (older glibc) the fts.h file cannot be included
"as-is" if the _FILE_OFFSET_BITS macro is set to 64.

This patch handles that case gently by including fts.h with
_FILE_OFFSET_BITS unset, but then by making sure fts.h can still
handle 64 bits file offset files.

* configure.ac: Detect if we are on a system where fts.h cannot be
included with _FILE_OFFSET_BITS defined.  If that is the case,
then define the BAD_FTS macro.
* src/abg-tools-utils.cc: If BAD_FTS is defined then include fts.h
with _FILE_OFFSET_BITS not defined (that is, before config.h) but
then make sure that open and fopen are 64 bits aware.
* tools/abipkgdiff.cc: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
7 years agoEdit the NEWS file a tiny little bit for 1.0
Dodji Seketeli [Wed, 8 Nov 2017 15:04:18 +0000 (16:04 +0100)]
Edit the NEWS file a tiny little bit for 1.0

* NEWS: Cleanup.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
7 years agoAutomatically Update ChangeLog for 1.0
Dodji Seketeli [Sun, 5 Nov 2017 23:35:24 +0000 (00:35 +0100)]
Automatically Update ChangeLog for 1.0

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

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
7 years agoUpdate NEWS file for 1.0 changes
Dodji Seketeli [Sun, 5 Nov 2017 23:33:09 +0000 (00:33 +0100)]
Update NEWS file for 1.0 changes

* NEWS: Update for 1.0 changes

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
7 years agoBump version number to 1.0
Dodji Seketeli [Sun, 5 Nov 2017 23:32:36 +0000 (00:32 +0100)]
Bump version number to 1.0

* configure.ac: Bump version number to 1.0

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
7 years agoDon't make system headers depend on config.h
Dodji Seketeli [Wed, 8 Nov 2017 14:23:10 +0000 (15:23 +0100)]
Don't make system headers depend on config.h

While building on an 32 bit intel platform, compilation of
abipkgdiff.cc failed because  fts.h wouldn't compile with
the macro _FILE_OFFSET_BITS set to 64.  That macro is set by config.h!

The idea of this patch is to make config.h have an effect only on
libabigail's own header files, not on system header files.

* tools/abipkgdiff.cc: Include config.h after system headers and
before libabigail's headers.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
7 years agoWire the --no-show-locs option to abidw upstream/1.0
Dodji Seketeli [Thu, 2 Nov 2017 11:46:32 +0000 (12:46 +0100)]
Wire the --no-show-locs option to abidw

Up until now, the --no-show-locs option only had effect when abidiff
was used with the --abidiff option.  It had no effect on the ABIXML
output of abidw.

This patch changes that to make it so that --no-show-locs avoids
emitting source location to the ABIXML output.

* doc/manuals/abidw.rst: Update the documentation.
* tests/test-annotate.cc: Now that --no-show-locs has an effect on
the ABIXML output, let's not use it here, because it changes the
output and we don't want that.
* tools/abidw.cc (display_usage): Fix a typo in the help string.
(load_corpus_and_write_abixml): Set the "show-locs" option to the
write_context object that we use.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
7 years agoAllow setting options to instances of xml_writer::write_context
Dodji Seketeli [Thu, 2 Nov 2017 08:52:58 +0000 (09:52 +0100)]
Allow setting options to instances of xml_writer::write_context

Up to know, it wasn't possible to set options to instances of
xml_writer::write_context.  So it wasn't possible to, say, make abidw
stop emitting source locations in the abixml.

This patch does the work necessary to set two options: annotate and
show locations.  Note that the patch doesn't yet enable abidw to stop
emitting source locations.  That will be done in a subsequent patch.

* include/abg-writer.h (create_write_context, set_show_locs)
(set_annotate): Declare new functions.
(write_corpus, write_corpus_group): Remove the output stream and
the annotate parameters as these can be retrieved from the
context.
* src/abg-writer.cc (write_context::m_show_locs): New data member.
(write_context::write_context): Initialize it.
(write_context::{get_show_locs, set_show_locs}): Add new member
functions.
(write_location): Take a write_context, rather than an output
stream.  From the context, we detect if the user did set the "show
loc" option and act accordingly.  Write the second overload in
terms of the first one.
(create_write_context, set_show_locs, set_annotate): Define new
functions.
(write_type_decl, write_qualified_type_def)
(write_pointer_type_def, write_reference_type_def)
(write_array_type_def, write_enum_type_decl, write_typedef_decl)
(write_var_decl, write_function_decl)
(write_class_decl_opening_tag, write_union_decl_opening_tag)
(write_type_tparameter, write_non_type_tparameter)
(write_function_tdecl, write_class_tdecl): Adjust the invocation
of write_location.
(write_corpus, write_corpus_group): Remove the output stream and
the annotate parameters as these can be retrieved from the
context.  Adjust.
* tools/abidw.c: (load_corpus_and_write_abixml): Create a
write_context object, set the 'annotate' option to it and use that
object to actually write out the corpus.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
7 years agoRemove useless vertical space from src/abg-writer.cc
Dodji Seketeli [Thu, 2 Nov 2017 11:51:06 +0000 (12:51 +0100)]
Remove useless vertical space from src/abg-writer.cc

* src/abg-writer.cc (class write_context): Remove useless vertical
space near the end of the class definition.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
7 years agoAdd a --suppressions option to fedabipkgdiff
Dodji Seketeli [Mon, 16 Oct 2017 12:07:55 +0000 (14:07 +0200)]
Add a --suppressions option to fedabipkgdiff

This patch adds a --suppressions option to fedabipkgdiff so that a
suppression specification can be applied to the comparisons performed.

* tools/fedabipkgdiff (abipkgdiff): If a suppression file was
provided, pass it to the underlying abipkgdiff tool.
(build_commandline_args_parser): Parse the new --suppressions
option.
* docs/manuals/fedabipkgdiff.rst: Add documentation for the new
--suppressions option.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
7 years agoHandle exceptions when global_config is not yet set in fedabipkgdiff
Dodji Seketeli [Mon, 16 Oct 2017 12:02:13 +0000 (14:02 +0200)]
Handle exceptions when global_config is not yet set in fedabipkgdiff

Handling an exception in fedabipkgdiff requires that the global_config
object is set because we reference some if its data members.

This patch avoids requiring the global_config object so that users can
still be aware of the reason of the exception when that object is not
yet set.

* tools/fedabipkgdiff: When handling an exception, if the
global_config object is not yet set then just let the exception
through.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
7 years agoFix a indentation warning from GCC 7.2.1
Dodji Seketeli [Wed, 11 Oct 2017 13:22:17 +0000 (15:22 +0200)]
Fix a indentation warning from GCC 7.2.1

* tools/abipkgdiff.cc (compare): In the overload of elf_file, fix
a mis-indentation pointed out by a GCC 7.2.1 warning.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
7 years agoCleanup a switch-case logic to avoid a GCC 7.2.1 warning
Dodji Seketeli [Wed, 11 Oct 2017 13:13:46 +0000 (15:13 +0200)]
Cleanup a switch-case logic to avoid a GCC 7.2.1 warning

* src/abg-dwarf-reader.cc (die_qualified_type_name): Cleanup a
switch case to make the form support more what we meant, and shut
down a GCC 7.2.1 warning.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
7 years agoFix -Wmisleading-indentation warning in abg-leaf-reporter.cc.
Mark Wielaard [Mon, 9 Oct 2017 07:30:37 +0000 (09:30 +0200)]
Fix -Wmisleading-indentation warning in abg-leaf-reporter.cc.

abg-leaf-reporter.cc: In member function ‘virtual void abigail::comparison::leaf_reporter::report(const abigail::comparison::qualified_type_diff&, std::ostream&, const string&) const’:
abg-leaf-reporter.cc:158:3: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
   if (!diff_to_be_reported(&d))
   ^~
abg-leaf-reporter.cc:161:5: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’
     report_local_qualified_type_changes(d, out, indent);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    * src/abg-leaf-reporter.cc (leaf_reporter::report): Fix misleading
    indentation.

Signed-off-by: Mark Wielaard <mark@klomp.org>
7 years agoAdd --impacted-changes option to kmidiff
Dodji Seketeli [Fri, 6 Oct 2017 09:25:48 +0000 (11:25 +0200)]
Add --impacted-changes option to kmidiff

kmidiff displays leaf changes by default and and it does so by *not*
showing impacted interfaces.

This patch add a --impacted-changes option to kmidiff so that it shows
the interfaces that are impacted by each leaf change.  Thus, by
default, no impacted interface is shown.

* doc/manuals/kmidiff.rst: Document the new --impacted-changes
option.
* tools/kmidif.cc (options::show_impacted_interfaces): Add new
data member.
(options::options): Initialize the new data member to false.
(display_usage): Add a description string for the new
--impacted-changes option.
(parse_command_line): Parse the new --impacted-changes option.
(set_diff_context): Update the 'show-impacted-interface' property
accordingly.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
7 years agoAdd --full-impact option to kmidiff
Dodji Seketeli [Wed, 4 Oct 2017 08:33:53 +0000 (10:33 +0200)]
Add --full-impact option to kmidiff

This patch changes the default report emitted by kmidiff.  Now, it
emits a leaf changes report by default.  And if the user wants the
classical kind of report then she can use the --full-impact option.

* doc/manuals/kmidiff.rst: Add documentation for the new
--full-impact|-f option.
* tools/kmidiff.cc (options::leaf_changes_only): Add new data
member.
(option::option): Initialize the new data member.
(display_usage): Add a documentation string for the new
--full-impact|-f option.
(parse_command_line): Parse the new --full-impact|-f option.
(set_diff_context): Set the diff context appropriately.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
7 years agoAdd a --leaf-changes-only option to abipkgdiff
Dodji Seketeli [Mon, 18 Sep 2017 14:00:23 +0000 (16:00 +0200)]
Add a --leaf-changes-only option to abipkgdiff

This patch adds the --leaf-changes-only option to abipkgdiff, just
like what we have for abidiff.  The patch also emit leaf changes
report by default when comparing two Linux Kernel packages.

The patch also adds the --impacted-interfaces and --full-impact
options.

* doc/manuals/abipkgdiff.rst: Add documentation for the new
--leaf-change-only, --impacted-interfaces and --full-impact
options.
* tools/abipkgdiff.cc (options::{leaf_changes_only,
show_impacted_interfaces, show_full_impact_report): Add new data
members.
(options::options): Initialize them.
(display_usage): Add help strings for the new --leaf-change-only,
--impacted-interfaces and --full-impact|-f options.
(set_diff_context_from_opts): Set the diff context for the
'leaf-changes-only' and 'show-impacted-interfaces' flags.
(parse_command_line): Parse the --leaf-change-only,
--impacted-interfaces and --full-impact options.  Handle the case
where the --linux-kernel-abi-whitelist|-w option is given a
whitelist *package*.
* tests/data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-3.txt:
New test output reference.
* tests/test-diff-pkg.cc (in_out_spec): Compare
data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64.rpm and
data/test-diff-pkg/spice-server-0.12.8-1.el7.x86_64.rpm with the
new --leaf-changes-only and --impacted-interfaces options, using
the new output reference above.
* tests/data/Makefile.am: Add the new test material to source
distribution.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
7 years agoInitial implementation of a --leaf-changes-only option to abidiff
Dodji Seketeli [Wed, 2 Aug 2017 16:00:23 +0000 (18:00 +0200)]
Initial implementation of a --leaf-changes-only option to abidiff

This patch allows abidiff to take the --leaf-changes-only option and
then to display only the changes that are local to any given type.
That means the reporting agent won't follow pointers when displaying
changes.  That gives less context to the ABI change reports but then
they are less cluttered.

To do this, the patch introduces a new reporting agent to libabigail:
abigail::comparison::leaf_reporter.  When given a graph of diff nodes,
this agent only reports about the leaf (local) changes.  That is, it
will *NOT* follow pointers, references, underlying types of qualified
and typedef types and things like that. It will just report about
changes that are local to a given type.

This reporting agent is then used (in lieu of the default
abigail::comparison::default_reporter agent) when the
--leaf-changes-only option is provided by the user on the command line
of abidiff.

Note that abidiff also takes the --impacted-interfaces option to so
that the leaf reporter shows the set of interfaces impacted
by each leaf change.

* doc/manuals/abidiff.rst: Add documentation the new
--leaf-changes-only and --impacted-interfaces options.
* src/abg-leaf-reporter.cc: New file.
* src/Makefile.am: Add the new src/abg-leaf-reporter.cc file to
source distribution.
* include/abg-fwd.h (get_var_size_in_bits)
(function_decl_is_less_than): Declare new functions.
(get_name): Add new overload for type_or_decl_base*.
* include/abg-ir.h (struct type_or_decl_hash, type_or_decl_equal)
(type_or_decl_base_comp): Define new types.
(artifact_sptr_set_type, artifact_ptr_set_type): Define new
typedefs.
* include/abg-comp-filter.h: Update copyright year.
(has_basic_type_name_change): Add new function declaration.
* src/abg-comp-filter.cc (decl_name_changed): Take a
type_or_decl_base rather than just a decl.  Add an overload for
diff*.
(has_basic_type_name_change): Define new function.
* include/abg-comparison.h: Update copyright year.
(string_diff_ptr_map): Define this new typedef.
(class diff_maps): Define this new class.
(diff_context::{set_corpora}): Remove this member function.
(diff_context::{set_corpus_diff, get_corpus_diff,
show_leaf_changes_only, show_impacted_interfaces,
forbid_visiting_a_node_twice_per_interface}): Declare these new
member functions.
(diff_node_visitor::priv_): Add a new pimpl data member.
(diff_node_visitor::{diff_node_visitor, get_visiting_kind,
set_visiting_kind}): Turn these into out-of-line member functions.
(diff_node_visitor::{set,get}_current_topmost_iface_diff): Add new
member functions.
(class {scope_diff, function_type_diff, corpus_diff}): Add class
leaf_reporter as a friend.
(corpus_diff::mark_leaf_diff_nodes, get_leaf_diffs): Declare new
member functions.
(diff::{visiting_a_node_twice_is_forbidden_per_interface,
parent_interface_node}): Define new member functions.
(is_diff_of_basic_type): Return a type_decl_diff* rather than just
a bool.
(is_enum_diff, is_array_diff, is_function_type, is_typedef_diff)
(is_corpus_diff): Declare new functions.
(corpus_diff::diff_stats::{num_leaf_changes,
num_leaf_changes_filtered_out, net_num_leaf_changes}): Add new
member functions.
(is_distinct_diff): Declare new function.
* include/abg-reporter.h: Forward-declare "class diff_maps".
(reporter_base::diff_to_be_reported): Declare a new virtual member
function.
(reporter_base::{report_local_typedef_changes,
report_local_reference_type_changes,
report_local_function_type_changes}): Declare new member
functions.
(class leaf_reporter): Define new type.
* src/abg-comparison-priv.h (struct diff_hash, diff_equal): Define
new types.
(diff_artifact_set_map_type): Define new typedef.
(diff_context::priv::{first_corpus_, second_corpus_}): Remove
these data members.
(diff_context::priv::{corpus_diff_, leaf_changes_only_,
reset_visited_diffs_for_each_interface_,
show_impacted_interfaces_}): Add new data members.
(diff_context::priv::priv): Adjust.
(corpus_diff::priv::{leaf_diffs_, parent_interface_}): Add new
data member.
(corpus_diff::diff_stats::priv::{num_leaf_changes,
num_leaf_changes_filtered_out}): Add new data members.
(corpus_diff::priv::count_leaf_changes): Define new member
function.
(sort_artifacts_set, get_fn_decl_or_var_decl_diff_ancestor)
(is_diff_of_global_decls): Declare new functions.
(function_comp::operator()): Factorize this out into the new
function abigail::ir::function_decl_is_less_than.
* src/abg-ir.cc (get_var_size_in_bits)
(function_decl_is_less_than): Define new functions.
(get_name): Define new overload for type_or_decl_base*.
* src/abg-comparison.cc (is_enum_diff, is_typedef_diff)
(is_array_diff, is_function_type_diff, is_corpus_diff)
(is_distinct_diff, sort_artifacts_set, is_diff_of_global_decls):
Define new functions.
(is_union_diff): Fix comment.
(diff_context::forbid_visiting_a_node_twice_per_interface): Define
new member functions.
(diff_context::set_corpus_diff, get_corpus_diff)
(diff_context::show_leaf_changes_only)
(diff_context::visiting_a_node_twice_is_forbidden_per_interface)
(diff_context::show_impacted_interfaces): Define new member
functions.
(diff_context::get_reporter): Create the reporter that matches
what diff_context::show_leaf_changes_only says.
(diff_node_visitor::priv): Define a new type.
(diff_node_visitor::{diff_node_visitor, get_visiting_kind,
set_visiting_kind, or_visiting_kind,
set_current_topmost_iface_diff, get_current_topmost_iface_diff}):
Define new out-of-line member functions.
(struct diff_maps::priv): Define new type.
(diff_maps::{diff_maps, get_type_decl_diff_map,
get_type_decl_diff_map, get_enum_diff_map, get_class_diff_map,
get_union_diff_map, get_typedef_diff_map, get_array_diff_map,
get_function_type_diff_map, get_function_decl_diff_map,
get_var_decl_diff_map, get_reference_diff_map,
get_fn_parm_diff_map, get_distinct_diff_map, insert_diff_node,
lookup_impacted_interfaces}): Define member functions.
(corpus_diff::{mark_leaf_diff_nodes, get_leaf_diffs}): Define new
member functions.
(struct leaf_diff_node_marker_visitor): Define new type.
(corpus_diff::apply_filters_and_suppressions_before_reporting):
Mark diff nodes in here.
(corpus_diff::traverse): Appropriately set the current topmost
interface into the visitor before visiting a diff node.
(compute_diff): In the overload for corpus_sptr, adjust to reflect
that we are now storing the corpus_diff in the diff context.
(is_diff_of_basic_type): Return a type_decl_diff*, not just a
bool.
(corpus_diff::priv::count_leaf_changes): Define a new member
function.
(corpus_diff::diff_stats::{num_leaf_changes,
num_leaf_changes_filtered_out, net_num_leaf_changes}): Define new
member functions.
(corpus_diff::priv::apply_filters_and_compute_diff_stats): Use the
new corpus_diff::priv::count_leaf_changes to compute the number of
leaf changes.
(corpus_diff::priv::emit_diff_stats): Emit the report about leaf
type changes when necessary.
* src/abg-reporter-priv.h (report_mem_header): Declare new
overload.
(maybe_show_relative_offset_change,): Pass the var_diff_sptr
parameter by const reference.
(represent): Pass the var_diff_sptr parameter by const reference
and take a new "local-only" flag.
(maybe_show_relative_size_change)
(maybe_report_interfaces_impacted_by_diff): Declare new functions.
* src/abg-default-reporter.cc: Adjust copyright year.
(default_reporter::{report_local_typedef_changes,
report_local_qualified_type_changes,
report_local_reference_type_changes,
report_local_function_type_changes}): Define new member functions.
(default_reporter::report): Adjust.  Add an overload for
function_type_diff&. In the overload for qualified_type_diff, if
the name of the underlying type changed, do not detail the changes
any further.  In the overload for function_decl_diff, Adjust to
use the new diff_context::get_{first, second}_corpus member
function.  In the overload for enum_diff, call the new
maybe_report_interfaces_impacted_by_diff that is advertised below.
* src/abg-reporter-priv.cc (represent): Adjust the overload for
var_diff_sptr.
(report_mem_header): Define new overload.
(maybe_show_relative_size_change)
(maybe_report_interfaces_impacted_by_diff): Define new functions.
(reporter_base::diff_to_be_reported): Define new member function.
(maybe_show_relative_offset_change): Pass the var_diff_sptr
parameter by const reference.
(represent): In the overload for var_diff_sptr, pass the
var_diff_sptr parameter by reference.  Take a 'local_only' flag.
Iisplay type changes only if we are not displaying "local changes
only".  Display size changes of data members too, when in
"local-only" mode.
* src/abg-suppression.cc (sonames_of_binaries_match)
(names_of_binaries_match): Adjust.
* tools/abidiff.cc (options::{leaf_changes_only,
show_impacted_interfaces}): Add new data members.
(display_usage): Emit usage string for the new --leaf-changes-only
and --impacted-interfaces options.
(parse_command_line): Parse the new --leaf-changes-only and the
--impacted-interfaces options.
(set_diff_context_from_opts): Set the 'show-leaf-changes' and the
'show-impacted-interfaces' flags.
* tests/data/test-diff-filter/libtest42-leaf-report-v{0,1}.so: New
test input.
* tests/data/test-diff-filter/test42-leaf-report-output-0.txt: New
test reference output.
* tests/data/test-diff-filter/test42-leaf-report-v{0,1}.cc: Source
code of the new test inputs.
* tests/test-diff-filter.cc (in_out_specs): Use the new test
inputs above in this harness.
* tests/data/test-diff-suppr/libtest35-leaf-v0.so: New test input.
* tests/data/test-diff-suppr/test35-leaf-report-0.txt: New test
reference output.
* tests/data/test-diff-suppr/test35-leaf-v{0,1}.cc: Source code of
the new test inputs.
* tests/data/test-diff-suppr/test35-leaf.suppr: Suppression
specification to use for the test35 test.
* tests/data/test-diff-suppr/libtest36-leaf-v0.so: New test input.
* tests/data/test-diff-suppr/libtest36-leaf-v1.so: Likewise.
* tests/data/test-diff-suppr/test36-leaf-report-0.txt: New
reference test output.
* tests/data/test-diff-suppr/test36-leaf-v0.cc: Source code of
test input above.
* tests/data/test-diff-suppr/test36-leaf-v1.cc: Likewise.
* tests/test-diff-suppr.cc (in_out_specs): Use the new test inputs
above in this harness.
* tests/data/Makefile.am: Add the new test inputs above to source
distribution.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
7 years agoAllow several kinds of reports to be emitted
Dodji Seketeli [Mon, 17 Jul 2017 12:18:55 +0000 (14:18 +0200)]
Allow several kinds of reports to be emitted

Right now, the reporting functionnality is implemented directly in the
comparison engine.  Being able to emit several kinds of reports is
really not practical with the current design.

This patch improves that situation by introducing an indirection
between the comparison engine and the code that emits the report.

A new abigail::comparison::reporter_base type is introduced.  That
type several contains virtual methods that knows how to implement
reporting.  Each virtual method reports about changes carried by a
kind of diff node.  In other words, abigail::comparison::reporter_base
is the interface of reporter objects.

The current reporting using the current format is thus implemented by
the new abigail::comparison::default_reporter type, which implements
the abigail::comparison::reporter_base interface.

The diff::report methods now "just" get the reporter object from the
context of the diff and invoke its right reporting interface.

So whenever someone needs to implement a new reporting format, she
needs to provide a new implementation of the
abigail::comparison::reporter_base interface and set it to the
diff_context prior to invoking the
abigail::comparison::corpus_diff::report() method.

* include/Makefile.am: Add the new abg-reporter.h header file to
source distribution.
* include/abg-comparison.h: Include the new abg-reporter.h header
file.
(diff_context::{g,s}et_reporter): Declare new accessors.
({type_diff_base, decl_diff_base, corpus_diff}::priv): Make this
be a struct rather than a class.
({decl_diff_base, class_diff, scope_diff, function_type_diff,
corpus_diff}): Declare default_reporter a friend class of these.
* include/abg-reporter.h: New file.
* src/Makefile.am: Add abg-comparison-priv.h,
abg-reporter-priv.{h,cc} and abg-default-reporter.cc files to
source distribution.
* src/abg-comparison-priv.h: New file.
* src/abg-comparison.cc (sort_enumerators)
(sort_changed_enumerators, sort_data_members)
(sort_string_function_ptr_map)
(sort_string_function_decl_diff_sptr_map)
(sort_string_var_diff_sptr_map, sort_string_elf_symbol_map)
(sort_string_var_ptr_map, sort_string_data_member_diff_sptr_map)
(sort_unsigned_data_member_diff_sptr_map)
(sort_string_diff_sptr_map, sort_string_base_diff_sptr_map)
(sort_string_base_sptr_map, sort_string_fn_parm_diff_sptr_map)
(sort_string_parm_map, get_leaf_type, sort_enumerators)
(sort_changed_enumerators): Make these functions non-static and
move them at the beginning of the file.  These functions are now
declared in abg-compared-priv.h so they can be shared privately
with other files in src/.
(diff_context::{g,s}et_reporter): Define new accessors.
({diff_context, diff, type_diff_base, decl_diff_base,
distinct_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, corpus_diff::diff_stats,
corpus_diff}::priv)
(diff_less_than_functor, enumerator_value_comp)
(changed_enumerator_comp, base_spec_comp, base_diff_comp)
(data_member_diff_comp, diff_comp, fn_parm_diff_comp, parm_comp)
(elf_symbol_comp, function_comp, function_decl_diff_comp)
(var_diff_sptr_comp): Move these type definitions to
abg-comparison-priv.h
(report_size_and_alignment_changes, report_loc_info)
(maybe_report_diff_for_member, maybe_report_diff_for_symbol)
(represent, represent_data_member)
(maybe_show_relative_offset_change, represent)
(report_size_and_alignment_changes, report_loc_info)
(report_name_size_and_alignment_changes, report_mem_header)
(maybe_report_diff_for_member, maybe_report_diff_for_symbol)
(show_linkage_name_and_aliases): Move these definitions to
abg-reporter-priv.cc.
({distinct_diff, var_diff, pointer_diff, array_diff,
reference_diff, qualified_type_diff, enum_diff,
class_or_union_diff, class_diff, base_diff, union_diff,
scope_diff, fn_parm_diff, function_type_diff, type_decl_diff,
typedef_diff, corpus_diff}::report): Use the reporter object to
report about the changes carried by the the current diff node.
* src/abg-default-reporter.cc: New file.
* src/abg-reporter-priv.h: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
7 years agoUpdate copyright year to tools/abidiff.cc
Dodji Seketeli [Wed, 4 Oct 2017 08:53:53 +0000 (10:53 +0200)]
Update copyright year to tools/abidiff.cc

* tools/abidiff.cc: Update copyright year.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
7 years agoAdd missing comment to type declaration
Dodji Seketeli [Wed, 4 Oct 2017 08:53:20 +0000 (10:53 +0200)]
Add missing comment to type declaration

* include/abg-comparison.h (struct diff_sptr_hasher): Add missing
comment.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
7 years agoMisc style fixes in abg-writer.cc
Dodji Seketeli [Wed, 4 Oct 2017 12:21:12 +0000 (14:21 +0200)]
Misc style fixes in abg-writer.cc

* src/abg-writer.cc (type_hasher): Add comment.
(write_context::record_decl_as_emitted): Remove useless newline.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
7 years agoInitialize naked canonical type
Dodji Seketeli [Wed, 4 Oct 2017 12:17:32 +0000 (14:17 +0200)]
Initialize naked canonical type

* src/abg-ir.cc (type_base::priv::priv): Initialize the naked
canonical type data member.

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