mirror of
git://sourceware.org/git/libabigail.git
synced 2024-12-17 07:24:34 +00:00
8f994b5e29
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> |
||
---|---|---|
.. | ||
test-abicompat | ||
test-abidiff | ||
test-alt-dwarf-file | ||
test-core-diff | ||
test-diff-dwarf | ||
test-diff-filter | ||
test-diff-suppr | ||
test-lookup-syms | ||
test-read-dwarf | ||
test-read-write | ||
test-write-read-archive | ||
Makefile.am |