aboutsummaryrefslogtreecommitdiff
path: root/ChangeLog
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2020-07-28 15:41:30 +0200
committerJakub Jelinek <jakub@redhat.com>2020-07-28 15:41:30 +0200
commit86cb35983f55d6039b99b82ace30d2730fcb1eb1 (patch)
tree08ce56237c6fda746b917a9f3dff6d335b05c1fa /ChangeLog
parentae49af94850b26e50268031e24f1559d5a51edec (diff)
downloadgcc-86cb35983f55d6039b99b82ace30d2730fcb1eb1.zip
gcc-86cb35983f55d6039b99b82ace30d2730fcb1eb1.tar.gz
gcc-86cb35983f55d6039b99b82ace30d2730fcb1eb1.tar.bz2
c++: Fix up cp_lexer_safe_previous_token [PR96328]
The following testcase ICEs, because cp_lexer_safe_previous_token calls cp_lexer_previous_token and that ICEs, because all tokens in the lexer buffer before the current one (CPP_EOF) have been purged. cp_lexer_safe_previous_token is used in the context where it is ok if it punts, so the patch changes the function so that it doesn't assert there is some previous token, but instead returns NULL like in other cases where it punts. In addition to this, in the last hunk it does a micro-optimization, don't call the potentially expensive function if it will not need the result, instead check the least expensive condition first. And the middle hunk is a similar change from Mark's version of the patch, to use the safe variant in there because it is again just about a hint and it is better not to provide the hint than to ICE, though we don't have a testcase that would ICE. 2020-07-28 Jakub Jelinek <jakub@redhat.com> Mark Wielaard <mark@klomp.org> PR c++/96328 * parser.c (cp_lexer_safe_previous_token): Don't call cp_lexer_previous_token, instead inline it by hand and return NULL instead of failing assertion if all previous tokens until the first one are purged. (cp_parser_error_1): Optimize - only call cp_lexer_safe_previous_token if token->type is CPP_NAME. Use cp_lexer_safe_previous_token instead of cp_lexer_previous_token for the missing_token_desc != RT_NONE case too. * g++.dg/diagnostic/pr96328.C: New test. Co-Authored-By: Mark Wielaard <mark@klomp.org>
Diffstat (limited to 'ChangeLog')
0 files changed, 0 insertions, 0 deletions