build: guard against compiler path truncation warnings

This commit is contained in:
Hermes Agent
2026-09-15 02:12:09 +00:00
parent 9677ed81ba
commit 3fb0a2ec45
8 changed files with 34 additions and 4 deletions
+1
View File
@@ -11,6 +11,7 @@ REQUIRED_COMMANDS = [
"python3 tools/validate_typecheck_diagnostics.py",
"python3 tools/validate_version_convention.py",
"python3 tools/validate_package_security.py",
"python3 tools/validate_compiler_warnings.py",
"python3 tools/validate_ci_workflow.py",
]
+26
View File
@@ -0,0 +1,26 @@
#!/usr/bin/env python3
"""Keep the release build free of known path-truncation warnings."""
import subprocess
import tempfile
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
def main():
with tempfile.TemporaryDirectory() as tmp:
result = subprocess.run(
["gcc", "-std=c99", "-O0", "-c", "src/claro.c", "-o", str(Path(tmp) / "claro.o")],
cwd=ROOT,
text=True,
capture_output=True,
)
if result.returncode != 0:
raise SystemExit(result.stderr or "compiler warning validation could not compile src/claro.c")
if "format-truncation" in result.stderr:
raise SystemExit("compiler warning validation found -Wformat-truncation warnings:\n" + result.stderr)
print("Compiler warning validation complete")
if __name__ == "__main__":
main()