Skip to content

Conversation

jorge-ortega
Copy link
Collaborator

cl.exe macro expansion does not do any token validation when using token pasting (##), but cc does validate token pasting results in a valid token. This change switches from token pasting to stringify (#), which expands all the macro function variables as strings. Rename lines now expand to "RUST_RENAME" "_someDefine" "expandedFuncName". This prevents cc from erroring during expanding in cases where the expanded macro would have resulted in an invalid token, i.e: RUST_RENAME_someDefine_(not_valid) which is invalid because the ( is not a valid token character.

@adamcavendish
Copy link
Contributor

When we test the cust_raw pkg, we might need to enable all features so all the bindgens are generated.

`cl.exe` macro expansion does not do any token validation when using token pasting (##),  but `cc` does validate token pasting results in a valid token. This change switches from token pasting to stringify (#), which expands all the macro function variables as strings. Rename lines now  expand to `"RUST_RENAME" "_someDefine" "expandedFuncName"`. This prevents `cc` from erroring during expanding in cases where the expanded macro would have resulted in an invalid token, i.e: `RUST_RENAME_someDefine_(not_valid)` which is invalid because the `(` is not a valid token character.
This adds a step to build all features of `cust_raw` to validate all the
bindings it generates can build successfully.
@jorge-ortega
Copy link
Collaborator Author

Added a CI build step to do just that. I learned Windows mounts remain case insensitive in a dev container.

@adamcavendish
Copy link
Contributor

Added a CI build step to do just that. I learned Windows mounts remain case insensitive in a dev container.

Yeah, should be same across case insensitive filesystems.

@jorge-ortega jorge-ortega merged commit 7280134 into Rust-GPU:main Apr 9, 2025
4 checks passed
@jorge-ortega jorge-ortega deleted the fix-renames branch April 9, 2025 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants