From 77016f97d2d0ff5dadd92b6bb7786339e9891ae2 Mon Sep 17 00:00:00 2001 From: charlet Date: Fri, 31 Oct 2014 11:39:37 +0000 Subject: [PATCH] 2014-10-31 Ed Schonberg * sem_ch12.adb (Analyze_Generic_Package_Declaration): If there is a default storage pool, add a corresponding aspect to the generic unit, to be used at the point of instantiation. (Analyze_Package_Instantiation): If generic unit has aspect specifications, propagate them to instance. If instance has a Default_Storage_Pool aspect, make sure that it overrides the one that may be inherited from the generic. 2014-10-31 Vincent Celier * prj-attr.adb: Minor removal of attributes of package Linker that have never been used and never been documented. * projects.texi: Add documentation for attribute Runtime. * prj-nmsc.adb (Check_Configuration): Do not report a warning for unknown compilers when the project is externally built. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@216968 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/ChangeLog | 18 +++++++++ gcc/ada/prj-attr.adb | 3 -- gcc/ada/prj-nmsc.adb | 1 + gcc/ada/projects.texi | 16 +++++++- gcc/ada/sem_ch12.adb | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 137 insertions(+), 4 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 7081458aca4..db5c68182f5 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,21 @@ +2014-10-31 Ed Schonberg + + * sem_ch12.adb (Analyze_Generic_Package_Declaration): If there + is a default storage pool, add a corresponding aspect to the + generic unit, to be used at the point of instantiation. + (Analyze_Package_Instantiation): If generic unit has aspect + specifications, propagate them to instance. If instance has a + Default_Storage_Pool aspect, make sure that it overrides the + one that may be inherited from the generic. + +2014-10-31 Vincent Celier + + * prj-attr.adb: Minor removal of attributes of package Linker + that have never been used and never been documented. + * projects.texi: Add documentation for attribute Runtime. + * prj-nmsc.adb (Check_Configuration): Do not report a warning + for unknown compilers when the project is externally built. + 2014-10-31 Vasiliy Fofanov * prj-conf.adb (Do_Autoconf): Refactor the code so that empty diff --git a/gcc/ada/prj-attr.adb b/gcc/ada/prj-attr.adb index 06777bb9e7a..e356e72d295 100644 --- a/gcc/ada/prj-attr.adb +++ b/gcc/ada/prj-attr.adb @@ -280,9 +280,6 @@ package body Prj.Attr is -- Configuration - Linking "SVdriver#" & - "LVexecutable_switch#" & - "SVlib_dir_switch#" & - "SVlib_name_switch#" & -- Configuration - Response files diff --git a/gcc/ada/prj-nmsc.adb b/gcc/ada/prj-nmsc.adb index b808112e8c9..b4dd7985a3f 100644 --- a/gcc/ada/prj-nmsc.adb +++ b/gcc/ada/prj-nmsc.adb @@ -2572,6 +2572,7 @@ package body Prj.Nmsc is if Data.Flags.Compiler_Driver_Mandatory and then Lang_Index.Config.Compiler_Driver = No_File + and then not Project.Externally_Built then Error_Msg_Name_1 := Lang_Index.Display_Name; Error_Msg diff --git a/gcc/ada/projects.texi b/gcc/ada/projects.texi index 06e3ac6796b..da9511bff84 100644 --- a/gcc/ada/projects.texi +++ b/gcc/ada/projects.texi @@ -4109,7 +4109,14 @@ case-insensitive values are "false" and "true" (the default). @item @b{Target}: single -Value is the name of the target platform. +Value is the name of the target platform. Taken into account only in the main +project. + +@item @b{Runtime}: single, indexed, case-insensitive index + +Index is a language name. Indicates the runtime directory that is to be used +when using the compiler of the language. Taken into account only in the main +project. @end itemize @@ -4778,6 +4785,13 @@ Value is the directory used to generate the documentation of source code. @itemize @bullet +@item @b{Artifacts}: list, indexed + +An array attribute to declare a set of files not part of the sources +to be installed. The array discriminant is the directory where the +file is to be installed. If a relative directory then Prefix (see +below) is prepended. + @item @b{Prefix}: single Value is the install destination directory. diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb index 5420a79b118..0cf67c6fad2 100644 --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -3437,6 +3437,27 @@ package body Sem_Ch12 is Check_References (Id); end if; end if; + + -- If there is a specified storage pool in the context, create an + -- aspect on the package declaration, so that it is used in any + -- instance that does not override it. + + if Present (Default_Pool) then + declare + ASN : Node_Id; + + begin + ASN := Make_Aspect_Specification (Loc, + Identifier => Make_Identifier (Loc, Name_Default_Storage_Pool), + Expression => New_Copy (Default_Pool)); + + if No (Aspect_Specifications (Specification (N))) then + Set_Aspect_Specifications (Specification (N), New_List (ASN)); + else + Append (ASN, Aspect_Specifications (Specification (N))); + end if; + end; + end if; end Analyze_Generic_Package_Declaration; -------------------------------------------- @@ -3605,6 +3626,7 @@ package body Sem_Ch12 is Act_Tree : Node_Id; Gen_Decl : Node_Id; + Gen_Spec : Node_Id; Gen_Unit : Entity_Id; Is_Actual_Pack : constant Boolean := @@ -3837,6 +3859,7 @@ package body Sem_Ch12 is end if; Gen_Decl := Unit_Declaration_Node (Gen_Unit); + Gen_Spec := Specification (Gen_Decl); -- Initialize renamings map, for error checking, and the list that -- holds private entities whose views have changed between generic @@ -3910,6 +3933,52 @@ package body Sem_Ch12 is New_Copy_List_Tree (Aspect_Specifications (Act_Tree))); end if; + -- The generic may have a generated Default_Storage_Pool aspect, + -- set at the point of generic declaration. If the instance has + -- that aspect, it overrides the one inherited from the generic. + + if Has_Aspects (Gen_Spec) then + if No (Aspect_Specifications (N)) then + Set_Aspect_Specifications (N, + (New_Copy_List_Tree + (Aspect_Specifications (Gen_Spec)))); + + else + declare + ASN1, ASN2 : Node_Id; + + begin + ASN1 := First (Aspect_Specifications (N)); + while Present (ASN1) loop + if Chars (Identifier (ASN1)) + = Name_Default_Storage_Pool + then + -- If generic carries a default storage pool, remove + -- it in favor of the instance one. + + ASN2 := First (Aspect_Specifications (Gen_Spec)); + while Present (ASN2) loop + if Chars (Identifier (ASN2)) + = Name_Default_Storage_Pool + then + Remove (ASN2); + exit; + end if; + + Next (ASN2); + end loop; + end if; + + Next (ASN1); + end loop; + + Prepend_List_To (Aspect_Specifications (N), + (New_Copy_List_Tree + (Aspect_Specifications (Gen_Spec)))); + end; + end if; + end if; + -- Save the instantiation node, for subsequent instantiation of the -- body, if there is one and we are generating code for the current -- unit. Mark unit as having a body (avoids premature error message). @@ -4212,6 +4281,40 @@ package body Sem_Ch12 is if Nkind (Parent (N)) /= N_Compilation_Unit then Mark_Rewrite_Insertion (Act_Decl); Insert_Before (N, Act_Decl); + + if Has_Aspects (N) then + Analyze_Aspect_Specifications (N, Act_Decl_Id); + + -- The pragma created for a Default_Storage_Pool aspect must + -- appear ahead of the declarations in the instance spec. + -- Analysis has placed it after the instance node, so remove + -- it and reinsert it properly now. + + declare + ASN : constant Node_Id := First (Aspect_Specifications (N)); + A_Name : constant Name_Id := Chars (Identifier (ASN)); + Decl : Node_Id; + + begin + if A_Name = Name_Default_Storage_Pool then + if No (Visible_Declarations (Act_Spec)) then + Set_Visible_Declarations (Act_Spec, New_List); + end if; + + Decl := Next (N); + while Present (Decl) loop + if Nkind (Decl) = N_Pragma then + Remove (Decl); + Prepend (Decl, Visible_Declarations (Act_Spec)); + exit; + end if; + + Next (Decl); + end loop; + end if; + end; + end if; + Analyze (Act_Decl); -- For an instantiation that is a compilation unit, place -- 2.11.4.GIT