From 66286e275f33f71863b63d2ba531fa83643e4a42 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Thu, 10 Nov 2016 12:47:50 +0000 Subject: warn about trailing whitespace at the end of comments; missing feature noticed by jmc@ --- read.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'read.c') diff --git a/read.c b/read.c index 8ab1ad16..39ff2337 100644 --- a/read.c +++ b/read.c @@ -1,4 +1,4 @@ -/* $Id: read.c,v 1.152 2016/10/09 18:16:56 schwarze Exp $ */ +/* $Id: read.c,v 1.153 2016/11/10 12:47:50 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2010-2016 Ingo Schwarze @@ -423,11 +423,17 @@ mparse_buf_r(struct mparse *curp, struct buf blk, size_t i, int start) i += 2; /* Comment, skip to end of line */ for (; i < blk.sz; ++i) { - if ('\n' == blk.buf[i]) { - ++i; - ++lnn; - break; - } + if (blk.buf[i] != '\n') + continue; + if (blk.buf[i - 1] == ' ' || + blk.buf[i - 1] == '\t') + mandoc_msg( + MANDOCERR_SPACE_EOL, + curp, curp->line, + pos, NULL); + ++i; + ++lnn; + break; } /* Backout trailing whitespaces */ -- cgit v1.2.3