Type
Fixtype of C types [C:6.2.5].
This is a tagged union type, introduced by fty::deftagsum.
Member Tags → Types
- :void → type-void
- :char → type-char
- :schar → type-schar
- :uchar → type-uchar
- :sshort → type-sshort
- :ushort → type-ushort
- :sint → type-sint
- :uint → type-uint
- :slong → type-slong
- :ulong → type-ulong
- :sllong → type-sllong
- :ullong → type-ullong
- :float → type-float
- :double → type-double
- :ldouble → type-ldouble
- :floatc → type-floatc
- :doublec → type-doublec
- :ldoublec → type-ldoublec
- :bool → type-bool
- :struct → type-struct
- :union → type-union
- :enum → type-enum
- :array → type-array
- :pointer → type-pointer
- :function → type-function
- :unknown → type-unknown
Currently we do not model all the C types in detail,
but only an approximate version of them,
which still lets us perform some validation.
We plan to refine the types, and the rest of the validator,
to cover exactly all the validity checks prescribed by [C]
(as well as applicable GCC extensions).
We capture the following types:
- The void type [C:6.2.5/19].
- The plain char type [C:6.2.5/3].
- The five standard signed integer types [C:6.2.5/4]
and the corresponding unsigned integer types [C:6.2.5/6].
- The three real floating point types [C:6.2.5/10].
- The three complex types [C:6.2.5/11].
These are a conditional feature,
but they must be included in this fixtype
because this fixtype consists of all the possible types.
- The _Bool type [C:6.2.5/2].
- A collective type for all structure types [C:6.2.5/20].
This is an approximation,
because there are different structure types.
- A collective type for all union types [C:6.2.5/20].
This is an approximation,
because there are different union types.
- A collective type for all enumeration types [C:6.2.5/20].
This is an approximation,
because there are different enumeration types.
- A collective type for all array types [C:6.2.5/20].
This is an approximation,
because there are different array types.
- A collective type for all pointer types [C:6.2.5/20].
This is an approximation,
because there are different pointer types.
- A collective type for all function types [C:6.2.5/20].
This is an approximation,
because there are different function types.
- An ``unknown'' type that we need due to our current approximation.
Our validator must not reject valid code.
But due to our approximate treatment of types,
we cannot always calculate a type,
e.g. for a member expression of the form s.m
where s is an expression with structure type.
Since our approximate type for all structure types
has no information about the members,
we cannot calculate any actual type for s.m;
but if the expression is used elsewhere,
we need to accept it, because it could have the right type.
We use this unknown type for this purpose:
the expression s.m has unknown type,
and unknown types are always acceptable.
Besides the approximations noted above,
currently we do not capture atomic types [C:6.2.5/20],
which we approximate as the underlying (argument) type.
We also do not capture typedef names,
which we approximate as unknown types.
Furthermore, we do not capture qualified types [C:6.2.5/26].
Subtopics
- Type-case
- Case macro for the different kinds of type structures.
- Type-fix
- Fixing function for type structures.
- Typep
- Recognizer for type structures.
- Type-kind
- Get the kind (tag) of a type structure.
- Type-equiv
- Basic equivalence relation for type structures.
- Type-void
- Type-ushort
- Type-unknown
- Type-union
- Type-ulong
- Type-ullong
- Type-uint
- Type-uchar
- Type-struct
- Type-sshort
- Type-slong
- Type-sllong
- Type-sint
- Type-schar
- Type-pointer
- Type-ldoublec
- Type-ldouble
- Type-function
- Type-floatc
- Type-float
- Type-enum
- Type-doublec
- Type-double
- Type-char
- Type-bool
- Type-array