-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Fix ENABLE_CHECKED_CASTS build and transform it into ENABLE_CHECKED_BUILDS_ option #91630
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
|
||
| //#define ENABLE_CHECKED_CASTS | ||
| #ifdef ENABLE_CHECKED_CASTS | ||
| #ifdef ENABLE_CHECKED_BUILD_CASTS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What exactly is this checked option doing ? The defines below seem to not do anything in case of overflow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are no actions hooked up to these checks at the moment, so we would need to implement valid actions in case of underflow/owerflow when we would start to use them. When I prepared for them a year ago I know we have some casts that will trigger the checks so we probably need to start logging or similar to get a better understanding where we do potential dangerous casts and where the underflow/overflow might be excepted.
| mono_aligned_addr_hash (gconstpointer ptr) | ||
| { | ||
| /* Same hashing we use for objects */ | ||
| return (GPOINTER_TO_UINT (ptr) >> 3) * 2654435761u; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overflowing here is expected
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah I suspect we'd need to audit every usage if/when we turn on validation, but right now this at least gives us all the places where conversions are happening.
Companion to #91395. Removes some duplicate defines and allows CHECKED_BUILD to be turned on in Release config.