diff mbox

[Ada] 'use all type' syntax error

Message ID 20140120154002.GA15692@adacore.com
State New
Headers show

Commit Message

Arnaud Charlet Jan. 20, 2014, 3:40 p.m. UTC
This patch detects a syntax error when "use all" is not followed by "type".
The following test must get an error:
gcc -c use_all_type_syntax.adb
use_all_type_syntax.ads:3:12: "type" expected

package Use_All_Type_Syntax is

   use all TYP Boolean; -- syntax error

end Use_All_Type_Syntax;

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

2014-01-20  Bob Duff  <duff@adacore.com>

	* par-ch8.adb (P_Use_Type_Clause): Detect syntax
	error when "use all" is not followed by "type".
diff mbox

Patch

Index: par-ch8.adb
===================================================================
--- par-ch8.adb	(revision 206804)
+++ par-ch8.adb	(working copy)
@@ -113,7 +113,12 @@ 
          Error_Msg_Ada_2012_Feature ("|`USE ALL TYPE`", Token_Ptr);
          All_Present := True;
          Scan; -- past ALL
-      else
+
+         if Token /= Tok_Type then
+            Error_Msg_SC ("TYPE expected");
+         end if;
+
+      else pragma Assert (Token = Tok_Type);
          All_Present := False;
       end if;