History

Fix macro expansion of empty args.

Reimar Döffinger committed 11 years ago

Commit fb6331e1 parent a6149c64 files · +14 −2Browse files

Unified · Split

4 files
  1. tccpp.c +1 −1
  2. tests/tests2/71_macro_empty_arg.c +9 −0
  3. tests/tests2/71_macro_empty_arg.expect +1 −0
  4. tests/tests2/Makefile +3 −1
tccpp.c+1−1
@@ -2640,7 +2640,7 @@ static int *macro_arg_subst(Sym **nested_list, const int *macro_str, Sym *args) · 2639 unmodified lines
2640 tok_str_add2(&str, t1, &cval);2640 tok_str_add2(&str, t1, &cval);
2641 }2641 }
2642 }2642 }
2643 } else {2643 } else if (*st != TOK_PLCHLDR) {
2644 /* NOTE: the stream cannot be read when macro2644 /* NOTE: the stream cannot be read when macro
2645 substituing an argument */2645 substituing an argument */
2646 macro_subst(&str, nested_list, st, NULL);2646 macro_subst(&str, nested_list, st, NULL);
tests/tests2/71_macro_empty_arg.c+9−0
@@ -0,0 +1,9 @@
1#include <stdio.h>
2
3#define T(a,b,c) a b c
4
5int main(void)
6{
7 printf("%d", T(1,+,2) T(+,,) T(,2,*) T(,7,) T(,,));
8 return 0;
9}
tests/tests2/71_macro_empty_arg.expect+1−0
@@ -0,0 +1 @@
117
tests/tests2/Makefile+3−1
@@ -89,7 +89,9 @@ TESTS = \ · 88 unmodified lines
89 67_macro_concat.test \89 67_macro_concat.test \
90 68_macro_param_list_err_1.test \90 68_macro_param_list_err_1.test \
91 69_macro_param_list_err_2.test \91 69_macro_param_list_err_2.test \
92 70_floating_point_literals.test92 70_floating_point_literals.test \
93 71_macro_empty_arg.test \
94
93 95
94# 34_array_assignment.test -- array assignment is not in C standard96# 34_array_assignment.test -- array assignment is not in C standard
95 97