diff options
author | Nathan Sidwell <nathan@acm.org> | 2020-10-19 07:57:50 -0700 |
---|---|---|
committer | Nathan Sidwell <nathan@acm.org> | 2020-10-19 08:00:41 -0700 |
commit | 5abe05b4331250b6a7798ce87c0a82adc2bd70f3 (patch) | |
tree | e0e0014c3fb9a8fdf77f99b7393dd0dd443f9a0d /libcpp/internal.h | |
parent | 8d31eb8f17fa17f63d46651af1c69fb8eca2d04a (diff) | |
download | gcc-5abe05b4331250b6a7798ce87c0a82adc2bd70f3.zip gcc-5abe05b4331250b6a7798ce87c0a82adc2bd70f3.tar.gz gcc-5abe05b4331250b6a7798ce87c0a82adc2bd70f3.tar.bz2 |
preprocessor: Fix non-fn fn-like macro at EOF [PR97471]
We inject EOF tokens between macro argument lists, but had
confused/stale logic in the non-fn invocation. Renamed the magic
'eof' token, as it's now only used for macro argument termination.
Always rewind the non-OPEN_PAREN token.
libcpp/
* internal.h (struct cpp_reader): Rename 'eof' field to 'endarg'.
* init.c (cpp_create_reader): Adjust.
* macro.c (collect_args): Use endarg for separator. Always rewind
in the not-fn case.
gcc/testsuite/
* c-c++-common/cpp/pr97471.c: New.
Diffstat (limited to 'libcpp/internal.h')
-rw-r--r-- | libcpp/internal.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libcpp/internal.h b/libcpp/internal.h index b728df7..b1a2a99 100644 --- a/libcpp/internal.h +++ b/libcpp/internal.h @@ -517,9 +517,9 @@ struct cpp_reader set to -1 to disable it or to a non-negative value to enable it. */ time_t source_date_epoch; - /* EOF token, and a token forcing paste avoidance. */ + /* A token forcing paste avoidance, and one demarking macro arguments. */ cpp_token avoid_paste; - cpp_token eof; + cpp_token endarg; /* Opaque handle to the dependencies of mkdeps.c. */ class mkdeps *deps; |