if (VAR_INIT (prod))
{
- if (! ((struct prod_token_parm_item*)VAR_INIT (prod))->tp.pro.code)
- abort ();
+ gcc_assert (((struct prod_token_parm_item*)VAR_INIT (prod))->tp.pro.code);
if (STORAGE_CLASS (prod) == EXTERNAL_REFERENCE_STORAGE)
{
fprintf (stderr, "%s:%i:%i: External reference variables may not have initial value\n",
VAR_INIT (prod) ?
((struct prod_token_parm_item*)VAR_INIT (prod))->tp.pro.code : NULL,
tok->tp.tok.location);
- if (!prod->tp.pro.code)
- abort ();
+ gcc_assert (prod->tp.pro.code);
}
;
break;
default:
- abort ();
+ gcc_unreachable ();
}
type = EXPRESSION_TYPE (prod);
/* Create a parameter list in a non-front end specific format. */
this_parm;
this_parm = this_parm->tp.pro.next)
{
- if (this_parm->category != production_category)
- abort ();
+ gcc_assert (this_parm->category == production_category);
+
this_parm_var = VARIABLE (this_parm);
- if (!this_parm_var)
- abort ();
- if (this_parm_var->category != production_category)
- abort ();
+
+ gcc_assert (this_parm_var);
+ gcc_assert (this_parm_var->category == production_category);
+
this_parms = my_malloc (sizeof (struct prod_token_parm_item));
- if (!this_parm_var->tp.pro.main_token)
- abort ();
+ gcc_assert (this_parm_var->tp.pro.main_token);
this_parms->tp.par.variable_name =
this_parm_var->tp.pro.main_token->tp.tok.chars;
errorcount++;
YYERROR;
}
- if (!proto->tp.pro.code)
- abort ();
- tree_code_create_function_initial
- (proto->tp.pro.code, tok->tp.tok.location,
- FIRST_PARMS (current_function));
+ gcc_assert (proto->tp.pro.code);
+ tree_code_create_function_initial (proto->tp.pro.code, tok->tp.tok.location,
+ FIRST_PARMS (current_function));
+
+#ifdef ENABLE_CHECKING
/* Check all the parameters have code. */
for (this_parm = PARAMETERS (proto);
this_parm;
this_parm = this_parm->tp.pro.next)
{
- if (! (struct prod_token_parm_item*)VARIABLE (this_parm))
- abort ();
- if (! (( (struct prod_token_parm_item*)VARIABLE (this_parm))->tp.pro.code))
- abort ();
+ gcc_assert ((struct prod_token_parm_item*)VARIABLE (this_parm));
+ gcc_assert ((( (struct prod_token_parm_item*)VARIABLE (this_parm))->tp.pro.code));
}
+#endif
}
variable_defs_opt statements_opt RIGHT_BRACE {
struct prod_token_parm_item* tok;
/* Check same type. */
if (check_type_match (NUMERIC_TYPE (type_prod), $2))
{
- if (!type_prod->tp.pro.code)
- abort ();
- if (!exp->tp.pro.code)
- abort ();
+ gcc_assert (type_prod->tp.pro.code);
+ gcc_assert (exp->tp.pro.code);
+
/* Generate the code. */
- tree_code_generate_return (type_prod->tp.pro.code, exp->tp.pro.code);
+ tree_code_generate_return (type_prod->tp.pro.code,
+ exp->tp.pro.code);
}
}
}
|expression {
struct prod_token_parm_item *exp;
exp = $1;
- if (!exp->tp.pro.code)
- abort ();
+ gcc_assert (exp->tp.pro.code);
$$ = $1;
}
for (exp_proto = PARAMETERS (proto), exp = PARAMETERS (prod);
exp_proto;
exp = exp->tp.pro.next, exp_proto = exp_proto->tp.pro.next)
- {
- if (!exp)
- abort ();
- if (!exp_proto)
- abort ();
- if (!exp->tp.pro.code)
- abort ();
- var = VARIABLE (exp_proto);
- if (!var)
- abort ();
- if (!var->tp.pro.code)
- abort ();
- parms = tree_code_add_parameter (parms, var->tp.pro.code, exp->tp.pro.code);
- }
+ {
+ gcc_assert (exp);
+ gcc_assert (exp_proto);
+ gcc_assert (exp->tp.pro.code);
+
+ var = VARIABLE (exp_proto);
+
+ gcc_assert (var);
+ gcc_assert (var->tp.pro.code);
+
+ parms = tree_code_add_parameter (parms, var->tp.pro.code,
+ exp->tp.pro.code);
+ }
type = tree_code_get_type (NUMERIC_TYPE (prod));
prod->tp.pro.code = tree_code_get_expression (EXP_FUNCTION_INVOCATION, type,
proto->tp.pro.code, parms,
while (current)
{
- if (current->category != production_category)
- abort ();
+ gcc_assert (current->category == production_category);
next = current->tp.pro.next;
current->tp.pro.next = prev;
prev = current;
return 1;
case VOID_TYPE:
- abort ();
-
default:
- abort ();
+ gcc_unreachable ();
}
break;
case VOID_TYPE:
- abort ();
-
default:
- abort ();
+ gcc_unreachable ();
}
}
NUMERIC_TYPE (prod) = type_code;
type = tree_code_get_type (type_code);
- if (!type)
- abort ();
+ gcc_assert (type);
OP1 (prod) = op1;
OP2 (prod) = op2;
break;
default:
- abort ();
+ gcc_unreachable ();
}
}
return void_type_node;
default:
- abort ();
+ gcc_unreachable ();
}
}
id = get_identifier ((const char*)chars);
for (parm = parms; parm; parm = parm->tp.par.next)
{
- if (parm->category != parameter_category)
- abort ();
+ gcc_assert (parm->category == parameter_category);
type_node = tree_code_get_type (parm->type);
type_list = tree_cons (NULL_TREE, type_node, type_list);
}
case AUTOMATIC_STORAGE:
default:
- abort ();
+ gcc_unreachable ();
}
/* Process declaration of function defined elsewhere. */
struct prod_token_parm_item* parm;
fn_decl = prev_saved;
- if (!fn_decl)
- abort ();
+ gcc_assert (fn_decl);
/* Output message if not -quiet. */
announce_function (fn_decl);
/* Some languages have different nominal and real types. */
DECL_ARG_TYPE (parm_decl) = TREE_TYPE (parm_decl);
- if (!DECL_ARG_TYPE (parm_decl))
- abort ();
- if (!fn_decl)
- abort ();
+ gcc_assert (DECL_ARG_TYPE (parm_decl));
+ gcc_assert (fn_decl);
DECL_CONTEXT (parm_decl) = fn_decl;
DECL_SOURCE_LOCATION (parm_decl) = loc;
parm_list = chainon (parm_decl, parm_list);
param_decl = TREE_CHAIN (param_decl),
this_parm = this_parm->tp.par.next)
{
- if (!this_parm)
- abort (); /* Too few. */
+ gcc_assert (this_parm); /* Too few. */
*this_parm->tp.par.where_to_put_var_tree = param_decl;
}
- if (this_parm)
- abort (); /* Too many. */
+ gcc_assert (!this_parm); /* Too many. */
/* Create a new level at the start of the function. */
var_type = tree_code_get_type (expression_type);
/* 2. Build the name. */
- if (chars[length] != 0)
- abort (); /* Should be null terminated. */
+ gcc_assert (chars[length] == 0); /* Should be null terminated. */
var_id = get_identifier ((const char*)chars);
else
DECL_INITIAL (var_decl) = NULL_TREE;
- if (TYPE_SIZE (var_type) == 0)
- abort (); /* Did not calculate size. */
+ gcc_assert (TYPE_SIZE (var_type) != 0); /* Did not calculate size. */
DECL_CONTEXT (var_decl) = current_function_decl;
break;
default:
- abort ();
+ gcc_unreachable ();
}
/* This should really only be set if the variable is used. */
tree setret;
tree param;
+#ifdef ENABLE_CHECKING
for (param = DECL_ARGUMENTS (current_function_decl);
param;
param = TREE_CHAIN (param))
- {
- if (DECL_CONTEXT (param) != current_function_decl)
- abort ();
- }
+ gcc_assert (DECL_CONTEXT (param) == current_function_decl);
+#endif
if (exp && TREE_TYPE (TREE_TYPE (current_function_decl)) != void_type_node)
{
switch (exp_type)
{
case EXP_ASSIGN:
- if (!op1 || !op2)
- abort ();
+ gcc_assert (op1 && op2);
operator = MODIFY_EXPR;
ret1 = fold (build2 (operator, void_type_node, op1,
fold (build1 (CONVERT_EXPR, TREE_TYPE (op1), op2))));
-
break;
case EXP_PLUS:
/* Expand a binary expression. Ensure the operands are the right type. */
binary_expression:
- if (!op1 || !op2)
- abort ();
+ gcc_assert (op1 && op2);
ret1 = fold (build2 (operator, type,
fold (build1 (CONVERT_EXPR, type, op1)),
fold (build1 (CONVERT_EXPR, type, op2))));
decl for the variable. If the TYPE is different than the
variable type, convert it. */
case EXP_REFERENCE:
- if (!op1)
- abort ();
+ gcc_assert (op1);
if (type == TREE_TYPE (op1))
ret1 = op1;
else
break;
case EXP_FUNCTION_INVOCATION:
- if (!op1 || !op2)
- abort ();
-
+ gcc_assert (op1 && op2);
{
tree fun_ptr;
fun_ptr = fold (build1 (ADDR_EXPR,
break;
default:
- abort ();
+ gcc_unreachable ();
}
return ret1;