diff --git a/bootstrap/tests/common/mod.rs b/bootstrap/tests/common/mod.rs new file mode 100644 index 0000000000..0654506290 --- /dev/null +++ b/bootstrap/tests/common/mod.rs @@ -0,0 +1,37 @@ +use std::process::Command; +use std::sync::OnceLock; + +static CC_ARGS: OnceLock> = OnceLock::new(); + +/// Returns the appropriate compiler arguments for the current `cc`. +pub fn get_cc_args() -> &'static [&'static str> { + CC_ARGS.get_or_init(|| { + // Probe the compiler for -ferror-limit=0 (clang) or -fmax-errors=0 (gcc) + if Command::new("cc") + .arg("-ferror-limit=0") + .arg("-c") + .arg("-x") + .arg("c") + .arg("-") + .output() + .map(|o| o.status.success()) + .unwrap_or(false) + { + vec!["-std=c11", "-ferror-limit=0", "-fsyntax-only", "-x", "c"] + } else if Command::new("cc") + .arg("-fmax-errors=0") + .arg("-c") + .arg("-x") + .arg("c") + .arg("-") + .output() + .map(|o| o.status.success()) + .unwrap_or(false) + { + vec!["-std=c11", "-fmax-errors=0", "-fsyntax-only", "-x", "c"] + } else { + vec!["-std=c11", "-fsyntax-only", "-x", "c"] + } + }) + .as_slice() +} \ No newline at end of file diff --git a/docs/now/2026-09-26-published-the-c-backend-tests-hand-cc-a-clang-only-flag-23-red-on-gcc-.md b/docs/now/2026-09-26-published-the-c-backend-tests-hand-cc-a-clang-only-flag-23-red-on-gcc-.md new file mode 100644 index 0000000000..9872e6baf0 --- /dev/null +++ b/docs/now/2026-09-26-published-the-c-backend-tests-hand-cc-a-clang-only-flag-23-red-on-gcc-.md @@ -0,0 +1,11 @@ +# NOW -- The C-backend tests hand cc a clang-only flag: 23 red on gcc, and the ones that stay green check nothing (published 2026-09-26) + +## A bee's work on #4832, published from `queen-4832` (Closes #4832) + +- The branch changes 1 file(s): `bootstrap/tests/common/mod.rs`. +- `git diff --stat origin/master...queen-4832` reads: 1 file changed, 37 insertions(+) +- This entry is written by the publisher, not by the bee. A pull request must + add exactly one `docs/now/` entry and a bee has no way to know that: its brief + names a boundary file and acceptance criteria, and `docs/now/` is neither. +- What this entry does NOT establish: that the work is correct. The gates on the + pull request judge that, and they are the same gates every other change meets.