Date: Fri, 08 May 2026 15:35:29 +0000 From: Ryan Libby <rlibby@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: cab150feb82e - stable/14 - sys/time: appease gcc -Wtype-limits Message-ID: <69fe02c1.31ef5.59564ceb@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch stable/14 has been updated by rlibby: URL: https://cgit.FreeBSD.org/src/commit/?id=cab150feb82ebae3edf59565de28df68be5cf281 commit cab150feb82ebae3edf59565de28df68be5cf281 Author: Ryan Libby <rlibby@FreeBSD.org> AuthorDate: 2026-04-15 08:08:37 +0000 Commit: Ryan Libby <rlibby@FreeBSD.org> CommitDate: 2026-05-08 15:34:15 +0000 sys/time: appease gcc -Wtype-limits In environments where time_t is 32 bits, including the 32-bit library build on amd64, the overflow being tested for cannot happen, and gcc complains with -Wtype-limits, causing the gcc build to fail. Work around this by ifdef'ing out the saturation code on i386. Reviewed by: imp, jfree Discussed with: markj Fixes: e3799530b3ba ("sys/time: Add saturating sbt conversions") Differential Revision: https://reviews.freebsd.org/D56369 (cherry picked from commit 00dccc3164c6dff38350a1baeeea7238acf2efc3) --- sys/sys/time.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/sys/time.h b/sys/sys/time.h index 66fbd2dd41f4..195d3d12e953 100644 --- a/sys/sys/time.h +++ b/sys/sys/time.h @@ -357,10 +357,12 @@ tstosbt(struct timespec _ts) static __inline sbintime_t tstosbt_sat(struct timespec _ts) { +#ifndef __i386__ if (_ts.tv_sec > SBT_MAX >> 32) return (SBT_MAX); if (_ts.tv_sec < -(SBT_MAX >> 32) - 1) return (-SBT_MAX - 1); +#endif return (tstosbt(_ts)); } @@ -384,10 +386,12 @@ tvtosbt(struct timeval _tv) static __inline sbintime_t tvtosbt_sat(struct timeval _tv) { +#ifndef __i386__ if (_tv.tv_sec > SBT_MAX >> 32) return (SBT_MAX); if (_tv.tv_sec < -(SBT_MAX >> 32) - 1) return (-SBT_MAX - 1); +#endif return (tvtosbt(_tv)); }home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69fe02c1.31ef5.59564ceb>
