You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: fold [build].defines into cflags/cxxflags before P1689 scan
[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#296
Copy file name to clipboardExpand all lines: docs/05-mcpp-toml.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -141,6 +141,7 @@ c_standard = "c11" # Standard for C source files (default c11)
141
141
cflags = ["-DFOO=1"] # Extra C compile flags
142
142
cxxflags = ["-DBAR=2"] # Extra C++ compile flags (do not put -std=... here)
143
143
ldflags = ["-lfoo"] # Extra link flags
144
+
defines = ["BIZ=1", "QUX"] # Preprocessor macros for every TU (desugars to -D; reaches module scans)
144
145
static_stdlib = true# Statically link libstdc++ (default true)
145
146
target = "x86_64-linux-musl"# Default build target when no --target is passed
146
147
# (≙ cargo build.target; e.g. "ship fully-static")
@@ -182,6 +183,8 @@ then only guaranteed to run on the build machine's version and above). A lower
182
183
floor (11–13) requires a self-built libc++ archive (already verified to work, a
183
184
data-level switch, available on request).
184
185
186
+
`defines` desugars each entry to `-D<x>` on both the C and C++ compile channels and reaches every TU in the package — including module interface units — so it affects the P1689 module scan. For macros that should only affect a single binary's entry source, use `[targets.<name>].defines` instead.
187
+
185
188
Do not configure the C++ standard via `build.cxxflags = ["-std=..."]`. Instead use:
0 commit comments