From 405c0ea679dfd7bb93deda4396cc5a8a3b7a9db6 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Thu, 10 Nov 2016 12:52:12 +0000 Subject: merge rev. 1.153: warn about trailing whitespace at the end of comments --- read.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'read.c') diff --git a/read.c b/read.c index 60ef105f..678e6f9b 100644 --- a/read.c +++ b/read.c @@ -1,4 +1,4 @@ -/* $Id: read.c,v 1.150.2.1 2016/10/18 22:44:29 schwarze Exp $ */ +/* $Id: read.c,v 1.150.2.2 2016/11/10 12:52:12 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2010-2016 Ingo Schwarze @@ -425,11 +425,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-56-ge451