Better error recovery for merge-conflict markers
authorDavid Malcolm <dmalcolm@redhat.com>
Wed, 16 Dec 2015 18:15:01 +0000 (18:15 +0000)
committerDavid Malcolm <dmalcolm@gcc.gnu.org>
Wed, 16 Dec 2015 18:15:01 +0000 (18:15 +0000)
commitde67c4c37913cb4f30cc0d5163665ab8419ac2ed
tree631c0d4e81b08a923db1179b2753d0d62d53bd9c
parent8a69b8590383788dc5da60693b3a48f8222a2893
Better error recovery for merge-conflict markers

gcc/c-family/ChangeLog:
* c-common.h (conflict_marker_get_final_tok_kind): New prototype.
* c-lex.c (conflict_marker_get_final_tok_kind): New function.

gcc/c/ChangeLog:
* c-parser.c (struct c_parser): Expand array "tokens_buf" from 2
to 4.
(c_parser_peek_nth_token): New function.
(c_parser_peek_conflict_marker): New function.
(c_parser_error): Detect conflict markers and report them as such.

gcc/cp/ChangeLog:
* parser.c (cp_lexer_peek_conflict_marker): New function.
(cp_parser_error): Detect conflict markers and report them as
such.

gcc/testsuite/ChangeLog:
* c-c++-common/conflict-markers-1.c: New testcase.
* c-c++-common/conflict-markers-2.c: Likewise.
* c-c++-common/conflict-markers-3.c: Likewise.
* c-c++-common/conflict-markers-4.c: Likewise.
* c-c++-common/conflict-markers-5.c: Likewise.
* c-c++-common/conflict-markers-6.c: Likewise.
* c-c++-common/conflict-markers-7.c: Likewise.
* c-c++-common/conflict-markers-8.c: Likewise.
* c-c++-common/conflict-markers-9.c: Likewise.
* c-c++-common/conflict-markers-10.c: Likewise.
* c-c++-common/conflict-markers-11.c: Likewise.
* g++.dg/conflict-markers-1.C: Likewise.

From-SVN: r231712
20 files changed:
gcc/c-family/ChangeLog
gcc/c-family/c-common.h
gcc/c-family/c-lex.c
gcc/c/ChangeLog
gcc/c/c-parser.c
gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/conflict-markers-1.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/conflict-markers-10.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/conflict-markers-11.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/conflict-markers-2.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/conflict-markers-3.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/conflict-markers-4.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/conflict-markers-5.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/conflict-markers-6.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/conflict-markers-7.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/conflict-markers-8.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/conflict-markers-9.c [new file with mode: 0644]
gcc/testsuite/g++.dg/conflict-markers-1.C [new file with mode: 0644]