diff mbox series

[Ada] Improve error recovery

Message ID 20201130141712.GA117864@adacore.com
State New
Headers show
Series [Ada] Improve error recovery | expand

Commit Message

Pierre-Marie de Rodat Nov. 30, 2020, 2:17 p.m. UTC
Function P_Formal_Part was unnecessarily calling Scan after calling
T_Semicolon: T_Semicolon is already calling Scan to go past the
comma-used-insted-of-semicolon.

This avoids spurious cascaded errors in case of e.g:

  procedure P (A : Integer, B : Integer, C : Integer) is

where ',' is used instead of ';'.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

	* par-ch6.adb (P_Formal_Part): Remove extra call to Scan.
	* par-tchk.adb: Minor reformatting.
diff mbox series

Patch

diff --git a/gcc/ada/par-ch6.adb b/gcc/ada/par-ch6.adb
--- a/gcc/ada/par-ch6.adb
+++ b/gcc/ada/par-ch6.adb
@@ -1650,7 +1650,6 @@  package body Ch6 is
 
          elsif Token = Tok_Comma then
             T_Semicolon;
-            Scan; -- past comma
 
          --  Special check for omitted separator
 


diff --git a/gcc/ada/par-tchk.adb b/gcc/ada/par-tchk.adb
--- a/gcc/ada/par-tchk.adb
+++ b/gcc/ada/par-tchk.adb
@@ -436,7 +436,6 @@  package body Tchk is
 
    procedure T_Semicolon is
    begin
-
       if Token = Tok_Semicolon then
          Scan;