warn on return foo (); where foo returns void

This commit is contained in:
Bill Currie 2004-02-04 01:30:12 +00:00
parent fb9c3e6125
commit ab4f0e7ca9
2 changed files with 5 additions and 2 deletions

View file

@ -1949,6 +1949,9 @@ return_expr (function_t *f, expr_t *e)
t = &type_float;
}
if (t == &type_void) {
if (!options.traditional)
return error (e, "void value not ignored as it ought to be");
warning (e, "void value not ignored as it ought to be");
t = f->def->type->aux_type;
e->type = expr_types[t->type];
}

View file

@ -1437,8 +1437,8 @@ keywordnamelist
;
keywordname
: selector ':' { $$ = new_keywordarg ($1, 0); }
| ':' { $$ = new_keywordarg ("", 0); }
: selector ':' { $$ = new_keywordarg ($1, new_nil_expr ()); }
| ':' { $$ = new_keywordarg ("", new_nil_expr ()); }
;
obj_string