DfaStartFunction(name);
#endif DATAFLOW
- func_tp = def->df_type->tp_up;
+ if (def->df_type->tp_fund != FUNCTION) {
+ error("making function body for non-function");
+ func_tp = error_type;
+ }
+ else
+ func_tp = def->df_type->tp_up;
size = ATW(func_tp->tp_size);
C_pro_narg(name);
if (is_struct_or_union(func_tp->tp_fund)) {
/* at the L_FORMAL1 level there is no type specified yet
*/
ASSERT(lvl == L_FORMAL1);
- type = 0;
+ type = int_type; /* may change at L_FORMAL2 */
}
else {
/* combine the decspecs and the declarator into one type */
{
/* idf is declared as a formal.
*/
- add_def(idf, FORMAL, (struct type *)0, level);
+ add_def(idf, FORMAL, int_type, level);
}
declare_enum(tp, idf, l)
struct idf *idf = se->se_idf;
struct def *def = idf->id_def;
- if (def->df_type == 0)
- def->df_type = int_type; /* default type */
def->df_address = f_offset;
/* the alignment convention for parameters is: align on
For simplicity, we suppose int_size == word_size.
*/
-code_startswitch(expr)
- struct expr *expr;
+code_startswitch(expp)
+ struct expr **expp;
{
/* Check the expression, stack a new case header and
fill in the necessary fields.
register label l_table = text_label();
register label l_break = text_label();
register struct switch_hdr *sh = new_switch_hdr();
- int fund = any2arith(&expr, SWITCH); /* INT, LONG or DOUBLE */
+ int fund = any2arith(expp, SWITCH); /* INT, LONG or DOUBLE */
switch (fund) {
case LONG:
if (options['R'])
warning("long in switch (cast to int)");
- int2int(&expr, int_type);
+ int2int(expp, int_type);
break;
case DOUBLE:
error("float/double in switch");
- erroneous2int(&expr);
+ erroneous2int(expp);
break;
}
sh->sh_default = 0;
sh->sh_table = l_table;
sh->sh_nrofentries = 0;
- sh->sh_type = expr->ex_type; /* the expression switched */
+ sh->sh_type = (*expp)->ex_type; /* the expression switched */
sh->sh_lowerbd = sh->sh_upperbd = (arith)0; /* immaterial ??? */
sh->sh_entries = (struct case_entry *) 0; /* case-entry list */
sh->next = switch_stack; /* push onto switch-stack */
switch_stack = sh;
- code_expr(expr, RVAL, TRUE, NO_LABEL, NO_LABEL);
+ code_expr(*expp, RVAL, TRUE, NO_LABEL, NO_LABEL);
/* evaluate the switch expr. */
C_bra(l_table); /* goto start of switch_table */
}