#[non_exhaustive]pub struct Options {Show 19 fields
pub target: Triple,
pub opt_level: OptLevel,
pub emit: EmitKind,
pub debug_info: bool,
pub frame_pointer: bool,
pub red_zone: bool,
pub warnings_are_errors: bool,
pub error_limit: u32,
pub std: Std,
pub gnu_extensions: bool,
pub pedantic: bool,
pub gnuc: GnucVersion,
pub hosted: bool,
pub defines: Vec<String>,
pub undefines: Vec<String>,
pub search: SearchPath,
pub line_markers: bool,
pub dumps: Dumps,
pub rule_coverage: Option<String>,
}Expand description
Everything a compilation was asked to do.
Options are a plain value with no interior mutability, so a caller can build one, clone
it, tweak one field and run a second compilation, which is exactly what the differential
testing in spec/15-testing.md needs.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.target: TripleThe target to generate code for.
opt_level: OptLevelThe optimisation level.
emit: EmitKindWhat to produce.
debug_info: boolWhether to emit debug information.
frame_pointer: boolWhether every function keeps a frame pointer, from -fno-omit-frame-pointer.
Off by default, which is what gcc does at every level above -O0 and what leaves the
register free for the allocator. A profiler that walks the stack by following saved frame
pointers needs it on, and so does any code a debugger has to unwind without unwind tables.
red_zone: boolWhether the red zone may be used, from -mno-red-zone turned around.
The 128 bytes below the stack pointer that the System V psABI promises no signal handler
will touch, which lets a small leaf function keep its locals without moving the stack
pointer at all. A kernel turns this off, because an interrupt taken on the kernel stack
makes the promise false, and every kernel build in the wild passes -mno-red-zone for
exactly that reason. A convention without a red zone ignores this.
warnings_are_errors: boolWhether warnings are errors.
error_limit: u32How many diagnostics to print before giving up. Past a certain point the output is noise from a single earlier mistake, and GCC’s default of no limit is not a kindness.
std: StdThe dialect, from -std=.
gnu_extensions: boolWhether the GNU extensions are on, which is -std=gnu23 rather than -std=c23.
pedantic: boolWhether -pedantic was given, which is what turns a use of an extension from silence
into a diagnostic. It is not the same knob as the dialect: -std=c17 -pedantic warns
about a construct that -std=c17 alone accepts without a word.
gnuc: GnucVersionThe GCC release claimed, from -fgnuc-version=.
hosted: boolWhether there is a standard library, which is -ffreestanding turned around.
defines: Vec<String>-D in command line order. FOO means FOO=1, as GCC has it.
undefines: Vec<String>-U in command line order, applied after the defines because -U wins.
search: SearchPathWhere a header is looked for.
line_markers: boolWhether -E writes line markers, which -P turns off.
dumps: DumpsWhat the -d family asks for.
rule_coverage: Option<String>Where -Zrule-coverage=FILE writes which lowering rules fired, if it was given.
A measurement rather than a thing a build asks for, which is why it is spelled with a -Z
the way an unstable option is everywhere else: it is here for the harness in
tamnd/rucc-compat to union over a corpus and report, and nothing about the code that comes
out changes when it is on. One file per run of the compiler, holding the whole rule set with
the rules this run reached marked, whatever the run compiled and however many files it was.