Page MenuHomeFreeBSD

tip: Cast via intptr_t not long when casting between pointer and int
ClosedPublic

Authored by jrtc27 on Jun 8 2021, 2:57 PM.
Tags
None
Referenced Files
F108514724: D30696.id90598.diff
Sat, Jan 25, 7:39 PM
Unknown Object (File)
Fri, Jan 24, 7:17 PM
Unknown Object (File)
Sun, Jan 12, 12:16 AM
Unknown Object (File)
Dec 17 2024, 2:37 AM
Unknown Object (File)
Nov 27 2024, 11:45 AM
Unknown Object (File)
Nov 27 2024, 2:37 AM
Unknown Object (File)
Nov 19 2024, 7:41 PM
Unknown Object (File)
Nov 15 2024, 9:16 PM
Subscribers
None

Details

Summary

Whilst all FreeBSD architectures have the same representation for
intptr_t and long (even if the former is int on ILP32 architectures),
this is more general and correct, and on CHERI they are not the same so
warnings are generated by default for integer-to-pointer casts that
aren't via (u)intptr_t.

Obtained from: CheriBSD

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jrtc27 requested review of this revision.Jun 8 2021, 2:57 PM
jrtc27 created this revision.
jrtc27 added inline comments.
usr.bin/tip/tip/tip.h
157–161

The whitespace here is actually dodgy (number has a tab, but boolean and character have spaces after them). I didn't notice when writing this patch, only the next one, but can update that when committing this if approved.

This revision is now accepted and ready to land.Jun 8 2021, 3:43 PM

These look good to me