mirror of
git://sourceware.org/git/libabigail.git
synced 2024-12-18 16:04:34 +00:00
4b7e295b20
35 Commits
Author | SHA1 | Message | Date | |
---|---|---|---|---|
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
|
d0b8ef6521 |
Bug 18535 - abidiff reports false positive ABI difference for libstdc++
When the DWARF reader of libabigail sees a data member for a given class flagged as being a declaration, it considers the declaration as being a definition. The reason why it doesn't strictly trust the "is_declaration" flag of DWARF is that some DWARF producers sometimes wrongly emit that flag. But then, it turns out that a class declaration can have a *static* data member without loosing its declaration-only property. This patch thus changes the behaviour of the DWARF reader to make it consider the class declaration as being a definition when the class has a *non-static* data member; a static data member only is not enough to make the class declaration become a definition. * src/abg-dwarf-reader.cc (build_class_type_and_add_to_ir): The presence of a data member shouldn't make a declaration-only class loose its declaration-only-ness; the presence of a enon-static* data member should. * tests/data/test-read-dwarf/test15-pr18892.so.abi: Adjust. * tests/data/test-read-dwarf/test16-pr18904.so.abi: Likewise. * tests/data/test-diff-filter/test31-pr18535-libstdc++-4.8.3.so: New binary test input. * tests/data/test-diff-filter/test31-pr18535-libstdc++-4.9.2.so: Likewise. * tests/data/test-diff-filter/test31-pr18535-libstdc++-report-0.txt: New test reference output. * tests/data/Makefile.am: Add the new test material to the build system. * tests/test-diff-filter.cc (in_out_specs): Add the new test inputs to the set of inputs to consider. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
49759d3be8 |
Bug 18904 - Fix support for C++ rvalue references
* src/abg-comparison.cc (reference_diff::has_changes): Just compare the references, rather than assuming that the change can only be on underlying types. (reference_diff::report): Describe lvalue/rvalue changes for references. * src/abg-ir.cc (reference_type_def::reference_type_def): Properly set the name for an rvalue reference. (equals): For references, compare lvalue-ness too. (reference_type_def::get_qualified_name): Properly set rvalue reference names. * tests/data/test-diff-filter/test30-pr18904-rvalueref-liba.so: New test input. * tests/data/test-diff-filter/test30-pr18904-rvalueref-libb.so: New test input. * tests/data/test-diff-filter/test30-pr18904-rvalueref-report0.txt: New test reference output. * tests/data/Makefile.am: Add the new files to source distribution. * tests/test-diff-filter.cc (in_out_specs): Run the new tests. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
85929105f5 |
Fix redundancy marking for change of types used directly
If a type T is used directly (i.e, not through a pointer or reference) as a function parameter or as a base class, a change in T should never be marked as redundant in that context. Otherwise, the change in that context might be filtered out, possibly hiding real ABI incompatible changes. This patch implements this policy. Also, it turned out in some circumstances, we where marking the first visited diff node of a given class of equivalence of nodes as being redundant, while we should only mark the *subsequently* visited nodes of that class of equivalence as visited. The patch also fixes that. * include/abg-comparison.h (pointer_map): Make this be a map of {size_t, size_t} pairs, rather than {size_t, bool}, so that each pointer in the map can be associated to another one. (diff_context::diff_has_been_visited): Return the pointer to the first diff node of the equivalence class that has been visited. * src/abg-comparison.cc (is_pointer_diff, is_reference_diff) (is_reference_or_pointer_diff, is_fn_parm_diff, is_base_diff) (is_child_node_of_function_parm_diff, is_child_node_of_base_diff): Define new static functions. (diff_context::diff_has_been_visited): Return the pointer to the first diff node of the equivalence class that has been visited. (diff_context::mark_diff_as_visited): Save the pointer to the first diff node of a given class of equivalence that has been visited. (redundancy_marking_visitor::visit_begin): If a diff node is a child node of a function parameter diff or base diff node and if it's not a pointer or reference diff node, then do not mark it as redundant. Also, make sure to not mark the first diff node of a given class of equivalence that has been visited, as redundant; only the other subsequent nodes should be marked redundant; we were hitting this case because of an optimization that makes equivalent class diff nodes to share their private (pimpl) data. * tests/data/test-diff-filter/test29-finer-redundancy-marking-v{0,1}.o: New test input binaries. * tests/data/test-diff-filter/test29-finer-redundancy-marking-v{0,1}.cc: Source code of the new test input binaries above. * tests/data/test-diff-filter/test29-finer-redundancy-marking-report-0.txt: New test input. * tests/data/Makefile.am: Add the new test material above to the source distribution. * tests/test-diff-filter.cc (in_out_specs): Make this test harness run over the additional test input above. * tests/data/test-diff-suppr/test5-fn-suppr-report-0.txt: Adjust. 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
|
b041bc9cf0 |
Fix redundancy propagation on node with filtered local changes
Until now, if a diff node N has a local change, even if all of its children nodes are redundant, N is not considered as being redundant. This is an issue if the local changes of N are filtered out; in that case, N should be considered redundant. This patch fixes that. It introduces a second category bitmap on the diff node that stores the categorization of the diff node that does *NOT* take in account the categories inherited from its children nodes. That way, it's possible to know if the *local changes* of a given node have been filtered out. * include/abg-comparison.h (diff::{get_local_category, add_to_local_category, add_to_local_and_inherited_categories, remove_from_local_category, set_local_category, is_filtered_out_wrt_non_inherited_categories, has_local_changes_to_be_reported}): Declare new member functions. * src/abg-comp-filter.cc ({harmless, harmful}_filter::{visit, visit_end}): Update local category too. * src/abg-comparison.cc (diff::priv::local_category_): Add new data member. (diff::priv::priv): Initialize it. (diff::priv::is_filtered_out): Add new member function. This is factorized out of diff::is_filtered_out(). (diff::is_filtered_out): Re-write in terms of diff::priv::is_filtered_out(). (diff::{get_local_category, add_to_local_category, add_to_local_and_inherited_categories, remove_from_local_category, set_local_category, is_filtered_out_wrt_non_inherited_categories, has_local_changes_to_be_reported}): Define new member functions. (suppression_categorization_visitor::visit_begin): Update local categories too. (redundancy_marking_visitor::visit_end): If all of the children nodes of the a diff node N are redundant and if N has filtered-out local changes, then N is redundant too. * tests/data/test-diff-filter/libtest28-redundant-and-filtered-children-nodes-v{1,2}.so: New binary test inputs. * tests/data/test-diff-filter/test28-redundant-and-filtered-children-nodes-v{0,1}.cc: Source code for the binary test inputs above. * tests/data/test-diff-filter/test28-redundant-and-filtered-children-nodes-report-{0,1}.txt: New test output references. * tests/test-diff-filter.cc (in_out_specs): Add the test inputs above to the set of inputs this test harness has to run over. * tests/data/Makefile.am: Add the test materials above to the source distribution. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
5244794279 |
Fix redundancy categorization propagation
Propagating redundancy categorization is broken for cases where there is a diff node that has children nodes carrying changes that are all filtered out. In that case, if among those children changes there is a redundant change, normally the parent diff node we are look at should be marked redundant too. The bug is that it's not marked as redundant at the moment. This patch fixes that. * src/abg-comparison.cc (redundancy_marking_visitor::visit_end): Consider the cases of changes that are a filtered out. * tests/data/test-diff-filter/libtest27-redundant-and-filtered-children-nodes-v{0,1}.so: New test binaries to use as test input. * tests/data/test-diff-filter/test27-redundant-and-filtered-children-nodes-report-{0,1,2}.txt: New test result baselines. * tests/data/test-diff-filter/test27-redundant-and-filtered-children-nodes-v{0,1}.cc: Source code for the test input binaries above. * tests/test-diff-filter.cc (in_out_spec): Add the binaries to the test inputs used for this test harness. * tests/data/Makefile.am: Add the new test material above to the distribution. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
29bc673dc0 |
Fix chaining of descendant node of qualified type diff node
While looking at the abidiff report emitted for two versions of the TBB library, I noticed that some diff nodes were not marked as redundant as they should be. As a result, they were being reported as having "been reported earlier", which seems to be an acceptable cruft to me especially now that the comparison IR can do proper redundancy detection and marking. I tracked that down and it's because the child node of a qualified_type_diff is just the underlying type diff node, whereas during reporting, we report about the leaf underlying type diff node, which can be different from the just the underlying type diff node because the later is always non-qualified. The fix is to make the child node of qualified_type_diff be the leaf underlying type diff node, so that diff tree walking (for the purpose of redundancy detection) and reporting are all looking at the same tree. * include/abg-comparison.h (qualified_type_diff::leaf_underlying_type_diff): Declare new accessor. * src/abg-comparison.cc (get_leaf_type): Forward declare this static function. (qualified_type_diff::priv::leaf_underlying_type_diff): Define new data member. (qualified_type_diff::leaf_underlying_type_diff): Define this new accessor. (qualified_type_diff::chain_into_hierarchy): Call leaf_underlying_type_diff() here rather than underlying_type_diff(). (qualified_type_diff::report): Use leaf_underlying_type_diff() rather than re-computing the diff between the two leaf underlying type diff nodes. * libtest26-qualified-redundant-node-v{0,1}.so: New binary test input files. * tests/data/test-diff-filter/test26-qualified-redundant-node-v{0,1}.cc: Source code for the binary test inputs above. * tests/test-diff-filter.cc (int_out_spec): Add the new test input to the vector of test input data over which to run this test harness. * tests/data/test-diff-filter/test26-qualified-redundant-node-report-{0,1.txt: New test input file. * tests/data/Makefile.am: Add the new test input data to the source distribution. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
ddfb37ab17 |
Recognize cyclic diff tree nodes as being redundant
Okay I need to introduce some vocabulary here. Suppose we have the version 1 of a library named library-v1.so which source code is: struct S { int m0; struct S* m2; }; int foo(struct S* ptr) { return ptr; } And now suppose we have a version 2 of that library named library-v2.so which source code is modified so that a new data member is inserted into struct S: struct S { int m0; char m1; /* <--- a new data member is inserted here. */ struct S* m2; }; int foo(struct S* ptr) { return ptr; } struct S is said to be a cyclic type because it contains a (data) member which type refers to struct S itself, namely, the type of the data member S::m2 is struct S*, which refers to struct S. So, by analogy, the diff node tree that represents the changes of struct S is also said to be cyclic, for similar reasons: the diff node of the change of S::m2 refers to the diff node of the change of the type of S::m2, namely the diff node of struct S*, which refers to the diff node for the change of struct S itself. Now let's talk about redundancy. When walking the diff node tree of struct S in a depth-first manner, at some point, we look at the diff node for the data member S::m2, and we end up looking at the diff node of its type which is the diff node for struct S*; we keep walking and eventually we look the diff node of the change of the underlying type of struct S, which is the diff node of struct S, and hah! that is a redundant node because it's the first node that we visited when visiting the diff node of ... struct S! So the diff tree node for the change of struct S is not only a cyclic node, it's a redundant diff node as well, and its second occurrence is located at the point of appearance of data member S::m2. Hence the wording "cyclic redundant diff tree node". There! We have our vocabulary all set now. This patch enhances the code of the comparison engine so that a cyclic diff tree node is marked as redundant from the point of its second occurrence, onward. First the patch separates the notion of visiting a diff node from the notion of traversing it. Now traversing a diff node means visiting it and visiting its children nodes. So one can visit a node without traversing it, but one can not traverse a node without visiting it. So, when walking diff node trees, we need to avoid ending up in infinite loop in presence of cyclic nodes. This is why re-traversing a node that is already being traversed is forbidden by this patch, but visiting a node that is being visited is allowed. Before this patch, the notions of visiting and traversing were conflated in one and were not very clear; and one couldn't visit a node that was currently being visited. As a result, in presence of a cyclic node, its redundant nature wasn't being recognized, and so the diff tree node was not being flagged as being redundant. Diff reports were then cluttered by redundant references to changes involving cyclic types. * include/abg-comparison.h (enum visiting_kind): Rename enumerator DO_NOT_MARK_VISITED_NODES_AS_TRAVERSED into DO_NOT_MARK_VISITED_NODES_AS_VISITED. (diff_context::diff_has_been_visited): Rename diff_context::diff_has_been_traversed into this. (diff_context::mark_diff_as_visited): Rename diff_context::mark_diff_as_traversed into this. (diff_context::forget_visited_diffs): Rename diff_context::forget_traversed_diffs into this. (diff_context::forbid_visiting_a_node_twice): Rename diff_context::forbid_traversing_a_node_twice into this. (diff_context::visiting_a_node_twice_is_forbidden): Rename diff_context::traversing_a_node_twice_is_forbidden into this. (diff::is_traversing): Move this from protected to public. * src/abg-comparison.cc (diff_context::priv::visited_diff_nodes_): Rename diff_context::priv::traversed_diff_nodes_ into this. (diff_context::priv::forbid_visiting_a_node_twice_): Rename diff_context::priv::forbid_traversing_a_node_twice_ into this. (diff_context::priv::priv): Adjust. (diff_context::diff_has_been_visited): Rename diff_context::diff_has_been_traversed into this. Adjust. (diff_context::mark_diff_as_visited): Rename diff_context::mark_diff_as_traversed into this. Adjust. (diff_context::forget_visited_diffs): Rename diff_context::forget_traversed_diffs into this. Adjust. (diff_context::forbid_visiting_a_node_twice): Rename diff_context::forbid_traversing_a_node_twice into this. (diff_context::visiting_a_node_twice_is_forbidden): Rename diff_context::traversing_a_node_twice_is_forbidden into this. (diff_context::maybe_apply_filters): Adjust. (diff::end_traversing): Remove the 'mark_as_traversed' parameter of this. Remove the visited-marking code. (diff::traverse): This is the crux of the changes of this patch. Avoid traversing a node that is being traversed, but one can visit a node being visited. Also, traversing a node means visiting it and visiting its children nodes. (diff::is_filtered_out): Simplify logic for filtering redundant code. Basically all nodes that are redundant are filtered. All the complicated logic that was due when diff nodes were shared is not relevant anymore. (corpus_diff::priv::categorize_redundant_changed_sub_nodes) (propagate_categories, apply_suppressions) (diff_node_printer::diff_node_printer, print_diff_tree) (categorize_redundant_changed_sub_nodes) (clear_redundancy_categorization) (clear_redundancy_categorization): Adjust. (redundancy_marking_visitor::visit_begin): Adjust. Also, if the current diff node is already being traversed (that's a clyclic node) then mark it as redundant. * src/abg-comp-filter.cc (apply_filter): Adjust. * tests/data/test-diff-filter/test16-report-2.txt: New test input data. * tests/data/test-diff-filter/libtest25-cyclic-type-v{0,1}.so: New test input binaries. * tests/data/test-diff-filter/test25-cyclic-type-v{0,1}.cc: Source code for the test input binaries. * tests/data/test-diff-filter/test25-cyclic-type-report-0.txt: New test input data. * tests/data/test-diff-filter/test25-cyclic-type-report-1.txt: Likewise. * tests/test-diff-filter.cc (in_out_specs): Add the new test inputs above to the list of test input data over which to run this test harness. * tests/data/Makefile.am: Add the new test files above to source distribution. * tests/data/test-diff-filter/test16-report.txt: Adjust. * tests/data/test-diff-filter/test17-0-report.txt: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
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
|
8879d00538 |
Extend detection of compatible types to arrays
* include/abg-fwd.h (is_array_type): Renamed is_array_type_def() into this for consistency. * src/abg-comparison.cc (type_suppression::suppresses_diff): Adjust. * src/abg-dwarf-reader.cc (build_array_type): Remove useless code that was trying to read a DW_AT_byte_size attribute from the DIE of the array, but then wasn't doing anything with the value. But then if the attribute was not present, the array type wouldn't be built. * src/abg-ir.cc (strip_typedef): Strip typedefs from sub-types of array types too. (is_array_type): Rename is_array_def() to this, for consistency. (var_decl::get_pretty_representation): Adjust. * tests/data/test-diff-filter/libtest24-compatible-vars-v0.so: New test input data. * tests/data/test-diff-filter/libtest24-compatible-vars-v1.so: Likewise. * tests/data/test-diff-filter/test24-compatible-vars-report-0.txt: Likewise. * tests/data/test-diff-filter/test24-compatible-vars-v0.c: Source code for the first binary above. * tests/data/test-diff-filter/test24-compatible-vars-v1.c: Source code for the second binary above. * tests/data/Makefile.am: Add the new test input data to source distribution. * tests/test-diff-filter.cc (in_out_specs): Add the new test input data to the list of input to run this test harness over. 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
|
1b75fd3eac |
Make determining of compatible types complete
Until now, two types that are different were considered compatible if one type is a typedef of the other. This is useful because two different types, if compatible, are not ABI-incompatible. This patch extends the concept of compatible types to types which might have sub-types that are typedefs of each others, including function types. Note implementing this required that I fixed various other things left and right. Like style fixes, crash avoiding fixes, etc. * include/abg-fwd.h (is_reference_type, is_function_type) (is_method_type): Declare new predicates. * include/abg-ir.h (class qualified_type_def): Pimpl this class. (qualified_type_def::qualified_type_def): Use the convenience type_base_sptr typedef. (qualified_type_def::{get_cv_quals, set_cv_quals}): Use the qualified_type_def::CV type rather than char. (qualified_type_def::get_underlying_type): Use the convenience type_base_sptr typedef. (pointer_type_def::pointer_type_def): Likewise. (function_decl::parameter::parameter): Add a new constructor. * src/abg-ir.cc (is_reference_type, is_function_type) (is_method_type): Define new predicates. (class qualified_type_def::priv): Define this new private type, for the purpose of Pimpl-ifying the qualified_type_def class. (qualified_type_def::{qualified_type_def, build_name, get_cv_quals_string_prefix, get_underlying_type}): Adjust for the purpose of Pimpl-ifying the qualified_type_def class. (equals): In the qualified_type_def, reference_type_def overloads, trust the fact that we have operator== overload for the type_base_sptr. This avoids crashes for when the (possible) underlying type is null. (pointer_type_def::operator==): Likewise. (strip_typedef): Make this recursively strip typedefs from sub-types. (types_are_compatible): Handle null types. (qualified_type_def::{get_cv_quals, set_cv_quals}): Handle qualified_type_def::CV rather than char. (pointer_type_def::pointer_type_def): Use the convenience type_base_sptr typedef. * include/abg-comparison.h (distinct_diff::compatible_child_diff): Declare new member function. * src/abg-comparison.cc (distinct_diff::compatible_child_diff): Define new member function. (distinct_diff::chain_into_hierarchy): Chain the compatible child diff node that might be present. (distinct_diff::report): Now when a distinct diff carries a compatible change, mention it in the report. * src/abg-comp-filter.cc (is_compatible_change): A compatible change can now involve types that are not typedefs. Only their sub-types need to be involved with typedef-ness. * tests/data/test-diff-dwarf/test{2,4,5}-report.txt: Adjust. * tests/data/test-diff-filter/libtest21-compatible-vars-v0.so: New test data input. * tests/data/test-diff-filter/libtest21-compatible-vars-v1.so: Likewise. * tests/data/test-diff-filter/test21-compatible-vars-report-0.txt Likewise. * tests/data/test-diff-filter/test21-compatible-vars-report-1.txt Likewise. * tests/data/test-diff-filter/test21-compatible-vars-v0.cc: Source code for the first data input binary above. * tests/data/test-diff-filter/test21-compatible-vars-v1.cc: Source code for the second data input binary above. * tests/data/test-diff-filter/libtest22-compatible-fns-v0.so: New test data input. * tests/data/test-diff-filter/libtest22-compatible-fns-v1.so Likewise. * tests/data/test-diff-filter/test22-compatible-fns-report-0.txt: New test data input. * tests/data/test-diff-filter/test22-compatible-fns-report-1.txt: Likewise. * tests/data/test-diff-filter/test22-compatible-fns-v0.c: Source code for the first test data input binary above. * tests/data/test-diff-filter/test22-compatible-fns-v1.c: Source code for the second test data input binary above. * tests/data/Makefile.am: Add the new test input data to source distribution. * tests/test-diff-filter.cc (in_out_specs): Add the new test data input above to the list of test data this harness has to be run over. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
d041c1f5dd |
Rename bi* tools to abi* tools
* tests/data/test-bidiff: Rename this directory to tests/data/test-abidiff. * tests/test-bidiff.cc: Renamed this to tests/test-abidiff.cc. * tools/biar.cc: Renamed to tools/abiar.cc * tools/bidiff.cc: Renamed to tools/abidiff.cc * tools/bidw.cc: Renamed to tools/abidw.cc * tools/bilint.cc: Renamed to tools/abilint.cc * tools/bisym.cc: Renamed to tools/abisym.cc * tests/test-alt-dwarf-file.cc: Renamed references to bidw* to abidw*. * tests/test-diff-filter.cc: Renamed references to bidiff to abidiff. * tests/test-lookup-syms.cc: Renamed references to bisym to abisym. * tools/Makefile.am: Adjust. * tests/Makefile.am: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
fde3436568 |
Better support for inline related diffs
* include/abg-comparison.h (diff_category::HARMLESS_SYMBOL_ALIAS_CHANGE_CATEORY): New enumerator. (diff_category::EVERYTHING_CATEGORY): Adjust. * include/abg-ir.h (elf_symbol::get_aliases_id_string) (elf_symbol::does_alias, elf_symbols_alias) (compute_aliases_for_elf_symbol): Declare new functions ... * src/abg-ir.cc (elf_symbol::get_aliases_id_string) (elf_symbol::does_alias, elf_symbols_alias) (compute_aliases_for_elf_symbol): ... and define them. (function_decl::operator==): Take in account elf symbol aliases. * src/abg-comp-filter.cc (function_name_changed_but_not_symbol): Define new static functions. (harmless_filter::visit): Categorize function name changes that n doesn't impact underlying elf symbols (or the fact that two symbols were aliases and are not anymore) as harmless. * src/abg-comparison.cc (function_decl_diff::report): Properly report function name changes, or symbol aliases changes for that matter. Also report inline-ness declaration changes. * src/abg-dwarf-reader.cc (die_is_declared_inline): New static function. (build_function_decl): Use the above. * tools/bidiff.cc (set_diff_context_from_opts): Add abigail::comparison::HARMLESS_SYMBOL_ALIAS_CHANGE_CATEORY into the harmless change camp. * tests/data/test-diff-dwarf/test14-inline-report.txt: New test input. * tests/data/test-diff-dwarf/test14-inline-v0.o: Likewise. * tests/data/test-diff-dwarf/test14-inline-v1.o: Likewise. * tests/data/test-diff-dwarf/test14-inline-v0.cc: Source code for test input. * tests/data/test-diff-dwarf/test14-inline-v1.cc: Source code for test input. * tests/test-diff-dwarf.cc: Run this test harness over the new input above. * tests/data/test-diff-filter/test20-inline-report-0.txt: Likewise. * tests/data/test-diff-filter/test20-inline-report-1.txt: Likewise. * tests/data/test-diff-filter/test20-inline-v0.o: New test input. * tests/data/test-diff-filter/test20-inline-v1.o: New test input. * tests/data/test-diff-filter/test20-inline-v0.cc: Source code for test input. * tests/data/test-diff-filter/test20-inline-v1.cc: Likewise. * tests/test-diff-filter.cc: Run this test harness over the new input above. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
ba487a2cd9 |
Better support for enum diffs
* include/abg-comparison.h (changed_enumerator_type): New typedef. (diff_category::{HARMLESS_ENUM_CHANGE_CATEGORY}): New enumerator. * src/abg-comp-filter.cc (has_type_size_change) (has_enumerator_insertion, has_enumerator_removal_or_change) (has_harmful_enum_change): New functions. (harmless_filter::visit): Categorize enumerator insertions that don't change the size of the type into HARMLESS_ENUM_CHANGE_CATEGORY. (harmful_filter::visit): Categorize enumerator removal or any enum change that changes the size of the type into SIZE_OR_OFFSET_CHANGE_CATEGORY. * src/abg-comparison.cc (enumerator_value_comp) (changed_enumerator_comp): New types. (sort_enumerators, sort_changed_enumerators): New static functions. (enum_diff::report): Sort enum related reports by the value of the enumerators. * src/abg-dwarf-reader.cc (build_enum_type): Name anonymous enums as __anonymous_enum__. * tools/bidiff.cc (set_diff_context_from_opts): Add abigail::comparison::HARMLESS_ENUM_CHANGE_CATEGORY into the harmless stuff camp. * tests/data/test-diff-dwarf/test15-enum-report.txt: New test input. * tests/data/test-diff-dwarf/test15-enum-v1.o: Likewise. * tests/data/test-diff-dwarf/test15-enum-v0.o: Likewise. * tests/data/test-diff-dwarf/test15-enum-v0.cc: Source code for test input. * tests/data/test-diff-dwarf/test15-enum-v1.cc: Likewise. * tests/data/test-diff-filter/test19-enum-report-0.txt: New test input. * tests/data/test-diff-filter/test19-enum-report-1.txt: Likewise. * tests/data/test-diff-filter/test19-enum-v0.o: Likewise. * tests/data/test-diff-filter/test19-enum-v1.o: Likewise. * tests/data/test-diff-filter/test19-enum-v0.cc: Source code for test input. * tests/data/test-diff-filter/test19-enum-v1.cc: Likewise. * tests/test-diff-dwarf.cc: Run this test harness on the new test inputs above. * tests/test-diff-filter.cc: Likewise. * tests/Makefile.am: Add the new files above to the source distribution. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
b75a020fb1 |
Do not filter out diff nodes that are only in NOT_REDUNDANT_CATEGORY
* src/abg-comparison.cc (diff::is_filtered_out): If a diff not is only in the NOT_REDUNDANT_CATEGORY category consider it as not being filtered. * tests/data/test-diff-filter/test18-report.txt: New test input. * tests/data/test-diff-filter/test18-v0.cc: Source code for new test input. * tests/data/test-diff-filter/test18-v0.o: New test input. * tests/data/test-diff-filter/test18-v1.cc: Source code for new test input. * tests/data/test-diff-filter/test18-v1.o: New test input. * tests/Makefile.am: Add the new test inputs to the source distribution. * tests/test-diff-filter.cc: Run this test harness on the new test input above. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
bc7694e14c |
During redundancy marking start with the current node as non redundant
* src/abg-comparison.cc (ENSURE_DIFF_NODE_TRAVERSED_ONCE): If the diff node is being traversed for the first time, mark it as being in the NOT_REDUNDANT_CATEGORY. I don't know why I was doing this only for classes and basic types. Update comments. * tests/data/test-diff-filter/test16-report.txt: New test input. * tests/data/test-diff-filter/test16-v0.cc: Source code of new test input. * tests/data/test-diff-filter/test16-v0.o: New test input. * tests/data/test-diff-filter/test16-v1.cc: Source code of new test input. * tests/data/test-diff-filter/test16-v1.o: New test input. * tests/data/test-diff-filter/test17-0-report.txt: Likewise. * tests/data/test-diff-filter/test17-1-report.txt: Likewise. * tests/data/test-diff-filter/test17-v0.cc: Source code of new test input. * tests/data/test-diff-filter/test17-v0.o: Likewise. * tests/data/test-diff-filter/test17-v1.cc: Source code of new test input. * tests/data/test-diff-filter/test17-v1.o: Likewise. * tests/Makefile.am: Add the new files to the source distribution. * tests/test-diff-filter.cc (in_out_spec): Run this test harness over the new test inputs. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
83ed508010 |
In bidiff, change --no-linkage-names to --no-linkage-name
* tools/bidiff.cc (display_usage): Change--no-linkage-names -o --no-linkage-name in the help string. (parse_command_line): Adjust the command line parsing accordingly. * tests/test-diff-filter.cc (in_out_specs): Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
591014bf40 |
Avoid reporting diff nodes that have already been reported
* include/abg-comp-filter.h (class harmful_filter): Update comment. (class redundant_filter): Declare new filter. * include/abg-comparison.h (enum diff_category::NOT_REDUNDANT_CATEGORY): New category. Update the values of the other enumerators. (diff_context::{add_diff, diff_has_been_traversed}): New overloads. (diff_context::{categorizing_redundancy, show_redundant_changes}): Declare new methods. (diff_context::remove_from_category): Define new inline method. * src/abg-comparison.cc (noop_deleter::operator()): Constify the parameter. (CATEGORIZE_REDUNDANCY_FROM_CHILD_NODE) (UPDATE_REDUNDANCY_CATEGORIZATION_FROM_NODE_SUBTREE): New macros. (TRAVERSE_DIFF_NODE_AND_PROPAGATE_CATEGORY) (TRAVERSE_MEM_DIFF_NODE_AND_PROPAGATE_CATEGORY) (TRAVERSE_MEM_FN_DIFF_NODE_AND_PROPAGATE_CATEGORY): Use the new CATEGORIZE_REDUNDANCY_FROM_CHILD_NODE and UPDATE_REDUNDANCY_CATEGORIZATION_FROM_NODE_SUBTREE macros above. (ENSURE_DIFF_NODE_TRAVERSED_ONCE) (ENSURE_MEM_DIFF_NODE_TRAVERSED_ONCE): If the (type_decl or class) node hasn't been yet traversed, mark it as non-redundant. (diff_context::priv::categorizing_redundancy): New member. (diff_context::priv::priv): Initialize it. (diff_context::{add_diff, diff_has_been_traversed): Define new overloads. (diff_context::mark_diff_as_traversed): Intern a diff node that is marked as being traversed. (diff_context::{categorizing_redundancy, show_redundant_changes}): Define new methods. (diff::is_filtered_out): A redundant function or top-level variable is considered filtered-out. Otherwise, the new NOT_REDUNDANT_CATEGORY doesn't play any role when comparing allowed categories with the set of categories a diff node belongs to. (corpus::priv::categorize_redundant_changed_sub_nodes): Define new member function. (corpus_diff::priv::apply_filters_and_compute_diff_stats): Change this to first walk the changed functions and variables to apply filters, then categorize redundant changed functions, and then walk the changed functions and variables again to count filtered-out diff nodes. (filtering::redundant_filter::visit): Define new member function. * tools/bidiff.cc (options::show_redundant_changes): New data member. (options::options): Initialize it. (display_usage): Add help string for the --redundant command line option. (parse_command_line): Add support for the --redundant command line option. (set_diff_context_from_opts): Take the --redundant command line option in account. * tests/test-diff-filter.cc: Update this to add new test inputs. * tests/data/test-diff-filter/test14-0-report.txt: New test input. * tests/data/test-diff-filter/test14-1-report.txt: Likewise. * tests/data/test-diff-filter/test14-v0.cc: Likewise. * tests/data/test-diff-filter/test14-v0.o: Likewise. * tests/data/test-diff-filter/test14-v1.cc: Likewise. * tests/data/test-diff-filter/test14-v1.o: Likewise. * tests/data/test-diff-filter/test15-0-report.txt: Likewise. * tests/data/test-diff-filter/test15-1-report.txt: Likewise. * tests/data/test-diff-filter/test15-v0.cc: Likewise. * tests/data/test-diff-filter/test15-v0.o: Likewise. * tests/data/test-diff-filter/test15-v1.cc: Likewise. * tests/data/test-diff-filter/test15-v1.o: Likewise. * tests/Makefile.am: Add the above to the build system. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
f3f2382396 |
Update copyright notice for a bunch of files
* include/abg-comp-filter.h: Update copyright notice. * include/abg-comparison.h: Likewise. * src/abg-comparison.cc: Likewise. * src/abg-ir.cc: Likewise. * tools/bidiff.cc: Likewise. * tests/test-diff-filter.cc: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
9ed00db0a2 |
Make bidiff filter output and display symbol names by default
* tools/bidiff.cc (options::options): Initialize options::show_linkage_names to true and options::show_harmful_changes to false. (parse_command_line): Change --linkage-names into --no-linkage-names as the linkage names are now displayed by default. Change --no-harmless into --harmless as harmless changes are now filtered by default. (display_usage): Update help string for the --linkage-names -> --no-linkage-names and --no-harmful -> --harmful change. * tests/test-diff-filter.cc: Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
262c39f763 |
Categorize base class changes as SIZE_OR_OFFSET_CHANGE_CATEGORY
* include/abg-comparison.h (class_diff::{deleted, inserted, changed}_bases): Declare new member functions ... * src/abg-comparison.cc ((class_diff::{deleted, inserted, changed}_bases)): ... and define them. * src/abg-comp-filter.cc (base_classes_added_or_removed): Define new static functions. (harmless_filter): Categorize base classes added or removed. * tests/data/test-diff-dwarf/test8-report.txt: New test input. * tests/data/test-diff-dwarf/test8-v0.cc: Likewise. * tests/data/test-diff-dwarf/test8-v0.o: Likewise. * tests/data/test-diff-dwarf/test8-v1.cc: Likewise. * tests/data/test-diff-dwarf/test8-v1.o: Likewise. * tests/data/test-diff-filter/test13-report.txt: New test input. * tests/data/test-diff-filter/test13-v0.cc: Likewise. * tests/data/test-diff-filter/test13-v0.o: Likewise. * tests/data/test-diff-filter/test13-v1.cc: Likewise. * tests/data/test-diff-filter/test13-v1.o: Likewise. * tests/Makefile.am: Add the new files above to the source distribution. * tests/test-diff-dwarf.cc: Use the new relevant input above to run more tests. * tests/test-diff-filter.cc: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
e4820f9e33 |
File static data member changes in STATIC_DATA_MEMBER_CHANGE_CATEGORY
* include/abg-comparison.h (diff_category::STATIC_DATA_MEMBER_CHANGE_CATEGORY): New category. (diff_category::EVERYTHING_CATEGORY): Update * src/abg-comp-filter.cc (static_data_member_type_size_changed) (static_data_member_added_or_removed): Define new static functions. (harmless_filter::visit): Categorize changes to static data members as STATIC_DATA_MEMBER_CHANGE_CATEGORY. * tools/bidiff.cc (set_diff_context_from_opts): STATIC_DATA_MEMBER_CHANGE_CATEGORY is falls into the harmless group. * tests/data/test-diff-filter/test12-report.txt: New test input. * tests/data/test-diff-filter/test12-v0.cc: Likewise. * tests/data/test-diff-filter/test12-v0.o: Likewise. * tests/data/test-diff-filter/test12-v1.cc: Likewise. * tests/data/test-diff-filter/test12-v1.o: Likewise. * tools/bidiff.cc: Run this test with the additional input data above. * tests/Makefile.am: Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
305f18e91e |
Filter non-virtual member fns insertions/deletions from class changes
* include/abg-fwd.h (member_function_is_virtual): Declare new function. * include/abg-comparison.h (diff_category::{NON_VIRT_MEM_FUN_CHANGE_CATEGORY, VIRTUAL_MEMBER_CHANGE_CATEGORY}): New enumerators. (diff_category::EVERYTHING_CATEGORY): Adjust. (class_diff::{changed, deleted, inserted}_member_fns): Declare new member functions. * src/abg-comp-filter.cc (data_member_added_or_removed): Add missing comments. (has_non_virtual_mem_fn_change): New static predicate function. (harmless_filter::visit): Categorize non-virtual member function changes in a diff into NON_VIRT_MEM_FUN_CHANGE_CATEGORY. * src/abg-comparison.cc (TRAVERSE_MEM_FN_DIFF_NODE_AND_PROPAGATE_CATEGORY): New macro. (report_mem_header): Count filtered functions for added/deleted functions as well. (class_diff::priv::count_filtered_changed_mem_fns): Renamed priv::count_filtered_member_functions into this. Filter out changes to non-virtual member functions here. (class_diff::priv::count_filtered_{inserted, deleted}_mem_fns): New member functions. (class_diff::{deleted, inserted, changed}_member_fns): Define new member functions. (class_diff::report): Adjust count for filtered inserted/deleted member functions. Do not report NON_VIRT_MEM_FUN_CHANGE_CATEGORY if it's disallowed. (class_diff::traverse): Propagate only VIRTUAL_MEMBER_CHANGE_CATEGORY from member functions to their enclosing class. * src/abg-ir.cc (member_function_is_virtual): Define new functions. * tools/bidiff.cc (set_diff_context_from_opts): Adjust to add NON_VIRT_MEM_FUN_CHANGE_CATEGORY into the harmless group and VIRTUAL_MEMBER_CHANGE_CATEGORY into the harmful one. * tests/data/test-diff-filter/test0-report.txt: New test input. * tests/data/test-diff-filter/test10-report.txt: Likewise. * tests/data/test-diff-filter/test10-v0.cc: Likewise. * tests/data/test-diff-filter/test10-v0.o: Likewise. * tests/data/test-diff-filter/test10-v1.cc: Likewise. * tests/data/test-diff-filter/test10-v1.o: Likewise. * tests/data/test-diff-filter/test11-report.txt: Likewise. * tests/data/test-diff-filter/test11-v0.cc: Likewise. * tests/data/test-diff-filter/test11-v0.o: Likewise. * tests/data/test-diff-filter/test11-v1.cc: Likewise. * tests/data/test-diff-filter/test11-v1.o: Likewise. * tests/data/test-diff-filter/test2-report.txt: Likewise. * tests/data/test-diff-filter/test9-report.txt: Likewise. * tests/data/test-diff-filter/test9-v0.cc: Likewise. * tests/data/test-diff-filter/test9-v0.o: Likewise. * tests/data/test-diff-filter/test9-v1.cc: Likewise. * tests/data/test-diff-filter/test9-v1.o: Likewise. * tests/test-diff-filter.cc: Consume the test input above to run more tests. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
f02768e7a7 |
Represent a removed+added data member at a given offset as changed
* include/abg-fwd.h (get_data_member_offset): Declare new overload for decl_base_sptr. * include/abg-comparison.h (unsigned_decl_base_sptr_map) (unsigned_changed_type_or_decl_map): New typedefs. * src/abg-ir.cc (get_data_member_offset): Define new overload for decl_base_sptr. * src/abg-comparison.cc (diff_kind::subtype_change_kind): New enumerator for a change about a type or sub-type of a member of a structure/enum. (report_mem_header): Handle the new enumerator above. (class_diff::priv::{deleted_dm_by_offset_, inserted_dm_by_offset_, changed_dm_}): New data members. (class_diff::priv::subtype_changed_dm_): Renamed class_diff::priv::changed_data_members_ into this. (class_diff::priv::subtype_changed_dm): Renamed class_diff::priv::data_member_has_changed into this. Adjust. (class_diff::count_filtered_subtype_changed_dm): Renamed count_filtered_data_members into this. Adjust. (class_diff::priv::count_filtered_changed_dm): New member function. (class_diff::lookup_tables_empty): Adjust. (class_diff::ensure_lookup_tables_populated): Adjust. Detect when a data member is deleted and added back to offset N, and be prepared to present that as a change of data member at offset N. (class_diff::report): Adjust. Report data members of a given offset that have changed. * tests/data/test-diff-dwarf/test6-report.txt: New reference report for new test input. * tests/data/test-diff-dwarf/test6-v0.cc: Source code for new test input binary. * tests/data/test-diff-dwarf/test6-v0.o: New test input binary. * tests/data/test-diff-dwarf/test6-v1.cc: Source code for new test input binary. * tests/data/test-diff-dwarf/test6-v1.o: New test input binary. * tests/test-diff-dwarf.cc: Adjust to include the new test inputs above. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
23b7fa9ac2 |
Add a new DECL_NAME_CHANGE_CATEGORY change category
* include/abg-comparison.h (enum diff_category::DECL_NAME_CHANGE_CATEGORY): New enumerator. * src/abg-comparison.cc (report_name_size_and_alignment_changes) ({enum, typedef}_diff::report): Adjust to avoid emitting name change report if the DECL_NAME_CHANGE_CATEGORY category of change is currently disallowed. * abg-comp-filter.cc (decl_name_changed): New static function. (harmless_filter::visit): Detect that the decl name changed and put the current diff node (and its parents) into the DECL_NAME_CHANGE_CATEGORY category. * tools/bidiff.cc (set_diff_context_from_opts): Set the new DECL_NAME_CHANGE_CATEGORY category into the harmless_changes group of categories. * tests/data/test-diff-filter/test6-report.txt: New test input file. * tests/data/test-diff-filter/test6-v0.cc: Likewise. * tests/data/test-diff-filter/test6-v0.o: Likewise. * tests/data/test-diff-filter/test6-v1.cc: Likewise. * tests/data/test-diff-filter/test6-v1.o: Likewise. * tests/data/test-diff-filter/test7-report.txt: Likewise. * tests/data/test-diff-filter/test7-v0.cc: Likewise. * tests/data/test-diff-filter/test7-v0.o: Likewise. * tests/data/test-diff-filter/test7-v1.cc: Likewise. * tests/data/test-diff-filter/test7-v1.o: Likewise. * tests/test-diff-filter.cc: Take the new inputs above to run new tests. * tests/Makefile.am: Add the new files above to the distribution. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
8801da4eb9 |
Categorize through compatible distinct type diffs
* src/abg-comparison.cc (report_size_and_alignment_changes): Split this static function out of ... (report_name_size_and_alignment_changes): ... this one. (distinct_diff::report): If the typedef-stripped variants of the diff subjects are of the same kind, display their diff. Otherwise, tell explicitly is the distinct type diff involves a type size change. (distinct_diff::traverse): If the typedef-stripped variants of the diff subjects are of the same kind, traverse that underlying diff sub-tree and propagate the categorizing possibly resulting from that traversal. * tests/data/test-diff-dwarf/test4-v0.o: New test input binary. * tests/data/test-diff-dwarf/test4-v0.cc: Source code for the input binary above. * tests/data/test-diff-dwarf/test4-v1.o: New test input binary. * tests/data/test-diff-dwarf/test4-v1.cc: Source code for the input binary above. * tests/data/test-diff-dwarf/test4-report.txt: Reference report for the difference between the two binaries above. * tests/data/test-diff-filter/test5-v0.o: New test input binary. * tests/data/test-diff-filter/test5-v0.cc: Source code for the input binary above. * tests/data/test-diff-filter/test5-v1.o: New test input binary. * tests/data/test-diff-filter/test5-v1.cc: Source code for the input binary above. * tests/data/test-diff-filter/test5-report.txt: Reference report for the difference between the two binaries above. * tests/test-diff-filter.cc: Adjust to produce a filtered diff for the two input binaries above. * tests/Makefile.am: Adjust to add missing test files to the distribution. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
e9ce9ef352 |
Do not hook type diff nodes to a parent
A given diff node for a type can be hung off of several contexts: a function parameter type node, another type diff node, etc. For that reason, a type diff node should not have a parent node. Thus, it's should be the job of the context containing the type diff node to propagate its categories to the context nodes. This actually fixes a bug about category propagation. * abg/comparison.cc (var_diff::var_diff): Do not set parent node for the type diff of the var_diff. (var_diff::traverse): Handle category propagation from the type diff node to the var_diff node. (pointer_diff::underlying_type_diff) (reference_diff::underlying_type_diff) (qualified_type_diff::underlying_type_diff, enum_diff::enum_diff) (base_diff::get_underlying_class_diff) (typedef_diff::underlying_type_diff): Do not set the parent node here. ({pointer_diff, reference_diff, qualified_type, enum_diff, class_diff, base_diff, function_decl_diff, typedef_diff}::traverse): Handle category propagation here. * tests/data/test-diff-filter/test4-v0.o: New input binary. * tests/data/test-diff-filter/test4-v0.cc: Source code for the input binary above. * tests/data/test-diff-filter/test4-v1.o: New input binary. * tests/data/test-diff-filter/test4-v1.cc: Source code for the input binary above. * tests/data/test-diff-filter/test4-report.txt: Reference diff report for the input binaries above. * tests/test-diff-filter.cc:: Run bidiff --no-harmless on the binaries above. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
64bbb5ccef |
Add a COMPATIBLE_TYPE_CHANGE_CATEGORY to bidiff --no-harmless
* include/abg-comparison.h (diff_category::COMPATIBLE_TYPE_CHANGE_CATEGORY): New enumerator. (operator|=(diff_category&, diff_category)): New declaration. * include/abg-fwd.h (is_typedef, strip_typedef) (types_are_compatible): New declarations. * include/abg-ir.h (operator==(const decl_base_sptr, const decl_base_sptr)): Added the consts here. (operator==(const type_base_sptr, const type_base_sptr)): New declaration. * src/abg-comp-filter.cc (is_compatible_change): New static function. (harmless_filter::visit): Detect compatible changes and add the sub-tree into the new COMPATIBLE_TYPE_CHANGE_CATEGORY if applicable. Cleanup the logic. * src/abg-comparison.cc (operator|=(diff_category&, diff_category)): Define new function. (operator==(const decl_base_sptr l, const decl_base_sptr r)): Add consts. (operator==(const type_base_sptr l, const type_base_sptr r)): Define new operator. (is_typedef, strip_typedef, types_are_compatible): New function definitions. * tests/data/test-diff-filter/test3-report.txt: New test report reference. * tests/data/test-diff-filter/test3-v0.cc: Source code for new test input. * tests/data/test-diff-filter/test3-v0.o: New test input. * tests/data/test-diff-filter/test3-v1.cc: Source code for new test input. * tests/data/test-diff-filter/test3-v1.o: New test input. * tests/test-diff-filter.cc: Adjust to consume the new tests inputs above. * tools/bidiff.cc: Add the new COMPATIBLE_TYPE_CHANGE_CATEGORY into the --harmless group. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
28304c9439 |
Don't emit local filtered-out changes
* src/abg-comparison.cc (represent): For var_decl, do not emit filtered-out local size/offset/access changes. (report_name_size_and_alignment_changes): Take the diff context. Do not report filtered-out local size/offset changes. ({var_diff, enum_diff, class_diff, type_decl_diff}::report): Adjust. * test0-report.txt: Adjust. * test01-report.txt: New reference report for the same inputs test0-v{1,0}.o, but called without the --no-harmless command line. * tests/data/test-diff-filter/test2-v0.cc: Source code for new test input. * tests/data/test-diff-filter/test2-v1.cc: Likewise. * tests/data/test-diff-filter/test2-v0.o: New test input. * tests/data/test-diff-filter/test2-v1.o: Likewise. * tests/data/test-diff-filter/test2-report.txt: Reference report for new test input. * tests/test-diff-filter.cc: Consume the test inputs above. * tests/Makefile.am: Add the new test inputs above to the distribution. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
847c9e8166 |
Fix thinko class_diff traversing.
* src/abg-comparison.cc (class_diff::traverse): Fix thinking in introduced by commit "6709478 Fix infinite loop when traversing classes and their members" * tests/data/test-diff-filter/test1-v{0,1}.o: New test binary input files. * tests/data/test-diff-filter/test1-v{0,1}.cc: Source code for the above. * tests/data/test-diff-filter/test1-report.txt: Reference report for the diffing of the two binary input files above. * tests/test-diff-filter.cc: Make the test run on the new input above. * tests/Makefile.am: Add the new material to the distribution. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
67e6971005 |
Take filtering in account in diff stats & better categorizing
* include/abg-comparison.h (diff_category::ACCESS_CHANGE_CATEGORY): Renamed ACCESS_CHANGED_CATEGORY into this. (diff_category::SIZE_OR_OFFSET_CHANGE_CATEGORY): Renamed SIZE_CHANGED_CATEGORY into this. Changed its semantics to incorporate offset changes as well. * src/abg-comparison.cc (struct noop_deleter): Move this up. (represent): Do not report filtered out data members. (report_mem_header): Add a new num_filtered parameter to take filtered-out members in account in members report headers. Adjust. (class_diff::priv::{count_filtered_bases, count_filtered_data_members, count_filtered_member_functions}): New member functions. When a member is filtered, do not report it all. ({enum_diff, class_diff}::report): Adjust. Take filtered members into account in headers. (corpus_diff::priv::apply_filters_and_compute_diff_stats): New member function. (corpus_diff::priv::emit_diff_stats): Renamed emit_corpus_diff_stats into this. Change it to take the stats in parameter. (corpus_diff::report): Adjust to re-use the above. Filter varibles as well. Take the filtered functions & variables in account in the stats. Do not report filtered-out functions & variables at all. * src/abg-comp-filter.cc (type_size_changed, access_changed) (data_member_offset_changed): New predicates. ({harmless, harmful}_filter::visit): Adjust to use the new predicates above. Update the harmful variant for the new SIZE_OR_OFFSET_CHANGE_CATEGORY category. * tools/bidiff.cc (set_diff_context_from_opts): Adjust for the categories name changes. * tests/data/test-diff-filter/test0-report.txt: New test input. * tests/data/test-diff-filter/test0-v0.cc: Likewise. * tests/data/test-diff-filter/test0-v0.o: Likewise. * tests/data/test-diff-filter/test0-v1.cc: Likewise. * tests/data/test-diff-filter/test0-v1.o: Likewise. * tests/test-diff-filter.cc: New test harness. * tests/Makefile.am: Add the new test files above to the distribution. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |