diff options
| author | Changming Xu <xcmhit@gmail.com> | 2011-03-01 09:19:43 +0800 |
|---|---|---|
| committer | Changming Xu <xcmhit@gmail.com> | 2011-03-01 09:19:43 +0800 |
| commit | 684723488d09f129f0e945ba860dc477c0068305 (patch) | |
| tree | 9648c29c7a9d262e7f56e745afea0804e4a4656f | |
| parent | 185fba418978aabef36765fdfaf24d516f1a9f33 (diff) | |
| download | tinycc-684723488d09f129f0e945ba860dc477c0068305.tar.gz tinycc-684723488d09f129f0e945ba860dc477c0068305.tar.bz2 | |
Replace comment by a blank
- fix my prev commit:
put declaration above statements to stay c89 compatible
- replace commit by a blank
#define con(a, b) a/**/b
this should yield a b, not ab
| -rw-r--r-- | tccpp.c | 18 |
1 files changed, 11 insertions, 7 deletions
@@ -2448,10 +2448,13 @@ maybe_newline: PEEKC(c, p); if (c == '*') { p = parse_comment(p); - goto redo_no_start; + /* comments replaced by a blank */ + tok = ' '; + goto keep_tok_flags; } else if (c == '/') { p = parse_line_comment(p); - goto redo_no_start; + tok = ' '; + goto keep_tok_flags; } else if (c == '=') { p++; tok = TOK_A_DIV; @@ -2847,16 +2850,17 @@ static void macro_subst(TokenString *tok_str, Sym **nested_list, int t, ret, spc; CValue cval; struct macro_level ml; + int force_blank; /* first scan for '##' operator handling */ ptr = macro_str; macro_str1 = macro_twosharps(ptr); - /* a ' ' after subst */ - int append_space = 0; if (macro_str1) ptr = macro_str1; spc = 0; + force_blank = 0; + while (1) { /* NOTE: ptr == NULL can only happen if tokens are read from file stream due to a macro function call */ @@ -2892,13 +2896,13 @@ static void macro_subst(TokenString *tok_str, Sym **nested_list, if (ret != 0) goto no_subst; if (parse_flags & PARSE_FLAG_SPACES) - append_space = 1; + force_blank = 1; } else { no_subst: - if (append_space) { + if (force_blank) { tok_str_add(tok_str, ' '); spc = 1; - append_space = 0; + force_blank = 0; } if (!check_space(t, &spc)) tok_str_add2(tok_str, t, &cval); |
