History

tcc -E: append a ' ' after subst

We need a ' ' after subst of m in the following case #define m(name,r) name ## r #define m0(a,b,c) int m(a,b) c #define m1(a,b,c) int m(a,b)c m0(a, b, c); m1(a, b, c);

Changming Xu committed 15 years ago

Commit 185fba41 parent 1b85b551 file · +10 −0Browse files

Unified · Split

tccpp.c+10−0
@@ -2851,6 +2851,9 @@ static void macro_subst(TokenString *tok_str, Sym **nested_list, · 2850 unmodified lines
28512851 /* first scan for '##' operator handling */
28522852 ptr = macro_str;
28532853 macro_str1 = macro_twosharps(ptr);
2854+
2855+ /* a ' ' after subst */
2856+ int append_space = 0;
28542857 if (macro_str1)
28552858 ptr = macro_str1;
28562859 spc = 0;
@@ -2888,8 +2891,15 @@ static void macro_subst(TokenString *tok_str, Sym **nested_list, · 31 unmodified lines
28882891 *can_read_stream = ml.prev;
28892892 if (ret != 0)
28902893 goto no_subst;
2894+ if (parse_flags & PARSE_FLAG_SPACES)
2895+ append_space = 1;
28912896 } else {
28922897 no_subst:
2898+ if (append_space) {
2899+ tok_str_add(tok_str, ' ');
2900+ spc = 1;
2901+ append_space = 0;
2902+ }
28932903 if (!check_space(t, &spc))
28942904 tok_str_add2(tok_str, t, &cval);
28952905 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t