Mercurial > hg > tinycc
changeset 232:9cda43afb82a
[project @ 2003-04-13 18:32:37 by bellard]
fixed macro function bug
author | bellard |
---|---|
date | Sun, 13 Apr 2003 18:32:37 +0000 |
parents | 3b6cc8fcab7a |
children | 05711eb02ede |
files | Changelog tcc.c |
diffstat | 2 files changed, 12 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/Changelog Sun Apr 13 18:08:17 2003 +0000 +++ b/Changelog Sun Apr 13 18:32:37 2003 +0000 @@ -7,6 +7,7 @@ - function parameters must be converted to pointers (signaled by Neil Brown) - sanitized string and character constant parsing - fixed comment parse (signaled by Damian M Gryski) +- fixed macro function bug (signaled by Philippe Ribet) version 0.9.16:
--- a/tcc.c Sun Apr 13 18:08:17 2003 +0000 +++ b/tcc.c Sun Apr 13 18:32:37 2003 +0000 @@ -3749,7 +3749,14 @@ 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 @@ 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;