mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-22 20:41:20 +00:00
Change pointer_t to unsigned and clean up the mess.
It doesn't make sense to have negative pointers. The size of the commit is from enabling gcc's -Wtype-limits warning and cleaning up that mess too.
This commit is contained in:
parent
7701393bd4
commit
6eb6b6c0ba
25 changed files with 55 additions and 57 deletions
|
@ -190,6 +190,7 @@ QF_CC_OPTION(-Wsign-compare)
|
||||||
if test $CC_MAJ -gt 4 -o $CC_MAJ -eq 4 -a $CC_MIN -ge 5; then
|
if test $CC_MAJ -gt 4 -o $CC_MAJ -eq 4 -a $CC_MIN -ge 5; then
|
||||||
QF_CC_OPTION(-Wlogical-op)
|
QF_CC_OPTION(-Wlogical-op)
|
||||||
fi
|
fi
|
||||||
|
QF_CC_OPTION(-Wtype-limits)
|
||||||
QF_CC_OPTION_TEST([-fvisibility=hidden], [VISIBILITY=-fvisibility=hidden])
|
QF_CC_OPTION_TEST([-fvisibility=hidden], [VISIBILITY=-fvisibility=hidden])
|
||||||
|
|
||||||
dnl QuakeForge uses lots of BCPL-style (//) comments, which can cause problems
|
dnl QuakeForge uses lots of BCPL-style (//) comments, which can cause problems
|
||||||
|
|
|
@ -29,7 +29,7 @@ typedef int32_t pr_int_t;
|
||||||
typedef uint32_t pr_uint_t;
|
typedef uint32_t pr_uint_t;
|
||||||
typedef pr_int_t func_t;
|
typedef pr_int_t func_t;
|
||||||
typedef pr_int_t string_t;
|
typedef pr_int_t string_t;
|
||||||
typedef pr_int_t pointer_t;
|
typedef pr_uint_t pointer_t;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
ev_void,
|
ev_void,
|
||||||
|
|
|
@ -206,7 +206,7 @@ int PR_RunLoadFuncs (progs_t *pr);
|
||||||
*/
|
*/
|
||||||
int PR_Check_Opcodes (progs_t *pr);
|
int PR_Check_Opcodes (progs_t *pr);
|
||||||
|
|
||||||
void PR_BoundsCheckSize (progs_t *pr, int addr, unsigned size);
|
void PR_BoundsCheckSize (progs_t *pr, pointer_t addr, unsigned size);
|
||||||
void PR_BoundsCheck (progs_t *pr, int addr, etype_t type);
|
void PR_BoundsCheck (progs_t *pr, int addr, etype_t type);
|
||||||
|
|
||||||
//@}
|
//@}
|
||||||
|
@ -1577,7 +1577,7 @@ struct progs_s {
|
||||||
ddef_t *pr_fielddefs;
|
ddef_t *pr_fielddefs;
|
||||||
dstatement_t *pr_statements;
|
dstatement_t *pr_statements;
|
||||||
pr_type_t *pr_globals;
|
pr_type_t *pr_globals;
|
||||||
int globals_size;
|
unsigned globals_size;
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
/// \name parameter block
|
/// \name parameter block
|
||||||
|
@ -1630,8 +1630,8 @@ struct progs_s {
|
||||||
|
|
||||||
/// \name obj info
|
/// \name obj info
|
||||||
//@{
|
//@{
|
||||||
int selector_index;
|
unsigned selector_index;
|
||||||
int selector_index_max;
|
unsigned selector_index_max;
|
||||||
struct obj_list_s **selector_sels;
|
struct obj_list_s **selector_sels;
|
||||||
string_t *selector_names;
|
string_t *selector_names;
|
||||||
struct hashtab_s *selector_hash;
|
struct hashtab_s *selector_hash;
|
||||||
|
|
|
@ -478,7 +478,7 @@ SND_SetPaint (sfxbuffer_t *sc)
|
||||||
};
|
};
|
||||||
|
|
||||||
wavinfo_t *info = sc->sfx->wavinfo (sc->sfx);
|
wavinfo_t *info = sc->sfx->wavinfo (sc->sfx);
|
||||||
if (info->channels < 0 || info->channels > 8)
|
if (info->channels > 8)
|
||||||
Sys_Error ("illegal channel count %d", info->channels);
|
Sys_Error ("illegal channel count %d", info->channels);
|
||||||
sc->paint = painters[info->channels];
|
sc->paint = painters[info->channels];
|
||||||
}
|
}
|
||||||
|
|
|
@ -395,8 +395,7 @@ PR_Get_Lineno_Addr (progs_t *pr, pr_lineno_t *lineno)
|
||||||
|
|
||||||
if (lineno->line)
|
if (lineno->line)
|
||||||
return lineno->fa.addr;
|
return lineno->fa.addr;
|
||||||
if (lineno->fa.func >= 0
|
if (lineno->fa.func < pr->debug->num_auxfunctions) {
|
||||||
&& lineno->fa.func < pr->debug->num_auxfunctions) {
|
|
||||||
f = &pr->auxfunctions[lineno->fa.func];
|
f = &pr->auxfunctions[lineno->fa.func];
|
||||||
return pr->pr_functions[f->function].first_statement;
|
return pr->pr_functions[f->function].first_statement;
|
||||||
}
|
}
|
||||||
|
@ -701,7 +700,7 @@ def_string (progs_t *pr, pr_int_t ofs, dstring_t *dstr)
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
global_string (progs_t *pr, pr_int_t ofs, etype_t type, int contents)
|
global_string (progs_t *pr, pointer_t ofs, etype_t type, int contents)
|
||||||
{
|
{
|
||||||
static dstring_t *line = NULL;
|
static dstring_t *line = NULL;
|
||||||
ddef_t *def = NULL;
|
ddef_t *def = NULL;
|
||||||
|
|
|
@ -255,9 +255,9 @@ PR_LeaveFunction (progs_t *pr)
|
||||||
}
|
}
|
||||||
|
|
||||||
VISIBLE void
|
VISIBLE void
|
||||||
PR_BoundsCheckSize (progs_t *pr, int addr, unsigned size)
|
PR_BoundsCheckSize (progs_t *pr, pointer_t addr, unsigned size)
|
||||||
{
|
{
|
||||||
if (addr < 0 || addr >= pr->globals_size
|
if (addr >= pr->globals_size
|
||||||
|| size > (unsigned) (pr->globals_size - addr))
|
|| size > (unsigned) (pr->globals_size - addr))
|
||||||
PR_RunError (pr, "invalid memory access: %d (0 to %d-%d)", addr,
|
PR_RunError (pr, "invalid memory access: %d (0 to %d-%d)", addr,
|
||||||
pr->globals_size, size);
|
pr->globals_size, size);
|
||||||
|
|
|
@ -103,13 +103,13 @@ GIB_Execute_Split_Var (cbuf_t * cbuf)
|
||||||
&GIB_DATA (cbuf)->globals,
|
&GIB_DATA (cbuf)->globals,
|
||||||
str, &i, false)))
|
str, &i, false)))
|
||||||
return;
|
return;
|
||||||
if (end < 0)
|
if ((int) end < 0)
|
||||||
end += var->size;
|
end += var->size;
|
||||||
else if (end > var->size)
|
else if (end > var->size)
|
||||||
end = var->size;
|
end = var->size;
|
||||||
if (start < 0) {
|
if ((int) start < 0) {
|
||||||
start += var->size;
|
start += var->size;
|
||||||
if (start < 0)
|
if ((int) start < 0)
|
||||||
start = 0;
|
start = 0;
|
||||||
} else if (start >= var->size || start >= end)
|
} else if (start >= var->size || start >= end)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1653,7 +1653,7 @@ static int
|
||||||
rua_init_runtime (progs_t *pr)
|
rua_init_runtime (progs_t *pr)
|
||||||
{
|
{
|
||||||
ddef_t *def;
|
ddef_t *def;
|
||||||
int i;
|
unsigned i;
|
||||||
|
|
||||||
if (!pr->selector_hash)
|
if (!pr->selector_hash)
|
||||||
pr->selector_hash = Hash_NewTable (1021, selector_get_key, 0, pr);
|
pr->selector_hash = Hash_NewTable (1021, selector_get_key, 0, pr);
|
||||||
|
|
|
@ -107,10 +107,10 @@ Hash_String (const char *str)
|
||||||
// dx_hack_hash
|
// dx_hack_hash
|
||||||
// shamelessly stolen from Daniel Phillips <phillips@innominate.de>
|
// shamelessly stolen from Daniel Phillips <phillips@innominate.de>
|
||||||
// from his post to lkml
|
// from his post to lkml
|
||||||
unsigned long hash0 = 0x12a3fe2d, hash1 = 0x37abe8f9;
|
uint32_t hash0 = 0x12a3fe2d, hash1 = 0x37abe8f9;
|
||||||
while (*str) {
|
while (*str) {
|
||||||
unsigned long hash = hash1 + (hash0 ^ ((unsigned char)*str++ * 71523));
|
uint32_t hash = hash1 + (hash0 ^ ((unsigned char)*str++ * 71523));
|
||||||
if (hash < 0) hash -= 0x7fffffff;
|
if (hash & 0x80000000) hash -= 0x7fffffff;
|
||||||
hash1 = hash0;
|
hash1 = hash0;
|
||||||
hash0 = hash;
|
hash0 = hash;
|
||||||
}
|
}
|
||||||
|
@ -134,10 +134,10 @@ Hash_Buffer (const void *_buf, int len)
|
||||||
// dx_hack_hash
|
// dx_hack_hash
|
||||||
// shamelessly stolen from Daniel Phillips <phillips@innominate.de>
|
// shamelessly stolen from Daniel Phillips <phillips@innominate.de>
|
||||||
// from his post to lkml
|
// from his post to lkml
|
||||||
unsigned long hash0 = 0x12a3fe2d, hash1 = 0x37abe8f9;
|
uint32_t hash0 = 0x12a3fe2d, hash1 = 0x37abe8f9;
|
||||||
while (len-- > 0) {
|
while (len-- > 0) {
|
||||||
unsigned long hash = hash1 + (hash0 ^ ((unsigned char)*buf++ * 71523));
|
uint32_t hash = hash1 + (hash0 ^ ((unsigned char)*buf++ * 71523));
|
||||||
if (hash < 0) hash -= 0x7fffffff;
|
if (hash & 0x80000000) hash -= 0x7fffffff;
|
||||||
hash1 = hash0;
|
hash1 = hash0;
|
||||||
hash0 = hash;
|
hash0 = hash;
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ noise_diamondsquare (unsigned char *noise, unsigned int size,
|
||||||
if (startgrid != (unsigned int) (1 << gridpower))
|
if (startgrid != (unsigned int) (1 << gridpower))
|
||||||
Sys_Error("fractalnoise: grid must be power of 2");
|
Sys_Error("fractalnoise: grid must be power of 2");
|
||||||
|
|
||||||
startgrid = bound(0, startgrid, size);
|
startgrid = min(startgrid, size);
|
||||||
amplitude = 0xFFFF; // this gets halved before use
|
amplitude = 0xFFFF; // this gets halved before use
|
||||||
noisebuf = calloc (size * size, sizeof (int));
|
noisebuf = calloc (size * size, sizeof (int));
|
||||||
memset(noisebuf, 0, size * size * sizeof(int));
|
memset(noisebuf, 0, size * size * sizeof(int));
|
||||||
|
@ -121,8 +121,8 @@ noise_diamondsquare (unsigned char *noise, unsigned int size,
|
||||||
void
|
void
|
||||||
noise_plasma (unsigned char *noise, int size)
|
noise_plasma (unsigned char *noise, int size)
|
||||||
{
|
{
|
||||||
unsigned int a, b, c, d, i;
|
unsigned int a, b, c, i;
|
||||||
int j, k;
|
int d, j, k;
|
||||||
|
|
||||||
if (128 >= size)
|
if (128 >= size)
|
||||||
d = 64 / size;
|
d = 64 / size;
|
||||||
|
|
|
@ -305,7 +305,7 @@ static pt_phys_func part_phys[] = {
|
||||||
pt_phys_func
|
pt_phys_func
|
||||||
R_ParticlePhysics (ptype_t type)
|
R_ParticlePhysics (ptype_t type)
|
||||||
{
|
{
|
||||||
if (type < pt_static || type > pt_flame)
|
if (type > pt_flame)
|
||||||
Sys_Error ("R_ParticlePhysics: invalid particle type");
|
Sys_Error ("R_ParticlePhysics: invalid particle type");
|
||||||
return part_phys[type];
|
return part_phys[type];
|
||||||
}
|
}
|
||||||
|
|
|
@ -265,7 +265,7 @@ Draw_Character (int x, int y, unsigned int chr)
|
||||||
|
|
||||||
if (y > vid.conheight - 8 || x < 0 || x > vid.conwidth - 8)
|
if (y > vid.conheight - 8 || x < 0 || x > vid.conwidth - 8)
|
||||||
return;
|
return;
|
||||||
if (chr < 0 || chr > 255)
|
if (chr > 255)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
row = chr >> 4;
|
row = chr >> 4;
|
||||||
|
|
|
@ -267,7 +267,7 @@ sw32_Draw_Character (int x, int y, unsigned int chr)
|
||||||
|
|
||||||
if (y > vid.conheight - 8 || x < 0 || x > vid.conwidth - 8)
|
if (y > vid.conheight - 8 || x < 0 || x > vid.conwidth - 8)
|
||||||
return;
|
return;
|
||||||
if (chr < 0 || chr > 255)
|
if (chr > 255)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
row = chr >> 4;
|
row = chr >> 4;
|
||||||
|
|
|
@ -1319,8 +1319,8 @@ SV_StringToFilter (const char *address, ipfilter_t *f)
|
||||||
if (mask == -1) {
|
if (mask == -1) {
|
||||||
if (sv_filter_automask->int_val) {
|
if (sv_filter_automask->int_val) {
|
||||||
mask = sizeof (b) * 8;
|
mask = sizeof (b) * 8;
|
||||||
i = sizeof (b) - 1;
|
i = sizeof (b);
|
||||||
while (i >= 0 && !b[i]) {
|
while (i > 0 && !b[i - 1]) {
|
||||||
mask -= 8;
|
mask -= 8;
|
||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
|
|
|
@ -159,7 +159,7 @@ plotpoint (image_t *image, long xco, long yco, unsigned int color)
|
||||||
|
|
||||||
bigcol += color;
|
bigcol += color;
|
||||||
|
|
||||||
bigcol = bound (0, bigcol, 255);
|
bigcol = min (bigcol, 255);
|
||||||
|
|
||||||
image->image[yco * image->width + xco] = (eightbit) bigcol;
|
image->image[yco * image->width + xco] = (eightbit) bigcol;
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ typedef struct qfo_space_s {
|
||||||
pr_int_t defs; ///< index of first def
|
pr_int_t defs; ///< index of first def
|
||||||
pr_int_t num_defs; ///< zero for code or string spaces
|
pr_int_t num_defs; ///< zero for code or string spaces
|
||||||
pr_int_t data; ///< byte offset in qfo
|
pr_int_t data; ///< byte offset in qfo
|
||||||
pr_int_t data_size; ///< in elements. zero for entity spaces
|
pr_uint_t data_size; ///< in elements. zero for entity spaces
|
||||||
pr_int_t id;
|
pr_int_t id;
|
||||||
pr_int_t reserved[2];
|
pr_int_t reserved[2];
|
||||||
} qfo_space_t;
|
} qfo_space_t;
|
||||||
|
@ -240,7 +240,7 @@ typedef struct qfo_reloc_s {
|
||||||
pr_int_t space; ///< index of space holding data to be adjusted
|
pr_int_t space; ///< index of space holding data to be adjusted
|
||||||
pr_int_t offset; ///< offset of the relocation
|
pr_int_t offset; ///< offset of the relocation
|
||||||
pr_int_t type; ///< type of the relocation (::reloc_type)
|
pr_int_t type; ///< type of the relocation (::reloc_type)
|
||||||
pr_int_t target; ///< def/func/etc this relocation is for
|
pr_uint_t target; ///< def/func/etc this relocation is for
|
||||||
} qfo_reloc_t;
|
} qfo_reloc_t;
|
||||||
|
|
||||||
/** In-memory representation of a QFO space
|
/** In-memory representation of a QFO space
|
||||||
|
@ -254,7 +254,7 @@ typedef struct qfo_mspace_s {
|
||||||
pr_type_t *data;
|
pr_type_t *data;
|
||||||
char *strings;
|
char *strings;
|
||||||
} d;
|
} d;
|
||||||
int data_size;
|
unsigned data_size;
|
||||||
int id;
|
int id;
|
||||||
} qfo_mspace_t;
|
} qfo_mspace_t;
|
||||||
|
|
||||||
|
|
|
@ -1487,7 +1487,7 @@ fold_constants (expr_t *e)
|
||||||
if (op == 'A' || op == 'g' || op == 'r')
|
if (op == 'A' || op == 'g' || op == 'r')
|
||||||
return e;
|
return e;
|
||||||
t1 = extract_type (e1);
|
t1 = extract_type (e1);
|
||||||
if (t1 < 0 || t1 >= ev_type_count || !do_unary_op[t1]) {
|
if (t1 >= ev_type_count || !do_unary_op[t1]) {
|
||||||
print_expr (e);
|
print_expr (e);
|
||||||
internal_error (e, "invalid type: %d", t1);
|
internal_error (e, "invalid type: %d", t1);
|
||||||
}
|
}
|
||||||
|
@ -1519,7 +1519,7 @@ fold_constants (expr_t *e)
|
||||||
if (op == 's')
|
if (op == 's')
|
||||||
return e;
|
return e;
|
||||||
|
|
||||||
if (t1 < 0 || t1 >= ev_type_count || t2 < 0 || t2 >= ev_type_count
|
if (t1 >= ev_type_count || t2 >= ev_type_count
|
||||||
|| !do_op[t1] || !do_op[t1][t2])
|
|| !do_op[t1] || !do_op[t1][t2])
|
||||||
internal_error (e, "invalid type");
|
internal_error (e, "invalid type");
|
||||||
return do_op[t1][t2] (op, e, e1, e2);
|
return do_op[t1][t2] (op, e, e1, e2);
|
||||||
|
|
|
@ -466,7 +466,7 @@ _print_expr (dstring_t *dstr, expr_t *e, int level, int id, expr_t *next)
|
||||||
return;
|
return;
|
||||||
e->printid = id;
|
e->printid = id;
|
||||||
|
|
||||||
if (e->type < 0 || e->type > ex_value) {
|
if ((int) e->type < 0 || e->type > ex_value) {
|
||||||
dasprintf (dstr, "%*se_%p [label=\"(bad expr type)\\n%d\"];\n",
|
dasprintf (dstr, "%*se_%p [label=\"(bad expr type)\\n%d\"];\n",
|
||||||
indent, "", e, e->line);
|
indent, "", e, e->line);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -60,10 +60,9 @@ dump_lines (progs_t *pr)
|
||||||
if (!lineno->line) {
|
if (!lineno->line) {
|
||||||
aux_func = 0;
|
aux_func = 0;
|
||||||
func = 0;
|
func = 0;
|
||||||
if (lineno->fa.func >= 0
|
if (lineno->fa.func < pr->debug->num_auxfunctions)
|
||||||
&& lineno->fa.func < pr->debug->num_auxfunctions)
|
|
||||||
aux_func = pr->auxfunctions + lineno->fa.func;
|
aux_func = pr->auxfunctions + lineno->fa.func;
|
||||||
if (aux_func && aux_func->function >= 0
|
if (aux_func
|
||||||
&& aux_func->function < (unsigned int) pr->progs->numfunctions)
|
&& aux_func->function < (unsigned int) pr->progs->numfunctions)
|
||||||
func = pr->pr_functions + aux_func->function;
|
func = pr->pr_functions + aux_func->function;
|
||||||
}
|
}
|
||||||
|
|
|
@ -183,12 +183,12 @@ linker_type_mismatch (qfo_def_t *def, qfo_def_t *prev)
|
||||||
const char *def_encoding;
|
const char *def_encoding;
|
||||||
const char *prev_encoding;
|
const char *prev_encoding;
|
||||||
|
|
||||||
if (def->type < 0)
|
if ((int) def->type < 0)
|
||||||
def_encoding = QFO_GETSTR (work, -def->type);
|
def_encoding = QFO_GETSTR (work, -(int) def->type);
|
||||||
else
|
else
|
||||||
def_encoding = QFO_TYPESTR (work, def->type);
|
def_encoding = QFO_TYPESTR (work, def->type);
|
||||||
if (prev->type < 0)
|
if ((int) prev->type < 0)
|
||||||
prev_encoding = QFO_GETSTR (work, -prev->type);
|
prev_encoding = QFO_GETSTR (work, -(int) prev->type);
|
||||||
else
|
else
|
||||||
prev_encoding = QFO_TYPESTR (work, prev->type);
|
prev_encoding = QFO_TYPESTR (work, prev->type);
|
||||||
def_error (def, "type mismatch for `%s' `%s'", WORKSTR (def->name),
|
def_error (def, "type mismatch for `%s' `%s'", WORKSTR (def->name),
|
||||||
|
@ -844,7 +844,7 @@ process_type_space (qfo_t *qfo, qfo_mspace_t *space, int pass)
|
||||||
if (!bi->defref)
|
if (!bi->defref)
|
||||||
continue;
|
continue;
|
||||||
def = REF (bi->defref);
|
def = REF (bi->defref);
|
||||||
if (def->type >= 0)
|
if ((int) def->type >= 0)
|
||||||
continue;
|
continue;
|
||||||
ref = Hash_Find (defined_type_defs, WORKSTR (-def->type));
|
ref = Hash_Find (defined_type_defs, WORKSTR (-def->type));
|
||||||
if (!ref)
|
if (!ref)
|
||||||
|
@ -926,8 +926,7 @@ process_loose_relocs (qfo_t *qfo)
|
||||||
if (reloc->type == rel_def_string) {
|
if (reloc->type == rel_def_string) {
|
||||||
const char *str;
|
const char *str;
|
||||||
|
|
||||||
if (reloc->target < 0
|
if (reloc->target >= qfo->spaces[qfo_strings_space].data_size) {
|
||||||
|| reloc->target >= qfo->spaces[qfo_strings_space].data_size) {
|
|
||||||
linker_error ("bad string reloc at %d:%x", reloc->space,
|
linker_error ("bad string reloc at %d:%x", reloc->space,
|
||||||
reloc->offset);
|
reloc->offset);
|
||||||
reloc->target = 0;
|
reloc->target = 0;
|
||||||
|
@ -963,7 +962,7 @@ linker_add_qfo (qfo_t *qfo)
|
||||||
work_func_base = work->num_funcs;
|
work_func_base = work->num_funcs;
|
||||||
for (pass = 0; pass < 2; pass++) {
|
for (pass = 0; pass < 2; pass++) {
|
||||||
for (i = 0, space = qfo->spaces; i < qfo->num_spaces; i++, space++) {
|
for (i = 0, space = qfo->spaces; i < qfo->num_spaces; i++, space++) {
|
||||||
if (space->type < 0 || space->type > qfos_type) {
|
if ((int) space->type < 0 || space->type > qfos_type) {
|
||||||
linker_error ("bad space type");
|
linker_error ("bad space type");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -621,7 +621,7 @@ static etype_t
|
||||||
get_def_type (qfo_t *qfo, pointer_t type)
|
get_def_type (qfo_t *qfo, pointer_t type)
|
||||||
{
|
{
|
||||||
qfot_type_t *type_def;
|
qfot_type_t *type_def;
|
||||||
if (type < 0 || type >= qfo->spaces[qfo_type_space].data_size)
|
if (type >= qfo->spaces[qfo_type_space].data_size)
|
||||||
return ev_void;
|
return ev_void;
|
||||||
type_def = QFO_POINTER (qfo, qfo_type_space, qfot_type_t, type);
|
type_def = QFO_POINTER (qfo, qfo_type_space, qfot_type_t, type);
|
||||||
switch ((ty_meta_e)type_def->ty) {
|
switch ((ty_meta_e)type_def->ty) {
|
||||||
|
@ -646,7 +646,7 @@ get_type_size (qfo_t *qfo, pointer_t type)
|
||||||
{
|
{
|
||||||
qfot_type_t *type_def;
|
qfot_type_t *type_def;
|
||||||
int i, size;
|
int i, size;
|
||||||
if (type < 0 || type >= qfo->spaces[qfo_type_space].data_size)
|
if (type >= qfo->spaces[qfo_type_space].data_size)
|
||||||
return 1;
|
return 1;
|
||||||
type_def = QFO_POINTER (qfo, qfo_type_space, qfot_type_t, type);
|
type_def = QFO_POINTER (qfo, qfo_type_space, qfot_type_t, type);
|
||||||
switch ((ty_meta_e)type_def->ty) {
|
switch ((ty_meta_e)type_def->ty) {
|
||||||
|
@ -684,7 +684,7 @@ function_params (qfo_t *qfo, qfo_func_t *func, dfunction_t *df)
|
||||||
int num_params;
|
int num_params;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (func->type < 0 || func->type >= qfo->spaces[qfo_type_space].data_size)
|
if (func->type >= qfo->spaces[qfo_type_space].data_size)
|
||||||
return;
|
return;
|
||||||
type = QFO_POINTER (qfo, qfo_type_space, qfot_type_t, func->type);
|
type = QFO_POINTER (qfo, qfo_type_space, qfot_type_t, func->type);
|
||||||
if (type->ty != ty_none && type->t.type != ev_func)
|
if (type->ty != ty_none && type->t.type != ev_func)
|
||||||
|
@ -787,7 +787,7 @@ qfo_to_progs (qfo_t *qfo, int *size)
|
||||||
dprograms_t *progs;
|
dprograms_t *progs;
|
||||||
qfo_def_t *types_def = 0;
|
qfo_def_t *types_def = 0;
|
||||||
int i, j;
|
int i, j;
|
||||||
int locals_size = 0;
|
unsigned locals_size = 0;
|
||||||
int locals_start;
|
int locals_start;
|
||||||
int big_locals = 0;
|
int big_locals = 0;
|
||||||
int big_func = 0;
|
int big_func = 0;
|
||||||
|
|
|
@ -273,7 +273,7 @@ qfo_encode_type (type_t *type)
|
||||||
}
|
}
|
||||||
if (type->type_def)
|
if (type->type_def)
|
||||||
return type->type_def;
|
return type->type_def;
|
||||||
if (type->meta < 0 || type->meta > ty_class)
|
if (type->meta > ty_class)
|
||||||
internal_error (0, "bad type meta type");
|
internal_error (0, "bad type meta type");
|
||||||
if (!type->encoding)
|
if (!type->encoding)
|
||||||
type->encoding = type_get_encoding (type);
|
type->encoding = type_get_encoding (type);
|
||||||
|
|
|
@ -67,7 +67,7 @@ static const char *op_type_names[] = {
|
||||||
const char *
|
const char *
|
||||||
optype_str (op_type_e type)
|
optype_str (op_type_e type)
|
||||||
{
|
{
|
||||||
if (type < 0 || type > op_temp)
|
if (type > op_temp)
|
||||||
return "<invalid op_type>";
|
return "<invalid op_type>";
|
||||||
return op_type_names[type];
|
return op_type_names[type];
|
||||||
}
|
}
|
||||||
|
@ -1011,7 +1011,7 @@ statement_subexpr (sblock_t *sblock, expr_t *e, operand_t **op)
|
||||||
return sblock;
|
return sblock;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e->type < 0 || e->type > ex_value)
|
if (e->type > ex_value)
|
||||||
internal_error (e, "bad expression type");
|
internal_error (e, "bad expression type");
|
||||||
if (!sfuncs[e->type])
|
if (!sfuncs[e->type])
|
||||||
internal_error (e, "unexpected expression type");
|
internal_error (e, "unexpected expression type");
|
||||||
|
@ -1287,7 +1287,7 @@ statement_slist (sblock_t *sblock, expr_t *e)
|
||||||
};
|
};
|
||||||
|
|
||||||
for (/**/; e; e = e->next) {
|
for (/**/; e; e = e->next) {
|
||||||
if (e->type < 0 || e->type > ex_value)
|
if (e->type > ex_value)
|
||||||
internal_error (e, "bad expression type");
|
internal_error (e, "bad expression type");
|
||||||
sblock = sfuncs[e->type] (sblock, e);
|
sblock = sfuncs[e->type] (sblock, e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ static const char *sy_type_names[] = {
|
||||||
const char *
|
const char *
|
||||||
symtype_str (sy_type_e type)
|
symtype_str (sy_type_e type)
|
||||||
{
|
{
|
||||||
if (type < 0 || type > sy_class)
|
if (type > sy_class)
|
||||||
return "<invalid sy_type>";
|
return "<invalid sy_type>";
|
||||||
return sy_type_names[type];
|
return sy_type_names[type];
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,7 +93,7 @@ static type_t *free_types;
|
||||||
etype_t
|
etype_t
|
||||||
low_level_type (type_t *type)
|
low_level_type (type_t *type)
|
||||||
{
|
{
|
||||||
if (type->type < 0 || type->type >= ev_type_count)
|
if (type->type >= ev_type_count)
|
||||||
internal_error (0, "invalid type");
|
internal_error (0, "invalid type");
|
||||||
if (type->type == ev_type_count)
|
if (type->type == ev_type_count)
|
||||||
internal_error (0, "found 'type count' type");
|
internal_error (0, "found 'type count' type");
|
||||||
|
|
Loading…
Reference in a new issue