Use is_type_compound().
authorChristoph Mallon <christoph.mallon@gmx.de>
Thu, 14 Jun 2012 07:56:20 +0000 (09:56 +0200)
committerChristoph Mallon <christoph.mallon@gmx.de>
Thu, 14 Jun 2012 08:38:12 +0000 (10:38 +0200)
parser.c
wrappergen/write_fluffy.c
wrappergen/write_jna.c

index ccba03f..abd38c9 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -5472,8 +5472,7 @@ static expression_t *find_create_select(const source_position_t *pos,
                symbol_t *iter_symbol = iter->base.symbol;
                if (iter_symbol == NULL) {
                        type_t *type = iter->declaration.type;
-                       if (type->kind != TYPE_COMPOUND_STRUCT
-                                       && type->kind != TYPE_COMPOUND_UNION)
+                       if (!is_type_compound(type))
                                continue;
 
                        compound_t *sub_compound = type->compound.compound;
@@ -6859,9 +6858,7 @@ static expression_t *parse_select_expression(expression_t *addr)
                type_left = type;
        }
 
-       if (type_left->kind != TYPE_COMPOUND_STRUCT &&
-           type_left->kind != TYPE_COMPOUND_UNION) {
-
+       if (!is_type_compound(type_left)) {
                if (is_type_valid(type_left) && !saw_error) {
                        errorf(&pos,
                               "request for member '%Y' in something not a struct or union, but '%T'",
index ddf940f..028adfd 100644 (file)
@@ -319,8 +319,7 @@ void write_fluffy_decls(FILE *output, const translation_unit_t *unit)
                        continue;
 
                type_t *type = entity->typedefe.type;
-               if(type->kind == TYPE_COMPOUND_STRUCT
-                               || type->kind == TYPE_COMPOUND_UNION) {
+               if (is_type_compound(type)) {
                        write_compound(entity->base.symbol, &type->compound);
                } else if(type->kind == TYPE_ENUM) {
                        write_enum(entity->base.symbol, &type->enumt);
index d4d7d1b..d681f47 100644 (file)
@@ -517,8 +517,7 @@ void write_jna_decls(FILE *output, const translation_unit_t *unit)
                }
 
 #if 0
-               if(type->kind == TYPE_COMPOUND_STRUCT
-                               || type->kind == TYPE_COMPOUND_UNION) {
+               if (is_type_compound(type)) {
                        write_compound(entity->base.symbol, &type->compound);
                }
 #endif