mirror of
https://github.com/mirror/tinycc.git
synced 2024-12-28 04:00:06 +08:00
Fix macro expansion of empty args.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
This commit is contained in:
parent
a6149c6dbb
commit
fb6331e0fa
2
tccpp.c
2
tccpp.c
@ -2640,7 +2640,7 @@ static int *macro_arg_subst(Sym **nested_list, const int *macro_str, Sym *args)
|
||||
tok_str_add2(&str, t1, &cval);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
} else if (*st != TOK_PLCHLDR) {
|
||||
/* NOTE: the stream cannot be read when macro
|
||||
substituing an argument */
|
||||
macro_subst(&str, nested_list, st, NULL);
|
||||
|
9
tests/tests2/71_macro_empty_arg.c
Normal file
9
tests/tests2/71_macro_empty_arg.c
Normal file
@ -0,0 +1,9 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#define T(a,b,c) a b c
|
||||
|
||||
int main(void)
|
||||
{
|
||||
printf("%d", T(1,+,2) T(+,,) T(,2,*) T(,7,) T(,,));
|
||||
return 0;
|
||||
}
|
1
tests/tests2/71_macro_empty_arg.expect
Normal file
1
tests/tests2/71_macro_empty_arg.expect
Normal file
@ -0,0 +1 @@
|
||||
17
|
@ -89,7 +89,9 @@ TESTS = \
|
||||
67_macro_concat.test \
|
||||
68_macro_param_list_err_1.test \
|
||||
69_macro_param_list_err_2.test \
|
||||
70_floating_point_literals.test
|
||||
70_floating_point_literals.test \
|
||||
71_macro_empty_arg.test \
|
||||
|
||||
|
||||
# 34_array_assignment.test -- array assignment is not in C standard
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user