diff options
| author | Thomas Preud'homme <robotux@celest.fr> | 2014-04-14 20:45:10 +0800 |
|---|---|---|
| committer | Thomas Preud'homme <robotux@celest.fr> | 2014-04-14 20:49:14 +0800 |
| commit | 6b7a6fcbc8b9ed623a436dc2218cfe31b991037c (patch) | |
| tree | 9e0821a9c374b06f9c680db2c63792bbd304ce6b /tccpp.c | |
| parent | 356c6f6293fdd4d1ce232c6abf8741ac5f731c63 (diff) | |
| download | tinycc-6b7a6fcbc8b9ed623a436dc2218cfe31b991037c.tar.gz tinycc-6b7a6fcbc8b9ed623a436dc2218cfe31b991037c.tar.bz2 | |
Improve efficiency of macro concatenation
As per grischka comment, always output a space after macro concatenation
instead of trying to detect if it's necessary as the current approach
has a huge cost.
Diffstat (limited to 'tccpp.c')
| -rw-r--r-- | tccpp.c | 28 |
1 files changed, 2 insertions, 26 deletions
@@ -2910,32 +2910,8 @@ static inline int *macro_twosharps(const int *macro_str) } } if (tok != TOK_NOSUBST) { - const int *oldptr; - CValue cval; - - /* Check if a space need to be added after ## concatenation in - order to avoid misinterpreting the newly formed token - followed by the next token as being a single token (see - macro_concat test) */ - cstr_new(&cstr); - cstr_cat(&cstr, get_tok_str(tok, &tokc)); - oldptr = ptr; - TOK_GET(&t, &ptr, &cval); - ptr = oldptr; - cstr_cat(&cstr, get_tok_str(t, &cval)); - cstr_ccat(&cstr, '\0'); - t = tok; - cval = tokc; - tcc_open_bf(tcc_state, ":paste:", cstr.size); - memcpy(file->buffer, cstr.data, cstr.size); - next_nomacro1(); - if (!*file->buf_ptr) { - tok_str_add2(¯o_str1, t, &cval); - tok = ' '; - } - tcc_close(); - cstr_free(&cstr); - + tok_str_add2(¯o_str1, tok, &tokc); + tok = ' '; start_of_nosubsts = -1; } tok_str_add2(¯o_str1, tok, &tokc); |
