pub struct Context<'a> {
pub names: &'a Interner,
pub target: &'a TargetInfo,
pub std: Std,
pub gnu: bool,
pub pedantic: bool,
pub permissive: bool,
pub gnu89_inline: bool,
pub error_limit: usize,
pub builtins: bool,
pub no_builtin: &'a [String],
pub short_enums: bool,
}Expand description
What the checking needs and does not change.
Fields§
§names: &'a InternerThe spellings, for the diagnostics that name an identifier.
target: &'a TargetInfoWhat the target’s types are, which every layout and every promotion is decided by.
std: StdThe dialect.
gnu: boolWhether the GNU extensions are on.
pedantic: boolWhether -pedantic was given.
permissive: boolWhether -fpermissive was given, which is read through Context::promoted.
gnu89_inline: boolWhether the whole unit is under GNU’s reading of inline, which is -fgnu89-inline.
error_limit: usizeHow many errors to report before stopping, with zero meaning no limit.
builtins: boolWhether a C library function written under its own plain name may be taken to mean that
function, which is -fno-builtin and -ffreestanding turned around.
no_builtin: &'a [String]The names -fno-builtin-<name> took away one at a time, without the prefix.
short_enums: boolWhether an enumeration nothing wrote an underlying type for is represented in the smallest
integer type that holds it, which is -fshort-enums.
Implementations§
Source§impl<'a> Context<'a>
impl<'a> Context<'a>
Sourcepub fn new(names: &'a Interner, target: &'a TargetInfo, std: Std) -> Context<'a>
pub fn new(names: &'a Interner, target: &'a TargetInfo, std: Std) -> Context<'a>
A context with the defaults, for a caller that has an interner and a target to hand.
Sourcepub fn gnu_inline_by_default(&self) -> bool
pub fn gnu_inline_by_default(&self) -> bool
Whether a name nothing said gnu_inline about is read GNU’s way all the same.
Two things ask for that and they ask for it for the whole unit rather than for one name.
C89 is where the older reading came from and has never had any other, and -fgnu89-inline
is how a program written against it says so under a later dialect. The dialect wins where
the two meet, so -std=c89 -fno-gnu89-inline leaves the reading alone. gcc refuses that
command line instead, and there is nothing else it could have meant.
Sourcepub fn means_the_library(&self, name: &str) -> bool
pub fn means_the_library(&self, name: &str) -> bool
Whether a call to name, written as the program wrote it, may be taken to mean the C
library function of that name.
The plain names are the ones the flags are about. A __builtin_ spelling is the program
saying which function it means, so -fno-builtin leaves it alone and so does
-ffreestanding, which is what lets a freestanding build reach one deliberately.