Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Apr 2023 05:25:36 +0000
From:      Alexey Dokuchaev <danfe@freebsd.org>
To:        "Stephen J. Kiernan" <stevek@freebsd.org>
Cc:        src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org
Subject:   Re: git: 1c7ac0c23bc1 - main - veriexec: fix use of getopt
Message-ID:  <ZDzYUBXp4cIUmDJY@FreeBSD.org>
In-Reply-To: <202304170105.33H150a7020428@gitrepo.freebsd.org>
References:  <202304170105.33H150a7020428@gitrepo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Apr 17, 2023 at 01:05:00AM +0000, Stephen J. Kiernan wrote:
> commit 1c7ac0c23bc12cc7cd5776fa28ebe0582e1bccec
> 
>   veriexec: fix use of getopt
> 
>   getopt(3) returns int type not char. Using char triggers the
>   -Wtautological-constant-out-of-range-compare warning with clang.

Not just that, depending on the usage (e.g. if there is == -1 check),
it could be broken on machines where char is unsigned by default.

This is one of those things I could never understand: getopt(3) is
said to return `int' by the standard and the manpage, but people
keep assigning it to `char' (go figure).

./danfe



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ZDzYUBXp4cIUmDJY>