mirror of
git://sourceware.org/git/libabigail.git
synced 2024-12-16 06:54:37 +00:00
247b4a1815
46 Commits
Author | SHA1 | Message | Date | |
---|---|---|---|---|
Dodji Seketeli
|
1d6731c438 |
Update copyright year to 2020
We are in February 2020 so this is long overdue. * include/abg-comp-filter.h: Update copyright year to 2020. * include/abg-comparison.h: Likewise. * include/abg-config.h: Likewise. * include/abg-corpus.h: Likewise. * include/abg-cxx-compat.h: Likewise. * include/abg-diff-utils.h: Likewise. * include/abg-dwarf-reader.h: Likewise. * include/abg-fwd.h: Likewise. * include/abg-hash.h: Likewise. * include/abg-ini.h: Likewise. * include/abg-interned-str.h: Likewise. * include/abg-ir.h: Likewise. * include/abg-libxml-utils.h: Likewise. * include/abg-libzip-utils.h: Likewise. * include/abg-reader.h: Likewise. * include/abg-reporter.h: Likewise. * include/abg-sptr-utils.h: Likewise. * include/abg-suppression.h: Likewise. * include/abg-tools-utils.h: Likewise. * include/abg-traverse.h: Likewise. * include/abg-viz-common.h: Likewise. * include/abg-viz-dot.h: Likewise. * include/abg-viz-svg.h: Likewise. * include/abg-workers.h: Likewise. * include/abg-writer.h: Likewise. * src/abg-comp-filter.cc: Likewise. * src/abg-comparison-priv.h: Likewise. * src/abg-comparison.cc: Likewise. * src/abg-config.cc: Likewise. * src/abg-corpus-priv.h: Likewise. * src/abg-corpus.cc: Likewise. * src/abg-default-reporter.cc: Likewise. * src/abg-diff-utils.cc: Likewise. * src/abg-dwarf-reader.cc: Likewise. * src/abg-hash.cc: Likewise. * src/abg-ini.cc: Likewise. * src/abg-internal.h: Likewise. * src/abg-ir-priv.h: Likewise. * src/abg-ir.cc: Likewise. * src/abg-leaf-reporter.cc: Likewise. * src/abg-libxml-utils.cc: Likewise. * src/abg-libzip-utils.cc: Likewise. * src/abg-reader.cc: Likewise. * src/abg-reporter-priv.cc: Likewise. * src/abg-reporter-priv.h: Likewise. * src/abg-sptr-utils.cc: Likewise. * src/abg-suppression-priv.h: Likewise. * src/abg-suppression.cc: Likewise. * src/abg-tools-utils.cc: Likewise. * src/abg-traverse.cc: Likewise. * src/abg-viz-common.cc: Likewise. * src/abg-viz-dot.cc: Likewise. * src/abg-viz-svg.cc: Likewise. * src/abg-workers.cc: Likewise. * src/abg-writer.cc: Likewise. * tests/print-diff-tree.cc: Likewise. * tests/test-abicompat.cc: Likewise. * tests/test-abidiff-exit.cc: Likewise. * tests/test-abidiff.cc: Likewise. * tests/test-alt-dwarf-file.cc: Likewise. * tests/test-core-diff.cc: Likewise. * tests/test-diff-dwarf-abixml.cc: Likewise. * tests/test-diff-dwarf.cc: Likewise. * tests/test-diff-filter.cc: Likewise. * tests/test-diff-pkg.cc: Likewise. * tests/test-diff-suppr.cc: Likewise. * tests/test-diff2.cc: Likewise. * tests/test-dot.cc: Likewise. * tests/test-ini.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-svg.cc: Likewise. * tests/test-tools-utils.cc: Likewise. * tests/test-types-stability.cc: Likewise. * tests/test-utils.cc: Likewise. * tests/test-utils.h: Likewise. * tests/test-write-read-archive.cc: Likewise. * tools/abiar.cc: Likewise. * tools/abicompat.cc: Likewise. * tools/abidiff.cc: Likewise. * tools/abidw.cc: Likewise. * tools/abilint.cc: Likewise. * tools/abipkgdiff.cc: Likewise. * tools/abisym.cc: Likewise. * tools/binilint.cc: Likewise. * tools/kmidiff.cc: Likewise. * update-copyright.sh: Fix the updating script to handle not just "Red Hat, Inc." Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
6a0e7e120b |
abixml-reader: Support SONAME related properties on file suppression
When comparing binary files (using abidiff for instance) libabigail can interpret the [suppress_file] section of a suppression specification. If the suppression specification matches either of the compared files, no comparison is performed. At the moment, that doesn't work when comparing abixml files. Thus, this patch implements that feature for abixml files. With this patch, one can now write a suppression specification like this: [suppress_file] soname_regexp = <some-regexp> or [suppress_file] file_name_regexp = <some-regexp> If either abixml file has a soname matched by such a regexp, then no comparison is performed. * doc/manuals/libabigail-concepts.rst: Update the documentation to mention soname_regexp and soname_not_regexp is supported in the [suppress_file] section. * include/abg-suppression.h (suppression_matches_soname) (suppression_matches_soname_or_filename): Declare new functions. Make them be friends of class suppression_base. * src/abg-reader.cc (read_context::corpus_is_suppressed_by_soname_or_filename): Define new member function. (read_corpus_from_input): Apply file suppression. * src/abg-suppression.cc (read_file_suppression): Support "soname_regexp" and "soname_not_regexp" in the [suppress_file] section. (suppression_matches_soname) (suppression_matches_soname_or_filename): Define new functions. * tests/data/test-diff-suppr/libtest48-soname-abixml-report-{1,2}.txt: New test reference output files. Likewise. * tests/data/test-diff-suppr/libtest48-soname-abixml-suppr.txt: New test suppression file. * tests/data/test-diff-suppr/libtest48-soname-abixml-suppr-{2,3,4}.txt:: Likewise. * tests/data/test-diff-suppr/libtest48-soname-abixml-v{0,1}.so: New test binary input files. * tests/data/test-diff-suppr/libtest48-soname-abixml-v{0,1}.so.abi: New abixml for the binary input files above. * tests/data/test-diff-suppr/test48-soname-abixml-v{0,1}.c: Source code of the binary input files above. * tests/data/Makefile.am: Add the above test material to source distribution. * tests/test-diff-suppr.cc (in_out_specs): Add the test input above to this test harness. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Matthias Maennich
|
e84537afea |
abidiff/kmidiff: do not default-suppress added symbols
kmidiff and abidiff do filter out added symbols (vars, functions and symbols without debug info) by default when dealing with kernel binaries. The reason for this is that the ABI could be considered compatible and not broken when adding symbols. In practice, this is confusing as there is no possibility for a symmetric comparison (i.e. a deleted function when comparing left to right is an added function when comparing right to left). Furthermore, there is no option available to actually report these added symbols. I thought of adding an option to report added symbols, but in the end came to the conclusion that we should behave consistent across the various ways you can diff an ABI with abidiff and kmidiff and should not change default behaviour for a particular type of binary. Hence, remove the default behaviour of filtering out added symbols when comparing kernel binaries. To restore the current behaviour, the user needs to parametrize with the tools with --no-added-syms --no-unreferenced-symbols. Adjusted test cases accordingly and add a new test that covers the old behaviour new available with additional flags to abidiff. * tools/abidiff.cc (adjust_diff_context_for_kmidiff): Drop default suppression of added symbols. * tools/kmidiff.cc (set_diff_context): Likewise. * tests/data/test-diff-suppr/test46-PR25128-report-1.txt: Adjust test expectation. * tests/data/test-diff-suppr/test46-PR25128-report-2.txt: Add test case for abidiff with flag --no-added-syms. * tests/data/Makefile.am: add new testcase. Reviewed-by: Dodji Seketeli <dodji@seketeli.org> Signed-off-by: Matthias Maennich <maennich@google.com> |
||
Dodji Seketeli
|
c32b8ec9f3 |
Bug 24690 - Support comparing non-reachable types of a binary
This patch adds the ability to compare all types of a binary, including those types that are not reachable from global functions and variables. This implies that for types that are not reachable from public interfaces, we want compare them against each others directly, without first comparing global functions/variables and walking the graph of reachable types from there. The patch adds the --non-reachable-types option to abidiff and abipkgdiff, instructing them to also compare types that are non-reachable from global variables and functions. Using that option, for instance, here is what the summary of abipkgdiff now looks like, in the test case attached added by this patch: ================ changes of 'libflatpak.so.0.10204.0'=============== Functions changes summary: 0 Removed, 0 Changed (16 filtered out), 16 Added functions Variables changes summary: 0 Removed, 0 Changed, 0 Added variable Unreachable types summary: 3 removed (2 filtered out), 1 changed (15 filtered out), 3 added (1 filtered out) types You can see that there is a new summary line which starts with the string: "Unreachable types summary:" Then in the body of the report, those unreachable types are reported separately. In practise, we want to limit the unreachable types to compare somehow, otherwise we'll end up comparing all the types of the types of the binary and that can be huge. So we want to limit the unreachable type analysis to types that are defined in public headers. So, for abipkgdiff, one can limit the analysis of non-reachable types to those defined in public headers by supplying the --devel{1,2} options that specifies the development packages that contain said public headers. For abidiff however, you'll want to use the --headers-dir{1,2} options for that. The patch comes with appropriate regression tests. * include/abg-comparison.h (string_type_base_sptr_map): Define new typedef. (diff_context::show_unreachable_types): Declare new member functions. (corpus_diff::{deleted_unreachable_types, deleted_unreachable_types_sorted, added_unreachable_types, added_unreachable_types_sorted, changed_unreachable_types, changed_unreachable_types_sorted}): Likewise. (maybe_report_unreachable_type_changes): Declare this function a friend of class corpus_diff. (corpus_diff::diff_stats::{num_added_unreachable_types, num_added_unreachable_types_filtered_out, net_num_added_unreachable_types, num_removed_unreachable_types, num_removed_unreachable_types_filtered_out, net_num_removed_unreachable_types, num_changed_unreachable_types, num_changed_unreachable_types_filtered_out, net_num_changed_unreachable_types}): Likewise. * src/abg-comparison-priv.h (diff_context::priv::show_unreachable_types_): Define new data member. (diff_context::priv::priv): Initialize the new data member. (diff_comp::operator()): Use pretty representation of diff subjects to sort them, rather than just their name. Also, add comment to the other member functions of diff_comp. (corpus_diff::{unreachable_types_edit_script_, deleted_unreachable_types_, deleted_unreachable_types_sorted_, suppressed_deleted_unreachable_types_, added_unreachable_types_, added_unreachable_types_sorted_, suppressed_added_unreachable_types_, changed_unreachable_types_, changed_unreachable_types_sorted_}): Define new data members. (corpus_diff::priv::apply_supprs_to_added_removed_fns_vars_unreachable_types): Changed the name of corpus_diff::priv::apply_suppressions_to_added_removed_fns_vars into this. (corpus_diff::priv::{added_unreachable_type_is_suppressed, deleted_unreachable_type_is_suppressed, changed_unreachable_types_sorted, count_unreachable_types}): Declare new member functions. (corpus_diff::diff_stats::priv::{num_added_unreachable_types, num_added_unreachable_types_filtered_out, num_removed_unreachable_types, num_removed_unreachable_types_filtered_out, num_changed_unreachable_types, num_changed_unreachable_types_filtered_out}): Define new data members. (sort_string_type_base_sptr_map): Declare new function. * src/abg-comparison.cc (sort_string_type_base_sptr_map) (diff_context::show_unreachable_types): Define new functions. (corpus_diff::diff_stats::{num_added_unreachable_types, num_added_unreachable_types_filtered_out, net_num_added_unreachable_types, net_num_removed_unreachable_types, num_removed_unreachable_types_filtered_out, num_removed_unreachable_types}): Define new member functions. (diff_maps::insert_diff_node): Do not update the map "diff -> impacted interfaces" if the current impacted interface is nil. This happens if we are looking at a diff node for a change on a type that is not reachable from any interfaces. (corpus_diff::priv::ensure_lookup_tables_populated): Handle the edit script for unreachable types. (corpus_diff::priv::apply_supprs_to_added_removed_fns_vars_unreachable_types): Rename corpus_diff::priv::apply_suppressions_to_added_removed_fns_vars into this. Apply suppression specifications to added and removed unreachable types as well. (corpus_diff::priv::{added,deleted}_unreachable_type_is_suppressed): Define new member functions. (corpus_diff::priv::{count_unreachable_types, changed_unreachable_types_sorted}): Likewise. (corpus_diff::priv::apply_filters_and_compute_diff_stats): Update statistics (including walking changed unreachable types to apply categorization and redundancy filters to them) related to unreachable types. (corpus_diff::priv::emit_diff_stats): Emit diff stats related to unreachable types. (corpus_diff::priv::maybe_dump_diff_tree): Dump diff tree nodes related to unreachable types. (corpus_diff::{deleted_unreachable_types, deleted_unreachable_types_sorted, added_unreachable_types, added_unreachable_types_sorted, changed_unreachable_types, changed_unreachable_types_sorted): Define new member functions. (corpus_diff::has_changes): Take deleted/added/changed unreachable types into account. (corpus_diff::has_incompatible_changes): Take net removed/changed unreachable types into account. (corpus_diff::has_net_subtype_changes): Take net removed and changed unreachable types into account. (corpus_diff::has_net_changes): Take net removed/added/changed unreachable types into account. (corpus_diff::traverse): When traversing the components of a corpus_diff node, make sure to traverse the changed unreachable types of the corpus. (leaf_diff_node_marker_visitor::visit_begin): Arrange for the fact that the current topmost interface can be nil if we are looking at types not reachable from global functions/variables. Also, make sure that only leaf nodes that are reachable from a global function/variable are recorded as leaf nodes. (compute_diff): In the overload for corpus_sptr, compute the changes between types not reachable from global functions and variables, if the user wishes that we do so. Also, add more comments. (apply_suppressions): Update for the name change of the function apply_suppressions_to_added_removed_fns_vars to apply_supprs_to_added_removed_fns_vars_unreachable_types. * include/abg-corpus.h (corpus::{record_type_as_reachable_from_public_interfaces, type_is_reachable_from_public_interfaces, get_types_not_reachable_from_public_interfaces}): Declare new member functions. (corpus::recording_types_reachable_from_public_interface_supported): Declare new virtual member function. (corpus_group::get_public_types_pretty_representations): Declare new member functons. (corpus_group::recording_types_reachable_from_public_interface_supported): Declare new virtual member function. * src/abg-corpus-priv.h (corpus::priv::{types_not_reachable_from_pub_ifaces_, pub_type_pretty_reprs_}): Define new data members. (corpus::priv::priv): Initialize the pub_type_pretty_reprs_ data member because it's a pointer. (corpus::priv::get_public_types_pretty_representations): Declare new member function. (corpus::priv::~priv): Declare a destructor. * src/abg-corpus.cc (corpus::priv::get_public_types_pretty_representations): Define new member function. (corpus::priv::~priv): Define new destructor to delete the new pub_type_pretty_reprs_ member pointer. (corpus::{record_type_as_reachable_from_public_interfaces, type_is_reachable_from_public_interfaces, get_types_not_reachable_from_public_interfaces, recording_types_reachable_from_public_interface_supported}): Define new member functions (corpus_group::get_public_types_pretty_representations): Likewise. * include/abg-diff-utils.h (struct deep_ptr_eq_functor): Document the equality operator. Also, add an overload to the equality operator, for weak_ptr<T>. The existing equality operator overload was just for shared_ptr<T>. * include/abg-fwd.h (is_user_defined_type): Declare function. * include/abg-ir.h (operator!=(const decl_base_sptr&, const decl_base_sptr&)): Declare new operator. (type_maps::get_types_sorted_by_name): Declare new member function. (decl_base::{g,s}et_is_artificial): Declare new member function. (function_decl::parameter::{g,s}et_artificial): Remove these member functions. * src/abg-ir.cc (operator!=(const decl_base_sptr&, const decl_base_sptr&)): Define new operator. (decl_base::priv::is_artificial_): Define new data member. (type_maps::priv::sorted_types_): Define new data member. (struct type_name_comp): Define new comparison functor to sort types based on their pretty representations. (decl_base::priv::priv): Initialize it. (decl_base::{g,s}et_is_artificial): Define new member functions. (type_maps::get_types_sorted_by_name): Define new member function. (is_user_defined_type): Define new function overloads. (strip_typedef, function_type::{function_type, set_parameters}): Adjust using decl_base::get_is_artificial rather than function_decl::parameter::get_artificial. (function_decl::parameter::priv::artificial_): Remove this data member. (function_decl::parameter::priv::priv): Adjust to the removal of function_decl::parameter::priv::artificial_. This constructor does not take an "is_artificial" flag anymore. (function_decl::parameter::parameter): Adjust to the removal of the is_artificial flag from the arguments of the constructor of function_decl::parameter::parameter::priv. (function_decl::parameter::get_artificial): Remove this member function. * src/abg-reporter-priv.h (maybe_report_unreachable_type_changes): Declare new function. * src/abg-reporter-priv.cc (maybe_report_unreachable_type_changes): Define new function. * src/abg-default-reporter.cc (default_reporter::report): In the overload for corpus_diff&, report added/removed/changed types that are not reachable from global functions and variables using the new function maybe_report_unreachable_type_changes. * src/abg-leaf-reporter.cc (leaf_reporter::report): In the overload for corpus_diff, report changes to types unreachable from global functions or variables, using the new function maybe_report_unreachable_type_changes. * src/abg-dwarf-reader.cc (build_ir_node_from_die): When the user requests that all types be loaded, record relevant types as reachable from global functions and variables. (build_enum_type, add_or_update_class_type) (add_or_update_union_type): Read the 'is-artificial' DWARF attribute and set the corresponding decl_base property accordingly. (finish_member_function_reading, strip_typedef) (function_type::function_type): Adjust using decl_base::get_is_artificial, rather than function_decl::parameter::get_artificial. * include/abg-reader.h (consider_types_not_reachable_from_public_interfaces): Declare new function. * src/abg-reader.cc (read_context::m_tracking_non_reachable_types): Add new data member. (read_context::read_context): Initialize it. (read_context::tracking_non_reachable_types): Define accessors for the new data member above. (read_is_declaration_only): Re-indent. (read_is_artificial): Define new helper function. (build_function_parameter): Use the new read_is_artificial function here, rather than open-coding it. (build_enum_type_decl, build_class_decl, build_union_decl): Support reading the 'is-artificial' property by using the new read_is_artificial function. (read_corpus_from_input): If the user wants us to take non-reachable types into account, then make sure we do so. (read_tracking_non_reachable_types, read_is_non_reachable_type): Define new static functions. (handle_element_node, build_type): Read the "is-non-reachable" attribute on type element nodes if the user wants us to track non-reachable types. (consider_types_not_reachable_from_public_interfaces): Define new function. * src/abg-writer.cc (write_is_artificial): Define new static helper function. (annotate): Adjust using decl_base::get_is_artificial rather than function_decl::parameter::get_artificial. (write_enum_type_decl, write_class_decl_opening_tag) (write_union_decl_opening_tag): Support writing the "is-artificial" property, using the new write_is_artificial function. (write_function_type): Adjust this to use the new write_is_artificial rather than open-coding writing the 'is-artificial' attribute. (write_is_non_reachable) (write_tracking_non_reachable_types): Define new static functions. (write_enum_type_decl, write_class_decl_opening_tag) (write_union_decl_opening_tag): Write the 'is-no-reachable' attribute when applicable. (write_corpus, write_corpus_group): Write the 'tracking-non-reachable-types' attribute when applicable. * tools/abidiff.cc (options::options): Initialize ... (options::show_all_types): ... new data member. (display_usage): Add help string from the new --non-reachable-types option. (parse_command_line): Parse the new --non-reachable-types option. (set_diff_context_from_opts): Set the dwarf_reader::read_context::show_unreachable_types property. (set_native_xml_reader_options): Define new static function. (main): Load all types when analyzing the DWARF or the ABIXML files, if the user wants us to do so. * tools/abipkgdiff.cc (options::show_all_types): Define new data member. (options::options): Initialize it. (parse_command_line): Parse the --non-reachable-types option to set the options::show_all_types data member. (display_usage): Add a help string for the new --non-reachable-types option. (set_diff_context_from_opts): Set the dwarf_reader::read_context::show_unreachable_types property based on the options::show_all_type data member. (compare): Configure the read context to load all types while analyzing the DWARF info, depending on the options::show_all_type data member. * doc/manuals/abidiff.rst: Document the new --non-reachable-types option added to abidiff above. * doc/manuals/abipkgdiff.rst: Add documentation for the --non-reachable-types option. * tests/data/test-diff-suppr/test47-non-reachable-types-v{0,1}.c: Source code files of test binary input. * tests/data/test-diff-suppr/test47-non-reachable-types-suppr-{1,2,3,4,5}.txt: New test input files. * tests/data/test-diff-suppr/test47-non-reachable-types-report-{1,2,3,4,5,6,7,8,9,10}.txt: New test reference output files. * tests/data/test-diff-suppr/test47-non-reachable-types-v{0,1}.o.alltypes.abixml: New test input abixml. * tests/data/Makefile.am: Add the new test material to source distribution. * tests/test-diff-suppr.cc (in_out_specs): Add the new tests above to this test harness. * tests/data/test-abidiff/test-struct1-report.txt: Adjust. * tests/data/test-diff-pkg/PR24690/flatpak-debuginfo-1.2.4-3.fc30.x86_64.rpm: New input binary RPM. * tests/data/test-diff-pkg/PR24690/flatpak-debuginfo-1.4.0-1.fc30.x86_64.rpm: Likewise. * tests/data/test-diff-pkg/PR24690/flatpak-devel-1.2.4-3.fc30.x86_64.rpm: Likewise. * tests/data/test-diff-pkg/PR24690/flatpak-devel-1.4.0-1.fc30.x86_64.rpm: Likewise. * tests/data/test-diff-pkg/PR24690/flatpak-libs-1.2.4-3.fc30.x86_64.rpm: Likewise. * tests/data/test-diff-pkg/PR24690/flatpak-libs-1.4.0-1.fc30.x86_64.rpm: Likewise. * tests/data/test-diff-pkg/PR24690/flatpak-libs-debuginfo-1.2.4-3.fc30.x86_64.rpm: Likewise. * tests/data/test-diff-pkg/PR24690/flatpak-libs-debuginfo-1.4.0-1.fc30.x86_64.rpm: Likewise. * tests/data/test-diff-pkg/PR24690/PR24690-report-0.txt: New test reference output. * tests/data/Makefile.am: Add the new test material above to source distribution. * tests/test-diff-pkg.cc (in_out_specs): Add the new test material above to this test harness. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
1f4dbe3515 |
Bug 25128 - Leaf diff reporter shouldn't compare decl-only classes
The leaf_diff_node_marker_visitor pass which collects leaf diff nodes for the leaf diff reporter considers bogus decl-only classes (that have the is-declaration-only flag set, are empty, and yet have a non-nil size property) originated from bogus DWARF. The leaf reporter thus potentially reports size changes among decl-only classes, which does not make sense. Two decl-only classes of the same name should always be considered equal, in this context. This patch thus teaches the leaf_diff_node_marker_visitor to avoid collecting a leaf diff node that is about a size change on a true decl-only class. * include/abg-comp-filter.h (is_decl_only_class_with_size_change): Declare new function. * src/abg-comp-filter.cc (is_decl_only_class_with_size_change): Define new function. * src/abg-comparison.cc (leaf_diff_node_marker_visitor::visit_begin): Use the newly defined is_decl_only_class_with_size_change above to ignore bogus decl-only classes with a size change. * tests/data/test-diff-suppr/test45-abi-report-1.txt: New test input. * tests/data/test-diff-suppr/test45-abi-wl.xml: Likewise. * tests/data/test-diff-suppr/test45-abi.xml: Likewise. * tests/data/test-diff-suppr/test45-abi.suppr.txt: New reference output for the test input above. * tests/data/test-diff-suppr/test46-PR25128-base.xml: New test input. * tests/data/test-diff-suppr/test46-PR25128-new.xml: Likewise. * tests/data/test-diff-suppr/test46-PR25128-report-1.txt: New reference input for the test input above. * tests/data/Makefile.am: Add the new test material to source distribution. * tests/test-diff-suppr.cc (in_out_spec): Add the new test input above to this test harness. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
b00976517f |
Support symbol_name_not_regexp in [suppress_{function, variable}]
In the suppress_function and suppress_variable directives of the suppression specification language, we lack the 'symbol_name_not_regexp' properties, that would allow users to specify which (function/variable) symbols to *keep* as opposed to specifying which symbols to suppress. This patch adds that feature. That will later allow us to make the linux kernel symbol white lists[1] functionality use this feature; that is, upon analysing the content of a kernel symbol whitelist which lists a symbol named "foo", Libabigail would automatically generate a suppression specification which contains, e.g a 'suppress_function" directive that has this new 'symbol_name_not_regexp' property which value is set to "foo". Note that the patch makes sure that feature is supported when analyzing both abixml and DWARF formats. [1]: You can learn about what a Linux Kernel symbols white list is by reading about it at https://sourceware.org/libabigail/manual/kmidiff.html#environment. * doc/manuals/libabigail-concepts.rst: Document the new symbol_name_not_regexp properties for the suppress_{function,variable} directives. * include/abg-suppression.h ({function,variable}_suppression::{g,s}et_symbol_name_not_regex_str): Declare new member functions. * src/abg-dwarf-reader.cc (read_context::is_elf_symbol_suppressed): Define new member functions. (read_context::{load_symbol_maps_from_symtab_section, populate_symbol_map_from_ksymtab, populate_symbol_map_from_ksymtab_reloc}): Drop suppressed symbols when reading symbol tables. ({function,variable}_is_suppressed): Consider that in C, the linkage name is _by default_ the same as the function/variable name. Remove local variable. * include/abg-ir.h (elf_symbol_is_{function,variable}): Add ... * src/abg-ir.cc (elf_symbol_is_{function,variable}): ... new functions. * src/abg-reader.cc (build_elf_symbol): Take an additional boolean to detect and drop suppressed symbols. (build_elf_symbol_db): Adjust the call to build_elf_symbol to make it detect and drop suppressed symbols. (read_corpus_from_input): Be mindful that the set of symbols for a given corpus can be empty because of suppression specifications. * src/abg-suppression-priv.h ({function,variable}_suppression::priv::symbol_name_not_regex[_str_]): Add new data members. (function,variable}_suppression::priv::get_symbol_name_not_regex): Add new member functions. ({function,variable}_is_suppressed): Guard against empty name. (is_elf_symbol_suppressed): Define new function template. * src/abg-suppression.cc ({function,variable}_suppression::{g,s}et_symbol_name_not_regex_str): Define new member functions. ({function,variable}_suppression::suppresses_function) (suppression_matches_{function,variable}_sym_name) (read_{function,variable}_suppression): Support the new "symbol_name_not_regex" property. * tests/data/test-diff-suppr/test44-suppr-sym-name-not-regexp-report-1.txt: New test reference report. * tests/data/test-diff-suppr/test44-suppr-sym-name-not-regexp-report-2.txt: Likewise. * tests/data/test-diff-suppr/test44-suppr-sym-name-not-regexp-v{0,1}.c: Sources of the new test input. * tests/data/test-diff-suppr/test44-suppr-sym-name-not-regexp-v{0,1}.o: New test input binaries. * tests/data/test-diff-suppr/test44-suppr-sym-name-not-regexp-v{0,1}.o.abi: New test input abixml files. * tests/data/test-diff-suppr/test44-suppr-sym-name-not-regexp.suppr.txt: Next test suppression specification. * tests/data/Makefile.am: Add the new test material above to source distribution. * tests/test-diff-suppr.cc (in_out_specs): Add the input tests above to the test harness. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
d2c88645e8 |
Support the "name_not_regexp" property in the [suppress_type] section
When writting a suppression specification in which the user wants to keep a family of types (whose names set is specified by a regular expression) and suppress/drop all other types, one needs to write something like: [suppress_type] name_regexp = (?!the-regexp-of-the-types-to-keep) It would be nicer (like what is done for other properties that take regular expressions as value in suppression specifications) to be able to write: [suppress_type] name_not_regexp = the-regexp-of-types-to-keep This patch does just that. It augments the abigail::suppr::type_suppression type to make it carry the new 'name_not_regex' property. It updates the suppression engine to take the 'name_not_regex' property into account when interpreting instances of abigail::suppr::type_suppression. The parser for type suppression directives is updated to recognize the new name_not_regexp property. The manual has been updated accordingly to describe the new property. New regression tests have been added. * doc/manuals/libabigail-concepts.rst: Update this to document the new name_not_regexp property of the suppress_type directive. * include/abg-suppression.h (type_suppression::{g,s}et_type_name_not_regex_str): Declare new accessors. * src/abg-suppression-priv.h (type_suppression::priv::{type_name_not_regex_str_, type_name_not_regex_}): Define new data members. (type_suppression::priv::{get_type_name_not_regex, set_type_name_not_regex, get_type_name_not_regex_str, set_type_name_not_regex_str}): Define new member functions. * src/abg-suppression.cc (type_suppression::get_type_name_regex_str): Fix comments. (type_suppression::{set_type_name_not_regex_str, get_type_name_not_regex_str}): Define new data members. (suppression_matches_type_name): Adapt to support the new type_name_not_regex property. (read_type_suppression): Support parsing the type_name_not_regexp property. * tests/data/test-diff-suppr/test42-negative-suppr-type-report-0.txt: New test reference output. * tests/data/test-diff-suppr/test42-negative-suppr-type-report-1.txt: Likewise. * tests/data/test-diff-suppr/test42-negative-suppr-type-suppr-1.txt: New test input. * tests/data/test-diff-suppr/test42-negative-suppr-type-suppr-2.txt: Likewise. * tests/data/test-diff-suppr/test42-negative-suppr-type-v0.{cc, o}: Likewise. * tests/data/test-diff-suppr/test42-negative-suppr-type-v1.{cc, o}: Likewise. * tests/data/Makefile.am: Add the test files above to source distribution. * tests/test-diff-suppr.cc (int_out_specs): Add the new tests to the harness. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
bdd927f663 |
Better propagation of suppressed-ness to function types
In the comparison engine, when a sub-type of a function type (say, a parameter type size change) has been suppressed, this suppression is not necessarily well propagated to the function carrying the function type, because the parameter type size, for instance, is considered as a type local change to that function; and we generally don't propagate suppression to a non-suppressed parent diff node that already carries a local change. This leads to an empty change report for the function we are looking at because the only sub-type change has been suppressed. This patch properly propagates the suppressed-ness in that case, so that the parent function diff node is suppressed as well. * src/abg-comparison.cc (suppression_categorization_visitor::visit_end): Propagate suppression-ness from suppressed function type diff node to its parent function node if the latter doesn't have any local non-type change. * tests/data/test-diff-suppr/test43-suppr-direct-fn-subtype-report-1.txt: New test reference output. * tests/data/test-diff-suppr/test43-suppr-direct-fn-subtype-suppr-1.txt: New test input suppression file. * tests/data/test-diff-suppr/test43-suppr-direct-fn-subtype-v{0,1}.cc: Source code of input binary file. * tests/data/test-diff-suppr/test43-suppr-direct-fn-subtype-v{0,1}.o: Input binary files. * tests/data/Makefile.am: Add the new test input files above to source distribution. * tests/test-diff-suppr.cc (in_out_specs): Add the test input to test harness. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
3826ab5308 |
Bug 24139 - Support suppressing some enumerator changes
This patch teaches the suppression specification subsystem how to ignore changes of some enumerators in particular. The patch adds a new property to the [suppress_type] section which is: changed_enumerators = enumerator1, enumerator2, etc This property is taken into accound iff the current suppress_type does have the 'type_kind = enum' property. Changes to enum types that match the new 'changed_enumerators' property are suppressed. * doc/manuals/libabigail-concepts.rst: Document the new 'changed_enumerators' property. * include/abg-suppression.h (type_suppression::{g, s}et_changed_enumerator_names): Declare two new member functions. * src/abg-suppression-priv.h (type_suppression::priv::changed_enumerator_names_): Add a new data member. * src/abg-suppression.cc (type_suppression::{g,s}et_changed_enumerator_names): Define two new member functions. (type_suppression::suppresses_diff): Support evaluating the new 'changed_enumerators = <vector of changed enumerators>'. (read_type_suppression): Read the new list property'changed_enumerators" and store it into the type_suppression using the new type_suppression::set_changed_enumerator_names (). * tests/data/test-diff-suppr/libtest4{0,1}-enumerator-changes-v{0,1}.so: Add new test inpujts. * tests/data/test-diff-suppr/test4{0,1}-enumerator-changes-0.suppr: Add a new suppr spec for this new test. * tests/data/test-diff-suppr/test4{0,1}-enumerator-changes-report-0.txt: The default report. * tests/data/test-diff-suppr/test4{0,1}-enumerator-changes-v{0,1}.cc: Add Source code of libtest4{0,1}-enumerator-changes-v{0,1}.so. * tests/data/Makefile.am: Add the test files above to source distribution. * tests/test-diff-suppr.cc: Add the test input files above to the harness. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
047342467c |
Update copyright for 2019
* include/abg-comp-filter.h: Update copyright for 2019 * include/abg-comparison.h: Update copyright for 2019 * include/abg-config.h: Update copyright for 2019 * include/abg-corpus.h: Update copyright for 2019 * include/abg-diff-utils.h: Update copyright for 2019 * include/abg-dwarf-reader.h: Update copyright for 2019 * include/abg-fwd.h: Update copyright for 2019 * include/abg-hash.h: Update copyright for 2019 * include/abg-ini.h: Update copyright for 2019 * include/abg-interned-str.h: Update copyright for 2019 * include/abg-ir.h: Update copyright for 2019 * include/abg-libxml-utils.h: Update copyright for 2019 * include/abg-libzip-utils.h: Update copyright for 2019 * include/abg-reader.h: Update copyright for 2019 * include/abg-reporter.h: Update copyright for 2019 * include/abg-sptr-utils.h: Update copyright for 2019 * include/abg-suppression.h: Update copyright for 2019 * include/abg-tools-utils.h: Update copyright for 2019 * include/abg-traverse.h: Update copyright for 2019 * include/abg-viz-common.h: Update copyright for 2019 * include/abg-viz-dot.h: Update copyright for 2019 * include/abg-viz-svg.h: Update copyright for 2019 * include/abg-workers.h: Update copyright for 2019 * include/abg-writer.h: Update copyright for 2019 * src/abg-comp-filter.cc: Update copyright for 2019 * src/abg-comparison-priv.h: Update copyright for 2019 * src/abg-comparison.cc: Update copyright for 2019 * src/abg-config.cc: Update copyright for 2019 * src/abg-corpus-priv.h: Update copyright for 2019 * src/abg-corpus.cc: Update copyright for 2019 * src/abg-default-reporter.cc: Update copyright for 2019 * src/abg-diff-utils.cc: Update copyright for 2019 * src/abg-dwarf-reader.cc: Update copyright for 2019 * src/abg-hash.cc: Update copyright for 2019 * src/abg-ini.cc: Update copyright for 2019 * src/abg-internal.h: Update copyright for 2019 * src/abg-ir-priv.h: Update copyright for 2019 * src/abg-ir.cc: Update copyright for 2019 * src/abg-leaf-reporter.cc: Update copyright for 2019 * src/abg-libxml-utils.cc: Update copyright for 2019 * src/abg-libzip-utils.cc: Update copyright for 2019 * src/abg-reader.cc: Update copyright for 2019 * src/abg-reporter-priv.cc: Update copyright for 2019 * src/abg-reporter-priv.h: Update copyright for 2019 * src/abg-sptr-utils.cc: Update copyright for 2019 * src/abg-suppression-priv.h: Update copyright for 2019 * src/abg-suppression.cc: Update copyright for 2019 * src/abg-tools-utils.cc: Update copyright for 2019 * src/abg-traverse.cc: Update copyright for 2019 * src/abg-viz-common.cc: Update copyright for 2019 * src/abg-viz-dot.cc: Update copyright for 2019 * src/abg-viz-svg.cc: Update copyright for 2019 * src/abg-workers.cc: Update copyright for 2019 * src/abg-writer.cc: Update copyright for 2019 * tests/print-diff-tree.cc: Update copyright for 2019 * tests/test-abicompat.cc: Update copyright for 2019 * tests/test-abidiff-exit.cc: Update copyright for 2019 * tests/test-abidiff.cc: Update copyright for 2019 * tests/test-alt-dwarf-file.cc: Update copyright for 2019 * tests/test-core-diff.cc: Update copyright for 2019 * tests/test-diff-dwarf-abixml.cc: Update copyright for 2019 * tests/test-diff-dwarf.cc: Update copyright for 2019 * tests/test-diff-filter.cc: Update copyright for 2019 * tests/test-diff-pkg.cc: Update copyright for 2019 * tests/test-diff-suppr.cc: Update copyright for 2019 * tests/test-diff2.cc: Update copyright for 2019 * tests/test-ini.cc: Update copyright for 2019 * tests/test-ir-walker.cc: Update copyright for 2019 * tests/test-lookup-syms.cc: Update copyright for 2019 * tests/test-read-dwarf.cc: Update copyright for 2019 * tests/test-read-write.cc: Update copyright for 2019 * tests/test-types-stability.cc: Update copyright for 2019 * tests/test-utils.cc: Update copyright for 2019 * tests/test-utils.h: Update copyright for 2019 * tests/test-write-read-archive.cc: Update copyright for 2019 * tools/abiar.cc: Update copyright for 2019 * tools/abicompat.cc: Update copyright for 2019 * tools/abidiff.cc: Update copyright for 2019 * tools/abidw.cc: Update copyright for 2019 * tools/abilint.cc: Update copyright for 2019 * tools/abipkgdiff.cc: Update copyright for 2019 * tools/abisym.cc: Update copyright for 2019 * tools/binilint.cc: Update copyright for 2019 * tools/kmidiff.cc: Update copyright for 2019 * update-copyright.sh: Update new year to 2019 Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
60daf958ae |
Fix propagation of private type suppression category
This is a partial fix of PR23700. Conceptually, there are two kinds of type suppression specifications: 1/ a generic user-provided suppression specification that is meant to suppress changes on types specified by the user 2/ a private type suppression specification that is automatically generated from the path to public header files provided by the user. Technically, one difference between 1 and 2 lays in the way we propagate categories of changes matched by those suppression specifications. If a class type change of category SUPPRESSED_CATEGORY is referenced in a typedef change, then the typedef change is also considered to be of category SUPPRESSED_CATEGORY. In other words, the SUPPRESSED_CATEGORY category is propagated to the typedef change. That means that if a change to a class type is suppressed, a (changed) typedef to that class is considered to be suppressed too. But then that is not true if the class type was changed because it's private. In that, a typedef to that class can be *public*, because the said typedef is defined in a public header. In that case the typedef change should *NOT* be considered suppressed just because the class type change was suppressed. The problem we have here is that we don't make any difference between 1/ and 2/. So we need to introduce different propagation rules for 1/ and 2/. So this patch introduces a new PRIVATE_TYPE_CATEGORY category for types suppression specification that are automatically generated for private types. That new category has its own propagation rule which is basically "no propagation"; every type must be matched by the private type suppression specification to be considered as private. * include/abg-comp-filter.h (has_harmful_name_change): Declare new function overloads. * include/abg-comparison.h (PRIVATE_TYPE_CATEGORY): New enumerator for diff_category; (EVERYTHING_CATEGORY): Adjust this enumerator in diff_category; (is_suppressed): Take an output parameter to say if the suppression is a private type suppression. * include/abg-suppression.h (is_private_type_suppr_spec): Take a const reference parameter and add an overload for a shared pointer. * src/abg-comp-filter.cc (has_harmful_name_change): Define new function. * src/abg-comparison-priv.h (diff::priv::is_filtered_out): Diffs of category PRIVATE_TYPE_CATEGORY are also considered filtered out. * src/abg-comparison.cc (diff::is_filtered_out): Adjust to account for canonical diffs of category PRIVATE_TYPE_CATEGORY. (diff::is_suppressed): Add an overload that takes a is_private_type output parameter. Re-write the old overload in terms of the new one. (operator<<(ostream& o, diff_category c)): Handle PRIVATE_TYPE_CATEGORY. (category_propagation_visitor::visit_end): Do not propagate PRIVATE_TYPE_CATEGORY here. Do not propagate HARMLESS_DECL_NAME_CHANGE_CATEGORY either, when the class does have a harmful decl name change. (suppression_categorization_visitor::visit_begin): Set the new PRIVATE_TYPE_CATEGORY category but do not propagate it. (suppression_categorization_visitor::visit_end): Add some comments. * src/abg-default-reporter.cc (default_reporter::report): Avoid reporting typedef underlying types that are in the PRIVATE_TYPE_CATEGORY category. * src/abg-suppression.cc (type_suppression::suppresses_diff): Do not peel typedefs if we are a private type suppression. (is_private_type_suppr_spec): Take a const reference. * tests/data/Makefile.am: Add the new test material below to source distribution. * tests/test-diff-suppr.cc: Use new test binary input. * tests/data/test-diff-filter/test7-report.txt: Adjust. * tests/data/test-diff-suppr/test39-opaque-type-report-0.txt: New test reference output. * tests/data/test-diff-suppr/test39-opaque-type-v{0,1}.c: Source code of new test binary input. * tests/data/test-diff-suppr/test39-opaque-type-v{0,1}.o: New test binary input. * tests/data/test-diff-suppr/test39-public-headers-dir/test39-header-v{0,1}.h: Source code of new test binary input. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
1478d9cc1c |
Allow square brackets in ini property values
Sometimes, one wants to be able to write suppression specifications like: [suppress_function] filename_regexp = ^test38-char-class-in-ini-v[[:digit:]].* symbol_name_regexp = bar change_kind = added-function without having to escape the square brackets in the regexp. Normally, one has to escape the '[' and the ']' because these characters are used to define ini section names (e.g, [suppress_function]). This patch allows the presence of the square bracket characters in a property value, making the suppression specification above valid. * src/abg-ini.cc (char_is_delimiter): Possibly disallow square bracket characters into the set of delimiters. * tests/data/test-diff-suppr/test38-char-class-in-ini-report-0.txt: New reference output. * tests/data/test-diff-suppr/test38-char-class-in-ini-v{0,1}.c: Source code new test binaries. * tests/data/test-diff-suppr/test38-char-class-in-ini-v{0,1}.o: New test binaries. * tests/data/test-diff-suppr/test38-char-class-in-ini.abignore: New test abi suppression file. * tests/data/Makefile.am: Add the new test materials above to source distribution. * tests/test-diff-suppr.cc: Add the test materials above to the set of tests to run. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
ef9d20c97c |
Fix redundancy detection through fn ptr and typedef paths
When analyzing the libfreetype.so binary, it appears that libabigail's diff node redundancy marking pass is failing to detect a redundant diff node in cases were the node is recursively referencing itself through a path that involves function type and typedef diff nodes. So it is only at reporting time that we'd detect that the node is redundant so we emit messages like "this change was reported earlier". But When the earlier change in question is suppressed due to, e.g, a suppression specification resulting from the user providing abidiff with the --headers-dir{1,2} command line option, then the change report becomes confusing, at best. The right behaviour is to detect the node is redundant and mark it as such, so that the reporting pass can avoid reporting it altogether. This is what this patch does. This patch changes the output of the runtestdiffpkg regression test. To update the reference output, we need an additional patch to handle a separate (but somewhat related) issue. That is going to be done in the subsequent commit which title is: "Filter out changes like type to const type" * include/abg-comparison.h (is_function_type_diff_with_local_changes) (is_reference_or_pointer_diff_to_non_basic_distinct_types) (peel_typedef_diff): Declare new functions. * src/abg-comparison.cc (is_function_type_diff_with_local_changes) (is_reference_or_ptr_diff_to_non_basic_nor_distinct_types) (peel_typedef_diff): Define new functions. (is_reference_or_pointer_diff): Peel typedefs before operating. (redundancy_marking_visitor::visit_begin): Only sibbling parameter diff node that carry basic type changes (or distinct type changes) are *not* marked as redundant. All other kinds of sibbling parameter diff nodes are markes redundant. Also, rather than never marking function type diffs as redundant by fear of missing local changes on these, just avoid marking function type diff nodes with local changes. It's possible to be that precise now that we can detect that a diff node carries local changes. * tests/data/test-diff-suppr/test37-opaque-type-v{0,1}.o: New binary tests input. * tests/data/test-diff-suppr/test37-opaque-type-v{0,1}.c: Source code of the binary tests input above. * tests/data/test-diff-suppr/test37-opaque-type-header-dir/test37-opaque-type-header-v{0,1}.h: Headers of the binary tests input above. * tests/data/test-diff-suppr/test37-opaque-type-report-0.txt: Reference output for this new test. * tests/data/Makefile.am: Add the new test material above to source distribution. * tests/test-diff-suppr.cc (in_out_specs): Add the new test input above to the test harness. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
b3c3049fdd |
Update copyright notice for all source files
Happy New Year 2018, I guess :-) * update-copyright.sh: New sed-based script to update the year in the copyright notice. * include/abg-comp-filter.h: Updated the year in the copyright notice. * include/abg-comparison.h: Likewise. * include/abg-config.h: Likewise. * include/abg-corpus.h: Likewise. * include/abg-diff-utils.h: Likewise. * include/abg-dwarf-reader.h: Likewise. * include/abg-fwd.h: Likewise. * include/abg-hash.h: Likewise. * include/abg-ini.h: Likewise. * include/abg-interned-str.h: Likewise. * include/abg-ir.h: Likewise. * include/abg-libxml-utils.h: Likewise. * include/abg-libzip-utils.h: Likewise. * include/abg-reader.h: Likewise. * include/abg-reporter.h: Likewise. * include/abg-sptr-utils.h: Likewise. * include/abg-suppression.h: Likewise. * include/abg-tools-utils.h: Likewise. * include/abg-traverse.h: Likewise. * include/abg-viz-common.h: Likewise. * include/abg-viz-dot.h: Likewise. * include/abg-viz-svg.h: Likewise. * include/abg-workers.h: Likewise. * include/abg-writer.h: Likewise. * src/abg-comp-filter.cc: Likewise. * src/abg-comparison-priv.h: Likewise. * src/abg-comparison.cc: Likewise. * src/abg-config.cc: Likewise. * src/abg-corpus-priv.h: Likewise. * src/abg-corpus.cc: Likewise. * src/abg-default-reporter.cc: Likewise. * src/abg-diff-utils.cc: Likewise. * src/abg-dwarf-reader.cc: Likewise. * src/abg-hash.cc: Likewise. * src/abg-ini.cc: Likewise. * src/abg-internal.h: Likewise. * src/abg-ir-priv.h: Likewise. * src/abg-ir.cc: Likewise. * src/abg-leaf-reporter.cc: Likewise. * src/abg-libxml-utils.cc: Likewise. * src/abg-libzip-utils.cc: Likewise. * src/abg-reader.cc: Likewise. * src/abg-reporter-priv.cc: Likewise. * src/abg-reporter-priv.h: Likewise. * src/abg-sptr-utils.cc: Likewise. * src/abg-suppression-priv.h: Likewise. * src/abg-suppression.cc: Likewise. * src/abg-tools-utils.cc: Likewise. * src/abg-traverse.cc: Likewise. * src/abg-viz-common.cc: Likewise. * src/abg-viz-dot.cc: Likewise. * src/abg-viz-svg.cc: Likewise. * src/abg-workers.cc: Likewise. * src/abg-writer.cc: Likewise. * tests/print-diff-tree.cc: Likewise. * tests/test-abicompat.cc: Likewise. * tests/test-abidiff-exit.cc: Likewise. * tests/test-abidiff.cc: Likewise. * tests/test-alt-dwarf-file.cc: Likewise. * tests/test-core-diff.cc: Likewise. * tests/test-diff-dwarf-abixml.cc: Likewise. * tests/test-diff-dwarf.cc: Likewise. * tests/test-diff-filter.cc: Likewise. * tests/test-diff-pkg.cc: Likewise. * tests/test-diff-suppr.cc: Likewise. * tests/test-diff2.cc: Likewise. * tests/test-ir-walker.cc: Likewise. * tests/test-lookup-syms.cc: Likewise. * tests/test-read-dwarf.cc: Likewise. * tests/test-read-write.cc: Likewise. * tests/test-types-stability.cc: Likewise. * tests/test-utils.cc: Likewise. * tests/test-utils.h: Likewise. * tests/test-write-read-archive.cc: Likewise. * tools/abiar.cc: Likewise. * tools/abicompat.cc: Likewise. * tools/abidiff.cc: Likewise. * tools/abidw.cc: Likewise. * tools/abilint.cc: Likewise. * tools/abipkgdiff.cc: Likewise. * tools/abisym.cc: Likewise. * tools/binilint.cc: Likewise. * tools/kmidiff.cc: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
108a6074a5 |
Initial implementation of a --leaf-changes-only option to abidiff
This patch allows abidiff to take the --leaf-changes-only option and then to display only the changes that are local to any given type. That means the reporting agent won't follow pointers when displaying changes. That gives less context to the ABI change reports but then they are less cluttered. To do this, the patch introduces a new reporting agent to libabigail: abigail::comparison::leaf_reporter. When given a graph of diff nodes, this agent only reports about the leaf (local) changes. That is, it will *NOT* follow pointers, references, underlying types of qualified and typedef types and things like that. It will just report about changes that are local to a given type. This reporting agent is then used (in lieu of the default abigail::comparison::default_reporter agent) when the --leaf-changes-only option is provided by the user on the command line of abidiff. Note that abidiff also takes the --impacted-interfaces option to so that the leaf reporter shows the set of interfaces impacted by each leaf change. * doc/manuals/abidiff.rst: Add documentation the new --leaf-changes-only and --impacted-interfaces options. * src/abg-leaf-reporter.cc: New file. * src/Makefile.am: Add the new src/abg-leaf-reporter.cc file to source distribution. * include/abg-fwd.h (get_var_size_in_bits) (function_decl_is_less_than): Declare new functions. (get_name): Add new overload for type_or_decl_base*. * include/abg-ir.h (struct type_or_decl_hash, type_or_decl_equal) (type_or_decl_base_comp): Define new types. (artifact_sptr_set_type, artifact_ptr_set_type): Define new typedefs. * include/abg-comp-filter.h: Update copyright year. (has_basic_type_name_change): Add new function declaration. * src/abg-comp-filter.cc (decl_name_changed): Take a type_or_decl_base rather than just a decl. Add an overload for diff*. (has_basic_type_name_change): Define new function. * include/abg-comparison.h: Update copyright year. (string_diff_ptr_map): Define this new typedef. (class diff_maps): Define this new class. (diff_context::{set_corpora}): Remove this member function. (diff_context::{set_corpus_diff, get_corpus_diff, show_leaf_changes_only, show_impacted_interfaces, forbid_visiting_a_node_twice_per_interface}): Declare these new member functions. (diff_node_visitor::priv_): Add a new pimpl data member. (diff_node_visitor::{diff_node_visitor, get_visiting_kind, set_visiting_kind}): Turn these into out-of-line member functions. (diff_node_visitor::{set,get}_current_topmost_iface_diff): Add new member functions. (class {scope_diff, function_type_diff, corpus_diff}): Add class leaf_reporter as a friend. (corpus_diff::mark_leaf_diff_nodes, get_leaf_diffs): Declare new member functions. (diff::{visiting_a_node_twice_is_forbidden_per_interface, parent_interface_node}): Define new member functions. (is_diff_of_basic_type): Return a type_decl_diff* rather than just a bool. (is_enum_diff, is_array_diff, is_function_type, is_typedef_diff) (is_corpus_diff): Declare new functions. (corpus_diff::diff_stats::{num_leaf_changes, num_leaf_changes_filtered_out, net_num_leaf_changes}): Add new member functions. (is_distinct_diff): Declare new function. * include/abg-reporter.h: Forward-declare "class diff_maps". (reporter_base::diff_to_be_reported): Declare a new virtual member function. (reporter_base::{report_local_typedef_changes, report_local_reference_type_changes, report_local_function_type_changes}): Declare new member functions. (class leaf_reporter): Define new type. * src/abg-comparison-priv.h (struct diff_hash, diff_equal): Define new types. (diff_artifact_set_map_type): Define new typedef. (diff_context::priv::{first_corpus_, second_corpus_}): Remove these data members. (diff_context::priv::{corpus_diff_, leaf_changes_only_, reset_visited_diffs_for_each_interface_, show_impacted_interfaces_}): Add new data members. (diff_context::priv::priv): Adjust. (corpus_diff::priv::{leaf_diffs_, parent_interface_}): Add new data member. (corpus_diff::diff_stats::priv::{num_leaf_changes, num_leaf_changes_filtered_out}): Add new data members. (corpus_diff::priv::count_leaf_changes): Define new member function. (sort_artifacts_set, get_fn_decl_or_var_decl_diff_ancestor) (is_diff_of_global_decls): Declare new functions. (function_comp::operator()): Factorize this out into the new function abigail::ir::function_decl_is_less_than. * src/abg-ir.cc (get_var_size_in_bits) (function_decl_is_less_than): Define new functions. (get_name): Define new overload for type_or_decl_base*. * src/abg-comparison.cc (is_enum_diff, is_typedef_diff) (is_array_diff, is_function_type_diff, is_corpus_diff) (is_distinct_diff, sort_artifacts_set, is_diff_of_global_decls): Define new functions. (is_union_diff): Fix comment. (diff_context::forbid_visiting_a_node_twice_per_interface): Define new member functions. (diff_context::set_corpus_diff, get_corpus_diff) (diff_context::show_leaf_changes_only) (diff_context::visiting_a_node_twice_is_forbidden_per_interface) (diff_context::show_impacted_interfaces): Define new member functions. (diff_context::get_reporter): Create the reporter that matches what diff_context::show_leaf_changes_only says. (diff_node_visitor::priv): Define a new type. (diff_node_visitor::{diff_node_visitor, get_visiting_kind, set_visiting_kind, or_visiting_kind, set_current_topmost_iface_diff, get_current_topmost_iface_diff}): Define new out-of-line member functions. (struct diff_maps::priv): Define new type. (diff_maps::{diff_maps, get_type_decl_diff_map, get_type_decl_diff_map, get_enum_diff_map, get_class_diff_map, get_union_diff_map, get_typedef_diff_map, get_array_diff_map, get_function_type_diff_map, get_function_decl_diff_map, get_var_decl_diff_map, get_reference_diff_map, get_fn_parm_diff_map, get_distinct_diff_map, insert_diff_node, lookup_impacted_interfaces}): Define member functions. (corpus_diff::{mark_leaf_diff_nodes, get_leaf_diffs}): Define new member functions. (struct leaf_diff_node_marker_visitor): Define new type. (corpus_diff::apply_filters_and_suppressions_before_reporting): Mark diff nodes in here. (corpus_diff::traverse): Appropriately set the current topmost interface into the visitor before visiting a diff node. (compute_diff): In the overload for corpus_sptr, adjust to reflect that we are now storing the corpus_diff in the diff context. (is_diff_of_basic_type): Return a type_decl_diff*, not just a bool. (corpus_diff::priv::count_leaf_changes): Define a new member function. (corpus_diff::diff_stats::{num_leaf_changes, num_leaf_changes_filtered_out, net_num_leaf_changes}): Define new member functions. (corpus_diff::priv::apply_filters_and_compute_diff_stats): Use the new corpus_diff::priv::count_leaf_changes to compute the number of leaf changes. (corpus_diff::priv::emit_diff_stats): Emit the report about leaf type changes when necessary. * src/abg-reporter-priv.h (report_mem_header): Declare new overload. (maybe_show_relative_offset_change,): Pass the var_diff_sptr parameter by const reference. (represent): Pass the var_diff_sptr parameter by const reference and take a new "local-only" flag. (maybe_show_relative_size_change) (maybe_report_interfaces_impacted_by_diff): Declare new functions. * src/abg-default-reporter.cc: Adjust copyright year. (default_reporter::{report_local_typedef_changes, report_local_qualified_type_changes, report_local_reference_type_changes, report_local_function_type_changes}): Define new member functions. (default_reporter::report): Adjust. Add an overload for function_type_diff&. In the overload for qualified_type_diff, if the name of the underlying type changed, do not detail the changes any further. In the overload for function_decl_diff, Adjust to use the new diff_context::get_{first, second}_corpus member function. In the overload for enum_diff, call the new maybe_report_interfaces_impacted_by_diff that is advertised below. * src/abg-reporter-priv.cc (represent): Adjust the overload for var_diff_sptr. (report_mem_header): Define new overload. (maybe_show_relative_size_change) (maybe_report_interfaces_impacted_by_diff): Define new functions. (reporter_base::diff_to_be_reported): Define new member function. (maybe_show_relative_offset_change): Pass the var_diff_sptr parameter by const reference. (represent): In the overload for var_diff_sptr, pass the var_diff_sptr parameter by reference. Take a 'local_only' flag. Iisplay type changes only if we are not displaying "local changes only". Display size changes of data members too, when in "local-only" mode. * src/abg-suppression.cc (sonames_of_binaries_match) (names_of_binaries_match): Adjust. * tools/abidiff.cc (options::{leaf_changes_only, show_impacted_interfaces}): Add new data members. (display_usage): Emit usage string for the new --leaf-changes-only and --impacted-interfaces options. (parse_command_line): Parse the new --leaf-changes-only and the --impacted-interfaces options. (set_diff_context_from_opts): Set the 'show-leaf-changes' and the 'show-impacted-interfaces' flags. * tests/data/test-diff-filter/libtest42-leaf-report-v{0,1}.so: New test input. * tests/data/test-diff-filter/test42-leaf-report-output-0.txt: New test reference output. * tests/data/test-diff-filter/test42-leaf-report-v{0,1}.cc: Source code of the new test inputs. * tests/test-diff-filter.cc (in_out_specs): Use the new test inputs above in this harness. * tests/data/test-diff-suppr/libtest35-leaf-v0.so: New test input. * tests/data/test-diff-suppr/test35-leaf-report-0.txt: New test reference output. * tests/data/test-diff-suppr/test35-leaf-v{0,1}.cc: Source code of the new test inputs. * tests/data/test-diff-suppr/test35-leaf.suppr: Suppression specification to use for the test35 test. * tests/data/test-diff-suppr/libtest36-leaf-v0.so: New test input. * tests/data/test-diff-suppr/libtest36-leaf-v1.so: Likewise. * tests/data/test-diff-suppr/test36-leaf-report-0.txt: New reference test output. * tests/data/test-diff-suppr/test36-leaf-v0.cc: Source code of test input above. * tests/data/test-diff-suppr/test36-leaf-v1.cc: Likewise. * tests/test-diff-suppr.cc (in_out_specs): Use the new test inputs above in this harness. * tests/data/Makefile.am: Add the new test inputs above to source distribution. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
8ae81a8e16 |
Bug 21058 - abipkgdiff wrongly drops non-public types
When using abipkgdiff types that are defined in files not present in the devel packages provided by the --devel1 and --devel2 option are dropped from the internal representation by default. This has been designed as such, not only to avoid showing changes on types that are not part of the public headers of a shared library, but also to help lower the memory consumption of libabigail. In this particular bug report, we see a library that uses types (in its public interface) that are defined in headers of a *different* package. For instance, suppose a particular package foo that uses types defined in headers of the glib package. And some of those Glib types can be present in its public interface. So in this case, libabigail is dropping a type that is actually part of the public interface of the library that is being analyzed, even if the type was not defined in the devel package of the current package. This patch addresses the issue by doing a number of things: 1/ If a type is defined in a file which path starts with "/usr/include/", then consider it as a public type. This is so that type coming from the public interface of other packages, and that are defined in system headers are considered as part of the public types of the package being analyzed. 2/ by default, don't drop types not defined in the associated devel package. This will hinder our ability to decrease the memory usage, but there have been a number of recent optimization that help in that regard independently. So I am hoping this shouldn't have a big impact now. Incidentally, the option --dont-drop-private-types (from abidiff) is changed into --drop-private-types, so that interested users can still drop non-private types from the model, if they wish. That --drop-private-types option is added to abipkgdiff too. As the offended types are not dropped from the model anymore, the usual filtering mechanisms of libabigail can take place. * doc/manuals/abidiff.rst (--dont-drop-private-types): Remove documentation. (--drop-private-types): Document this new option. * src/abg-tools-utils.cc: Update copyright notice (handle_fts_entry): On the generated suppression specification, do not set the flag to drop matched types. Also, don't match types defined in files which patch start with "/usr/include/". * tools/abidiff.cc (options::options): Initialize the drop_private_types data member to false. (display_usage): Remove usage string for --dont-drop-private-types. Add a new one for --drop-private-types. (parse_command_line): Don't part --dont-drop-private-types, rather, parse --drop-private-types. (set_suppressions): When the suppression for private types is generated, if --drop-private-types was provided, then instruct the suppression to drop matched types. * tools/abipkgdiff.cc (options::drop_private_types): New option. (options::options): Initialize the new drop_private_types data member to false. (display_usage): Add a usage string for --drop-private-types. (parse_command_line): Parse the new --drop-private-types option. (maybe_create_private_types_suppressions): Don't take just a package, but a package_descriptor because the latter carries the options. So when the user used the --drop-private-types option, make the generated private types suppression to drop matched types. * tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-1.txt: Adjust. * tests/test-diff-suppr.cc (in_out_specs): Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
f27520d767 |
A suppressed diff node implies suppressing all equivalent nodes too
When a diff node N is suppressed (for instance, using the --headers-dir{1,2} option of abidiff}, it's only that diff node that is suppressed. We forget to suppress diff nodes that are equivalent to N. Here is why we forget to suppress diff ndoes that are equivalent. apply_suppressions walks the diff node graph to mark diff nodes as suppressed. But it does the walking by making sure each diff node's *class of equivalence* is visited once. This is not only a way to prevent infinite loops while visiting the graph, but also an optimization as it avoids walking two equivalent diff nodes. But then it can happen that we forget to categorize some diff nodes inside a given class of equivalence, even though we categorized some others. This patch makes it so that when a diff node inside a class of equivalence is categorized as SUPPRESSED, the canonical diff node of that class of equivalence is categorized as SUPPRESSED too. That way, to know if a diff node is suppressed, we just need to look at its canonical diff node. While doing this, I noticed that abidiff and abipkgdiff are not dropping private types from libabigail's internal representation, even though the Library now has that capability. The patch fixes that. But then the patch adds a --dont-drop-private-types option to abidiff to avoid dropping those private types from the IR, so that regression tests can make sure that a suppressed diff node implies suppression all equivalent nodes too. * doc/manuals/abidiff.rst b/doc/manuals/abidiff.rst: Document the new --dont-drop-private-types option. * src/abg-comparison.cc (diff::is_filtered_out): If the canonical type was suppressed then the current diff node is filtered out. (suppression_categorization_visitor::visit_{begin,end}): Categorized the canonical node as SUPPRESSED if the current node is suppressed. * tools/abidiff.cc (options::drop_private_types): New data member. (options::options): Initialize it. (display_usage): Add new help string for the new --dont-drop-private-types option. (parse_command_line): Parse the new --dont-drop-private-types option. (set_suppressions): Generate suppression specification from header directories given in parameter and stick them to the read context. * tools/abipkgdiff.cc (compare): Likewise. * tests/data/test-diff-suppr/libtest34-v0.so: New test input. * tests/data/test-diff-suppr/libtest34-v1.so: Likewise. * tests/data/test-diff-suppr/test34-report-0.txt: New reference report. * tests/data/test-diff-suppr/test34-v0.c: Source code for the new test input. * tests/data/test-diff-suppr/test34-v1.c: Likewise. * tests/data/test-diff-suppr/test34-priv-include-dir-v0/test34-priv-include-v0.h: Likewise. * tests/data/test-diff-suppr/test34-priv-include-dir-v1/test34-priv-include-v1.h: Likewise. * tests/data/test-diff-suppr/test34-pub-include-dir-v0/test34-pub-include-v0.h: Likewise. * tests/data/test-diff-suppr/test34-pub-include-dir-v1/test34-pub-include-v1.h: Likewise. * tests/data/Makefile.am: Add new test input material above to source distribution. * tests/test-diff-suppr.cc (in_out_spec): Compare the two new test library provided. Add --dont-drop-private-types to test30*. signed-off-by: Dodji Seketeli <dodji@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
eac363eb66 |
Forgot to consider libtest33-v{0,1}.so in test-diff-suppr.cc
I forgot the make test-diff-suppr.cc run over libtest33-v{0,1}.so even though this test was added to the source distribution. Fixed thus. * tests/data/test-diff-suppr/test33-report-0.txt: New refernce report. * tests/test-diff-suppr.cc (in_out_specs): Compare libtest33-v0.so and libtest33-v1.so. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
98c8d61684 |
Drop suppressed ABI artifacts from the IR
This patch allows dropping suppressed ABI artifacts from the in-memory internal representation right during the DWARF or abixml reading. In practise, this means that abidw and abilint now have a --suppressions options to give them suppression specifications. If a suppression specification that has the "drop" property matches an ABI artifact (type, function or variable) then that artifact is dropped from the internal representation. This also applies to abidiff. Note that now, by default, ABI artifacts (types) that are suppressed due to the --headers-dir{1,2} option of abidiff are now also dropped from the IR as well. Incidentally, abidw and abilint tools now have a --header-dir option too. * doc/manuals/abidw.rst: Document the new --suppressions and --headers-dir options off the abidw tool. * doc/manuals/abilint.rst: Document the new --suppressions and --headers-dir options on the abilint tool. * doc/manuals/libabigail-concepts.rst: Document the new "drop" and "name_not_regexp" properties on suppression directives. * include/abg-corpus.h (corpus::corpus): Add a default argument to the path parameter. * src/abg-suppression-priv.h: New private header file. * src/Makefile.am: Add the new abg-suppression-priv.h file to source distribution. * include/abg-suppression.h ({suppression_base, type_suppression, function_suppression, variable_suppression}::priv): Make these public. (suppression_base::{g,s}et_drops_artifact_from_ir): Declare new member functions. (type_suppression::{suppressed_type}): Likewise. (suppression_base::{names,sonames}_of_binaries_match): Remove member functions. (function_suppression::{get_name, set_name, get_name_regex_str, set_name_regex_str}): Renamed get_function_name, set_function_name, get_function_name_regex_str, set_function_name_regex_str into these. ({variable,function}_suppression::{g,s}et_name_not_regex_str): Declare new member functions. * src/abg-suppression.cc: Include the new abg-suppression-priv.h private header. (class suppression_base::priv, class type_suppression::priv, class function_suppression::parameter_spec::priv, class function_suppression::priv, class variable_suppression::priv): Move these types to that new private header. (suppression_base::{g,s}et_drops_artifact_from_ir) (function_suppression::{g,s}et_name_not_regex_str) (variable_suppression::{g,s}et_name_not_regex_str): New member functions. (sonames_of_binaries_match): New static function, taken from suppression_base::sonames_of_binaries_match. (names_of_binaries_match): New static function, taken from suppression_base::names_of_binaries_match. (suppression_matches_type_no_name): New static function. (type_suppression::suppresses_type): Adjust (function_suppression::suppresses_function) (variable_suppression::suppresses_variable): Adjust. Evaluate the new "name_not_regexp" property. (suppression_matches_type_name) (suppression_matches_type_location) (suppression_matches_type_name_or_location) (suppression_matches_function_name) (suppression_matches_function_sym_name) (suppression_matches_variable_name) (suppression_matches_variable_sym_name, suppression_matches_type): New functions. (read_type_suppression): Support the new "drop_artifacts" and "drop" properties. (read_function_suppression, read_variable_suppression): Support the new "drop_artifacts", "drop", and "name_not_regexp" properties. (function_suppression::{g,s}et_name): Renamed {g,s}et_function_name into these. (function_suppression::set_name_not_regex_str): Renamed {g,s}et_name_regex_str into this. (function_suppression::suppresses_function_symbol): Adjust. * include/abg-dwarf-reader.h (add_read_context_suppressions): Declare new function. * src/abg-dwarf-reader.cc: Use the new private abg-suppression-priv.h header file. (read_context::supprs_): New data member. (read_context::get_suppressions): New member function. (read_context::get_die_source): Make this const. (read_context::tu_die_imported_unit_points_map): Add a const overload. (read_context::cur_transl_unit): Renamed current_translation_unit unit into this; (read_context::cur_tu): Remove or rename into cur_transl_unit. (get_scope_for_die, build_translation_unit_and_add_to_ir) (build_enum_type, build_pointer_type_def, build_reference_type) (build_function_type, build_array_type, build_function_decl): Adjust. (read_context::{suppression_can_match, suppression_matches_function_sym_name, suppression_matches_function_name, suppression_matches_variable_sym_name, suppression_matches_variable_name, suppression_matches_type_name_or_location, suppression_matches_type_name}): Add member functions. (die_signed_constant_attribute): Remove this as dead code. (die_location, die_loc_and_name) (find_import_unit_point_between_dies) (find_import_unit_point_before_die, get_parent_die): Make the read_context& parameter be const and adjust as required. (build_var_decl_if_not_suppressed, function_is_suppressed) (variable_is_suppressed, type_is_suppressed): Define new static functions. (add_read_context_suppressions): Define new function. (build_class_type_and_add_to_ir): Do not add suppressed static data members to the IR. (build_ir_node_from_die): Do not add suppressed enum types, class types, variables or functions to the IR. Adjust for the read_context::cur_tu -> read_context::cur_transl_unit rename. * include/abg-reader.h (read_context_sptr): Declare new type. (create_native_xml_read_context, read_corpus_from_input) (add_read_context_suppressions): Declare new functions. * src/abg-reader.cc: Include the new private abg-suppression-priv.h header file. (read_context::m_exported_decls_builder): Renamed m_exported_decls_builder_ into this. (read_context::get_exported_decls_builder): Adjust. (read_context::get_cur_scope): Make this const. (read_location): Take a const read_context and adjust. (read_corpus_from_input): Make this non-static. (build_namespace_decl): Don't abort if trying to add an artifact to the IR doesn't succeed. It might be suppressed now. (read_context::{m_path, m_supprs}): New data members. (read_context::{g,s}et_path): New member functions. (read_context::{get_suppressions, suppression_matches_function_name, suppression_can_match, suppression_matches_function_name, suppression_matches_function_sym_name, suppression_matches_variable_name, suppression_matches_variable_sym_name, suppression_matches_type_name_or_location}): Likewise. (add_read_context_suppressions, create_native_xml_read_context) (read_corpus_from_native_xml): New functions. (build_function_decl_if_not_suppressed, function_is_suppressed) (type_is_suppressed, build_var_decl_if_not_suppressed) (variable_is_suppressed, build_enum_type_decl_if_not_suppressed) (build_class_decl_if_not_suppressed): New static functions. (build_class_decl): Add member types that are being built early, so that their sub-types can be evaluated for suppression. Do not add suppressed static data members or suppressed member functions to the IR. (build_type): Do not add an enum type or a class type to the IR if they are suppressed. (handle_enum_type_decl): Do not add an enum type to the IR if its suppressed. (handle_var_decl): Likewise for a variable decl. (handle_function_decl): Likewise for a function decl. (handle_class_decl): Likewise for a class decl. * src/abg-tools-utils.cc (handle_fts_entry): Drop suppressed ABI from the IR. * tools/abidiff.cc (display_usage): Fix help strings for --headers-dirs{1,2}. (set_suppressions): New static function. (main): Adjust. Release the memory used by read_context early. * tools/abidw.cc (options::{headers_dir, suppression_paths}): (display_usage): New help strings for the new --header-dir and --suppressions options. (parse_command_line): Parse the new --header-dir and --suppressions options. (maybe_check_suppression_files, set_suppressions): New static functions. (main): Use the two new functions above. Free the memory used by the read context before working with the corpus. * tools/abilint.cc (options::suppression_paths): (display_usage): New help strings for the new --header-dir and --suppressions options. (parse_command_line): Parse the new --header-dir and --suppressions options. (maybe_check_suppression_files, set_suppressions): New static functions. (main): Use the two new functions above. Free the memory used by the read context before working with the corpus. * tests/data/test-diff-suppr/test24-soname-suppr-{2,3].txt: Adjust. * tests/data/test-diff-suppr/test29-suppr-6.txt: Likewise. * tests/data/test-diff-suppr/test29-suppr-8.txt: Likewise. * tests/data/test-diff-suppr/libtest31-v{0,1}.so: New test input. * tests/data/test-diff-suppr/libtest31.suppr: Likewise * tests/data/test-diff-suppr/libtest32-v{0,1}.so: Likewise. * tests/data/test-diff-suppr/libtest32-0.suppr: Likewise. * tests/data/test-diff-suppr/libtest33-v{0,1}.so: Likewise. * tests/data/test-diff-suppr/test31-report-{0,1}.txt: Likewise. * tests/data/test-diff-suppr/test31-v{0,1}.cc: Likewise. * tests/data/test-diff-suppr/test32-report-{0,1}.txt: Likewise. * tests/data/test-diff-suppr/test32-v{0,1}.c: Likewise. * tests/data/test-diff-suppr/test33-suppr-1.txt: Likewise. * tests/data/test-diff-suppr/test33-v{0,1}.cc: Likewise. * tests/data/test-diff-suppr/test33-v{0,1}.h: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns-2.so.abi: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns.so: Likewise. * tests/data/test-read-dwarf/libtest24-drop-fns.so.abi: Likewise. * tests/data/test-read-dwarf/test24-drop-fns-0.suppr: Likewise. * tests/data/test-read-dwarf/test24-drop-fns.cc: Likewise. * tests/data/test-read-write/test28-drop-std-fns.abignore: Likewise. * tests/data/test-read-write/test28-drop-std-vars.abignore: Likewise. * tests/data/test-read-write/test28-without-std-fns-ref.xml: Likewise. * tests/data/test-read-write/test28-without-std-fns.xml: Likewise. * tests/data/test-read-write/test28-without-std-vars-ref.xml: Likewise. * tests/data/test-read-write/test28-without-std-vars.xml: Likewise. * tests/data/test-read-write/test28.xml: Likewise. * tests/data/Makefile.am: Add the new test artifacts to source distribution. * tests/test-diff-suppr.cc (in_out_spec): Take the new test inputs into account. * tests/test-read-dwarf.cc (Inoutspec::in_suppr_spec_path): New data member. (in_out_spec): Adjust. The new test inputs into account. (set_suppressions): New static function. (handle_in_out_spec): Adjust. * tests/test-read-write.cc (Inoutspec::{in_suppr_spec_path, ref_out_path}): New data members. (in_out_spec): Adjust. Take new test inputs into account. (main): Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
3e47efb112 |
Escape all characters when reading a string in ini files
It turns out that when parsing foo = bar\[a-z\], the '[' and ']' characters where not being escaped while parsing the string "bar\[a-z\]". This patch fixes that. * src/abg-ini.cc (read_context::peek): Take an output parameter to tell the caller when this function escaped the returned character. Added an overload without this new parameter. (read_context::read_string): Accept all characters as part of the string. * tests/data/test-diff-suppr/test7-var-suppr-9.suppr: New test input. * tests/data/test-diff-suppr/test7-var-suppr-report-9.txt: New test reference output. * tests/data/Makefile.am: Add the files above to source distribution. * tests/test-diff-suppr.cc (in_out_spec): Run a new comparison of libtest7-var-suppr-v{0,1}.so this time using the new test7-var-suppr-9.suppr specification that exercices a string with the escaped characters that we were having difficulty with. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
b36ca1501e |
Bug 20180 - Support system-wide suppression specifications
This patch adds support for loading system and user level suppression specifications for libabigail tools. At launch time, relevant libabigail tools (abidiff, abipkgdiff fedabipkgdiff for now) read the default system suppression specification file, if it's present, from a file which path is the value of the environment variable LIBABIGAIL_DEFAULT_SYSTEM_SUPPRESSION_FILE, if set, or from the file $libdir/libabigail/default.abignore. Then it reads the user system suppression specification file, if it's present, from a file which path is the value of the environment variable LIBABIGAIL_DEFAULT_USER_SUPPRESSION_FILE, if set, or from the file $HOME/.abignore. The content of the user system suppression file is merged with the content of default system suppression file. That content is also merged with the content of the suppression specification files that might be provided by the --suppressions command line option of the invoked tools. The resulting set of all these suppression specifications is thus used to filter the ABI change reports that are emitted. abidiff, abipkgdiff and abipkgdiff gain a --no-default-suppression option to avoid loading any of these default suppression specification files. The patch also installs a default.abignore file into $(pkglibdir). Note that on x86_64, that directory is /usr/lib64/libabigail. Now we just need to think about the content of that default.abignore file. * doc/manuals/abidiff.rst: Document the default suppression scheme, its interaction with the --supprs option and the new --no-default option. * doc/manuals/abipkgdiff.rst: Likewise. * doc/manuals/fedabipkgdiff.rst: Likewise. * configure.ac: Generate the tests/runtestdefaultsupprs.py file from the new tests/runtestdefaultsupprs.py.in template. * default.abignore: New file. * Makefile.am: Add it to source distribution. * src/Makefile.am: Define the ABIGAIL_ROOT_SYSTEM_LIBDIR preprocessor macro that is set the value of the $libdir autotools macro. * include/abg-tools-utils.h: Update copyright years. (get_system_libdir, get_default_system_suppression_file_path) (get_default_user_suppression_file_path) (load_default_system_suppressions) (load_default_user_suppressions): Declare new functions * src/abg-tools-utils.cc (get_system_libdir) (get_default_system_suppression_file_path) (get_default_user_suppression_file_path) (load_default_system_suppressions) (load_default_user_suppressions): Define new functions. (is_regular_file): Amend this so that it return true for symlinks to regular files too. (is_dir): Amend this so that it returns true for symlinks to directories too. * tools/abidiff.cc (options::no_default_supprs): New data member. (options::options): Initialize the new data member. (display_usage): Display a new help string for the new --no-default-suppression command line option. (parse_command_line): Parse this new command line option. (set_diff_context_from_opts): Load the default suppression specifications, unless --no-default-suppression or --supprs was provided. * tools/abipkgdiff.cc (options::no_default_supprs): New data member. (options::options): Initialize the new data member. (parse_command_line): Parse the new --no-default-suppression command line option. (main): Load the default suppression specifications, unless --no-default-suppression or --supprs was provided. * tools/fedabipkgdiff (abipkgdiff): Add --no-default-suppression to the invocation of abipkgdiff if it was provided on the command line. (build_commandline_args_parser): Parse the new --no-default-suppression command line option. * tests/runtestdefaultsupprs.py.in: New test harness template. * tests/Makefile.am: Add the new runtestdefaultsupprs.py to the set of tests. * tests/data/test-default-supprs/test0-type-suppr-0.suppr: New test input. * tests/data/test-default-supprs/test0-type-suppr-report-0.txt: Likewise. * tests/data/test-default-supprs/test0-type-suppr-v0.o: Likewise. * tests/data/test-default-supprs/test0-type-suppr-v1.o: Likewise. * tests/data/test-default-supprs/dirpkg-1-dir-report-0.txt: Likewise. * tests/data/test-default-supprs/dirpkg-1-dir1: Likewise. * tests/data/test-default-supprs/dirpkg-1-dir2: Likewise. * tests/data/Makefile.am: Add new the new tests input above to Makefile.am. * tests/runtestcanonicalizetypes.sh.in: Pass --no-default-suppression to abidiff invocations. * tests/runtestdefaultsupprs.py.in: Likewise. * tests/test-abidiff-exit.cc: Likewise. * tests/test-diff-dwarf-abixml.cc: Likewise. * tests/test-diff-filter.cc: Likewise. * tests/test-diff-suppr.cc: Likewise. * tools/abidiff.cc: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
e19bf5627a |
Make abi{pkg}diff filter out changes about private types
This is to address the following enhancement requests: #19588 - Add a --headers-dir1 and --headers-dir2 option to abidiff #19948 - Add --devel-pkg1 and --devel-pkg2 options to abipkgdiff When the user specifies where to find header files for two binaries (or packages) being compared, this patch generates a type suppression specification that filters out change reports about types that are defined in files that are not in the set of header files specified. The type suppression specification also suppresses change reports about changed/added/removed virtual member functions which enclosing class type matches the type suppression specification. There is a corner case that the patch handles too, and that is exhibited by the accompanying test case for abidiff. There can be a class defined by DWARF as having no source location and as being a pure declaration. This can be a class declaration that has inline virtual members only, and one or several non-defined virtual methods too. When that declaration is included in a source file, GCC generates debug info that describes that class as being a declaration-only class with no source declaration. This patch considers such a class as being non defined; you know, like a true opaque type. So it's considered being not defined in any public header file. Changes to this kind of class are thus filtered out. * include/abg-comp-filter.h: Update copyright year. * src/abg-comp-filter.cc (has_virtual_mem_fn_change): Make this static function become exported. (has_virtual_mem_fn_change): Declare new function. * include/abg-suppression.h (suppression_base::{get,set}_is_artificial): Declare new accessors. (type_suppression::get_source_locations_to_keep): Return an unordered set of strings, not a vector. Add a non-const overload. (type_suppression::set_source_locations_to_keep): Set an unordered set of strings, not a vector. * src/abg-suppression.cc (suppression_base::priv::is_artificial_): New data member. (suppression_base::priv::priv): Initialize the new data member. (suppression_base::{get,set}_is_artificial): Define new accessors. (type_suppression::priv::source_locations_to_keep_): Change the vector of strings representing source file names into unordered set of string. (type_suppression::get_source_locations_to_keep): Return an unordered set of strings, not a vector. Define a non-const overload. (type_suppression::set_source_locations_to_keep): Set an unordered set of strings, not a vector. (type_suppression::suppresses_diff): Make this suppress virtual member function diffs if the enclosing type of the changed virtual member is suppressed by the current type_suppression. (read_type_suppression): Adjust to use the fact that the source locations are not stored in an unordered set, not in a vector anymore. Otherwise, using a vector here make things too slow. (type_suppression::suppresses_type): Likewise. Also, If the type we are looking at has no location because it's a true opaque type and if the current suppression is an artificial suppression that is meant to suppress change reports about non-public types, then suppress the type. * include/abg-tools-utils.h (gen_suppr_spec_from_headers): Declare new public function. * src/abg-tools-utils.cc (PRIVATE_TYPES_SUPPR_SPEC_NAME): Define a new constant variable. (handle_fts_entry): Define new static function. (gen_suppr_spec_from_headers): Define new public function. * src/abg-comparison.cc (corpus_diff::priv::apply_suppressions_to_added_removed_fns_vars): If a type suppression suppresses a given class C, make it change added/removed virtual functions whose enclosing type is C. * tools/abidiff.cc (options::{headers_dir1, headers_dir2}): New data members. (display_usage): Add help strings for --headers-dir1 and --headers-dir2. (parse_command_line): Parse the new --headers-dir1 and --headers-dir2 options. (set_diff_context_from_opts): Generate suppression specifications to filter out changes on private types, if --headers-dir1 or --headers-dir2 is given. * tools/abipkgdiff.cc (options::{devel_package1, devel_package2}): New data members. (typedef package_sptr): New typedef. (enum package::kind): New enum. (package::kind_): New data member. This replaces ... (package::is_debug_info_): ... this data member. (package::{devel_package_, private_types_suppressions_}): New data members. (package::package): Adjust. (package::get_kind): Define new member function. This replaces ... (package::is_debug_info): ... this member function overload. (package::set_kind): Define new member functin. It replaces ... (package::is_debug_info): ... this member function overload. (package::{devel_package, private_types_suppressions}): Define new accessors. (package::erase_extraction_directies): Erase the sub-directory where development packages are extracted to. (compare_args::private_types_suppr{1,2}): New data members. (compare_args::compare_args): Adjust. (display_usage): Add help strings for --devel-pkg1/--devel-pkg2. (compare): Make the overload that compares elf files take private types suppressions. Add the private types suppressions to the diff context. (pthread_routine_compare): Adjust the call to compare. (maybe_create_private_types_suppressions): Define new static function. (pthread_routine_extract_pkg_and_map_its_content): If a devel package was specified for the main package then extract it in parallel with the other package extraction. When the extraction is done, create private types suppressions by visiting the directories that contain the header files. (compare): In the overload that compares packages by scheduling comparison of individual elf files that are in the packages, pass in the private type suppressions too. (parse_command_line): Parse the new --devel-pkg{1,2} command line options. (main): Associate the devel package to the main package, if the --devel-pkg{1,2}. * doc/manuals/abidiff.rst: Add documentation about the new --headers-dir1 and --headers-dir2 options. * doc/manuals/abipkgdiff.rst: Likewise, add documentation about the new --devel-pkg1 and --devel-pkg2 libraries. * tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-1.txt: New test reference output. * tests/data/test-diff-pkg/tbb-devel-4.1-9.20130314.fc22.x86_64.rpm: New test input package. * tests/data/test-diff-pkg/tbb-devel-4.3-3.20141204.fc23.x86_64.rpm: Likewise. * tests/test-diff-pkg.cc b/tests/test-diff-pkg.cc (InOutSpec::{first,second}_in_devel_package_path): New data members. (in_out_specs): Adjust. Also, add a new entry describing the new test inputs above. (test_task::perform): When the new test entry contains devel packages, pass them to abipkgdiff using the --devel1 and --devel2 options. * tests/data/test-diff-suppr/test30-include-dir-v0/test30-pub-lib-v0.h: A new test input source code. * tests/data/test-diff-suppr/test30-include-dir-v1/test30-pub-lib-v1.h: Likewise. * tests/data/test-diff-suppr/test30-priv-lib-v0.cc: Likewise. * tests/data/test-diff-suppr/test30-priv-lib-v0.h: Likewise. * tests/data/test-diff-suppr/test30-priv-lib-v1.cc: Likewise. * tests/data/test-diff-suppr/test30-priv-lib-v1.h: Likewise. * tests/data/test-diff-suppr/test30-pub-lib-v0.cc: Likewise. * tests/data/test-diff-suppr/test30-pub-lib-v0.so: Add new test binary input. * tests/data/test-diff-suppr/test30-pub-lib-v1.cc: Add new test input source code. * tests/data/test-diff-suppr/test30-pub-lib-v1.so: Add new test binary input. * tests/data/test-diff-suppr/test30-report-0.txt: Add new test reference output. * tests/data/test-diff-suppr/test30-report-1.txt: Add new test reference output. * tests/test-diff-suppr.cc (InOutSpec::headers_dir{1,2}): New data members. (InOutSpec::abidiff_options): Renamed the bidiff_options data member into this. (in_out_specs): Adjust. Also, added the new test input above to this. (main): Adjust to invoke abidiff with the new --hd1 and --hd2 options if the input specs for the tests has the new InOutSpec::headers_dir{1,2} data member set. Renamed bidiff into abidiff. * tests/data/Makefile.am: Add the new test inputs to the source distribution. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
080b88c9a1 |
Implement a [suppress_file] suppression directive
abidiff, abipkgdiff and abicompat now recognize a [suppress_file] directive in suppression specifications. That directive instructs the tool to avoid loading some binaries altogether. This is the first directive that won't act on the result of the comparison of two binaries. It actually acts earlier and prevents the tool from loading some binaries altogether. The directive looks like: [suppress_file] # Don't load any library named lib_private*.so file_name_regexp = lib_private.*\\.so This prevents the tool from loading (and thus comparing) any library which name matches the pattern "lib_private*.so". [suppress_file] # Only load libraries name lib_public*.so file_name_not_regexp = lib_public.*\\.so This instructs the tool to only load (and compare) files which name match the pattern "lib_public*.so". * doc/manuals/libabigail-concepts.rst: Document the new 'suppress_file' directive. * include/abg-suppression.h (file_suppression): Define new class. (file_suppression_sptr): Define new typedef. (is_file_suppression, file_is_suppressed): Declare new functions. * src/abg-suppression.cc (): (read_file_suppression, is_file_suppression, file_is_suppressed): Define new functions. (file_suppression::{file_suppression, suppresses_file, ~file_suppression}): Define new member functions. * tools/abidiff.cc (main): If a suppression specification suppresses one of the input files, then do not perform the comparison. * tools/abipkgdiff.cc (compare): If a suppression specification suppresses a file that is to be compared, then do not perform the comparison. * tools/abicompat.cc (create_diff_context): New static function. (perform_compat_check_in_normal_mode) (perform_compat_check_in_weak_mode): Adjust to take a context in parameter. Do not create a diff context here anymore, do not load suppression files here either. (main): Use the new create_diff_context to create a diff context and initialize it, including loading suppression specifications. If any suppression specification suppresses a file to load, then do not load perform any compatibility checking. Adjust invocations of perform_compat_check_in_weak_mode and perform_compat_check_in_normal_mode to pass the diff context. * tests/data/test-diff-suppr/test0-type-suppr-3.suppr: New test input. * tests/data/test-diff-suppr/test0-type-suppr-4.suppr: Likewise. * tests/data/test-diff-suppr/test0-type-suppr-report-4.txt: Likewise. * tests/data/test-diff-suppr/test0-type-suppr-5.suppr: Likewise. * tests/data/test-diff-suppr/test0-type-suppr-report-5.txt: Likewise. * tests/data/test-diff-suppr/test0-type-suppr-6.suppr: Likewise. * tests/data/test-diff-suppr/test0-type-suppr-report-6.txt: Likewise. * tests/data/test-diff-suppr/test0-type-suppr-report-7.txt: Likewise. * tests/test-diff-suppr.cc (in_out_specs): Use the new test inputs. * tests/data/test-abicompat/test0-fn-changed-1.suppr: New test input. * tests/data/test-abicompat/test0-fn-changed-report-3.txt: Likewise. * tests/test-abicompat.cc (in_out_specs):: Use the new test inputs. * tests/data/Makefile.am: Add the new test material to source distribution. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
b885e6283f |
Bug 20015 - support file_name_not_regexp and soname_not_regexp in suppr specs
The supression directives suppress_type, suppress_function and suppress_variable support the two properties below, among others: file_name_regexp = <some-regexp> soname_regexp = <some-regexp> When the regular expression matches either the file name or the soname, then the suppression directive is activated. This patch adds the support for these two additional properties for these suppression directives: file_name_not_regexp = <some-regexp> soname_not_regexp = <some-regexp> These activate the current suppression directive if the regular expression does *NOT* match the file name or soname. This is very helpful to express change report suppressions like: "suppress all ABI change reports for all libraries but those with file names (or sonames) with the pattern libfoobar.*" * include/abg-comparison.h (suppression_base::{get,set}_file_name_not_regex_str): Declare new member functions. (suppression_base::{get,set}_soname_not_regex_str): Likewise. (suppression_base::{names,sonames}_of_binaries_match): Likewise. * src/abg-comparison.cc (suppression_base::priv::get_file_name_regex): Fix comment. (suppression_base::priv::get_file_name_not_regex): New member function. (suppression_base::priv::get_soname_regex): Fix comment. (suppression_base::priv::get_soname_not_regex): New member function. (suppression_base::{get,set}_file_name_not_regex_str): Define new member functions. (suppression_base::{get,set}_soname_not_regex_str): Likewise. (suppression_base::{names,sonames}_of_binaries_match): Likewise. These got factorized out of type_suppression::suppresses_type, function_suppression::suppresses_function, function_suppression::suppresses_function_symbol, variable_suppression::suppresses_variable, variable_suppression::suppresses_variable_symbol. (type_suppression::suppresses_type): Use the new suppression_base::{names,sonames}_of_binaries_match. (read_type_suppression): Read the new file_name_not_regexp and soname_not_regexp properties. (function_suppression::{suppresses_function, suppresses_function_symbol}): Use the new suppression_base::{names,sonames}_of_binaries_match. (read_function_suppression): Read the new file_name_not_regexp and soname_not_regexp properties. (variable_suppression::{suppresses_variable, variable_suppression::suppresses_variable_symbol}): Use the new suppression_base::{names,sonames}_of_binaries_match. (read_variable_suppression): Use the new suppression_base::{names,sonames}_of_binaries_match. * doc/manuals/libabigail-concepts.rst: Document the new file_name_not_regexp and soname_not_regexp suppression properties. * tests/data/test-diff-suppr/test24-soname-report-10.txt: New test reference output. * tests/data/test-diff-suppr/test24-soname-report-11.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-report-12.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-report-13.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-report-14.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-report-15.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-report-16.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-report-9.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-suppr-10.txt: New test input. * tests/data/test-diff-suppr/test24-soname-suppr-11.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-suppr-12.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-suppr-13.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-suppr-14.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-suppr-15.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-suppr-16.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-suppr-9.txt: Likewise. * tests/data/test-diff-suppr/test29-soname-report-2.txt: New test reference output. * tests/data/test-diff-suppr/test29-soname-report-3.txt: Likewise. * tests/data/test-diff-suppr/test29-soname-report-4.txt: Likewise. * tests/data/test-diff-suppr/test29-soname-report-5.txt: Likewise. * tests/data/test-diff-suppr/test29-soname-report-6.txt: Likewise. * tests/data/test-diff-suppr/test29-soname-report-7.txt: Likewise. * tests/data/test-diff-suppr/test29-soname-report-8.txt: Likewise. * tests/data/test-diff-suppr/test29-suppr-2.txt: New test input. * tests/data/test-diff-suppr/test29-suppr-3.txt: Likewise. * tests/data/test-diff-suppr/test29-suppr-4.txt: Likewise. * tests/data/test-diff-suppr/test29-suppr-5.txt: Likewise. * tests/data/test-diff-suppr/test29-suppr-6.txt: Likewise. * tests/data/test-diff-suppr/test29-suppr-7.txt: Likewise. * tests/data/test-diff-suppr/test29-suppr-8.txt: Likewise. * tests/data/Makefile.am: Add the new test material to source distribution. * tests/test-diff-suppr.cc (in_out_specs): Make this test harness run over the new test inputs. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
f6c182bb56 |
Ease use of soname_regexp/file_name_regexp in suppr specs
In a suppression specification, soname_regexp or file_name_regexp cannot be the only property of a suppression directive. For instance, the suppression specification below won't work: [suppress_type] # suppress all change reports about *any type* from the library # libtestfoo.so file_name_regexp = libtestfoo.so This is because as documented in the manual, the suppression directive 'suppress_type' requires that some other properties be specified. For instance, the below would work: [suppress_type] name_regexp = .* file_name_regexp This was done on purpose to prevent folks from inadvertently suppressing too much of change report bits. But experience is showing that this is surprising some users. And in hindsight, I kind of agree it's surprising. So this patch allows the first example to work, as seems to be expected. The patch allows the first example to work for the suppress_function and suppress_variable directive too. * doc/manuals/libabigail-concepts.rst: Update the manual to reflect the changes in the suppression_type, suppress_function and suppress_variable directives. * src/abg-comparison.cc (read_type_suppression): Accept that the suppress_type directive contains only file_name_regexp or the soname_regexp property. (read_function_suppression): Likewise for the suppress_function directive. (read_variable_suppression): Likewise for the suppress_variable directive. * tests/data/test-diff-suppr/libtest29-soname-v0.so: New binary test input. * tests/data/test-diff-suppr/libtest29-soname-v1.so: Likewise. * tests/data/test-diff-suppr/test24-soname-report-5.txt: New reference test output. * tests/data/test-diff-suppr/test24-soname-report-6.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-report-7.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-report-8.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-suppr-5.txt: New test suppression file. * tests/data/test-diff-suppr/test24-soname-suppr-6.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-suppr-7.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-suppr-8.txt: Likewise. * tests/data/test-diff-suppr/test29-soname-report-0.txt: New reference test output. * tests/data/test-diff-suppr/test29-soname-report-1.txt: Likewise. * tests/data/test-diff-suppr/test29-soname-v0.cc: Source code for the new binary output above. * tests/data/test-diff-suppr/test29-soname-v1.cc: Likewise. * tests/data/test-diff-suppr/test29-suppr-0.txt: New test suppression file. * tests/data/test-diff-suppr/test29-suppr-1.txt: Likewise. * tests/data/Makefile.am: Add the new test material above to source distribution. * tests/test-diff-suppr.cc (in_out_specs): Make this test harness run over the new test input above. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
1eecd89ee1 |
Bug 19619 - failing to suppress added aliased function reports for C++
Libabigail is designed to avoid suppressing a change report about an added (or removed) function if that function has aliases. For the change report to be suppressed, the condition of the suppression specification must match all the aliases of the symbol of the function. This is to avoid suppressing change reports about aliases by error. If the binary results from a C program, the name of the function is the same as the name of its underlying symbol. So if the condition of the suppression specification is the property "name_regexp", the value of the condition can be made to match the names of all the aliases of the underlying symbol of the function. In that case, if value of the property name_regexp does *NOT* match all the aliases, then it's OK for the "change report suppression sub-system" to avoid suppressing the change report. But if the binary results from a C++ program, the name of the function is *different* from the name of its underlying symbol. If the condition of the suppression specification is the property "name_regexp", there is *NO* way for the user to provide a value which matches *ANY* of the names of the underlying function symbols while also matching the name of the function. So in this case, the "change report suppression sub-system" should assume that the user wants to suppress the change reports about all the aliases of the function. In this problem report, the issue is that in the case of a C++ program for which the user provided the "name_regexp" property, Libabigail is expecting the "name_regexp" to match all the aliased symbol names. Which is not possible. So the suppression specification is not suppressing the change report about the added function, just because the function has an alias. This patch fixes the issue by taking into account the difference between languages where the name of the function is the same as the name of their underlying symbol and languages where it is not. * src/abg-comparison.cc (function_suppression::suppresses_function): Make the evaluation of the "name" and "name_regexp" consider the cases of languages in which the function name is the same as the symbol name and the case of languages in which it is not. In the former case, all symbol alias names must be matched. In the latter case, if "name" and "name_regexp" match the function name, the suppression specification is considered to match the report about the function change. Also, use the elf_symbol::is_main_symbol() predicate to test for the symbol being a main symbol, rather than using error-prone pointer equality. * tests/data/test-diff-suppr/test27-add-aliased-function-0.suppr: New test input. * tests/data/test-diff-suppr/test27-add-aliased-function-1.suppr: Likewise. * tests/data/test-diff-suppr/test27-add-aliased-function-2.suppr: Likewise. * tests/data/test-diff-suppr/test27-add-aliased-function-3.suppr: Likewise. * tests/data/test-diff-suppr/test27-add-aliased-function-4.suppr: Likewise. * tests/data/test-diff-suppr/test27-add-aliased-function-report-0.txt: Likewise. * tests/data/test-diff-suppr/test27-add-aliased-function-report-1.txt: Likewise. * tests/data/test-diff-suppr/test27-add-aliased-function-report-2.txt: Likewise. * tests/data/test-diff-suppr/test27-add-aliased-function-report-3.txt: Likewise. * tests/data/test-diff-suppr/test27-add-aliased-function-report-4.txt: Likewise. * tests/data/test-diff-suppr/test27-add-aliased-function-report-5.txt: Likewise. * tests/data/test-diff-suppr/test27-add-aliased-function-v0.cc: Likewise. * tests/data/test-diff-suppr/test27-add-aliased-function-v0.o: Likewise. * tests/data/test-diff-suppr/test27-add-aliased-function-v1.cc: Likewise. * tests/data/test-diff-suppr/test27-add-aliased-function-v1.o: Likewise. * tests/data/test-diff-suppr/test28-add-aliased-function-0.suppr: Likewise. * tests/data/test-diff-suppr/test28-add-aliased-function-1.suppr: Likewise. * tests/data/test-diff-suppr/test28-add-aliased-function-2.suppr: Likewise. * tests/data/test-diff-suppr/test28-add-aliased-function-3.suppr: Likewise. * tests/data/test-diff-suppr/test28-add-aliased-function-4.suppr: Likewise. * tests/data/test-diff-suppr/test28-add-aliased-function-5.suppr: Likewise. * tests/data/test-diff-suppr/test28-add-aliased-function-report-0.txt: Likewise. * tests/data/test-diff-suppr/test28-add-aliased-function-report-1.txt: Likewise. * tests/data/test-diff-suppr/test28-add-aliased-function-report-2.txt: Likewise. * tests/data/test-diff-suppr/test28-add-aliased-function-report-3.txt: Likewise. * tests/data/test-diff-suppr/test28-add-aliased-function-report-4.txt: Likewise. * tests/data/test-diff-suppr/test28-add-aliased-function-report-5.txt: Likewise. * tests/data/test-diff-suppr/test28-add-aliased-function-report-6.txt: Likewise. * tests/data/test-diff-suppr/test28-add-aliased-function-v0.c: Likewise. * tests/data/test-diff-suppr/test28-add-aliased-function-v0.o: Likewise. * tests/data/test-diff-suppr/test28-add-aliased-function-v1.c: Likewise. * tests/data/test-diff-suppr/test28-add-aliased-function-v1.o: Likewise. * tests/data/Makefile.am: Add the new test material above to the source distribution. * tests/test-diff-suppr.cc: Add the new test inputs above to this test harness. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
ef2211831f |
Use proper WIFEXITED and WEXITSTATUS macros to get exit code
It turns out we were wrongly getting the exit code of some processes being executed by the "system()" invocation. The patch uses the WIFEXITED and WEXITSTATUS macro as documented in the man page for "system". * tests/test-diff-dwarf-abixml.cc (main): Use WIFEXITED and WEXITSTATUS macros to get the return code of the abidiff program. * tests/test-diff-filter.cc (test_task::perform): Likewise. * tests/test-diff-pkg.cc (main): Likewise. * tests/test-diff-suppr.cc (main): Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
f275939df2 |
Use worker threads pattern to speed up some tests
We are going to need to speed up more and more tests, and coding directly with libpthread for that can be tedious and bug-prone. So I devised an implementation for the worker threads design pattern instead, and used it to speed up some tests. * include/Makefile.am: Add the new abg-workers.h to source distribution. * include/abg-workers.h: New file. * src/Makefile.am: Add the new abg-worker.cc to source distribution. * src/abg-workers.cc: New file. * tests/test-utils.cc: Update copyright. Make get_src_dir() and get_build_dir() return a const char*, as opposed to returning a string. Make that const char reside in thread local storage, so that two concurrent threads can safely call these functions in parallel, without any race. * tests/test-utils.h: Make get_src_dir() and get_build_dir() return a const char*, as opposed to returning a string. * tests/test-abicompat.cc: Update copyright. Adjust for get_src_dir() and get_build_dir() change. * tests/test-abidiff.cc: Likewise. * tests/test-alt-dwarf-file.cc: Likewise. * tests/test-core-diff.cc: Likewise. * tests/test-diff-dwarf-abixml.cc: Likewise. * tests/test-diff-dwarf.cc: Likewise. * tests/test-diff-pkg.cc: Likewise. * tests/test-diff-suppr.cc: Likewise. * tests/test-lookup-syms.cc: Likewise. * tests/test-read-dwarf.cc: Likewise. * tests/test-read-write.cc: Likewise. * tests/test-types-stability.cc: Likewise. Use the new task queue type to run these tests in parallel. * tests/test-diff-filter.cc: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Ondrej Oprala
|
6a7566d513 |
Add the option of printing the file, line and column information about a type being reported.
* bash-completion/abicompat: Complete the new "--no-show-locs" option. * bash-completion/abidiff: Likewise. * bash-completion/abidw: Likewise. * bash-completion/abipkgdiff: Likewise. * doc/manuals/abicompat.rst: Mention the new "--no-show-locs" option. * doc/manuals/abidiff.rst: Likewise. * doc/manuals/abidw.rst: Likewise. * doc/manuals/abipkgdiff.rst: Likewise. * include/abg-comparison.h (show_locs): Add declarations. * src/abg-comparison.cc: (diff_context::priv): Add a new switch called "show_locs_" and set its default value to false. (report_loc_info): New function. Outputting the extra information is conditionalized based on the associated diff contexts settings. (show_locs): define a getter/setter for diff_context::priv::show_locs_. ({distinct,pointer,reference,qualified_type,enum,class,scope,fn_parm, typedef,corpus}_diff::report): Call report_loc_info when appropriate. (maybe_report_diff_for_member): Likewise. (represent): Accept a const reference to a diff_context_sptr as a first argument and call report_loc_info on its second argument. * src/abg-dwarf-reader.cc: * tests/data/Makefile.am: Add the new test reference files. * tests/data/test-abicompat/test0-fn-changed-report-2.txt: New test reference output. * tests/data/test-abicompat/test5-fn-changed-report-1.txt: Likewise. * tests/data/test-abicompat/test6-var-changed-report-1.txt: Likewise. * tests/data/test-abicompat/test7-fn-changed-report-2.txt: Likewise. * tests/data/test-diff-filter/test30-pr18904-rvalueref-report1.txt: Likewise. * tests/data/test-diff-filter/test31-pr18535-libstdc++-report-1.txt: Likewise. * tests/data/test-diff-pkg/dirpkg-3-report-2.txt: Likewise. * tests/data/test-diff-suppr/test6-fn-suppr-report-0-1.txt: Likewise. * tests/test-abidiff.cc: Explicitly create a diff context and turn off location emitting. * tests/test-diff-dwarf.cc: Likewise. * tests/test-abicompat.cc: Add --no-show-locs to all existing test arguments. Run a few of the existing tests again, but without this option. * tests/test-diff-filter.cc: Likewise. * tests/test-diff-pkg.cc: Likewise. * tests/test-diff-suppr.cc: Likewise. * tools/abicompat.cc: Handle the new "--no-show-locs" option. * tools/abidiff.cc: Likewise. * tools/abidw.cc: Likewise. * tools/abipkgdiff.cc: Likewise. Signed-off-by: Ondrej Oprala <ooprala@redhat.com> |
||
Dodji Seketeli
|
16299395d7 |
Support source_location_not_in and source_location_not_regexp suppressions
This patch adds support for properties source_location_not_in and source_location_not_regexp in the [suppress_type] section of suppression specifications. So the suppression specification: [suppress_type] source_location_not_in = foo1.h, foo2.h bar1.h bar2.h suppresses ABI change reports about types that are *NOT* defined in files foo{1,2}.h and bar{1,2}.h. The intended use of this construct is to constrain abi change reports to types that are part of the API of a given shared library. The API of the library is supposed to be defined in foo.h and bar.h only. Similarly, the suppression specification: [suppress_type] source_location_not_regexp = (foo|bar){1,2}\\.h suppresses ABI change reports about types that are not defined in the same set of files foo1.h, foo2.h, bar1.h and bar2.h. * include/abg-ini.h (enum property_value::value_kind): Add a LIST_PROPERTY_VALUE kind. (class {list_property_value, list_property}): Declare new types. (is_list_property, is_list_property_value): Declare new functions. * src/abg-ini.cc (struct list_property_value::priv): Define new type. (list_property_value::{list_property_value, get_content, set_content, as_string}): Define new member functions. (is_list_property_value): Define new function. (struct list_property::priv): Define new type. (list_property::{list_property, get_value, set_value, handle_escape}): Define new member functions. (is_list_property): Define new function. (read_context::buf_): New data member. (read_context::{peek, get, put_back, good, eof, read_string, read_list_property_value}): New member functions. (read_context::read_next_char): Use the new read_context::{get, good, eof} member function, rather than using the input stream directly. (read_context::{skip_white_spaces, skip_comments, skip_white_spaces_or_comments, read_property_name, read_function_name, read_function_argument, read_function_call_expr, read_property_value, read_tuple_property_value, read_section_name, read_section}): Adjust to use the new member functions of read_context rather than using the input stream directly. (read_context::read_string_property_value): Likewise. Use the new read_context::read_string() method. (read_context::{read, write}_property): Support reading list_property. * include/abg-comparison.h (type_suppression::{get_source_locations_to_keep, set_source_locations_to_keep, set_source_location_to_keep_regex_str, get_source_location_to_keep_regex_str}): Add new member functions. * src/abg-comparison.cc (type_suppression::priv::{source_location_to_keep_, source_location_to_keep_regex_str_, source_location_to_keep_regex_}): Add new data members. (type_suppression::priv::{g,s}et_source_location_to_keep_regex): Define new member functions. (type_suppression::{g,s}et_source_locations_to_keep): Define new member functions. (type_suppression::{g,s}et_source_location_to_keep_regex_str): Likewise. (type_suppression::suppresses_type): Support "source_location_not_regexp" and "source_location_not_in" properties of suppression specifications. (read_type_suppression): Likewise. Also adjust to the fact that ta tuple property value that is a list of strings is not a list property value. * doc/manuals/libabigail-concepts.rst: Add documentation for source_location_not_in and source_location_not_regexp. * tests/data/test-diff-suppr/libtest26-loc-suppr-v{0,1}.so: New binary test inputs. * tests/data/test-diff-suppr/test26-loc-suppr-{0,1,2}.suppr: New suppression specification test inputs. * tests/data/test-diff-suppr/test26-loc-suppr-report-{0,1,2,3}.txt: New test reference reports. * tests/data/test-diff-suppr/test26-loc-suppr-v{0,1}.cc: Source code of the test binary input above. * tests/data/test-diff-suppr/test26-loc-suppr.h: Likewise. * tests/data/Makefile.am: Add the new test material to source distribution. * tests/test-diff-suppr.cc (in_out_specs): Add the new test inputs above. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
a746f4afee |
Make applying supp specs through pointer access look through typedefs
Consider the declaration of the exported function bar() below: struct _OpaqueType {int member;}; typedef struct _OpaqueType Type; void bar(Type*); Once the *definition of struct _OpaqueType and bar() are compiled into a shared library, if a layout change happens to struct _OpaqueType, then abidiff rightfully reports that bar() is impacted by the layout change to struct _OpaqueType. But then, the following suppression specification won't silence the ABI change report: [suppress_type] name = _OpaqueType type_kind = struct accessed_through = pointer This is because strictly speaking, it's not struct _OpaqueType that is accessed through a pointer, from function bar(); it's the type 'Type', (which is a typedef of struct _OpaqueType) that is accessed though a pointer. But then, as 'Type' and 'struct _OpaqueType' are the same type (modulo the typedef), this behaviour is not super useful. It would be more interesting if the suppression specification could silence the ABI change report. And this is what this patch does. * include/abg-comparison.h (type_suppression::suppresses_type): Declare new member function. (get_typedef_diff_underlying_type_diff): Declare new function. * include/abg-fwd.h (get_typedef_underlying_type): Likewise. * src/abg-comparison.cc (type_suppression::suppresses_type): Define new member function. (get_typedef_diff_underlying_type_diff): Define new function. (type_suppression::suppresses_diff): After looking through the different kind of access methods, use the new type_suppression::suppresses_type(), rather than doing lots of stuff ourselves here. But then, if the suppression doesn't apply to the subjects of the diff, look through typedefs and try to apply the suppression again. * src/abg-ir.cc (get_typedef_underlying_type): Define new function. * tests/data/test-diff-suppr/libtest25-typedef-v{0,1}.so: New binary test input files. * tests/data/test-diff-suppr/test25-typedef-v{0,1}.c: Source code for the binary test input files above. * tests/data/test-diff-suppr/test25-typedef-report-{0, 1}.txt: New test input files. * tests/data/test-diff-suppr/test25-typedef-suppr-0.txt: New test input file. * tests/data/Makefile.am: Add the new test material to the source distribution. * tests/test-diff-suppr.cc (in_out_specs): Add the test inputs above to the set of test inputs this harness has to run over. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
f3ed9dfa92 |
Support file_name_regexp and soname_regexp in supp-specs
With this patch it's now possible to express the soname or name of the binary file that contains the ABI artifacts the suppression specifications should apply to. * include/abg-comparison.h (suppression_base::priv_): Make this pimpl member protected. (suppression_base::set_file_name_regex_str) (get_file_name_regex_str, get_soname_regex_str) (set_soname_regex_str): Declare new accessors. (function_suppression::{suppresses_function, suppresses_function_symbol}): Take a diff_context_sptr. (variable_suppression::{suppresses_variable, suppresses_variable_symbol}): Take a diff_context_sptr. * src/abg-comparison.cc (suppression_base::priv::{file_name_regex_str_, file_name_regex_, soname_regex_str_, soname_regex_}): Define new data members. (suppression_base::priv::get_file_name_regex_str) (get_soname_regex_str): Define new member functions. (suppression_base::set_file_name_regex_str) (get_file_name_regex_str, get_soname_regex_str) (set_soname_regex_str): Define new accessors. (type_suppression::suppresses_diff): Evaluate file_name_regexp and soname_regexp. (read_type_suppression): Fix the reading of the "label" property. Read the file_name_regexp and soname_regexp properties. (function_suppression::{suppresses_function, suppresses_function_symbol): Take a diff_context_sptr parameter. Evaluate file_name_regexp and soname_regexp properties. (function_suppression::suppresses_diff): Adjust for the api change of function_suppression::suppresses_function(). (read_function_suppression): Read the file_name_regexp and soname_regexp properties. (variable_suppression::suppresses_variable): Take a diff_context_sptr parameter and evaluate file_name_regexp and soname_regexp properties. (variable_suppression::suppresses_variable_symbol): Likewise. (variable_suppression::suppresses_diff): Adjust for the api change of variable_suppression::suppresses_variable(). (read_variable_suppression): Read the file_name_regexp and soname_regexp properties. (function_is_suppressed, variable_is_suppressed): Take a diff_context_sptr parameter. (corpus_diff::priv::apply_suppressions_to_added_removed_fns_vars): Adjust. * doc/manuals/libabigail-concepts.rst: Document file_name_regexp and soname_regexp in the manual. * tests/data/test-diff-suppr/libtest24-soname-v{0,1}.so: New test binary input files. * tests/data/test-diff-suppr/test24-soname-report-{0,4}.txt: New test input files. * tests/data/test-diff-suppr/test24-soname-suppr-{0,4}.txt: Likewise. * tests/data/test-diff-suppr/test24-soname-v{0,1}.cc: Source code of the binary test input files above. * tests/data/Makefile.am: Add the new test material above to source distribution. * tests/test-diff-suppr.cc (in_out_spec): Add the new test inputs to the set of tests this harness has to run over. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
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. |