From 4fc26524b5b40e7be207ba6378c3385bdbe4bcd1 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Wed, 29 Apr 2009 12:28:55 +0200 Subject: [PATCH] [multiple changes] 2009-04-29 Ed Schonberg * sem_disp.adb (Check_Dispatching_Operation): if the dispatching operation is a body without previous spec, update the list of primitive operations to ensure that cross-reference information is up-to-date. * sem_ch12.adb (Build_Instance_Compilation_Unit_Nodes): When creating a new compilation unit node for the instance declaration, keep the context items of the original unit on it, so that the context of the instance body only holds the context inherited from the generic body. 2009-04-29 Bob Duff * sem_res.adb: Minor comment fix. From-SVN: r146945 --- gcc/ada/ChangeLog | 16 ++++++++++++++++ gcc/ada/sem_ch12.adb | 7 +++++-- gcc/ada/sem_disp.adb | 11 +++++++++-- gcc/ada/sem_res.adb | 2 +- 4 files changed, 31 insertions(+), 5 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index e2eaa614f51..c8767f10f58 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,19 @@ +2009-04-29 Ed Schonberg + + * sem_disp.adb (Check_Dispatching_Operation): if the dispatching + operation is a body without previous spec, update the list of + primitive operations to ensure that cross-reference information is + up-to-date. + + * sem_ch12.adb (Build_Instance_Compilation_Unit_Nodes): When creating a + new compilation unit node for the instance declaration, keep the + context items of the original unit on it, so that the context of the + instance body only holds the context inherited from the generic body. + +2009-04-29 Bob Duff + + * sem_res.adb: Minor comment fix. + 2009-04-29 Thomas Quinot * sem_elim.adb: Minor reformatting diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb index e56a0f3b796..9a4f1e34b41 100644 --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -4360,16 +4360,19 @@ package body Sem_Ch12 is Old_Main : constant Entity_Id := Cunit_Entity (Main_Unit); begin - -- A new compilation unit node is built for the instance declaration + -- A new compilation unit node is built for the instance declaration. + -- Place the context of the compilation this declaration, so that it + -- it is processed before the instance in CodePeer. Decl_Cunit := Make_Compilation_Unit (Sloc (N), - Context_Items => Empty_List, + Context_Items => Context_Items (Parent (N)), Unit => Act_Decl, Aux_Decls_Node => Make_Compilation_Unit_Aux (Sloc (N))); Set_Parent_Spec (Act_Decl, Parent_Spec (N)); + Set_Context_Items (Parent (N), Empty_List); -- The new compilation unit is linked to its body, but both share the -- same file, so we do not set Body_Required on the new unit so as not diff --git a/gcc/ada/sem_disp.adb b/gcc/ada/sem_disp.adb index 33044b3a810..c44c8e8d0fc 100644 --- a/gcc/ada/sem_disp.adb +++ b/gcc/ada/sem_disp.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2009, 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- -- @@ -865,7 +865,14 @@ package body Sem_Disp is Prim => Subp)); end if; - Generate_Reference (Tagged_Type, Subp, 'p', False); + -- Indicate that this is an overriding operation, + -- and replace the overriden entry in the list of + -- primitive operations, which is used for xref + -- generation subsequently. + + Generate_Reference (Tagged_Type, Subp, 'P', False); + Override_Dispatching_Operation + (Tagged_Type, Old_Subp, Subp); end if; end if; end if; diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index 690ade4827b..c6f79de4915 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -6977,7 +6977,7 @@ package body Sem_Res is begin -- The parser folds an enormous sequence of concatenations of string -- literals into "" & "...", where the Is_Folded_In_Parser flag is set - -- in the right. If the expression resolves to a predefined "&" + -- in the right operand. If the expression resolves to a predefined "&" -- operator, all is well. Otherwise, the parser's folding is wrong, so -- we give an error. See P_Simple_Expression in Par.Ch4.