]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: error recovery & pragmas
authorNathan Sidwell <nathan@acm.org>
Wed, 15 Jul 2020 13:00:10 +0000 (06:00 -0700)
committerGiuliano Belinassi <giuliano.belinassi@usp.br>
Mon, 17 Aug 2020 16:17:46 +0000 (13:17 -0300)
commit9f03edbfb43ffb8aa8944931793b76941d85d945
tree23b7f82ca9e55bab73e8ad03900574b3048f8f5f
parent4fd8f15af4230be6b5bd147a7762cb9a4febe722
c++: error recovery & pragmas

Parser error recovery can get confused by the tokens within a deferred
pragma, as treats those as regular tokens.  This adjusts the recovery
so that the pragma is treated as a unit.  Also, the preprocessor now
ensures that we never have an EOF token inside a pragma -- the pragma
is always closed first.

gcc/cp/
* parser.c (cp_parser_skip_to_closing_parenthesis_1): Deal with
meeting a deferred pragma.
(cp_parser_skip_to_end_of_statement): Likewise.
(cp_parser_skip_to_end_of_block_or_statement): Likewise.
(cp_parser_skip_to_pragma_eol): We should never meet EOF.
(cp_parser_omp_declare_simd): Likewise.
(cp_parser_omp_declare_reduction, cp_parser_oacc_routine)
(pragma_lex): Likewise.
gcc/testsuite/
* g++.dg/parse/pragma-recovery.C: New.
gcc/cp/parser.c
gcc/testsuite/g++.dg/parse/pragma-recovery.C [new file with mode: 0644]