- used MINGW instead of Win32 again
[cparser] / type.c
diff --git a/type.c b/type.c
index 49c1e7e..4069148 100644 (file)
--- a/type.c
+++ b/type.c
@@ -167,10 +167,11 @@ void init_types(void)
 
        /* 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];
 }
@@ -299,12 +300,12 @@ static void print_function_type_post(const function_type_t *type,
 
        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);
                        }
@@ -314,7 +315,7 @@ static void print_function_type_post(const function_type_t *type,
                declaration_t *parameter = scope->declarations;
                for( ; parameter != NULL; parameter = parameter->next) {
                        if(first) {
-                               first = 0;
+                               first = false;
                        } else {
                                fputs(", ", out);
                        }
@@ -324,7 +325,7 @@ static void print_function_type_post(const function_type_t *type,
        }
        if(type->variadic) {
                if(first) {
-                       first = 0;
+                       first = false;
                } else {
                        fputs(", ", out);
                }
@@ -800,12 +801,19 @@ bool is_type_arithmetic(const type_t *type)
 {
        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);
+       }
 }
 
 /**
@@ -842,12 +850,12 @@ bool is_type_incomplete(const type_t *type)
        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:
        case TYPE_FUNCTION: