Dodji Seketeli [Thu, 28 Jun 2018 10:33:13 +0000 (12:33 +0200)]
Filter out changes like type to const type
For too long now changes to parameter types like "const char*" to
"char*" have been reported by libabigail by default. Those are not
really meaningful ABI changes, at least not in C. This patch makes
filters out those changes by default.
* include/abg-comparison.h (FN_PARM_TYPE_CV_CHANGE_CATEGORY): Add
this new enumerator to the diff_category enum. Also, OR this to
the value of the EVERYTHING_CATEGORY enumerator.
* src/abg-comp-filter.cc (has_fn_parm_type_top_cv_qual_change):
Rename has_fn_parm_type_cv_qual_change into this.
(has_fn_parm_type_cv_qual_change): New function.
(categorize_harmless_diff_node): Categorize cv qual changes as
being of category FN_PARM_TYPE_CV_CHANGE_CATEGORY.
* src/abg-comparison.cc (get_default_harmless_categories_bitmap):
Add FN_PARM_TYPE_CV_CHANGE_CATEGORY to the default harmless
categories.
* tests/data/test-diff-pkg/libICE-1.0.6-1.el6.x86_64.rpm--libICE-1.0.9-2.el7.x86_64.rpm-report-0.txt: Adjust.
Dodji Seketeli [Thu, 28 Jun 2018 08:11:18 +0000 (10:11 +0200)]
Fix redundancy detection through fn ptr and typedef paths
When analyzing the libfreetype.so binary, it appears that
libabigail's diff node redundancy marking pass is failing to detect a
redundant diff node in cases were the node is recursively referencing
itself through a path that involves function type and typedef diff
nodes.
So it is only at reporting time that we'd detect that the node is
redundant so we emit messages like "this change was reported
earlier". But When the earlier change in question is suppressed due
to, e.g, a suppression specification resulting from the user providing
abidiff with the --headers-dir{1,2} command line option, then the
change report becomes confusing, at best.
The right behaviour is to detect the node is redundant and mark it as
such, so that the reporting pass can avoid reporting it altogether.
This is what this patch does.
This patch changes the output of the runtestdiffpkg regression test.
To update the reference output, we need an additional patch to handle
a separate (but somewhat related) issue. That is going to be done in
the subsequent commit which title is:
"Filter out changes like type to const type"
* include/abg-comparison.h
(is_function_type_diff_with_local_changes)
(is_reference_or_pointer_diff_to_non_basic_distinct_types)
(peel_typedef_diff): Declare new functions.
* src/abg-comparison.cc
(is_function_type_diff_with_local_changes)
(is_reference_or_ptr_diff_to_non_basic_nor_distinct_types)
(peel_typedef_diff): Define new functions.
(is_reference_or_pointer_diff): Peel typedefs before operating.
(redundancy_marking_visitor::visit_begin): Only sibbling parameter
diff node that carry basic type changes (or distinct type changes)
are *not* marked as redundant. All other kinds of sibbling
parameter diff nodes are markes redundant. Also, rather than
never marking function type diffs as redundant by fear of missing
local changes on these, just avoid marking function type diff
nodes with local changes. It's possible to be that precise now
that we can detect that a diff node carries local changes.
* tests/data/test-diff-suppr/test37-opaque-type-v{0,1}.o: New
binary tests input.
* tests/data/test-diff-suppr/test37-opaque-type-v{0,1}.c: Source
code of the binary tests input above.
* tests/data/test-diff-suppr/test37-opaque-type-header-dir/test37-opaque-type-header-v{0,1}.h:
Headers of the binary tests input above.
* tests/data/test-diff-suppr/test37-opaque-type-report-0.txt:
Reference output for this new test.
* tests/data/Makefile.am: Add the new test material above to
source distribution.
* tests/test-diff-suppr.cc (in_out_specs): Add the new test input
above to the test harness.
Dodji Seketeli [Fri, 8 Jun 2018 02:40:07 +0000 (04:40 +0200)]
Identify a function using its symbol name and version
When a function symbol S has several versions and several different
functions with different names have those different versions of S as
underlying symbols, libabigail could mistakenly take one function for
another. This is because there are cases where libabigail identifies
the function using its symbol name without taking the version name
into account.
This patch fixes that.
* src/abg-default-reporter.cc (default_reporter::report): In C,
tell the user about the underlying function symbol name only if
said symbol name is different from the name of the function.
* src/abg-ir.cc (function_decl::get_id): If the function has an
underlying symbol, use the symbol name and version as the function
ID. But if the function symbol has an alias then use the linkage
name as the ID.
* tests/data/test-diff-pkg/elfutils-debuginfo-0.170-4.el7.x86_64.rpm:
New binary test input.
* tests/data/test-diff-pkg/elfutils-debuginfo-0.171-1.el7.x86_64.rpm: Likewise.
* tests/data/test-diff-pkg/elfutils-devel-0.170-4.el7.x86_64.rpm: Likewise.
* tests/data/test-diff-pkg/elfutils-devel-0.171-1.el7.x86_64.rpm: Likewise.
* tests/data/test-diff-pkg/elfutils-libs-0.170-4.el7.x86_64.rpm: Likewise.
* tests/data/test-diff-pkg/elfutils-libs-0.171-1.el7.x86_64.rpm: Likewise.
* tests/data/test-diff-pkg/elfutils-libs-0.170-4.el7.x86_64-multiple-sym-vers-report-0.txt:
New reference test output.
* tests/data/Makefile.am: Add the new test material above to
source distribution.
* tests/test-diff-pkg.cc (in_out_specs): Integrate the new test
inputs above into the harness.
Dodji Seketeli [Wed, 6 Jun 2018 10:05:10 +0000 (12:05 +0200)]
Explicitely detect anonymous data member changes
This patch detects when a data member becomes anonymous or when an
anonymous data member becomes non anonymous and emits an explicit
message.
* include/abg-comp-filter.h (has_anonymous_data_member_change):
Add new function declaration.
* include/abg-fwd.h (is_data_member, is_anonymous_data_member):
declare new overloads.
* src/abg-comp-filter.cc (has_anonymous_data_member_change):
Define new overloads.
* src/abg-ir.cc (is_data_member, is_anonymous_data_member): Define
new overloads.
* src/abg-reporter-priv.cc (represent): In the var_diff overload,
detect when we have anonymous data member changes and emit
explicit error messages then.
* tests/data/test-diff-dwarf/test45-anon-dm-change-report-0.txt:
New test material.
* tests/data/test-diff-dwarf/test45-anon-dm-change-v0.cc: Likewise.
* tests/data/test-diff-dwarf/test45-anon-dm-change-v0.o: Likewise.
* tests/data/test-diff-dwarf/test45-anon-dm-change-v1.cc: Likewise.
* tests/data/test-diff-dwarf/test45-anon-dm-change-v1.o: Likewise.
* tests/data/Makefile.am: Add the new test material above to source
distribution.
* tests/test-diff-dwarf.cc (in_out_specs): Add the new test
material above to the test harness.
* tests/data/test-diff-filter/test30-pr18904-rvalueref-report0.txt: Adjust.
* tests/data/test-diff-filter/test30-pr18904-rvalueref-report1.txt: Likewise.
* tests/data/test-diff-filter/test30-pr18904-rvalueref-report2.txt: Likewise.
* tests/data/test-diff-filter/test35-pr18754-no-added-syms-report-0.txt: Likewise.
Dodji Seketeli [Mon, 4 Jun 2018 15:17:27 +0000 (17:17 +0200)]
Use the flat representation for anonymous struct/unions
When referring to an anonymous struct or union, libabigail used to
name it __anonymous_struct__ or __anonymous_union__.
Now, with this patch, libabigail rather uses the flat representation
of the struct/union, e.g, struct {int foo; char bar;}.
* src/abg-ir.cc (get_class_or_union_flat_representation): Take a
const class_or_union* (like what the declaration in the header
file says), rather than just a class_or_union*.
({class,union}_decl::get_pretty_representation): For anonymous
classes and unions, use the flat representation.
* tests/data/test-annotate/libtest23.so.abi: Adjust.
* tests/data/test-annotate/libtest24-drop-fns-2.so.abi: Likewise.
* tests/data/test-annotate/libtest24-drop-fns.so.abi: Likewise.
* tests/data/test-annotate/test13-pr18894.so.abi: Likewise.
* tests/data/test-annotate/test14-pr18893.so.abi: Likewise.
* tests/data/test-annotate/test15-pr18892.so.abi: Likewise.
* tests/data/test-annotate/test17-pr19027.so.abi: Likewise.
* tests/data/test-annotate/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Likewise.
* tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi: Likewise.
* tests/data/test-annotate/test20-pr19025-libvtkParallelCore-6.1.so.abi: Likewise.
* tests/data/test-annotate/test21-pr19092.so.abi: Likewise.
* tests/data/test-diff-dwarf/test43-PR22913-report-0.txt: Likewise.
* tests/data/test-diff-dwarf/test44-anon-struct-union-report-0.txt:
New test reference output.
* tests/data/test-diff-dwarf/test44-anon-struct-union-v{0,1}.cc:
Source code of new test binary outputs.
* tests/data/test-diff-dwarf/test44-anon-struct-union-v{0,1}.o:
New test binary outputs.
* tests/data/Makefile.am: Add the new test materials above to
source districution.
* tests/test-diff-dwarf.cc (in_out_specs): Add the new test
material above to the test harness here.
* tests/data/test-diff-filter/test30-pr18904-rvalueref-report0.txt: Adjust.
* tests/data/test-diff-filter/test30-pr18904-rvalueref-report1.txt: Likewise.
* tests/data/test-diff-filter/test30-pr18904-rvalueref-report2.txt: Likewise.
* tests/data/test-diff-filter/test35-pr18754-no-added-syms-report-0.txt: Likewise.
* tests/data/test-diff-pkg/libcdio-0.94-1.fc26.x86_64--libcdio-0.94-2.fc26.x86_64-report.1.txt: Likewise.
* tests/data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-2.txt: Likewise.
* tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi: Likewise.
Dodji Seketeli [Fri, 1 Jun 2018 12:49:46 +0000 (14:49 +0200)]
Better detect when pointer and qualified types carry local changes
This is a fixup of the previous commit entitled:
"Better detect when diff nodes only carry local type changes"
In that previous commit, I missed some things about pointer, reference
and qualified types, as far as local changes detection and management
is concerned.
This commit handles those points.
* src/abg-comparison.cc
(leaf_diff_node_marker_visitor::visit_begin): Do not mark
qualified types as leaf diff nodes.
(redundancy_marking_visitor::visit_end): Changes to qualified type
are never considered local. This is just as for pointer and
reference types.
* src/abg-default-reporter.cc
(default_reporter::report_local_reference_type_changes): Display
structural changes of the pointed-to type.
(default_reporter::report): In the overload for reference_diff,
better detect and handle when we have local changes, or not.
* src/abg-ir.cc (equals): In the overload for qualified_type_def
and reference_type_de, report local type changes of the underlying
type as local changes. Add comments in the overload for pointer
type, and make it look like the the overload for reference_type.
* src/abg-leaf-reporter.cc (leaf_reporter::report): In the
overload for pointer_diff, remove end of line.
* tests/data/test-diff-filter/libtest45-basic-type-change-report-1.txt: Adjust.
* tests/data/test-diff-filter/test30-pr18904-rvalueref-report0.txt: Likewise.
* tests/data/test-diff-filter/test30-pr18904-rvalueref-report1.txt: Likewise.
* tests/data/test-diff-filter/test30-pr18904-rvalueref-report2.txt: Likewise.
* tests/data/test-diff-filter/test35-pr18754-no-added-syms-report-0.txt: Likewise.
Dodji Seketeli [Wed, 23 May 2018 09:43:29 +0000 (11:43 +0200)]
Better detect when diff nodes only carry local type changes
For some fine grain redundancy filtering, we need to know when a diff
node carries *only* a basic type change. This is because basic type
changes should not be marked as redundant; we want to see all of them
-- unlike for class or union (user defined) type changes.
And so to know if a diff node carries only a basic type change, we
need to know if a diff node only carries a local type change. If it
carries only a type change, we can safely just look at that type
change and see if it's a basic type change or not.
So, we then need to know what kind of local changes a diff node
carries: type change or non-type change. That way, we can analyze the
local changes a node carries and infer that it only carries a local
type change or if it also carries a non-type change.
This patch thus changes the diff::has_local_changes() pure virtual member
function to make it return the enum change_kind bitmask, which
describes the different kinds of local changes the diff node has.
Note that two new bit values were added to that enum:
LOCAL_TYPE_CHANGE_KIND and LOCAL_NON_TYPE_CHANGE_KIND. The first one
says that the diff node carries a local type change, while the second
one says that the diff node carries a local non-type change kind.
The various implementations of that interface are thus amended to make
them return the right bitmask. To do this, the patch updates the
various 'equals' overloads to make them return the proper enum
change_kind bitmap with the LOCAL_TYPE_CHANGE_KIND and
LOCAL_NON_TYPE_CHANGE_KIND set, if need be.
* include/abg-comparison.h ({diff, type_diff_base, decl_diff_base,
distinct_diff, var_diff, pointer_diff, reference_diff, array_diff,
qualified_type, enum_diff, class_or_union_diff, class_diff,
base_diff, scope_diff, fn_parm_diff, function_type_diff,
function_decl_diff, typedef_diff,
translation_unit_diff}::has_local_changes): Return an enum
change_kind, rather than just a bool.
(is_diff_of_basic_type): Declare an overload that takes a boolean
flag.
(is_qualified_type_diff, peel_pointer_diff, peel_reference_diff)
(peel_qualified_type, peel_pointer_or_qualified_type): Declare new
functions
* include/abg-fwd.h (peel_qualified_type):
* include/abg-ir.h (enum change_kind::{LOCAL_TYPE_CHANGE_KIND,
LOCAL_NON_TYPE_CHANGE_KIND, ALL_LOCAL_CHANGES_MASK}): Add these
three new enumerators.
* src/abg-comparison.cc ({distinct_diff, var_diff, pointer_diff,
array_diff, reference_diff, qualified_type_diff, enum_diff,
class_or_union_diff, class_diff, base_diff, scope_diff,
fn_parm_diff, function_type_diff, function_decl_diff,
type_decl_diff, typedef_diff,
translation_unit_diff}::has_local_changes): Adjust to return an
enum change_kind, rather than just a bool.
(has_local_type_change_only): Define new functions.
(has_basic_type_change_only): Use the new
has_local_type_change_only function and the new overload for
is_diff_of_basic_type.
(is_diff_of_basic_type): Define an overload that takes a boolean
flag.
(is_qualified_type_diff, peel_pointer_diff, peel_reference_diff)
(peel_qualified_type, peel_pointer_or_qualified_type): Define new
functions.
* src/abg-ir.cc (equals): In the overloads for decl_base,
scope_decl, type_base, qualified_type_diff, pointer_type_def,
reference_type_def, array_type_def, enum_type_decl, typedef_decl,
var_decl, function_type, function_decl, function_decl::parameter,
class_or_union, class_decl::base_spec and class_decl, properly set
the new abigail::ir::{LOCAL_CHANGE_KIND,
LOCAL_NON_TYPE_CHANGE_KIND, LOCAL_TYPE_CHANGE_KIND} bits.
(types_have_similar_structure): Peel qualified types and typedefs
off, first thing.
(peel_qualified_or_typedef_type): Define new function.
* tests/data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-3.txt:
Adjust.
* tests/data/test-diff-filter/libtest45-basic-type-change-report-{0,1}.txt:
New reference test reports.
* tests/data/test-diff-filter/libtest45-basic-type-change-v{0,1}.so:
New input test binaries.
* tests/data/test-diff-filter/test45-basic-type-change-v{0,1}.cc:
Source code of the input test binaries above.
* tests/data/Makefile.am: Add the new test file above to source
distribution.
* tests/test-diff-filter.cc: Add the test input above to the test
harness.
Dodji Seketeli [Fri, 18 May 2018 08:18:45 +0000 (10:18 +0200)]
Improve detection of local *type* changes
For variables and data member, we are quite gross in the way we detect
a local type change. Basically, if a textual representation of the
variable (and thus of its type) changes, then we consider that the
variable has a local (possibly type) change.
This leads us to (wrongly) report changes like this:
'struct S1 at test-44-anonymous-data-member-v0.c:1:1' changed:
type size hasn't changed
there are data member changes:
anonymous data member at offset 32 (in bits) changed from:
union {int b; float c;}
to:
union {int b; float c; char e;}
Here, you see that the textual representation of the anonymous data
member (of union type) changed from:
union {int b; float c;}
to:
union {int b; float c; char e;}
You see that although the textual representation of the type changed,
the *structure* of the type hasn't really changed. I am using the
"vague" term structure, on purpose. Here, in the case of a union, the
structure hasn't change because the size of the union hasn't changed.
This patch thus introduces the concept of "similarity of type
structures". That is, even if two types are different, if "their
structure is similar", then the type change is not a local type
change.
More precisely, here is what we mean by type similarity:
Two indirect types (pointers, references) have similar structure
if their underlying types are of the same kind and have the same
name. In this indirect types case, the size of the underlying
type does not matter.
Two direct types (i.e, non indirect) have a similar structure if
they have the same kind, name and size. Two class types have
similar structure if they have the same name, size, and if their
data members have similar types.
This patch then uses that similarity concept to detect local type
changes.
* include/abg-fwd.h (is_type_decl): Declare new overload for
type_base*.
(types_have_similar_structure): Declare new function.
* src/abg-comparison.cc
(class_or_union_diff::priv::count_filtered_changed_dm): Even when
looking at local changes only, do not forget to count nodes that
were filtered out.
* src/abg-ir.cc (types_have_similar_structure): Define new
function.
(is_type_decl): Define new overload for
type_base*.
(is_enum_type):
(equals): In the overload for var_decl, use the new
types_have_similar_structure function to detect local (type)
changes.
* src/abg-reporter-priv.cc (represent): In the overload for
var_decl, use the diff::has_local_changes function to detect local
changes, now that we can better detect local changes.
* tests/data/test-diff-filter/test44-anonymous-data-member-report-1.txt:
Adjust.
* tests/data/test-diff-suppr/test36-leaf-report-0.txt: Likewise.
Dodji Seketeli [Wed, 16 May 2018 07:30:31 +0000 (09:30 +0200)]
Remove references, arrays and fn parms from leaf diff nodes
It doesn't make sense to report about I leaf diff nodes that are
either references, arrays of function parameters. It makes more sense
to have these be reported as part of their containing diff nodes.
This patch fixes that.
* src/abg-comparison.cc
(leaf_diff_node_marker_visitor::visit_begin): Do not mark
references, array and fn parms diff nodes as leaf nodes.
* tests/data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-3.txt:
Adjust.
Dodji Seketeli [Wed, 16 May 2018 15:52:17 +0000 (17:52 +0200)]
Don't bail because "rpm" issued an error
It turns out that the "rpm -qp --provides <rpm>" can issue an error on
el6 (on the RPMs that we feed it) and still provide us with the output
we want. So we shouldn't just fail in that case.
This patch handles that case.
* src/abg-tools-utils.cc (get_dsos_provided_by_rpm): Do not fail
when the rpm command issues an error. Rather rely on the presence
of a valid output or not. Also, make sure to filter out error
outputs so that they don't appear in the general output of tools
using this function.
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.
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.
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.
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.
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.
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.
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>
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.
[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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.