Skip to content

One reading of a compile-flag element, the databases list what the compiler receives (#655); macOS 27 - #657

Merged
Sunrisepeak merged 6 commits into
mainfrom
fix/655-flag-words
Sep 16, 2026
Merged

Sunrisepeak merged 6 commits into
mainfrom
fix/655-flag-words

Conversation

@Sunrisepeak

@Sunrisepeak Sunrisepeak commented Sep 16, 2026

Copy link
Copy Markdown
Member

Closes #655.

Summary

An element of cflags, cxxflags and asmflags now stands for the same compiler arguments on every host, the build quotes each word for its host, and compile_commands.json and mcpp emit build-database list those words, so the databases equal the build by construction (mcpp.manifest.flag_words, SPEC-004 §8). The same pull request adds macOS 27 CI and fixes what it found: import std did not build on macOS 27.

#655

  • The syntax is the POSIX shell's word syntax without expansions; outside quotes a backslash escapes only a blank, a quote or a backslash, so Windows paths keep their backslashes.
  • One compatibility exception: an element that begins with -D or /D and contains a space is one word, verbatim, as every release since [bug] defines 值含空格时未转义,命令行被拆散(-DX="long long" → 孤立 long 参数) #234 passed it.
  • Measured on Linux and Windows runners ([DO NOT MERGE] #655 host readings of flag spellings #656), 5 of 14 spellings gave different macros on the two hosts, so a database that imitates each host would have hidden the host dependence.
  • defines = ["N=\"x\""] reached the compiler as -DN=x; it now arrives as -DN="x".
  • The first plan after an upgrade names an element whose words changed, with both readings (build/flag-words); a repeated plan says nothing. 285 flag-like literals of the published index read the same under the old and the new rules.
  • Windows shell_quote_arg doubles backslashes before a quote and the closing quote.

macOS 27

  • GitHub serves macOS 27 as the preview label xcode-27 (no macos-27 label; [DO NOT MERGE] probe macOS 27 runner labels #658 read macOS 27.0 26A5406e). ci-macos and ci-macos-e2e run on macos-15 and xcode-27; ci-fresh-install runs the xlings and Homebrew channels on macos-14 and xcode-27; each macOS 27 leg asserts sw_vers major 27.
  • The 27.0 SDK's math.h leaves INFINITY and NAN to <float.h> once modules are on, and clang's <float.h> does not supply them under -std=c++23, so libc++'s std module failed (use of undeclared identifier 'INFINITY', llvm 22.1.8 and 20.1.7; measured on the runner, [DO NOT MERGE] probe libc++ std module on macOS 27 #659). The released 2026.9.16.2 fails the same way on the fresh-install macOS 27 legs.
  • For clang on an Apple target mcpp states both macros with the SDK's own spellings; where the SDK defines them the redefinition is identical and silent under -Wall -Werror. The decision reads the target triple only. Rejected: gnu++23 (dialect of every unit), -U__STRICT_ANSI__ (non-standard libc declarations), -D__need_infinity_nan (a single float.h include loses FLT_MAX).
  • CI wraps the bootstrap mcpp, which predates the fix, on macOS 27 with the same two words through CCC_OVERRIDE_OPTIONS; the binary the job builds runs unwrapped, and the wrapper retires with the bootstrap pin.

Tests

  • FlagWords.*: syntax table with the -D exception, round trip over 2000 generated words.
  • CompileCommandsArgs.*: edge equals database; host quoting round trip on each CI host; /bin/sh as the reference on POSIX.
  • HostFlags.AppleFloatMacrosAreStatedForClangOnAppleTargetsOnly.
  • e2e 736: identical assertions on Linux, macOS 15, macOS 27 and Windows; fails on 2026.9.16.2.
  • e90674fb: 12 of 12 runs green, macOS 27 unit 121/121 and e2e 182 passed 0 failed.

Records: .agents/docs/2026-09-17-655-*. Version 2026.9.17.1.

…mpiler receives (#655)

An element of `cflags`, `cxxflags` and `asmflags` now has one meaning on every
host: the POSIX shell's word syntax without expansions, where a backslash
escapes only a blank, a quote or a backslash (mcpp.manifest.flag_words,
SPEC-004 §8). The ninja writer quotes each word for its host, and
compile_commands.json and `mcpp emit build-database` list the words, so the
databases equal the build by construction instead of re-reading command lines.

Before, an element meant whatever the host's command-line reader made of it
(measured on Linux and Windows runners, #656: five of fourteen spellings gave
different macros), and the databases listed the text with a third reading,
which is how libarchive's `-DPLATFORM_CONFIG_H=\"...\"` reached consumers with
its backslashes.

- A `defines` entry is one value: `N="x"` reaches the compiler as `-DN="x"`
  (it arrived as `-DN=x`). Features, globs, targets and `mcpp:cfg=` alike.
- Link units keep their rendered text; GAS units' database entries list their
  edge's list; the `-std` guard, dialect promotion and include normalisation
  read words.
- Windows `shell_quote_arg` doubles backslashes before a quote and the closing
  quote.
- The first plan after an upgrade names an element whose words changed
  (`build/flag-words`); a repeated plan says nothing. No flag-list element of
  the published index changes.

Tests: FlagWords.* (syntax table and round trip), CompileCommandsArgs.*
(edge equals database, host quoting round trip, /bin/sh as the reference),
e2e 736 (same assertions on every host; fails on 2026.9.16.2).
Records: .agents/docs/2026-09-17-655-*.
Version 2026.9.17.1.
GitHub serves macOS 27 under the preview label xcode-27 (macOS 27.0 with Xcode
27, actions/runner-images#14404); there is no macos-27 label. Measured on #658:
the label delivers macOS 27.0 (26A5406e), arm64, ImageOS macos27.

- ci-macos and ci-macos-e2e run on macos-15 and xcode-27.
- ci-fresh-install runs the xlings and Homebrew channels on macos-14 (the
  floor) and xcode-27 (the newest release).
- Every macOS 27 leg asserts sw_vers major 27, because the label names an
  Xcode and its base OS has changed once.
- setup-macos-llvm takes the image as an input and puts it in the xlings cache
  key, which named macos15 for every image.
…ed test fixes

macOS 27 (measured on the xcode-27 image, #659): the 27.0 SDK's math.h leaves
INFINITY and NAN to <float.h> once modules are on, and clang 22's header does
not supply them under -std=c++23, so libc++'s std module stopped building.
apple_float_macro_words (hostflags.cppm) states both with the SDK's own GNU-mode
spellings for clang on an Apple target; its readers quote the words their own
way (ninja text, the std module command, graph std flags, build program argv).
gnu++23, -U__STRICT_ANSI__ and -D__need_infinity_nan were rejected for their
effect beyond the defect. The raw clang steps of ci-macos state the same words.

Compatibility: an element beginning with -D or /D that contains a space is one
word, verbatim, as every release since #234 passed it (SPEC-004 §8 rule 8).

Windows: flag_element no longer quotes a backslash the syntax does not read as
an escape, normalize_include_flags keeps the spelling of an unchanged element,
and the split_flags quoting tests follow the host's reader.
The raw clang steps now build import std on macOS 27 (run 35142520288). The
self-host step failed because the bootstrap, 2026.9.16.1, predates the fix.
setup-macos-llvm wraps a bootstrap older than 2026.9.17.1 on macOS 27 or later
and passes the same two words through CCC_OVERRIDE_OPTIONS; the freshly built
binary runs unwrapped, and the wrapper retires with the bootstrap pin.
…the 252 claim; index reading with the -D exception

- report_flag_words_changes was inserted between fold_build_defines_into_flags
  and its comment; it now precedes the comment.
- The record claimed e2e 252 keeps its real old-client leg on macOS through the
  wrapper. It does not, on any macOS leg including main: MCPP_BOOT is the xlings
  shim. Corrected and listed as a residual, with dialect promotion reading words.
- The index reading script applies the -D exception: 285 literals, 0 differ.
@Sunrisepeak Sunrisepeak changed the title One reading of a compile-flag element; the databases list what the compiler receives (#655) One reading of a compile-flag element, the databases list what the compiler receives (#655); macOS 27 Sep 16, 2026
@Sunrisepeak
Sunrisepeak merged commit f1043b7 into main Sep 16, 2026
47 of 48 checks passed
Sunrisepeak pushed a commit that referenced this pull request Sep 16, 2026
The implementation plan and the triage record move to landed. The ledger
closes every row with its reading: #657 merged as f1043b7, release
2026.9.17.1 mirrored byte for byte to GitHub and GitCode, index #854 published,
the SubOS sandbox with CN mirrors at fails=0 against a control of fails=10, and
the post-release fresh install on macOS 27 running mcpp new and run and building
mcpp from source.
Sunrisepeak added a commit that referenced this pull request Sep 16, 2026
* bootstrap from 2026.9.17.1

2026.9.17.1 is released, mirrored to GitHub and GitCode (each archive compared
byte for byte), and indexed (openxlings/xim-pkgindex#854). The macOS 27
bootstrap wrapper in setup-macos-llvm retires with this pin.

* #655 landed: the ledger, the sandbox table, and the closure

The implementation plan and the triage record move to landed. The ledger
closes every row with its reading: #657 merged as f1043b7, release
2026.9.17.1 mirrored byte for byte to GitHub and GitCode, index #854 published,
the SubOS sandbox with CN mirrors at fails=0 against a control of fails=10, and
the post-release fresh install on macOS 27 running mcpp new and run and building
mcpp from source.

---------

Co-authored-by: speak-agent <248744407+speak-agent@users.noreply.github.com>
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.

emit build-database: shell-escaped quotes inside the arguments array break consumers

2 participants