mirror of
git://gcc.gnu.org/git/gcc.git
synced 2024-11-25 02:13:10 +08:00
d565999792
The following patch implements C++20 # __VA_OPT__ (...) support. Testcases cover what I came up with myself and what LLVM has for #__VA_OPT__ in its testsuite and the string literals are identical between the two compilers on the va-opt-5.c testcase. 2021-08-17 Jakub Jelinek <jakub@redhat.com> libcpp/ * macro.c (vaopt_state): Add m_stringify member. (vaopt_state::vaopt_state): Initialize it. (vaopt_state::update): Overwrite it. (vaopt_state::stringify): New method. (stringify_arg): Replace arg argument with first, count arguments and add va_opt argument. Use first instead of arg->first and count instead of arg->count, for va_opt add paste_tokens handling. (paste_tokens): Fix up len calculation. Don't spell rhs twice, instead use %.*s to supply lhs and rhs spelling lengths. Don't call _cpp_backup_tokens here. (paste_all_tokens): Call it here instead. (replace_args): Adjust stringify_arg caller. For vaopt_state::END if stringify is true handle __VA_OPT__ stringification. (create_iso_definition): Handle # __VA_OPT__ similarly to # macro_arg. gcc/testsuite/ * c-c++-common/cpp/va-opt-5.c: New test. * c-c++-common/cpp/va-opt-6.c: New test. |
||
---|---|---|
.. | ||
include | ||
po | ||
aclocal.m4 | ||
ChangeLog | ||
ChangeLog.jit | ||
charset.c | ||
config.in | ||
configure | ||
configure.ac | ||
directives.c | ||
errors.c | ||
expr.c | ||
files.c | ||
generated_cpp_wcwidth.h | ||
identifiers.c | ||
init.c | ||
internal.h | ||
lex.c | ||
line-map.c | ||
location-example.txt | ||
macro.c | ||
Makefile.in | ||
makeucnid.c | ||
mkdeps.c | ||
pch.c | ||
symtab.c | ||
system.h | ||
traditional.c | ||
ucnid.h | ||
ucnid.tab |