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>