tccpp: Implement __COUNTER__
commit824dcebe59f52a686b003214c1af0633cf5fe89e
authorMichael Matz <matz@suse.de>
Sun, 9 Jul 2017 03:30:47 +0000 (9 05:30 +0200)
committerMichael Matz <matz@suse.de>
Sun, 9 Jul 2017 03:30:47 +0000 (9 05:30 +0200)
treec3f0e9be1b79309bd2e02932c1ebe52b9609e8b2
parent1f3d3957c4aa4d403b07245fe4f0a49ac8fefcc4
tccpp: Implement __COUNTER__

This requires one more change in how macro arguments are expanded:
the standard requires that macro args are expanded before substituting
into the replacement list.  This implies expanding them only once
even when they occur multiple times in the list.  TCC expanded
them repeatedly in that case.  Without __COUNTER__ that's harmless.

So, simply always expand arguments (when used without # and ##) once
and store the resulting tokens.
libtcc.c
tccpp.c
tcctok.h
tests/pp/pp-counter.c [new file with mode: 0644]
tests/pp/pp-counter.expect [new file with mode: 0644]