No_Implicit_Loops, -- GNAT
No_Elaboration_Code, -- GNAT
No_Obsolescent_Features, -- Ada 2005 AI-368
+ No_Unrecognized_Aspects, -- AI12-0389-1/02
+ No_Unrecognized_Pragmas, -- AI12-0389-1/02
No_Wide_Characters, -- GNAT
Static_Dispatch_Tables, -- GNAT
SPARK_05, -- GNAT
-- --
------------------------------------------------------------------------------
+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
-- 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
-- No_Dependence must be processed at parse time, since otherwise it gets
-- handled too late.
--
+ -- No_Unrecognized_Aspects must be processed at parse time, since
+ -- unrecognized aspects are ignored by the parser.
+ --
-- Note that we don't need to do full error checking for badly formed cases
-- of restrictions, since these will be caught during semantic analysis.
("??% restriction is obsolete and ignored, consider " &
"using 'S'P'A'R'K_'Mode and gnatprove instead", Arg);
+ when Name_No_Unrecognized_Aspects =>
+ Set_Restriction
+ (No_Unrecognized_Aspects,
+ Pragma_Node,
+ Prag_Id = Pragma_Restriction_Warnings);
+
when others =>
null;
end case;
-- Deal with unrecognized pragma
if not Is_Pragma_Name (Pname) then
- if Warn_On_Unrecognized_Pragma then
- Error_Msg_Name_1 := Pname;
- Error_Msg_N ("?g?unrecognized pragma%!", Pragma_Identifier (N));
-
- for PN in First_Pragma_Name .. Last_Pragma_Name loop
- if Is_Bad_Spelling_Of (Pname, PN) then
- Error_Msg_Name_1 := PN;
- Error_Msg_N -- CODEFIX
- ("\?g?possible misspelling of %!", Pragma_Identifier (N));
- exit;
- end if;
- end loop;
- end if;
+ declare
+ Msg_Issued : Boolean := False;
+ begin
+ Check_Restriction
+ (Msg_Issued, No_Unrecognized_Pragmas, Pragma_Identifier (N));
+ if not Msg_Issued and then Warn_On_Unrecognized_Pragma then
+ Error_Msg_Name_1 := Pname;
+ Error_Msg_N ("?g?unrecognized pragma%!", Pragma_Identifier (N));
+
+ for PN in First_Pragma_Name .. Last_Pragma_Name loop
+ if Is_Bad_Spelling_Of (Pname, PN) then
+ Error_Msg_Name_1 := PN;
+ Error_Msg_N -- CODEFIX
+ ("\?g?possible misspelling of %!",
+ Pragma_Identifier (N));
+ exit;
+ end if;
+ end loop;
+ end if;
+ end;
return;
end if;
Name_No_Use_Of_Entity : constant Name_Id := N + $;
Name_No_Use_Of_Pragma : constant Name_Id := N + $;
Name_No_Unroll : constant Name_Id := N + $;
+ Name_No_Unrecognized_Aspects : constant Name_Id := N + $;
+ Name_No_Unrecognized_Pragmas : constant Name_Id := N + $;
Name_No_Vector : constant Name_Id := N + $;
Name_Nominal : constant Name_Id := N + $;
Name_Non_Volatile : constant Name_Id := N + $;