Date: Fri, 06 Feb 2026 01:07:29 +0000 From: Colin Percival <cperciva@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Cc: Ingo Schwarze <schwarze@usta.de> Subject: git: e261ea91050c - releng/14.4 - mandoc: Improve width calculation for GCC compat Message-ID: <69853ed1.36315.512962e7@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch releng/14.4 has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=e261ea91050c6955a00d3428c3a3522971789aa1 commit e261ea91050c6955a00d3428c3a3522971789aa1 Author: Ingo Schwarze <schwarze@usta.de> AuthorDate: 2025-08-25 22:58:48 +0000 Commit: Colin Percival <cperciva@FreeBSD.org> CommitDate: 2026-02-06 01:06:59 +0000 mandoc: Improve width calculation for GCC compat Avoid implicitly converting a potentially negative page offset to size_t and then back to int. While this was not a bug and the end result was portably correct, Alexander Ziaee@ privately reported to me that the GCC 14 in the FreeBSD Jenkins CI felt uneasy about it. For clarity and readability, rewrite the truncation statement to not mix signed and unsigned types, to not use explicit casts, and make handling of the lower and upper cutoff more similar to each other. Approved by: re (cperciva) Fixes: 6410c1b51637 (mandoc: vendor import of upstream at 2025-07-27) MFC after: 3 days Reported by: ivy Reviewed by: ivy Differential Revision: https://reviews.freebsd.org/D52127 (cherry picked from commit 93bc3d83a11a1dbebd264616d63af3dd32cc1c8c) (cherry picked from commit 0d066d21668172aa7fc9bc38f9a0725ae31f0deb) --- contrib/mandoc/roff_term.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/contrib/mandoc/roff_term.c b/contrib/mandoc/roff_term.c index 8f95aa920790..85d2caeb2749 100644 --- a/contrib/mandoc/roff_term.c +++ b/contrib/mandoc/roff_term.c @@ -165,6 +165,7 @@ roff_term_pre_po(ROFF_TERM_ARGS) static int polast; /* Previously requested. */ static int po; /* Currently requested. */ static int pouse; /* Currently used. */ + int pomin; /* Minimum to be used. */ int pomax; /* Maximum to be used. */ int ponew; /* Newly requested. */ @@ -186,9 +187,9 @@ roff_term_pre_po(ROFF_TERM_ARGS) po = ponew; /* Truncate to the range [-offset, 60], remember, and apply it. */ + pomin = -p->tcol->offset; pomax = term_len(p, 60); - pouse = po >= pomax ? pomax : - po < -(int)p->tcol->offset ? -p->tcol->offset : po; + pouse = po > pomax ? pomax : po < pomin ? pomin : po; p->tcol->offset += pouse; }home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69853ed1.36315.512962e7>
