docs/rationale/ambiguous-cc-version-probe.md
cc and c++ name different toolchains per OS - GCC on most Linux,
Clang on the BSDs and macOS. Misclassifying them corrupts the database
silently, because GCC and Clang have different flag-arity tables (e.g.
Clang's -Xclang <arg> consumes the next argv slot and GCC's does not),
so source/output detection mis-parses. Several designs were weighed:
cc, which is exactly the case users hit.cc to GCC.--version on every
invocation.--version, cache the result per canonical path, and do not
fall back to the regex for ambiguous names.Use the cached version probe as the sole classifier for ambiguous names.
The recognition regex deliberately does not list cc/c++, so when the
probe declines (timeout, unrecognizable output, failed spawn, non-zero
exit) recognition returns NotRecognized rather than guessing.
gcc.yaml carries a comment recording why cc/c++
are absent from its recognize list.compilers: takes priority over the probe and is the only way to
recover recognition for a quirky cc whose --version output the
probe cannot read. There is no process-wide off switch, by request.fork+exec
pairs per clean build rather than per invocation - the reason the
per-invocation probe (PR #695) was not taken.cc, c++).
Cross-prefixed variants like aarch64-linux-gnu-cc are left to the
regex because cross-toolchains are overwhelmingly GCC; the list can
grow if a real BSD cross-toolchain case appears.recognition-ambiguous-name-probe