pub struct Predef {
pub std: Std,
pub gnu_extensions: bool,
pub gnu89_inline: bool,
pub gnuc: GnucVersion,
pub opt_level: OptLevel,
pub hosted: bool,
pub timestamp: Timestamp,
pub defines: Vec<String>,
pub undefines: Vec<String>,
}Expand description
Everything the predefined set is built from that is not the target.
Fields§
§std: StdThe dialect, which decides __STDC_VERSION__.
gnu_extensions: boolWhether the GNU extensions are on, which is -std=gnu23 rather than -std=c23. It
decides __STRICT_ANSI__ and the unarmoured linux and unix macros.
gnu89_inline: boolWhether the unit is under GNU’s reading of inline, which is -fgnu89-inline. It decides
which of __GNUC_GNU_INLINE__ and __GNUC_STDC_INLINE__ is defined, and the C89 dialects
are under that reading whatever it says.
gnuc: GnucVersionThe GCC release claimed.
opt_level: OptLevelDecides __OPTIMIZE__, __OPTIMIZE_SIZE__ and __NO_INLINE__.
hosted: boolWhether there is a standard library, which is -ffreestanding turned around.
timestamp: Timestamp__DATE__ and __TIME__.
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.
Implementations§
Source§impl Predef
impl Predef
Sourcepub fn for_options(opts: &Options) -> Predef
pub fn for_options(opts: &Options) -> Predef
The set the command line asked for.
The mapping lives here rather than in the driver because it is the definition of what
each flag means to the macro set, and the driver’s job is to parse a command line, not
to know that -ffreestanding is __STDC_HOSTED__ being zero.