* gnat_ugn.texi: Minor clean ups.
2013-04-11 Robert Dewar <dewar@adacore.com>
* nlists.ads, nlists.adb, treepr.adb, treepr.ads: Move debugging
function p from Nlists to Treepr.
2013-04-11 Ed Schonberg <schonberg@adacore.com>
* sem_disp.adb (Check_Dispatching_Context): If the context is
a contract for a null procedure defer error reporting until
postcondition body is created.
* exp_ch13.adb (Expand_N_Freeze_Entity): If the entity is a
null procedure, complete the analysis of its contracts so that
calls within classwide conditions are properly rewritten as
dispatching calls.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@197794
138bc75d-0d04-0410-961f-
82ee72b054a4
+2013-04-11 Ben Brosgol <brosgol@adacore.com>
+
+ * gnat_ugn.texi: Minor clean ups.
+
+2013-04-11 Robert Dewar <dewar@adacore.com>
+
+ * nlists.ads, nlists.adb, treepr.adb, treepr.ads: Move debugging
+ function p from Nlists to Treepr.
+
+2013-04-11 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_disp.adb (Check_Dispatching_Context): If the context is
+ a contract for a null procedure defer error reporting until
+ postcondition body is created.
+ * exp_ch13.adb (Expand_N_Freeze_Entity): If the entity is a
+ null procedure, complete the analysis of its contracts so that
+ calls within classwide conditions are properly rewritten as
+ dispatching calls.
+
2013-04-11 Thomas Quinot <quinot@adacore.com>
* sem_ch10.adb, sem_ch12.adb: Minor reformatting.
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, 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- --
with Sem_Ch7; use Sem_Ch7;
with Sem_Ch8; use Sem_Ch8;
with Sem_Eval; use Sem_Eval;
+with Sem_Prag; use Sem_Prag;
with Sem_Util; use Sem_Util;
with Sinfo; use Sinfo;
with Snames; use Snames;
end;
else
+ -- If the action is the generated body of a null subprogram,
+ -- analyze the expressions in its delayed aspects, because we
+ -- may not have reached the end of the declarative list when
+ -- delayed aspects are normally analyzed. This ensures that
+ -- dispatching calls are properly rewritten when the inner
+ -- postcondition procedure is analyzed.
+
+ if Is_Subprogram (E)
+ and then Nkind (Parent (E)) = N_Procedure_Specification
+ and then Null_Present (Parent (E))
+ then
+ declare
+ Prag : Node_Id;
+ begin
+ Prag := Spec_PPC_List (Contract (E));
+ while Present (Prag) loop
+ Analyze_PPC_In_Decl_Part (Prag, E);
+ Prag := Next_Pragma (Prag);
+ end loop;
+ end;
+ end if;
+
Analyze (Decl, Suppress => All_Checks);
end if;
* Static Stack Usage Analysis::
* Dynamic Stack Usage Analysis::
-Some Useful Memory Pools
-
-The GNAT Debug Pool Facility
-
-@ifclear vms
-The gnatmem Tool
-
-* Running gnatmem::
-* Switches for gnatmem::
-* Example of gnatmem Usage::
-@end ifclear
-
Verifying Properties Using gnatcheck
Sample Bodies Using gnatstub
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2010, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, 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- --
return Int (Lists.Last) - Int (Lists.First) + 1;
end Num_Lists;
- -------
- -- p --
- -------
-
- function p (U : Union_Id) return Node_Or_Entity_Id is
- begin
- if U in Node_Range then
- return Parent (Node_Or_Entity_Id (U));
- elsif U in List_Range then
- return Parent (List_Id (U));
- else
- return 99_999_999;
- end if;
- end p;
-
------------
-- Parent --
------------
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2010, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, 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- --
-- These functions return the addresses of the Next_Node and Prev_Node
-- tables (used in Back_End for Gigi).
- function p (U : Union_Id) return Node_Or_Entity_Id;
- -- This function is intended for use from the debugger, it determines
- -- whether U is a Node_Id or List_Id, and calls the appropriate Parent
- -- function and returns the parent Node in either case. This is shorter
- -- to type, and avoids the overloading problem of using Parent. It
- -- should NEVER be used except from the debugger. If p is called with
- -- other than a node or list id value, it returns 99_999_999.
-
end Nlists;
Set_Entity (Name (N), Alias (Subp));
return;
+ -- An obscure special case: a null procedure may have a class-
+ -- wide pre/postcondition that includes a call to an abstract
+ -- subp. Calls within the expression may not have been rewritten
+ -- as dispatching calls yet, because the null body appears in
+ -- the current declarative part. The expression will be properly
+ -- rewritten/reanalyzed when the postcondition procedure is built.
+
+ elsif In_Spec_Expression
+ and then Is_Subprogram (Current_Scope)
+ and then
+ Nkind (Parent (Current_Scope)) = N_Procedure_Specification
+ and then Null_Present (Parent (Current_Scope))
+ then
+ null;
+
else
-- We need to determine whether the context of the call
-- provides a tag to make the call dispatching. This requires
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, 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- --
-- descendents are to be printed. Prefix_Str is to be added to all
-- printed lines.
+ -------
+ -- p --
+ -------
+
+ function p (N : Union_Id) return Node_Or_Entity_Id is
+ begin
+ case N is
+ when List_Low_Bound .. List_High_Bound - 1 =>
+ return Nlists.Parent (List_Id (N));
+
+ when Node_Range =>
+ return Atree.Parent (Node_Or_Entity_Id (N));
+
+ when others =>
+ Write_Int (Int (N));
+ Write_Str (" is not a Node_Id or List_Id value");
+ Write_Eol;
+ return Empty;
+ end case;
+ end p;
+
--------
-- pe --
--------
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, 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- --
-- The following debugging procedures are intended to be called from gdb
+ function p (N : Union_Id) return Node_Or_Entity_Id;
+ pragma Export (Ada, p);
+ -- Returns parent of a list or node (depending on the value of N). If N
+ -- is neither a list nor a node id, then prints a message to that effect
+ -- and returns Empty.
+
+ procedure pn (N : Union_Id);
+ -- Prints a node, node list, uint, or anything else that falls under
+ -- the definition of Union_Id. Historically this was only for printing
+ -- nodes, hence the name.
+
procedure pp (N : Union_Id);
pragma Export (Ada, pp);
- -- Prints a node, node list, uint, or anything else that falls under
- -- Union_Id.
+ -- Identical to pn, present for historical reasons
procedure ppp (N : Node_Id);
pragma Export (Ada, ppp);
-- Same as Print_Node_Subtree
- -- The following are no longer needed; you can use pp or ppp instead
+ -- The following are no longer really needed, now that pn will print
+ -- anything you throw at it!
procedure pe (E : Elist_Id);
pragma Export (Ada, pe);
-- on the left and add a minus sign. This just saves some typing in the
-- debugger.
- procedure pn (N : Union_Id);
- pragma Export (Ada, pn);
- -- Same as pp
-
procedure pt (N : Node_Id);
pragma Export (Ada, pt);
-- Same as ppp