Skip to content

feat(c++): make fory enum/nuion macro in user namespace#3200

Merged
chaokunyang merged 10 commits intoapache:mainfrom
chaokunyang:same_namespace_for_enum_union
Jan 26, 2026
Merged

feat(c++): make fory enum/nuion macro in user namespace#3200
chaokunyang merged 10 commits intoapache:mainfrom
chaokunyang:same_namespace_for_enum_union

Conversation

@chaokunyang
Copy link
Collaborator

@chaokunyang chaokunyang commented Jan 25, 2026

Why?

Allow C++ enum/union/field metadata macros to live in user namespaces (no forced fory:: specialization) while keeping registration/serialization behavior consistent.

What does this PR do?

  • Switch C++ enum/field/union metadata to ADL-based descriptors and update union serialization to use UnionInfo (case ids, metas, factories).
  • Adjust C++ codegen to emit namespace-scope macros and clean up union/field generation details.
  • Add a namespace macro test and wire it into C++ serialization build/test targets.
  • Update C++ docs to clarify scope rules (FORY_ENUM at namespace scope, FORY_STRUCT in public scope).
  • Set FORY_JAVASCRIPT_JAVA_CI=0 in the JavaScript xlang CI job.

Related issues

#3099
#2906
#1017

Does this PR introduce any user-facing change?

C++ macro placement rules are now enforced via ADL-based descriptors; docs call out the required scope for FORY_ENUM/FORY_STRUCT.

  • Does this PR introduce any public API change?
  • Does this PR introduce any binary protocol compatibility change?

Benchmark

@chaokunyang chaokunyang force-pushed the same_namespace_for_enum_union branch 2 times, most recently from c00d160 to 8f1e8e2 Compare January 25, 2026 16:05
@chaokunyang chaokunyang force-pushed the same_namespace_for_enum_union branch from 8f1e8e2 to b081c64 Compare January 25, 2026 16:08
@chaokunyang chaokunyang merged commit 5521c31 into apache:main Jan 26, 2026
63 checks passed
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