Page MenuHomeFreeBSD

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

Authored by jrtc27 on Tue, Jun 8, 2:57 PM.

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
R10 FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

jrtc27 requested review of this revision.Tue, Jun 8, 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.Tue, Jun 8, 3:43 PM

These look good to me