Skip to content

migrate: shared defs now carry the host SDK's availability macros (MAC_OS_X_VERSION_*), making corpus output platform-dependent #1102

Closed

Description

@ehartford

Re-migrating pcre2 and zlib on 2026-09-09 (macOS arm64, migrator at the tip of the zlib-wo branch, i.e. main a2df211 plus the prelude-free change) reproduces the committed corpora byte-for-byte except that each shared defs.w gains 77 constants that come from the macOS SDK, not from the library:

pub let MAC_OS_X_VERSION_10_0: c_int = 1000
...
pub let MAC_OS_VERSION_26_5: c_int = 260500

(zlib's also gains FD_SETSIZE, and no-op function-macro stubs OF[T], zmemzero[T], Assert, Trace*, check_match — those are the library's own macros and are fine.)

The committed corpora were promoted 2026-09-03 (5465144) without these, so the change is in the migrator between then and now — the candidates are the two c_import macro commits 1f826ac4 ("a macro whose value is its own name or an omitted macro is untranslated") and 82f21d7c ("a bare integer-suffix macro is not a literal"): the MAC_OS_X_VERSION_* values are bare integer macros that were previously dropped and are now captured by ci_capture_macro_values.

Why it matters:

  • The output is now host-dependent: the same corpus migrated on Linux or Windows will not carry these rows, so :pcre2-promote / :zlib-promote produce a different defs.w per host, and the bundle's interface-sha with it.
  • Nothing in either library references them; they are SDK noise in a library's public surface.

Expected: macro values captured for the shared defs are limited to macros defined by the corpus's own headers (the files under the migrate source dir / -I roots), never by system headers the corpus merely includes.

Repro (from the zlib-wo worktree, any stage1 with the current migrator):

with migrate <dir with zlib's 26 sources> -o out -I <dir> --no-c-export --prefer-brace --width-slice 8 --shared-defs std.zl.defs --no-prelude
grep -c MAC_OS_X_VERSION out/defs.w   # 77; the committed lib/std/re/defs.w has 0

The zlib re-promotion in the zlib-wo batch carries these rows (they compile everywhere; they are just noise); pcre2 was not re-promoted. Fix the migrator, then re-promote both.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions