[1/6] show-parse: strip do_show_type()'s trailing space
diff mbox series

Message ID 20181216172151.1361-2-luc.vanoostenryck@gmail.com
State Mainlined, archived
Headers show
Series
  • small improvements of show_typename()
Related show

Commit Message

Luc Van Oostenryck Dec. 16, 2018, 5:21 p.m. UTC
It's possible that the result of do_show_type() ends with a space.

Strip this unneeded space.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 show-parse.c               | 4 ++++
 validation/enum-mismatch.c | 4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)

Patch
diff mbox series

diff --git a/show-parse.c b/show-parse.c
index b892c189b..5590dae9b 100644
--- a/show-parse.c
+++ b/show-parse.c
@@ -408,6 +408,10 @@  out:
 		prepend(name, "restricted ");
 	if (fouled)
 		prepend(name, "fouled ");
+
+	// strip trailing space
+	if (name->end > name->start && name->end[-1] == ' ')
+		name->end--;
 }
 
 void show_type(struct symbol *sym)
diff --git a/validation/enum-mismatch.c b/validation/enum-mismatch.c
index f698c0161..1bdb1d6c2 100644
--- a/validation/enum-mismatch.c
+++ b/validation/enum-mismatch.c
@@ -13,7 +13,7 @@  static enum eb foo(enum ea a)
  *
  * check-error-start
 enum-mismatch.c:7:16: warning: mixing different enum types
-enum-mismatch.c:7:16:     unsigned int enum ea  versus
-enum-mismatch.c:7:16:     unsigned int enum eb 
+enum-mismatch.c:7:16:     unsigned int enum ea versus
+enum-mismatch.c:7:16:     unsigned int enum eb
  * check-error-end
  */