[Cocoa] Support architecture-specific enum values in MacGenerator#3449
Open
HeikoKlare wants to merge 2 commits into
Open
[Cocoa] Support architecture-specific enum values in MacGenerator#3449HeikoKlare wants to merge 2 commits into
HeikoKlare wants to merge 2 commits into
Conversation
Contributor
|
This pull request changes some projects for the first time in this development cycle. An additional commit containing all the necessary changes was pushed to the top of this PR's branch. To obtain these changes (for example if you want to push more changes) either fetch from your fork or apply the git patch. Git patchFurther information are available in Common Build Issues - Missing version increments. |
Contributor
HeikoKlare
force-pushed
the
macgenerator-enum-aarch64-value
branch
from
July 17, 2026 12:44
e0026ef to
93bf7b2
Compare
HeikoKlare
marked this pull request as ready for review
July 17, 2026 12:58
Some macOS enum constants have different numeric values on x86_64 versus aarch64, since aarch64 values were inherited from iOS headers and diverge from the values in the x86_64/bridgesupport definitions. Until now, this was handled by hand-editing the generated OS.java after every MacGenerator run, since the generator had no way to express an architecture-dependent value and the divergence isn't present in the (machine-generated, non-editable) bridgesupport files themselves. MacGenerator now supports a new "swt_value_aarch64" attribute on <enum> elements in *.bridgesupport.extras files. When set, it declares the value to use on aarch64, while the regular value/value64 attribute continues to describe the x86_64 value; the generator derives the appropriate architecture-conditional expression from both. This removes the need to manually patch generated code after each run and keeps the architecture-specific knowledge in the extras file, alongside the other custom generation hints already maintained there. Follow-up to 0ffafe6 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
HeikoKlare
force-pushed
the
macgenerator-enum-aarch64-value
branch
from
July 17, 2026 13:13
93bf7b2 to
28ded75
Compare
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
OS.javaafter every MacGenerator run, since the divergence isn't present in the (machine-generated, non-editable).bridgesupportfiles, and the generator had no way to express an architecture-dependent value.MacGeneratornow supports a newswt_value_aarch64attribute on<enum>elements in*.bridgesupport.extrasfiles. When set, it declares the aarch64-specific value while the regularvalue/value64attribute continues to describe the x86_64 value; the generator derives theIS_X86_64 ? ... : ...expression from both, removing the need to manually patch generated code after each run.NSTextAlignmentCenter/NSTextAlignmentRightinAppKitFull.bridgesupport.extras, replacing the two hand-maintained ternaries that previously lived directly inOS.java.Follow-up to 0ffafe6 (which introduced the manual macro code).
Test plan
OS.javavia MacGenerator on macOS and confirmNSTextAlignmentCenter/NSTextAlignmentRightproduce the sameIS_X86_64 ? ... : ...expressions as before, with no other unintended diffMacGeneratorUI's attribute editor shows/editsswt_value_aarch64for enum nodesswt_value_aarch64round-trips correctly when extras are re-saved from the tool🤖 Generated with Claude Code