aboutsummaryrefslogtreecommitdiff
path: root/tccpp.c
diff options
context:
space:
mode:
authorMichael Matz <matz@suse.de>2012-04-16 00:21:40 +0200
committerMichael Matz <matz@suse.de>2012-04-18 20:57:13 +0200
commit4c0d70ab07b4a5a5040e53259f8e9cedd4ec89b2 (patch)
treedd91e5de8da11315ca1d55db52c5ab427989a648 /tccpp.c
parent15f4ac2b1a4453b73904bb2ff4441498d5911a64 (diff)
downloadtinycc-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.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/tccpp.c b/tccpp.c
index f3dd232..aff5a53 100644
--- a/tccpp.c
+++ b/tccpp.c
@@ -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 */