mirror of
git://sourceware.org/git/libabigail.git
synced 2024-12-20 17:00:36 +00:00
f2175b70cc
14 Commits
Author | SHA1 | Message | Date | |
---|---|---|---|---|
Dodji Seketeli
|
fe9fa7a05f |
Support filtering out just one alias of a function
Suppose a function private_foo() has a symbol private_foo and also a another one (an alias) named public_foo. Then suppose we want to filter out sub-type changes to private_foo(). But then we still want to see changes to public_foo. This patch does add this feature. The [suppress_function] directive now has a new (hidden) boolean 'allow_other_aliases' property. When set to 'yes' or 'true', if the function being looked at has an alias symbol that does *NOT* match the other properties of the directive, then the directive doesn't suppress reports for the function. This new property is set to yes by default. This means that when a function has got multiple aliases, to suppress the function, one needs to write a regular expression that matches the names of aliases. Otherwise the function will not be suppressed. * include/abg-comparison.h (function_suppression::{get, set}_allow_other_aliases): Declare new member functions. * src/abg-comparison.cc (function_suppression::priv::allow_other_aliases_): New data member. (function_suppression::priv::priv): Initialize it to 'true'. (function_suppression::{get, set}_allow_other_aliases): Define new member functions. (read_function_suppression): Parse the new "allow_other_aliases" property. (function_suppression::suppresses_function): Update to evaluate the new 'allow_other_aliases' property when there is a property to match against some a symbol name of the function. (corpus_diff::report): Fix the printing of function aliases when printing sub-type changes to properly emit the plural of the word 'symbol' when the function has several aliases. * include/abg-ir.h (elf_symbol::get_number_of_aliases): Declare new member function. * src/abg-ir.cc (elf_symbol::get_number_of_aliases): Define new member function. * doc/manuals/libabigail-concepts.rst: Update manual. * tests/data/test-diff-dwarf/test5-report.txt: Adjust. * tests/data/test-diff-suppr/libtest23-alias-filter-v0.so: New test input. * tests/data/test-diff-suppr/libtest23-alias-filter-v1.so: Likewise. * tests/data/test-diff-suppr/test23-alias-filter-0.suppr: Likewise. * tests/data/test-diff-suppr/test23-alias-filter-1.suppr: Likewise. * tests/data/test-diff-suppr/test23-alias-filter-2.suppr: Likewise. * tests/data/test-diff-suppr/test23-alias-filter-3.suppr: Likewise. * tests/data/test-diff-suppr/test23-alias-filter-4.suppr: Likewise. * tests/data/test-diff-suppr/test23-alias-filter-report-0.txt: Likewise. * tests/data/test-diff-suppr/test23-alias-filter-report-1.txt: Likewise. * tests/data/test-diff-suppr/test23-alias-filter-report-2.txt: Likewise. * tests/data/test-diff-suppr/test23-alias-filter-report-3.txt: Likewise. * tests/data/test-diff-suppr/test23-alias-filter-report-4.txt: Likewise. * tests/data/test-diff-suppr/test23-alias-filter-report-5.txt: Likewise. * tests/data/test-diff-suppr/test23-alias-filter-v0.c: Likewise. * tests/data/test-diff-suppr/test23-alias-filter-v1.c: Likewise. * tests/data/test-diff-suppr/test23-alias-filter-version-script: Likewise. * tests/data/Makefile.am: Add the new test stuff to source distribution. * tests/test-diff-suppr.cc (in_out_spec): Add the tests inputs above to the list of input to run over. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
79383f937c |
Apply suppression specifications to added and removed functions and variables
Until now, specifications for suppressing change reports were applied only to functions and variables that have sub-type changes. Change reports about function and variables that were added or removed could not be suppressed. This patch makes suppression specifications to apply to added and removed functions and variables too. They can also apply to function and variable symbols that are not referenced by any debug info. The patch also fixes some typo and formatting glitches and updates some existing tests accordingly. * include/abg-comparison.h (is_type_suppression) (is_function_suppression): Declare new functions. ({function, variable}_suppression::change_kind): Declare new enum. (function_suppression::{parse_change_kind, get_change_kind, set_change_kind, suppresses_function, suppresses_function_symbol}): Declare new member functions. (variable_suppression::{parse_change_kind, get_change_kind, set_change_kind, suppresses_variable, suppresses_variable, suppresses_variable_symbol}): Declare new member functions. (operator{&,|}): Declare new operators for function_suppression::change_kind and variable_suppression::change_kind enums. (corpus_diff::diff_stats::{num_removed_func_filtered_out, net_num_func_removed, num_added_func_filtered_out, net_num_func_added, num_removed_vars_filtered_out, net_num_vars_removed, num_added_vars_filtered_out, net_num_vars_added, num_removed_func_syms_filtered_out, num_added_func_syms_filtered_out, net_num_removed_func_syms, net_num_added_func_syms, num_added_var_syms_filtered_out, num_removed_vars_filtered_out, net_num_removed_var_syms, net_num_added_var_syms}): Declare new member functions. (corpus_diff::diff_stats::num_changed_vars_filtered_out): Renamed corpus_diff::diff_stats::num_vars_filtered_out into this. (corpus_diff::diff_stats::num_changed_func_filtered_out): Renamed corpus_diff::diff_stats::num_func_filtered_out into this. * src/abg-comparison.cc (is_type_suppression) (is_function_suppression): Define new function. (function_suppression::priv::change_kind): New data member. (function_suppression::priv): Initialize it. (function_suppression::{parse_change_kind, get_change_kind, set_change_kind, suppresses_function, suppresses_function_symbol}): Define new member functions. (operator{&,|}): Define new operators for the new function_suppression::change_kind enum. (function_suppression::suppresses_diff): Re-write this in terms of the new function_suppression::suppresses_function() function. (read_function_suppression): Support reading the new "change_kind" property. (variable_suppression::priv::change_kind_): New data member. (variable_suppression::priv::priv): Initialize it. (variable_suppression::{parse_change_kind, get_change_kind, set_change_kind, suppresses_variable, suppresses_variable_symbol}): Define new member functions. (is_variable_suppression): Define new function. (operator{&,|}): Define new operators for variable_suppression::change_kind enum. (variable_suppression::suppresses_diff): Re-write in terms of the new variable_suppression::suppresses_variable function. (read_variable_suppression): Support reading the new "change_kind" property. (corpus_diff::diff_stats::priv::{num_removed_func_filtered_out, num_added_func_filtered_out, num_removed_vars_filtered_out, num_added_vars_filtered_out, num_removed_func_syms_filtered_out, num_added_func_syms_filtered_out, num_removed_var_syms_filtered_out, num_added_var_syms_filtered_out}): New data members. (corpus_diff::diff_stats::priv::num_changed_func_filtered_out): Renamed the data member num_func_filtered_out into this. (corpus_diff::diff_stats::priv::num_changed_vars_filtered_out): Renamed data member num_vars_filtered_out into this. (corpus_diff::diff_stats::priv::priv): Initialize the new data members. (corpus_diff::diff_stats::{num_removed_func_filtered_out, num_removed_func_filtered_out, net_num_func_removed, net_num_func_added, num_added_func_filtered_out, net_num_func_added, num_removed_vars_filtered_out, num_removed_vars_filtered_out, net_num_vars_removed, num_added_vars_filtered_out, net_num_vars_added, num_removed_func_syms_filtered_out, num_added_func_syms_filtered_out, net_num_removed_func_syms, net_num_added_func_syms, num_added_var_syms_filtered_out, num_removed_vars_filtered_out, net_num_removed_var_syms, net_num_added_var_syms}): Define new member functions. (corpus_diff::diff_stats::num_changed_func_filtered_out): Renamed corpus_diff::diff_stats::num_func_filtered_out into this. (corpus_diff::diff_stats::num_changed_vars_filtered_out): Renamed corpus_diff::diff_stats::num_vars_filtered_out into this. (corpus_diff::diff_stats::{net_num_func_changed, net_num_vars_changed}): Adjust. (corpus_diff::priv::{suppressed_deleted_fns_, suppressed_added_fns_, suppressed_deleted_vars_, suppressed_added_vars_, suppressed_added_unrefed_fn_syms_, suppressed_deleted_unrefed_fn_syms_, suppressed_added_unrefed_var_syms_, suppressed_deleted_unrefed_fn_syms_}): New data members. (corpus_diff::priv::{apply_suppressions_to_added_removed_fns_vars, deleted_function_is_suppressed, added_function_is_suppressed, deleted_variable_is_suppressed, added_variable_is_suppressed, added_unrefed_fn_sym_is_suppressed, deleted_unrefed_fn_sym_is_suppressed, added_unrefed_var_sym_is_suppressed, deleted_unrefed_var_sym_is_suppressed}): Define member functions. (function_is_suppressed, variable_is_suppressed): Define new functions. (corpus_diff::priv::apply_filters_and_compute_diff_stats): Compute stats for filtered added or removed functions, variables and their symbols. (corpus_diff::priv::emit_diff_stats): Emit diff stats for filtered added or removed functions, variables and symbols. (corpus_diff::report): Support suppressed reports about added or removed functions, variables and symbols. Fixed a typo that was in there for a while. Note that that fix requires updating some regression tests, and the part of this patch that touches regression tests does that. (apply_suppressions): In the overload for corpus_diff, apply the suppression to added or removed functions and variables. * doc/manuals/libabigail-concepts.rst: Update this manual to reflect the changes above. Also, perform an extensive cleanup of the manual to introduce more section titles to make it easier to navigate the document using the table of content. * tests/data/test-abicompat/test2-var-removed-report-0.txt: Adjust. * tests/data/test-diff-dwarf/test0-report.txt: Likewise. * tests/data/test-diff-dwarf/test12-report.txt: Likewise. * tests/data/test-diff-dwarf/test18-alias-sym-report-0.txt: Likewise. * tests/data/test-diff-dwarf/test19-soname-report-0.txt: Likewise. * tests/data/test-diff-dwarf/test7-report.txt: Likewise. * tests/data/test-diff-dwarf/test8-report.txt: Likewise. * tests/data/test-diff-dwarf/test9-report.txt: Likewise. * tests/data/test-diff-dwarf/test16-syms-only-report.txt: Likewise. * tests/data/test-diff-dwarf/test17-non-refed-syms-report-0.txt: Likewise. * tests/data/test-diff-dwarf/test28-vtable-changes-report-0.txt: Likewise. * tests/data/test-diff-filter/test0-report.txt: Likewise. * tests/data/test-diff-filter/test01-report.txt: Likewise. * tests/data/test-diff-filter/test13-report.txt: Likewise. * test-diff-suppr/test15-suppr-added-fn-v0.o: Add new test material. * tests/data/test-diff-filter/test15-0-report.txt: Likewise. * tests/data/test-diff-filter/test2-report.txt: Likewise. * tests/data/test-diff-filter/test21-compatible-vars-report-0.txt: Likewise. * tests/data/test-diff-filter/test24-compatible-vars-report-1.txt: Likewise. * test-diff-suppr/test15-suppr-added-fn-v1.o: Likewise. * test-diff-suppr/test15-suppr-added-fn-0.suppr: Likewise. * test-diff-suppr/test15-suppr-added-fn-1.suppr: Likewise. * test-diff-suppr/test15-suppr-added-fn-2.suppr: Likewise. * test-diff-suppr/test15-suppr-added-fn-3.suppr: Likewise. * test-diff-suppr/test15-suppr-added-fn-4.suppr: Likewise. * test-diff-suppr/test15-suppr-added-fn-report-0.txt: Likewise. * test-diff-suppr/test15-suppr-added-fn-report-1.txt: Likewise. * test-diff-suppr/test15-suppr-added-fn-report-2.txt: Likewise. * test-diff-suppr/test15-suppr-added-fn-report-3.txt: Likewise. * test-diff-suppr/test15-suppr-added-fn-report-4.txt: Likewise. * test-diff-suppr/test15-suppr-added-fn-report-5.txt: Likewise. * test-diff-suppr/test15-suppr-added-fn-v0.cc: Likewise. * test-diff-suppr/test15-suppr-added-fn-v1.cc: Likewise. * test-diff-suppr/test16-suppr-removed-fn-v0.o: Likewise. * test-diff-suppr/test16-suppr-removed-fn-v1.o: Likewise. * test-diff-suppr/test16-suppr-removed-fn-0.suppr: Likewise. * test-diff-suppr/test16-suppr-removed-fn-1.suppr: Likewise. * test-diff-suppr/test16-suppr-removed-fn-2.suppr: Likewise. * test-diff-suppr/test16-suppr-removed-fn-3.suppr: Likewise. * test-diff-suppr/test16-suppr-removed-fn-4.suppr: Likewise. * test-diff-suppr/test16-suppr-removed-fn-report-0.txt: Likewise. * test-diff-suppr/test16-suppr-removed-fn-report-1.txt: Likewise. * test-diff-suppr/test16-suppr-removed-fn-report-2.txt: Likewise. * test-diff-suppr/test16-suppr-removed-fn-report-3.txt: Likewise. * test-diff-suppr/test16-suppr-removed-fn-report-4.txt: Likewise. * test-diff-suppr/test16-suppr-removed-fn-report-5.txt: Likewise. * test-diff-suppr/test16-suppr-removed-fn-v0.cc: Likewise. * test-diff-suppr/test16-suppr-removed-fn-v1.cc: Likewise. * test-diff-suppr/test17-suppr-added-var-v0.o: Likewise. * test-diff-suppr/test17-suppr-added-var-v1.o: Likewise. * test-diff-suppr/test17-suppr-added-var-0.suppr: Likewise. * test-diff-suppr/test17-suppr-added-var-1.suppr: Likewise. * test-diff-suppr/test17-suppr-added-var-2.suppr: Likewise. * test-diff-suppr/test17-suppr-added-var-3.suppr: Likewise. * test-diff-suppr/test17-suppr-added-var-4.suppr: Likewise. * test-diff-suppr/test17-suppr-added-var-report-0.txt: Likewise. * test-diff-suppr/test17-suppr-added-var-report-1.txt: Likewise. * test-diff-suppr/test17-suppr-added-var-report-2.txt: Likewise. * test-diff-suppr/test17-suppr-added-var-report-3.txt: Likewise. * test-diff-suppr/test17-suppr-added-var-report-4.txt: Likewise. * test-diff-suppr/test17-suppr-added-var-report-5.txt: Likewise. * test-diff-suppr/test17-suppr-added-var-v0.cc: Likewise. * test-diff-suppr/test17-suppr-added-var-v1.cc: Likewise. * test-diff-suppr/test18-suppr-removed-var-v0.o: Likewise. * test-diff-suppr/test18-suppr-removed-var-v1.o: Likewise. * test-diff-suppr/test18-suppr-removed-var-0.suppr: Likewise. * test-diff-suppr/test18-suppr-removed-var-1.suppr: Likewise. * test-diff-suppr/test18-suppr-removed-var-2.suppr: Likewise. * test-diff-suppr/test18-suppr-removed-var-3.suppr: Likewise. * test-diff-suppr/test18-suppr-removed-var-4.suppr: Likewise. * test-diff-suppr/test18-suppr-removed-var-report-0.txt: Likewise. * test-diff-suppr/test18-suppr-removed-var-report-1.txt: Likewise. * test-diff-suppr/test18-suppr-removed-var-report-2.txt: Likewise. * test-diff-suppr/test18-suppr-removed-var-report-3.txt: Likewise. * test-diff-suppr/test18-suppr-removed-var-report-4.txt: Likewise. * test-diff-suppr/test18-suppr-removed-var-report-5.txt: Likewise. * test-diff-suppr/test18-suppr-removed-var-v0.cc: Likewise. * test-diff-suppr/test18-suppr-removed-var-v1.cc: Likewise. * tests/data/test-diff-suppr/test19-suppr-added-fn-sym-v0.o: New test input. * tests/data/test-diff-suppr/test19-suppr-added-fn-sym-v1.o: Likewise. * tests/data/test-diff-suppr/test19-suppr-added-fn-sym-0.suppr: Likewise. * tests/data/test-diff-suppr/test19-suppr-added-fn-sym-1.suppr: Likewise. * tests/data/test-diff-suppr/test19-suppr-added-fn-sym-2.suppr: Likewise. * tests/data/test-diff-suppr/test19-suppr-added-fn-sym-3.suppr: Likewise. * tests/data/test-diff-suppr/test19-suppr-added-fn-sym-4.suppr: Likewise. * tests/data/test-diff-suppr/test19-suppr-added-fn-sym-report-0.txt: Likewise. * tests/data/test-diff-suppr/test19-suppr-added-fn-sym-report-1.txt: Likewise. * tests/data/test-diff-suppr/test19-suppr-added-fn-sym-report-2.txt: Likewise. * tests/data/test-diff-suppr/test19-suppr-added-fn-sym-report-3.txt: Likewise. * tests/data/test-diff-suppr/test19-suppr-added-fn-sym-report-4.txt: Likewise. * tests/data/test-diff-suppr/test19-suppr-added-fn-sym-report-5.txt: Likewise. * tests/data/test-diff-suppr/test19-suppr-added-fn-sym-v0.cc: Likewise. * tests/data/test-diff-suppr/test19-suppr-added-fn-sym-v1.cc: Likewise. * tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-v0.o: Likewise. * tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-v1.o: Likewise. * tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-0.suppr: Likewise. * tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-1.suppr: Likewise. * tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-2.suppr: Likewise. * tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-3.suppr: Likewise. * tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-4.suppr: Likewise. * tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-report-0.txt: Likewise. * tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-report-1.txt: Likewise. * tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-report-2.txt: Likewise. * tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-report-3.txt: Likewise. * tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-report-4.txt: Likewise. * tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-report-5.txt: Likewise. * tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-v0.cc: Likewise. * tests/data/test-diff-suppr/test20-suppr-removed-fn-sym-v1.cc: Likewise. * tests/data/test-diff-suppr/test21-suppr-added-var-sym-v0.o: Likewise. * tests/data/test-diff-suppr/test21-suppr-added-var-sym-v1.o: Likewise. * tests/data/test-diff-suppr/test21-suppr-added-var-sym-0.suppr: Likewise. * tests/data/test-diff-suppr/test21-suppr-added-var-sym-1.suppr: Likewise. * tests/data/test-diff-suppr/test21-suppr-added-var-sym-2.suppr: Likewise. * tests/data/test-diff-suppr/test21-suppr-added-var-sym-3.suppr: Likewise. * tests/data/test-diff-suppr/test21-suppr-added-var-sym-4.suppr: Likewise. * tests/data/test-diff-suppr/test21-suppr-added-var-sym-report-0.txt: Likewise. * tests/data/test-diff-suppr/test21-suppr-added-var-sym-report-1.txt: Likewise. * tests/data/test-diff-suppr/test21-suppr-added-var-sym-report-2.txt: Likewise. * tests/data/test-diff-suppr/test21-suppr-added-var-sym-report-3.txt: Likewise. * tests/data/test-diff-suppr/test21-suppr-added-var-sym-report-4.txt: Likewise. * tests/data/test-diff-suppr/test21-suppr-added-var-sym-report-5.txt: Likewise. * tests/data/test-diff-suppr/test21-suppr-added-var-sym-v0.cc: Likewise. * tests/data/test-diff-suppr/test21-suppr-added-var-sym-v1.cc: Likewise. * tests/data/test-diff-suppr/test22-suppr-removed-var-sym-v0.o: Likewise. * tests/data/test-diff-suppr/test22-suppr-removed-var-sym-v1.o: Likewise. * tests/data/test-diff-suppr/test22-suppr-removed-var-sym-0.suppr: Likewise. * tests/data/test-diff-suppr/test22-suppr-removed-var-sym-1.suppr: Likewise. * tests/data/test-diff-suppr/test22-suppr-removed-var-sym-2.suppr: Likewise. * tests/data/test-diff-suppr/test22-suppr-removed-var-sym-3.suppr: Likewise. * tests/data/test-diff-suppr/test22-suppr-removed-var-sym-4.suppr: Likewise. * tests/data/test-diff-suppr/test22-suppr-removed-var-sym-report-0.txt: Likewise. * tests/data/test-diff-suppr/test22-suppr-removed-var-sym-report-1.txt: Likewise. * tests/data/test-diff-suppr/test22-suppr-removed-var-sym-report-2.txt: Likewise. * tests/data/test-diff-suppr/test22-suppr-removed-var-sym-report-3.txt: Likewise. * tests/data/test-diff-suppr/test22-suppr-removed-var-sym-report-4.txt: Likewise. * tests/data/test-diff-suppr/test22-suppr-removed-var-sym-report-5.txt: Likewise. * tests/data/test-diff-suppr/test22-suppr-removed-var-sym-v0.cc: Likewise. * tests/data/test-diff-suppr/test22-suppr-removed-var-sym-v1.cc: Likewise. * tests/data/Makefile.am: Add the new test materials above to source distribution. * tests/test-diff-suppr.cc (in_out_specs): Add the new tests material above to the list of test inputs this harness has to run over. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
0cd814766b |
Support new 'accessed_through' suppression property
It turned out it's important to be able to suppress changes about types that are reachable from a function parameter only through e.g, a pointer or a reference, so that only changes types that are reachable directly from a function parameter are emitted. This patch adds that feature. While doing this, I noticed this: Suppose a diff node D2 is marked as being redundant with a diff node D1 seen previously. So only D1 is reported; D2 is not, because it's been filtered out, because it's redundant with D1. But then suppose D1 is filtered out, due to a suppression specification. At that point, D2 should not be marked redundant anymore, and should be reported. Of course, the code before this patch was wrongly filtering D2 *and* D1 out. So this patch fixes that. * include/abg-comparison.h (enum type_suppression::reach_kind): Define new enum. (type_suppression::{get_consider_reach_kind, set_consider_reach_kind, get_reach_kind, mark_last_diff_visited_per_class_of_equivalence, clear_last_diffs_visited_per_class_of_equivalence, get_last_visited_diff_of_class_of_equivalence}): Declare new member functions. * src/abg-comparison.cc (diff_has_ancestor_filtered_out) (read_suppression_reach_kind): Define static function. (type_suppression::priv::{consider_reach_kind_, reach_kind_}): Define new data members. (type_suppression::priv::priv): Take a new reach_kind parameter. (type_suppression::type_suppression): Adjust to new prototype of priv constructor. (type_suppression::{get_consider_reach_kind, set_consider_reach_kind, get_reach_kind, set_reach_kind}): Define new member functions. (type_suppression::suppresses_diff): Interpret the result of type_suppression::get_reach_kind() to determine if the suppression specification suppresses a given diff node. (read_type_suppression): Support reading the content of the "accessed_through" property. (diff_context::priv::last_visited_diff_node_): New data member. (diff_context::{mark_last_diff_visited_per_class_of_equivalence, clear_last_diffs_visited_per_class_of_equivalence, get_last_visited_diff_of_class_of_equivalence}): Define new data members. (redundancy_marking_visitor::visit_begin): So if the current diff node has already been visited, but if the previously visited node has been filtered out, then do not mark this node as being redundant. And mark the current diff node as being the last visited one in its class of equivalence. (categorize_redundancy): Clear the map of diff nodes visited per class of equivalence. * doc/manuals/libabigail-concepts.rst: Document the new 'accessed_through' property. * tests/data/test-diff-suppr/test13-suppr-through-pointer-0.suppr: New test input data. * tests/data/test-diff-suppr/test13-suppr-through-pointer-report-{0,1}.txt: Likewise. * tests/data/test-diff-suppr/libtest13-suppr-through-pointer-v{0,1}.so: New test input binaries. * tests/data/test-diff-suppr/test13-suppr-through-pointer-v{0,1}.cc: Source code of the test input binaries above. * tests/data/test-diff-suppr/test14-suppr-non-redundant-0.suppr: New test input data. * tests/data/test-diff-suppr/test14-suppr-non-redundant-report-0.txt: Likewise. * tests/data/test-diff-suppr/test14-suppr-non-redundant-v{0,1}.o: New test input binaries. * tests/data/test-diff-suppr/test14-suppr-non-redundant-v{0,1}.cc: Source code of the binaries above. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
d0bd599b4b |
Support specifying data member insertion in suppressions
This patch is for supporting this kind of things: [suppress_type] name = S has_data_member_inserted_between = {8, end} or: [suppress_type] name = S has_data_members_inserted_between = {{8, 31}, {64, end}} or: [suppress_type] name = S has_data_members_inserted_at = offset_after(member0) How cool is that, heh? Anyway, to do this, the patch adds support for tuple values (i.e, lists of values) in INI files. Then on top of that the patch adds support for the specific has_data_member_inserted_between, has_data_members_inserted_between and has_data_members_inserted_at properties. * include/abg-comparison.h (type_suppression::insertion_range): Declare new type. (type_suppression::insertion_ranges): Declare new typedef. (type_suppression::{s,g}et_data_member_insertion_ranges): Declare new member functions. (is_integer_boundary, is_fn_call_expr_boundary): Declare new functions. (type_suppression::insertion_range::{boundary, integer_boundary, fn_call_expr_boundary}): Define new types. * src/abg-comparison.cc: (struct type_suppression::insertion_range::priv): New type. (type_suppression::insertion_range::{insertion_range, begin, end}): Define new member functions. (type_suppression::priv::insertion_ranges_): Add data member. (type_suppression::{s,g}et_data_member_insertion_ranges): Define new member functions. (type_suppression::insertion_range::boundary::priv): Define new type. (type_suppression::insertion_range::boundary::{boundary, ~boundary}): Define new member functions. (type_suppression::insertion_range::integer_boundary::priv): Define new type. (type_suppression::insertion_range::integer_boundary::{integer_boundary, as_integer, operator int, ~integer_boundary}): Define member functions. (type_suppression::insertion_range::fn_call_expr_boundary::priv): Define new type. (type_suppression::insertion_range::fn_call_expr_boundary::{fn_call_expr_boundary, as_function_call_expr, operator ini::function_call_expr_sptr}): Define new member functions. (type_suppression::insertion_range::{create_integer_boundary, type_suppression::insertion_range::create_fn_call_expr_boundary, type_suppression::insertion_range::eval_boundary}): Define new member functions. (is_integer_boundary, is_fn_call_expr_boundary): Define new functions. (read_type_suppression, read_function_suppression) (read_variable_suppression): Support the new kinds of property-related types. Aslo, in read_type_suppression, support the new properties has_data_member_inserted_at, has_data_member_inserted_between and has_data_members_inserted_between. (type_suppression::suppresses_diff): If we are looking at a type diff node that has inserted data members, evaluate the insertion ranges of the current type_suppression and see if they match the inserted data members. * include/abg-ini.h (property, simple_property, property_value) (string_property_value, tuple_property_value, function_call_expr): Declare new types. (property_sptr, property_value_sptr, string_property_value_sptr) (tuple_property_value_sptr): Declare new typedefs. (is_string_property_value, is_tuple_property_value) (is_simple_property, is_tuple_property, read_function_call_expr): Declare new functions. * src/abg-ini.cc (char_is_white_space, char_is_comment_start) (char_is_delimiter, char_is_property_value_char) (char_is_section_name_char, char_is_property_name_char) (char_is_comment_start, char_is_white_space) (remove_trailing_white_spaces, is_string_property_value) (is_tuple_property_value, is_simple_property, is_tuple_property) (write_property_value, char_is_function_name_char) (char_is_function_argument_char): Define new functions. (property::priv, tuple_property_value::priv) (simple_property::priv, tuple_property::priv): Define new types. (property::{property, get_name, set_name, ~property}): Define new member functions. (struct property_value::priv): Define new type. (property_value::{property_value, get_kind, operator const string&(), ~property_value}): Define new member functions. (struct string_property_value::priv): Define new type. (string_property_value::{string_property_value, set_content, as_string, operator string()}, ~string_property_value): Define new member functions. (tuple_property_value::{tuple_property_value, get_value_items, ~tuple_property_value, as_string}): Likewise. (simple_property::{simple_property, get_value, set_value, ~simple_property}): Likewise. (tuple_property::{tuple_property, set_value, get_value}): Likewise. (config::section::find_property): Adjust return type. (read_context::{char_is_delimiter, char_is_property_value_char, char_is_section_name_char, char_is_property_name_char, char_is_comment_start, char_is_white_space}): Remove these from here as they got moved them to be non-member functions above. (read_context::read_property_value): Return a property_value_sptr and do not take any parameter anymore. (read_context::{read_string_property_value, read_tuple_property_value, read_function_name, read_function_argument, read_function_call_expr}): Define new member functions. (read_context::read_property): Adjust return type. Also, change to read the different new kinds of properties values. (function_call_expr::priv): Define new type. (function_call_expr::{function_call_expr, get_name, get_arguments}): New member functions. (read_context::read_section): Adjust. (write_property, write_section): Adjust. * tests/data/test-diff-suppr/libtest{11,12}-add-data-member-v{0,1}.so: New test input binaries. * tests/data/test-diff-suppr/test{11,12}-add-data-member-{0,1}.suppr: New input suppression files. * tests/data/test-diff-suppr/test11-add-data-member-{2,3,4}.suppr: Add new test input files. * tests/data/test-diff-suppr/test{11,12}-add-data-member-report-{0,1}.txt: New reference output files. * tests/data/test-diff-suppr/test12-add-data-member-report-2.txt: Likewise. * tests/data/test-diff-suppr/test{11,12}-add-data-member-v{0,1}.cc: Source code for the new binaries above. * tests/test-diff-suppr.cc (in_out_specs): Add new test inputs. * tests/data/Makefile.am: Add the new test related files above to source distribution. * doc/manuals/libabigail-concepts.rst: Document the new properties has_data_member_inserted_at, has_data_member_inserted_between and has_data_members_inserted_between. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
fc55e7f343 |
Make abidiff and abicompat return meaningful exit codes
As per https://sourceware.org/bugzilla/show_bug.cgi?id=18146, abidiff the exit code of abidiff and abicompat is now a bit field that can be inspected to know if the ABI change reported is incompatible for sure, or if it needs user review of the output to decide. This patch also updates the documentation. * doc/manuals/abicompat.rst: Update documentation for abicompat exit codes. * doc/manuals/abidiff.rst: Likewise for abidiff exit codes. * include/abg-tools-utils.h (enum abidiff_status): Declare new enum. (operator{|,&,|=}): Declare new operators for the new enum abidiff_status. (abidiff_status_has_error, abidiff_status_has_abi_change) (abidiff_status_has_incompatible_abi_change): Declare new functions. * src/abg-tools-utils.cc (operator{|,&,|=}): Define these new operators. (abidiff_status_has_error, abidiff_status_has_abi_change) (abidiff_status_has_incompatible_abi_change): Define new functions. * tests/test-diff-filter.cc (main): Adjust for the new exit code of abidiff. * tests/test-diff-suppr.cc (main): Likewise. * tests/test-abicompat.cc (main): Likewise. * tools/abicompat.cc (enum abicompat_status): Remove. (operator{|,&,|=}): Remove these operators for enum abicompat_status. (perform_compat_check_in_normal_mode) (perform_compat_check_in_weak_mode): Return abidiff_status instead of abicompat_status. Adjust therefore. (main): Adjust to return abidiff_status now, instead of a just zero for all non-error cases. * tools/abidiff.cc (main): Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
322b0e7769 |
Expose a new libabigail::tools_utils namespace
The utilities present in this namespace were previously living in tools/abg-tools-utils.h and tools/abg-tools-utils.cc. They were not exported and were meant to be useful to the tools writting in the tools/ directory. I realized that these utilities might be useful to clients of the libabigail library in general so I am making them available generally. Note that the initial name of the namespace was libabigail::tools; so renaming it to libabigail::tools_utils required that I adjust some client code. I have also cleaned up the code, interfaces and their apidoc a little bit. * include/abg-tools-utils.h: Moved tools/abg-tools-utils.h in here. Renamed the namespace tools into tools_utils. Inject std::ostream, std::istream, std::ifstream, and std::string types into the tools_utils namespace. Adjust the function declarations accordingly. Remove the useless dirname() function declaration. * include/Makefile.am: Add abg-tools-utils.h to the list of exported headers. * src/abg-tools-utils.cc: Moved tools/abg-tools-utils.cc in here. Renamed the namespace tools into tools_utils. (get_stat): Add apidoc. (is_dir): Cleanup apidoc. (dir_name); Cleanup parameter name. (guess_file_type): Cleanup parameter type. * src/Makefile.am: Add abg-tools-utils.cc to the list of exported headers. * tools/Makefile.am: Do not build the temporary library libtoolsutils.la anymore as abg-tools-utils.{h,cc} have moved out of this directory. * tools/abicompat.cc (parse_command_line, main): Adjust for tools -> tools_utils namespace change. * tools/abidiff.cc (parse_command_line, main): Likewise. * tools/abidw.cc (parse_command_line, main): Likewise. * tools/abilint.cc (parse_command_line, main): Likewise. * tests/test-abicompat.cc (main): Adjust for tools -> tools_utils namespace change. * tests/test-abidiff.cc (main): Likewise. * tests/test-alt-dwarf-file.cc (main): Likewise. * tests/test-core-diff.cc (main): Likewise. * tests/test-diff-dwarf.cc (main): Likewise. * tests/test-diff-filter.cc (main): Likewise. * tests/test-diff-suppr.cc (main): Likewise. * tests/test-lookup-syms.cc (main): Likewise. * tests/test-read-dwarf.cc (main): Likewise. * tests/test-read-write.cc (main): Likewise. * tests/Makefile.am: Do not reference the libtoolsutils.la private library anymore. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
76837d1cbf |
Update copyright years
* include/abg-comp-filter.h: Update copyright years. * include/abg-comparison.h: Likewise. * include/abg-config.h: Likewise. * include/abg-corpus.h: Likewise. * include/abg-diff-utils.h: Likewise. * include/abg-dwarf-reader.h: Likewise. * include/abg-fwd.h: Likewise. * include/abg-hash.h: Likewise. * include/abg-ini.h: Likewise. * include/abg-ir.h: Likewise. * include/abg-libxml-utils.h: Likewise. * include/abg-libzip-utils.h: Likewise. * include/abg-reader.h: Likewise. * include/abg-sptr-utils.h: Likewise. * include/abg-traverse.h: Likewise. * include/abg-viz-common.h: Likewise. * include/abg-viz-dot.h: Likewise. * include/abg-viz-svg.h: Likewise. * include/abg-writer.h: Likewise. * src/abg-comp-filter.cc: Likewise. * src/abg-comparison.cc: Likewise. * src/abg-config.cc: Likewise. * src/abg-corpus.cc: Likewise. * src/abg-diff-utils.cc: Likewise. * src/abg-dwarf-reader.cc: Likewise. * src/abg-hash.cc: Likewise. * src/abg-ini.cc: Likewise. * src/abg-ir.cc: Likewise. * src/abg-libxml-utils.cc: Likewise. * src/abg-libzip-utils.cc: Likewise. * src/abg-reader.cc: Likewise. * src/abg-traverse.cc: Likewise. * src/abg-viz-common.cc: Likewise. * src/abg-viz-dot.cc: Likewise. * src/abg-viz-svg.cc: Likewise. * src/abg-writer.cc: Likewise. * tests/print-diff-tree.cc: Likewise. * tests/test-abidiff.cc: Likewise. * tests/test-alt-dwarf-file.cc: Likewise. * tests/test-core-diff.cc: Likewise. * tests/test-diff-dwarf.cc: Likewise. * tests/test-diff-filter.cc: Likewise. * tests/test-diff-suppr.cc: Likewise. * tests/test-diff2.cc: Likewise. * tests/test-ir-walker.cc: Likewise. * tests/test-lookup-syms.cc: Likewise. * tests/test-read-dwarf.cc: Likewise. * tests/test-read-write.cc: Likewise. * tests/test-utils.cc: Likewise. * tests/test-utils.h: Likewise. * tests/test-write-read-archive.cc: Likewise. * tools/abg-tools-utils.cc: Likewise. * tools/abg-tools-utils.h: Likewise. * tools/abiar.cc: Likewise. * tools/abidiff.cc: Likewise. * tools/abidw.cc: Likewise. * tools/abilint.cc: Likewise. * tools/abisym.cc: Likewise. * tools/binilint.cc: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
1e82b98af2 |
Do not mark sibling structurally identical nodes as redundant
Consider the C code below: int foo(int a, int b) { } that is changed as: float foo(float a, float b) { } In this case, we want the 'abidiff' tool to report the three occurrences of the 'int' -> 'float' change (in the return type and in the two parameter changes of the function foo). In the current code, the comparison engine only reports the first occurrence of the change and consider the two other occurrences as being redundant. So, by default, it only reports the first occurrence of the change. This patch modifies the comparison engine to make it *NOT* mark the two later occurrences of change as redundant because the three occurrences of changes happen at the same logical level: they are all children of the function diff node in the diff tree. * include/abg-comparison.h (diff::parent_node): Declare new accessor. * src/abg-comparison.cc (diff::priv::parent_): New data member. (diff::priv::priv): Initialize it. (diff::parent_node): Define new accessor. (diff::append_child_node): Set the diff::priv::parent_ data member of the added child node. (redundancy_marking_visitor::visit_begin): If two (logical) sibbling nodes are structurally equivalent, do not mark them as being redundant. * tests/data/test-diff-suppr/libtest10-changed-parm-c-v0.so: New test input binary. * tests/data/test-diff-suppr/libtest10-changed-parm-c-v1.so: Likewise. * tests/data/test-diff-suppr/test10-changed-parm-c-report-0.txt: New test input data. * tests/data/test-diff-suppr/test10-changed-parm-c-v0.c: Source code for the binary input above. * tests/data/test-diff-suppr/test10-changed-parm-c-v1.c: Likewise. * tests/data/Makefile.am: Add the new test files to source distribution. * tests/test-diff-suppr.cc (in_out_specs): Add the new test input to the vector of test inputs to run this harness over. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
817aa5555e |
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:#️⃣: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>
|
||
Dodji Seketeli
|
8f994b5e29 |
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> |
||
Dodji Seketeli
|
2e896ce107 |
Initial support for variable suppressions
* include/abg-comparison.h (variable_suppression_sptr) (variable_suppressions_type): New convenience typedefs. (class variable_suppression): Declare new type. * src/abg-comparison.cc (is_var_diff): New predicate. (read_variable_suppression): Define new static function. (class variable_suppression::priv): Define type for the private data of the variable_suppression type. (variable_suppression::{variable_suppression, ~variable_suppression, get_name, set_name, get_name_regex_str, set_name_regex_str, get_symbol_name, set_symbol_name, get_symbol_name_regex_str, set_symbol_name_regex_str, get_symbol_version, set_symbol_version, get_symbol_version_regex_str, set_symbol_version_regex_str, get_type_name, set_type_name, get_type_name_regex_str, set_type_name_regex_str, suppresses_diff}): Define new member functions for the variable_suppression type. * tests/data/test-diff-suppr/libtest7-var-suppr-v0.so: Add new test input. * tests/data/test-diff-suppr/libtest7-var-suppr-v1.so: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-1.suppr: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-2.suppr: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-3.suppr: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-4.suppr: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-5.suppr: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-6.suppr: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-7.suppr: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-8.suppr: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-report-0.txt: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-report-1.txt: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-report-2.txt: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-report-3.txt: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-report-4.txt: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-report-5.txt: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-report-6.txt: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-report-7.txt: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-report-8.txt: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-version-script: Likewise. * tests/data/test-diff-suppr/test7-var-suppr-v0.cc: Source code for the librairie above. * tests/data/test-diff-suppr/test7-var-suppr-v1.cc: Source code for the librairie above. * tests/Makefile.am: Add the new test input data to the source distribution. * tests/test-diff-suppr.cc: Update to make this harness to run over the new test input above. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
23772b3f8d |
Initial support for function suppressions
* include/abg-comparison.h (enum visiting_kind): Change the meaning of this. It was to determine if traversal was to be done in a pre or post manner. But with the recent addition of diff_node_visitor::visit_{begin,end}() notifiers, the pre/post handling is taken care of in a different way. So now the meaning of this enum is changed to handle whether diff node children should be visited or not. So the enumerators are now DEFAULT_VISITING_KIND, and SKIP_CHILDREN_VISITING_KIND. And it's a bit-field. (operator{&,~}): Declare more bit manipulation operators for the enum visiting_kind. (function_suppression_sptr, function_suppressions_type): New typedefs. (function_suppression, function_suppression::parameter_spec): Declare new types. (read_function_suppressions): Declare new function. (diff_node_visitor::diff_node_visitor): Adjust for the enum visiting_kind change. Value-initialize the visiting_kind_ data member. * src/abg-comparison.cc (operator{&,~}): Define these operators for enum visiting_kind. (read_type_suppressions): Forward declare this static function. (read_function_suppression, read_parameter_spec_from_string): Define new static functions. (read_suppressions): Update to read function suppressions too, using the new read_function_suppression function above. (class function_suppression::parameter_spec::priv): Define new type. (function_suppression::parameter_spec::*): Define the member functions of the new function_suppression::parameter_spec type. (class function_suppression::priv): Define new type. (function_suppression::*): Define the member functions of the new function_suppression type. (diff::traverse): There is no more {PRE,POST}_VISITING_KIND enumerator. So nuke the code that was dealing with it. (redundancy_marking_visitor::skip_children_nodes_): New data member flag. (redundancy_marking_visitor::visit_begin): If the current diff node is not be reported (is filtered out), do not bother visit its children nodes for the purpose of marking redundant nodes. So use the new skip_children_nodes_ flag above to know we are in that case. (redundancy_marking_visitor::visit_end): Unset the new skip_children_nodes_ flag above when appropriate. * include/abg-fwd.h (is_function_decl): Declare new function. * include/abg-ir.h (function_type::get_parm_at_index_from_first_non_implicit_parm): Declare new member function. * src/abg-ir.cc (is_function_decl): Define new function. (function_type::get_parm_at_index_from_first_non_implicit_parm): Define new member function. * src/abg-comp-filter.cc (apply_filter): Adjust for the enum visiting_kind change. No need to set it for filters anymore * doc/suppr-doc.txt: Update examples of function suppression. * doc/manuals/libabigail-concepts.rst: Update the manual for the function suppression addition. * tests/data/test-diff-suppr/libtest5-fn-suppr-v0.so: New test input. * tests/data/test-diff-suppr/libtest5-fn-suppr-v1.so: New test input. * tests/data/test-diff-suppr/libtest6-fn-suppr-v0.so: New test input. * tests/data/test-diff-suppr/libtest6-fn-suppr-v1.so: New test input. * tests/data/test-diff-suppr/test5-fn-suppr-0.suppr: New test input. * tests/data/test-diff-suppr/test5-fn-suppr-1.suppr: New test input. * tests/data/test-diff-suppr/test5-fn-suppr-2.suppr: New test input. * tests/data/test-diff-suppr/test5-fn-suppr-3.suppr: New test input. * tests/data/test-diff-suppr/test5-fn-suppr-4.suppr: New test input. * tests/data/test-diff-suppr/test5-fn-suppr-report-0.txt: New test input. * tests/data/test-diff-suppr/test5-fn-suppr-report-1.txt: New test input. * tests/data/test-diff-suppr/test5-fn-suppr-report-2.txt: New test input. * tests/data/test-diff-suppr/test5-fn-suppr-report-3.txt: New test input. * tests/data/test-diff-suppr/test5-fn-suppr-report-4.txt: New test input. * tests/data/test-diff-suppr/test5-fn-suppr-report-5.txt: New test input. * tests/data/test-diff-suppr/test5-fn-suppr-v0.cc: Source code for new test input. * tests/data/test-diff-suppr/test5-fn-suppr-v1.cc: Source code for new test input. * tests/data/test-diff-suppr/test6-fn-suppr-0.suppr: New test input. * tests/data/test-diff-suppr/test6-fn-suppr-1.suppr: New test input. * tests/data/test-diff-suppr/test6-fn-suppr-2.suppr: New test input. * tests/data/test-diff-suppr/test6-fn-suppr-3.suppr: New test input. * tests/data/test-diff-suppr/test6-fn-suppr-report-0.txt: New test input. * tests/data/test-diff-suppr/test6-fn-suppr-report-1.txt: New test input. * tests/data/test-diff-suppr/test6-fn-suppr-report-2.txt: New test input. * tests/data/test-diff-suppr/test6-fn-suppr-report-3.txt: New test input. * tests/data/test-diff-suppr/test6-fn-suppr-report-4.txt: New test input. * tests/data/test-diff-suppr/test6-fn-suppr-v0.cc: Source code for new test input. * tests/data/test-diff-suppr/test6-fn-suppr-v1.cc: Source code for new test input. * tests/data/test-diff-suppr/test6-fn-suppr-version-script: New test input. * tests/Makefile.am: Add the new files above to source the distribution. * tests/test-diff-suppr.cc (in_out_specs): Add the test inputs above to the list of tests to be run by this harness. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
4e07799f42 |
Properly propagate {REDUNDANT, SUPPRESSED}_CATEGORY wrt local changes
* src/abg-comparison.cc (suppression_categorization_visitor::visit_end): If a diff node carries local changes, then, even if all of its children node have been suppressed, this diff node shall not be categorized as suppressed by way of propagation. (redundancy_marking_visitor::visit_end): If a diff node carries local changes, then, even if all of its children nodes are redundant, this diff node shall not be categorized as being redundant by way of propagation. * tests/data/test-diff-suppr/libtest4-local-suppr-v{0,1}.so: New test inputs. * tests/data/test-diff-suppr/test4-local-suppr-0.suppr: Likewise. * tests/data/test-diff-suppr/test4-local-suppr-report-{0,1}.txt: Likewise. * tests/data/test-diff-suppr/test4-local-suppr-v{0,1}.{c,h}: Source code of the new tests inputs. * tests/Makefile.am: Add the new test material to the source distribution. * tests/test-diff-suppr.cc (in_out_spec): Run this test harness over the new test input above. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
feea5df3fe |
Initial support for type suppressions
* include/abg-comparison.h (diff_category::SUPPRESSED_CATEGORY): New enumerator. (diff_category::{SIZE_OR_OFFSET_CHANGE_CATEGORY, VIRTUAL_MEMBER_CHANGE_CATEGORY): Update the enumerator values for these. (diff::EVERYTHING_CATEGORY): Adjust. (suppression_base, type_suppression): Declare new types. (suppression_ptr, suppressions_type, type_suppression_sptr) (type_suppressions_type): New typedefs. (read_type_suppressions, read_suppressions): Declare new functions. (diff_context::{suppressions, add_suppression, add_suppressions}): Declare new methods. (diff::is_suppressed): Declare new member function. (apply_suppressions): Declare new function & overloads. * src/abg-comparison.cc (is_type_diff): Define new static function. ({suppression_base, type_suppression}::priv): Define new types. ({suppression_base, type_suppression}::*): Define the methods of the new suppression_base, type_suppressions types. (read_type_suppression, read_type_suppressions, read_suppressions) (read_type_suppressions): Define new static functions. (diff_context::priv::supprssions_): New data member. (diff_context::{suppressions, add_suppression, add_suppressions}): New methods. (diff::is_filtered_out): Consider that a diff node that is in the SUPPRESSED_CATEGORY is filtered out. (diff::is_suppressed): Define new member function. (operator<<(ostream& o, diff_category c)): Support the SUPPRESSED_CATEGORY category. (corpus_diff::report): Apply suppressions before reporting anything. (category_propagation_visitor::visit_end): Do not propagate SUPPRESSED_CATEGORY. This is just like what we do for REDUNDANT_CATEGORY. (struct suppression_categorization_visitor): New visitor. (apply_suppressions): Define function & overloads. * include/abg-ini.h (config::section::find_property): New method. (config::section): Fix end of class comment. * src/abg-ini.cc (config::section::find_property): Define new method. * tests/data/test-diff-suppr/test0-type-suppr-{0,1,2}.suppr: New test input files. * tests/data/test-diff-suppr/test0-type-suppr-report-{0,1,2,3}.txt: Likewise. * tests/data/test-diff-suppr/test0-type-suppr-v{0,1}.o: Likewise. * tests/data/test-diff-suppr/test0-type-suppr-v{0,1}.cc: Source code for new test input. * tests/data/test-diff-suppr/test1-typedef-suppr-v{0,1}.o: New test input files. * tests/data/test-diff-suppr/test1-typedef-suppr.h: Source code for new test input files. * tests/data/test-diff-suppr/test1-typedef-suppr-v{0,1}.c: Likewise * tests/data/test-diff-suppr/test1-typedef-suppr-{0,1}.suppr: New test input files. * tests/data/test-diff-suppr/test1-typedef-suppr-report-0.txt: Likewise. * tests/data/test-diff-suppr/test1-typedef-suppr-report-1.txt: Likewise. * tests/data/test-diff-suppr/test1-typedef-suppr-report-2.txt: Likewise. * tests/test-diff-suppr.cc: New test harness to run type suppression tests using the input files above. * tests/data/test-diff-suppr/test3-struct-suppr-0.suppr: New test input. * tests/data/test-diff-suppr/test3-struct-suppr-1.suppr: Likewise. * tests/data/test-diff-suppr/test3-struct-suppr-report-0.txt: Likewise. * tests/data/test-diff-suppr/test3-struct-suppr-report-1.txt: Likewise. * tests/data/test-diff-suppr/test3-struct-suppr-report-2.txt: Likewise. * tests/data/test-diff-suppr/test3-struct-suppr-v0.cc: Likewise. * tests/data/test-diff-suppr/test3-struct-suppr-v0.o: Likewise. * tests/data/test-diff-suppr/test3-struct-suppr-v1.cc: Likewise. * tests/data/test-diff-suppr/test3-struct-suppr-v1.o: Likewise. * tests/Makefile.am: Build the new runtestdiffsuppr test harness from the test-diff-filter.cc file. Add the new test files to the build system and source distribution. * tools/bidiff.cc (options::suppressions): New data member. (display_usage): Add a help string for the new --suppressions command line switch. (parse_command_line): Parse the --suppressions command line switch. (set_diff_context_from_opts): Read the suppressions provided by the --suppression command line switch and stuff them into the diff context. |