give an error message from the parser on things like "void x;" instead of relying on codegen erroring out.
Unified · Split
| @@ -3916,6 +3916,7 @@ do_decl: · 3915 unmodified lines | ||
| 3916 | 3916 | get_tok_str(v, NULL)); |
| 3917 | 3917 | } |
| 3918 | 3918 | if ((type1.t & VT_BTYPE) == VT_FUNC || |
| 3919 | + (type1.t & VT_BTYPE) == VT_VOID || | |
| 3919 | 3920 | (type1.t & VT_STORAGE)) |
| 3920 | 3921 | tcc_error("invalid type for '%s'", |
| 3921 | 3922 | get_tok_str(v, NULL)); |
| @@ -7362,6 +7363,9 @@ found: · 3440 unmodified lines | ||
| 7362 | 7363 | } |
| 7363 | 7364 | sym->a = ad.a; |
| 7364 | 7365 | sym->f = ad.f; |
| 7366 | + } else if ((type.t & VT_BTYPE) == VT_VOID | |
| 7367 | + && !(type.t & VT_EXTERN)) { | |
| 7368 | + tcc_error("declaration of void object"); | |
| 7365 | 7369 | } else { |
| 7366 | 7370 | r = 0; |
| 7367 | 7371 | if ((type.t & VT_BTYPE) == VT_FUNC) { |