fix: fold [build].defines into cflags/cxxflags before P1689 scan - #297
Open
ZheFeng7110 wants to merge 3 commits into
Open
fix: fold [build].defines into cflags/cxxflags before P1689 scan#297ZheFeng7110 wants to merge 3 commits into
ZheFeng7110 wants to merge 3 commits into
Conversation
[build].defines was parsed but never folded into the compile flags used by the P1689 module scanner. When imports were guarded by a macro from [build].defines, the scanner saw no imports while the planner (via scan_overrides) expected them, causing module-graph divergence. - Add defines to BuildConfig - Parse [build].defines in TOML loader - Fold defines into -D<x> on cflags/cxxflags before snapshot/fingerprint - Add unit test and E2E regression test - Update English and Chinese docs Closes mcpp-community#296
[build].defines was parsed but never folded into the compile flags used by the P1689 module scanner. When imports were guarded by a macro from [build].defines, the scanner saw no imports while the planner (via scan_overrides) expected them, causing module-graph divergence. - Add defines to BuildConfig - Parse [build].defines in TOML loader - Fold defines into -D<x> on cflags/cxxflags before snapshot/fingerprint - Add unit test and E2E regression test - Update English and Chinese docs Closes mcpp-community#296
…to fix/build-defines-p1689-scan # Conflicts: # tests/e2e/167_build_defines_module_scan.sh
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
[build].defineswas parsed by the TOML loader but never folded into the compile flags used by the P1689 module scanner. Whenimportstatements were guarded by a macro declared in[build].defines, the scanner saw no imports, while the planner (viascan_overrides) expected them, causing a plan-vs-scan divergence.This PR fixes that by:
definestoBuildConfiginsrc/manifest/types.cppm.[build].definesinsrc/manifest/toml.cppm.fold_build_defines_into_flags()insrc/build/prepare.cppmto desugardefinesinto-D<x>on bothcflagsandcxxflagsbefore the manifest is snapshotted into packages and before fingerprinting.tests/e2e/167_build_defines_module_scan.sh) that mirrors the conditional-import +scan_overridesscenario.docs/05-mcpp-toml.mdanddocs/zh/05-mcpp-toml.md.Closes #296
Test plan
mcpp buildself-hosts successfully.mcpp test unit/test_manifestpasses.tests/e2e/167_build_defines_module_scan.shpasses.