aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tccpp.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/tccpp.c b/tccpp.c
index e4bc0d0..3afee3f 100644
--- a/tccpp.c
+++ b/tccpp.c
@@ -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);