forked from Mirrors/tinycc
parent
07d896c8e5
commit
6015840583
50
tccpp.c
50
tccpp.c
|
@ -48,7 +48,6 @@ static TokenSym *hash_ident[TOK_HASH_SIZE];
|
|||
static char token_buf[STRING_MAX_SIZE + 1];
|
||||
static CString cstr_buf;
|
||||
static TokenString tokstr_buf;
|
||||
static TokenString tokstr_buf2;
|
||||
static unsigned char isidnum_table[256 - CH_EOF];
|
||||
/* isidnum_table flags: */
|
||||
#define IS_SPC 1
|
||||
|
@ -3565,48 +3564,10 @@ ST_FUNC void next(void)
|
|||
/* if reading from file, try to substitute macros */
|
||||
s = define_find(tok);
|
||||
if (s) {
|
||||
if (tcc_state->output_type == TCC_OUTPUT_PREPROCESS)
|
||||
{
|
||||
int t = 0;
|
||||
Sym *nested_list = NULL;
|
||||
tokstr_buf2.len = 0;
|
||||
macro_subst_tok(&tokstr_buf2, &nested_list, s, 1);
|
||||
{
|
||||
CValue cval;
|
||||
const int *str = tokstr_buf2.str;
|
||||
const int *str1 = tokstr_buf2.str + tokstr_buf2.len;
|
||||
int tok = 0;
|
||||
tokstr_buf.len = 0;
|
||||
while (str < str1) {
|
||||
t = tok;
|
||||
TOK_GET(&tok, &str, &cval);
|
||||
if (t == TOK_PPNUM && (tok == '+' || tok == '-'))
|
||||
tok_str_add(&tokstr_buf, ' ');
|
||||
tok_str_add2(&tokstr_buf, tok, &cval);
|
||||
}
|
||||
t = tok;
|
||||
}
|
||||
if (macro_ptr)
|
||||
ch = *macro_ptr;
|
||||
else
|
||||
ch = handle_eob();
|
||||
if (t == TOK_PPNUM && (ch == '+' || ch == '-' || ch >= 'a')) {
|
||||
tok_str_add(&tokstr_buf, ' ');
|
||||
} else
|
||||
if ((t == TOK_INC || t == TOK_DEC) && (ch == '+' || ch == '-')) {
|
||||
tok_str_add(&tokstr_buf, ch);
|
||||
tok_str_add(&tokstr_buf, ' ');
|
||||
if (macro_ptr)
|
||||
macro_ptr++;
|
||||
else
|
||||
file->buf_ptr++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
Sym *nested_list = NULL;
|
||||
tokstr_buf.len = 0;
|
||||
macro_subst_tok(&tokstr_buf, &nested_list, s, 1);
|
||||
}
|
||||
Sym *nested_list = NULL;
|
||||
tokstr_buf.len = 0;
|
||||
nested_list = NULL;
|
||||
macro_subst_tok(&tokstr_buf, &nested_list, s, 1);
|
||||
tok_str_add(&tokstr_buf, 0);
|
||||
begin_macro(&tokstr_buf, 2);
|
||||
goto redo;
|
||||
|
@ -3681,8 +3642,6 @@ ST_FUNC void preprocess_new(void)
|
|||
cstr_realloc(&cstr_buf, STRING_MAX_SIZE);
|
||||
tok_str_new(&tokstr_buf);
|
||||
tok_str_realloc(&tokstr_buf, TOKSTR_MAX_SIZE);
|
||||
tok_str_new(&tokstr_buf2);
|
||||
tok_str_realloc(&tokstr_buf2, TOKSTR_MAX_SIZE);
|
||||
|
||||
tok_ident = TOK_IDENT;
|
||||
p = tcc_keywords;
|
||||
|
@ -3721,7 +3680,6 @@ ST_FUNC void preprocess_delete(void)
|
|||
cstr_free(&tokcstr);
|
||||
cstr_free(&cstr_buf);
|
||||
tok_str_free(tokstr_buf.str);
|
||||
tok_str_free(tokstr_buf2.str);
|
||||
|
||||
/* free allocators */
|
||||
tal_delete(toksym_alloc);
|
||||
|
|
Loading…
Reference in New Issue