diff options
author | 2004-10-29 11:58:42 -0700 | |
---|---|---|
committer | 2005-04-07 21:03:50 -0700 | |
commit | 9fb615407dca8d4835971ec4668a435845038c12 (patch) | |
tree | d5710b05e7525749bc98cbd7b5d77fbcc5956053 /symbol.c | |
parent | Implement a C99-like _Bool type. (diff) | |
download | sparse-9fb615407dca8d4835971ec4668a435845038c12.tar.gz sparse-9fb615407dca8d4835971ec4668a435845038c12.tar.bz2 sparse-9fb615407dca8d4835971ec4668a435845038c12.zip |
Use 'bad_type' instead of NULL when something bad happens
in type evaluation.
This avoids a lot of special cases later on, and makes the
error messages more readable anyway.
We re-use the old "bad_enum_ctype" for this, and just make
it more generic (and rename it).
Diffstat (limited to 'symbol.c')
-rw-r--r-- | symbol.c | 10 |
1 files changed, 4 insertions, 6 deletions
@@ -309,7 +309,7 @@ static struct symbol *examine_enum_type(struct symbol *sym) { struct symbol *base_type = examine_base_type(sym); - if (!base_type || base_type == &bad_enum_ctype) { + if (!base_type || base_type == &bad_ctype) { warning(sym->pos, "invalid enum type"); sym->bit_size = -1; return sym; @@ -618,9 +618,7 @@ static struct sym_init eval_init_table[] = { * Abstract types */ struct symbol int_type, - fp_type, - vector_type, - bad_type; + fp_type; /* * C types (ie actual instances that the abstract types @@ -634,7 +632,7 @@ struct symbol bool_ctype, void_ctype, type_ctype, llong_ctype, sllong_ctype, ullong_ctype, float_ctype, double_ctype, ldouble_ctype, string_ctype, ptr_ctype, lazy_ptr_ctype, - incomplete_ctype, label_ctype, bad_enum_ctype; + incomplete_ctype, label_ctype, bad_ctype; #define __INIT_IDENT(str, res) { .len = sizeof(str)-1, .name = str, .reserved = res } @@ -684,7 +682,7 @@ static const struct ctype_declare { { &void_ctype, SYM_BASETYPE, 0, NULL, NULL, NULL }, { &type_ctype, SYM_BASETYPE, MOD_TYPE, NULL, NULL, NULL }, { &incomplete_ctype,SYM_BASETYPE, 0, NULL, NULL, NULL }, - { &bad_enum_ctype, SYM_BAD, 0, NULL, NULL, NULL }, + { &bad_ctype, SYM_BASETYPE, 0, NULL, NULL, NULL }, { &char_ctype, SYM_BASETYPE, MOD_SIGNED | MOD_CHAR, &bits_in_char, &max_int_alignment, &int_type }, { &schar_ctype, SYM_BASETYPE, MOD_ESIGNED | MOD_CHAR, &bits_in_char, &max_int_alignment, &int_type }, |