echo "void bugged() { do {} }" | tcc -run - now produces the sensible: -:1: error: 'while' expected (got "}") I believe (but am far from sure) that the additional use of &tokc is ok.
Unified · Split
| @@ -98,8 +98,11 @@ static void next_nomacro(void); · 97 unmodified lines | |||
| 98 | 98 | ||
| 99 | ST_FUNC void skip(int c) | 99 | ST_FUNC void skip(int c) |
| 100 | { | 100 | { |
| 101 | if (tok != c) | 101 | if (tok != c) { |
| 102 | tcc_error("'%c' expected (got \"%s\")", c, get_tok_str(tok, &tokc)); | 102 | char tmp[40]; |
| 103 | pstrcpy(tmp, sizeof tmp, get_tok_str(c, &tokc)); | ||
| 104 | tcc_error("'%s' expected (got \"%s\")", tmp, get_tok_str(tok, &tokc)); | ||
| 105 | } | ||
| 103 | next(); | 106 | next(); |
| 104 | } | 107 | } |
| 105 | 108 | ||