[Ada] Implement No_Unrecognized_{Aspects,Pragmas} restrictions
[gcc.git] / gcc / ada / par-ch13.adb
index 95223a1a354d56515462a33491c20773d290ddb9..8bee84086bebebe91692c061ec6710d5d793619d 100644 (file)
@@ -23,6 +23,8 @@
 --                                                                          --
 ------------------------------------------------------------------------------
 
+with Rident;    use Rident;
+with Restrict; use Restrict;
 pragma Style_Checks (All_Checks);
 --  Turn off subprogram body ordering check. Subprograms are in order
 --  by RM section rather than alphabetical
@@ -264,20 +266,28 @@ package body Ch13 is
          --  The aspect mark is not recognized
 
          if A_Id = No_Aspect then
-            Error_Msg_Warn := not Debug_Flag_2;
-            Error_Msg_N ("<<& is not a valid aspect identifier", Token_Node);
-            OK := False;
-
-            --  Check bad spelling
-
-            for J in Aspect_Id_Exclude_No_Aspect loop
-               if Is_Bad_Spelling_Of (Token_Name, Aspect_Names (J)) then
-                  Error_Msg_Name_1 := Aspect_Names (J);
-                  Error_Msg_N -- CODEFIX
-                    ("\<<possible misspelling of%", Token_Node);
-                  exit;
+            declare
+               Msg_Issued : Boolean := False;
+            begin
+               Check_Restriction (Msg_Issued, No_Unrecognized_Aspects, Aspect);
+               if not Msg_Issued then
+                  Error_Msg_Warn := not Debug_Flag_2;
+                  Error_Msg_N
+                    ("<<& is not a valid aspect identifier", Token_Node);
+                  OK := False;
+
+                  --  Check bad spelling
+
+                  for J in Aspect_Id_Exclude_No_Aspect loop
+                     if Is_Bad_Spelling_Of (Token_Name, Aspect_Names (J)) then
+                        Error_Msg_Name_1 := Aspect_Names (J);
+                        Error_Msg_N -- CODEFIX
+                          ("\<<possible misspelling of%", Token_Node);
+                        exit;
+                     end if;
+                  end loop;
                end if;
-            end loop;
+            end;
 
             Scan; -- past incorrect identifier