preprocessor: Further fix for EOF in macro args [PR97471]
authorNathan Sidwell <nathan@acm.org>
Tue, 20 Oct 2020 14:51:40 +0000 (07:51 -0700)
committerNathan Sidwell <nathan@acm.org>
Tue, 20 Oct 2020 15:01:34 +0000 (08:01 -0700)
commitdbcc6b1577bedd2bf5879393c862b6c461787503
tree7c7367f1c312b308ff6755df41cbeea55c62fbe8
parent35f258f4bbba7fa044f90b4f14d1bc942db58089
preprocessor: Further fix for EOF in macro args [PR97471]

My previous attempt at fixing this was incorrect.  The problem occurs
earlier in that _cpp_lex_direct processes the unwinding EOF needs in
collect_args mode.  This patch changes it not to do that, in the same
way as directive parsing works.  Also collect_args shouldn't push_back
such fake EOFs, and neither should funlike_invocation_p.

libcpp/
* lex.c (_cpp_lex_direct): Do not complete EOF processing when
parsing_args.
* macro.c (collect_args): Do not unwind fake EOF.
(funlike_invocation_p): Do not unwind fake EOF.
(cpp_context): Replace abort with gcc_assert.
gcc/testsuite/
* gcc.dg/cpp/endif.c: Move to ...
* c-c++-common/cpp/endif.c: ... here.
* gcc.dg/cpp/endif.h: Move to ...
* c-c++-common/cpp/endif.h: ... here.
* c-c++-common/cpp/eof-2.c: Adjust diagnostic.
* c-c++-common/cpp/eof-3.c: Adjust diagnostic.
gcc/testsuite/c-c++-common/cpp/endif.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/cpp/endif.h [new file with mode: 0644]
gcc/testsuite/c-c++-common/cpp/eof-2.c
gcc/testsuite/c-c++-common/cpp/eof-3.c
gcc/testsuite/gcc.dg/cpp/endif.c [deleted file]
gcc/testsuite/gcc.dg/cpp/endif.h [deleted file]
libcpp/lex.c
libcpp/macro.c