C++: avoid partial duplicate implementation of cp_parser_error
commit9af3e7f6b40c6a88447a552d0f38efb73871800b
authordmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 12 Oct 2017 17:29:15 +0000 (12 17:29 +0000)
committerdmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 12 Oct 2017 17:29:15 +0000 (12 17:29 +0000)
treeebedc33278fd940d2f13db951d60f5634e8eaf83
parentf2dc888e5a1bed57bae5d3ac74c4f945cb94b22a
C++: avoid partial duplicate implementation of cp_parser_error

In r251026 (aka 3fe34694f0990d1d649711ede0326497f8a849dc,
"C/C++: show pertinent open token when missing a close token")
I copied part of cp_parser_error into cp_parser_required_error,
leading to duplication of code.

This patch eliminates this duplication by merging the two copies of the
code into a new cp_parser_error_1 subroutine.

Doing so removes an indentation level, making the patch appear to have
more churn than it really does.

The patch also undoes the change to g++.dg/parse/pragma2.C, as the
old behavior is restored.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@253686 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/parse/pragma2.C