[2/5] abg-leaf-reporter.cc: Fix indentation of function parameter diffs.

Message ID 20200312063036.29419-3-gprocida@google.com
State Committed
Headers
Series More whitespace and leaf-changes-only fixes |

Commit Message

Giuliano Procida March 12, 2020, 6:30 a.m. UTC
  When reporting the details of changes to function parameter
differences in leaf-changes-only mode, the details are output at the
same level of indentation as the introductory text. In default mode
the usual 2-space indentation is used.

This patch fixes this discrepancy, making the output more readable.

	* src/abg-leaf-reporter.cc (report): In the fn_parm_diff
	override, indent the lines of detail by 2 spaces.
	* tests/data/test-abidiff-exit/test-leaf3-report.txt: Update
	report with correct indentation.

Signed-off-by: Giuliano Procida <gprocida@google.com>
---
 src/abg-leaf-reporter.cc                         |  2 +-
 .../data/test-abidiff-exit/test-leaf3-report.txt | 16 ++++++++--------
 2 files changed, 9 insertions(+), 9 deletions(-)
  

Comments

Dodji Seketeli March 13, 2020, 5:37 p.m. UTC | #1
Hello Giuliano,

Giuliano Procida <gprocida@google.com> a ?crit:

> When reporting the details of changes to function parameter
> differences in leaf-changes-only mode, the details are output at the
> same level of indentation as the introductory text. In default mode
> the usual 2-space indentation is used.
>
> This patch fixes this discrepancy, making the output more readable.
>
> 	* src/abg-leaf-reporter.cc (report): In the fn_parm_diff
> 	override, indent the lines of detail by 2 spaces.
> 	* tests/data/test-abidiff-exit/test-leaf3-report.txt: Update
> 	report with correct indentation.

This looks good to me and has been applied to master.

Cheers,
  

Patch

diff --git a/src/abg-leaf-reporter.cc b/src/abg-leaf-reporter.cc
index 878e4125..bbd51dcb 100644
--- a/src/abg-leaf-reporter.cc
+++ b/src/abg-leaf-reporter.cc
@@ -250,7 +250,7 @@  leaf_reporter::report(const fn_parm_diff& d,
   out << " of type '"
       << f->get_type_pretty_representation()
       << "' changed:\n";
-  d.type_diff()->report(out, indent);
+  d.type_diff()->report(out, indent + "  ");
 }
 
 /// Report the changes carried by a @ref function_type_diff node.
diff --git a/tests/data/test-abidiff-exit/test-leaf3-report.txt b/tests/data/test-abidiff-exit/test-leaf3-report.txt
index d02c71a7..138c4b5a 100644
--- a/tests/data/test-abidiff-exit/test-leaf3-report.txt
+++ b/tests/data/test-abidiff-exit/test-leaf3-report.txt
@@ -7,23 +7,23 @@  Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable
 
   [C] 'function void fn1(sto1)' at test-leaf3-v1.c:10:1 has some sub-type changes:
     parameter 1 of type 'struct sto1' changed:
-    type name changed from 'sto1' to 'stn1'
-    type size hasn't changed
+      type name changed from 'sto1' to 'stn1'
+      type size hasn't changed
 
 
   [C] 'function void fn2(sto2)' at test-leaf3-v1.c:13:1 has some sub-type changes:
     parameter 1 of type 'struct sto2' changed:
-    type name changed from 'sto2' to 'stn2'
-    type size changed from 64 to 128 (in bits)
-    1 data member insertion:
-      'double stn2::y', at offset 64 (in bits) at test-leaf3-v1.c:7:1
+      type name changed from 'sto2' to 'stn2'
+      type size changed from 64 to 128 (in bits)
+      1 data member insertion:
+        'double stn2::y', at offset 64 (in bits) at test-leaf3-v1.c:7:1
 
   [C] 'function void fn3(sto1*)' at test-leaf3-v1.c:16:1 has some sub-type changes:
     parameter 1 of type 'sto1*' changed:
-    pointer type changed from: 'sto1*' to: 'stn1*'
+      pointer type changed from: 'sto1*' to: 'stn1*'
 
   [C] 'function void fn4(sto2*)' at test-leaf3-v1.c:19:1 has some sub-type changes:
     parameter 1 of type 'sto2*' changed:
-    pointer type changed from: 'sto2*' to: 'stn2*'
+      pointer type changed from: 'sto2*' to: 'stn2*'