Date: Wed, 15 Apr 2026 02:29:00 -0700 From: Ryan Libby <rlibby@freebsd.org> To: Konstantin Belousov <kostikbel@gmail.com> Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 00dccc3164c6 - main - sys/time: appease gcc -Wtype-limits Message-ID: <CAHgpiFwX5KqY08TDE7vXFqQ%2BViYUyGhphdForcgAD5=TTihiCA@mail.gmail.com> In-Reply-To: <ad9Tkqnhs3zWWO6q@kib.kiev.ua> References: <69df4dc9.18e73.533e828@gitrepo.freebsd.org> <ad9Tkqnhs3zWWO6q@kib.kiev.ua>
index | next in thread | previous in thread | raw e-mail
On Wed, Apr 15, 2026 at 2:00 AM Konstantin Belousov <kostikbel@gmail.com> wrote: > > On Wed, Apr 15, 2026 at 08:35:21AM +0000, Ryan Libby wrote: > > The branch main has been updated by rlibby: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=00dccc3164c6dff38350a1baeeea7238acf2efc3 > > > > commit 00dccc3164c6dff38350a1baeeea7238acf2efc3 > > Author: Ryan Libby <rlibby@FreeBSD.org> > > AuthorDate: 2026-04-15 08:08:37 +0000 > > Commit: Ryan Libby <rlibby@FreeBSD.org> > > CommitDate: 2026-04-15 08:08:37 +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 > > --- > > sys/sys/time.h | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/sys/sys/time.h b/sys/sys/time.h > > index 707565b6a6f1..6f18d8bd844d 100644 > > --- a/sys/sys/time.h > > +++ b/sys/sys/time.h > > @@ -355,10 +355,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)); > > } > > > > @@ -382,10 +384,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)); > > } > > I dislike the direct tests for the arch. Could we add some define like > __SIZEOF_TIME_T and put the code under > #ifdef __SIZEOF_TIME_T >= 8 instead of __i386__? Sure, that would work, if you don't mind the wider patch and added definitions. I put up this diff for review: https://reviews.freebsd.org/D56401 Ryanhome | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAHgpiFwX5KqY08TDE7vXFqQ%2BViYUyGhphdForcgAD5=TTihiCA>
