Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Provisional API: This reference documents current compiler behavior. Compatibility is not yet promised.

src/cli.x

X2c command-line parsing and presentation.

Functions

FunctionSummary
cli_dependency_pass_throughReturns whether argument contains a driver-owned dependency option.
cli_parseExpands response files and parses argv[1..] into one validated request.
CliRequest.inspectsReturns whether request selects a terminating inspection or dump mode.

Functions

cli_dependency_pass_through

int cli_dependency_pass_through(String s)

Returns whether argument contains a driver-owned dependency option. Recognizes -MMD, -MP, -MF, and -MT as leading spellings or in a comma-delimited pass-through argument; NULL returns zero.

Source: src/cli.x:658

cli_parse

CliRequest cli_parse(int argc, char **argv)

Expands response files and parses argv[1..] into one validated request. Help and version requests print and exit with status zero. An empty command line prints help and exits with status two; other invalid input reports an error and exits with status two. The result has the active Scope and canonical-pool lifetimes described by CliRequest.

Raises: <alloc-fail> or <size-limit> while expanding response files or constructing request values.

Source: src/cli.x:860

CliRequest

CliRequest.inspects

int CliRequest.inspects(CliRequest request)

Returns whether request selects a terminating inspection or dump mode.

Source: src/cli.x:909

Public types

TypeKindSummary
CliRequeststructHolds one compiler command and its command-specific inputs and options.

CliRequest

typedef struct CliRequest { Symbol command, List inputs, run_args, include_dirs, package_dirs, cpp_args; List cc_args, ld_args, String out_dir, dep_file, dep_target, manifest; String target, profile, output, build_dir, temps_dir, label, state_seed; String prefix, cc, ar, Symbol kind, color_mode; Symbol dump; int jobs, debugging, verbose, dry_run, quiet, plain, nested, no_deps; int no_phony_deps, compile_only, kind_explicit, save_temps, no_cpp; int live_symbols, cpp_symbols; } *CliRequest

Holds one compiler command and its command-specific inputs and options. Lists produced by cli_parse preserve CLI order. Copies are shallow: request storage and referenced canonical values keep their producing Scope and pool lifetimes.

Source: src/cli.x:17

Design notes

Response expansion, command selection, option validation, migration diagnostics, and help rendering all produce or read the typed CliRequest.