From a49565158271693fa8f994ba9b35f00b9ee25028 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Mon, 19 Mar 2012 17:27:18 +0100 Subject: [PATCH] [multiple changes] 2012-03-19 Hristian Kirtchev * sem_ch4.adb (Analyze_Allocator): Detect an allocator generated by the build-in-place machinery where the designated type is indefinite, but the underlying type is not. Do not emit errors related to missing initialization in this case. 2012-03-19 Robert Dewar * gnat_ugn.texi: Add documentation for -gnateinnn switch. * sem_elab.adb, put_alfa.adb, lib-xref-alfa.adb: Minor reformatting. * sem_prag.adb: Minor comment update. From-SVN: r185525 --- gcc/ada/ChangeLog | 13 +++++++++++++ gcc/ada/gnat_ugn.texi | 6 ++++++ gcc/ada/lib-xref-alfa.adb | 6 +++--- gcc/ada/put_alfa.adb | 1 + gcc/ada/sem_ch4.adb | 15 ++++++++++++++- gcc/ada/sem_elab.adb | 3 --- gcc/ada/sem_prag.adb | 2 +- 7 files changed, 38 insertions(+), 8 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 9fa56eb335b..956ff44e759 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,16 @@ +2012-03-19 Hristian Kirtchev + + * sem_ch4.adb (Analyze_Allocator): Detect an allocator generated + by the build-in-place machinery where the designated type is + indefinite, but the underlying type is not. Do not emit errors + related to missing initialization in this case. + +2012-03-19 Robert Dewar + + * gnat_ugn.texi: Add documentation for -gnateinnn switch. + * sem_elab.adb, put_alfa.adb, lib-xref-alfa.adb: Minor reformatting. + * sem_prag.adb: Minor comment update. + 2012-03-15 Robert Dewar * errout.ads: Add entry for translating -gnateinn to diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi index 365a4478a1d..b8539f03d47 100644 --- a/gcc/ada/gnat_ugn.texi +++ b/gcc/ada/gnat_ugn.texi @@ -4155,6 +4155,12 @@ Display full source path name in brief error messages. @cindex @option{-gnateG} (@command{gcc}) Save result of preprocessing in a text file. +@item ^-gnatei^/MAX_INSTANTIATIONS=^@var{nnn} +@cindex @option{-gnatei} (@command{gcc}) +Set maximum number of instantiations during compilation of a single unit to +@var{nnn}. This may be useful in increasing the default maximum of 8000 for +the rare case when a single unit legitimately exceeds this limit. + @item ^-gnateI^/MULTI_UNIT_INDEX=^@var{nnn} @cindex @option{-gnateI} (@command{gcc}) Indicates that the source is a multi-unit source and that the index of the diff --git a/gcc/ada/lib-xref-alfa.adb b/gcc/ada/lib-xref-alfa.adb index c1c6b25ca9c..4961fedc8c1 100644 --- a/gcc/ada/lib-xref-alfa.adb +++ b/gcc/ada/lib-xref-alfa.adb @@ -211,10 +211,10 @@ package body Alfa is procedure Add_Alfa_File (U : Unit_Number_Type; D : Nat) is From : Scope_Index; + S : constant Source_File_Index := Source_Index (U); - S : constant Source_File_Index := Source_Index (U); - - File_Name, Unit_File_Name : String_Ptr; + File_Name : String_Ptr; + Unit_File_Name : String_Ptr; begin -- Source file could be inexistant as a result of an error, if option diff --git a/gcc/ada/put_alfa.adb b/gcc/ada/put_alfa.adb index a5580a8018c..f4715bfdd84 100644 --- a/gcc/ada/put_alfa.adb +++ b/gcc/ada/put_alfa.adb @@ -56,6 +56,7 @@ begin Write_Info_Char ('-'); Write_Info_Char ('>'); Write_Info_Char (' '); + for N in F.Unit_File_Name'Range loop Write_Info_Char (F.Unit_File_Name (N)); end loop; diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb index ffc3a271c63..d56da36f3fa 100644 --- a/gcc/ada/sem_ch4.adb +++ b/gcc/ada/sem_ch4.adb @@ -661,9 +661,22 @@ package body Sem_Ch4 is if Is_Indefinite_Subtype (Type_Id) and then Serious_Errors_Detected = Sav_Errs then - if Is_Class_Wide_Type (Type_Id) then + -- The build-in-place machinery may produce an allocator when + -- the designated type is indefinite but the underlying type is + -- not. In this case the unknown discriminants are meaningless + -- and should not trigger error messages. Check the parent node + -- because the allocator is marked as coming from source. + + if Present (Underlying_Type (Type_Id)) + and then not Is_Indefinite_Subtype (Underlying_Type (Type_Id)) + and then not Comes_From_Source (Parent (N)) + then + null; + + elsif Is_Class_Wide_Type (Type_Id) then Error_Msg_N ("initialization required in class-wide allocation", N); + else if Ada_Version < Ada_2005 and then Is_Limited_Type (Type_Id) diff --git a/gcc/ada/sem_elab.adb b/gcc/ada/sem_elab.adb index 2656f46de5b..4f28e1eb1d7 100644 --- a/gcc/ada/sem_elab.adb +++ b/gcc/ada/sem_elab.adb @@ -2620,13 +2620,10 @@ package body Sem_Elab is if No (Nam) then return Empty; - elsif Nkind (Nam) = N_Selected_Component then return Entity (Selector_Name (Nam)); - elsif not Is_Entity_Name (Nam) then return Empty; - else return Entity (Nam); end if; diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index d55325a272f..1cd35904a20 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -3704,7 +3704,7 @@ package body Sem_Prag is Check_At_Most_N_Arguments (1); -- Modeled internally as - -- pragma Unsuppress (Atomic_Synchronization [,Entity]) + -- pragma Suppress/Unsuppress (Atomic_Synchronization [,Entity]) Rewrite (N, Make_Pragma (Loc, -- 2.30.2