Date: Wed, 25 Sep 2019 23:12:55 +0200 From: Dimitry Andric <dim@FreeBSD.org> To: Ed Maste <emaste@freebsd.org> Cc: Bruce Evans <brde@optusnet.com.au>, src-committers <src-committers@freebsd.org>, svn-src-all <svn-src-all@freebsd.org>, svn-src-head <svn-src-head@freebsd.org> Subject: Re: svn commit: r352661 - head/sys/netinet/tcp_stacks Message-ID: <A7FE871A-B5E9-44BC-B3CF-4B7D8302EC01@FreeBSD.org> In-Reply-To: <CAPyFy2BMAbnNqmu9Cn_74Cc4-3eHCPYfiQP9W17xj2=cdEwoOA@mail.gmail.com> References: <201909242036.x8OKahnv021758@repo.freebsd.org> <20190925070207.Y3271@besplex.bde.org> <CAPyFy2BMAbnNqmu9Cn_74Cc4-3eHCPYfiQP9W17xj2=cdEwoOA@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
On 25 Sep 2019, at 15:36, Ed Maste <emaste@freebsd.org> wrote:
>
> On Tue, 24 Sep 2019 at 17:39, Bruce Evans <brde@optusnet.com.au> wrote:
>>
>> On i386, these types have different sizes, so
>> gcc detects the type mismatch. clang is too broken to report this type
>> mismatch.
>
> Interesting, it seems Clang doesn't even warn in the case of casting a
> uint64_t to a 32-bit pointer. Looks like there are some useful
> warnings that ought to be implemented.
There is -Wconversion for this, or the more specific -Wshorten-64-to-32:
$ cat shorten.c
int foo(long l)
{
return l;
}
$ clang -Wconversion -c shorten.c
shorten.c:3:10: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
return l;
~~~~~~ ^
1 warning generated.
But for some reason this warning isn't enabled by default, even with -Wall.
I guess you would get a zillion warnings on our tree, if you enabled this. :)
-Dimitry
[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.2
iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCXYvYVwAKCRCwXqMKLiCW
o4otAKDfngl9Y+ZW0gOHPShvGyEvjJ8bMACeIOyQoNfj431asRs+JO7tD2LTrKU=
=EjjJ
-----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?A7FE871A-B5E9-44BC-B3CF-4B7D8302EC01>
