Index | Thread | Search

From:
Theo Buehler <tb@theobuehler.org>
Subject:
Re: relayd: fix GCC16 warnings
To:
rafael@sizeofvoid.org, tech@openbsd.org
Date:
Sat, 24 Oct 2026 00:20:58 +0200

Download raw body.

Thread
On Fri, Oct 23, 2026 at 11:41:47PM +0200, Kirill A. Korinsky wrote:
> On Fri, 23 Oct 2026 21:58:19 +0200,
> Rafael Sadowski <rafael@sizeofvoid.org> wrote:
> > 
> > Make GCC16 happy with relayd code
> > 
> > ca.c:348:50: warning: operand of '?:' changes signedness from 'int' to 'unsigned int' due to unsignedness of other operand [-Wsign-compare]
> >   348 |                 cko.cko_tlen = (ret > 0) ? len : -1;
> > 
> > 
> ...
> > -		cko.cko_tlen = (ret > 0) ? len : -1;
> > +		cko.cko_tlen = (ret > 0) ? (int)len : -1;
> 
> Not sure that I understand this warning.
> 
> len is int, -1 is int, cko_tlen is int.
>
> Why gcc things what something here is unsigned int?

gcc is often dumb, but here it is right (even if it's a harmless
warning)

len is an unsigned int. Thus the return type of the conditional
expression is unsigned int and -1 ets promoted.