Expand description
Typed compiler / tool identity and capability model.
Cabin’s build planner emits GCC/Clang-style commands. The
ResolvedToolchain (see crate::toolchain) says which
tools the user picked; this module says what those tools are
and what they can do. The
resolver in cabin-toolchain::detect runs harmless --version
invocations against each resolved tool, hands the output to the
pure parsers in this module, and assembles a typed
ToolchainDetectionReport.
This module is data and pure logic only. Process spawning, filesystem traversal, and CLI dispatch live elsewhere.
Structs§
- Archiver
Capabilities - Capability set for a static-library archiver.
- Archiver
Identity - Detected identity of a static-library archiver.
- Capability
- One typed capability decision: whether the tool supports it, and where the answer came from.
- Compiler
Capabilities - Capability set for a C/C++ compiler. Every field is decided during detection so the planner can compare its required set against the resolved set without re-running parsing logic.
- Compiler
Identity - Detected identity of one C/C++ compiler.
- Compiler
Version - Decomposed compiler / archiver version (
major.minor.patch). - Tool
Detection - One tool’s detection outcome plus the path it was invoked at.
pathis the resolved absolute path fromcrate::ResolvedToolchain; it is preserved here so error messages can mention the exact executable. - Toolchain
Detection Report - Whole-toolchain detection report. The CLI builds one per invocation that needs detection (build / metadata) and threads it into the planner and the metadata view.
Enums§
- Archiver
Kind - Recognized static-library archiver family.
- Capability
Source - Where one capability decision came from. Recorded so
cabin metadatacan show whether Cabin trusted the version alone, ran a probe, or fell back to a conservative default. - Compiler
Kind - Recognized C/C++ compiler family.
- Tool
Detection Error - Errors produced while validating a detection report against the current C++ backend’s required capability set.
Functions§
- c_
standard_ capability - Whether
identityaccepts the exact flag spelling for a Cstandard(-std=<std>on the GNU dialect,/std:<std>on MSVC). Version thresholds follow the audited table indocs/language-standards.md: unknown versions fail open (assumed-default), recognized-but-old versions fail closed, and MSVC-dialect gaps (no stable flag at any version) areUnsupported. Unknown compiler kinds are rejected earlier by the backend validation, so their entry here is conservative. - cxx_
standard_ capability - C++ twin of
c_standard_capability. - derive_
ar_ capabilities - Derive an
ArchiverCapabilitiesset from the detected identity. - derive_
cxx_ capabilities - parse_
ar_ version_ output - Pure parser for archiver
--versionoutput. The recognized families (arandllvm-ar) print one line that includes the family name. Anything else is classified asArchiverKind::Unknown; archivers that exit non-zero on--versionare left to the subprocess layer to surface asUnknown. - parse_
cxx_ version_ output - Pure parser for compiler
--versionoutput. - standard_
support_ detail - Human-readable reason for an unsupported standard capability, used by the validation errors: either the compiler has no stable flag for the standard at any version, or the detected version predates the flag.
- validate_
ar_ for_ backend - Validate that the resolved archiver can drive one of Cabin’s
two static-library backends:
lib.exefor MSVC (lib /OUT:<lib> <objs>), or anar-compatible archiver for GCC/Clang (ar crs <lib> <objs>). - validate_
c_ standards - C-side twin of
validate_cxx_standards. - validate_
cc_ for_ backend - Validate that the resolved C compiler supports the C-side
command shape the active backend emits. An MSVC compiler
drives the
cl.exebackend; every other recognized compiler drives the GCC/Clang backend, which needs GCC-style flags plus-MMD -MFdepfile generation. Support for the requested C standards is validated separately byvalidate_c_standards. - validate_
cxx_ for_ backend - Validate that the resolved C++ compiler can drive one of Cabin’s two C++ backends.
- validate_
cxx_ standards - Validate that the C++ compiler accepts every requested C++
standard. The whole set is checked, not the maximum: MSVC
support is non-monotonic (
/std:c++20exists,/std:c++11does not).