Skip to main content

Predef

Struct Predef 

Source
pub struct Predef {
    pub std: Std,
    pub gnu_extensions: 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: Std

The dialect, which decides __STDC_VERSION__.

§gnu_extensions: bool

Whether the GNU extensions are on, which is -std=gnu23 rather than -std=c23. It decides __STRICT_ANSI__ and the unarmoured linux and unix macros.

§gnuc: GnucVersion

The GCC release claimed.

§opt_level: OptLevel

Decides __OPTIMIZE__, __OPTIMIZE_SIZE__ and __NO_INLINE__.

§hosted: bool

Whether 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

Source

pub fn new() -> Predef

The default dialect, gnu23, at -O0.

Source§

impl Predef

Source

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.

Trait Implementations§

Source§

impl Clone for Predef

Source§

fn clone(&self) -> Predef

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Predef

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Predef

Source§

fn default() -> Predef

Returns the “default value” for a type. Read more
Source§

impl Eq for Predef

Source§

impl PartialEq for Predef

Source§

fn eq(&self, other: &Predef) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Predef

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.