From nobody Mon Aug 25 23:02:50 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4c9mXp4rZwz65nNr; Mon, 25 Aug 2025 23:02:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4c9mXp3tr9z3ZpN; Mon, 25 Aug 2025 23:02:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1756162970; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jEOi7/g0pPBF3R+FxftqHFjhZ50zcQ/Z9OddJgqxgVo=; b=eTYo+utqjmXiG/cSLVtleKXoMbk4DOARCVZH76HF3cAyTTGH24HkXhvKxhRPVe3H8xdi1V s1iTU4CevQ7TYx4wYcnMk2J6vTwDl/RTAMpYqH7mGvlpcdUapW/SJHNWCojAFQdfRKFSsy CvKEfxOpf6Aci6L18MVmfKjju5MoBfkzrDg4VIm3j9oGhqfRD1BDy6nTW5ky5vKlvYRJGO WSz+t6QLY4IhxX4i7ma7+HCBGdjS6FFYyHNMpTG79Q4ts+b/6GhIgfrYxPZ/zgWwNF/u7n X7i8fDYeC5BNp8WfYuApJMmcRuej2A3WILtBH/2tVCg/np7C280rAhZQGk0IZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1756162970; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jEOi7/g0pPBF3R+FxftqHFjhZ50zcQ/Z9OddJgqxgVo=; b=Fkq3yYzmgepwnUsnROC/nxcOo1B4wUwo4MjLeA8c88ScsNspfuerofze5tE6z5FEJP1qjV J8lU5NJ5BHdYpspsX3LFgrG4kcLzLy4bH4Smqv07lgXdPgp5TBZ4eAHtN73pNJZhJlfAu7 9InCu4JIg/KJQex2c/UxEDRyJhKaBVHUzncM+KRLd8cJ2dOgB8HFloF8X6nUc3W6Ifg4Tb 5sfM6EaFeu0mmjc9fToB6zxssHvImGMwi0NG+J96iApe35sxTuxvzYotkKrTI3KI9byDYN VnJRRqCW2hVG3lUMmSXqZpcFWcJksbD1mGGVi0gI8HpcFQmQ3GSLiMHIefoRqg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1756162970; a=rsa-sha256; cv=none; b=UpNyqI5l0DSLwRwAQp7Vh8JHf3ecAaa3+iNAguoKZrMymwRI1vO56UAF3OffvIeGxB2by8 9q+2vjn/0LhetoYKUaIKWkWTVtQCXAOHc5wbwsZB+NBOEjwexSwjpFQpOQRQffpMHzC6F0 zfENo0eIUNv9qbDOka5bAl2prFBqUiq8hSlYxvyg5ESH6VYtE3FHZg9rE8Z4AXGyyIQl3B aQuD9s3SHY5up4WN3ZUY3Q3dvzVeA7MSqonDHbA/0iKEGGDxCFQiG/2czcMNzNwV8dsncy Cv6OsGiKVJZdmFM0yoNzwEWXHIsd+jYJIyFovsEqIoo9KuDL08l5j/5WdlSR7A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4c9mXp3TxSz18WD; Mon, 25 Aug 2025 23:02:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 57PN2opc020647; Mon, 25 Aug 2025 23:02:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57PN2oRs020644; Mon, 25 Aug 2025 23:02:50 GMT (envelope-from git) Date: Mon, 25 Aug 2025 23:02:50 GMT Message-Id: <202508252302.57PN2oRs020644@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Ziaee Subject: git: 93bc3d83a11a - main - mandoc: Improve width calculation for GCC compat List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ziaee X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 93bc3d83a11a1dbebd264616d63af3dd32cc1c8c Auto-Submitted: auto-generated The branch main has been updated by ziaee: URL: https://cgit.FreeBSD.org/src/commit/?id=93bc3d83a11a1dbebd264616d63af3dd32cc1c8c commit 93bc3d83a11a1dbebd264616d63af3dd32cc1c8c Author: Ingo Schwarze AuthorDate: 2025-08-25 22:58:48 +0000 Commit: Alexander Ziaee CommitDate: 2025-08-25 23:02:27 +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. 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 --- 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; }