[Ada] Complain about missing -gnat2020 switch on iterator_filter
authorPiotr Trojanek <trojanek@adacore.com>
Wed, 25 Nov 2020 11:05:47 +0000 (12:05 +0100)
committerPierre-Marie de Rodat <derodat@adacore.com>
Tue, 15 Dec 2020 11:41:55 +0000 (06:41 -0500)
gcc/ada/

* par-ch5.adb (P_Loop_Parameter_Specification): Complain about
missing -gnat2020 switch.
(P_Iterator_Specification): Likewise.

gcc/ada/par-ch5.adb

index 5b002c46f06394b51dfe3f76872ab3be9d4ebee2..ce02af727736399e05a44b33d517c17f706eb3d2 100644 (file)
@@ -1712,9 +1712,9 @@ package body Ch5 is
       Set_Discrete_Subtype_Definition
         (Loop_Param_Specification_Node, P_Discrete_Subtype_Definition);
 
-      if Ada_Version >= Ada_2020
-         and then Token = Tok_When
-      then
+      if Token = Tok_When then
+         Error_Msg_Ada_2020_Feature ("iterator filter", Token_Ptr);
+
          Scan; -- past WHEN
          Set_Iterator_Filter
            (Loop_Param_Specification_Node, P_Condition);
@@ -1773,9 +1773,9 @@ package body Ch5 is
 
       Set_Name (Node1, P_Name);
 
-      if Ada_Version >= Ada_2020
-         and then Token = Tok_When
-      then
+      if Token = Tok_When then
+         Error_Msg_Ada_2020_Feature ("iterator filter", Token_Ptr);
+
          Scan; -- past WHEN
          Set_Iterator_Filter
            (Node1, P_Condition);