summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-12-16 10:04:00 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-12-16 17:58:15 +0100
commitdf93af7da3cb6e4598c7fc471d7d2392cc8474de (patch)
tree591425c84ba93ead5ffe2eebb097748a8bdb8016
parent55324619d9fd35355629870b8d441eeb074e6739 (diff)
downloadsparse-df93af7da3cb6e4598c7fc471d7d2392cc8474de.tar.gz
show-parse: strip do_show_type()'s trailing space
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>
-rw-r--r--show-parse.c4
-rw-r--r--validation/enum-mismatch.c4
2 files changed, 6 insertions, 2 deletions
diff --git a/show-parse.c b/show-parse.c
index b892c189..5590dae9 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 f698c016..1bdb1d6c 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
*/