mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-31 21:20:33 +00:00
Clean up all extra aborts, using internal_error instead.
Some internal_error calls have no message, but at least things will be more consistent.
This commit is contained in:
parent
5530e84ada
commit
27b83a8d65
8 changed files with 44 additions and 47 deletions
|
@ -322,10 +322,8 @@ copy_expr (expr_t *e)
|
|||
append_expr (n, copy_expr (t));
|
||||
}
|
||||
}
|
||||
if (e->e.block.result && !n->e.block.result) {
|
||||
error (e, "internal: bogus block result?");
|
||||
abort ();
|
||||
}
|
||||
if (e->e.block.result && !n->e.block.result)
|
||||
internal_error (e, "bogus block result?");
|
||||
break;
|
||||
case ex_expr:
|
||||
n = new_expr ();
|
||||
|
@ -350,8 +348,7 @@ copy_expr (expr_t *e)
|
|||
n->e.temp.expr = copy_expr (e->e.temp.expr);
|
||||
return n;
|
||||
}
|
||||
error (e, "internal: invalid expression");
|
||||
abort ();
|
||||
internal_error (e, "invalid expression");
|
||||
}
|
||||
|
||||
const char *
|
||||
|
@ -914,15 +911,13 @@ expr_t *
|
|||
append_expr (expr_t *block, expr_t *e)
|
||||
{
|
||||
if (block->type != ex_block)
|
||||
abort ();
|
||||
internal_error (block, "not a block expression");
|
||||
|
||||
if (!e || e->type == ex_error)
|
||||
return block;
|
||||
|
||||
if (e->next) {
|
||||
error (e, "append_expr: expr loop detected");
|
||||
abort ();
|
||||
}
|
||||
if (e->next)
|
||||
internal_error (e, "append_expr: expr loop detected");
|
||||
|
||||
*block->e.block.tail = e;
|
||||
block->e.block.tail = &e->next;
|
||||
|
@ -1151,9 +1146,8 @@ merge (ex_list_t *l1, ex_list_t *l2)
|
|||
{
|
||||
ex_list_t *m;
|
||||
|
||||
if (!l1 && !l2) {
|
||||
if (!l1 && !l2)
|
||||
internal_error (0, 0);
|
||||
}
|
||||
if (!l2)
|
||||
return l1;
|
||||
if (!l1)
|
||||
|
@ -1493,9 +1487,8 @@ binary_expr (int op, expr_t *e1, expr_t *e2)
|
|||
return e2;
|
||||
t1 = get_type (e1);
|
||||
t2 = get_type (e2);
|
||||
if (!t1 || !t2) {
|
||||
if (!t1 || !t2)
|
||||
internal_error (e1, 0);
|
||||
}
|
||||
if (op == EQ || op == NE) {
|
||||
if (e1->type == ex_nil) {
|
||||
t1 = t2;
|
||||
|
@ -2536,9 +2529,8 @@ assign_expr (expr_t *e1, expr_t *e2)
|
|||
}
|
||||
t1 = get_type (e1);
|
||||
t2 = get_type (e2);
|
||||
if (!t1 || !t2) {
|
||||
if (!t1 || !t2)
|
||||
internal_error (e1, 0);
|
||||
}
|
||||
//XXX func = func ???
|
||||
if (t1->type == ev_pointer && is_array (t2)) {
|
||||
e2 = address_expr (e2, 0, t2->t.fldptr.type);
|
||||
|
@ -2864,9 +2856,8 @@ message_expr (expr_t *receiver, keywordarg_t *message)
|
|||
expr_t *
|
||||
sizeof_expr (expr_t *expr, struct type_s *type)
|
||||
{
|
||||
if (!((!expr) ^ (!type))) {
|
||||
if (!((!expr) ^ (!type)))
|
||||
internal_error (0, 0);
|
||||
}
|
||||
if (!type)
|
||||
type = get_type (expr);
|
||||
expr = new_integer_expr (type_size (type));
|
||||
|
|
|
@ -164,10 +164,8 @@ parse_params (type_t *type, param_t *parms)
|
|||
return type;
|
||||
}
|
||||
if (!p->selector && !p->type && !p->name) {
|
||||
if (p->next) {
|
||||
error (0, "internal error");
|
||||
abort ();
|
||||
}
|
||||
if (p->next)
|
||||
internal_error (0, "");
|
||||
new->t.func.num_params = -(new->t.func.num_params + 1);
|
||||
} else if (p->type) {
|
||||
new->t.func.param_types[new->t.func.num_params] = p->type;
|
||||
|
|
|
@ -71,6 +71,8 @@
|
|||
#include "strpool.h"
|
||||
#include "type.h"
|
||||
|
||||
static void linker_internal_error (const char *fmt, ...)
|
||||
__attribute__ ((format (printf, 1, 2), noreturn));
|
||||
static void linker_error (const char *fmt, ...)
|
||||
__attribute__ ((format (printf, 1, 2)));
|
||||
static void linker_warning (const char *fmt, ...)
|
||||
|
@ -245,14 +247,12 @@ resolve_external_def (defref_t *ext, defref_t *def)
|
|||
if (!(REF (ext)->flags & QFOD_EXTERNAL)) {
|
||||
def_error (REF (ext), "%s %x", WORKSTR (REF (ext)->name),
|
||||
REF (ext)->flags);
|
||||
linker_error ("ext is not an external def");
|
||||
abort ();
|
||||
linker_internal_error ("ext is not an external def");
|
||||
}
|
||||
if (!(REF (def)->flags & QFOD_GLOBAL)) {
|
||||
def_error (REF (ext), "%s %x", WORKSTR (REF (ext)->name),
|
||||
REF (ext)->flags);
|
||||
linker_error ("def is not a global def");
|
||||
abort ();
|
||||
linker_internal_error ("def is not a global def");
|
||||
}
|
||||
if (REF (ext)->type != REF (def)->type) {
|
||||
linker_type_mismatch (REF (ext), REF (def));
|
||||
|
@ -1308,3 +1308,19 @@ linker_error (const char *fmt, ...)
|
|||
|
||||
pr.error_count++;
|
||||
}
|
||||
|
||||
static void
|
||||
linker_internal_error (const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
fprintf (stderr, "%s: ", linker_current_file->str);
|
||||
|
||||
va_start (args, fmt);
|
||||
vfprintf (stderr, fmt, args);
|
||||
va_end (args);
|
||||
|
||||
fputs ("\n", stderr);
|
||||
|
||||
abort ();
|
||||
}
|
||||
|
|
|
@ -143,10 +143,8 @@ copy_method (method_t *method)
|
|||
void
|
||||
add_method (methodlist_t *methodlist, method_t *method)
|
||||
{
|
||||
if (method->next) {
|
||||
error (0, "add_method: method loop detected");
|
||||
abort ();
|
||||
}
|
||||
if (method->next)
|
||||
internal_error (0, "add_method: method loop detected");
|
||||
|
||||
*methodlist->tail = method;
|
||||
methodlist->tail = &method->next;
|
||||
|
@ -187,10 +185,8 @@ method_set_param_names (method_t *dst, method_t *src)
|
|||
dp = dp->next, sp = sp->next) {
|
||||
dp->name = sp->name;
|
||||
}
|
||||
if (dp || sp) {
|
||||
error (0, "internal compiler error: missmatched method params");
|
||||
abort ();
|
||||
}
|
||||
if (dp || sp)
|
||||
internal_error (0, "missmatched method params");
|
||||
}
|
||||
|
||||
methodlist_t *
|
||||
|
|
|
@ -293,8 +293,7 @@ convert_relop (const char *relop)
|
|||
}
|
||||
break;
|
||||
}
|
||||
error (0, "internal: bad relop %s", relop);
|
||||
return EQ;
|
||||
internal_error (0, "bad relop %s", relop);
|
||||
}
|
||||
|
||||
#ifdef YY_FLEX_REALLOC_HACK
|
||||
|
|
|
@ -206,10 +206,8 @@ new_case_node (expr_t *low, expr_t *high)
|
|||
} else {
|
||||
int size;
|
||||
|
||||
if (!is_integer_val (low)) {
|
||||
error (low, "switch: internal error");
|
||||
abort ();
|
||||
}
|
||||
if (!is_integer_val (low))
|
||||
internal_error (low, "switch");
|
||||
size = expr_integer (high) - expr_integer (low) + 1;
|
||||
node->labels = calloc (size, sizeof (case_node_t *));
|
||||
}
|
||||
|
@ -435,8 +433,7 @@ switch_expr (switch_block_t *switch_block, expr_t *break_label,
|
|||
op = '-';
|
||||
break;
|
||||
default:
|
||||
error (0, "internal compiler error in switch");
|
||||
abort ();
|
||||
internal_error (0, "in switch");
|
||||
}
|
||||
build_switch (sw, case_tree, op, sw_val, temp, default_label->label);
|
||||
}
|
||||
|
|
|
@ -132,7 +132,7 @@ symtab_removesymbol (symtab_t *symtab, symbol_t *symbol)
|
|||
for (s = &symtab->symbols; *s && *s != symbol; s = & (*s)->next)
|
||||
;
|
||||
if (!*s)
|
||||
abort ();
|
||||
internal_error (0, "symtab_removesymbol");
|
||||
*s = (*s)->next;
|
||||
if (symtab->symtail == &symbol->next)
|
||||
symtab->symtail = s;
|
||||
|
|
|
@ -108,7 +108,7 @@ imm_get_hash (void *_imm, void *_tab)
|
|||
} else if (tab == &integer_imm_defs) {
|
||||
return imm->i.integer_val;
|
||||
} else {
|
||||
abort ();
|
||||
internal_error (0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -144,7 +144,7 @@ imm_compare (void *_imm1, void *_imm2, void *_tab)
|
|||
} else if (tab == &integer_imm_defs) {
|
||||
return imm1->i.integer_val == imm2->i.integer_val;
|
||||
} else {
|
||||
abort ();
|
||||
internal_error (0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -282,7 +282,7 @@ emit_value (ex_value_t *value, def_t *def)
|
|||
type = &type_quaternion;
|
||||
break;
|
||||
default:
|
||||
abort ();
|
||||
internal_error (0, 0);
|
||||
}
|
||||
memcpy (&search.i, &val.v, sizeof (search.i));
|
||||
imm = (immediate_t *) Hash_FindElement (tab, &search);
|
||||
|
|
Loading…
Reference in a new issue