From patchwork Wed Jan 1 00:00:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksei Vetrov via Libabigail X-Patchwork-Id: 39006 X-Patchwork-Original-From: libabigail@sourceware.org (Giuliano Procida via libabigail) From: Aleksei Vetrov via Libabigail Date: Wed, 01 Jan 2020 00:00:00 -0000 Subject: [PATCH] Fix stray comma in leaf-changes-only mode. Message-ID: <20200204172743.154098-1-gprocida@google.com> This change replaces the "\n," sometimes seen in output (such as for the PR25128 test cases) with a correctly indented "and". * src/abg-reporter-priv.cc (represent): Don't try to follow output of indented pretty representation with a comma, just emit "and" unconditionally; remove unnecessary intermediate ostringstream. * tests/data/Makefile.am: Add new test case files. * tests/data/test-abidiff-exit/test-b146198490-*: New test cases. * tests/data/test-diff-suppr/test46-PR25128-report-?.txt: Replace unindented comma with indented "and". * tests/test-abidiff-exit.cc: Add b146198490 test case. Signed-off-by: Giuliano Procida --- src/abg-reporter-priv.cc | 17 ++++++----------- tests/data/Makefile.am | 3 +++ .../test-b146198490-report.txt | 14 ++++++++++++++ .../test-abidiff-exit/test-b146198490-v0.o | Bin 0 -> 2784 bytes .../test-abidiff-exit/test-b146198490-v1.o | Bin 0 -> 2784 bytes .../test46-PR25128-report-1.txt | 2 +- .../test46-PR25128-report-2.txt | 2 +- tests/test-abidiff-exit.cc | 9 +++++++++ 8 files changed, 34 insertions(+), 13 deletions(-) create mode 100644 tests/data/test-abidiff-exit/test-b146198490-report.txt create mode 100644 tests/data/test-abidiff-exit/test-b146198490-v0.o create mode 100644 tests/data/test-abidiff-exit/test-b146198490-v1.o diff --git a/src/abg-reporter-priv.cc b/src/abg-reporter-priv.cc index f9e08c91..fff7b55b 100644 --- a/src/abg-reporter-priv.cc +++ b/src/abg-reporter-priv.cc @@ -486,30 +486,25 @@ represent(const var_diff_sptr &diff, { if (local_only && d->has_local_changes()) { - std::ostringstream out_buffer; - out_buffer - << indent << "type '" << get_pretty_representation(o->get_type()) + out << indent << "type '" << get_pretty_representation(o->get_type()) << "' of '" << o->get_qualified_name() << "' changed"; if (d->currently_reporting()) { - out_buffer << " as being reported\n"; - begin_with_and = true; + out << " as being reported\n"; } else if (d->reported_once()) { - out_buffer << " as reported earlier\n"; - begin_with_and = true; + out << " as reported earlier\n"; } else { - out_buffer << ":\n"; - d->report(out_buffer, indent + " "); - begin_with_and = false; + out << ":\n"; + d->report(out, indent + " "); } - out << out_buffer.str(); + begin_with_and = true; emitted = true; } else diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am index 1f574d2e..d362eb8c 100644 --- a/tests/data/Makefile.am +++ b/tests/data/Makefile.am @@ -107,6 +107,9 @@ test-abidiff-exit/test-loc-v0.bi \ test-abidiff-exit/test-loc-v1.bi \ test-abidiff-exit/test-loc-with-locs-report.txt \ test-abidiff-exit/test-loc-without-locs-report.txt \ +test-abidiff-exit/test-b146198490-report.txt \ +test-abidiff-exit/test-b146198490-v0.o \ +test-abidiff-exit/test-b146198490-v1.o \ \ test-diff-dwarf/test0-v0.cc \ test-diff-dwarf/test0-v0.o \ diff --git a/tests/data/test-abidiff-exit/test-b146198490-report.txt b/tests/data/test-abidiff-exit/test-b146198490-report.txt new file mode 100644 index 00000000..a66500d5 --- /dev/null +++ b/tests/data/test-abidiff-exit/test-b146198490-report.txt @@ -0,0 +1,14 @@ +Leaf changes summary: 1 artifact changed +Changed leaf types summary: 1 leaf type changed +Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 0 Added function +Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable + +'struct foo at test-b146198490-v0.cc:1:1' changed: + type size changed from 32 to 64 (in bits) + there are data member changes: + type 'int[1]' of 'foo::bar' changed: + type name changed from 'int[1]' to 'int[2]' + array type size changed from 32 to 64 + array type subrange 1 changed length from 1 to 2 + and size changed from 32 to 64 (in bits) (by +32 bits) + diff --git a/tests/data/test-abidiff-exit/test-b146198490-v0.o b/tests/data/test-abidiff-exit/test-b146198490-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