gcc/libcpp
Jakub Jelinek e235031d49 c++: Partially implement P1042R1: __VA_OPT__ wording clarifications [PR92319]
I've noticed we claim in cxx-status.html that we implement P1042R1,
but it seems we don't implement any of the changes from there.
The following patch implements just the change that __VA_OPT__ determines
whether to expand to nothing or the enclosed tokens no longer based on
whether there were any tokens passed to __VA_ARGS__, but whether __VA_ARGS__
expands to any tokens (from testing apparently it has to be non-CPP_PADDING
tokens).

I'm afraid I'm completely lost about the padding preservation/removal
changes that are also in the paper, so haven't touched that part.

2020-02-14  Jakub Jelinek  <jakub@redhat.com>

	Partially implement P1042R1: __VA_OPT__ wording clarifications
	PR preprocessor/92319
	* macro.c (expand_arg): Move declarations before vaopt_state
	definition.
	(class vaopt_state): Move enum update_type definition earlier.  Remove
	m_allowed member, add m_arg and m_update members.
	(vaopt_state::vaopt_state): Change last argument from bool any_args
	to macro_arg *arg, initialize m_arg and m_update instead of m_allowed.
	(vaopt_state::update): When bumping m_state from 1 to 2 and m_update
	is ERROR, determine if __VA_ARGS__ expansion has any non-CPP_PADDING
	tokens and set m_update to INCLUDE if it has any, DROP otherwise.
	Return m_update instead of m_allowed ? INCLUDE : DROP in m_state >= 2.
	(replace_args, create_iso_definition): Adjust last argument to
	vaopt_state ctor.

	* c-c++-common/cpp/va-opt-4.c: New test.
2020-02-14 09:04:14 +01:00
..
include Remove trailing comma to avoid pedantic warning in C++ 98 mode: comma at end of enumerator list 2020-02-05 17:14:42 -07:00
po Regenerate .pot files. 2020-02-07 22:35:59 +00:00
aclocal.m4
ChangeLog c++: Partially implement P1042R1: __VA_OPT__ wording clarifications [PR92319] 2020-02-14 09:04:14 +01:00
ChangeLog.jit
charset.c Update copyright years. 2020-01-01 12:51:42 +01:00
config.in
configure Fixes after recent configure changes relating to static libraries 2020-02-01 00:34:28 +00:00
configure.ac
directives-only.c Update copyright years. 2020-01-01 12:51:42 +01:00
directives.c preprocessor: Make __has_include a builtin macro [PR93452] 2020-01-28 08:02:17 -08:00
errors.c Update copyright years. 2020-01-01 12:51:42 +01:00
expr.c preprocessor: Make __has_include a builtin macro [PR93452] 2020-01-28 08:02:17 -08:00
files.c [PR 80005] Fix __has_include 2020-01-20 05:39:59 -08:00
generated_cpp_wcwidth.h Byte vs column awareness for diagnostic-show-locus.c (PR 49973) 2019-12-09 20:03:47 +00:00
identifiers.c [PR 80005] Fix __has_include 2020-01-20 05:39:59 -08:00
init.c preprocessor: Make __has_include a builtin macro [PR93452] 2020-01-28 08:02:17 -08:00
internal.h preprocessor: Make __has_include a builtin macro [PR93452] 2020-01-28 08:02:17 -08:00
lex.c Update copyright years. 2020-01-01 12:51:42 +01:00
line-map.c Add diagnostic paths 2020-01-10 21:22:12 +00:00
location-example.txt
macro.c c++: Partially implement P1042R1: __VA_OPT__ wording clarifications [PR92319] 2020-02-14 09:04:14 +01:00
Makefile.in Update copyright years. 2020-01-01 12:51:42 +01:00
makeucnid.c Update copyright years. 2020-01-01 12:51:42 +01:00
mkdeps.c Work around array out of bounds warning in mkdeps 2020-01-16 11:09:24 +01:00
pch.c preprocessor: Make __has_include a builtin macro [PR93452] 2020-01-28 08:02:17 -08:00
symtab.c Update copyright years. 2020-01-01 12:51:42 +01:00
system.h Update copyright years. 2020-01-01 12:51:42 +01:00
traditional.c preprocessor: Make __has_include a builtin macro [PR93452] 2020-01-28 08:02:17 -08:00
ucnid.h Update copyright years. 2020-01-01 12:51:42 +01:00
ucnid.tab Update copyright years. 2020-01-01 12:51:42 +01:00