aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2020-10-20 07:51:40 -0700
committerNathan Sidwell <nathan@acm.org>2020-10-20 08:01:34 -0700
commitdbcc6b1577bedd2bf5879393c862b6c461787503 (patch)
tree7c7367f1c312b308ff6755df41cbeea55c62fbe8 /gcc
parent35f258f4bbba7fa044f90b4f14d1bc942db58089 (diff)
downloadgcc-dbcc6b1577bedd2bf5879393c862b6c461787503.zip
gcc-dbcc6b1577bedd2bf5879393c862b6c461787503.tar.gz
gcc-dbcc6b1577bedd2bf5879393c862b6c461787503.tar.bz2
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.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/c-c++-common/cpp/endif.c (renamed from gcc/testsuite/gcc.dg/cpp/endif.c)0
-rw-r--r--gcc/testsuite/c-c++-common/cpp/endif.h (renamed from gcc/testsuite/gcc.dg/cpp/endif.h)0
-rw-r--r--gcc/testsuite/c-c++-common/cpp/eof-2.c2
-rw-r--r--gcc/testsuite/c-c++-common/cpp/eof-3.c2
4 files changed, 2 insertions, 2 deletions
diff --git a/gcc/testsuite/gcc.dg/cpp/endif.c b/gcc/testsuite/c-c++-common/cpp/endif.c
index efea52c..efea52c 100644
--- a/gcc/testsuite/gcc.dg/cpp/endif.c
+++ b/gcc/testsuite/c-c++-common/cpp/endif.c
diff --git a/gcc/testsuite/gcc.dg/cpp/endif.h b/gcc/testsuite/c-c++-common/cpp/endif.h
index 3762249..3762249 100644
--- a/gcc/testsuite/gcc.dg/cpp/endif.h
+++ b/gcc/testsuite/c-c++-common/cpp/endif.h
diff --git a/gcc/testsuite/c-c++-common/cpp/eof-2.c b/gcc/testsuite/c-c++-common/cpp/eof-2.c
index 3a4af7f..9cc4fed 100644
--- a/gcc/testsuite/c-c++-common/cpp/eof-2.c
+++ b/gcc/testsuite/c-c++-common/cpp/eof-2.c
@@ -5,4 +5,4 @@
#define f(x) x
#include "eof-2.h"
- /* { dg-regexp {[^\n]*eof-2.h:4: error: unterminated argument list invoking macro "f"\n} } */
+ /* { dg-regexp {[^\n]*eof-2.h:4:21: error: unterminated argument list invoking macro "f"\n} } */
diff --git a/gcc/testsuite/c-c++-common/cpp/eof-3.c b/gcc/testsuite/c-c++-common/cpp/eof-3.c
index 316918e..e309a54 100644
--- a/gcc/testsuite/c-c++-common/cpp/eof-3.c
+++ b/gcc/testsuite/c-c++-common/cpp/eof-3.c
@@ -3,6 +3,6 @@
/* { dg-do preprocess } */
/* { dg-additional-options "-include $srcdir/c-c++-common/cpp/eof-2.h" } */
- /* { dg-regexp {[^\n]*eof-2.h:4: error: unterminated argument list invoking macro "f"\n} } */
+ /* { dg-regexp {[^\n]*eof-2.h:4:21: error: unterminated argument list invoking macro "f"\n} } */
token )