Keep the flags helper private and make the identity guard explicit

This commit is contained in:
J. Nick Koston
2026-08-28 16:30:43 -05:00
parent c1ec1f3ee7
commit 537976a895
2 changed files with 9 additions and 9 deletions
+7 -7
View File
@@ -1245,18 +1245,18 @@ def write_project(paths: InstalledPaths, ccache: str | None) -> bool:
pch_text = pch_header_text(pch_includes)
# The .sum exists only for CCACHE_PCH_EXTSUM; ninja's depfile
# handles staleness
checksum = (
pch_identity(
identity_ok = True
checksum = None
if ccache:
checksum = pch_identity(
cxxflags,
src_dir,
pch_includes,
(str(paths.framework), str(paths.toolchain)),
)
if ccache
else None
)
# Identity unknown under ccache: pch_identity warned and degraded
if not ccache or checksum is not None:
# Identity unknown: pch_identity warned and degraded
identity_ok = checksum is not None
if identity_ok:
log_pch_in_use()
write_file_if_changed(pch_header, pch_text)
sum_path = build_dir / f"{PCH_HEADER_NAME}.gch.sum"
+2 -2
View File
@@ -389,7 +389,7 @@ def pch_compile_command(
return [*args, "-x", "c++-header", "-c", str(header), "-o", str(gch)], cmd_dir
def flags_identity(tokens: Iterable[str]) -> str:
def _flags_identity(tokens: Iterable[str]) -> str:
"""Flag string normalized for digest use: strip like ccache's rewriting
(user CCACHE_BASEDIR wins); the raw build path covers unresolved
(symlinked) spellings."""
@@ -420,7 +420,7 @@ def pch_identity(
# The closure is sorted, so root order only enters via the text
pch_header_text(include_headers),
*extra,
flags_identity(tokens),
_flags_identity(tokens),
),
)
except (OSError, UnicodeError) as err: