Commit 0b3d16c0 by Arnaud Charlet

[multiple changes]

2011-08-02  Thomas Quinot  <quinot@adacore.com>

	* s-taskin.ads: Minor reformatting.

2011-08-02  Emmanuel Briot  <briot@adacore.com>

	* g-comlin.adb (Display_Help): swap the order in which it prints the
	short help and the general usage.

2011-08-02  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch12.adb (Analyze_Generic_Subprogram_Declaration): copy properly
	the aspect declarations and attach them to the generic copy for
	subsequent analysis.
	(Analyze_Subprogram_Instantiation): copy explicitly the aspect
	declarations of the generic tree to the new subprogram declarations.
	* sem_attr.adb (Check_Precondition_Postcondition): recognize
	conditions that apply to a subprogram instance.

2011-08-02  Robert Dewar  <dewar@adacore.com>

	* gnat_rm.texi: Clarify doc on pragma Source_File_Name[_Project].

2011-08-02  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch3.adb (Derived_Type_Declaration): When checking that a untagged
	private type with a tagged full view is not derived in the immediate
	scope of the partial view, (RM 7.3 (7)) use the scope of the base type.

From-SVN: r177157
parent 4637729f
2011-08-02 Thomas Quinot <quinot@adacore.com>
* s-taskin.ads: Minor reformatting.
2011-08-02 Emmanuel Briot <briot@adacore.com>
* g-comlin.adb (Display_Help): swap the order in which it prints the
short help and the general usage.
2011-08-02 Ed Schonberg <schonberg@adacore.com>
* sem_ch12.adb (Analyze_Generic_Subprogram_Declaration): copy properly
the aspect declarations and attach them to the generic copy for
subsequent analysis.
(Analyze_Subprogram_Instantiation): copy explicitly the aspect
declarations of the generic tree to the new subprogram declarations.
* sem_attr.adb (Check_Precondition_Postcondition): recognize
conditions that apply to a subprogram instance.
2011-08-02 Robert Dewar <dewar@adacore.com>
* gnat_rm.texi: Clarify doc on pragma Source_File_Name[_Project].
2011-08-02 Ed Schonberg <schonberg@adacore.com>
* sem_ch3.adb (Derived_Type_Declaration): When checking that a untagged
private type with a tagged full view is not derived in the immediate
scope of the partial view, (RM 7.3 (7)) use the scope of the base type.
2011-08-02 Robert Dewar <dewar@adacore.com>
* exp_ch4.adb: Minor reformatting.
......
......@@ -3176,6 +3176,10 @@ package body GNAT.Command_Line is
return;
end if;
if Config.Help /= null and then Config.Help.all /= "" then
Put_Line (Config.Help.all);
end if;
if Config.Usage /= null then
Put_Line ("Usage: "
& Base_Name
......@@ -3185,10 +3189,6 @@ package body GNAT.Command_Line is
& " [switches] [arguments]");
end if;
if Config.Help /= null and then Config.Help.all /= "" then
Put_Line (Config.Help.all);
end if;
Display_Section_Help ("");
if Config.Sections /= null and then Config.Switches /= null then
......
......@@ -4558,8 +4558,12 @@ specifies the casing of the unit name in the resulting file name string.
The default is lower case. Finally the third argument allows for systematic
replacement of any dots in the unit name by the specified string literal.
A pragma Source_File_Name cannot appear after a
@ref{Pragma Source_File_Name_Project}.
Note that Source_File_Name pragmas should not be used if you are using
project files. The reason for this rule is that the project manager is not
aware of these pragmas, and so other tools that use the projet file would not
be aware of the intended naming conventions. If you are using project files,
file naming is controlled by Source_File_Name_Project pragmas. A pragma
Source_File_Name cannot appear after a @ref{Pragma Source_File_Name_Project}.
For more details on the use of the @code{Source_File_Name} pragma,
@xref{Using Other File Names,,, gnat_ugn, @value{EDITION} User's Guide},
......@@ -4581,7 +4585,8 @@ The intention is that Source_File_Name_Project pragmas are always
generated by the Project Manager in a manner consistent with the naming
specified in a project file, and when naming is controlled in this manner,
it is not permissible to attempt to modify this naming scheme using
Source_File_Name pragmas (which would not be known to the project manager).
Source_File_Name or Source_File_Name_Project pragmas (which would not be
known to the project manager).
@node Pragma Source_Reference
@unnumberedsec Pragma Source_Reference
......
......@@ -1057,7 +1057,7 @@ package System.Tasking is
-- Protection: Self.L
Serial_Number : Task_Serial_Number;
-- A growing number to provide some way to check locking rules/ordering
-- Monotonic counter to provide some way to check locking rules/ordering
Known_Tasks_Index : Integer := -1;
-- Index in the System.Tasking.Debug.Known_Tasks array
......
......@@ -2794,6 +2794,20 @@ package body Sem_Ch12 is
Set_Parent_Spec (New_N, Save_Parent);
Rewrite (N, New_N);
-- The aspect specifications are not attached to the tree, and must
-- be copied and attached to the generic copy explicitly.
if Present (Aspect_Specifications (New_N)) then
declare
Aspects : constant List_Id := Aspect_Specifications (N);
begin
Set_Has_Aspects (N, False);
Move_Aspects (New_N, N);
Set_Has_Aspects (Original_Node (N), False);
Set_Aspect_Specifications (Original_Node (N), Aspects);
end;
end if;
Spec := Specification (N);
Id := Defining_Entity (Spec);
Generate_Definition (Id);
......@@ -2888,16 +2902,42 @@ package body Sem_Ch12 is
Save_Global_References (Original_Node (N));
-- To capture global references, analyze the expressions of aspects,
-- and propagate information to original tree. Note that in this case
-- analysis of attributes is not delayed until the freeze point.
-- It seems very hard to recreate the proper visibility of the generic
-- subprogram at a later point because the analysis of an aspect may
-- create pragmas after the generic copies have been made ???
if Has_Aspects (N) then
declare
Aspect : Node_Id;
begin
Aspect := First (Aspect_Specifications (N));
while Present (Aspect) loop
if Get_Aspect_Id (Chars (Identifier (Aspect)))
/= Aspect_Warnings
then
Analyze (Expression (Aspect));
end if;
Next (Aspect);
end loop;
Aspect := First (Aspect_Specifications (Original_Node (N)));
while Present (Aspect) loop
Save_Global_References (Expression (Aspect));
Next (Aspect);
end loop;
end;
end if;
End_Generic;
End_Scope;
Exit_Generic_Scope (Id);
Generate_Reference_To_Formals (Id);
List_Inherited_Pre_Post_Aspects (Id);
if Has_Aspects (N) then
Analyze_Aspect_Specifications (N, Id);
end if;
end Analyze_Generic_Subprogram_Declaration;
-----------------------------------
......@@ -4262,6 +4302,12 @@ package body Sem_Ch12 is
Make_Subprogram_Declaration (Sloc (Act_Spec),
Specification => Act_Spec);
-- The aspects have been copied previously, but they have to be
-- linked explicitly to the new subprogram declaration.
-- Explicit pre/postconditions on the instance are analyzed below,
-- in a separate step.
Move_Aspects (Act_Tree, Act_Decl);
Set_Categorization_From_Pragmas (Act_Decl);
if Parent_Installed then
......
......@@ -13902,7 +13902,6 @@ package body Sem_Ch3 is
Indic : constant Node_Id := Subtype_Indication (Def);
Extension : constant Node_Id := Record_Extension_Part (Def);
Parent_Node : Node_Id;
Parent_Scope : Entity_Id;
Taggd : Boolean;
-- Start of processing for Derived_Type_Declaration
......@@ -14225,25 +14224,18 @@ package body Sem_Ch3 is
-- that it is not a Full_Type_Declaration (i.e. a private type or
-- private extension declaration), to distinguish a partial view
-- from a derivation from a private type which also appears as
-- E_Private_Type.
-- E_Private_Type. If the parent base type is not declared in an
-- enclosing scope there is no need to check.
elsif Present (Full_View (Parent_Type))
and then Nkind (Parent (Parent_Type)) /= N_Full_Type_Declaration
and then not Is_Tagged_Type (Parent_Type)
and then Is_Tagged_Type (Full_View (Parent_Type))
and then In_Open_Scopes (Scope (Base_Type (Parent_Type)))
then
Parent_Scope := Scope (T);
while Present (Parent_Scope)
and then Parent_Scope /= Standard_Standard
loop
if Parent_Scope = Scope (Parent_Type) then
Error_Msg_N
("premature derivation from type with tagged full view",
Indic);
end if;
Parent_Scope := Scope (Parent_Scope);
end loop;
Error_Msg_N
("premature derivation from type with tagged full view",
Indic);
end if;
end if;
......
......@@ -1738,7 +1738,18 @@ package body Sem_Prag is
-- Skip stuff not coming from source
elsif not Comes_From_Source (PO) then
null;
-- The condition may apply to a subprogram instantiation.
if Nkind (PO) = N_Subprogram_Declaration
and then Present (Generic_Parent (Specification (PO)))
then
Chain_PPC (PO);
return;
else
null;
end if;
-- Only remaining possibility is subprogram declaration
......@@ -7554,6 +7565,7 @@ package body Sem_Prag is
then
Set_Elaborate_Present (Citem, True);
Set_Unit_Name (Get_Pragma_Arg (Arg), Name (Citem));
Generate_Reference (Entity (Name (Citem)), Citem);
-- With the pragma present, elaboration calls on
-- subprograms from the named unit need no further
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment