diff options
| author | Michael Matz <matz@suse.de> | 2017-04-15 19:24:13 +0200 |
|---|---|---|
| committer | Michael Matz <matz@suse.de> | 2017-04-15 19:34:55 +0200 |
| commit | 328b826e8a43ed39f9eebb8493cc6abea2ddac1c (patch) | |
| tree | 11130f2851dbd99522cca765b91d5f012a431cdb /tests/pp | |
| parent | 536ed76d5a69d8e3c0e247d6557f5942818cb253 (diff) | |
| download | tinycc-328b826e8a43ed39f9eebb8493cc6abea2ddac1c.tar.gz tinycc-328b826e8a43ed39f9eebb8493cc6abea2ddac1c.tar.bz2 | |
tccpp: Fix corner case of fnlike macro invocation
Arg substitution leaves placeholder marker in the stream for
empty arguments. Those need to be skipped when searching for
a fnlike macro invocation in the replacement list itself. See
testcase.
Diffstat (limited to 'tests/pp')
| -rw-r--r-- | tests/pp/18.c | 15 | ||||
| -rw-r--r-- | tests/pp/18.expect | 3 |
2 files changed, 18 insertions, 0 deletions
diff --git a/tests/pp/18.c b/tests/pp/18.c new file mode 100644 index 0000000..0961426 --- /dev/null +++ b/tests/pp/18.c @@ -0,0 +1,15 @@ +#define M_RETI_ARG27(x,y,z,aa, ...) aa +#define M_RET_ARG27(...) M_RETI_ARG27(__VA_ARGS__) +#define M_COMMA_P(...) M_RET_ARG27(__VA_ARGS__, 1, 1, 0, useless) +#define M_EMPTYI_DETECT(...) 0, 1, +#define M_EMPTYI_P_C1(...) M_COMMA_P(M_EMPTYI_DETECT __VA_ARGS__ () ) +#define EX +#define empty(x) +#define fnlike(x) yeah x +/* If the following macro is called with empty arg (X183), the use + of 'x' between fnlike and '(' doesn't hinder the recognition of this + being a further fnlike macro invocation. */ +#define usefnlike(x) fnlike x (x) +X181 M_EMPTYI_P_C1() +X182 M_EMPTYI_P_C1(x) +X183 usefnlike() diff --git a/tests/pp/18.expect b/tests/pp/18.expect new file mode 100644 index 0000000..447a9b2 --- /dev/null +++ b/tests/pp/18.expect @@ -0,0 +1,3 @@ +X181 1 +X182 0 +X183 yeah |
