+2017-01-12 Bob Duff <duff@adacore.com>
+
+ * contracts.adb, einfo.adb, errout.adb, exp_attr.adb,
+ exp_ch3.adb, exp_ch7.adb, exp_ch9.adb, exp_prag.adb, freeze.adb,
+ frontend.adb, ghost.adb, inline.adb, lib-writ.adb, lib-xref.adb,
+ par.adb, par-ch10.adb, par-ch2.adb, par-prag.adb, par_sco.adb,
+ sem_attr.adb, sem_aux.adb, sem_ch10.adb, sem_ch12.adb,
+ sem_ch13.adb, sem_ch6.adb, sem_ch8.adb, sem_ch9.adb, sem_elab.adb,
+ sem_prag.adb, sem_res.adb, sem_util.adb, sem_util.ads,
+ sem_warn.adb, sinfo.adb, sinfo.ads, sprint.adb (Pragma_Name):
+ Change name to Pragma_Name_Unmapped.
+ (Pragma_Name_Mapped): Change name to Pragma_Name.
+ This is because the "mapped" version should be the usual case.
+
2017-01-09 Hristian Kirtchev <kirtchev@adacore.com>
* einfo.ads, einfo.adb: Remove uses of flags Has_Default_Init_Cond,
-- A contract must contain only pragmas
pragma Assert (Nkind (Prag) = N_Pragma);
- Prag_Nam : constant Name_Id := Pragma_Name_Mapped (Prag);
+ Prag_Nam : constant Name_Id := Pragma_Name (Prag);
-- Start of processing for Add_Contract_Item
Prag := Contract_Test_Cases (Items);
while Present (Prag) loop
- Prag_Nam := Pragma_Name_Mapped (Prag);
+ Prag_Nam := Pragma_Name (Prag);
if Prag_Nam = Name_Contract_Cases then
Prag := Classifications (Items);
while Present (Prag) loop
- Prag_Nam := Pragma_Name_Mapped (Prag);
+ Prag_Nam := Pragma_Name (Prag);
if Prag_Nam = Name_Depends then
Depends := Prag;
Prag := Classifications (Items);
while Present (Prag) loop
- Prag_Nam := Pragma_Name_Mapped (Prag);
+ Prag_Nam := Pragma_Name (Prag);
if Prag_Nam = Name_Initial_Condition then
Init_Cond := Prag;
if Present (Items) then
Prag := Contract_Test_Cases (Items);
while Present (Prag) loop
- if Pragma_Name_Mapped (Prag) = Name_Contract_Cases then
+ if Pragma_Name (Prag) = Name_Contract_Cases then
Expand_Pragma_Contract_Cases
(CCs => Prag,
Subp_Id => Subp_Id,
if Present (Items) then
Prag := Pre_Post_Conditions (Items);
while Present (Prag) loop
- if Pragma_Name_Mapped (Prag) = Post_Nam then
+ if Pragma_Name (Prag) = Post_Nam then
Append_Enabled_Item
(Item => Build_Pragma_Check_Equivalent (Prag),
List => Stmts);
-- Note that non-matching pragmas are skipped
if Nkind (Decl) = N_Pragma then
- if Pragma_Name_Mapped (Decl) = Post_Nam then
+ if Pragma_Name (Decl) = Post_Nam then
Append_Enabled_Item
(Item => Build_Pragma_Check_Equivalent (Decl),
List => Stmts);
if Present (Items) then
Prag := Pre_Post_Conditions (Items);
while Present (Prag) loop
- if Pragma_Name_Mapped (Prag) = Name_Postcondition then
+ if Pragma_Name (Prag) = Name_Postcondition then
Append_Enabled_Item
(Item => Build_Pragma_Check_Equivalent (Prag),
List => Stmts);
if Present (Items) then
Prag := Pre_Post_Conditions (Items);
while Present (Prag) loop
- if Pragma_Name_Mapped (Prag) = Name_Postcondition
+ if Pragma_Name (Prag) = Name_Postcondition
and then Class_Present (Prag)
then
Append_Enabled_Item
if Present (Items) then
Prag := Pre_Post_Conditions (Items);
while Present (Prag) loop
- if Pragma_Name_Mapped (Prag) = Name_Precondition
+ if Pragma_Name (Prag) = Name_Precondition
and then Class_Present (Prag)
then
Check_Prag :=
if Present (Items) then
Prag := Pre_Post_Conditions (Items);
while Present (Prag) loop
- if Pragma_Name_Mapped (Prag) = Name_Precondition then
+ if Pragma_Name (Prag) = Name_Precondition then
Prepend_To_Decls_Or_Save (Prag);
end if;
-- Note that non-matching pragmas are skipped
if Nkind (Decl) = N_Pragma then
- if Pragma_Name_Mapped (Decl) = Name_Precondition then
+ if Pragma_Name (Decl) = Name_Precondition then
Prepend_To_Decls_Or_Save (Decl);
end if;
while Present (Item) loop
if Nkind (Item) = N_Pragma
- and then Get_Pragma_Id (Pragma_Name (Item)) = Id
+ and then Get_Pragma_Id (Pragma_Name_Unmapped (Item)) = Id
then
return Item;
Ritem := First_Rep_Item (Id);
while Present (Ritem) loop
if Nkind (Ritem) = N_Pragma
- and then Pragma_Name_Mapped (Ritem) = Name_Attach_Handler
+ and then Pragma_Name (Ritem) = Name_Attach_Handler
then
return True;
else
Ritem := First_Rep_Item (Id);
while Present (Ritem) loop
if Nkind (Ritem) = N_Pragma
- and then Pragma_Name_Mapped (Ritem) = Name_Interrupt_Handler
+ and then Pragma_Name (Ritem) = Name_Interrupt_Handler
then
return True;
else
-- identifiers, pragmas, and pragma argument associations.
if Nkind (Node) = N_Pragma then
- Nam := Pragma_Name_Mapped (Node);
+ Nam := Pragma_Name (Node);
Loc := Sloc (Node);
-- The other cases have Chars fields
N := First_Rep_Item (Implementation_Base_Type (T));
while Present (N) loop
if Nkind (N) = N_Pragma
- and then Pragma_Name_Mapped (N) = Name_Stream_Convert
+ and then Pragma_Name (N) = Name_Stream_Convert
then
-- For tagged types this pragma is not inherited, so we
-- must verify that it is defined for the given type and
-- Conversion for Priority expression
if Nam = Name_Priority then
- if Pragma_Name_Mapped (Ritem) = Name_Priority
+ if Pragma_Name (Ritem) = Name_Priority
and then not GNAT_Mode
then
Exp := Convert_To (RTE (RE_Priority), Exp);
Rep_Item := First_Rep_Item (T);
while Present (Rep_Item) loop
if Nkind (Rep_Item) = N_Pragma
- and then Pragma_Name_Mapped (Rep_Item) = Name_Invariant
+ and then Pragma_Name (Rep_Item) = Name_Invariant
then
-- Stop the traversal of the rep item chain once a specific
-- item is encountered.
Prag := Pre_Post_Conditions (Items);
while Present (Prag) loop
- if Nam_In (Pragma_Name (Prag), Name_Postcondition,
- Name_Precondition)
+ if Nam_In (Pragma_Name_Unmapped (Prag),
+ Name_Postcondition, Name_Precondition)
and then Is_Checked (Prag)
then
Has_Pragma := True;
Prag := Contract_Test_Cases (Items);
while Present (Prag) loop
- if Pragma_Name_Mapped (Prag) = Name_Contract_Cases
+ if Pragma_Name (Prag) = Name_Contract_Cases
and then Is_Checked (Prag)
then
Has_Pragma := True;
Ritem := First_Rep_Item (Prot_Typ);
while Present (Ritem) loop
if Nkind (Ritem) = N_Pragma
- and then Pragma_Name_Mapped (Ritem) = Name_Attach_Handler
+ and then Pragma_Name (Ritem) = Name_Attach_Handler
then
Num_Attach_Handler := Num_Attach_Handler + 1;
end if;
N := First (Visible_Declarations (T));
while Present (N) loop
if Nkind (N) = N_Pragma
- and then Pragma_Name_Mapped (N) = Name_Relative_Deadline
+ and then Pragma_Name (N) = Name_Relative_Deadline
then
return N;
end if;
N := First (Private_Declarations (T));
while Present (N) loop
if Nkind (N) = N_Pragma
- and then Pragma_Name_Mapped (N) = Name_Relative_Deadline
+ and then Pragma_Name (N) = Name_Relative_Deadline
then
return N;
end if;
-- Get_Rep_Item returns either priority pragma.
- if Pragma_Name_Mapped (Prio_Clause) = Name_Priority then
+ if Pragma_Name (Prio_Clause) = Name_Priority then
Prio_Type := RTE (RE_Any_Priority);
else
Prio_Type := RTE (RE_Interrupt_Priority);
while Present (Ritem) loop
if Nkind (Ritem) = N_Pragma
- and then Pragma_Name_Mapped (Ritem) = Name_Attach_Handler
+ and then Pragma_Name (Ritem) = Name_Attach_Handler
then
declare
Handler : constant Node_Id :=
or else
(Nkind (Stmt) = N_Pragma
and then
- Nam_In (Pragma_Name (Stmt), Name_Unreferenced,
- Name_Unmodified,
- Name_Warnings)))
+ Nam_In (Pragma_Name_Unmapped (Stmt),
+ Name_Unreferenced,
+ Name_Unmodified,
+ Name_Warnings)))
loop
Next (Stmt);
end loop;
---------------------
procedure Expand_N_Pragma (N : Node_Id) is
- Pname : constant Name_Id := Pragma_Name_Mapped (N);
+ Pname : constant Name_Id := Pragma_Name (N);
begin
-- Rewrite pragma ignored by Ignore_Pragma to null statement, so that
if Relaxed_RM_Semantics
and then List_Length (Pragma_Argument_Associations (N)) = 2
- and then Pragma_Name_Mapped (N) = Name_Import
+ and then Pragma_Name (N) = Name_Import
and then Nkind (Arg2 (N)) = N_String_Literal
then
Def_Id := Entity (Arg1 (N));
begin
while Present (Prag) loop
- if Nam_In (Pragma_Name (Prag), Name_Post,
- Name_Postcondition,
- Name_Refined_Post)
+ if Nam_In (Pragma_Name_Unmapped (Prag),
+ Name_Post,
+ Name_Postcondition,
+ Name_Refined_Post)
then
Exp :=
Expression
if Present (Decl)
and then Nkind (Decl) = N_Pragma
- and then Pragma_Name_Mapped (Decl) = Name_Import
+ and then Pragma_Name (Decl) = Name_Import
then
return;
end if;
Item := First (Context_Items (Cunit (Main_Unit)));
while Present (Item) loop
if Nkind (Item) = N_Pragma
- and then Pragma_Name_Mapped (Item) = Name_Initialize_Scalars
+ and then Pragma_Name (Item) = Name_Initialize_Scalars
then
Initialize_Scalars := True;
end if;
while Present (Decl) loop
if Nkind (Decl) = N_Pragma
- and then Pragma_Name_Mapped (Decl) = Name_Ghost
+ and then Pragma_Name (Decl) = Name_Ghost
then
return
Enables_Ghostness (First (Pragma_Argument_Associations (Decl)));
-- not be posting warnings on the inlined body so it is unneeded.
elsif Nkind (N) = N_Pragma
- and then Pragma_Name_Mapped (N) = Name_Unreferenced
+ and then Pragma_Name (N) = Name_Unreferenced
then
Rewrite (N, Make_Null_Statement (Sloc (N)));
return OK;
Write_Info_Initiate ('N');
Write_Info_Char (' ');
- case Pragma_Name (N) is
+ case Pragma_Name_Unmapped (N) is
when Name_Annotate =>
C := 'A';
when Name_Comment =>
P := Parent (P);
if Nkind (P) = N_Pragma then
- if Nam_In (Pragma_Name (P), Name_Warnings,
- Name_Unmodified,
- Name_Unreferenced)
+ if Nam_In (Pragma_Name_Unmapped (P),
+ Name_Warnings,
+ Name_Unmodified,
+ Name_Unreferenced)
then
return False;
end if;
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2015, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2016, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
Item := P_Pragma;
if Item = Error
- or else Pragma_Name (Item) /= Name_Source_Reference
+ or else Pragma_Name_Unmapped (Item) /= Name_Source_Reference
then
Restore_Scan_State (Scan_State);
Save_Scan_State (Scan_State);
Item := P_Pragma;
- if Item /= Error and then Pragma_Name (Item) = Name_No_Body then
+ if Item /= Error and then Pragma_Name_Unmapped (Item) = Name_No_Body
+ then
No_Body := True;
end if;
if Item = Error
- or else not Is_Configuration_Pragma_Name (Pragma_Name (Item))
+ or else
+ not Is_Configuration_Pragma_Name (Pragma_Name_Unmapped (Item))
then
Restore_Scan_State (Scan_State);
exit;
P := P_Pragma;
if Nkind (P) /= N_Error
- and then Nam_In (Pragma_Name (P), Name_Assert, Name_Debug)
+ and then Nam_In (Pragma_Name_Unmapped (P), Name_Assert, Name_Debug)
then
- Error_Msg_Name_1 := Pragma_Name (P);
+ Error_Msg_Name_1 := Pragma_Name_Unmapped (P);
Error_Msg_N
("pragma% must be in declaration/statement context", P);
else
separate (Par)
function Prag (Pragma_Node : Node_Id; Semi : Source_Ptr) return Node_Id is
- Prag_Name : constant Name_Id := Pragma_Name (Pragma_Node);
+ Prag_Name : constant Name_Id := Pragma_Name_Unmapped (Pragma_Node);
Prag_Id : constant Pragma_Id := Get_Pragma_Id (Prag_Name);
Pragma_Sloc : constant Source_Ptr := Sloc (Pragma_Node);
Arg_Count : Nat;
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2015, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2016, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- Give error if bad pragma
- if not Is_Configuration_Pragma_Name (Pragma_Name (P_Node))
- and then Pragma_Name (P_Node) /= Name_Source_Reference
+ if not Is_Configuration_Pragma_Name
+ (Pragma_Name_Unmapped (P_Node))
+ and then
+ Pragma_Name_Unmapped (P_Node) /= Name_Source_Reference
then
- if Is_Pragma_Name (Pragma_Name (P_Node)) then
+ if Is_Pragma_Name (Pragma_Name_Unmapped (P_Node)) then
Error_Msg_N
("only configuration pragmas allowed " &
"in configuration file", P_Node);
-- --
-- B o d y --
-- --
--- Copyright (C) 2009-2015, Free Software Foundation, Inc. --
+-- Copyright (C) 2009-2016, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
Pragma_Sloc := SCE.From;
SCO_Raw_Hash_Table.Set
(Pragma_Sloc, SCO_Raw_Table.Last + 1);
- Pragma_Aspect_Name := Pragma_Name (SCE.N);
+ Pragma_Aspect_Name := Pragma_Name_Unmapped (SCE.N);
pragma Assert (Pragma_Aspect_Name /= No_Name);
elsif SCE.Typ = 'P' then
- Pragma_Aspect_Name := Pragma_Name (SCE.N);
+ Pragma_Aspect_Name := Pragma_Name_Unmapped (SCE.N);
pragma Assert (Pragma_Aspect_Name /= No_Name);
end if;
-- Processing depends on the kind of pragma
declare
- Nam : constant Name_Id := Pragma_Name (N);
+ Nam : constant Name_Id := Pragma_Name_Unmapped (N);
Arg : Node_Id :=
First (Pragma_Argument_Associations (N));
Typ : Character;
if Nkind (Prag) = N_Aspect_Specification then
Prag_Nam := Chars (Identifier (Prag));
else
- Prag_Nam := Pragma_Name_Mapped (Prag);
+ Prag_Nam := Pragma_Name (Prag);
end if;
if Prag_Nam = Name_Check then
-- that the pragma appears in an appropriate loop location.
if Nkind (Original_Node (Stmt)) = N_Pragma
- and then Nam_In (Pragma_Name (Original_Node (Stmt)),
+ and then Nam_In (Pragma_Name_Unmapped (Original_Node (Stmt)),
Name_Loop_Invariant,
Name_Loop_Variant,
Name_Assert,
if Nkind (N) = N_Pragma
and then
- (Pragma_Name (N) = Nam
+ (Pragma_Name_Unmapped (N) = Nam
or else (Nam = Name_Priority
- and then Pragma_Name_Mapped (N) =
+ and then Pragma_Name (N) =
Name_Interrupt_Priority)
or else (Nam = Name_Interrupt_Priority
- and then Pragma_Name_Mapped (N) = Name_Priority))
+ and then Pragma_Name (N) = Name_Priority))
then
if Check_Parents then
return N;
elsif Nkind (Cont_Item) = N_Pragma
and then
- Nam_In (Pragma_Name (Cont_Item), Name_Elaborate,
- Name_Elaborate_All)
+ Nam_In (Pragma_Name_Unmapped (Cont_Item),
+ Name_Elaborate, Name_Elaborate_All)
and then not Used_Type_Or_Elab
then
Prag_Unit :=
Item := First (Context_Items (N));
while Present (Item)
and then Nkind (Item) = N_Pragma
- and then Pragma_Name_Mapped (Item) in Configuration_Pragma_Names
+ and then Pragma_Name (Item) in Configuration_Pragma_Names
loop
Analyze (Item);
Next (Item);
Item := First (Context_Items (N));
while Present (Item)
and then Nkind (Item) = N_Pragma
- and then Pragma_Name_Mapped (Item) in Configuration_Pragma_Names
+ and then Pragma_Name (Item) in Configuration_Pragma_Names
loop
Next (Item);
end loop;
Check_Declarations (Specification (Decl));
elsif Nkind (Decl) = N_Pragma
- and then Pragma_Name_Mapped (Decl) = Name_Import
+ and then Pragma_Name (Decl) = Name_Import
then
Check_Pragma_Import (Decl);
end if;
Append_Elmt (Decl, Incomplete_Decls);
elsif Nkind (Decl) = N_Pragma
- and then Pragma_Name_Mapped (Decl) = Name_Import
+ and then Pragma_Name (Decl) = Name_Import
then
Check_Pragma_Import (Decl);
end if;
Decl := First (Decls);
while Present (Decl) and then Nkind (Decl) = N_Pragma loop
- if Pragma_Name_Mapped (Decl) = Name_Abstract_State then
+ if Pragma_Name (Decl) = Name_Abstract_State then
Process_State
(Get_Pragma_Arg
(First (Pragma_Argument_Associations (Decl))));
-- Do not copy Comment or Ident pragmas their content is relevant to
-- the generic unit, not to the instantiating unit.
- if Nam_In (Pragma_Name (N), Name_Comment, Name_Ident) then
+ if Nam_In (Pragma_Name_Unmapped (N), Name_Comment, Name_Ident) then
New_N := Make_Null_Statement (Sloc (N));
-- Do not copy pragmas generated from aspects because the pragmas do
-- The only pragma of interest is Complete_Representation
- if Pragma_Name_Mapped (CC) = Name_Complete_Representation then
+ if Pragma_Name (CC) = Name_Complete_Representation then
CR_Pragma := CC;
end if;
Ritem := First_Rep_Item (Typ);
while Present (Ritem) loop
if Nkind (Ritem) = N_Pragma
- and then Pragma_Name_Mapped (Ritem) = Name_Predicate
+ and then Pragma_Name (Ritem) = Name_Predicate
then
Add_Predicate (Ritem);
begin
if Nkind (Prag) = N_Pragma
- and then Pragma_Name_Mapped (Prag) = Name_Predicate
+ and then Pragma_Name (Prag) = Name_Predicate
then
Add_Predicate (Prag);
end if;
if Is_Overloadable (T) and then Nkind (N) = N_Pragma then
declare
- Pname : constant Name_Id := Pragma_Name_Mapped (N);
+ Pname : constant Name_Id := Pragma_Name (N);
begin
if Nam_In (Pname, Name_Convention, Name_Import, Name_Export,
Name_External, Name_Interface)
procedure No_Independence is
begin
- if Pragma_Name_Mapped (N) = Name_Independent then
+ if Pragma_Name (N) = Name_Independent then
Error_Msg_NE ("independence cannot be guaranteed for&", N, E);
else
Error_Msg_NE
for J in Independence_Checks.First .. Independence_Checks.Last loop
N := Independence_Checks.Table (J).N;
E := Independence_Checks.Table (J).E;
- IC := Pragma_Name_Mapped (N) = Name_Independent_Components;
+ IC := Pragma_Name (N) = Name_Independent_Components;
-- Deal with component case
Next_Decl := Next (Decl);
if Nkind (Decl) = N_Pragma
- and then Nam_In (Pragma_Name (Decl), Name_Ghost,
- Name_SPARK_Mode,
- Name_Volatile_Function)
+ and then Nam_In (Pragma_Name_Unmapped (Decl),
+ Name_Ghost,
+ Name_SPARK_Mode,
+ Name_Volatile_Function)
then
Remove (Decl);
Insert_After (To, Decl);
begin
if Nkind (N) = N_Pragma
and then
- (Pragma_Name (N) = Name_Inline_Always
- or else (Pragma_Name (N) = Name_Inline
+ (Pragma_Name_Unmapped (N) = Name_Inline_Always
+ or else (Pragma_Name_Unmapped (N) = Name_Inline
and then
(Front_End_Inlining or else Optimization_Level > 0)))
and then Present (Pragma_Argument_Associations (N))
Analyze (Prag);
Set_Has_Pragma_Inline (Subp);
- if Pragma_Name_Mapped (Prag) = Name_Inline_Always then
+ if Pragma_Name (Prag) = Name_Inline_Always then
Set_Is_Inlined (Subp);
Set_Has_Pragma_Inline_Always (Subp);
end if;
begin
if Nkind (Orig) = N_Pragma
- and then Pragma_Name_Mapped (Orig) = Name_Assert
+ and then Pragma_Name (Orig) = Name_Assert
and then not Error_Posted (Orig)
then
declare
if Class_Present (Prag)
and then not Split_PPC (Prag)
then
- if Pragma_Name_Mapped (Prag) = Name_Precondition then
+ if Pragma_Name (Prag) = Name_Precondition then
Error_Msg_N
("info: & inherits `Pre''Class` aspect from "
& "#?L?", E);
Par := Nod;
while Present (Par) loop
if Nkind (Par) = N_Pragma then
- if Nam_In (Pragma_Name (Par), Name_Abstract_State,
- Name_Depends,
- Name_Global,
- Name_Initializes,
- Name_Refined_Depends,
- Name_Refined_Global)
+ if Nam_In (Pragma_Name_Unmapped (Par),
+ Name_Abstract_State,
+ Name_Depends,
+ Name_Global,
+ Name_Initializes,
+ Name_Refined_Depends,
+ Name_Refined_Global)
then
return True;
elsif Kind = N_Pragma then
declare
Prag_Name : constant Name_Id :=
- Pragma_Name_Mapped (N);
+ Pragma_Name (N);
Prag_Id : constant Pragma_Id :=
Get_Pragma_Id (Prag_Name);
-- Pragma case
else
- Error_Msg_Name_1 := Pragma_Name_Mapped (Prio_Item);
+ Error_Msg_Name_1 := Pragma_Name (Prio_Item);
Error_Msg_NE
("pragma% for & has no effect when Lock_Free given??",
Prio_Item, Id);
-- Pragma case
elsif Nkind (Prio_Item) = N_Pragma
- and then Pragma_Name_Mapped (Prio_Item) = Name_Priority
+ and then Pragma_Name (Prio_Item) = Name_Priority
then
Error_Msg_N
("pragma Interrupt_Priority is preferred in presence of "
Par := Call;
while Present (Par) loop
if Nkind (Par) = N_Pragma then
- Nam := Pragma_Name_Mapped (Par);
+ Nam := Pragma_Name (Par);
-- Pragma Initial_Condition appears in its alternative from as
-- Check (Initial_Condition, ...).
-- Or, in the case of an initial condition, specifically by a
-- Check pragma specifying an Initial_Condition check.
- elsif Pragma_Name_Mapped (O) = Name_Check
+ elsif Pragma_Name (O) = Name_Check
and then
Chars
(Expression (First (Pragma_Argument_Associations (O)))) =
Item := First (Context_Items (CU));
while Present (Item) loop
if Nkind (Item) = N_Pragma
- and then Pragma_Name_Mapped (Item) = Name_Elaborate_All
+ and then Pragma_Name (Item) = Name_Elaborate_All
then
-- Return if some previous error on the pragma itself. The
-- pragma may be unanalyzed, because of a previous error, or
return;
end if;
- Error_Msg_Name_1 := Pragma_Name_Mapped (N);
+ Error_Msg_Name_1 := Pragma_Name (N);
-- An external property pragma must apply to an effectively volatile
-- object other than a formal subprogram parameter (SPARK RM 7.1.3(2)).
-- previously given aspect specification or attribute definition
-- clause for the same pragma.
- P := Get_Rep_Item (E, Pragma_Name_Mapped (N), Check_Parents => False);
+ P := Get_Rep_Item (E, Pragma_Name (N), Check_Parents => False);
if Present (P) then
-- Here we have a definite duplicate
- Error_Msg_Name_1 := Pragma_Name_Mapped (N);
+ Error_Msg_Name_1 := Pragma_Name (N);
Error_Msg_Sloc := Sloc (P);
-- For a single protected or a single task object, the error is
if Nkind (Original_Node (Stmt)) = N_Pragma then
return
- Nam_In (Pragma_Name (Original_Node (Stmt)),
+ Nam_In (Pragma_Name_Unmapped (Original_Node (Stmt)),
Name_Loop_Invariant,
Name_Loop_Variant);
else
if Is_Rewrite_Substitution (N)
and then Nkind (Original_Node (N)) = N_Pragma
then
- Error_Msg_Name_1 := Pragma_Name_Mapped (Original_Node (N));
+ Error_Msg_Name_1 := Pragma_Name (Original_Node (N));
end if;
-- Case where pragma comes from an aspect specification
then
-- Give error if same as our pragma or Export/Convention
- if Nam_In (Pragma_Name (Decl), Name_Export,
- Name_Convention,
- Pragma_Name_Mapped (N))
+ if Nam_In (Pragma_Name_Unmapped (Decl),
+ Name_Export,
+ Name_Convention,
+ Pragma_Name_Unmapped (N))
then
exit;
-- Case of Import/Interface or the other way round
- elsif Nam_In (Pragma_Name (Decl), Name_Interface,
- Name_Import)
+ elsif Nam_In (Pragma_Name_Unmapped (Decl),
+ Name_Interface, Name_Import)
then
-- Here we know that we have Import and Interface. It
-- doesn't matter which way round they are. See if
-- Deal with unrecognized pragma
- Pname := Pragma_Name_Mapped (N);
+ Pname := Pragma_Name (N);
if not Is_Pragma_Name (Pname) then
if Warn_On_Unrecognized_Pragma then
-- Skip prior pragmas, but check for duplicates
if Nkind (Stmt) = N_Pragma then
- if Pragma_Name_Mapped (Stmt) = Pname then
+ if Pragma_Name (Stmt) = Pname then
Error_Msg_Name_1 := Pname;
Error_Msg_Sloc := Sloc (Stmt);
Error_Msg_N ("pragma % duplicates pragma declared#", N);
-- Skip prior pragmas, but check for duplicates
if Nkind (Stmt) = N_Pragma then
- if Pragma_Name_Mapped (Stmt) = Pname then
+ if Pragma_Name (Stmt) = Pname then
Error_Msg_Name_1 := Pname;
Error_Msg_Sloc := Sloc (Stmt);
Error_Msg_N ("pragma % duplicates pragma declared#", N);
if Is_Imported (Def_Id)
and then Present (First_Rep_Item (Def_Id))
and then Nkind (First_Rep_Item (Def_Id)) = N_Pragma
- and then Pragma_Name_Mapped (First_Rep_Item (Def_Id)) =
+ and then Pragma_Name (First_Rep_Item (Def_Id)) =
Name_Interface
then
null;
Nod := Next (N);
while Present (Nod) loop
if Nkind (Nod) = N_Pragma
- and then Pragma_Name_Mapped (Nod) = Name_Main
+ and then Pragma_Name (Nod) = Name_Main
then
Error_Msg_Name_1 := Pname;
Error_Msg_N ("duplicate pragma% not permitted", Nod);
Nod := Next (N);
while Present (Nod) loop
if Nkind (Nod) = N_Pragma
- and then Pragma_Name_Mapped (Nod) = Name_Main_Storage
+ and then Pragma_Name (Nod) = Name_Main_Storage
then
Error_Msg_Name_1 := Pname;
Error_Msg_N ("duplicate pragma% not permitted", Nod);
-- this also takes care of pragmas generated for aspects.
if Nkind (Stmt) = N_Pragma then
- if Pragma_Name_Mapped (Stmt) = Pname then
+ if Pragma_Name (Stmt) = Pname then
Error_Msg_Name_1 := Pname;
Error_Msg_Sloc := Sloc (Stmt);
Error_Msg_N ("pragma% duplicates pragma declared#", N);
if Present (Items) then
Prag := Contract_Test_Cases (Items);
while Present (Prag) loop
- if Pragma_Name_Mapped (Prag) = Name_Test_Case
+ if Pragma_Name (Prag) = Name_Test_Case
and then Prag /= N
and then String_Equal
(Name, Get_Name_From_CTC_Pragma (Prag))
Nod := Next (N);
while Present (Nod) loop
if Nkind (Nod) = N_Pragma
- and then Pragma_Name_Mapped (Nod) = Name_Time_Slice
+ and then Pragma_Name (Nod) = Name_Time_Slice
then
Error_Msg_Name_1 := Pname;
Error_Msg_N ("duplicate pragma% not permitted", Nod);
-- Local variables
Loc : constant Source_Ptr := Sloc (Prag);
- Prag_Nam : constant Name_Id := Pragma_Name_Mapped (Prag);
+ Prag_Nam : constant Name_Id := Pragma_Name (Prag);
Check_Prag : Node_Id;
Msg_Arg : Node_Id;
Nam : Name_Id;
Prag := Pre_Post_Conditions (Prags);
while Present (Prag) loop
- if Nam_In (Pragma_Name (Prag), Name_Precondition,
- Name_Postcondition)
+ if Nam_In (Pragma_Name_Unmapped (Prag),
+ Name_Precondition, Name_Postcondition)
and then Class_Present (Prag)
then
-- The generated pragma must be analyzed in the context of
function Delay_Config_Pragma_Analyze (N : Node_Id) return Boolean is
begin
- return Nam_In (Pragma_Name (N), Name_Interrupt_State,
- Name_Priority_Specific_Dispatching);
+ return Nam_In (Pragma_Name_Unmapped (N),
+ Name_Interrupt_State, Name_Priority_Specific_Dispatching);
end Delay_Config_Pragma_Analyze;
-----------------------
if Nkind (Stmt) = N_Pragma then
if Do_Checks
- and then Pragma_Name_Mapped (Stmt) = Pragma_Name_Mapped (Prag)
+ and then Pragma_Name (Stmt) = Pragma_Name (Prag)
then
Duplication_Error
(Prag => Prag,
Do_Checks : Boolean := False) return Node_Id
is
Context : constant Node_Id := Parent (Prag);
- Prag_Nam : constant Name_Id := Pragma_Name_Mapped (Prag);
+ Prag_Nam : constant Name_Id := Pragma_Name (Prag);
Stmt : Node_Id;
begin
-- Skip prior pragmas, but check for duplicates
if Nkind (Stmt) = N_Pragma then
- if Do_Checks and then Pragma_Name_Mapped (Stmt) = Prag_Nam then
+ if Do_Checks and then Pragma_Name (Stmt) = Prag_Nam then
Duplication_Error
(Prag => Prag,
Prev => Stmt);
begin
pragma Assert
(Nkind (N) = N_Pragma
- and then Pragma_Name_Mapped (N) = Name_SPARK_Mode
+ and then Pragma_Name (N) = Name_SPARK_Mode
and then Is_List_Member (N));
-- Pragma SPARK_Mode affects the elaboration of a package body when it
function Is_Pragma_String_Literal (Par : Node_Id) return Boolean is
Pragn : constant Node_Id := Parent (Par);
Assoc : constant List_Id := Pragma_Argument_Associations (Pragn);
- Pname : constant Name_Id := Pragma_Name_Mapped (Pragn);
+ Pname : constant Name_Id := Pragma_Name (Pragn);
Argn : Natural;
N : Node_Id;
begin
pragma Assert
(Nkind (N) = N_Pragma
- and then Pragma_Name_Mapped (N) = Name_SPARK_Mode
+ and then Pragma_Name (N) = Name_SPARK_Mode
and then Is_List_Member (N));
-- For pragma SPARK_Mode to be private, it has to appear in the private
if Is_True (Expr_Value (Arg1x)) then
declare
Cent : constant Entity_Id := Cunit_Entity (Current_Sem_Unit);
- Pname : constant Name_Id := Pragma_Name (N);
+ Pname : constant Name_Id := Pragma_Name_Unmapped (N);
Prag_Id : constant Pragma_Id := Get_Pragma_Id (Pname);
Str : constant String_Id := Strval (Get_Pragma_Arg (Arg2));
Str_Len : constant Nat := String_Length (Str);
-- Special handling of Asssert pragma
if Nkind (Orig) = N_Pragma
- and then Pragma_Name_Mapped (Orig) = Name_Assert
+ and then Pragma_Name (Orig) = Name_Assert
then
declare
Expr : constant Node_Id :=
-- Similar processing for Check pragma
elsif Nkind (Orig) = N_Pragma
- and then Pragma_Name_Mapped (Orig) = Name_Check
+ and then Pragma_Name (Orig) = Name_Check
then
-- Don't want to warn if original condition is explicit False
Par := Parent (Ref);
while Present (Par) loop
if Nkind (Par) = N_Pragma then
- Prag_Nam := Pragma_Name_Mapped (Par);
+ Prag_Nam := Pragma_Name (Par);
-- A concurrent constituent is allowed to appear in pragmas
-- Initial_Condition and Initializes as this is part of the
Check_Function_Result (Expr);
if not Mentions_Post_State (Expr) then
- if Pragma_Name_Mapped (Prag) = Name_Contract_Cases then
+ if Pragma_Name (Prag) = Name_Contract_Cases then
Error_Msg_NE
("contract case does not check the outcome of calling "
& "&?T?", Expr, Subp_Id);
- elsif Pragma_Name_Mapped (Prag) = Name_Refined_Post then
+ elsif Pragma_Name (Prag) = Name_Refined_Post then
Error_Msg_NE
("refined postcondition does not check the outcome of "
& "calling &?T?", Prag, Subp_Id);
Expr : constant Node_Id :=
Get_Pragma_Arg
(First (Pragma_Argument_Associations (Prag)));
- Nam : constant Name_Id := Pragma_Name_Mapped (Prag);
+ Nam : constant Name_Id := Pragma_Name (Prag);
CCase : Node_Id;
-- Start of processing for Check_Result_And_Post_State_In_Pragma
Prag := Pre_Post_Conditions (Items);
while Present (Prag) loop
- if Nam_In (Pragma_Name (Prag), Name_Postcondition,
- Name_Refined_Post)
+ if Nam_In (Pragma_Name_Unmapped (Prag),
+ Name_Postcondition, Name_Refined_Post)
and then not Error_Posted (Prag)
then
Post_Prag := Prag;
Prag := Contract_Test_Cases (Items);
while Present (Prag) loop
- if Pragma_Name_Mapped (Prag) = Name_Contract_Cases
+ if Pragma_Name (Prag) = Name_Contract_Cases
and then not Error_Posted (Prag)
then
Case_Prag := Prag;
Arg : constant Node_Id :=
Get_Pragma_Arg (First (Pragma_Argument_Associations (Prag)));
- Nam : constant Name_Id := Pragma_Name_Mapped (Prag);
+ Nam : constant Name_Id := Pragma_Name (Prag);
-- Start of processing for Contains_Refined_State
Decl := Next (Unit_Declaration_Node (Subp));
while Present (Decl) loop
if Nkind (Decl) = N_Pragma
- and then Pragma_Name_Mapped (Decl) = Name_Extensions_Visible
+ and then Pragma_Name (Decl) = Name_Extensions_Visible
then
Prag := Decl;
exit;
function Get_Pragma_Id (N : Node_Id) return Pragma_Id is
begin
- return Get_Pragma_Id (Pragma_Name (N));
+ return Get_Pragma_Id (Pragma_Name_Unmapped (N));
end Get_Pragma_Id;
------------------------
loop
if No (P) then
return False;
- elsif Nkind (P) = N_Pragma and then Pragma_Name_Mapped (P) = Nam then
+ elsif Nkind (P) = N_Pragma and then Pragma_Name (P) = Nam then
return True;
else
P := Parent (P);
Nam := Chars (Identifier (Item));
else pragma Assert (Nkind (Item) = N_Pragma);
- Nam := Pragma_Name_Mapped (Item);
+ Nam := Pragma_Name (Item);
end if;
return Nam = Name_Abstract_State
Nam := Chars (Identifier (Item));
else pragma Assert (Nkind (Item) = N_Pragma);
- Nam := Pragma_Name_Mapped (Item);
+ Nam := Pragma_Name (Item);
end if;
return Nam = Name_Contract_Cases
function Get_Pragma_Id (N : Node_Id) return Pragma_Id;
pragma Inline (Get_Pragma_Id);
- -- Obtains the Pragma_Id from Pragma_Name (N)
+ -- Obtains the Pragma_Id from Pragma_Name_Unmapped (N)
function Get_Qualified_Name
(Id : Entity_Id;
Nod := Parent (N);
while Present (Nod) loop
if Nkind (Nod) = N_Pragma
- and then Nam_In (Pragma_Name (Nod),
+ and then Nam_In (Pragma_Name_Unmapped (Nod),
Name_Postcondition,
Name_Refined_Post,
Name_Contract_Cases)
P := Parent (Nod);
if Nkind (P) = N_Pragma
- and then Pragma_Name_Mapped (P) =
+ and then Pragma_Name (P) =
Name_Test_Case
and then Nod = Test_Case_Arg (P, Name_Ensures)
then
-- node, since assert pragmas get rewritten at analysis time.
elsif Nkind (Original_Node (P)) = N_Pragma
- and then Nam_In (Pragma_Name (Original_Node (P)), Name_Assert,
- Name_Check)
+ and then Nam_In (Pragma_Name_Unmapped (Original_Node (P)),
+ Name_Assert, Name_Check)
then
return;
end if;
-- Pragma_Name --
-----------------
- function Pragma_Name (N : Node_Id) return Name_Id is
+ function Pragma_Name_Unmapped (N : Node_Id) return Name_Id is
begin
return Chars (Pragma_Identifier (N));
- end Pragma_Name;
+ end Pragma_Name_Unmapped;
---------------------
-- Map_Pragma_Name --
Pragma_Map (Last_Pair) := (Key => From, Value => To);
end Map_Pragma_Name;
- ------------------------
- -- Pragma_Name_Mapped --
- ------------------------
+ -----------------
+ -- Pragma_Name --
+ -----------------
- function Pragma_Name_Mapped (N : Node_Id) return Name_Id is
- Result : constant Name_Id := Pragma_Name (N);
+ function Pragma_Name (N : Node_Id) return Name_Id is
+ Result : constant Name_Id := Pragma_Name_Unmapped (N);
begin
for J in Pragma_Map'Range loop
if Result = Pragma_Map (J).Key then
end loop;
return Result;
- end Pragma_Name_Mapped;
+ end Pragma_Name;
end Sinfo;
-- Psect_Object is always converted to Common_Object, but there are
-- undoubtedly many other similar notes required ???
- -- Note: a utility function Pragma_Name may be applied to pragma nodes
- -- to conveniently obtain the Chars field of the Pragma_Identifier.
+ -- Note: utility functions Pragma_Name_Unmapped and Pragma_Name may be
+ -- applied to pragma nodes to obtain the Chars or its mapped version.
-- Note: if From_Aspect_Specification is set, then Sloc points to the
-- aspect name, as does the Pragma_Identifier. In this case if the
-- Utility Functions --
-----------------------
- function Pragma_Name (N : Node_Id) return Name_Id;
- pragma Inline (Pragma_Name);
- -- Convenient function to obtain Chars field of Pragma_Identifier
+ function Pragma_Name_Unmapped (N : Node_Id) return Name_Id;
+ -- Function to obtain Chars field of Pragma_Identifier. In most cases, you
+ -- want to call Pragma_Name instead.
procedure Map_Pragma_Name (From, To : Name_Id);
-- Used in the implementation of pragma Rename_Pragma. Maps pragma name
-- programs will use it at all, and those that do will use it approximately
-- once or twice.
- function Pragma_Name_Mapped (N : Node_Id) return Name_Id;
- -- Same as Pragma_Name, except that if From has been mapped to To, and
- -- Pragma_Name (N) = From, then this returns To.
+ function Pragma_Name (N : Node_Id) return Name_Id;
+ -- Same as Pragma_Name_Unmapped, except that if From has been mapped to To,
+ -- and Pragma_Name_Unmapped (N) = From, then this returns To. In other
+ -- words, this takes into account pragmas Rename_Pragma.
-----------------------------
-- Syntactic Parent Tables --
when N_Pragma =>
Write_Indent_Str_Sloc ("pragma ");
- Write_Name_With_Col_Check (Pragma_Name (Node));
+ Write_Name_With_Col_Check (Pragma_Name_Unmapped (Node));
if Present (Pragma_Argument_Associations (Node)) then
Sprint_Opt_Paren_Comma_List