]> gcc.gnu.org Git - gcc.git/commit
libcpp: Ignore CPP_PADDING tokens in _cpp_parse_expr [PR105732]
authorJakub Jelinek <jakub@redhat.com>
Sun, 29 May 2022 19:57:51 +0000 (21:57 +0200)
committerJakub Jelinek <jakub@redhat.com>
Wed, 15 Jun 2022 12:03:37 +0000 (14:03 +0200)
commitb2f5dc82400fe04511b85caa8c80677f81eee415
tree54e4a47c64665697ee82091ac56c56484e2c4a7e
parentb524caf88624a59977297535db74f81d37529a28
libcpp: Ignore CPP_PADDING tokens in _cpp_parse_expr [PR105732]

The first part of the following testcase (m1-m3 macros and its use)
regressed with my PR89971 fix, but as the m1,m4-m5 and its use part shows,
the problem isn't new, we can emit a CPP_PADDING token to avoid it from
being adjacent to whatever comes after the __VA_OPT__ (in this case there
is nothing afterwards, true).

In most cases these CPP_PADDING tokens don't matter, all other
callers of cpp_get_token_with_location either ignore CPP_PADDING tokens
completely (e.g. c_lex_with_flags) or they just remember them and
take them into account when printing stuff whether there should be
added whitespace or not (scan_translation_unit + token_streamer::stream).
So, I think we should just ignore CPP_PADDING tokens the same way in
_cpp_parse_expr.

2022-05-27  Jakub Jelinek  <jakub@redhat.com>

PR preprocessor/105732
* expr.c (_cpp_parse_expr): Handle CPP_PADDING by just another
token.

* c-c++-common/cpp/va-opt-10.c: New test.

(cherry picked from commit 58a40e76ebadce78639644cd3d56e42b68336927)
gcc/testsuite/c-c++-common/cpp/va-opt-10.c [new file with mode: 0644]
libcpp/expr.c
This page took 0.062049 seconds and 6 git commands to generate.