remove TYPE_INVALID, TYPE_ERROR is enough
authorMatthias Braun <matze@braunis.de>
Sat, 13 Aug 2011 11:41:24 +0000 (13:41 +0200)
committerMatthias Braun <matze@braunis.de>
Sat, 13 Aug 2011 11:41:24 +0000 (13:41 +0200)
ast2firm.c
mangle.c
type.c
type.h
type_hash.c
type_t.h
walk.c
wrappergen/write_fluffy.c
wrappergen/write_jna.c

index cc5d6a0..5089a01 100644 (file)
@@ -741,7 +741,6 @@ ir_type *get_ir_type(type_t *type)
 
        case TYPE_TYPEOF:
        case TYPE_TYPEDEF:
-       case TYPE_INVALID:
                break;
        }
        if (firm_type == NULL)
@@ -3331,7 +3330,6 @@ static ir_node *classify_type_to_firm(const classify_type_expression_t *const ex
                        /* typedef/typeof should be skipped already */
                        case TYPE_TYPEDEF:
                        case TYPE_TYPEOF:
-                       case TYPE_INVALID:
                        case TYPE_ERROR:
                                break;
                }
index d932f27..2291001 100644 (file)
--- a/mangle.c
+++ b/mangle.c
@@ -38,7 +38,7 @@ static void mangle_type(type_t *type);
 static char get_atomic_type_mangle(atomic_type_kind_t kind)
 {
        switch (kind) {
-       case ATOMIC_TYPE_INVALID: break;
+       case ATOMIC_TYPE_INVALID:     break;
        case ATOMIC_TYPE_VOID:        return 'v';
        case ATOMIC_TYPE_WCHAR_T:     return 'w';
        case ATOMIC_TYPE_BOOL:        return 'b';
@@ -211,8 +211,6 @@ static void mangle_type(type_t *orig_type)
        case TYPE_IMAGINARY:
                mangle_imaginary_type(&type->imaginary);
                return;
-       case TYPE_INVALID:
-               panic("invalid type encountered while mangling");
        case TYPE_ERROR:
                panic("error type encountered while mangling");
        case TYPE_TYPEDEF:
diff --git a/type.c b/type.c
index c2484b8..10500c3 100644 (file)
--- a/type.c
+++ b/type.c
@@ -633,9 +633,6 @@ static void intern_print_type_pre(const type_t *const type)
        case TYPE_ERROR:
                print_string("<error>");
                return;
-       case TYPE_INVALID:
-               print_string("<invalid>");
-               return;
        case TYPE_ENUM:
                print_type_enum(&type->enumt);
                return;
@@ -695,7 +692,6 @@ static void intern_print_type_post(const type_t *const type)
                print_array_type_post(&type->array);
                return;
        case TYPE_ERROR:
-       case TYPE_INVALID:
        case TYPE_ATOMIC:
        case TYPE_COMPLEX:
        case TYPE_IMAGINARY:
@@ -799,17 +795,6 @@ type_t *get_qualified_type(type_t *orig_type, type_qualifiers_t const qual)
        return identify_new_type(copy);
 }
 
-/**
- * Check if a type is valid.
- *
- * @param type  The type to check.
- * @return true if type represents a valid type.
- */
-bool type_valid(const type_t *type)
-{
-       return type->kind != TYPE_INVALID;
-}
-
 static bool test_atomic_type_flag(atomic_type_kind_t kind,
                                   atomic_type_flag_t flag)
 {
@@ -991,8 +976,6 @@ bool is_type_incomplete(const type_t *type)
        case TYPE_TYPEDEF:
        case TYPE_TYPEOF:
                panic("is_type_incomplete called without typerefs skipped");
-       case TYPE_INVALID:
-               break;
        }
 
        panic("invalid type found");
@@ -1130,8 +1113,6 @@ bool types_compatible(const type_t *type1, const type_t *type2)
        case TYPE_ERROR:
                /* Hmm, the error type should be compatible to all other types */
                return true;
-       case TYPE_INVALID:
-               panic("invalid type found in compatible types");
        case TYPE_TYPEDEF:
        case TYPE_TYPEOF:
                panic("typerefs not skipped in compatible types?!?");
@@ -1195,8 +1176,6 @@ type_t *skip_typeref(type_t *type)
 unsigned get_type_size(type_t *type)
 {
        switch (type->kind) {
-       case TYPE_INVALID:
-               break;
        case TYPE_ERROR:
                return 0;
        case TYPE_ATOMIC:
@@ -1238,8 +1217,6 @@ unsigned get_type_size(type_t *type)
 unsigned get_type_alignment(type_t *type)
 {
        switch (type->kind) {
-       case TYPE_INVALID:
-               break;
        case TYPE_ERROR:
                return 0;
        case TYPE_ATOMIC:
@@ -1292,7 +1269,6 @@ unsigned get_type_alignment_compound(type_t *type)
 decl_modifiers_t get_type_modifiers(const type_t *type)
 {
        switch(type->kind) {
-       case TYPE_INVALID:
        case TYPE_ERROR:
                break;
        case TYPE_COMPOUND_STRUCT:
diff --git a/type.h b/type.h
index 41bbada..d3414b6 100644 (file)
--- a/type.h
+++ b/type.h
@@ -153,12 +153,6 @@ bool is_type_complex(const type_t *type);
 
 bool is_type_real(const type_t *type);
 
-/**
- * returns true if the type is valid. A type is valid if it contains no
- * unresolved references anymore and is not of TYPE_INVALID.
- */
-bool type_valid(const type_t *type);
-
 /**
  * returns true if the type is an arithmetic type (ยง6.2.5 clause 18)
  */
index a931f7d..256cdd2 100644 (file)
@@ -126,8 +126,6 @@ static unsigned hash_type(const type_t *type)
        unsigned hash = 0;
 
        switch (type->kind) {
-       case TYPE_INVALID:
-               panic("internalizing void or invalid types not possible");
        case TYPE_ERROR:
                return 0;
        case TYPE_ATOMIC:
@@ -299,8 +297,6 @@ static bool types_equal(const type_t *type1, const type_t *type2)
        case TYPE_ERROR:
                /* Hmm, the error type is never equal */
                return false;
-       case TYPE_INVALID:
-               return false;
        case TYPE_ATOMIC:
                return atomic_types_equal(&type1->atomic, &type2->atomic);
        case TYPE_COMPLEX:
index 1d3ab4c..68e0966 100644 (file)
--- a/type_t.h
+++ b/type_t.h
@@ -32,7 +32,6 @@
 #include "adt/obst.h"
 
 typedef enum type_kind_t {
-       TYPE_INVALID,
        TYPE_ERROR,
        TYPE_ATOMIC,
        TYPE_COMPLEX,
diff --git a/walk.c b/walk.c
index 6724872..d1cd35d 100644 (file)
--- a/walk.c
+++ b/walk.c
@@ -82,8 +82,6 @@ static void walk_type(type_t *const type, const walk_env_t *const env)
        case TYPE_ENUM:
                walk_entity((entity_t*)type->enumt.enume, env);
                return;
-       case TYPE_INVALID:
-               break;
        }
        panic("invalid type found");
 }
index f1a4021..f3f752f 100644 (file)
@@ -173,8 +173,6 @@ static void write_type(const type_t *type)
        case TYPE_FUNCTION:
                write_function_type(&type->function);
                return;
-       case TYPE_INVALID:
-               panic("invalid type found");
        case TYPE_COMPLEX:
        case TYPE_IMAGINARY:
        default:
index 6f51464..1739481 100644 (file)
@@ -223,7 +223,6 @@ static void write_type(type_t *type)
                write_enum_type(&type->enumt);
                return;
        case TYPE_ERROR:
-       case TYPE_INVALID:
        case TYPE_TYPEOF:
        case TYPE_TYPEDEF:
                panic("invalid type found");