Generate pointer-valued macro constants#3379
Open
tamird wants to merge 1 commit into
Open
Conversation
Contributor
Author
|
cc @metaspace @ojeda |
The Clang macro fallback can evaluate macro forms that cexpr cannot parse, but it discards pointer-valued expressions. Emit data pointer macros as raw Rust pointer constants. Keep dependent expressions eligible for fallback evaluation. Materialize pointer macro types from a final fallback parse so deferred type resolution does not retain cursors invalidated by a later reparse. Related to rust-lang#3347.
ee2d27d to
dd174a8
Compare
Contributor
Author
|
r? @emilio |
47 tasks
Contributor
|
It could be nice to split in two commits, to see how the test changes -- from a quick test against mainline I see: +pub const BEFORE_DECL: *mut later = 3u64 as usize as *mut later;
+pub const CONST_PTR: *const later = 4u64 as usize as *const later;
+pub const TYPEDEF_PTR: *mut later = 5u64 as usize as *mut later;
+pub const MAP_FAILED: *mut ::std::os::raw::c_void = 18446744073709551615u64 as usize
+ as *mut ::std::os::raw::c_void;
+pub const MAP_FAILED_ALIAS: *mut ::std::os::raw::c_void = 18446744073709551615u64
+ as usize as *mut ::std::os::raw::c_void;
pub const MAP_FAILED_EQUALS_ITSELF: u32 = 1;
pub const REDEFINED_FROM_INT: u32 = 1;
-pub const REDEFINED_ALIAS: u32 = 1;
+pub const REDEFINED_ALIAS: *mut ::std::os::raw::c_void = 2u64 as usize
+ as *mut ::std::os::raw::c_void;Is that the expected change here? I am surprised there was no other test that needed an update for the (A couple surprising but pre-existing issues discussed elsewhere IIRC are the value of |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Clang macro fallback can evaluate macro forms that cexpr cannot
parse, but it discards pointer-valued expressions. Emit data pointer
macros as raw Rust pointer constants. Keep dependent expressions
eligible for fallback evaluation.
Materialize pointer macro types from a final fallback parse so
deferred type resolution does not retain cursors invalidated by a
later reparse.
Related to #3347.