Produce better error message on malformed while loop
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.
This commit is contained in:
parent
3d128041c3
commit
b214fb6ed3
1 changed files with 5 additions and 2 deletions
7
tccpp.c
7
tccpp.c
|
@ -98,8 +98,11 @@ static void next_nomacro(void);
|
|||
|
||||
ST_FUNC void skip(int c)
|
||||
{
|
||||
if (tok != c)
|
||||
tcc_error("'%c' expected (got \"%s\")", c, get_tok_str(tok, &tokc));
|
||||
if (tok != c) {
|
||||
char tmp[40];
|
||||
pstrcpy(tmp, sizeof tmp, get_tok_str(c, &tokc));
|
||||
tcc_error("'%s' expected (got \"%s\")", tmp, get_tok_str(tok, &tokc));
|
||||
}
|
||||
next();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue