]> sourceware.org Git - libabigail.git/commitdiff
Fix stray comma in leaf-changes-only mode.
authorGiuliano Procida <gprocida@google.com>
Wed, 5 Feb 2020 11:17:13 +0000 (11:17 +0000)
committerDodji Seketeli <dodji@redhat.com>
Wed, 19 Feb 2020 13:00:23 +0000 (14:00 +0100)
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-no-stray-comma-*: New test
        cases.
        * tests/data/test-diff-suppr/test46-PR25128-report-?.txt:
        Replace unindented comma with indented "and".
* tests/test-abidiff-exit.cc: Add no-stray-comma test case.

Signed-off-by: Giuliano Procida <gprocida@google.com>
Reviewed-by: Matthias Maennich <maennich@google.com>
src/abg-reporter-priv.cc
tests/data/Makefile.am
tests/data/test-abidiff-exit/test-no-stray-comma-report.txt [new file with mode: 0644]
tests/data/test-abidiff-exit/test-no-stray-comma-v0.o [new file with mode: 0644]
tests/data/test-abidiff-exit/test-no-stray-comma-v1.o [new file with mode: 0644]
tests/data/test-diff-suppr/test46-PR25128-report-1.txt
tests/data/test-diff-suppr/test46-PR25128-report-2.txt
tests/test-abidiff-exit.cc

index f9e08c9115bfc058a9b2fe1ecfa6f4eee40e7a10..fff7b55b9f41e9664acd099be96c2bf5e6f26586 100644 (file)
@@ -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
index 1f574d2e3eee19ec6156af0068a7e9c11241c922..a38fadfd36ca7ac92524ff8e96c181bf22bd2c28 100644 (file)
@@ -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-no-stray-comma-report.txt \
+test-abidiff-exit/test-no-stray-comma-v0.o \
+test-abidiff-exit/test-no-stray-comma-v1.o \
 \
 test-diff-dwarf/test0-v0.cc            \
 test-diff-dwarf/test0-v0.o                     \
diff --git a/tests/data/test-abidiff-exit/test-no-stray-comma-report.txt b/tests/data/test-abidiff-exit/test-no-stray-comma-report.txt
new file mode 100644 (file)
index 0000000..a66500d
--- /dev/null
@@ -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-no-stray-comma-v0.o b/tests/data/test-abidiff-exit/test-no-stray-comma-v0.o
new file mode 100644 (file)
index 0000000..1d40e89
Binary files /dev/null and b/tests/data/test-abidiff-exit/test-no-stray-comma-v0.o differ
diff --git a/tests/data/test-abidiff-exit/test-no-stray-comma-v1.o b/tests/data/test-abidiff-exit/test-no-stray-comma-v1.o
new file mode 100644 (file)
index 0000000..a2550b4
Binary files /dev/null and b/tests/data/test-abidiff-exit/test-no-stray-comma-v1.o differ
index b08460d4799bc503bd501d366c4efbb6922cda08..9a97403269aee8f2b5eeb9e25041ac59d0a7ee09 100644 (file)
@@ -13,6 +13,6 @@ Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable
    type 'unsigned long int' of 'root_domain::max_cpu_capacity' changed:
      entity changed from 'unsigned long int' to 'struct max_cpu_capacity' at sched.h:722:1
      type size changed from 64 to 192 (in bits)
-, size changed from 64 to 192 (in bits) (by +128 bits)
+   and size changed from 64 to 192 (in bits) (by +128 bits)
    'perf_domain* root_domain::pd' offset changed from 14528 to 14656 (in bits) (by +128 bits)
 
index 558530e1e7f931ed5ff2356774ebc508ce1f7f36..d6873cb05fb0cd4b67291039872f9e185c7e3120 100644 (file)
@@ -9,6 +9,6 @@ Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable
    type 'unsigned long int' of 'root_domain::max_cpu_capacity' changed:
      entity changed from 'unsigned long int' to 'struct max_cpu_capacity' at sched.h:722:1
      type size changed from 64 to 192 (in bits)
-, size changed from 64 to 192 (in bits) (by +128 bits)
+   and size changed from 64 to 192 (in bits) (by +128 bits)
    'perf_domain* root_domain::pd' offset changed from 14528 to 14656 (in bits) (by +128 bits)
 
index 4cef727e692d1ede21e514a7eb0ab800ade47ac6..88875b34303162179c4f4c06a6c8c379950338cb 100644 (file)
@@ -111,6 +111,15 @@ InOutSpec in_out_specs[] =
     "data/test-abidiff-exit/test-loc-without-locs-report.txt",
     "output/test-abidiff-exit/test-loc-without-locs-report.txt"
   },
+  {
+    "data/test-abidiff-exit/test-no-stray-comma-v0.o",
+    "data/test-abidiff-exit/test-no-stray-comma-v1.o",
+    "",
+    "--leaf-changes-only",
+    abigail::tools_utils::ABIDIFF_ABI_CHANGE,
+    "data/test-abidiff-exit/test-no-stray-comma-report.txt",
+    "output/test-abidiff-exit/test-no-stray-comma-report.txt"
+  },
   {0, 0, 0 ,0,  abigail::tools_utils::ABIDIFF_OK, 0, 0}
 };
 
This page took 0.041711 seconds and 5 git commands to generate.