F diff --git a/src/program/program.c b/src/program/program.c
--- a/src/program/program.c
+++ b/src/program/program.c
}
- char has_new_errors(struct Translation_Data *translation_data)
+ _Bool has_new_errors(struct Translation_Data *translation_data)
{
if(translation_data->errors->size != translation_data->number_of_errors_when_last_checked)
{
}
- char has_no_tokens(struct Translation_Data *translation_data)
+ _Bool has_no_tokens(struct Translation_Data *translation_data)
{
return (translation_data->tokens->size)==0;
}
F diff --git a/src/program/program.h b/src/program/program.h
--- a/src/program/program.h
+++ b/src/program/program.h
void entype_program(struct Program *program);
- char has_new_errors(struct Translation_Data *translation_data);
- char has_no_tokens(struct Translation_Data *translation_data);
+ _Bool has_new_errors(struct Translation_Data *translation_data);
+ _Bool has_no_tokens(struct Translation_Data *translation_data);
void delete_program(struct Program *program);
void delete_translation_data(struct Translation_Data *translation_data);
F diff --git a/src/semantics/identifiers/denoted.c b/src/semantics/identifiers/denoted.c
--- a/src/semantics/identifiers/denoted.c
+++ b/src/semantics/identifiers/denoted.c
return (struct Denoted*)ret;
}
- struct Denoted* extract_denoted(struct Denoted_Base *base,struct Denotation_Prototype *prototype,char allow_abstract)
+ struct Denoted* extract_denoted(struct Denoted_Base *base,struct Denotation_Prototype *prototype,_Bool allow_abstract)
{
if(base->type->specifier==TS_FUNC)
{
F diff --git a/src/semantics/identifiers/denoted.h b/src/semantics/identifiers/denoted.h
--- a/src/semantics/identifiers/denoted.h
+++ b/src/semantics/identifiers/denoted.h
struct Denoted* get_denoted_enum(struct Enum *enumerator);
struct Denoted* get_denoted_struct_union(struct Struct_Union *struct_union);
- struct Denoted* extract_denoted(struct Denoted_Base *base,struct Denotation_Prototype *prototype,char allow_abstract);
+ struct Denoted* extract_denoted(struct Denoted_Base *base,struct Denotation_Prototype *prototype,_Bool allow_abstract);
struct Denoted* get_denotation_prototype(struct Map *types);
F diff --git a/src/semantics/identifiers/scope.c b/src/semantics/identifiers/scope.c
--- a/src/semantics/identifiers/scope.c
+++ b/src/semantics/identifiers/scope.c
}
- char check_if_typedefed(struct Scope* scope,struct token *id)
+ _Bool check_if_typedefed(struct Scope* scope,struct token *id)
{
struct Denoted *hold;
hold=check_ordinary(scope,id);
F diff --git a/src/semantics/identifiers/scope.h b/src/semantics/identifiers/scope.h
--- a/src/semantics/identifiers/scope.h
+++ b/src/semantics/identifiers/scope.h
- char check_if_typedefed(struct Scope* scope,struct token *id);
+ _Bool check_if_typedefed(struct Scope* scope,struct token *id);
#endif
F diff --git a/src/semantics/value/constraints.c b/src/semantics/value/constraints.c
--- a/src/semantics/value/constraints.c
+++ b/src/semantics/value/constraints.c
#include <constraints.h>
/*the operands of % shall both have an integer type 6.5.5*/
- char constraint_check_modulo_expression(struct AST_Expression *left,struct AST_Expression *right,struct Translation_Data *translation_data)
+ _Bool constraint_check_modulo_expression(struct AST_Expression *left,struct AST_Expression *right,struct Translation_Data *translation_data)
{
struct Type *left_type;
struct Type *right_type;
return 1;
}
/*constraints only on modulo operation 6.5.5*/
- char constraint_check_multiplicative_expression(struct AST_Expression *left,struct AST_Expression *right,enum AST_Type operation,struct Translation_Data *translation_data)
+ _Bool constraint_check_multiplicative_expression(struct AST_Expression *left,struct AST_Expression *right,enum AST_Type operation,struct Translation_Data *translation_data)
{
if(left->type==ERROR || right->type==ERROR)
* both operands shall have arihtmetic type
* both operands are pointers to qualified or unqualified versions of compatible object types
* left operand is a pointer to an object type and the right operand has integer type*/
- char constraint_check_additive_expression(struct AST_Expression *left,struct AST_Expression *right,enum AST_Type operation,struct Translation_Data *translation_data)
+ _Bool constraint_check_additive_expression(struct AST_Expression *left,struct AST_Expression *right,enum AST_Type operation,struct Translation_Data *translation_data)
{
struct Type *left_type;
struct Type *right_type;
}
/*each of the operands shall have integer type 6.5.7*/
- char constraint_check_shift_expression(struct AST_Expression *left,struct AST_Expression *right,enum AST_Type operation,struct Translation_Data *translation_data)
+ _Bool constraint_check_shift_expression(struct AST_Expression *left,struct AST_Expression *right,enum AST_Type operation,struct Translation_Data *translation_data)
{
struct Type *left_type;
struct Type *right_type;
return 0;
}
}
- char constraint_check_bitwise_expression(struct AST_Expression *left,struct AST_Expression *right,enum AST_Type operation,struct Translation_Data *translation_data)
+ _Bool constraint_check_bitwise_expression(struct AST_Expression *left,struct AST_Expression *right,enum AST_Type operation,struct Translation_Data *translation_data)
{
if(left->type==ERROR || right->type==ERROR)
* both operands are pointers to qualified or unqualified versions of compatible incomplete type
*
* */
- char constraint_check_relational_operation(struct AST_Expression *left,struct AST_Expression *right,enum AST_Type operation,struct Translation_Data *translation_data)
+ _Bool constraint_check_relational_operation(struct AST_Expression *left,struct AST_Expression *right,enum AST_Type operation,struct Translation_Data *translation_data)
{
if(left->type==ERROR || right->type==ERROR)
* both operands are pointers to qualified or unqualified versions of compatible types
* one operand is a pointer to object or incomplete type and the other is a pointer to a qualified or unqualified version of void
* one operand is a pointer and the other is a null pointer constant*/
- char constraint_check_equality_expression(struct AST_Expression *left,struct AST_Expression *right,struct Translation_Data *translation_data)
+ _Bool constraint_check_equality_expression(struct AST_Expression *left,struct AST_Expression *right,struct Translation_Data *translation_data)
{
struct Type *left_type;
struct Type *right_type;
}
}
/*each of the operands shall have scallar type 6.5.13 6.5.14*/
- char constraint_check_logical_expression(struct AST_Expression *left,struct AST_Expression *right,enum AST_Type operation,struct Translation_Data *translation_data)
+ _Bool constraint_check_logical_expression(struct AST_Expression *left,struct AST_Expression *right,enum AST_Type operation,struct Translation_Data *translation_data)
{
struct Type *left_type;
struct Type *right_type;
6.5.16.1
* */
- char constraint_check_simple_assignment_expression(struct AST_Expression *left,struct AST_Expression *right,struct Translation_Data *translation_data)
+ _Bool constraint_check_simple_assignment_expression(struct AST_Expression *left,struct AST_Expression *right,struct Translation_Data *translation_data)
{
struct Type *left_type;
struct Type *right_type;
6.5.16.2
*/
- char constraint_check_compound_assignment_expression(struct AST_Expression *left,struct AST_Expression *right,enum AST_Type operation,struct Translation_Data *translation_data)
+ _Bool constraint_check_compound_assignment_expression(struct AST_Expression *left,struct AST_Expression *right,enum AST_Type operation,struct Translation_Data *translation_data)
{
struct Type *left_type;
struct Type *right_type;
/*
none that I could see
*/
- char constraint_check_comma_expression(struct AST_Expression *left,struct AST_Expression *right,struct Translation_Data *translation_data)
+ _Bool constraint_check_comma_expression(struct AST_Expression *left,struct AST_Expression *right,struct Translation_Data *translation_data)
{
if(left->type==ERROR || right->type==ERROR)
/*
one of the expressions shall have type pointer to object the other shall have integer
*/
- char constraint_check_array_subscript_expression(struct AST_Expression *left,struct AST_Expression *right,struct Translation_Data *translation_data)
+ _Bool constraint_check_array_subscript_expression(struct AST_Expression *left,struct AST_Expression *right,struct Translation_Data *translation_data)
{
struct Type *left_type;
struct Type *right_type;
left is (un)qualified struct or union, second is an id of a memeber of the struct or union
NOTE: we don't check if id is a member of the struct or union here
*/
- char constraint_check_struct_union_member_expression(struct AST_Expression *left,struct token *id,struct Translation_Data *translation_data)
+ _Bool constraint_check_struct_union_member_expression(struct AST_Expression *left,struct token *id,struct Translation_Data *translation_data)
{
struct Type *left_type;
/*
see above
*/
- char constraint_check_struct_union_member_trough_ptr_expression(struct AST_Expression *left,struct token *id,struct Translation_Data *translation_data)
+ _Bool constraint_check_struct_union_member_trough_ptr_expression(struct AST_Expression *left,struct token *id,struct Translation_Data *translation_data)
{
struct Type *left_type;
one operand is a pointer and the other is a null pointer constant
one operand is a pointer to an object or incomplete type and the other is a pointer to a (un)qualified version of void
*/
- char constraint_check_conditional_expression(struct AST_Expression *left,struct AST_Expression *center,struct AST_Expression *right,struct Translation_Data *translation_data)
+ _Bool constraint_check_conditional_expression(struct AST_Expression *left,struct AST_Expression *center,struct AST_Expression *right,struct Translation_Data *translation_data)
{
struct Type *left_type;
}
}
}
- char constraint_check_function_expression(struct AST_Function_Expression *proposed_function,struct Translation_Data *translation_data)
+ _Bool constraint_check_function_expression(struct AST_Function_Expression *proposed_function,struct Translation_Data *translation_data)
{
struct Type *expected_argument_type;
struct Type *given_argument_type;
}
return 1;
}
- char constraint_check_indirection_expression(struct AST_Expression *operand,struct Translation_Data *translation_data)
+ _Bool constraint_check_indirection_expression(struct AST_Expression *operand,struct Translation_Data *translation_data)
{
struct Type *operand_type;
return 0;
}
}
- char constraint_check_address_expression(struct AST_Expression *operand,struct Translation_Data *translation_data)
+ _Bool constraint_check_address_expression(struct AST_Expression *operand,struct Translation_Data *translation_data)
{
struct Type *operand_type;
return 0;
}
}
- char constraint_check_sizeof_by_type(struct Type *type)
+ _Bool constraint_check_sizeof_by_type(struct Type *type)
{
if(type->specifier==TS_ERROR)
return 0;
else
return 1;
}
- char constraint_check_sizeof_expression(struct AST_Expression *expression,struct Translation_Data *translation_data)
+ _Bool constraint_check_sizeof_expression(struct AST_Expression *expression,struct Translation_Data *translation_data)
{
if(expression->type==ERROR)
return 0;
/*
* operand shall have arithmetic type
*/
- char constraint_check_unary_plus_minus(struct AST_Expression *operand,enum AST_Type operation,struct Translation_Data *translation_data)
+ _Bool constraint_check_unary_plus_minus(struct AST_Expression *operand,enum AST_Type operation,struct Translation_Data *translation_data)
{
struct Type *operand_type;
/*
* operand shall have integer type
*/
- char constraint_check_unary_bitwise_not(struct AST_Expression *operand,struct Translation_Data *translation_data)
+ _Bool constraint_check_unary_bitwise_not(struct AST_Expression *operand,struct Translation_Data *translation_data)
{
struct Type *operand_type;
/*
* operand shall have scalar type
*/
- char constraint_check_unary_logical_not(struct AST_Expression *operand,struct Translation_Data *translation_data)
+ _Bool constraint_check_unary_logical_not(struct AST_Expression *operand,struct Translation_Data *translation_data)
{
struct Type *operand_type;
/*
operand is a modifiable lvalue and has a (un)qualified real or pointer type
* */
- char constraint_check_postfix_inc_dec_expression(struct AST_Expression *operand,enum AST_Type operation,struct Translation_Data *translation_data)
+ _Bool constraint_check_postfix_inc_dec_expression(struct AST_Expression *operand,enum AST_Type operation,struct Translation_Data *translation_data)
{
struct Type *operand_type;
/*
operand is a modifiable lvalue and has a (un)qualified real or pointer type
* */
- char constraint_check_prefix_inc_dec_expression(struct AST_Expression *operand,enum AST_Type operation,struct Translation_Data *translation_data)
+ _Bool constraint_check_prefix_inc_dec_expression(struct AST_Expression *operand,enum AST_Type operation,struct Translation_Data *translation_data)
{
if(operand->type==ERROR)
return 0;
return constraint_check_postfix_inc_dec_expression(operand,operation,translation_data);
}
- char constraint_check_cast_expression(struct Type *type,struct AST_Expression *expression,struct Translation_Data *translation_data)
+ _Bool constraint_check_cast_expression(struct Type *type,struct AST_Expression *expression,struct Translation_Data *translation_data)
{
if(expression->type==ERROR || type->specifier==TS_ERROR)
return 0;
F diff --git a/src/semantics/value/constraints.h b/src/semantics/value/constraints.h
--- a/src/semantics/value/constraints.h
+++ b/src/semantics/value/constraints.h
#include <constraints.hh>
#include <ast.h>
- char constraint_check_modulo_expression(struct AST_Expression *left,struct AST_Expression *right,struct Translation_Data *translation_data);
- char constraint_check_multiplicative_expression(struct AST_Expression *left,struct AST_Expression *right,enum AST_Type operation,struct Translation_Data *translation_data);
- char constraint_check_additive_expression(struct AST_Expression *left,struct AST_Expression *right,enum AST_Type operation,struct Translation_Data *translation_data);
- char constraint_check_shift_expression(struct AST_Expression *left,struct AST_Expression *right,enum AST_Type operation,struct Translation_Data *translation_data);
- char constraint_check_bitwise_expression(struct AST_Expression *left,struct AST_Expression *right,enum AST_Type operation,struct Translation_Data *translation_data);
- char constraint_check_relational_operation(struct AST_Expression *left,struct AST_Expression *right,enum AST_Type operation,struct Translation_Data *translation_data);
- char constraint_check_equality_expression(struct AST_Expression *left,struct AST_Expression *right,struct Translation_Data *translation_data);
- char constraint_check_logical_expression(struct AST_Expression *left,struct AST_Expression *right,enum AST_Type operation,struct Translation_Data *translation_data);
- char constraint_check_simple_assignment_expression(struct AST_Expression *left,struct AST_Expression *right,struct Translation_Data *translation_data);
- char constraint_check_compound_assignment_expression(struct AST_Expression *left,struct AST_Expression *right,enum AST_Type operation,struct Translation_Data *translation_data);
- char constraint_check_comma_expression(struct AST_Expression *left,struct AST_Expression *right,struct Translation_Data *translation_data);
- char constraint_check_array_subscript_expression(struct AST_Expression *left,struct AST_Expression *right,struct Translation_Data *translation_data);
- char constraint_check_struct_union_member_expression(struct AST_Expression *left,struct token *id,struct Translation_Data *translation_data);
- char constraint_check_struct_union_member_trough_ptr_expression(struct AST_Expression *left,struct token *id,struct Translation_Data *translation_data);
- char constraint_check_conditional_expression(struct AST_Expression *left,struct AST_Expression *center,struct AST_Expression *right,struct Translation_Data *translation_data);
- char constraint_check_function_expression(struct AST_Function_Expression *proposed_function,struct Translation_Data *translation_data);
- char constraint_check_indirection_expression(struct AST_Expression *operand,struct Translation_Data *translation_data);
- char constraint_check_address_expression(struct AST_Expression *operand,struct Translation_Data *translation_data);
- char constraint_check_sizeof_by_type(struct Type *type);
- char constraint_check_unary_plus_minus(struct AST_Expression *operand,enum AST_Type operation,struct Translation_Data *translation_data);
- char constraint_check_unary_bitwise_not(struct AST_Expression *operand,struct Translation_Data *translation_data);
- char constraint_check_unary_logical_not(struct AST_Expression *operand,struct Translation_Data *translation_data);
- char constraint_check_postfix_inc_dec_expression(struct AST_Expression *operand,enum AST_Type operation,struct Translation_Data *translation_data);
- char constraint_check_prefix_inc_dec_expression(struct AST_Expression *operand,enum AST_Type operation,struct Translation_Data *translation_data);
- char constraint_check_sizeof_expression(struct AST_Expression *expression,struct Translation_Data *translation_data);
- char constraint_check_cast_expression(struct Type *type,struct AST_Expression *expression,struct Translation_Data *translation_data);
+ _Bool constraint_check_modulo_expression(struct AST_Expression *left,struct AST_Expression *right,struct Translation_Data *translation_data);
+ _Bool constraint_check_multiplicative_expression(struct AST_Expression *left,struct AST_Expression *right,enum AST_Type operation,struct Translation_Data *translation_data);
+ _Bool constraint_check_additive_expression(struct AST_Expression *left,struct AST_Expression *right,enum AST_Type operation,struct Translation_Data *translation_data);
+ _Bool constraint_check_shift_expression(struct AST_Expression *left,struct AST_Expression *right,enum AST_Type operation,struct Translation_Data *translation_data);
+ _Bool constraint_check_bitwise_expression(struct AST_Expression *left,struct AST_Expression *right,enum AST_Type operation,struct Translation_Data *translation_data);
+ _Bool constraint_check_relational_operation(struct AST_Expression *left,struct AST_Expression *right,enum AST_Type operation,struct Translation_Data *translation_data);
+ _Bool constraint_check_equality_expression(struct AST_Expression *left,struct AST_Expression *right,struct Translation_Data *translation_data);
+ _Bool constraint_check_logical_expression(struct AST_Expression *left,struct AST_Expression *right,enum AST_Type operation,struct Translation_Data *translation_data);
+ _Bool constraint_check_simple_assignment_expression(struct AST_Expression *left,struct AST_Expression *right,struct Translation_Data *translation_data);
+ _Bool constraint_check_compound_assignment_expression(struct AST_Expression *left,struct AST_Expression *right,enum AST_Type operation,struct Translation_Data *translation_data);
+ _Bool constraint_check_comma_expression(struct AST_Expression *left,struct AST_Expression *right,struct Translation_Data *translation_data);
+ _Bool constraint_check_array_subscript_expression(struct AST_Expression *left,struct AST_Expression *right,struct Translation_Data *translation_data);
+ _Bool constraint_check_struct_union_member_expression(struct AST_Expression *left,struct token *id,struct Translation_Data *translation_data);
+ _Bool constraint_check_struct_union_member_trough_ptr_expression(struct AST_Expression *left,struct token *id,struct Translation_Data *translation_data);
+ _Bool constraint_check_conditional_expression(struct AST_Expression *left,struct AST_Expression *center,struct AST_Expression *right,struct Translation_Data *translation_data);
+ _Bool constraint_check_function_expression(struct AST_Function_Expression *proposed_function,struct Translation_Data *translation_data);
+ _Bool constraint_check_indirection_expression(struct AST_Expression *operand,struct Translation_Data *translation_data);
+ _Bool constraint_check_address_expression(struct AST_Expression *operand,struct Translation_Data *translation_data);
+ _Bool constraint_check_sizeof_by_type(struct Type *type);
+ _Bool constraint_check_unary_plus_minus(struct AST_Expression *operand,enum AST_Type operation,struct Translation_Data *translation_data);
+ _Bool constraint_check_unary_bitwise_not(struct AST_Expression *operand,struct Translation_Data *translation_data);
+ _Bool constraint_check_unary_logical_not(struct AST_Expression *operand,struct Translation_Data *translation_data);
+ _Bool constraint_check_postfix_inc_dec_expression(struct AST_Expression *operand,enum AST_Type operation,struct Translation_Data *translation_data);
+ _Bool constraint_check_prefix_inc_dec_expression(struct AST_Expression *operand,enum AST_Type operation,struct Translation_Data *translation_data);
+ _Bool constraint_check_sizeof_expression(struct AST_Expression *expression,struct Translation_Data *translation_data);
+ _Bool constraint_check_cast_expression(struct Type *type,struct AST_Expression *expression,struct Translation_Data *translation_data);
#endif
F diff --git a/src/semantics/value/type.c b/src/semantics/value/type.c
--- a/src/semantics/value/type.c
+++ b/src/semantics/value/type.c
return (struct Type*)ret;
}
- struct Type* get_pointer_type(struct Type *points_to,char is_const,char is_volatile)
+ struct Type* get_pointer_type(struct Type *points_to,_Bool is_const,_Bool is_volatile)
{
struct Type_Pointer *ret;
ret=calloc(1,sizeof(struct Type_Pointer));
ret=(struct Type_Function*)type_check_and_push((struct Type*)ret,return_type->node,sizeof(struct Type_Function));
}
- char is_type(struct Translation_Data *translation_data,struct Scope *scope)
+ _Bool is_type(struct Translation_Data *translation_data,struct Scope *scope)
{
struct token *hold;
struct Denoted *thing;
return ret;
}
/*TODO !!!*/
- char types_are_identical(struct Type *a,struct Type *b)
+ _Bool types_are_identical(struct Type *a,struct Type *b)
{
return a==b;
}
* Additional
*
* */
- char types_are_compatible(struct Type *a,struct Type *b)
+ _Bool types_are_compatible(struct Type *a,struct Type *b)
{
return types_are_identical(a,b) || ( type_is_constant(a)==type_is_constant(b) && type_is_volatile(a)==type_is_volatile(b)
&& types_are_compatible_inner(a,b) );
}
- char types_are_compatible_unqualified(struct Type *a,struct Type *b)
+ _Bool types_are_compatible_unqualified(struct Type *a,struct Type *b)
{
return types_are_identical(a,b) || types_are_compatible_inner(a,b);
}
- char types_are_compatible_inner(struct Type *a,struct Type *b)
+ _Bool types_are_compatible_inner(struct Type *a,struct Type *b)
{
switch(a->specifier)
{
assert(0);
return 0;
}
- char types_of_pointers_are_compatible_unqualified(struct Type_Pointer *a,struct Type_Pointer *b)
+ _Bool types_of_pointers_are_compatible_unqualified(struct Type_Pointer *a,struct Type_Pointer *b)
{
return types_are_compatible(a->points_to,b->points_to);
}
- char types_of_arrays_are_compatible_unqualified(struct Type_Array *a,struct Type_Array *b)
+ _Bool types_of_arrays_are_compatible_unqualified(struct Type_Array *a,struct Type_Array *b)
{
if(!types_are_compatible(a->is_array_of,b->is_array_of))
return 0;
return 1;
return a->number_of_elements==b->number_of_elements;
}
- char types_of_functions_are_compatible_unqualified(struct Type_Function *a,struct Type_Function *b)
+ _Bool types_of_functions_are_compatible_unqualified(struct Type_Function *a,struct Type_Function *b)
{
size_t current_argument;
}
return 1;
}
- char types_of_struct_unions_are_compatible_unqualified(struct Struct_Union *a,struct Struct_Union *b)
+ _Bool types_of_struct_unions_are_compatible_unqualified(struct Struct_Union *a,struct Struct_Union *b)
{
struct Queue_Node *it_a;
struct Queue_Node *it_b;
}
return 1;
}
- char types_of_bitfields_are_compatible_unqalified(struct Type_Bit_Field *a,struct Type_Bit_Field *b)
+ _Bool types_of_bitfields_are_compatible_unqalified(struct Type_Bit_Field *a,struct Type_Bit_Field *b)
{
return 1;
}
- char types_of_enum_are_compatible_unqualified(struct Type_Enum *a,struct Type_Enum *b)
+ _Bool types_of_enum_are_compatible_unqualified(struct Type_Enum *a,struct Type_Enum *b)
{
return 1;
}
- char type_is_scalar(struct Type *type)
+ _Bool type_is_scalar(struct Type *type)
{
return (type->specifier==TS_CHAR || type->specifier==TS_INT || type->specifier==TS_FLOAT || type->specifier==TS_DOUBLE || type->specifier==TS_POINTER);
}
- char type_is_of_object(struct Type *type)
+ _Bool type_is_of_object(struct Type *type)
{
return !(type->specifier==TS_VOID || type->specifier==TS_FUNC || type->specifier==TS_NONE || type->specifier==TS_ERROR);
}
- char type_is_complete(struct Type *type)
+ _Bool type_is_complete(struct Type *type)
{
if(type->specifier==TS_ENUM)
{
return 1;
}
}
- char type_is_integer_type(struct Type *type)
+ _Bool type_is_integer_type(struct Type *type)
{
return type->specifier==TS_INT || type->specifier==TS_CHAR;
}
- char type_is_basic(struct Type *type)
+ _Bool type_is_basic(struct Type *type)
{
return (type->specifier==TS_INT || type->specifier==TS_CHAR || type->specifier==TS_DOUBLE || type->specifier==TS_FLOAT || type->specifier==TS_VOID);
}
- char type_is_arithmetic(struct Type *type)
+ _Bool type_is_arithmetic(struct Type *type)
{
return (type->specifier==TS_CHAR || type->specifier==TS_INT || type->specifier==TS_FLOAT || type->specifier==TS_DOUBLE );
}
- char type_is_aggregate(struct Type *type)
+ _Bool type_is_aggregate(struct Type *type)
{
return (type->specifier==TS_ARRAY || type->specifier==TS_UNION || type->specifier==TS_STRUCT);
}
- char type_is_struct_union(struct Type *type)
+ _Bool type_is_struct_union(struct Type *type)
{
return (type->specifier==TS_STRUCT || type->specifier==TS_UNION);
}
- char type_is_constant_or_has_constant_member(struct Type *type)
+ _Bool type_is_constant_or_has_constant_member(struct Type *type)
{
if(type->specifier==TS_STRUCT || type->specifier==TS_UNION)
{
}
}
- char type_is_qualified(struct Type *type)
+ _Bool type_is_qualified(struct Type *type)
{
return 1;
}
assert(0);
}
}
- char type_is_pointer(struct Type *type)
+ _Bool type_is_pointer(struct Type *type)
{
return (type->specifier==TS_POINTER);
}
- char type_is_pointer_to_object(struct Type *type)
+ _Bool type_is_pointer_to_object(struct Type *type)
{
return (type->specifier==TS_POINTER && type_is_of_object(AS_TYPE_PTR_PTR(type)->points_to));
}
- char type_is_pointer_to_incomplete_type(struct Type *type)
+ _Bool type_is_pointer_to_incomplete_type(struct Type *type)
{
return (type->specifier==TS_POINTER && !type_is_complete(AS_TYPE_PTR_PTR(type)->points_to));
}
- char type_is_pointer_to_void(struct Type *type)
+ _Bool type_is_pointer_to_void(struct Type *type)
{
return (type->specifier==TS_POINTER && type_is_basic(AS_TYPE_PTR_PTR(type)->points_to) && AS_BASIC_TYPE_PTR(AS_TYPE_PTR_PTR(type)->points_to)->specifier==TS_VOID);
}
- char type_is_real(struct Type *type)
+ _Bool type_is_real(struct Type *type)
{
/*TODO add _Complex keyword and check for it here*/
return type_is_floating(type) || type_is_integer_type(type);
}
- char type_is_floating(struct Type *type)
+ _Bool type_is_floating(struct Type *type)
{
return (type->specifier==TS_FLOAT || type->specifier==TS_DOUBLE);
}
- char type_is_constant(struct Type *type)
+ _Bool type_is_constant(struct Type *type)
{
switch(type->specifier)
{
}
return 0;
}
- char type_is_volatile(struct Type *type)
+ _Bool type_is_volatile(struct Type *type)
{
switch(type->specifier)
{
F diff --git a/src/semantics/value/type.h b/src/semantics/value/type.h
--- a/src/semantics/value/type.h
+++ b/src/semantics/value/type.h
struct Struct_Union* get_struct_union_base(struct Scope *scope ,enum Type_Specifier struct_or_union,struct token *id);
struct Enum *get_enum_base(struct token *id);
struct Type* get_basic_type(struct Denotation_Prototype *prototype);
- struct Type* get_pointer_type(struct Type *points_to,char is_const,char is_volatile);
+ struct Type* get_pointer_type(struct Type *points_to,_Bool is_const,_Bool is_volatile);
struct Type* get_array_type(struct Type *array_of,struct AST* number_of_elements,struct Translation_Data *translation_data);
struct Type* get_enum_type(struct Denotation_Prototype *prototype);
struct Type* get_function_type(struct Type *return_type,struct Queue *parameters,struct Normal_Scope* function_prototype_scope);
void delete_struct_union(struct Struct_Union *su);
void delete_type(void *type);
- char is_type(struct Translation_Data *translation_data,struct Scope *scope);
+ _Bool is_type(struct Translation_Data *translation_data,struct Scope *scope);
size_t get_type_size(struct Type *type);
- char types_are_identical(struct Type *a,struct Type *b);
- char types_are_compatible(struct Type *a,struct Type *b);
- char types_are_compatible_unqualified(struct Type *a,struct Type *b);
- char types_are_compatible_inner(struct Type *a,struct Type *b);
- char types_of_pointers_are_compatible_unqualified(struct Type_Pointer *a,struct Type_Pointer *b);
- char types_of_arrays_are_compatible_unqualified(struct Type_Array *a,struct Type_Array *b);
- char types_of_functions_are_compatible_unqualified(struct Type_Function *a,struct Type_Function *b);
- char types_of_struct_unions_are_compatible_unqualified(struct Struct_Union *a,struct Struct_Union *b);
- char types_of_bitfields_are_compatible_unqalified(struct Type_Bit_Field *a,struct Type_Bit_Field *b);
- char types_of_enum_are_compatible_unqualified(struct Type_Enum *a,struct Type_Enum *b);
-
- char type_is_of_object(struct Type *type);
- char type_is_complete(struct Type *type);
- char type_is_integer_type(struct Type *type);
- char type_is_basic(struct Type *type);
- char type_is_character(struct Type *type);
- char type_is_arithmetic(struct Type *type);
- char type_is_scalar(struct Type *type);
- char type_is_aggregate(struct Type *type);
- char type_is_struct_union(struct Type *type);
- char type_is_constant_or_has_constant_member(struct Type *type);
- char type_is_qualified(struct Type *type);
- char type_is_pointer(struct Type *type);
- char type_is_pointer_to_object(struct Type *type);
- char type_is_pointer_to_incomplete_type(struct Type *type);
- char type_is_pointer_to_void(struct Type *type);
- char type_is_real(struct Type *type);
- char type_is_floating(struct Type *type);
+ _Bool types_are_identical(struct Type *a,struct Type *b);
+ _Bool types_are_compatible(struct Type *a,struct Type *b);
+ _Bool types_are_compatible_unqualified(struct Type *a,struct Type *b);
+ _Bool types_are_compatible_inner(struct Type *a,struct Type *b);
+ _Bool types_of_pointers_are_compatible_unqualified(struct Type_Pointer *a,struct Type_Pointer *b);
+ _Bool types_of_arrays_are_compatible_unqualified(struct Type_Array *a,struct Type_Array *b);
+ _Bool types_of_functions_are_compatible_unqualified(struct Type_Function *a,struct Type_Function *b);
+ _Bool types_of_struct_unions_are_compatible_unqualified(struct Struct_Union *a,struct Struct_Union *b);
+ _Bool types_of_bitfields_are_compatible_unqalified(struct Type_Bit_Field *a,struct Type_Bit_Field *b);
+ _Bool types_of_enum_are_compatible_unqualified(struct Type_Enum *a,struct Type_Enum *b);
+
+ _Bool type_is_of_object(struct Type *type);
+ _Bool type_is_complete(struct Type *type);
+ _Bool type_is_integer_type(struct Type *type);
+ _Bool type_is_basic(struct Type *type);
+ _Bool type_is_character(struct Type *type);
+ _Bool type_is_arithmetic(struct Type *type);
+ _Bool type_is_scalar(struct Type *type);
+ _Bool type_is_aggregate(struct Type *type);
+ _Bool type_is_struct_union(struct Type *type);
+ _Bool type_is_constant_or_has_constant_member(struct Type *type);
+ _Bool type_is_qualified(struct Type *type);
+ _Bool type_is_pointer(struct Type *type);
+ _Bool type_is_pointer_to_object(struct Type *type);
+ _Bool type_is_pointer_to_incomplete_type(struct Type *type);
+ _Bool type_is_pointer_to_void(struct Type *type);
+ _Bool type_is_real(struct Type *type);
+ _Bool type_is_floating(struct Type *type);
/*these return 0 if constant/volatile-ness make no sense for the type*/
- char type_is_constant(struct Type *type);
- char type_is_volatile(struct Type *type);
+ _Bool type_is_constant(struct Type *type);
+ _Bool type_is_volatile(struct Type *type);
/*these return 0 if constant/volatile-ness make no sense for the type*/
- char type_is_constant(struct Type *type);
- char type_is_volatile(struct Type *type);
+ _Bool type_is_constant(struct Type *type);
+ _Bool type_is_volatile(struct Type *type);
int type_get_integer_conversion_rank(struct Type_Basic *type);