[Ada] 'use all type' syntax error

Arnaud Charlet charlet@adacore.com
Mon Jan 20 15:40:00 GMT 2014

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".

-------------- next part --------------
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;

More information about the Gcc-patches mailing list