aboutsummaryrefslogtreecommitdiff
path: root/tccpp.c
diff options
context:
space:
mode:
authorgrischka <grischka>2010-11-25 13:30:31 +0100
committergrischka <grischka>2010-11-25 13:30:31 +0100
commit44e84bb22adc78844ac1c08e6f8a6d0278a942d8 (patch)
treeed973fc26354df9993560e1b95850d771777677e /tccpp.c
parente97bf88badfd72676ebdba0b6027370edfb2e584 (diff)
downloadtinycc-44e84bb22adc78844ac1c08e6f8a6d0278a942d8.tar.gz
tinycc-44e84bb22adc78844ac1c08e6f8a6d0278a942d8.tar.bz2
tccpp: fix token pasting ##
This patch takes advantage of new function tcc_open_bf from previous commit.
Diffstat (limited to 'tccpp.c')
-rw-r--r--tccpp.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/tccpp.c b/tccpp.c
index 41e6455..c461ff8 100644
--- a/tccpp.c
+++ b/tccpp.c
@@ -2776,7 +2776,6 @@ static inline int *macro_twosharps(const int *macro_str)
CValue cval;
TokenString macro_str1;
CString cstr;
- char *p;
int n;
/* we search the first '##' */
@@ -2809,18 +2808,17 @@ static inline int *macro_twosharps(const int *macro_str)
cstr_cat(&cstr, get_tok_str(t, &cval));
cstr_ccat(&cstr, '\0');
- p = file->buf_ptr;
- file->buf_ptr = cstr.data;
+ tcc_open_bf(tcc_state, "<paste>", cstr.size);
+ memcpy(file->buffer, cstr.data, cstr.size);
for (;;) {
next_nomacro1();
if (0 == *file->buf_ptr)
break;
tok_str_add2(&macro_str1, tok, &tokc);
-
warning("pasting \"%.*s\" and \"%s\" does not give a valid preprocessing token",
n, cstr.data, (char*)cstr.data + n);
}
- file->buf_ptr = p;
+ tcc_close();
cstr_reset(&cstr);
}
}