returning value for void function now a warning for traditional

This commit is contained in:
Bill Currie 2002-12-13 23:21:09 +00:00
parent 64a9a8199c
commit 2a5ac8c42d

View file

@ -1934,8 +1934,11 @@ return_expr (function_t *f, expr_t *e)
if (e->type == ex_error) if (e->type == ex_error)
return e; return e;
if (f->def->type->aux_type == &type_void) if (f->def->type->aux_type == &type_void) {
if (!options.traditional)
return error (e, "returning a value for a void function"); return error (e, "returning a value for a void function");
warning (e, "returning a value for a void function");
}
if (f->def->type->aux_type == &type_float && e->type == ex_integer) { if (f->def->type->aux_type == &type_float && e->type == ex_integer) {
e->type = ex_float; e->type = ex_float;
e->e.float_val = e->e.integer_val; e->e.float_val = e->e.integer_val;