svn commit: r352661 - head/sys/netinet/tcp_stacks

Dimitry Andric dim at FreeBSD.org
Wed Sep 25 21:13:06 UTC 2019


On 25 Sep 2019, at 15:36, Ed Maste <emaste at freebsd.org> wrote:
> 
> On Tue, 24 Sep 2019 at 17:39, Bruce Evans <brde at 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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 223 bytes
Desc: Message signed with OpenPGP
URL: <http://lists.freebsd.org/pipermail/svn-src-all/attachments/20190925/5f14b311/attachment.sig>


More information about the svn-src-all mailing list