diff options
| author | bellard <bellard> | 2003-04-13 18:32:37 +0000 |
|---|---|---|
| committer | bellard <bellard> | 2003-04-13 18:32:37 +0000 |
| commit | f46a02a3609fdb876ec1462cdfd550cffdeb22f3 (patch) | |
| tree | 6b7441f692f484c536978ca872f08c1192a66083 /tcc.c | |
| parent | 34b7d96fec7d7eb312a008b4220975550c64bea6 (diff) | |
| download | tinycc-f46a02a3609fdb876ec1462cdfd550cffdeb22f3.tar.gz tinycc-f46a02a3609fdb876ec1462cdfd550cffdeb22f3.tar.bz2 | |
fixed macro function bug
Diffstat (limited to 'tcc.c')
| -rw-r--r-- | tcc.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -3749,7 +3749,14 @@ static int macro_subst_tok(TokenString *tok_str, next token. XXX: find better solution */ if (macro_ptr) { t = *macro_ptr; + if (t == 0) { + /* end of macro stream: we must look at the token + after in the file */ + macro_ptr = NULL; + goto parse_stream; + } } else { + parse_stream: /* XXX: incorrect with comments */ ch = file->buf_ptr[0]; while (is_space(ch) || ch == '\n') @@ -3981,6 +3988,10 @@ static void macro_subst(TokenString *tok_str, if (macro_str1) ptr = macro_str1; while (1) { + /* NOTE: ptr == NULL can only happen if tokens are read from + file stream due to a macro function call */ + if (ptr == NULL) + break; TOK_GET(t, ptr, cval); if (t == 0) break; |
