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);
Unified · Split
| @@ -2851,6 +2851,9 @@ static void macro_subst(TokenString *tok_str, Sym **nested_list, · 2850 unmodified lines | ||
| 2851 | 2851 | /* first scan for '##' operator handling */ |
| 2852 | 2852 | ptr = macro_str; |
| 2853 | 2853 | macro_str1 = macro_twosharps(ptr); |
| 2854 | + | |
| 2855 | + /* a ' ' after subst */ | |
| 2856 | + int append_space = 0; | |
| 2854 | 2857 | if (macro_str1) |
| 2855 | 2858 | ptr = macro_str1; |
| 2856 | 2859 | spc = 0; |
| @@ -2888,8 +2891,15 @@ static void macro_subst(TokenString *tok_str, Sym **nested_list, · 31 unmodified lines | ||
| 2888 | 2891 | *can_read_stream = ml.prev; |
| 2889 | 2892 | if (ret != 0) |
| 2890 | 2893 | goto no_subst; |
| 2894 | + if (parse_flags & PARSE_FLAG_SPACES) | |
| 2895 | + append_space = 1; | |
| 2891 | 2896 | } else { |
| 2892 | 2897 | no_subst: |
| 2898 | + if (append_space) { | |
| 2899 | + tok_str_add(tok_str, ' '); | |
| 2900 | + spc = 1; | |
| 2901 | + append_space = 0; | |
| 2902 | + } | |
| 2893 | 2903 | if (!check_space(t, &spc)) |
| 2894 | 2904 | tok_str_add2(tok_str, t, &cval); |
| 2895 | 2905 | } |