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
Unknown Object (File)
Feb 21 2024, 8:52 AM
Unknown Object (File)
Feb 20 2024, 6:18 PM
Unknown Object (File)
Jan 14 2024, 4:55 AM
Unknown Object (File)
Dec 20 2023, 2:24 AM
Unknown Object (File)
Sep 24 2023, 11:17 AM
Unknown Object (File)
Sep 13 2023, 6:49 AM
Unknown Object (File)
Aug 2 2023, 6:31 PM
Unknown Object (File)
Jul 15 2023, 10:31 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