f27520d A suppressed diff node implies suppressing all equivalent nodes too

Authored and Committed by Dodji Seketeli 8 years ago
    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>
    
        
file modified
+17 -0
file modified
+26 -3
file modified
+9 -0
empty file added
empty file added
file modified
+13 -3
file modified
+39 -1
file modified
+36 -24