Skip to main content

Gating

Struct Gating 

Source
pub struct Gating {
    pub standard: Standard,
    pub dialect: Dialect,
}
Expand description

The pair every pass needs to answer “may this block write that?”.

A GNU dialect answers yes to everything a later revision added, exactly as GCC’s -std=gnu99 does; the strict entry points keep the diagnostic that names the macro to write instead.

Fields§

§standard: Standard

The revision the block is written in.

§dialect: Dialect

Whether the GNU extensions are switched on.

Implementations§

Source§

impl Gating

Source

pub fn requires(self, what: &str, needed: Standard) -> Option<String>

The message a feature from a newer revision gets here, or None when it is accepted.

Source

pub fn implicit_int(self) -> bool

Whether a declaration with no type specifier at all means int (C89 6.5.2).

C99 removed implicit int (N635) and GCC diagnoses it in every later mode, -std=gnu99 included, so this is one of the three places where gnu89! is older than gnu99! rather than a superset of it.

Source

pub fn implicit_function_declarations(self) -> bool

Whether a call to a function nobody declared declares extern int f(); at file scope (C89 6.3.2.2).

C99 removed the rule (N636); see Gating::implicit_int for why the GNU dialect does not bring it back.

Source

pub fn old_style_definitions(self) -> bool

Whether an old-style (K&R) function definition may be written.

Obsolescent from C89 onwards and removed by C23 (N2432), so every entry point below c23! has it and the two C23 ones do not.

Source

pub fn newer_keyword(self, name: &str) -> Option<String>

The gate message for name, if another entry point would have made it a keyword.

nullptr, bool and the rest are ordinary identifiers before C23 — the bundled <stdbool.h> writes #define bool _Bool — so a c11! block that uses one gets told what it would have meant. A GNU dialect says nothing about those: GCC’s gnu11 has no bool keyword either, so “use of undeclared identifier” is the honest answer there.

typeof and asm are the two the dialect decides, so their message names the entry point that has them.

Trait Implementations§

Source§

impl Clone for Gating

Source§

fn clone(&self) -> Self

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 Copy for Gating

Source§

impl Debug for Gating

Source§

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

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

impl Default for Gating

Source§

fn default() -> Self

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

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, !>

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.