/* TODO: backend specific, need a way to query the backend for this.
* The following are good settings for x86 */
- props[ATOMIC_TYPE_FLOAT].alignment = 4;
- props[ATOMIC_TYPE_DOUBLE].alignment = 4;
- props[ATOMIC_TYPE_LONGLONG].alignment = 4;
- props[ATOMIC_TYPE_ULONGLONG].alignment = 4;
+ props[ATOMIC_TYPE_FLOAT].alignment = 4;
+ props[ATOMIC_TYPE_DOUBLE].alignment = 4;
+ props[ATOMIC_TYPE_LONG_DOUBLE].alignment = 4;
+ props[ATOMIC_TYPE_LONGLONG].alignment = 4;
+ props[ATOMIC_TYPE_ULONGLONG].alignment = 4;
props[ATOMIC_TYPE_BOOL] = props[ATOMIC_TYPE_UINT];
}
fputc('(', out);
- int first = 1;
+ bool first = true;
if(scope == NULL) {
function_parameter_t *parameter = type->parameters;
for( ; parameter != NULL; parameter = parameter->next) {
if(first) {
- first = 0;
+ first = false;
} else {
fputs(", ", out);
}
declaration_t *parameter = scope->declarations;
for( ; parameter != NULL; parameter = parameter->next) {
if(first) {
- first = 0;
+ first = false;
} else {
fputs(", ", out);
}
}
if(type->variadic) {
if(first) {
- first = 0;
+ first = false;
} else {
fputs(", ", out);
}
if(type->kind == TYPE_ENUM)
return true;
+ if(type->kind == TYPE_BITFIELD)
+ return true;
if(type->kind != TYPE_ATOMIC)
return false;
/* enum types are int for now */
if(type->kind == TYPE_ENUM)
return true;
+ if(type->kind == TYPE_BITFIELD)
+ return is_type_signed(type->bitfield.base_type);
if(type->kind != TYPE_ATOMIC)
return false;
{
assert(!is_typeref(type));
- if(type->kind == TYPE_BITFIELD || type->kind == TYPE_ENUM)
+ switch(type->kind) {
+ case TYPE_BITFIELD:
+ case TYPE_ENUM:
return true;
- if(type->kind != TYPE_ATOMIC)
+ case TYPE_ATOMIC:
+ return test_atomic_type_flag(type->atomic.akind, ATOMIC_TYPE_FLAG_ARITHMETIC);
+ case TYPE_COMPLEX:
+ return test_atomic_type_flag(type->complex.akind, ATOMIC_TYPE_FLAG_ARITHMETIC);
+ case TYPE_IMAGINARY:
+ return test_atomic_type_flag(type->imaginary.akind, ATOMIC_TYPE_FLAG_ARITHMETIC);
+ default:
return false;
-
- return test_atomic_type_flag(type->atomic.akind, ATOMIC_TYPE_FLAG_ARITHMETIC);
+ }
}
/**
case TYPE_COMPOUND_UNION: {
const compound_type_t *compound_type = &type->compound;
declaration_t *declaration = compound_type->declaration;
- return !declaration->init.is_defined;
+ return !declaration->init.complete;
}
case TYPE_ENUM: {
const enum_type_t *enum_type = &type->enumt;
declaration_t *declaration = enum_type->declaration;
- return !declaration->init.is_defined;
+ return !declaration->init.complete;
}
case TYPE_BITFIELD:
+ return false;
+
case TYPE_FUNCTION:
return true;
case TYPE_ARRAY:
- return type->array.size_expression == NULL;
+ return type->array.size_expression == NULL
+ && !type->array.size_constant;
case TYPE_ATOMIC:
return type->atomic.akind == ATOMIC_TYPE_VOID;