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: StandardThe revision the block is written in.
dialect: DialectWhether the GNU extensions are switched on.
Implementations§
Source§impl Gating
impl Gating
Sourcepub fn requires(self, what: &str, needed: Standard) -> Option<String>
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.
Sourcepub fn implicit_int(self) -> bool
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.
Sourcepub fn implicit_function_declarations(self) -> bool
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.
Sourcepub fn old_style_definitions(self) -> bool
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.
Sourcepub fn newer_keyword(self, name: &str) -> Option<String>
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.