From patchwork Sun Mar 29 17:01:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Giuliano Procida X-Patchwork-Id: 39072 From: gprocida@google.com (Giuliano Procida) Date: Sun, 29 Mar 2020 18:01:19 +0100 Subject: [PATCH 1/3] abidiff: Remove blank line after typedef changes. Message-ID: <20200329170121.188147-1-gprocida@google.com> This patch removes perhaps the last remaining cause of double blank lines in output. The state variable emit_nl was being set to true just after emitting a new line which resulted in a blank line after every local typedef change report. * include/abg-reporter.h (default_reporter::report_local_typedef_changes): Change return type to void. * src/abg-default-reporter.cc: (default_reporter::report_local_typedef_changes): Change return type to void, remove emit_nl state variable and logic. * tests/data/test-abidiff/test-PR18791-report0.txt: Remove blank lines. * tests/data/test-diff-dwarf/test42-PR21296-clanggcc-report0.txt: Ditto. * tests/data/test-diff-suppr/test39-opaque-type-report-0.txt: Ditto. Signed-off-by: Giuliano Procida Reviewed-by: Matthias Maennich --- include/abg-reporter.h | 2 +- src/abg-default-reporter.cc | 18 +++--------------- .../data/test-abidiff/test-PR18791-report0.txt | 1 - .../test42-PR21296-clanggcc-report0.txt | 3 --- .../test39-opaque-type-report-0.txt | 1 - 5 files changed, 4 insertions(+), 21 deletions(-) diff --git a/include/abg-reporter.h b/include/abg-reporter.h index b1ae88d1..6254be6a 100644 --- a/include/abg-reporter.h +++ b/include/abg-reporter.h @@ -170,7 +170,7 @@ public: report(const enum_diff& d, ostream& out, const string& indent = "") const; - bool + void report_local_typedef_changes(const typedef_diff &d, ostream& out, const string& indent) const; diff --git a/src/abg-default-reporter.cc b/src/abg-default-reporter.cc index d2ac4a58..ff7ed67e 100644 --- a/src/abg-default-reporter.cc +++ b/src/abg-default-reporter.cc @@ -183,18 +183,14 @@ default_reporter::report(const enum_diff& d, ostream& out, /// @param out the output stream to report to. /// /// @param indent the white space string to use for indentation. -/// -/// @return true iff the caller needs to emit a newline to the output -/// stream before emitting anything else. -bool +void default_reporter::report_local_typedef_changes(const typedef_diff &d, ostream& out, const string& indent) const { if (!d.to_be_reported()) - return false; + return; - bool emit_nl = false; typedef_decl_sptr f = d.first_typedef_decl(), s = d.second_typedef_decl(); maybe_report_diff_for_member(f, s, d.context(), out, indent); @@ -211,10 +207,7 @@ default_reporter::report_local_typedef_changes(const typedef_diff &d, << s->get_qualified_name(); report_loc_info(s, *d.context(), out); out << "\n"; - emit_nl = true; } - - return emit_nl; } /// Reports the difference between the two subjects of the diff in a @@ -235,7 +228,7 @@ default_reporter::report(const typedef_diff& d, typedef_decl_sptr f = d.first_typedef_decl(), s = d.second_typedef_decl(); - bool emit_nl = report_local_typedef_changes(d, out, indent); + report_local_typedef_changes(d, out, indent); diff_sptr dif = d.underlying_type_diff(); if (dif && dif->has_changes()) @@ -250,7 +243,6 @@ default_reporter::report(const typedef_diff& d, report_loc_info(dif->first_subject(), *d.context(), out); out << " changed:\n"; dif->report(out, indent + " "); - emit_nl = false; } else { @@ -274,14 +266,10 @@ default_reporter::report(const typedef_diff& d, dif->report(out, indent + " "); if (c & REDUNDANT_CATEGORY) dif->set_category(c | REDUNDANT_CATEGORY); - emit_nl = false; } } } - if (emit_nl) - out << "\n"; - d.reported_once(true); } diff --git a/tests/data/test-abidiff/test-PR18791-report0.txt b/tests/data/test-abidiff/test-PR18791-report0.txt index 87322587..93faf599 100644 --- a/tests/data/test-abidiff/test-PR18791-report0.txt +++ b/tests/data/test-abidiff/test-PR18791-report0.txt @@ -74,7 +74,6 @@ Variables changes summary: 0 Removed, 0 Changed, 0 Added variable return type changed: underlying type 'typedef std::list >::iterator' changed: typedef name changed from std::list >::iterator to std::__cxx11::list >::iterator - parameter 1 of type 'const sigc::slot_base&' has sub-type changes: in referenced type 'const sigc::slot_base': unqualified underlying type 'class sigc::slot_base' changed, as reported earlier diff --git a/tests/data/test-diff-dwarf/test42-PR21296-clanggcc-report0.txt b/tests/data/test-diff-dwarf/test42-PR21296-clanggcc-report0.txt index ff9e2841..087cfd4e 100644 --- a/tests/data/test-diff-dwarf/test42-PR21296-clanggcc-report0.txt +++ b/tests/data/test-diff-dwarf/test42-PR21296-clanggcc-report0.txt @@ -43,7 +43,6 @@ Variables changes summary: 0 Removed, 0 Changed, 0 Added variable 'function std::__add_c_ref::type std::__get_helper<0ul, STR&&>(const std::_Tuple_impl<0ul, STR&&>&) {_ZSt12__get_helperILm0EO3STRJEENSt11__add_c_refIT0_E4typeERKSt11_Tuple_implIXT_EJS3_DpT1_EE}' now becomes 'function std::__add_c_ref::type std::__get_helper<0, STR &&>(const std::_Tuple_impl<0, STR &&>&) {_ZSt12__get_helperILm0EO3STRJEENSt11__add_c_refIT0_E4typeERKSt11_Tuple_implIXT_EJS3_DpT1_EE}' return type changed: typedef name changed from std::__add_c_ref::type to std::__add_c_ref::type - parameter 1 of type 'const std::_Tuple_impl<0ul, STR&&>&' changed: in referenced type 'const std::_Tuple_impl<0ul, STR&&>': 'const std::_Tuple_impl<0ul, STR&&>' changed to 'const std::_Tuple_impl<0, STR &&>' @@ -52,7 +51,6 @@ Variables changes summary: 0 Removed, 0 Changed, 0 Added variable 'function std::__add_c_ref::type std::get<0ul, STR&&>(const std::tuple&) {_ZSt3getILm0EJO3STREENSt11__add_c_refINSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeEE4typeERKS7_}' now becomes 'function std::__add_c_ref::type std::get<0, STR &&>(const std::tuple&) {_ZSt3getILm0EJO3STREENSt11__add_c_refINSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeEE4typeERKS7_}' return type changed: typedef name changed from std::__add_c_ref::type to std::__add_c_ref::type - parameter 1 of type 'const std::tuple&' changed: in referenced type 'const std::tuple': 'const std::tuple' changed to 'const std::tuple' @@ -63,7 +61,6 @@ Variables changes summary: 0 Removed, 0 Changed, 0 Added variable in referenced type 'typedef std::remove_reference::type': typedef name changed from std::remove_reference::type to std::remove_reference::type - [C] 'method void std::tuple::tuple(STR&&)' has some indirect sub-type changes: Please note that the symbol of this function is _ZNSt5tupleIJO3STREEC2IJS0_ESt9true_typeEEDpOT_ and it aliases symbol: _ZNSt5tupleIJO3STREEC1IJS0_ESt9true_typeEEDpOT_ diff --git a/tests/data/test-diff-suppr/test39-opaque-type-report-0.txt b/tests/data/test-diff-suppr/test39-opaque-type-report-0.txt index 7993fc08..b87ba2ae 100644 --- a/tests/data/test-diff-suppr/test39-opaque-type-report-0.txt +++ b/tests/data/test-diff-suppr/test39-opaque-type-report-0.txt @@ -8,4 +8,3 @@ Variables changes summary: 0 Removed, 0 Changed, 0 Added variable in pointed to type 'typedef StructType' at test39-header-v1.h:2:1: typedef name changed from StructType to AnotherStructType at test39-header-v1.h:2:1 - From patchwork Sun Mar 29 17:01:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Giuliano Procida X-Patchwork-Id: 39073 From: gprocida@google.com (Giuliano Procida) Date: Sun, 29 Mar 2020 18:01:20 +0100 Subject: [PATCH 2/3] test-diff-suppr.cc: Add missing tests. In-Reply-To: <20200329170121.188147-1-gprocida@google.com> References: <20200329170121.188147-1-gprocida@google.com> Message-ID: <20200329170121.188147-2-gprocida@google.com> Commit 79383f937ca5cd8b3b0cd9e8a5c28871172e7bf1 added many tests but didn't actually execute three of them. Commit fe9fa7a05f88cf73b3f53c188a7682467901d12d added many tests but didn't actually execute one of them. This patch corrects these issues. * tests/test-diff-suppr.cc: Add stanzas for test6-fn-suppr-report-4, test16-suppr-removed-fn-report-5 and test22-suppr-removed-var-sym-report-5 and test23-alias-filter-report-4 tests. * tests/data/test-diff-suppr/test6-fn-suppr-report-4.txt: Number parameters from 1 and update expected output to current formatting. * tests/data/test-diff-suppr/test16-suppr-removed-fn-report-5.txt: Update expected output to current formatting. * tests/data/test-diff-suppr/test22-suppr-removed-var-sym-report-5.txt: Update expected output to current formatting. Signed-off-by: Giuliano Procida Reviewed-by: Matthias Maennich --- .../test16-suppr-removed-fn-report-5.txt | 4 +- .../test22-suppr-removed-var-sym-report-5.txt | 1 - .../test6-fn-suppr-report-4.txt | 13 +++--- tests/test-diff-suppr.cc | 40 +++++++++++++++++++ 4 files changed, 47 insertions(+), 11 deletions(-) diff --git a/tests/data/test-diff-suppr/test16-suppr-removed-fn-report-5.txt b/tests/data/test-diff-suppr/test16-suppr-removed-fn-report-5.txt index e12412dc..b28fbd16 100644 --- a/tests/data/test-diff-suppr/test16-suppr-removed-fn-report-5.txt +++ b/tests/data/test-diff-suppr/test16-suppr-removed-fn-report-5.txt @@ -10,9 +10,7 @@ Variables changes summary: 0 Removed, 0 Changed, 0 Added variable [C] 'function void bar(S*)' has some indirect sub-type changes: parameter 1 of type 'S*' has sub-type changes: in pointed to type 'struct S': - type size changed from 32 to 64 bits + type size changed from 32 to 64 (in bits) 1 data member insertion: 'unsigned int S::bar', at offset 32 (in bits) - - diff --git a/tests/data/test-diff-suppr/test22-suppr-removed-var-sym-report-5.txt b/tests/data/test-diff-suppr/test22-suppr-removed-var-sym-report-5.txt index 174f1b93..5549648d 100644 --- a/tests/data/test-diff-suppr/test22-suppr-removed-var-sym-report-5.txt +++ b/tests/data/test-diff-suppr/test22-suppr-removed-var-sym-report-5.txt @@ -3,7 +3,6 @@ Variables changes summary: 0 Removed, 0 Changed, 0 Added variable Function symbols changes summary: 0 Removed, 0 Added function symbol not referenced by debug info Variable symbols changes summary: 0 Removed (2 filtered out), 1 Added variable symbols not referenced by debug info - 1 Added variable symbol not referenced by debug info: [A] global_var3 diff --git a/tests/data/test-diff-suppr/test6-fn-suppr-report-4.txt b/tests/data/test-diff-suppr/test6-fn-suppr-report-4.txt index 5633bed5..094b4903 100644 --- a/tests/data/test-diff-suppr/test6-fn-suppr-report-4.txt +++ b/tests/data/test-diff-suppr/test6-fn-suppr-report-4.txt @@ -4,21 +4,20 @@ Variables changes summary: 0 Removed, 0 Changed, 0 Added variable 2 functions with some indirect sub-type change: [C] 'function void bar(S1*)' has some indirect sub-type changes: - parameter 0 of type 'S1*' has sub-type changes: + parameter 1 of type 'S1*' has sub-type changes: in pointed to type 'struct S1': - size changed from 32 to 64 bits + type size changed from 32 to 64 (in bits) 1 base class insertion: struct base 1 data member change: - 'int S1::m0' offset changed from 0 to 32 + 'int S1::m0' offset changed from 0 to 32 (in bits) (by +32 bits) [C] 'function int bar(S&)' has some indirect sub-type changes: - parameter 0 of type 'S&' has sub-type changes: + parameter 1 of type 'S&' has sub-type changes: in referenced type 'struct S': - size changed from 32 to 64 bits + type size changed from 32 to 64 (in bits) 1 base class insertion: struct base 1 data member change: - 'int S::m0' offset changed from 0 to 32 - + 'int S::m0' offset changed from 0 to 32 (in bits) (by +32 bits) diff --git a/tests/test-diff-suppr.cc b/tests/test-diff-suppr.cc index 6b6a748c..abc1b3d7 100644 --- a/tests/test-diff-suppr.cc +++ b/tests/test-diff-suppr.cc @@ -348,6 +348,16 @@ InOutSpec in_out_specs[] = "data/test-diff-suppr/test6-fn-suppr-report-3.txt", "output/test-diff-suppr/test6-fn-suppr-report-3.txt", }, + { + "data/test-diff-suppr/libtest6-fn-suppr-v0.so", + "data/test-diff-suppr/libtest6-fn-suppr-v1.so", + "", + "", + "data/test-diff-suppr/test6-fn-suppr-3.suppr", + "--no-default-suppression --no-show-locs --no-redundant", + "data/test-diff-suppr/test6-fn-suppr-report-4.txt", + "output/test-diff-suppr/test6-fn-suppr-report-4.txt", + }, { "data/test-diff-suppr/libtest7-var-suppr-v0.so", "data/test-diff-suppr/libtest7-var-suppr-v1.so", @@ -738,6 +748,16 @@ InOutSpec in_out_specs[] = "data/test-diff-suppr/test16-suppr-removed-fn-report-4.txt", "output/test-diff-suppr/test16-suppr-removed-fn-report-4.txt" }, + { + "data/test-diff-suppr/test16-suppr-removed-fn-v0.o", + "data/test-diff-suppr/test16-suppr-removed-fn-v1.o", + "", + "", + "data/test-diff-suppr/test16-suppr-removed-fn-4.suppr", + "--no-default-suppression --no-show-locs --no-redundant", + "data/test-diff-suppr/test16-suppr-removed-fn-report-5.txt", + "output/test-diff-suppr/test16-suppr-removed-fn-report-5.txt" + }, { "data/test-diff-suppr/test17-suppr-added-var-v0.o", "data/test-diff-suppr/test17-suppr-added-var-v1.o", @@ -1088,6 +1108,16 @@ InOutSpec in_out_specs[] = "data/test-diff-suppr/test22-suppr-removed-var-sym-report-4.txt", "output/test-diff-suppr/test22-suppr-removed-var-sym-report-4.txt" }, + { + "data/test-diff-suppr/test22-suppr-removed-var-sym-v0.o", + "data/test-diff-suppr/test22-suppr-removed-var-sym-v1.o", + "", + "", + "data/test-diff-suppr/test22-suppr-removed-var-sym-4.suppr", + "--no-default-suppression --no-show-locs --no-redundant", + "data/test-diff-suppr/test22-suppr-removed-var-sym-report-5.txt", + "output/test-diff-suppr/test22-suppr-removed-var-sym-report-5.txt" + }, { "data/test-diff-suppr/libtest23-alias-filter-v0.so", "data/test-diff-suppr/libtest23-alias-filter-v1.so ", @@ -1128,6 +1158,16 @@ InOutSpec in_out_specs[] = "data/test-diff-suppr/test23-alias-filter-report-3.txt", "output/test-diff-suppr/test23-alias-filter-report-3.txt" }, + { + "data/test-diff-suppr/libtest23-alias-filter-v0.so", + "data/test-diff-suppr/libtest23-alias-filter-v1.so ", + "", + "", + "data/test-diff-suppr/test23-alias-filter-3.suppr", + "--no-default-suppression --no-show-locs --no-redundant", + "data/test-diff-suppr/test23-alias-filter-report-4.txt", + "output/test-diff-suppr/test23-alias-filter-report-4.txt" + }, { "data/test-diff-suppr/libtest23-alias-filter-v0.so", "data/test-diff-suppr/libtest23-alias-filter-v1.so ", From patchwork Sun Mar 29 17:01:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Giuliano Procida X-Patchwork-Id: 39074 From: gprocida@google.com (Giuliano Procida) Date: Sun, 29 Mar 2020 18:01:21 +0100 Subject: [PATCH 3/3] abidiffpkg: Remove stray test report file. In-Reply-To: <20200329170121.188147-1-gprocida@google.com> References: <20200329170121.188147-1-gprocida@google.com> Message-ID: <20200329170121.188147-3-gprocida@google.com> The file tests/data/test-diff-pkg/dirpkg-2-report-1.txt looks like it was committed in error. It's not used, its contents don't match the implied directories being compared and there are other tests that cover the same functionality, with or without --no-abignore, anyway. * tests/data/Makefile.am: Removed tests/data/test-diff-pkg/dirpkg-2-report-1.txt. * tests/data/test-diff-pkg/dirpkg-2-report-1.txt: Removed. Signed-off-by: Giuliano Procida Reviewed-by: Matthias Maennich --- tests/data/Makefile.am | 1 - tests/data/test-diff-pkg/dirpkg-2-report-1.txt | 16 ---------------- 2 files changed, 17 deletions(-) delete mode 100644 tests/data/test-diff-pkg/dirpkg-2-report-1.txt diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am index 277f5721..bb0fd83b 100644 --- a/tests/data/Makefile.am +++ b/tests/data/Makefile.am @@ -1479,7 +1479,6 @@ test-diff-pkg/dirpkg-2-dir2/dir.abignore \ test-diff-pkg/dirpkg-2-dir2/libobj-v0.so \ test-diff-pkg/dirpkg-2-dir2/obj-v0.cc \ test-diff-pkg/dirpkg-2-report-0.txt \ -test-diff-pkg/dirpkg-2-report-1.txt \ test-diff-pkg/dirpkg-3-dir1/libobj-v0.so \ test-diff-pkg/dirpkg-3-dir1/obj-v0.cc \ test-diff-pkg/dirpkg-3-dir2/.abignore \ diff --git a/tests/data/test-diff-pkg/dirpkg-2-report-1.txt b/tests/data/test-diff-pkg/dirpkg-2-report-1.txt deleted file mode 100644 index c7c34702..00000000 --- a/tests/data/test-diff-pkg/dirpkg-2-report-1.txt +++ /dev/null @@ -1,16 +0,0 @@ -================ changes of 'libobj-v0.so'=============== - 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 void bar(S&)' has some indirect sub-type changes: - parameter 1 of type 'S&' has sub-type changes: - in referenced type 'struct S': - type size changed from 32 to 64 bits - 1 data member insertion: - 'char S::mem1', at offset 32 (in bits) - - -================ end of changes of 'libobj-v0.so'=============== -