diff options
| author | Michael Matz <matz@suse.de> | 2012-04-16 00:21:40 +0200 |
|---|---|---|
| committer | Michael Matz <matz@suse.de> | 2012-04-18 20:57:13 +0200 |
| commit | 4c0d70ab07b4a5a5040e53259f8e9cedd4ec89b2 (patch) | |
| tree | dd91e5de8da11315ca1d55db52c5ab427989a648 /tccpp.c | |
| parent | 15f4ac2b1a4453b73904bb2ff4441498d5911a64 (diff) | |
| download | tinycc-4c0d70ab07b4a5a5040e53259f8e9cedd4ec89b2.tar.gz tinycc-4c0d70ab07b4a5a5040e53259f8e9cedd4ec89b2.tar.bz2 | |
Fix parsing function macro invocations
If a function macro name is separated from the parentheses in
an macro invocation the substitution doesn't take place.
Fix this by handling comments.
Diffstat (limited to 'tccpp.c')
| -rw-r--r-- | tccpp.c | 21 |
1 files changed, 18 insertions, 3 deletions
@@ -2697,10 +2697,25 @@ static int macro_subst_tok(TokenString *tok_str, goto redo; } } else { - /* XXX: incorrect with comments */ ch = file->buf_ptr[0]; - while (is_space(ch) || ch == '\n') - cinp(); + while (is_space(ch) || ch == '\n' || ch == '/') + { + if (ch == '/') + { + int c; + uint8_t *p = file->buf_ptr; + PEEKC(c, p); + if (c == '*') { + p = parse_comment(p); + file->buf_ptr = p - 1; + } else if (c == '/') { + p = parse_line_comment(p); + file->buf_ptr = p - 1; + } else + break; + } + cinp(); + } t = ch; } if (t != '(') /* no macro subst */ |
