From: Dodji Seketeli Date: Wed, 4 Sep 2019 09:10:31 +0000 (+0200) Subject: Better propagation of suppressed-ness to function types X-Git-Tag: upstream/1.7~51 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bdd927f66395e9a4a9c3febf86304a1fa71cf198;p=platform%2Fupstream%2Flibabigail.git 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 --- diff --git a/src/abg-comparison.cc b/src/abg-comparison.cc index 55033b09..18ebd109 100644 --- a/src/abg-comparison.cc +++ b/src/abg-comparison.cc @@ -10798,6 +10798,12 @@ struct suppression_categorization_visitor : public diff_node_visitor || is_pointer_diff(d) || is_reference_diff(d) || (is_qualified_type_diff(d) + && (!(d->has_local_changes() & LOCAL_NON_TYPE_CHANGE_KIND))) + || (is_function_decl_diff(d) + && (!(d->has_local_changes() & LOCAL_NON_TYPE_CHANGE_KIND))) + || (is_fn_parm_diff(d) + && (!(d->has_local_changes() & LOCAL_NON_TYPE_CHANGE_KIND))) + || (is_function_type_diff(d) && (!(d->has_local_changes() & LOCAL_NON_TYPE_CHANGE_KIND))))) { // Note that we handle private diff nodes differently from @@ -10884,6 +10890,27 @@ struct suppression_categorization_visitor : public diff_node_visitor canonical_diff->add_to_category (SUPPRESSED_CATEGORY|PRIVATE_TYPE_CATEGORY); } + + if (const function_decl_diff *fn_diff = is_function_decl_diff(d)) + if (!(d->has_local_changes() & LOCAL_NON_TYPE_CHANGE_KIND)) + { + // d is a function diff that carries a local *type* + // change (that means it's a change to the function + // type). Let's see if the child function type diff + // node is suppressed. That would mean that we are + // instructed to show details of a diff that is deemed + // suppressed; this means the suppression conflicts with + // a local type change. In that case, let's follow what + // the user asked and suppress the function altogether, + if (function_type_diff_sptr fn_type_diff = fn_diff->type_diff()) + if (fn_type_diff->is_suppressed()) + d->add_to_category(SUPPRESSED_CATEGORY); + // If a node was suppressed, all the other nodes of its class + // of equivalence are suppressed too. + diff *canonical_diff = d->get_canonical_diff(); + if (canonical_diff != d) + canonical_diff->add_to_category(SUPPRESSED_CATEGORY); + } } } }; //end struct suppression_categorization_visitor diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am index 5b52186b..57551db5 100644 --- a/tests/data/Makefile.am +++ b/tests/data/Makefile.am @@ -1205,6 +1205,12 @@ test-diff-suppr/test41-enumerator-changes-0.suppr \ test-diff-suppr/test41-enumerator-changes-report-0.txt \ test-diff-suppr/test41-enumerator-changes-v0.cc \ test-diff-suppr/test41-enumerator-changes-v1.cc \ +test-diff-suppr/test43-suppr-direct-fn-subtype-suppr-1.txt \ +test-diff-suppr/test43-suppr-direct-fn-subtype-v0.cc \ +test-diff-suppr/test43-suppr-direct-fn-subtype-v0.o \ +test-diff-suppr/test43-suppr-direct-fn-subtype-v1.cc \ +test-diff-suppr/test43-suppr-direct-fn-subtype-v1.o \ +test-diff-suppr/test43-suppr-direct-fn-subtype-report-1.txt \ \ test-diff-dwarf-abixml/test0-pr19026-libvtkIOSQL-6.1.so.1 \ test-diff-dwarf-abixml/test0-pr19026-libvtkIOSQL-6.1.so.1.abi \ diff --git a/tests/data/test-diff-suppr/test43-suppr-direct-fn-subtype-report-1.txt b/tests/data/test-diff-suppr/test43-suppr-direct-fn-subtype-report-1.txt new file mode 100644 index 00000000..9666a8fd --- /dev/null +++ b/tests/data/test-diff-suppr/test43-suppr-direct-fn-subtype-report-1.txt @@ -0,0 +1,3 @@ +Functions changes summary: 0 Removed, 0 Changed (1 filtered out), 0 Added function +Variables changes summary: 0 Removed, 0 Changed, 0 Added variable + diff --git a/tests/data/test-diff-suppr/test43-suppr-direct-fn-subtype-suppr-1.txt b/tests/data/test-diff-suppr/test43-suppr-direct-fn-subtype-suppr-1.txt new file mode 100644 index 00000000..051f30af --- /dev/null +++ b/tests/data/test-diff-suppr/test43-suppr-direct-fn-subtype-suppr-1.txt @@ -0,0 +1,2 @@ +[suppress_type] + name = type diff --git a/tests/data/test-diff-suppr/test43-suppr-direct-fn-subtype-v0.cc b/tests/data/test-diff-suppr/test43-suppr-direct-fn-subtype-v0.cc new file mode 100644 index 00000000..b1a30132 --- /dev/null +++ b/tests/data/test-diff-suppr/test43-suppr-direct-fn-subtype-v0.cc @@ -0,0 +1,9 @@ +struct type +{ + int m0; +}; + +void +func0(struct type) +{ +} diff --git a/tests/data/test-diff-suppr/test43-suppr-direct-fn-subtype-v0.o b/tests/data/test-diff-suppr/test43-suppr-direct-fn-subtype-v0.o new file mode 100644 index 00000000..fe0ee04d Binary files /dev/null and b/tests/data/test-diff-suppr/test43-suppr-direct-fn-subtype-v0.o differ diff --git a/tests/data/test-diff-suppr/test43-suppr-direct-fn-subtype-v1.cc b/tests/data/test-diff-suppr/test43-suppr-direct-fn-subtype-v1.cc new file mode 100644 index 00000000..07e89423 --- /dev/null +++ b/tests/data/test-diff-suppr/test43-suppr-direct-fn-subtype-v1.cc @@ -0,0 +1,10 @@ +struct type +{ + int m0; + char m1; +}; + +void +func0(struct type) +{ +} diff --git a/tests/data/test-diff-suppr/test43-suppr-direct-fn-subtype-v1.o b/tests/data/test-diff-suppr/test43-suppr-direct-fn-subtype-v1.o new file mode 100644 index 00000000..13e11348 Binary files /dev/null and b/tests/data/test-diff-suppr/test43-suppr-direct-fn-subtype-v1.o differ diff --git a/tests/test-diff-suppr.cc b/tests/test-diff-suppr.cc index 8cbb8b7c..dfc82883 100644 --- a/tests/test-diff-suppr.cc +++ b/tests/test-diff-suppr.cc @@ -1748,6 +1748,16 @@ InOutSpec in_out_specs[] = "data/test-diff-suppr/test41-enumerator-changes-report-0.txt", "output/test-diff-suppr/test41-enumerator-changes-report-0.txt" }, + { + "data/test-diff-suppr/test43-suppr-direct-fn-subtype-v0.o", + "data/test-diff-suppr/test43-suppr-direct-fn-subtype-v1.o", + "", + "", + "data/test-diff-suppr/test43-suppr-direct-fn-subtype-suppr-1.txt", + "--no-default-suppression", + "data/test-diff-suppr/test43-suppr-direct-fn-subtype-report-1.txt", + "output/test-diff-suppr/test43-suppr-direct-fn-subtype-report-1.txt" + }, // This should be the last entry {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL} };