2014-11-20 10:26:30 +00:00
|
|
|
|
|
|
|
EXTRA_DIST = \
|
|
|
|
test-read-write/test0.xml \
|
|
|
|
test-read-write/test1.xml \
|
|
|
|
test-read-write/test2.xml \
|
|
|
|
test-read-write/test3.xml \
|
|
|
|
test-read-write/test4.xml \
|
|
|
|
test-read-write/test5.xml \
|
|
|
|
test-read-write/test6.xml \
|
|
|
|
test-read-write/test7.xml \
|
|
|
|
test-read-write/test8.xml \
|
|
|
|
test-read-write/test9.xml \
|
|
|
|
test-read-write/test10.xml \
|
|
|
|
test-read-write/test11.xml \
|
|
|
|
test-read-write/test12.xml \
|
|
|
|
test-read-write/test13.xml \
|
|
|
|
test-read-write/test14.xml \
|
|
|
|
test-read-write/test15.xml \
|
|
|
|
test-read-write/test16.xml \
|
|
|
|
test-read-write/test17.xml \
|
|
|
|
test-read-write/test18.xml \
|
|
|
|
test-read-write/test19.xml \
|
|
|
|
test-read-write/test20.xml \
|
|
|
|
test-read-write/test21.xml \
|
|
|
|
test-read-write/test22.xml \
|
|
|
|
test-read-write/test23.xml \
|
|
|
|
test-read-write/test24.xml \
|
|
|
|
test-read-write/test25.xml \
|
2014-12-07 16:05:38 +00:00
|
|
|
test-read-write/test26.xml \
|
2014-11-20 10:26:30 +00:00
|
|
|
\
|
|
|
|
test-write-read-archive/test0.xml \
|
|
|
|
test-write-read-archive/test1.xml \
|
|
|
|
test-write-read-archive/test2.xml \
|
|
|
|
test-write-read-archive/test3.xml \
|
|
|
|
test-write-read-archive/test4.xml \
|
|
|
|
\
|
|
|
|
test-core-diff/report0.txt \
|
|
|
|
test-core-diff/report1.txt \
|
|
|
|
test-core-diff/report2.txt \
|
|
|
|
test-core-diff/report3.txt \
|
|
|
|
test-core-diff/report4.txt \
|
|
|
|
test-core-diff/report5.txt \
|
|
|
|
test-core-diff/report6.txt \
|
|
|
|
test-core-diff/report7.txt \
|
|
|
|
test-core-diff/report8.txt \
|
|
|
|
test-core-diff/report9.txt \
|
|
|
|
test-core-diff/report10.txt \
|
|
|
|
test-core-diff/report11.txt \
|
|
|
|
test-core-diff/report12.txt \
|
|
|
|
test-core-diff/report13.txt \
|
|
|
|
\
|
|
|
|
test-abidiff/test-enum0-v0.cc.bi \
|
|
|
|
test-abidiff/test-enum0-v1.cc.bi \
|
|
|
|
test-abidiff/test-enum0-report.txt \
|
|
|
|
test-abidiff/test-enum1-v0.cc.bi \
|
|
|
|
test-abidiff/test-enum1-v1.cc.bi \
|
|
|
|
test-abidiff/test-enum1-report.txt \
|
|
|
|
test-abidiff/test-qual-type0-v0.cc.bi \
|
|
|
|
test-abidiff/test-qual-type0-v1.cc.bi \
|
|
|
|
test-abidiff/test-qual-type0-report.txt \
|
|
|
|
test-abidiff/test-struct0-v0.cc.bi \
|
|
|
|
test-abidiff/test-struct0-v1.cc.bi \
|
|
|
|
test-abidiff/test-struct0-report.txt \
|
|
|
|
test-abidiff/test-struct1-v0.cc.bi \
|
|
|
|
test-abidiff/test-struct1-v1.cc.bi \
|
|
|
|
test-abidiff/test-struct1-report.txt \
|
|
|
|
test-abidiff/test-var0-v0.cc.bi \
|
|
|
|
test-abidiff/test-var0-v1.cc.bi \
|
18166 - Abidiff fails with internal on Libtirpc ABI in XML format
It turns out the support for reading the native libabigail XML format
is falling short since the work on (late) type canonicalizing.
The type ID -> XML node map is wrongly considered as being per corpus
data while it should be per translation unit data; type IDs are unique
only for a given translation unit.
The code to walk a XML sub-tree to perform the ID -> node mapping is
wrongly walking all the XML node *after* the sub-tree node too; that
is, it walks the entire corpus file starting from the XML sub-tree
node it's given. It should only walk the sub-tree it's given.
These two issues normally solve the crash reported here. But then
there are other related issues too.
The native XML format reader doesn't populate the set of exported
declarations for the current corpus it's building.
This patch addresses all these issues and makes tests/test-abidiff.cc
supports corpus files for a new regression test.
* src/abg-reader.cc (read_context::m_exported_decls_builder_): New
data member.
(read_context::read_context): Initialize it.
(read_context::{type_is_from_translation_unit,
get_exported_decls_builder, set_exported_decls_builder,
maybe_add_fn_to_exported_decls, maybe_add_fn_to_exported_decls,
type_id_new_in_translation_unit}): New member functions.
(read_context::clear_per_translation_unit_data): Clear id->xml
node map here ...
(read_context::clear_per_corpus_data): ... not here.
(read_context::walk_xml_node_to_map_type_ids): Only walk the
sub-tree we are asked to walk.
(read_translation_unit_from_input): Cleanup.
(read_corpus_from_input): Wire populating of exported declarations
of the current corpus.
(build_function_decl, build_var_decl): Populate exported
declarations of the current corpus here.
(build_type_decl, build_qualified_type_decl)
(build_pointer_type_def, build_reference_type_def)
(build_array_type_def, build_enum_type_decl, build_type_decl)
(build_template_tparameter): Adjust assert on ID to make sure
it's the first type it's being defined in the current translation
unit.
* tests/data/test-abidiff/test-corpus0-report0.txt: New test
reference output.
* tests/data/test-abidiff/test-corpus0-v{0,1}.so.abi: New test
input.
* tests/test-abidiff.cc (specs): Add the test inputs above to the
list of inputs over which to run the test harness.
(main): Support reading corpora too, as this test harness was
reading just translation units before.
(tests/data/Makefile.am): Add test material above to source
distribution.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-03-30 07:50:44 +00:00
|
|
|
test-abidiff/test-var0-report.txt \
|
|
|
|
test-abidiff/test-corpus0-v0.so.abi \
|
|
|
|
test-abidiff/test-corpus0-v1.so.abi \
|
|
|
|
test-abidiff/test-corpus0-report0.txt \
|
2014-11-20 10:26:30 +00:00
|
|
|
\
|
|
|
|
test-diff-dwarf/test0-v0.cc \
|
|
|
|
test-diff-dwarf/test0-v0.o \
|
|
|
|
test-diff-dwarf/test0-v1.cc \
|
|
|
|
test-diff-dwarf/test0-v1.o \
|
|
|
|
test-diff-dwarf/test0-report.txt \
|
|
|
|
test-diff-dwarf/test1-v0.cc \
|
|
|
|
test-diff-dwarf/test1-v0.o \
|
|
|
|
test-diff-dwarf/test1-v1.cc \
|
|
|
|
test-diff-dwarf/test1-v1.o \
|
|
|
|
test-diff-dwarf/test1-report.txt \
|
|
|
|
test-diff-dwarf/test2-v0.cc \
|
|
|
|
test-diff-dwarf/test2-v0.o \
|
|
|
|
test-diff-dwarf/test2-v1.cc \
|
|
|
|
test-diff-dwarf/test2-v1.o \
|
|
|
|
test-diff-dwarf/test2-report.txt \
|
|
|
|
test-diff-dwarf/test3-v0.cc \
|
|
|
|
test-diff-dwarf/test3-v0.o \
|
|
|
|
test-diff-dwarf/test3-v1.cc \
|
|
|
|
test-diff-dwarf/test3-v1.o \
|
|
|
|
test-diff-dwarf/test3-report.txt \
|
|
|
|
test-diff-dwarf/test4-v0.cc \
|
|
|
|
test-diff-dwarf/test4-v0.o \
|
|
|
|
test-diff-dwarf/test4-v1.cc \
|
|
|
|
test-diff-dwarf/test4-v1.o \
|
|
|
|
test-diff-dwarf/test4-report.txt \
|
|
|
|
test-diff-dwarf/test5-v0.cc \
|
|
|
|
test-diff-dwarf/test5-v0.o \
|
|
|
|
test-diff-dwarf/test5-v1.cc \
|
|
|
|
test-diff-dwarf/test5-v1.o \
|
|
|
|
test-diff-dwarf/test5-report.txt \
|
|
|
|
test-diff-dwarf/test6-v0.cc \
|
|
|
|
test-diff-dwarf/test6-v0.o \
|
|
|
|
test-diff-dwarf/test6-v1.cc \
|
|
|
|
test-diff-dwarf/test6-v1.o \
|
|
|
|
test-diff-dwarf/test6-report.txt \
|
|
|
|
test-diff-dwarf/test7-v0.cc \
|
|
|
|
test-diff-dwarf/test7-v0.o \
|
|
|
|
test-diff-dwarf/test7-v1.cc \
|
|
|
|
test-diff-dwarf/test7-v1.o \
|
|
|
|
test-diff-dwarf/test7-report.txt \
|
|
|
|
test-diff-dwarf/test8-v0.cc \
|
|
|
|
test-diff-dwarf/test8-v0.o \
|
|
|
|
test-diff-dwarf/test8-v1.cc \
|
|
|
|
test-diff-dwarf/test8-v1.o \
|
|
|
|
test-diff-dwarf/test8-report.txt \
|
|
|
|
test-diff-dwarf/test9-v0.cc \
|
|
|
|
test-diff-dwarf/libtest9-v0.so \
|
|
|
|
test-diff-dwarf/test9-v1.cc \
|
|
|
|
test-diff-dwarf/libtest9-v1.so \
|
|
|
|
test-diff-dwarf/test9-report.txt \
|
|
|
|
test-diff-dwarf/test10-v0.cc \
|
|
|
|
test-diff-dwarf/test10-v0.o \
|
|
|
|
test-diff-dwarf/test10-v1.cc \
|
|
|
|
test-diff-dwarf/test10-v1.o \
|
|
|
|
test-diff-dwarf/test10-report.txt \
|
|
|
|
test-diff-dwarf/test11-v0.cc \
|
|
|
|
test-diff-dwarf/test11-v0.o \
|
|
|
|
test-diff-dwarf/test11-v1.cc \
|
|
|
|
test-diff-dwarf/test11-v1.o \
|
|
|
|
test-diff-dwarf/test11-report.txt \
|
|
|
|
test-diff-dwarf/test12-v0.c \
|
|
|
|
test-diff-dwarf/libtest12-v0.so \
|
|
|
|
test-diff-dwarf/test12-v1.c \
|
|
|
|
test-diff-dwarf/libtest12-v1.so \
|
|
|
|
test-diff-dwarf/test12-version-script \
|
|
|
|
test-diff-dwarf/test12-report.txt \
|
|
|
|
test-diff-dwarf/test13-v0.cc \
|
|
|
|
test-diff-dwarf/test13-v0.o \
|
|
|
|
test-diff-dwarf/test13-v1.cc \
|
|
|
|
test-diff-dwarf/test13-v1.o \
|
|
|
|
test-diff-dwarf/test13-report.txt \
|
|
|
|
test-diff-dwarf/test14-inline-v0.cc \
|
|
|
|
test-diff-dwarf/test14-inline-v0.o \
|
|
|
|
test-diff-dwarf/test14-inline-v1.cc \
|
|
|
|
test-diff-dwarf/test14-inline-v1.o \
|
|
|
|
test-diff-dwarf/test14-inline-report.txt \
|
|
|
|
test-diff-dwarf/test15-enum-v0.cc \
|
|
|
|
test-diff-dwarf/test15-enum-v0.o \
|
|
|
|
test-diff-dwarf/test15-enum-v1.cc \
|
|
|
|
test-diff-dwarf/test15-enum-v1.o \
|
|
|
|
test-diff-dwarf/test15-enum-report.txt \
|
|
|
|
test-diff-dwarf/test16-syms-only-v0.o \
|
|
|
|
test-diff-dwarf/test16-syms-only-v1.o \
|
|
|
|
test-diff-dwarf/test16-syms-only-v0.cc \
|
|
|
|
test-diff-dwarf/test16-syms-only-v1.cc \
|
|
|
|
test-diff-dwarf/test16-syms-only-report.txt \
|
|
|
|
test-diff-dwarf/test17-non-refed-syms-v0.o \
|
|
|
|
test-diff-dwarf/test17-non-refed-syms-v1.o \
|
2014-12-07 22:34:21 +00:00
|
|
|
test-diff-dwarf/test17-non-refed-syms-report-0.txt \
|
2014-11-20 10:26:30 +00:00
|
|
|
test-diff-dwarf/test17-non-refed-syms-v0.cc \
|
|
|
|
test-diff-dwarf/test17-non-refed-syms-v1.cc \
|
|
|
|
test-diff-dwarf/libtest18-alias-sym-v0.so \
|
|
|
|
test-diff-dwarf/libtest18-alias-sym-v1.so \
|
|
|
|
test-diff-dwarf/test18-alias-sym-report-0.txt \
|
|
|
|
test-diff-dwarf/test18-alias-sym-v0.cc \
|
|
|
|
test-diff-dwarf/test18-alias-sym-v1.cc \
|
|
|
|
test-diff-dwarf/test18-alias-sym-version-script \
|
Support reading and comparing soname from ELF files
Libabigail's DWARF reader doesn't read the DT_SONAME tag from the
.dynamic section. The abigail::corpus type doesn't have a property
for that tag either. And the comparison engine doesn't take that tag
in when comparing corpora.
This patch modifies the DWARF reader to read the DT_SONAME and
DT_NEEDED tags from the .dynamic section. The value of DT_SONAME tag
is then saved in the new corpus property accessed by the new
abigail::corpus::get_soname() accessor. The comparison engine has
also been modified to compare the sonames of two corpora being
compared. Note that the value of the DT_NEEDED elf tag is saved in a
new corpus property that is accessed via the new
abigail::corpus::get_needed() getter. This property is not used yet.
This patch also adds a unit test for this new feature.
* include/abg-corpus.h (corpus::{get_needed, set_needed,
get_soname, set_soname}): Declare new accessors.
* src/abg-corpus.cc (corpus::priv::{needed, soname}): New data
members.
(corpus::{get_needed, set_needed, get_soname, set_soname}): Define
new accessors.
(corpus::is_empty): Take dt_needed and dt_soname in account in
computing empty-ness.
* src/abg-dwarf-reader.cc (read_context::{dt_needed_,
dt_soname_}): New data members.
(read_context::{dt_needed, dt_soname}): New accessors.
(read_context::load_dt_soname_and_needed): New member function.
(read_corpus_from_elf): Call the new
read_context::load_dt_soname_and_needed() to read the dt_soname
and dt_needed tags. Set them to the corpus.
* include/abg-comparison.h (diff_context::show_soname_change):
Declare new accessors.
* src/abg-comparison.cc (diff_context::priv::show_soname_change_):
New data member.
(diff_context::priv::priv): Initialize the new data member
diff_context::priv::show_soname_change_.
(diff_context::show_soname_change): Define new accessors.
(corpus_diff::priv::sonames_equal_): New data member.
(corpus_diff::priv::priv): Initialize the new data member
corpus_diff::priv::sonames_equal_.
(corpus_diff::length): Take the new priv_->sonames_equals_ data
member in account.
(corpus_diff::{report, priv::emit_diff_stats}): If the sonames
changed and we are allowed to report it, then report it.
(compute_diff): In the variant for corpus_diff, do not forget to
compare the sonames.
* src/abg-reader.cc (build_needed, read_elf_needed_from_input):
Define new static functions.
(read_corpus_from_input): Read the 'soname' attribute from the
'abi-corpus' xml element node.
* src/abg-writer.cc (write_elf_needed): Define new static
function.
(write_corpus_to_native_xml): Write a new 'elf-needed' xml element
node that contains one xml 'dependency' element node per
dependency to emit. This uses the new write_elf_needed() function
above.
* tests/data/test-diff-dwarf/libtest19-soname-v0.so: New test
input data.
* tests/data/test-diff-dwarf/libtest19-soname-v1.so: Likewise.
* tests/data/test-diff-dwarf/test19-soname-report-0.txt: Likewise.
* tests/data/test-diff-dwarf/test19-soname-v0.c: Source code of
the first binary above.
* tests/data/test-diff-dwarf/test19-soname-v1.c: Source code of
the second binary above.
* tests/test-diff-dwarf.cc (in_out_specs): Add the test input
above to the list of test input to run this harness on.
* tests/data/Makefile.am: Add the new test input data above.
* tests/data/test-read-dwarf/test{0,1}.abi: Adjust.
* tests/data/test-read-dwarf/test{2,3,4,6,}.so.abi: Adjust.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-12-07 20:01:20 +00:00
|
|
|
test-diff-dwarf/libtest19-soname-v0.so \
|
|
|
|
test-diff-dwarf/libtest19-soname-v1.so \
|
|
|
|
test-diff-dwarf/test19-soname-report-0.txt \
|
|
|
|
test-diff-dwarf/test19-soname-v0.cc \
|
|
|
|
test-diff-dwarf/test19-soname-v1.cc \
|
2014-12-09 11:37:23 +00:00
|
|
|
test-diff-dwarf/libtest20-add-fn-parm-v0.so \
|
|
|
|
test-diff-dwarf/libtest20-add-fn-parm-v1.so \
|
|
|
|
test-diff-dwarf/test20-add-fn-parm-report-0.txt \
|
|
|
|
test-diff-dwarf/test20-add-fn-parm-v0.c \
|
|
|
|
test-diff-dwarf/test20-add-fn-parm-v1.c \
|
Un-share diff nodes in the comparison IR
Until now, the diff nodes of the comparison IR were shared. That is,
two diffs about the same subjects were represented by the same diff
node that would appear twice in the tree.
This was preventing us from spotting e.g, the first occurrence of a
diff node that would later (in the tree) turn to be redundant because
all redundant diff nodes are represented by the same diff node
pointer.
This patch now makes each diff node be different, as far of pointer
comparison is concerned. But it introduces the concept of canonical
diff node to ease the comparison between two diff nodes. Two diff
nodes that are equal have the same canonical diff node.
With this facility, it's now possible to tell the difference between
diff nodes that are (structurally) equal. It's not possible to say
things like "this is the first or second occurrence of the redundant
diff node foo'.
* include/abg-ir.h: Prefix the doc string with "///", rather than
writing it inside a /**/ comment.
* include/abg-comparison.h (function_decl_diff)
(function_decl_diff_sptr, fn_parm_diff, fn_parm_diff_sptr)
(var_diff_sptr, base_diff, class_diff, class_diff_sptr): Move
these class & typedef decls to the top of the file.
(string_changed_base_map, string_changed_parm_map)
(unsigned_changed_parm_map, changed_function_ptr)
(string_changed_function_ptr_map): Remove these typedefs.
(string_base_diff_sptr_map, string_fn_parm_diff_sptr_map)
(unsigned_fn_parm_diff_sptr_map, string_var_diff_sptr_map)
(unsigned_var_diff_sptr_map, string_function_decl_diff_sptr_map)
(string_var_diff_ptr_map): New typedefs.
(diff_context::{has_diff_for,add_diff}): Make these member
functions private.
(diff_context::{set_canonical_diff_for,
set_or_get_canonical_diff_for}): Declare new private member
functions.
(diff_context::{get_canonical_diff_for,
initialize_canonical_diff}): New public member functions.
(diff_context::maybe_apply_filters): Set the default value of the
'traverse_nodes_once' parameter to false.
(compute_diff): Make the overload for class_decl_sptr friend of
the diff_context class.
(class diff): Make the diff_context class a friend of this one.
(diff::set_canonical_diff): Declare new private member function.
(diff::get_canonical_diff): Declare new public member function.
(diff::children_nodes): Make this return a vector<diff_sptr>, rather
than a vector<diff*>.
(diff::append_child_node): Make this take a diff_sptr rather than
a diff*.
(class fn_parm_diff): Declare new type.
(compute_diff): Declare new overload for the new
function_decl::parameter_sptr.
(function_decl_diff::subtype_changed_parms): Return a
string_fn_parm_diff_sptr_map rather than a string_changed_parm.
(function_decl_diff::children_nodes): Return a vector<diff_sptr>.
(function_decl_diff::append_child_node): Take a diff_sptr.
(function_decl_diff::changed_functions): Return a
string_function_decl_diff_sptr_map.
(function_decl_diff::changed_variables): Return a
string_var_diff_sptr.
(class function_decl::parameter): Make this a pimpled class.
Also, make it inherit decl_base.
(equals): New overload for function_decl::parameter.
(struct function_decl::parameter::hash): Declare this.
(ir_node_visitor::visit): Declare new overload for
function_decl::parameter.
* src/abg-comparison.cc: Add doc-string about the internal
representation of the comparison engine and also about the concept
of canonical diff of the comparison engine.
(RETURN_IF_BEING_REPORTED_OR_WAS_REPORTED_EARLIER)
(RETURN_IF_BEING_REPORTED_OR_WAS_REPORTED_EARLIER2)
(RETURN_IF_BEING_REPORTED_OR_WAS_REPORTED_EARLIER3): Consider the
canonical diff when trying to know if the current node was
reported earlier.
(diff_context::priv::canonical_diffs): New data member.
(diff_context::{get_canonical_diff_for, set_canonical_diff_for,
set_or_get_canonical_diff_for, initialize_canonical_diff}): Define
new member functions.
(diff_context::{diff_has_been_traversed, mark_diff_as_traversed):
Consider canonical diff for these tests and actions.
(diff::priv::children_): Change the type of this to
vector<diff_sptr>.
(diff::canonical_diff_): New data member.
(diff::diff): Initialize the diff::canonical_diff_ data member.
(diff::begin_traversing): Mark the canonical diff node too.
(diff::is_traversing): Consider the canonical diff node in this
test.
(diff::end_traversing): Make the canonical diff node too. Also
mark the current node as having been traversed.
(diff::children_nodes): Return a vector<diff_sptr> type.
(diff::{get_canonical_diff, set_canonical_diff}): Define new
member functions.
(diff::append_child_node): Take a diff_sptr type parameter.
(diff::{reported_once, currently_reporting}): Flag the canonical
diff node too. And consider the canonical diff node when checking
the flag.
(diff::traverse): No need to mark the node as being traversed
because the diff::end_traversing() function does it now. Adjust
the code because diff::children_nodes() now returns
vector<diff_sptr>.
({distinct_diff, var_diff, pointer_diff, array_diff,
reference_diff, qualified_type_diff, enum_diff, class_diff,
base_diff, scope_diff, function_decl_diff, typedef_diff,
corpus_diff}::chain_into_hierarchy): Adjust to the new type that
diff::append_child_node() takes. Also, take into account that the
diff nodes are now un-shared.
(compute_diff_for_distinct_kinds, compute_diff_for_types)
(compute_diff): Do not share diff nodes anymore. Initialize the
canonical diff node for the new created node.
(represent): Take a var_diff_sptr rather than two var_decl_sptr.
Adjust. Also take in account the fact that diff nodes are not
shared anymore, and that they do have canonical diffs.
(var_diff::type_diff): Make the computation of the type_diff of
the var_diff be lazy. This avoids infinite (recursive) creation
of diff nodes when a class diff node has a sub-type of data member
that is a class diff node too.
(var_diff::report): Detect redundant reporting of this kind of
diff node.
(class_diff::priv::changed_bases_): Change the type of this to
string_base_diff_sptr_map.
(class_diff::priv::subtype_changed_dm_): Change the type of this
to string_var_diff_sptr_map.
(class_diff::priv::changed_dm_): Change the type of this to
unsigned_var_diff_sptr_map.
(class_diff::priv::{count_filtered_subtype_changed_dm,
count_filtered_bases}): Do not take a diff_context_sptr anymore.
(class_diff::ensure_lookup_tables_populated): changed_bases_
subtype_changed_dm_ and changed_dm_ are now *NOT* shared diff
nodes anymore.
(class_diff::priv::base_has_changed): Adjust.
(class_diff::priv::subtype_changed_dm): Adjust.
(class_diff::priv::count_filtered_bases): Adjust as changed_bases_
is now a map of un-shared diff nodes.
(class_diff::priv::count_filtered_subtype_changed_dm): Adjust as
subtype_changed_dm_ is now a map of un-shared diff nodes.
(class_diff::priv::{count_filtered_changed_mem_fns,
count_filtered_inserted_mem_fns, count_filtered_deleted_mem_fns,
}): Adjust for change of the default parameter value of
diff_context::maybe_apply_filters().
(class_diff::~class_diff): New destructor.
(class_diff::changed_bases): Return a string_base_diff_sptr_map&
type.
(class_diff::{inserted_data_members, deleted_data_members,
changed_member_fns}): Add doc strings.
(struct changed_data_member_comp): Remove.
(struct var_diff_comp): New comparison functor.
(sort_changed_data_members): Remove.
(sort_var_diffs): Define new sorting function.
(class_diff::report): Adjust.
(fn_parm_diff::*): Define member types and functions of the new
fn_parm_diff type.
(function_decl_diff::priv::{subtype_changed_parms_,
changed_parms_by_id_}): Make these take a map of fn_parm_diff_sptr
nodes.
(function_decl_diff::ensure_lookup_tables_populated): Adjust to
the fact that priv_->subtype_changed_parms_ and
priv_->priv_->changed_parms_by_id_ now are maps of un-shared
fn_parm_diff_sptr nodes.
(function_decl_diff::subtype_changed_parms): Adjust.
(struct changed_parm_comp): Remove.
(struct fn_parm_diff_comp): New comparison functor.
(sort_changed_parm_map): Remove.
(sort_string_fn_parm_diff_sptr_map): New sorting function.
(function_decl_diff::report): Adjust.
(corpus_diff::priv::children_): Change the type of this to
vector<diff_sptr>.
(corpus_diff::priv::changed_fns_): Changed the type of this to
string_function_decl_diff_sptr_map.
(corpus_diff::priv::changed_vars_): Changed the type of this to
string_var_diff_sptr_map.
(corpus_diff::priv::ensure_lookup_tables_populated): Adjust.
(corpus_diff::priv::apply_filters_and_compute_diff_stats}):
Adjust. Do not need to clear redundancy categorization anymore
because the diff nodes are not shared anymore.
(corpus_diff::priv::categorize_redundant_changed_sub_nodes):
Adjust.
(corpus_diff::priv::clear_redundancy_categorization): Adjust.
(corpus_diff::changed_variables): Adjust.
(struct changed_function_ptr_comp): Remove.
(struct function_decl_diff_comp): New comparison functor.
(sort_string_changed_function_ptr_map): Remove.
(sort_string_function_decl_diff_sptr_map): Define new sorting
function.
(struct changed_vars_comp): Remove.
(struct var_diff_sptr_comp): New comparison functor.
(sort_changed_vars): Remove.
(sort_string_var_diff_sptr_map): Define new sorting function.
(corpus_diff::report): Adjust.
(corpus_diff::traverse): Adjust.
({category_propagation_visitor,
suppression_categorization_visitor}::visit_end): Adjust.
(clear_redundancy_categorization): Adjust.
* src/abg-hash.cc (function_decl::parameter::hash::operator):
Adjust.
* src/abg-ir.cc (struct function_decl::parameter::priv): Define
here as part of pimpl-ifying the function_decl::parameter type.
(function_decl::parameter::*): Define here the member functions as
part of pimpl-ifying the function_decl::parameter type.
(equals): Define the overload for function_decl::parameter here
too.
(ir_node_visitor::visit(function_decl::parameter*)): Define this.
* tests/data/test-abicompat/test0-fn-changed-report-0.txt: Adjust.
* tests/data/test-diff-suppr/test5-fn-suppr-report-0.txt: Adjust.
* tests/data/test-diff-dwarf/libtest21-redundant-fn-v0.so: New
test input data.
* tests/data/test-diff-dwarf/libtest21-redundant-fn-v1.so:
Likewise.
* tests/data/test-diff-dwarf/test21-redundant-fn-v0.cc: Source
code for test input binary above.
* tests/data/test-diff-dwarf/test21-redundant-fn-v1.cc: Likewise.
* tests/data/test-diff-dwarf/test21-redundant-fn-report-0.txt: New
test input data.
* tests/data/test-diff-dwarf/libtest22-changed-parm-c-v0.so: New
test input data.
* tests/data/test-diff-dwarf/libtest22-changed-parm-c-v1.so:
Likewise.
* tests/data/test-diff-dwarf/test22-changed-parm-c-v0.c: Source
code for test input binary above.
* tests/data/test-diff-dwarf/test22-changed-parm-c-v1.c: Likewise.
* tests/test-diff-dwarf.cc (in_out_spec): Add the new test input
data to the vector the test inputs to run this harness over.
* tests/data/test-diff-suppr/test8-redundant-fn-report-0.txt: New
test input data.
* tests/data/test-diff-suppr/test8-redundant-fn-report-1.txt:
Likewise.
* tests/data/test-diff-suppr/libtest8-redundant-fn-v0.so: New test
input binary.
* tests/data/test-diff-suppr/libtest8-redundant-fn-v1.so: Likewise.
* tests/data/test-diff-suppr/test8-redundant-fn-v0.cc: Source code
code for binary test input above.
* tests/data/test-diff-suppr/test8-redundant-fn-v1.cc: Likewise.
* tests/data/test-diff-suppr/test9-changed-parm-c-report-0.txt:
New test input data.
* tests/data/test-diff-suppr/test9-changed-parm-c-report-1.txt:
Likewise.
* tests/data/test-diff-suppr/libtest9-changed-parm-c-v0.so: New
test input binary.
* tests/data/test-diff-suppr/libtest9-changed-parm-c-v1.so: New
test input binary.
* tests/data/test-diff-suppr/test9-changed-parm-c-v0.c: Source
code for binary test input above.
* tests/data/test-diff-suppr/test9-changed-parm-c-v1.c: Likewise.
* tests/test-diff-suppr.cc (in_out_specs): Add the new test input
data to the vector the test inputs to run this harness over.
* tests/data/Makefile.am: Add the new files to the source
distribution.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-12-26 12:22:16 +00:00
|
|
|
test-diff-dwarf/libtest21-redundant-fn-v0.so \
|
|
|
|
test-diff-dwarf/libtest21-redundant-fn-v1.so \
|
|
|
|
test-diff-dwarf/test21-redundant-fn-report-0.txt \
|
|
|
|
test-diff-dwarf/test21-redundant-fn-v0.cc \
|
|
|
|
test-diff-dwarf/test21-redundant-fn-v1.cc \
|
|
|
|
test-diff-dwarf/libtest22-changed-parm-c-v0.so \
|
|
|
|
test-diff-dwarf/libtest22-changed-parm-c-v1.so \
|
|
|
|
test-diff-dwarf/test22-changed-parm-c-report-0.txt \
|
|
|
|
test-diff-dwarf/test22-changed-parm-c-v0.c \
|
|
|
|
test-diff-dwarf/test22-changed-parm-c-v1.c \
|
2015-01-07 12:45:53 +00:00
|
|
|
test-diff-dwarf/libtest-23-diff-arch-v0-32.so \
|
|
|
|
test-diff-dwarf/libtest-23-diff-arch-v0-64.so \
|
|
|
|
test-diff-dwarf/test-23-diff-arch-report-0.txt \
|
|
|
|
test-diff-dwarf/test-23-diff-arch-v0.cc \
|
2015-04-15 13:03:59 +00:00
|
|
|
test-diff-dwarf/libtest24-added-fn-parms-v0.so \
|
|
|
|
test-diff-dwarf/libtest24-added-fn-parms-v1.so \
|
|
|
|
test-diff-dwarf/test24-added-fn-parms-report-0.txt \
|
|
|
|
test-diff-dwarf/test24-added-fn-parms-v0.c \
|
|
|
|
test-diff-dwarf/test24-added-fn-parms-v1.c \
|
|
|
|
test-diff-dwarf/libtest25-removed-fn-parms-v0.so \
|
|
|
|
test-diff-dwarf/libtest25-removed-fn-parms-v1.so \
|
|
|
|
test-diff-dwarf/test25-removed-fn-parms-report-0.txt \
|
|
|
|
test-diff-dwarf/test25-removed-fn-parms-v0.c \
|
|
|
|
test-diff-dwarf/test25-removed-fn-parms-v1.c \
|
2014-11-20 10:26:30 +00:00
|
|
|
\
|
|
|
|
test-read-dwarf/test0 \
|
|
|
|
test-read-dwarf/test0.abi \
|
|
|
|
test-read-dwarf/test0.cc \
|
|
|
|
test-read-dwarf/test1 \
|
|
|
|
test-read-dwarf/test1.abi \
|
|
|
|
test-read-dwarf/test1.cc \
|
|
|
|
test-read-dwarf/test2.h \
|
|
|
|
test-read-dwarf/test2-0.cc \
|
|
|
|
test-read-dwarf/test2-1.cc \
|
|
|
|
test-read-dwarf/test2.so \
|
|
|
|
test-read-dwarf/test2.so.abi \
|
|
|
|
test-read-dwarf/test3.c \
|
|
|
|
test-read-dwarf/test3.so \
|
|
|
|
test-read-dwarf/test3.so.abi \
|
|
|
|
test-read-dwarf/test4.c \
|
|
|
|
test-read-dwarf/test4.so \
|
|
|
|
test-read-dwarf/test4.so.abi \
|
|
|
|
test-read-dwarf/test5.cc \
|
|
|
|
test-read-dwarf/test5.o \
|
|
|
|
test-read-dwarf/test5.o.abi \
|
|
|
|
test-read-dwarf/test6.cc \
|
|
|
|
test-read-dwarf/test6.so \
|
|
|
|
test-read-dwarf/test6.so.abi \
|
|
|
|
test-read-dwarf/test7.cc \
|
|
|
|
test-read-dwarf/test7.so \
|
|
|
|
test-read-dwarf/test7.so.abi \
|
|
|
|
test-read-dwarf/test8-qualified-this-pointer.cc \
|
|
|
|
test-read-dwarf/test8-qualified-this-pointer.so \
|
|
|
|
test-read-dwarf/test8-qualified-this-pointer.so.abi \
|
|
|
|
\
|
|
|
|
test-diff-filter/test0-v0.cc \
|
|
|
|
test-diff-filter/test0-v1.cc \
|
|
|
|
test-diff-filter/test0-v0.o \
|
|
|
|
test-diff-filter/test0-v1.o \
|
|
|
|
test-diff-filter/test0-report.txt \
|
|
|
|
test-diff-filter/test01-report.txt \
|
|
|
|
test-diff-filter/test1-v0.cc \
|
|
|
|
test-diff-filter/test1-v1.cc \
|
|
|
|
test-diff-filter/test1-v0.o \
|
|
|
|
test-diff-filter/test1-v1.o \
|
|
|
|
test-diff-filter/test1-report.txt \
|
|
|
|
test-diff-filter/test2-v0.cc \
|
|
|
|
test-diff-filter/test2-v1.cc \
|
|
|
|
test-diff-filter/test2-v0.o \
|
|
|
|
test-diff-filter/test2-v1.o \
|
|
|
|
test-diff-filter/test2-report.txt \
|
|
|
|
test-diff-filter/test3-v0.cc \
|
|
|
|
test-diff-filter/test3-v1.cc \
|
|
|
|
test-diff-filter/test3-v0.o \
|
|
|
|
test-diff-filter/test3-v1.o \
|
|
|
|
test-diff-filter/test3-report.txt \
|
|
|
|
test-diff-filter/test4-v0.cc \
|
|
|
|
test-diff-filter/test4-v1.cc \
|
|
|
|
test-diff-filter/test4-v0.o \
|
|
|
|
test-diff-filter/test4-v1.o \
|
|
|
|
test-diff-filter/test4-report.txt \
|
|
|
|
test-diff-filter/test5-v0.cc \
|
|
|
|
test-diff-filter/test5-v1.cc \
|
|
|
|
test-diff-filter/test5-v0.o \
|
|
|
|
test-diff-filter/test5-v1.o \
|
|
|
|
test-diff-filter/test5-report.txt \
|
|
|
|
test-diff-filter/test6-v0.cc \
|
|
|
|
test-diff-filter/test6-v1.cc \
|
|
|
|
test-diff-filter/test6-v0.o \
|
|
|
|
test-diff-filter/test6-v1.o \
|
|
|
|
test-diff-filter/test6-report.txt \
|
|
|
|
test-diff-filter/test7-v0.cc \
|
|
|
|
test-diff-filter/test7-v1.cc \
|
|
|
|
test-diff-filter/test7-v0.o \
|
|
|
|
test-diff-filter/test7-v1.o \
|
|
|
|
test-diff-filter/test7-report.txt \
|
|
|
|
test-diff-filter/test8-v0.cc \
|
|
|
|
test-diff-filter/test8-v1.cc \
|
|
|
|
test-diff-filter/test8-v0.o \
|
|
|
|
test-diff-filter/test8-v1.o \
|
|
|
|
test-diff-filter/test8-report.txt \
|
|
|
|
test-diff-filter/test9-v0.cc \
|
|
|
|
test-diff-filter/test9-v1.cc \
|
|
|
|
test-diff-filter/test9-v0.o \
|
|
|
|
test-diff-filter/test9-v1.o \
|
|
|
|
test-diff-filter/test9-report.txt \
|
|
|
|
test-diff-filter/test10-v0.cc \
|
|
|
|
test-diff-filter/test10-v1.cc \
|
|
|
|
test-diff-filter/test10-v0.o \
|
|
|
|
test-diff-filter/test10-v1.o \
|
|
|
|
test-diff-filter/test10-report.txt \
|
|
|
|
test-diff-filter/test11-v0.cc \
|
|
|
|
test-diff-filter/test11-v1.cc \
|
|
|
|
test-diff-filter/test11-v0.o \
|
|
|
|
test-diff-filter/test11-v1.o \
|
|
|
|
test-diff-filter/test11-report.txt \
|
|
|
|
test-diff-filter/test12-v0.cc \
|
|
|
|
test-diff-filter/test12-v1.cc \
|
|
|
|
test-diff-filter/test12-v0.o \
|
|
|
|
test-diff-filter/test12-v1.o \
|
|
|
|
test-diff-filter/test12-report.txt \
|
|
|
|
test-diff-filter/test13-v0.cc \
|
|
|
|
test-diff-filter/test13-v1.cc \
|
|
|
|
test-diff-filter/test13-v0.o \
|
|
|
|
test-diff-filter/test13-v1.o \
|
|
|
|
test-diff-filter/test13-report.txt \
|
|
|
|
test-diff-filter/test14-v0.cc \
|
|
|
|
test-diff-filter/test14-v1.cc \
|
|
|
|
test-diff-filter/test14-v0.o \
|
|
|
|
test-diff-filter/test14-v1.o \
|
|
|
|
test-diff-filter/test14-0-report.txt \
|
|
|
|
test-diff-filter/test14-1-report.txt \
|
|
|
|
test-diff-filter/test15-v0.cc \
|
|
|
|
test-diff-filter/test15-v1.cc \
|
|
|
|
test-diff-filter/test15-v0.o \
|
|
|
|
test-diff-filter/test15-v1.o \
|
|
|
|
test-diff-filter/test15-0-report.txt \
|
|
|
|
test-diff-filter/test15-1-report.txt \
|
|
|
|
test-diff-filter/test16-v0.cc \
|
|
|
|
test-diff-filter/test16-v1.cc \
|
|
|
|
test-diff-filter/test16-v0.o \
|
|
|
|
test-diff-filter/test16-v1.o \
|
Recognize cyclic diff tree nodes as being redundant
Okay I need to introduce some vocabulary here. Suppose we have the
version 1 of a library named library-v1.so which source code is:
struct S
{
int m0;
struct S* m2;
};
int
foo(struct S* ptr)
{
return ptr;
}
And now suppose we have a version 2 of that library named
library-v2.so which source code is modified so that a new data member
is inserted into struct S:
struct S
{
int m0;
char m1; /* <--- a new data member is inserted here. */
struct S* m2;
};
int
foo(struct S* ptr)
{
return ptr;
}
struct S is said to be a cyclic type because it contains a (data)
member which type refers to struct S itself, namely, the type of the
data member S::m2 is struct S*, which refers to struct S.
So, by analogy, the diff node tree that represents the changes of
struct S is also said to be cyclic, for similar reasons: the diff
node of the change of S::m2 refers to the diff node of the change of
the type of S::m2, namely the diff node of struct S*, which refers to
the diff node for the change of struct S itself.
Now let's talk about redundancy. When walking the diff node tree of
struct S in a depth-first manner, at some point, we look at the diff
node for the data member S::m2, and we end up looking at the diff node
of its type which is the diff node for struct S*; we keep walking and
eventually we look the diff node of the change of the underlying type
of struct S, which is the diff node of struct S, and hah! that is a
redundant node because it's the first node that we visited when
visiting the diff node of ... struct S! So the diff tree node for
the change of struct S is not only a cyclic node, it's a redundant
diff node as well, and its second occurrence is located at the point
of appearance of data member S::m2. Hence the wording "cyclic
redundant diff tree node". There! We have our vocabulary all set now.
This patch enhances the code of the comparison engine so that a cyclic
diff tree node is marked as redundant from the point of its second
occurrence, onward.
First the patch separates the notion of visiting a diff node from the
notion of traversing it. Now traversing a diff node means visiting it
and visiting its children nodes. So one can visit a node without
traversing it, but one can not traverse a node without visiting it.
So, when walking diff node trees, we need to avoid ending up in
infinite loop in presence of cyclic nodes. This is why re-traversing
a node that is already being traversed is forbidden by this patch, but
visiting a node that is being visited is allowed. Before this patch,
the notions of visiting and traversing were conflated in one and were
not very clear; and one couldn't visit a node that was currently being
visited. As a result, in presence of a cyclic node, its redundant
nature wasn't being recognized, and so the diff tree node was not
being flagged as being redundant. Diff reports were then cluttered by
redundant references to changes involving cyclic types.
* include/abg-comparison.h (enum visiting_kind): Rename
enumerator DO_NOT_MARK_VISITED_NODES_AS_TRAVERSED into
DO_NOT_MARK_VISITED_NODES_AS_VISITED.
(diff_context::diff_has_been_visited): Rename
diff_context::diff_has_been_traversed into this.
(diff_context::mark_diff_as_visited): Rename
diff_context::mark_diff_as_traversed into this.
(diff_context::forget_visited_diffs): Rename
diff_context::forget_traversed_diffs into this.
(diff_context::forbid_visiting_a_node_twice): Rename
diff_context::forbid_traversing_a_node_twice into this.
(diff_context::visiting_a_node_twice_is_forbidden): Rename
diff_context::traversing_a_node_twice_is_forbidden into this.
(diff::is_traversing): Move this from protected to public.
* src/abg-comparison.cc (diff_context::priv::visited_diff_nodes_):
Rename diff_context::priv::traversed_diff_nodes_ into this.
(diff_context::priv::forbid_visiting_a_node_twice_): Rename
diff_context::priv::forbid_traversing_a_node_twice_ into this.
(diff_context::priv::priv): Adjust.
(diff_context::diff_has_been_visited): Rename
diff_context::diff_has_been_traversed into this. Adjust.
(diff_context::mark_diff_as_visited): Rename
diff_context::mark_diff_as_traversed into this. Adjust.
(diff_context::forget_visited_diffs): Rename
diff_context::forget_traversed_diffs into this. Adjust.
(diff_context::forbid_visiting_a_node_twice): Rename
diff_context::forbid_traversing_a_node_twice into this.
(diff_context::visiting_a_node_twice_is_forbidden): Rename
diff_context::traversing_a_node_twice_is_forbidden into this.
(diff_context::maybe_apply_filters): Adjust.
(diff::end_traversing): Remove the 'mark_as_traversed' parameter
of this. Remove the visited-marking code.
(diff::traverse): This is the crux of the changes of this patch.
Avoid traversing a node that is being traversed, but one can visit
a node being visited. Also, traversing a node means visiting it
and visiting its children nodes.
(diff::is_filtered_out): Simplify logic for filtering redundant
code. Basically all nodes that are redundant are filtered. All
the complicated logic that was due when diff nodes were shared is
not relevant anymore.
(corpus_diff::priv::categorize_redundant_changed_sub_nodes)
(propagate_categories, apply_suppressions)
(diff_node_printer::diff_node_printer, print_diff_tree)
(categorize_redundant_changed_sub_nodes)
(clear_redundancy_categorization)
(clear_redundancy_categorization): Adjust.
(redundancy_marking_visitor::visit_begin): Adjust. Also, if the
current diff node is already being traversed (that's a clyclic
node) then mark it as redundant.
* src/abg-comp-filter.cc (apply_filter): Adjust.
* tests/data/test-diff-filter/test16-report-2.txt: New test input data.
* tests/data/test-diff-filter/libtest25-cyclic-type-v{0,1}.so: New
test input binaries.
* tests/data/test-diff-filter/test25-cyclic-type-v{0,1}.cc: Source
code for the test input binaries.
* tests/data/test-diff-filter/test25-cyclic-type-report-0.txt: New
test input data.
* tests/data/test-diff-filter/test25-cyclic-type-report-1.txt:
Likewise.
* tests/test-diff-filter.cc (in_out_specs): Add the new test
inputs above to the list of test input data over which to run this
test harness.
* tests/data/Makefile.am: Add the new test files above to source
distribution.
* tests/data/test-diff-filter/test16-report.txt: Adjust.
* tests/data/test-diff-filter/test17-0-report.txt: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-01-24 19:51:16 +00:00
|
|
|
test-diff-filter/test16-report.txt \
|
|
|
|
test-diff-filter/test16-report-2.txt \
|
2014-11-20 10:26:30 +00:00
|
|
|
test-diff-filter/test17-v0.cc \
|
|
|
|
test-diff-filter/test17-v1.cc \
|
|
|
|
test-diff-filter/test17-v0.o \
|
|
|
|
test-diff-filter/test17-v1.o \
|
|
|
|
test-diff-filter/test17-0-report.txt \
|
|
|
|
test-diff-filter/test17-1-report.txt \
|
|
|
|
test-diff-filter/test18-v0.cc \
|
|
|
|
test-diff-filter/test18-v1.cc \
|
|
|
|
test-diff-filter/test18-v0.o \
|
|
|
|
test-diff-filter/test18-v1.o \
|
|
|
|
test-diff-filter/test18-report.txt \
|
|
|
|
test-diff-filter/test19-enum-v0.cc \
|
|
|
|
test-diff-filter/test19-enum-v1.cc \
|
|
|
|
test-diff-filter/test19-enum-v0.o \
|
|
|
|
test-diff-filter/test19-enum-v1.o \
|
|
|
|
test-diff-filter/test19-enum-report-0.txt \
|
|
|
|
test-diff-filter/test19-enum-report-1.txt \
|
|
|
|
test-diff-filter/test20-inline-v0.cc \
|
|
|
|
test-diff-filter/test20-inline-v1.cc \
|
|
|
|
test-diff-filter/test20-inline-v0.o \
|
|
|
|
test-diff-filter/test20-inline-v1.o \
|
|
|
|
test-diff-filter/test20-inline-report-0.txt \
|
|
|
|
test-diff-filter/test20-inline-report-1.txt \
|
Make determining of compatible types complete
Until now, two types that are different were considered compatible if
one type is a typedef of the other. This is useful because two
different types, if compatible, are not ABI-incompatible. This patch
extends the concept of compatible types to types which might have
sub-types that are typedefs of each others, including function types.
Note implementing this required that I fixed various other things left
and right. Like style fixes, crash avoiding fixes, etc.
* include/abg-fwd.h (is_reference_type, is_function_type)
(is_method_type): Declare new predicates.
* include/abg-ir.h (class qualified_type_def): Pimpl this class.
(qualified_type_def::qualified_type_def): Use the convenience
type_base_sptr typedef.
(qualified_type_def::{get_cv_quals, set_cv_quals}): Use the
qualified_type_def::CV type rather than char.
(qualified_type_def::get_underlying_type): Use the convenience
type_base_sptr typedef.
(pointer_type_def::pointer_type_def): Likewise.
(function_decl::parameter::parameter): Add a new constructor.
* src/abg-ir.cc (is_reference_type, is_function_type)
(is_method_type): Define new predicates.
(class qualified_type_def::priv): Define this new private type,
for the purpose of Pimpl-ifying the qualified_type_def class.
(qualified_type_def::{qualified_type_def, build_name,
get_cv_quals_string_prefix, get_underlying_type}): Adjust for the
purpose of Pimpl-ifying the qualified_type_def class.
(equals): In the qualified_type_def, reference_type_def overloads,
trust the fact that we have operator== overload for the
type_base_sptr. This avoids crashes for when the (possible)
underlying type is null.
(pointer_type_def::operator==): Likewise.
(strip_typedef): Make this recursively strip
typedefs from sub-types.
(types_are_compatible): Handle null types.
(qualified_type_def::{get_cv_quals, set_cv_quals}): Handle
qualified_type_def::CV rather than char.
(pointer_type_def::pointer_type_def): Use the convenience
type_base_sptr typedef.
* include/abg-comparison.h (distinct_diff::compatible_child_diff):
Declare new member function.
* src/abg-comparison.cc (distinct_diff::compatible_child_diff):
Define new member function.
(distinct_diff::chain_into_hierarchy):
Chain the compatible child diff node that might be present.
(distinct_diff::report): Now when a distinct diff carries a
compatible change, mention it in the report.
* src/abg-comp-filter.cc (is_compatible_change): A compatible
change can now involve types that are not typedefs. Only their
sub-types need to be involved with typedef-ness.
* tests/data/test-diff-dwarf/test{2,4,5}-report.txt: Adjust.
* tests/data/test-diff-filter/libtest21-compatible-vars-v0.so: New
test data input.
* tests/data/test-diff-filter/libtest21-compatible-vars-v1.so: Likewise.
* tests/data/test-diff-filter/test21-compatible-vars-report-0.txt Likewise.
* tests/data/test-diff-filter/test21-compatible-vars-report-1.txt Likewise.
* tests/data/test-diff-filter/test21-compatible-vars-v0.cc: Source
code for the first data input binary above.
* tests/data/test-diff-filter/test21-compatible-vars-v1.cc: Source
code for the second data input binary above.
* tests/data/test-diff-filter/libtest22-compatible-fns-v0.so: New
test data input.
* tests/data/test-diff-filter/libtest22-compatible-fns-v1.so Likewise.
* tests/data/test-diff-filter/test22-compatible-fns-report-0.txt:
New test data input.
* tests/data/test-diff-filter/test22-compatible-fns-report-1.txt: Likewise.
* tests/data/test-diff-filter/test22-compatible-fns-v0.c: Source
code for the first test data input binary above.
* tests/data/test-diff-filter/test22-compatible-fns-v1.c: Source
code for the second test data input binary above.
* tests/data/Makefile.am: Add the new test input data to source
distribution.
* tests/test-diff-filter.cc (in_out_specs): Add the new test data
input above to the list of test data this harness has to be run
over.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-12-10 06:25:01 +00:00
|
|
|
test-diff-filter/libtest21-compatible-vars-v0.so \
|
|
|
|
test-diff-filter/libtest21-compatible-vars-v1.so \
|
|
|
|
test-diff-filter/test21-compatible-vars-report-0.txt \
|
|
|
|
test-diff-filter/test21-compatible-vars-report-1.txt \
|
|
|
|
test-diff-filter/test21-compatible-vars-v0.cc \
|
|
|
|
test-diff-filter/test21-compatible-vars-v1.cc \
|
|
|
|
test-diff-filter/libtest22-compatible-fns-v0.so \
|
|
|
|
test-diff-filter/libtest22-compatible-fns-v1.so \
|
|
|
|
test-diff-filter/test22-compatible-fns-report-0.txt \
|
|
|
|
test-diff-filter/test22-compatible-fns-report-1.txt \
|
|
|
|
test-diff-filter/test22-compatible-fns-v0.c \
|
|
|
|
test-diff-filter/test22-compatible-fns-v1.c \
|
Temporarily disable redundant diff report elimination
So, this is all about problem report
https://sourceware.org/bugzilla/show_bug.cgi?id=17693.
When redundant diff node reporting is enabled and when a diff node
appears twice in a diff tree, we detect that and the second occurrence
of the diff node is flagged as being redundant. Later at diff tree
node reporting time, the redundant diff node is not reported.
The problem is that diff nodes are canonicalized. That is, when the
same change is present twice in a diff, the same diff node is going to
be present twice. So flagging the second occurrence as being
redundant amounts as flagging the first occurrence as being redundant
too! So at reporting time, the diff tree visitor that walks the diff
tree nodes will avoid reporting the two occurrences of diff tree nodes
altogether. This is what happens in the example of the bug above. I
am reproducing the example here for convenience:
So suppose we have a first version of a library named lib-v0.so which
is made of this C code:
int add(int a, int b)
{
}
Then suppose that code was changed in a subsequent version of the
library named lib-v1.so, leading to the following code:
int add(float a, float b)
{
}
So, the diff tree node for the 'add' function is going to have several
child diff tree nodes, among which, one that carries the change for
the first parameter (int a becoming float a) and the one carrying the
change for the second parameter (int b becoming float b).
The diff tree node for the second parameter is going to be same diff
tree node as the one for the first parameter because what counts is
the change in the *type* of the parameter. Thus, the diff tree node
for the second parameter is going to be marked as being redundant; and
so is the first parameter.
So abidiff lib-v0.so lib-v1.so yields:
Functions changes summary: 0 Removed, 0 Changed (1 filtered out), 0 Added
function
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
You can see that even the function 'add' is not mentioned in the
report. This is because it has also been considered as being
redundant because of a phenomenon named 'propagation'. The
redundant-ness of the children nodes of the diff tree node of the
'add' function is propagated to the diff tree node of the add function
itself because that add function diff tree node has no child but
redundant diff children nodes. This categorization behaviour is
correct.
What is not correct is that only the second child node of the add
function diff tree node should have been marked redundant.
I am going to tackle this issue a bit later. For now, I am
temporarily disabling redundancy categorization for diff tree nodes by
default. Hence this patch.
With this patch, abidiff lib-v0.so lib-v1.so yields:
Functions changes summary: 0 Removed, 1 Changed, 0 Added function
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
1 function with some indirect sub-type change:
[C]'function int add(int, int)' has some indirect sub-type changes:
parameter 0 of type 'int' changed:
name changed from 'int' to 'float'
parameter 1 of type 'int' changed:
name changed from 'int' to 'float'
Note how the change on the second parameter appears equal to the
change on the first.
* src/abg-comparison.cc
(diff_context::priv::priv): Show redundant changes by default.
(categorize_redundancy): Do not categorize redundancy if the
diff_context says that we shouldn't.
* tools/abicompat.cc (options::show_redundant): New data member.
(options::options): Initialize to true.
(display_usage): Add new help string for new --no-redundant and
--redundant options.
(parse_command_line): Parse new --no-redundant and --redundant
command line options.
(main): Initialize the diff context with respect to the
options::show_redundant property.
* tools/abidiff.cc (options::options): Initialize the
show_redundant_changes data member to true.
(display_usage): Show new help string for the new --no-redundant
command line option.
(parse_command_line): Parse the new --no-redundant command line
option.
* tests/data/test-diff-filter/libtest23-redundant-fn-parm-change-v0.so:
New test data input.
* tests/data/test-diff-filter/libtest23-redundant-fn-parm-change-v1.so:
Likewise.
* tests/data/test-diff-filter/test23-redundant-fn-parm-change-report-0.txt:
Likewise.
* tests/data/test-diff-filter/test23-redundant-fn-parm-change-v0.c:
Source code for the first binary above.
* tests/data/test-diff-filter/test23-redundant-fn-parm-change-v1.c:
Source code for the second binary above.
* tests/data/Makefile.am: Add the new test data input to source
distribution.
* tests/test-abicompat.cc (in_out_specs): Add --no-redundant to
abicompat when we don't want it to show redundant diff reports.
* test-diff-filter.cc (in_out_specs): Likewise for abidiff.
* test-diff-suppr.cc (in_out_specs): Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-12-10 17:24:41 +00:00
|
|
|
test-diff-filter/libtest23-redundant-fn-parm-change-v0.so \
|
|
|
|
test-diff-filter/libtest23-redundant-fn-parm-change-v1.so \
|
|
|
|
test-diff-filter/test23-redundant-fn-parm-change-report-0.txt \
|
|
|
|
test-diff-filter/test23-redundant-fn-parm-change-v0.c \
|
|
|
|
test-diff-filter/test23-redundant-fn-parm-change-v1.c \
|
2014-12-12 13:30:31 +00:00
|
|
|
test-diff-filter/libtest24-compatible-vars-v0.so \
|
|
|
|
test-diff-filter/libtest24-compatible-vars-v1.so \
|
|
|
|
test-diff-filter/test24-compatible-vars-report-0.txt \
|
|
|
|
test-diff-filter/test24-compatible-vars-report-1.txt \
|
|
|
|
test-diff-filter/test24-compatible-vars-v0.c \
|
|
|
|
test-diff-filter/test24-compatible-vars-v1.c \
|
Recognize cyclic diff tree nodes as being redundant
Okay I need to introduce some vocabulary here. Suppose we have the
version 1 of a library named library-v1.so which source code is:
struct S
{
int m0;
struct S* m2;
};
int
foo(struct S* ptr)
{
return ptr;
}
And now suppose we have a version 2 of that library named
library-v2.so which source code is modified so that a new data member
is inserted into struct S:
struct S
{
int m0;
char m1; /* <--- a new data member is inserted here. */
struct S* m2;
};
int
foo(struct S* ptr)
{
return ptr;
}
struct S is said to be a cyclic type because it contains a (data)
member which type refers to struct S itself, namely, the type of the
data member S::m2 is struct S*, which refers to struct S.
So, by analogy, the diff node tree that represents the changes of
struct S is also said to be cyclic, for similar reasons: the diff
node of the change of S::m2 refers to the diff node of the change of
the type of S::m2, namely the diff node of struct S*, which refers to
the diff node for the change of struct S itself.
Now let's talk about redundancy. When walking the diff node tree of
struct S in a depth-first manner, at some point, we look at the diff
node for the data member S::m2, and we end up looking at the diff node
of its type which is the diff node for struct S*; we keep walking and
eventually we look the diff node of the change of the underlying type
of struct S, which is the diff node of struct S, and hah! that is a
redundant node because it's the first node that we visited when
visiting the diff node of ... struct S! So the diff tree node for
the change of struct S is not only a cyclic node, it's a redundant
diff node as well, and its second occurrence is located at the point
of appearance of data member S::m2. Hence the wording "cyclic
redundant diff tree node". There! We have our vocabulary all set now.
This patch enhances the code of the comparison engine so that a cyclic
diff tree node is marked as redundant from the point of its second
occurrence, onward.
First the patch separates the notion of visiting a diff node from the
notion of traversing it. Now traversing a diff node means visiting it
and visiting its children nodes. So one can visit a node without
traversing it, but one can not traverse a node without visiting it.
So, when walking diff node trees, we need to avoid ending up in
infinite loop in presence of cyclic nodes. This is why re-traversing
a node that is already being traversed is forbidden by this patch, but
visiting a node that is being visited is allowed. Before this patch,
the notions of visiting and traversing were conflated in one and were
not very clear; and one couldn't visit a node that was currently being
visited. As a result, in presence of a cyclic node, its redundant
nature wasn't being recognized, and so the diff tree node was not
being flagged as being redundant. Diff reports were then cluttered by
redundant references to changes involving cyclic types.
* include/abg-comparison.h (enum visiting_kind): Rename
enumerator DO_NOT_MARK_VISITED_NODES_AS_TRAVERSED into
DO_NOT_MARK_VISITED_NODES_AS_VISITED.
(diff_context::diff_has_been_visited): Rename
diff_context::diff_has_been_traversed into this.
(diff_context::mark_diff_as_visited): Rename
diff_context::mark_diff_as_traversed into this.
(diff_context::forget_visited_diffs): Rename
diff_context::forget_traversed_diffs into this.
(diff_context::forbid_visiting_a_node_twice): Rename
diff_context::forbid_traversing_a_node_twice into this.
(diff_context::visiting_a_node_twice_is_forbidden): Rename
diff_context::traversing_a_node_twice_is_forbidden into this.
(diff::is_traversing): Move this from protected to public.
* src/abg-comparison.cc (diff_context::priv::visited_diff_nodes_):
Rename diff_context::priv::traversed_diff_nodes_ into this.
(diff_context::priv::forbid_visiting_a_node_twice_): Rename
diff_context::priv::forbid_traversing_a_node_twice_ into this.
(diff_context::priv::priv): Adjust.
(diff_context::diff_has_been_visited): Rename
diff_context::diff_has_been_traversed into this. Adjust.
(diff_context::mark_diff_as_visited): Rename
diff_context::mark_diff_as_traversed into this. Adjust.
(diff_context::forget_visited_diffs): Rename
diff_context::forget_traversed_diffs into this. Adjust.
(diff_context::forbid_visiting_a_node_twice): Rename
diff_context::forbid_traversing_a_node_twice into this.
(diff_context::visiting_a_node_twice_is_forbidden): Rename
diff_context::traversing_a_node_twice_is_forbidden into this.
(diff_context::maybe_apply_filters): Adjust.
(diff::end_traversing): Remove the 'mark_as_traversed' parameter
of this. Remove the visited-marking code.
(diff::traverse): This is the crux of the changes of this patch.
Avoid traversing a node that is being traversed, but one can visit
a node being visited. Also, traversing a node means visiting it
and visiting its children nodes.
(diff::is_filtered_out): Simplify logic for filtering redundant
code. Basically all nodes that are redundant are filtered. All
the complicated logic that was due when diff nodes were shared is
not relevant anymore.
(corpus_diff::priv::categorize_redundant_changed_sub_nodes)
(propagate_categories, apply_suppressions)
(diff_node_printer::diff_node_printer, print_diff_tree)
(categorize_redundant_changed_sub_nodes)
(clear_redundancy_categorization)
(clear_redundancy_categorization): Adjust.
(redundancy_marking_visitor::visit_begin): Adjust. Also, if the
current diff node is already being traversed (that's a clyclic
node) then mark it as redundant.
* src/abg-comp-filter.cc (apply_filter): Adjust.
* tests/data/test-diff-filter/test16-report-2.txt: New test input data.
* tests/data/test-diff-filter/libtest25-cyclic-type-v{0,1}.so: New
test input binaries.
* tests/data/test-diff-filter/test25-cyclic-type-v{0,1}.cc: Source
code for the test input binaries.
* tests/data/test-diff-filter/test25-cyclic-type-report-0.txt: New
test input data.
* tests/data/test-diff-filter/test25-cyclic-type-report-1.txt:
Likewise.
* tests/test-diff-filter.cc (in_out_specs): Add the new test
inputs above to the list of test input data over which to run this
test harness.
* tests/data/Makefile.am: Add the new test files above to source
distribution.
* tests/data/test-diff-filter/test16-report.txt: Adjust.
* tests/data/test-diff-filter/test17-0-report.txt: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-01-24 19:51:16 +00:00
|
|
|
test-diff-filter/libtest25-cyclic-type-v0.so \
|
|
|
|
test-diff-filter/libtest25-cyclic-type-v1.so \
|
|
|
|
test-diff-filter/test25-cyclic-type-report-0.txt \
|
|
|
|
test-diff-filter/test25-cyclic-type-report-1.txt \
|
|
|
|
test-diff-filter/test25-cyclic-type-v0.cc \
|
|
|
|
test-diff-filter/test25-cyclic-type-v1.cc \
|
Fix chaining of descendant node of qualified type diff node
While looking at the abidiff report emitted for two versions of the
TBB library, I noticed that some diff nodes were not marked as
redundant as they should be. As a result, they were being reported as
having "been reported earlier", which seems to be an acceptable cruft
to me especially now that the comparison IR can do proper redundancy
detection and marking.
I tracked that down and it's because the child node of a
qualified_type_diff is just the underlying type diff node, whereas
during reporting, we report about the leaf underlying type diff node,
which can be different from the just the underlying type diff node
because the later is always non-qualified.
The fix is to make the child node of qualified_type_diff be the leaf
underlying type diff node, so that diff tree walking (for the purpose
of redundancy detection) and reporting are all looking at the same
tree.
* include/abg-comparison.h
(qualified_type_diff::leaf_underlying_type_diff): Declare new
accessor.
* src/abg-comparison.cc (get_leaf_type): Forward declare this
static function.
(qualified_type_diff::priv::leaf_underlying_type_diff): Define new
data member.
(qualified_type_diff::leaf_underlying_type_diff): Define this new
accessor.
(qualified_type_diff::chain_into_hierarchy): Call
leaf_underlying_type_diff() here rather than
underlying_type_diff().
(qualified_type_diff::report): Use leaf_underlying_type_diff()
rather than re-computing the diff between the two leaf underlying
type diff nodes.
* libtest26-qualified-redundant-node-v{0,1}.so: New binary test
input files.
* tests/data/test-diff-filter/test26-qualified-redundant-node-v{0,1}.cc:
Source code for the binary test inputs above.
* tests/test-diff-filter.cc (int_out_spec): Add the new test input
to the vector of test input data over which to run this test
harness.
* tests/data/test-diff-filter/test26-qualified-redundant-node-report-{0,1.txt:
New test input file.
* tests/data/Makefile.am: Add the new test input data to the
source distribution.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-01-26 10:38:08 +00:00
|
|
|
test-diff-filter/libtest26-qualified-redundant-node-v0.so \
|
|
|
|
test-diff-filter/libtest26-qualified-redundant-node-v1.so \
|
|
|
|
test-diff-filter/test26-qualified-redundant-node-report-0.txt \
|
|
|
|
test-diff-filter/test26-qualified-redundant-node-report-1.txt \
|
|
|
|
test-diff-filter/test26-qualified-redundant-node-v0.cc \
|
|
|
|
test-diff-filter/test26-qualified-redundant-node-v1.cc \
|
2015-03-13 12:30:01 +00:00
|
|
|
test-diff-filter/libtest27-redundant-and-filtered-children-nodes-v0.so \
|
|
|
|
test-diff-filter/libtest27-redundant-and-filtered-children-nodes-v1.so \
|
|
|
|
test-diff-filter/test27-redundant-and-filtered-children-nodes-report-0.txt \
|
|
|
|
test-diff-filter/test27-redundant-and-filtered-children-nodes-report-1.txt \
|
|
|
|
test-diff-filter/test27-redundant-and-filtered-children-nodes-report-2.txt \
|
|
|
|
test-diff-filter/test27-redundant-and-filtered-children-nodes-v0.cc \
|
|
|
|
test-diff-filter/test27-redundant-and-filtered-children-nodes-v1.cc \
|
Fix redundancy propagation on node with filtered local changes
Until now, if a diff node N has a local change, even if all of its
children nodes are redundant, N is not considered as being redundant.
This is an issue if the local changes of N are filtered out; in that
case, N should be considered redundant.
This patch fixes that. It introduces a second category bitmap on the
diff node that stores the categorization of the diff node that does
*NOT* take in account the categories inherited from its children
nodes. That way, it's possible to know if the *local changes* of a
given node have been filtered out.
* include/abg-comparison.h (diff::{get_local_category,
add_to_local_category, add_to_local_and_inherited_categories,
remove_from_local_category, set_local_category,
is_filtered_out_wrt_non_inherited_categories,
has_local_changes_to_be_reported}): Declare new member functions.
* src/abg-comp-filter.cc ({harmless, harmful}_filter::{visit,
visit_end}): Update local category too.
* src/abg-comparison.cc (diff::priv::local_category_): Add new
data member.
(diff::priv::priv): Initialize it.
(diff::priv::is_filtered_out): Add new member function. This is
factorized out of diff::is_filtered_out().
(diff::is_filtered_out): Re-write in terms of
diff::priv::is_filtered_out().
(diff::{get_local_category, add_to_local_category,
add_to_local_and_inherited_categories, remove_from_local_category,
set_local_category, is_filtered_out_wrt_non_inherited_categories,
has_local_changes_to_be_reported}): Define new member functions.
(suppression_categorization_visitor::visit_begin): Update local
categories too.
(redundancy_marking_visitor::visit_end): If all of the children
nodes of the a diff node N are redundant and if N has filtered-out
local changes, then N is redundant too.
* tests/data/test-diff-filter/libtest28-redundant-and-filtered-children-nodes-v{1,2}.so:
New binary test inputs.
* tests/data/test-diff-filter/test28-redundant-and-filtered-children-nodes-v{0,1}.cc:
Source code for the binary test inputs above.
* tests/data/test-diff-filter/test28-redundant-and-filtered-children-nodes-report-{0,1}.txt:
New test output references.
* tests/test-diff-filter.cc (in_out_specs): Add the test inputs
above to the set of inputs this test harness has to run over.
* tests/data/Makefile.am: Add the test materials above to the
source distribution.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-03-18 17:01:48 +00:00
|
|
|
test-diff-filter/libtest28-redundant-and-filtered-children-nodes-v0.so \
|
|
|
|
test-diff-filter/libtest28-redundant-and-filtered-children-nodes-v1.so \
|
|
|
|
test-diff-filter/test28-redundant-and-filtered-children-nodes-report-0.txt \
|
|
|
|
test-diff-filter/test28-redundant-and-filtered-children-nodes-report-1.txt \
|
|
|
|
test-diff-filter/test28-redundant-and-filtered-children-nodes-v0.cc \
|
|
|
|
test-diff-filter/test28-redundant-and-filtered-children-nodes-v1.cc \
|
2014-11-20 10:26:30 +00:00
|
|
|
\
|
|
|
|
test-diff-suppr/test0-type-suppr-v0.cc \
|
|
|
|
test-diff-suppr/test0-type-suppr-v1.cc \
|
|
|
|
test-diff-suppr/test0-type-suppr-v0.o \
|
|
|
|
test-diff-suppr/test0-type-suppr-v1.o \
|
|
|
|
test-diff-suppr/test0-type-suppr-0.suppr \
|
|
|
|
test-diff-suppr/test0-type-suppr-1.suppr \
|
|
|
|
test-diff-suppr/test0-type-suppr-2.suppr \
|
|
|
|
test-diff-suppr/test0-type-suppr-report-0.txt \
|
|
|
|
test-diff-suppr/test0-type-suppr-report-1.txt \
|
|
|
|
test-diff-suppr/test0-type-suppr-report-2.txt \
|
|
|
|
test-diff-suppr/test0-type-suppr-report-3.txt \
|
|
|
|
test-diff-suppr/test1-typedef-suppr.h \
|
|
|
|
test-diff-suppr/test1-typedef-suppr-v0.c \
|
|
|
|
test-diff-suppr/test1-typedef-suppr-v1.c \
|
|
|
|
test-diff-suppr/test1-typedef-suppr-v0.o \
|
|
|
|
test-diff-suppr/test1-typedef-suppr-v1.o \
|
|
|
|
test-diff-suppr/test1-typedef-suppr-0.suppr \
|
|
|
|
test-diff-suppr/test1-typedef-suppr-1.suppr \
|
|
|
|
test-diff-suppr/test1-typedef-suppr-report-0.txt \
|
|
|
|
test-diff-suppr/test1-typedef-suppr-report-1.txt \
|
|
|
|
test-diff-suppr/test1-typedef-suppr-report-2.txt \
|
|
|
|
test-diff-suppr/test2-struct-suppr-0.suppr \
|
|
|
|
test-diff-suppr/test2-struct-suppr-1.suppr \
|
|
|
|
test-diff-suppr/test2-struct-suppr-report-0.txt \
|
|
|
|
test-diff-suppr/test2-struct-suppr-report-1.txt \
|
|
|
|
test-diff-suppr/test2-struct-suppr-v0.cc \
|
|
|
|
test-diff-suppr/test2-struct-suppr-v1.cc \
|
|
|
|
test-diff-suppr/test2-struct-suppr-v0.o \
|
|
|
|
test-diff-suppr/test2-struct-suppr-v1.o \
|
|
|
|
test-diff-suppr/test3-struct-suppr-0.suppr \
|
|
|
|
test-diff-suppr/test3-struct-suppr-1.suppr \
|
|
|
|
test-diff-suppr/test3-struct-suppr-report-0.txt \
|
|
|
|
test-diff-suppr/test3-struct-suppr-report-1.txt \
|
|
|
|
test-diff-suppr/test3-struct-suppr-report-2.txt \
|
|
|
|
test-diff-suppr/test3-struct-suppr-v0.cc \
|
|
|
|
test-diff-suppr/test3-struct-suppr-v0.o \
|
|
|
|
test-diff-suppr/test3-struct-suppr-v1.cc \
|
|
|
|
test-diff-suppr/test3-struct-suppr-v1.o \
|
|
|
|
test-diff-suppr/libtest4-local-suppr-v0.so \
|
|
|
|
test-diff-suppr/libtest4-local-suppr-v1.so \
|
|
|
|
test-diff-suppr/test4-local-suppr-0.suppr \
|
|
|
|
test-diff-suppr/test4-local-suppr-report-0.txt \
|
|
|
|
test-diff-suppr/test4-local-suppr-report-1.txt \
|
|
|
|
test-diff-suppr/test4-local-suppr-v0.c \
|
|
|
|
test-diff-suppr/test4-local-suppr-v0.h \
|
|
|
|
test-diff-suppr/test4-local-suppr-v1.c \
|
|
|
|
test-diff-suppr/test4-local-suppr-v1.h \
|
|
|
|
test-diff-suppr/libtest5-fn-suppr-v0.so \
|
|
|
|
test-diff-suppr/libtest5-fn-suppr-v1.so \
|
|
|
|
test-diff-suppr/test5-fn-suppr-0.suppr \
|
|
|
|
test-diff-suppr/test5-fn-suppr-1.suppr \
|
|
|
|
test-diff-suppr/test5-fn-suppr-2.suppr \
|
|
|
|
test-diff-suppr/test5-fn-suppr-3.suppr \
|
|
|
|
test-diff-suppr/test5-fn-suppr-4.suppr \
|
|
|
|
test-diff-suppr/test5-fn-suppr-report-0.txt \
|
|
|
|
test-diff-suppr/test5-fn-suppr-report-1.txt \
|
|
|
|
test-diff-suppr/test5-fn-suppr-report-2.txt \
|
|
|
|
test-diff-suppr/test5-fn-suppr-report-3.txt \
|
|
|
|
test-diff-suppr/test5-fn-suppr-report-4.txt \
|
|
|
|
test-diff-suppr/test5-fn-suppr-report-5.txt \
|
|
|
|
test-diff-suppr/test5-fn-suppr-v0.cc \
|
|
|
|
test-diff-suppr/test5-fn-suppr-v1.cc \
|
|
|
|
test-diff-suppr/libtest6-fn-suppr-v0.so \
|
|
|
|
test-diff-suppr/libtest6-fn-suppr-v1.so \
|
|
|
|
test-diff-suppr/test6-fn-suppr-0.suppr \
|
|
|
|
test-diff-suppr/test6-fn-suppr-1.suppr \
|
|
|
|
test-diff-suppr/test6-fn-suppr-2.suppr \
|
|
|
|
test-diff-suppr/test6-fn-suppr-3.suppr \
|
|
|
|
test-diff-suppr/test6-fn-suppr-report-0.txt \
|
|
|
|
test-diff-suppr/test6-fn-suppr-report-1.txt \
|
|
|
|
test-diff-suppr/test6-fn-suppr-report-2.txt \
|
|
|
|
test-diff-suppr/test6-fn-suppr-report-3.txt \
|
|
|
|
test-diff-suppr/test6-fn-suppr-report-4.txt \
|
|
|
|
test-diff-suppr/test6-fn-suppr-v0.cc \
|
|
|
|
test-diff-suppr/test6-fn-suppr-v1.cc \
|
|
|
|
test-diff-suppr/test6-fn-suppr-version-script \
|
|
|
|
test-diff-suppr/libtest7-var-suppr-v0.so \
|
|
|
|
test-diff-suppr/libtest7-var-suppr-v1.so \
|
|
|
|
test-diff-suppr/test7-var-suppr-v0.cc \
|
|
|
|
test-diff-suppr/test7-var-suppr-v1.cc \
|
|
|
|
test-diff-suppr/test7-var-suppr-1.suppr \
|
|
|
|
test-diff-suppr/test7-var-suppr-2.suppr \
|
|
|
|
test-diff-suppr/test7-var-suppr-3.suppr \
|
|
|
|
test-diff-suppr/test7-var-suppr-4.suppr \
|
|
|
|
test-diff-suppr/test7-var-suppr-5.suppr \
|
|
|
|
test-diff-suppr/test7-var-suppr-6.suppr \
|
|
|
|
test-diff-suppr/test7-var-suppr-7.suppr \
|
|
|
|
test-diff-suppr/test7-var-suppr-8.suppr \
|
|
|
|
test-diff-suppr/test7-var-suppr-report-0.txt \
|
|
|
|
test-diff-suppr/test7-var-suppr-report-1.txt \
|
|
|
|
test-diff-suppr/test7-var-suppr-report-2.txt \
|
|
|
|
test-diff-suppr/test7-var-suppr-report-3.txt \
|
|
|
|
test-diff-suppr/test7-var-suppr-report-4.txt \
|
|
|
|
test-diff-suppr/test7-var-suppr-report-5.txt \
|
|
|
|
test-diff-suppr/test7-var-suppr-report-6.txt \
|
|
|
|
test-diff-suppr/test7-var-suppr-report-7.txt \
|
|
|
|
test-diff-suppr/test7-var-suppr-report-8.txt \
|
|
|
|
test-diff-suppr/test7-var-suppr-version-script \
|
Un-share diff nodes in the comparison IR
Until now, the diff nodes of the comparison IR were shared. That is,
two diffs about the same subjects were represented by the same diff
node that would appear twice in the tree.
This was preventing us from spotting e.g, the first occurrence of a
diff node that would later (in the tree) turn to be redundant because
all redundant diff nodes are represented by the same diff node
pointer.
This patch now makes each diff node be different, as far of pointer
comparison is concerned. But it introduces the concept of canonical
diff node to ease the comparison between two diff nodes. Two diff
nodes that are equal have the same canonical diff node.
With this facility, it's now possible to tell the difference between
diff nodes that are (structurally) equal. It's not possible to say
things like "this is the first or second occurrence of the redundant
diff node foo'.
* include/abg-ir.h: Prefix the doc string with "///", rather than
writing it inside a /**/ comment.
* include/abg-comparison.h (function_decl_diff)
(function_decl_diff_sptr, fn_parm_diff, fn_parm_diff_sptr)
(var_diff_sptr, base_diff, class_diff, class_diff_sptr): Move
these class & typedef decls to the top of the file.
(string_changed_base_map, string_changed_parm_map)
(unsigned_changed_parm_map, changed_function_ptr)
(string_changed_function_ptr_map): Remove these typedefs.
(string_base_diff_sptr_map, string_fn_parm_diff_sptr_map)
(unsigned_fn_parm_diff_sptr_map, string_var_diff_sptr_map)
(unsigned_var_diff_sptr_map, string_function_decl_diff_sptr_map)
(string_var_diff_ptr_map): New typedefs.
(diff_context::{has_diff_for,add_diff}): Make these member
functions private.
(diff_context::{set_canonical_diff_for,
set_or_get_canonical_diff_for}): Declare new private member
functions.
(diff_context::{get_canonical_diff_for,
initialize_canonical_diff}): New public member functions.
(diff_context::maybe_apply_filters): Set the default value of the
'traverse_nodes_once' parameter to false.
(compute_diff): Make the overload for class_decl_sptr friend of
the diff_context class.
(class diff): Make the diff_context class a friend of this one.
(diff::set_canonical_diff): Declare new private member function.
(diff::get_canonical_diff): Declare new public member function.
(diff::children_nodes): Make this return a vector<diff_sptr>, rather
than a vector<diff*>.
(diff::append_child_node): Make this take a diff_sptr rather than
a diff*.
(class fn_parm_diff): Declare new type.
(compute_diff): Declare new overload for the new
function_decl::parameter_sptr.
(function_decl_diff::subtype_changed_parms): Return a
string_fn_parm_diff_sptr_map rather than a string_changed_parm.
(function_decl_diff::children_nodes): Return a vector<diff_sptr>.
(function_decl_diff::append_child_node): Take a diff_sptr.
(function_decl_diff::changed_functions): Return a
string_function_decl_diff_sptr_map.
(function_decl_diff::changed_variables): Return a
string_var_diff_sptr.
(class function_decl::parameter): Make this a pimpled class.
Also, make it inherit decl_base.
(equals): New overload for function_decl::parameter.
(struct function_decl::parameter::hash): Declare this.
(ir_node_visitor::visit): Declare new overload for
function_decl::parameter.
* src/abg-comparison.cc: Add doc-string about the internal
representation of the comparison engine and also about the concept
of canonical diff of the comparison engine.
(RETURN_IF_BEING_REPORTED_OR_WAS_REPORTED_EARLIER)
(RETURN_IF_BEING_REPORTED_OR_WAS_REPORTED_EARLIER2)
(RETURN_IF_BEING_REPORTED_OR_WAS_REPORTED_EARLIER3): Consider the
canonical diff when trying to know if the current node was
reported earlier.
(diff_context::priv::canonical_diffs): New data member.
(diff_context::{get_canonical_diff_for, set_canonical_diff_for,
set_or_get_canonical_diff_for, initialize_canonical_diff}): Define
new member functions.
(diff_context::{diff_has_been_traversed, mark_diff_as_traversed):
Consider canonical diff for these tests and actions.
(diff::priv::children_): Change the type of this to
vector<diff_sptr>.
(diff::canonical_diff_): New data member.
(diff::diff): Initialize the diff::canonical_diff_ data member.
(diff::begin_traversing): Mark the canonical diff node too.
(diff::is_traversing): Consider the canonical diff node in this
test.
(diff::end_traversing): Make the canonical diff node too. Also
mark the current node as having been traversed.
(diff::children_nodes): Return a vector<diff_sptr> type.
(diff::{get_canonical_diff, set_canonical_diff}): Define new
member functions.
(diff::append_child_node): Take a diff_sptr type parameter.
(diff::{reported_once, currently_reporting}): Flag the canonical
diff node too. And consider the canonical diff node when checking
the flag.
(diff::traverse): No need to mark the node as being traversed
because the diff::end_traversing() function does it now. Adjust
the code because diff::children_nodes() now returns
vector<diff_sptr>.
({distinct_diff, var_diff, pointer_diff, array_diff,
reference_diff, qualified_type_diff, enum_diff, class_diff,
base_diff, scope_diff, function_decl_diff, typedef_diff,
corpus_diff}::chain_into_hierarchy): Adjust to the new type that
diff::append_child_node() takes. Also, take into account that the
diff nodes are now un-shared.
(compute_diff_for_distinct_kinds, compute_diff_for_types)
(compute_diff): Do not share diff nodes anymore. Initialize the
canonical diff node for the new created node.
(represent): Take a var_diff_sptr rather than two var_decl_sptr.
Adjust. Also take in account the fact that diff nodes are not
shared anymore, and that they do have canonical diffs.
(var_diff::type_diff): Make the computation of the type_diff of
the var_diff be lazy. This avoids infinite (recursive) creation
of diff nodes when a class diff node has a sub-type of data member
that is a class diff node too.
(var_diff::report): Detect redundant reporting of this kind of
diff node.
(class_diff::priv::changed_bases_): Change the type of this to
string_base_diff_sptr_map.
(class_diff::priv::subtype_changed_dm_): Change the type of this
to string_var_diff_sptr_map.
(class_diff::priv::changed_dm_): Change the type of this to
unsigned_var_diff_sptr_map.
(class_diff::priv::{count_filtered_subtype_changed_dm,
count_filtered_bases}): Do not take a diff_context_sptr anymore.
(class_diff::ensure_lookup_tables_populated): changed_bases_
subtype_changed_dm_ and changed_dm_ are now *NOT* shared diff
nodes anymore.
(class_diff::priv::base_has_changed): Adjust.
(class_diff::priv::subtype_changed_dm): Adjust.
(class_diff::priv::count_filtered_bases): Adjust as changed_bases_
is now a map of un-shared diff nodes.
(class_diff::priv::count_filtered_subtype_changed_dm): Adjust as
subtype_changed_dm_ is now a map of un-shared diff nodes.
(class_diff::priv::{count_filtered_changed_mem_fns,
count_filtered_inserted_mem_fns, count_filtered_deleted_mem_fns,
}): Adjust for change of the default parameter value of
diff_context::maybe_apply_filters().
(class_diff::~class_diff): New destructor.
(class_diff::changed_bases): Return a string_base_diff_sptr_map&
type.
(class_diff::{inserted_data_members, deleted_data_members,
changed_member_fns}): Add doc strings.
(struct changed_data_member_comp): Remove.
(struct var_diff_comp): New comparison functor.
(sort_changed_data_members): Remove.
(sort_var_diffs): Define new sorting function.
(class_diff::report): Adjust.
(fn_parm_diff::*): Define member types and functions of the new
fn_parm_diff type.
(function_decl_diff::priv::{subtype_changed_parms_,
changed_parms_by_id_}): Make these take a map of fn_parm_diff_sptr
nodes.
(function_decl_diff::ensure_lookup_tables_populated): Adjust to
the fact that priv_->subtype_changed_parms_ and
priv_->priv_->changed_parms_by_id_ now are maps of un-shared
fn_parm_diff_sptr nodes.
(function_decl_diff::subtype_changed_parms): Adjust.
(struct changed_parm_comp): Remove.
(struct fn_parm_diff_comp): New comparison functor.
(sort_changed_parm_map): Remove.
(sort_string_fn_parm_diff_sptr_map): New sorting function.
(function_decl_diff::report): Adjust.
(corpus_diff::priv::children_): Change the type of this to
vector<diff_sptr>.
(corpus_diff::priv::changed_fns_): Changed the type of this to
string_function_decl_diff_sptr_map.
(corpus_diff::priv::changed_vars_): Changed the type of this to
string_var_diff_sptr_map.
(corpus_diff::priv::ensure_lookup_tables_populated): Adjust.
(corpus_diff::priv::apply_filters_and_compute_diff_stats}):
Adjust. Do not need to clear redundancy categorization anymore
because the diff nodes are not shared anymore.
(corpus_diff::priv::categorize_redundant_changed_sub_nodes):
Adjust.
(corpus_diff::priv::clear_redundancy_categorization): Adjust.
(corpus_diff::changed_variables): Adjust.
(struct changed_function_ptr_comp): Remove.
(struct function_decl_diff_comp): New comparison functor.
(sort_string_changed_function_ptr_map): Remove.
(sort_string_function_decl_diff_sptr_map): Define new sorting
function.
(struct changed_vars_comp): Remove.
(struct var_diff_sptr_comp): New comparison functor.
(sort_changed_vars): Remove.
(sort_string_var_diff_sptr_map): Define new sorting function.
(corpus_diff::report): Adjust.
(corpus_diff::traverse): Adjust.
({category_propagation_visitor,
suppression_categorization_visitor}::visit_end): Adjust.
(clear_redundancy_categorization): Adjust.
* src/abg-hash.cc (function_decl::parameter::hash::operator):
Adjust.
* src/abg-ir.cc (struct function_decl::parameter::priv): Define
here as part of pimpl-ifying the function_decl::parameter type.
(function_decl::parameter::*): Define here the member functions as
part of pimpl-ifying the function_decl::parameter type.
(equals): Define the overload for function_decl::parameter here
too.
(ir_node_visitor::visit(function_decl::parameter*)): Define this.
* tests/data/test-abicompat/test0-fn-changed-report-0.txt: Adjust.
* tests/data/test-diff-suppr/test5-fn-suppr-report-0.txt: Adjust.
* tests/data/test-diff-dwarf/libtest21-redundant-fn-v0.so: New
test input data.
* tests/data/test-diff-dwarf/libtest21-redundant-fn-v1.so:
Likewise.
* tests/data/test-diff-dwarf/test21-redundant-fn-v0.cc: Source
code for test input binary above.
* tests/data/test-diff-dwarf/test21-redundant-fn-v1.cc: Likewise.
* tests/data/test-diff-dwarf/test21-redundant-fn-report-0.txt: New
test input data.
* tests/data/test-diff-dwarf/libtest22-changed-parm-c-v0.so: New
test input data.
* tests/data/test-diff-dwarf/libtest22-changed-parm-c-v1.so:
Likewise.
* tests/data/test-diff-dwarf/test22-changed-parm-c-v0.c: Source
code for test input binary above.
* tests/data/test-diff-dwarf/test22-changed-parm-c-v1.c: Likewise.
* tests/test-diff-dwarf.cc (in_out_spec): Add the new test input
data to the vector the test inputs to run this harness over.
* tests/data/test-diff-suppr/test8-redundant-fn-report-0.txt: New
test input data.
* tests/data/test-diff-suppr/test8-redundant-fn-report-1.txt:
Likewise.
* tests/data/test-diff-suppr/libtest8-redundant-fn-v0.so: New test
input binary.
* tests/data/test-diff-suppr/libtest8-redundant-fn-v1.so: Likewise.
* tests/data/test-diff-suppr/test8-redundant-fn-v0.cc: Source code
code for binary test input above.
* tests/data/test-diff-suppr/test8-redundant-fn-v1.cc: Likewise.
* tests/data/test-diff-suppr/test9-changed-parm-c-report-0.txt:
New test input data.
* tests/data/test-diff-suppr/test9-changed-parm-c-report-1.txt:
Likewise.
* tests/data/test-diff-suppr/libtest9-changed-parm-c-v0.so: New
test input binary.
* tests/data/test-diff-suppr/libtest9-changed-parm-c-v1.so: New
test input binary.
* tests/data/test-diff-suppr/test9-changed-parm-c-v0.c: Source
code for binary test input above.
* tests/data/test-diff-suppr/test9-changed-parm-c-v1.c: Likewise.
* tests/test-diff-suppr.cc (in_out_specs): Add the new test input
data to the vector the test inputs to run this harness over.
* tests/data/Makefile.am: Add the new files to the source
distribution.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-12-26 12:22:16 +00:00
|
|
|
test-diff-suppr/libtest8-redundant-fn-v0.so \
|
|
|
|
test-diff-suppr/libtest8-redundant-fn-v1.so \
|
|
|
|
test-diff-suppr/test8-redundant-fn-report-0.txt \
|
|
|
|
test-diff-suppr/test8-redundant-fn-report-1.txt \
|
|
|
|
test-diff-suppr/test8-redundant-fn-v0.cc \
|
|
|
|
test-diff-suppr/test8-redundant-fn-v1.cc \
|
|
|
|
test-diff-suppr/libtest9-changed-parm-c-v0.so \
|
|
|
|
test-diff-suppr/libtest9-changed-parm-c-v1.so \
|
|
|
|
test-diff-suppr/test9-changed-parm-c-report-0.txt \
|
|
|
|
test-diff-suppr/test9-changed-parm-c-report-1.txt \
|
|
|
|
test-diff-suppr/test9-changed-parm-c-v0.c \
|
|
|
|
test-diff-suppr/test9-changed-parm-c-v1.c \
|
2014-12-26 13:46:27 +00:00
|
|
|
test-diff-suppr/libtest10-changed-parm-c-v0.so \
|
|
|
|
test-diff-suppr/libtest10-changed-parm-c-v1.so \
|
|
|
|
test-diff-suppr/test10-changed-parm-c-report-0.txt \
|
|
|
|
test-diff-suppr/test10-changed-parm-c-v0.c \
|
|
|
|
test-diff-suppr/test10-changed-parm-c-v1.c \
|
2014-11-20 10:26:30 +00:00
|
|
|
\
|
|
|
|
test-lookup-syms/test0.cc \
|
|
|
|
test-lookup-syms/test0.o \
|
|
|
|
test-lookup-syms/test0-report.txt \
|
|
|
|
test-lookup-syms/test01-report.txt \
|
|
|
|
test-lookup-syms/test02-report.txt \
|
|
|
|
test-lookup-syms/test1.c \
|
|
|
|
test-lookup-syms/test1.version-script \
|
|
|
|
test-lookup-syms/test1.so \
|
|
|
|
test-lookup-syms/test1-1-report.txt \
|
|
|
|
test-lookup-syms/test1-2-report.txt \
|
|
|
|
test-lookup-syms/test1-3-report.txt \
|
|
|
|
\
|
|
|
|
test-alt-dwarf-file/test0.cc \
|
|
|
|
test-alt-dwarf-file/libtest0.so \
|
|
|
|
test-alt-dwarf-file/test0-common.cc \
|
|
|
|
test-alt-dwarf-file/libtest0-common.so \
|
|
|
|
test-alt-dwarf-file/test0-report.txt \
|
|
|
|
test-alt-dwarf-file/test0-debug-dir/test0-common-dwz.debug \
|
Initial implementation of the abicompat tool
Given an application A that links to a shared library L of version V
denoted L(V) and a subsequent version of that library denoted L(V+P),
the 'abicompat' tool tells the user if L(V+P) is still ABI compatible
with L(V+P). And if it is not, abicompat gives a reports that shows
the differences between L(V) and L(V+P) that makes L(V+P)
ABI-incompatible with A.
The source code of this tool is in the tools/abicompat.cc source
file. To support this new tool, this commit changes the comparison
engine to optionally avoid showing added symbols that were not
referenced by any debug info. It changes the ABI corpus type to allow
the specification of a list of variables and functions symbols to keep
(and drop all other functions and variables which have other symbols
on the floor even before starting to compare the two libraries).
This is how the abicompat tool itself works. It basically compares
L(V) and L(V+P) but it only looks at their exported functions and
variables which symbols are undefined in application A. If the list
of exported and defined variables and functions of L(V) whose symbols
are undefined in A equals that of L(V+P) (including the sub-types of
these variables and functions) A is still compatible with L(V+P).
Otherwise, they might not be compatible depending on the kind of
differences that are found.
* include/abg-comparison.h
(diff_context::show_added_symbols_unreferenced_by_debug_info):
Declare new accessors.
(corpus_diff::{deleted_variables,
deleted_unrefed_function_symbols,
deleted_unrefed_variable_symbols,
apply_filters_and_suppressions_before_reporting}): Declare new
methods.
(corpus_diff::diff_stats): Declare this new type. Actually this
was previously corpus_diff::priv::diff_stats, which was a hidden
internal type.. We are moving it here, in the external API so
that client code can have more information about changes
statistics. Change all the previously publicly accessible data
members into accessor functions.
* src/abg-comparison.cc (class corpus_diff::diff_stats::priv): New
type.
(diff_context::priv::show_added_syms_unreferenced_by_di_): New
data member.
(diff_context::priv::priv): Adjust.
(diff_context::show_added_symbols_unreferenced_by_debug_info):
Define this new method.
(corpus_diff::priv::emit_diff_stats): Do not show the diff stat
if the only changes is added function or variables symbols and if
we were instructed to not show added symbols.
(corpus_diff::priv::{diff_stats_, filters_and_suppr_applied_}):
New data members.
(corpus_diff::priv::priv): Initialize the
filters_and_suppr_applied_ data member.
(corpus_diff::priv::diff_stats): Move this type to
corpus_diff::diff_stats.
(corpus_diff::priv::{apply_filters_and_compute_diff_stats,
emit_diff_stats}): Adjust.
(corpus_diff::apply_filters_and_suppressions_before_reporting):
Define new member function.
(corpus_diff::report): Use the new
apply_filters_and_suppressions_before_reporting() function, rather
than applying the filters and suppressions by ourselves. Also
adjust to the use the accessors of the new corpus_diff::diff_stats
type.
(corpus_diff::{deleted_variables,
deleted_unrefed_function_symbols,
deleted_unrefed_variable_symbols}): Define new accessors.
(corpus_diff::diff_stats::{diff_stats, num_func_removed,
num_func_added, num_func_changed, num_func_filtered_out,
net_num_func_changed, num_vars_removed, num_vars_added,
num_vars_changed, num_vars_filtered_out, net_num_vars_changed,
num_func_sym_removed, num_func_syms_added, num_var_syms_removed,
num_var_syms_added}): Define new member functions.
* include/abg-corpus.h (corpus::{get_sym_ids_of_fns_to_keep,
get_sym_ids_of_vars_to_keep}): Declare new methods.
* src/abg-corpus.cc (corpus::priv::{sym_id_fns_to_keep,
sym_id_vars_to_keep}): Added data members.
(symtab_build_visitor_type::{unrefed_fun_symbols,
unrefed_var_symbols, sym_id_fns_to_keep, sym_id_vars_to_keep}):
Added new data members.
(symtab_build_visitor_type::symtab_build_visitor_type): Take two
additional parameters for the function and variable symbol ids to
keep.
(symtab_build_visitor_type::add_fn_to_wip_fns): Take the function
symbols to keep in account when building the exported symbol
table.
(symtab_build_visitor_type::add_var_to_wip_vars): Likewise, take
the variable symbols to keep in account when building the exported
symbol table.
(corpus::priv::build_public_decl_table): Adjust the initialization
of the visitor that walks the ABI artifacts to build the exported
symbol table to know take a list of function/variable symbols to
keep.
(corpus::priv::build_unreferenced_symbols_tables): Ensure that the
public table of functions/variables is built before doing the work
of this function. Also, if a list of variable/function symbols to
keep is given, drop all symbols that are not in that list on the
floor.
(corpus::{get_sym_ids_of_fns_to_keep,
get_sym_ids_of_vars_to_keep}): Define new accessors.
* tools/abicompat.cc: New abicompat tool.
* doc/manuals/abicompat.rst: New documentation source for
abicompat.
* doc/manuals/libabigail-tools.rst: Add an entry for the abicompat
doc.
* tests/test-abicompat.cc: New test harness for the 'abicompat'
tool.
* tests/Makefile.am: Build the runtestabicompat test harness and
add it to the list of tests harnesses that are run by make check.
* tests/data/test-abicompat/libtest0-fn-changed-libapp-v0.so: New
test input.
* tests/data/test-abicompat/libtest0-fn-changed-libapp-v1.so: Likewise.
* tests/data/test-abicompat/test0-fn-changed-app: Likewise.
* tests/data/test-abicompat/test0-fn-changed-0.suppr: Likewise
* tests/data/test-abicompat/test0-fn-changed-report-0.txt: Likewise.
* tests/data/test-abicompat/test0-fn-changed-report-1.txt: Likewise.
* tests/data/test-abicompat/test0-fn-changed-app.cc: Likewise.
* tests/data/test-abicompat/test0-fn-changed-libapp.h: Likewise.
* tests/data/test-abicompat/test0-fn-changed-libapp-v0.cc: Likewise.
* tests/data/test-abicompat/test0-fn-changed-libapp-v1.cc: Likewise.
* tests/data/test-abicompat/libtest1-fn-removed-v0.so: Likewise.
* tests/data/test-abicompat/libtest1-fn-removed-v1.so: Likewise.
* tests/data/test-abicompat/test1-fn-removed-app: Likewise.
* tests/data/test-abicompat/test1-fn-removed-app.cc: Likewise.
* tests/data/test-abicompat/test1-fn-removed-report-0.txt: Likewise.
* tests/data/test-abicompat/test1-fn-removed-v0.cc: Likewise.
* tests/data/test-abicompat/test1-fn-removed-v1.cc: Likewise.
* tests/data/test-abicompat/libtest2-var-removed-v0.so: Likewise.
* tests/data/test-abicompat/libtest2-var-removed-v1.so: Likewise.
* tests/data/test-abicompat/test2-var-removed-app: Likewise.
* tests/data/test-abicompat/test2-var-removed-app.cc: Likewise.
* tests/data/test-abicompat/test2-var-removed-report-0.txt: Likewise.
* tests/data/test-abicompat/test2-var-removed-v0.cc: Likewise.
* tests/data/test-abicompat/test2-var-removed-v1.cc: Likewise.
* tests/data/test-abicompat/libtest3-fn-removed-v0.so: Likewise.
* tests/data/test-abicompat/libtest3-fn-removed-v1.so: Likewise.
* tests/data/test-abicompat/test3-fn-removed-app: Likewise.
* tests/data/test-abicompat/test3-fn-removed-app.cc: Likewise.
* tests/data/test-abicompat/test3-fn-removed-report-0.txt: Likewise.
* tests/data/test-abicompat/test3-fn-removed-v0.cc: Likewise.
* tests/data/test-abicompat/test3-fn-removed-v1.cc: Likewise.
* tests/data/test-abicompat/test3-fn-removed-version-script-0 Likewise.:
* tests/data/test-abicompat/test3-fn-removed-version-script-1: Likewise.
* tests/data/Makefile.am: Add the new test inputs above to the
source distribution.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-11-30 17:18:55 +00:00
|
|
|
test-alt-dwarf-file/test0-debug-dir/.build-id/16/7088580c513b439c9ed95fe6a8b29496495f26.debug \
|
|
|
|
\
|
|
|
|
test-abicompat/libtest0-fn-changed-libapp-v0.so \
|
|
|
|
test-abicompat/libtest0-fn-changed-libapp-v1.so \
|
|
|
|
test-abicompat/test0-fn-changed-app \
|
|
|
|
test-abicompat/test0-fn-changed-0.suppr \
|
|
|
|
test-abicompat/test0-fn-changed-app.cc \
|
|
|
|
test-abicompat/test0-fn-changed-report-0.txt \
|
|
|
|
test-abicompat/test0-fn-changed-report-1.txt \
|
|
|
|
test-abicompat/test0-fn-changed-libapp.h \
|
|
|
|
test-abicompat/test0-fn-changed-libapp-v0.cc \
|
|
|
|
test-abicompat/test0-fn-changed-libapp-v1.cc \
|
|
|
|
test-abicompat/libtest1-fn-removed-v0.so \
|
|
|
|
test-abicompat/libtest1-fn-removed-v1.so \
|
|
|
|
test-abicompat/test1-fn-removed-app \
|
|
|
|
test-abicompat/test1-fn-removed-app.cc \
|
|
|
|
test-abicompat/test1-fn-removed-report-0.txt \
|
|
|
|
test-abicompat/test1-fn-removed-v0.cc \
|
|
|
|
test-abicompat/test1-fn-removed-v1.cc \
|
|
|
|
test-abicompat/libtest2-var-removed-v0.so \
|
|
|
|
test-abicompat/libtest2-var-removed-v1.so \
|
|
|
|
test-abicompat/test2-var-removed-app \
|
|
|
|
test-abicompat/test2-var-removed-app.cc \
|
|
|
|
test-abicompat/test2-var-removed-report-0.txt \
|
|
|
|
test-abicompat/test2-var-removed-v0.cc \
|
|
|
|
test-abicompat/test2-var-removed-v1.cc \
|
|
|
|
test-abicompat/libtest3-fn-removed-v0.so \
|
|
|
|
test-abicompat/libtest3-fn-removed-v1.so \
|
|
|
|
test-abicompat/test3-fn-removed-app \
|
|
|
|
test-abicompat/test3-fn-removed-app.cc \
|
|
|
|
test-abicompat/test3-fn-removed-report-0.txt \
|
|
|
|
test-abicompat/test3-fn-removed-v0.cc \
|
|
|
|
test-abicompat/test3-fn-removed-v1.cc \
|
|
|
|
test-abicompat/test3-fn-removed-version-script-0 \
|
2014-12-08 12:36:01 +00:00
|
|
|
test-abicompat/test3-fn-removed-version-script-1 \
|
|
|
|
test-abicompat/libtest4-soname-changed-v0.so \
|
|
|
|
test-abicompat/libtest4-soname-changed-v1.so \
|
|
|
|
test-abicompat/test4-soname-changed-app \
|
|
|
|
test-abicompat/test4-soname-changed-app.cc \
|
|
|
|
test-abicompat/test4-soname-changed-v0.cc \
|
|
|
|
test-abicompat/test4-soname-changed-v1.cc \
|
Add support for abicompat weak mode
This patch implements the weak mode of abicompat. In this mode, just
the application and the new version of the library are provided. The
types of functions and variables of the library that are consumed by
the application are compared to the types of the functions and
variables expected by the application. The goal is to check if the
types of the declarations consumed by the application and provided by
the library are compatible with what the application expects.
The abicompat first gets the set of symbols undefined in the
application and exported by the library. It then builds the set of
declarations exported by the library that have those symbols. We call
these the set of declarations of the library that are consumed by the
application.
Note that the debug information for the application does not contain
the declarations of the functions/variables whose symbols are
undefined. So we can not just read them to compare them to
declarations exported by the library.
But the *types* of the variables and the *sub-types* of the functions
whose symbols are undefined in the application are present in the
debug information of the application.
So in the weak mode, abicompat compare the *types* of the declarations
consumed by the application as expected by the application (described
by the debug information of the application) with the types of the
declarations exported by the library.
To do this a number of changes were necessary.
The patch builds a representation of all the types found in the
application's debug info. Before that, only the types that are
reachable from exported declarations were represented.
The abidw tool got a new --load-all-types to test this new ability of
loading all types.
The patch also adds support for looking a type, not by name, but by
its internal representation.
In the comparison engine, function_type_diff is introduced to
represent changes between two function types. For this, a new class
type_or_decl_base has been introduced in the IR. It's now the base
class for both decl_base and type_base. And abigail::comparison::diff
now takes two pointers of type_or_decl, not decl_base anymore. So
function_type_diff can take two function_type now; not that a
function_type has no declaration so it doesn't inherit decl_base. A
bunch of changes got made just to adjust to this modification.
A number of fixes were made too, to make this work, like adding
missing comparison operators, removing asserts that too strong, etc..
The patch also adjust the test suite as well as the documentation.
* include/abg-fwd.h (class type_or_decl_base): Forward declare
this.
(is_decl, is_type, is_function_type, get_name, get_type_name)
(get_function_type_name, get_pretty_representation)
(lookup_function_type_in_corpus, lookup_type_in_translation_unit)
(lookup_function_type_in_translation_unit)
(synthesize_function_type_from_translation_unit)
(hash_type_or_decl): New function declarations.
* src/abg-corpus.cc (lookup_type_in_corpus)
(lookup_function_type_in_corpus): Define new functions.
* include/abg-ir.h
(translation_unit::lookup_function_type_in_translation_unit):
Declare new friend function.
(class type_or_decl_base): Declare this.
(operator==(const type_or_decl_base&, const type_or_decl_base&)):
Declare new operator.
(operator==(const type_or_decl_base_sptr&, const
type_or_decl_base_sptr&)): Likewise.
(class {decl_base, type_base}): Make these class inherit
type_or_decl_base.
(decl_base::get_member_scopes): New const overload.
(bool operator==(const function_decl::parameter_sptr&,
const function_decl::parameter_sptr&)): New operator.
(function_type::get_parameters): Remove the non-const overload.
(function_type::get_pretty_representation): Declare new member
function.
(method_type::get_pretty_representation): Likewise.
* src/abg-ir.cc (bool operator==(const type_or_decl_base&, const
type_or_decl_base&)): Define new equality operator.
(bool operator==(const type_or_decl_base_sptr&, const
type_or_decl_base_sptr&)): Likewise.
(strip_typedef): Do not expect canonicalized types anymore. Now
the system accepts (and expects) canonicalized types in certain
cases. For instance, non-complete types and aggregated types that
contain non-complete sub-types.
(get_name, get_function_type_name, get_type_name)
(get_pretty_representation, is_decl, is_type, is_function_type)
(lookup_function_type_in_translation_unit)
(synthesize_function_type_from_translation_unit)
(lookup_type_in_scope, lookup_type_in_translation_unit): Define
new functions or new overloads.
(bool operator==(const function_decl::parameter_sptr&,
const function_decl::parameter_sptr& r)): Define
new operator.
(function_type::get_parameters): Remove non-const overload.
(function_type::get_pretty_representation): Define new function.
(function_type::traverse): Adjust.
(method_type::get_pretty_representation): Likewise.
(function_decl::get_pretty_representation): Avoid emitting the
type of cdtors.
(hash_type_or_decl): Define new function.
* include/abg-dwarf-reader.h (create_read_context)
(read_corpus_from_elf): Take a new 'read_all_types' flag.
* src/abg-dwarf-reader.cc (read_context::load_all_types_): New
flag.
(read_context::read_context): Initialize it.
(read_context::canonical_types_scheduled): If some types still
have non-canonicalized sub-types, then do not canonicalize them.
(read_context::load_all_types): New member functions.
(build_function_decl): Do not represent void return type like
empty type anymore, rather, represent it like a void type node.
(build_ir_node_from_die): When asked, load all types
including those that are not reachable from an exported
declaration.
(create_read_context, read_corpus_from_elf): Take a new
'load_all_types' flag and honour it.
* src/abg-reader.cc (read_context::type_is_from_translation_unit):
Support looking up function types in the current translation unit,
now that we now how to lookup function types.
* include/abg-comparison.h (diff_context::{has_diff_for, add_diff,
set_canonical_diff_for, set_or_get_canonical_diff_for,
get_canonical_diff_for}): Make these take instances of
type_or_decl_base_sptr, instead of decl_base_sptr.
(diff::diff): Likewise.
(diff::{first_subject, second_subject}): Make these return
type_or_decl_base_sptr instead of decl_base_sptr.
(type_diff_base::type_diff_base): Make these take instances of
type_or_decl_base_sptr instead of decl_base_sptr.
(distinct_diff::distinct_diff): Likewise.
(distinct_diff::{first, second}): Make these return
type_or_decl_base_sptr instead of decl_base_sptr.
(distinct_diff::entities_are_of_distinct_kinds): Make these take
instances of type_or_decl_base_sptr instead of decl_base_sptr.
(class function_type_diff): Create this new type. It's a
factorization of the function_decl_diff type.
* src/abg-comparison.cc ():
* src/abg-comp-filter.cc ({harmless, harmful}_filter::visit):
Adjust as diff::{first,second}_subject() now returns a
type_or_decl_base_sptr, no more a decl_base_sptr.
(decls_type, decls_diff_map_type): Remove these typedefs and replace it with ...
(types_or_decls_type, types_or_decls_diff_map_type): ... these.
(struct {decls_hash, decls_equals): Remove these type sand replace them with ...
(struct {types_or_decls_hash, types_or_decls_equals}): ... these.
({type_suppression, variable_suppression}::suppresses_diff):
Adjust.
(diff_context::priv::decls_diff_map): Replace this with ...
(diff_context::priv::types_or_decls_diff_map): ... this.
(diff_context::{has_diff_for, add_diff, get_canonical_diff_for,
set_canonical_diff_for, set_or_get_canonical_diff_for}): Take
type_or_decl_base_sptr instead of decl_base_sptr.
(diff::priv::{first, second}_subject): Make the type of these be
type_or_decl_base_sptr, no more decl_base_sptr.
(diff::priv::priv): Adjust for the subjects of the diff being of
type type_or_decl_sptr now, no more decl_base_sptr.
(diff_less_than_functor::operator()(const diff_sptr, const
diff_sptr) const): Adjust.
(diff::diff): djust for the subjects of the diff being of type
type_or_decl_sptr now, no more decl_base_sptr.
(diff::{first,second}_subject): Make the type of these be
type_or_decl_base_sptr, no more decl_base_sptr.
(report_size_and_alignment_changes): Likewise.
(type_diff_base::type_diff_base): Make the type of this be
type_or_decl_base_sptr instead of type_base_sptr.
(distinct_diff::distinct_diff): Make this take instances of
type_or_decl_base_sptr instead of decl_base_sptr.
(distinct_diff::{first, second, entities_are_of_distinct_kinds}):
Likewise.
(distinct_diff::has_changes): Simplify logic.
(distinct_diff::report): Adjust.
(compute_diff_for_types): Add an additional case to support the
new function_type.
(report_size_and_alignment_changes): Make this take instances of
type_or_decl_base_sptr instead of decl_base_sptr.
(class_diff::priv::member_type_has_changed): Return an instance of
type_or_decl_base_sptr rather than a decl_base_sptr.
(class_diff::report): Adjust.
(diff_comp::operator()(const diff&, diff&) const): Adjust.
(enum function_decl_diff::priv::Flags): Remove.
(function_decl_diff::priv::{first_fn_flags_, second_fn_flags_,
fn_flags_changes_}): Remove.
(function_decl_diff::priv::{fn_is_declared_inline_to_flag,
fn_binding_to_flag}): Remove.
(function_decl_diff::{deleted_parameter_at,
inserted_parameter_at}): Remove.
(function_decl_diff::ensure_lookup_tables_populated): Empty this.
(function_decl_diff::chain_into_hierarchy): Adjust.
(function_decl_diff::function_decl_diff): This now only takes the
subjects. It's body is now empty.
(function_decl_diff::{return_type_diff, subtype_changed_parms,
removed_parms, added_parms, type_diff}): Remove these member
functions.
(function_decl_diff::type_diff): Define new member function.
(function_decl_diff::report): Simplify logic by using the
reporting of the child type diff node.
(compute_diff): Likewise, in the overload for function_decl_sptr
simplify logic by using the child type diff object.
(function_type_diff::priv): Define new type.
(function_type_diff::{function_type_diff,
ensure_lookup_tables_populated, deleted_parameter_at,
inserted_parameter_at, finish_diff_type, first_function_type,
second_function_type, return_type_diff, subtype_changed_parms,
removed_parms, added_parms, get_pretty_representation,
has_changes, has_local_changes, report, chain_into_hierarchy}):
Define new functions.
(compute_diff): Define new overload for function_type_sptr.
* tools/abicompat.cc (options::weak_mode): New data member.
(options::options): Initialize it.
(enum abicompat_status): New enum
(abicompat_status operator|(abicompat_status, abicompat_status))
(abicompat_status& operator|=(abicompat_status &, abicompat_status))
(abicompat_status operator&(abicompat_status, abicompat_status)):
New operators to manipulate the abicompat_status enum.
(display_usage): Add help string for the new --weak-mode option.
(parse_command_line): Add the new --weak-mode command line
argument. If the tool is called with just the application and one
library then assume that we are in the weak mode.
(perform_compat_check_in_normal_mode): Define new function, factorized
from what was in the main function.
(perform_compat_check_in_weak_mode): Define new function.
(struct {fn,var}_change): Define new types.
(main): Use perform_compat_check_in_weak_mode() and
perform_compat_check_in_normal_mode().
* tools/abidiff.cc (main): Adjust.
* tools/abidw.cc: (options::load_all_types): Add new data member.
(options::options): Initialize it.
(display_usage): New help string for --load-all-types.
(parse_command_line): Support the new --load-all-types option.
(main): Adjust and honour the --load-all-types option.
* tools/abilint.cc (main): Adjust.
* doc/manuals/abicompat.rst: Update documentation for the new weak
mode. Also provide stuff that was missing from the examples
provided.
* doc/manuals/abidw.rst: Update documentation for the new
--load-all-types option.
* tests/print-diff-tree.cc (main): Adjust.
* tests/test-diff-dwarf.cc (main): Likewise.
* tests/test-read-dwarf.cc (main): Likewise.
* tests/data/test-abicompat/test0-fn-changed-app: Recompile this.
* tests/data/test-abicompat/libtest5-fn-changed-libapp-v{0,1}.so:
New new test input binaries
* tests/data/test-abicompat/test5-fn-changed-app: Likewise.
* tests/data/test-abicompat/test6-var-changed-app: Likewise.
* tests/data/test-abicompat/libtest6-var-changed-libapp-v{0,1}.so:
Likewise.
* tests/data/test-abicompat/test5-fn-changed-report-0.txt:
Reference output for one test above.
* tests/data/test-abicompat/test6-var-changed-report-0.txt:
Likewise.
* tests/data/test-abicompat/test5-fn-changed-app.cc: Source file
for a binary above.
* tests/data/test-abicompat/test5-fn-changed-libapp-v{0,1}.{h,cc}:
Likewise.
* tests/data/test-abicompat/test6-var-changed-libapp-v{0,1}.{cc,h}:
Likewise.
* tests/data/test-abicompat/test6-var-changed-app.cc: Likewise.
* tests/data/Makefile.am: Add the test related files above to the
source distribution.
* tests/test-abicompat.cc (in_out_spec): Add the new test input
above to the list of inputs to feed to this test harness.
(main): Support taking just the app and one library.
* tests/data/test-read-dwarf/test{0, 1, 2.so, 3.so, 5.o,
8-qualified-this-pointer.so,}.abi: Adjust for void type being
really emitted now, as opposed to just being an empty type.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-04-01 10:13:38 +00:00
|
|
|
test-abicompat/test4-soname-changed-report-0.txt \
|
|
|
|
test-abicompat/libtest5-fn-changed-libapp-v0.so \
|
|
|
|
test-abicompat/libtest5-fn-changed-libapp-v1.so \
|
|
|
|
test-abicompat/test5-fn-changed-app \
|
|
|
|
test-abicompat/test5-fn-changed-app.cc \
|
|
|
|
test-abicompat/test5-fn-changed-libapp-v0.cc \
|
|
|
|
test-abicompat/test5-fn-changed-libapp-v1.cc \
|
|
|
|
test-abicompat/test5-fn-changed-report-0.txt \
|
|
|
|
test-abicompat/libtest6-var-changed-libapp-v0.so \
|
|
|
|
test-abicompat/libtest6-var-changed-libapp-v1.so \
|
|
|
|
test-abicompat/test6-var-changed-app \
|
|
|
|
test-abicompat/test6-var-changed-app.cc \
|
|
|
|
test-abicompat/test6-var-changed-libapp-v0.cc \
|
|
|
|
test-abicompat/test6-var-changed-libapp-v1.cc \
|
|
|
|
test-abicompat/test6-var-changed-report-0.txt
|