/* do default promotion */
for( ; argument != NULL; argument = argument->next) {
type_t *type = argument->expression->datatype;
+ type = skip_typeref(type);
if(type == NULL)
continue;
} else if(type == type_float) {
type = type_double;
}
+
argument->expression
= create_implicit_cast(argument->expression, type);
}
bool is_type_integer(const type_t *type)
{
+ assert(!is_typeref(type));
+
if(type->type == TYPE_ENUM)
return true;
bool is_type_floating(const type_t *type)
{
+ assert(!is_typeref(type));
+
if(type->type != TYPE_ATOMIC)
return false;
bool is_type_signed(const type_t *type)
{
+ assert(!is_typeref(type));
+
/* enum types are int for now */
if(type->type == TYPE_ENUM)
return true;
bool is_type_arithmetic(const type_t *type)
{
+ assert(!is_typeref(type));
+
if(is_type_integer(type) || is_type_floating(type))
return 1;
bool is_type_scalar(const type_t *type)
{
+ assert(!is_typeref(type));
+
if(type->type == TYPE_POINTER)
return 1;
bool is_type_incomplete(const type_t *type)
{
+ assert(!is_typeref(type));
+
switch(type->type) {
case TYPE_COMPOUND_STRUCT:
case TYPE_COMPOUND_UNION: {
bool types_compatible(const type_t *type1, const type_t *type2)
{
+ assert(!is_typeref(type1));
+ assert(!is_typeref(type2));
+
/* TODO: really incomplete */
if(type1 == type2)
return true;
bool pointers_compatible(const type_t *type1, const type_t *type2)
{
+ assert(!is_typeref(type1));
+ assert(!is_typeref(type2));
+
assert(type1->type == TYPE_POINTER);
assert(type2->type == TYPE_POINTER);
#if 0