Repository navigation
Keep global names' case in AOT header macros - #78
Merged
Merged
Conversation
The per-global _OFFSET_/_SIZE_/_KIND_ macros uppercased the global's name, so two globals differing only in case (`count` and `Count`, `r` and `R`) defined the same macros twice and every TU including the header got -Wmacro-redefined warnings. Identifiers are case-sensitive and unique within a program, so keeping their case makes the macros unique. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Keeping case makes distinct identifiers distinct macros, but sanitizing can still merge names: an overloaded extern is mangled to `send$f32`, which becomes `send_f32`, the same macro as a global called `send_f32`. A repeat now gets a `_2`, `_3`, ... suffix. The metadata table keeps the real names. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Collaborator
Author
|
Follow-up from review: the overloaded-extern finding does not reproduce as described, since overloads are mangled ( 🤖 Generated with Claude Code |
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.
Summary
The AOT backend's per-global
_OFFSET_/_SIZE_/_KIND_macros uppercased the global's name, so two globals that differ only in case defined the same macros twice. Audulus's pro patches hit this: the RS-1 ratchet sequencer hascountandCount, and the dac-out script hasrandR, so every translation unit including those headers got-Wmacro-redefinedwarnings.Identifiers are case-sensitive and unique within a program, so this keeps their case in the macro name:
RS_1_RATCHET_SEQUENCER_OFFSET_Countand..._OFFSET_count. The prefix part stays uppercase, and non-identifier characters still become underscores. The runtime metadata table is unchanged.This renames existing macros for any host that used them; Audulus only goes through the metadata table and manifest.
Test plan
aot_header_macros_keep_global_caseCLI test: globalsrandR, both macros and both metadata entries present, no macro defined twice.cargo test --release --features llvm aot_incli/: 4 passed.🤖 Generated with Claude Code