gcc/libcpp
Jakub Jelinek d565999792 c++: Add C++20 #__VA_OPT__ support
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.
2021-08-17 09:27:57 +02:00
..
include c: Add support for __FILE_NAME__ macro (PR c/42579) 2021-05-20 08:12:41 +00:00
po Daily bump. 2021-08-17 00:16:32 +00:00
aclocal.m4
ChangeLog Daily bump. 2021-08-13 00:16:43 +00:00
ChangeLog.jit
charset.c
config.in
configure GCC_CET_HOST_FLAGS: Check if host supports multi-byte NOPs 2021-05-03 05:01:23 -07:00
configure.ac
directives.c preprocessor: Support C2X #elifdef, #elifndef 2021-05-11 23:54:01 +00:00
errors.c
expr.c preprocessor: Fix pp-number lexing of digit separators [PR83873, PR97604] 2021-05-06 23:20:35 +00:00
files.c c++: header-unit build capability [PR 99023] 2021-02-18 13:22:48 -08:00
generated_cpp_wcwidth.h
identifiers.c
init.c c: Add support for __FILE_NAME__ macro (PR c/42579) 2021-05-20 08:12:41 +00:00
internal.h c++: header-unit build capability [PR 99023] 2021-02-18 13:22:48 -08:00
lex.c libcpp: Fix up -fdirectives-only handling of // comments on last line not terminated with newline [PR100646] 2021-05-20 09:09:07 +02:00
line-map.c libcpp: location comparison within macro [PR100796] 2021-06-16 11:41:08 -04:00
location-example.txt
macro.c c++: Add C++20 #__VA_OPT__ support 2021-08-17 09:27:57 +02:00
Makefile.in
makeucnid.c libcpp: Fix makeucnid bug with combining values [PR100977] 2021-08-05 17:34:16 +02:00
mkdeps.c
pch.c
symtab.c
system.h
traditional.c
ucnid.h libcpp: Regenerate ucnid.h using Unicode 13.0.0 files [PR100977] 2021-08-05 17:35:20 +02:00
ucnid.tab