History

tccpp.c: fix endless loop

Perhaps a better fix would be to ensure tok is set to TOK_EOF rather than 0 at the end of a macro stream. This partially fixes test2 of the examples given in: http://lists.nongnu.org/archive/html/tinycc-devel/2015-05/msg00002.html It's still failing, but at least it's not running out of memory now.

Philip committed 11 years ago

Commit a3d78b91 parent 1e878201 file · +3 −2Browse files

Unified · Split

tccpp.c+3−2
@@ -2930,8 +2930,9 @@ static int macro_subst_tok(TokenString *tok_str, · 2929 unmodified lines
2930 /* NOTE: non zero sa->t indicates VA_ARGS */2930 /* NOTE: non zero sa->t indicates VA_ARGS */
2931 while ((parlevel > 0 || 2931 while ((parlevel > 0 ||
2932 (tok != ')' && 2932 (tok != ')' &&
2933 (tok != ',' || sa->type.t))) && 2933 (tok != ',' || sa->type.t)))) {
2934 tok != -1) {2934 if (tok == TOK_EOF || tok == 0)
2935 break;
2935 if (tok == '(')2936 if (tok == '(')
2936 parlevel++;2937 parlevel++;
2937 else if (tok == ')')2938 else if (tok == ')')

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t