diff options
-rw-r--r-- | gcc/ada/ChangeLog | 30 | ||||
-rw-r--r-- | gcc/ada/gnatcmd.adb | 13 | ||||
-rw-r--r-- | gcc/ada/prj-nmsc.adb | 1 | ||||
-rw-r--r-- | gcc/ada/prj-util.adb | 9 | ||||
-rw-r--r-- | gcc/ada/sem.adb | 58 | ||||
-rw-r--r-- | gcc/ada/sem_res.adb | 13 | ||||
-rw-r--r-- | gcc/ada/sprint.adb | 2 |
7 files changed, 105 insertions, 21 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 2490a89..85f6c68 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,33 @@ +2010-09-10 Ed Schonberg <schonberg@adacore.com> + + * sprint.adb (Sprint_Node_Actual, case N_Derived_Type_Definition): Do + not reset Sloc when printing keyword "new". + +2010-09-10 Vincent Celier <celier@adacore.com> + + * gnatcmd.adb (GNATCmd): Put the command line in environment variable + GNAT_DRIVER_COMMAND_LINE. + +2010-09-10 Ed Schonberg <schonberg@adacore.com> + + * sem.adb (Do_Unit_And_Dependents): if Withed_Body is set on a context + clause, process the body at once. + +2010-09-10 Ed Schonberg <schonberg@adacore.com> + + * sem_res.adb (Resolve_Type_Conversion): Do not warn on a redundant + conversion is the expression is a qualified expression used to + disambiguate a function call. + +2010-09-10 Vincent Celier <celier@adacore.com> + + * prj-nmsc.adb (Add_Source): Allow an Ada source to have the same name + as a source of another project and of another language. + +2010-09-10 Robert Dewar <dewar@adacore.com> + + * prj-util.adb: Minor reformatting. + 2010-09-10 Eric Botcazou <ebotcazou@adacore.com> * exp_disp.adb: Minor reformatting. diff --git a/gcc/ada/gnatcmd.adb b/gcc/ada/gnatcmd.adb index eaac1db..9c038db 100644 --- a/gcc/ada/gnatcmd.adb +++ b/gcc/ada/gnatcmd.adb @@ -1349,6 +1349,19 @@ begin Targparm.Get_Target_Parameters; + -- Put the command line in environment variable GNAT_DRIVER_COMMAND_LINE, + -- so that the spawned tool may know the way the GNAT driver was invoked. + + Name_Len := 0; + Add_Str_To_Name_Buffer (Command_Name); + + for J in 1 .. Argument_Count loop + Add_Char_To_Name_Buffer (' '); + Add_Str_To_Name_Buffer (Argument (J)); + end loop; + + Setenv ("GNAT_DRIVER_COMMAND_LINE", Name_Buffer (1 .. Name_Len)); + -- Add the directory where the GNAT driver is invoked in front of the path, -- if the GNAT driver is invoked with directory information. Do not do this -- for VMS, where the notion of path does not really exist. diff --git a/gcc/ada/prj-nmsc.adb b/gcc/ada/prj-nmsc.adb index f341610..bd800f8 100644 --- a/gcc/ada/prj-nmsc.adb +++ b/gcc/ada/prj-nmsc.adb @@ -722,6 +722,7 @@ package body Prj.Nmsc is elsif not Source.Locally_Removed and then not Data.Flags.Allow_Duplicate_Basenames and then Lang_Id.Config.Kind = Unit_Based + and then Source.Language.Config.Kind = Unit_Based then Error_Msg_File_1 := File_Name; Error_Msg_File_2 := File_Name_Type (Source.Project.Name); diff --git a/gcc/ada/prj-util.adb b/gcc/ada/prj-util.adb index 43e5101..d714cdb 100644 --- a/gcc/ada/prj-util.adb +++ b/gcc/ada/prj-util.adb @@ -189,11 +189,10 @@ package body Prj.Util is elsif Builder_Package /= No_Package then - -- If the suffix is specified in the project itself, as - -- opposed to the config file, it needs to be taken into account. - -- Unfortunately, when the project was processed, in both cases - -- the suffix is stored in Project.Config, so get it from the - -- project again. + -- If the suffix is specified in the project itself, as opposed to + -- the config file, it needs to be taken into account. However, + -- when the project was processed, in both cases the suffix was + -- stored in Project.Config, so get it from the project again. Suffix_From_Project := Prj.Util.Value_Of diff --git a/gcc/ada/sem.adb b/gcc/ada/sem.adb index 90304b3..bf41936 100644 --- a/gcc/ada/sem.adb +++ b/gcc/ada/sem.adb @@ -1538,16 +1538,7 @@ package body Sem is -- This is needed because the spec of the main unit may appear in the -- context of some other unit. We do not want this to force processing -- of the main body before all other units have been processed. - - function Depends_On_Main (CU : Node_Id) return Boolean; - -- The body of a unit that is withed by the spec of the main unit - -- may in turn have a with_clause on that spec. In that case do not - -- traverse the body, to prevent loops. It can also happen that the - -- main body has a with_clause on a child, which of course has an - -- implicit with on its parent. It's OK to traverse the child body - -- if the main spec has been processed, otherwise we also have a - -- circularity to avoid. - + -- -- Another circularity pattern occurs when the main unit is a child unit -- and the body of an ancestor has a with-clause of the main unit or on -- one of its children. In both cases the body in question has a with- @@ -1556,6 +1547,14 @@ package body Sem is -- spec of a subprogram declared in an instance within the parent will -- not be seen in the main unit. + function Depends_On_Main (CU : Node_Id) return Boolean; + -- The body of a unit that is withed by the spec of the main unit may in + -- turn have a with_clause on that spec. In that case do not traverse + -- the body, to prevent loops. It can also happen that the main body has + -- a with_clause on a child, which of course has an implicit with on its + -- parent. It's OK to traverse the child body if the main spec has been + -- processed, otherwise we also have a circularity to avoid. + procedure Do_Action (CU : Node_Id; Item : Node_Id); -- Calls Action, with some validity checks @@ -1960,10 +1959,16 @@ package body Sem is -- a package, the original file carries the body, and the spec -- appears as a later entry in the units list. - -- Otherwise Bodies appear in the list only because of inlining - -- or instantiations, and they are processed only if relevant - -- to the main unit. The main unit itself is processed - -- separately after all other specs. + -- Otherwise bodies appear in the list only because of inlining + -- or instantiations, and they are processed only if relevant. + -- The flag Withed_Body on a context clause indicates that a + -- unit contains an instantiation that may be needed later, + -- and therefore the body that contains the generic body (and + -- its context) must be traversed immediately after the + -- corresponding spec (see Do_Unit_And_Dependents). + + -- The main unit itself is processed separately after all other + -- specs, and relevant bodies are examined in Process_Main. when N_Subprogram_Body => if Acts_As_Spec (N) then @@ -2181,6 +2186,8 @@ package body Sem is pragma Assert (Nkind (CU) = N_Compilation_Unit); Context_Item : Node_Id; + Lib_Unit : Node_Id; + Body_CU : Node_Id; begin Context_Item := First (Context_Items (CU)); @@ -2189,7 +2196,28 @@ package body Sem is and then (Include_Limited or else not Limited_Present (Context_Item)) then - Action (Library_Unit (Context_Item)); + Lib_Unit := Library_Unit (Context_Item); + Action (Lib_Unit); + + -- If the context item indicates that a package body is needed + -- because of an instantiation in CU, traverse the body now, + -- even if CU is not related to the main unit. + + if Present (Withed_Body (Context_Item)) + and then Present (Corresponding_Body (Unit (Lib_Unit))) + then + Body_CU := + Parent + (Unit_Declaration_Node + (Corresponding_Body (Unit (Lib_Unit)))); + + -- A body may have an implicit with on its own spec, in which + -- case we must ignore this context item to prevent looping. + + if Unit (CU) /= Unit (Body_CU) then + Action (Body_CU); + end if; + end if; end if; Context_Item := Next (Context_Item); diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index 519292b..8f621ac 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -8831,6 +8831,19 @@ package body Sem_Res is then null; + -- Finally, the expression may be a qualified expression whose + -- own expression is a possibly overloaded function call. The + -- qualified expression is needed to be disambiguate the call, + -- but it appears in a context in which a name is needed, forcing + -- the use of a conversion. + -- In Ada2012 a qualified expression is a name, and this idiom + -- is not needed any longer. + + elsif Nkind (Orig_N) = N_Qualified_Expression + and then Nkind (Expression (Orig_N)) = N_Function_Call + then + null; + -- Here we give the redundant conversion warning. If it is an -- entity, give the name of the entity in the message. If not, -- just mention the expression. diff --git a/gcc/ada/sprint.adb b/gcc/ada/sprint.adb index 264056e..b1367fb 100644 --- a/gcc/ada/sprint.adb +++ b/gcc/ada/sprint.adb @@ -1332,7 +1332,7 @@ package body Sprint is Write_Str_With_Col_Check ("abstract "); end if; - Write_Str_With_Col_Check_Sloc ("new "); + Write_Str_With_Col_Check ("new "); -- Ada 2005 (AI-231) |