From d24d7e81b6a309d113bc69412592c363733bc095 Mon Sep 17 00:00:00 2001 From: charlet Date: Mon, 5 Apr 2004 14:57:42 +0000 Subject: 2004-04-05 Vincent Celier * adaint.h, adaint.c: Add function __gnat_named_file_length * impunit.adb: Add Ada.Directories to the list * Makefile.in: Add VMS and Windows versions of Ada.Directories.Validity package body. * Makefile.rtl: Add a-direct and a-dirval * mlib-tgt.ads: Minor comment update. * a-dirval.ads, a-dirval.adb, 5vdirval.adb, 5wdirval.adb, a-direct.ads, a-direct.adb: New files. 2004-04-05 Vincent Celier PR ada/13620 * make.adb (Scan_Make_Arg): Pass any -fxxx switches to gnatlink, not just to the compiler. 2004-04-05 Robert Dewar * a-except.adb (Exception_Name_Simple): Make sure lower bound of returned string is 1. * ali-util.adb: Use proper specific form for Warnings (Off, entity) * eval_fat.ads: Minor reformatting * g-curexc.ads: Document that lower bound of returned string values is always one. * gnatlink.adb: Add ??? comment for previous change (need to document why this is VMS specific) * s-stoele.ads: Minor reformatting * tbuild.ads: Minor reformatting throughout (new function specs) * par-ch10.adb (P_Context_Clause): Handle comma instead of semicolon after WITH. * scng.adb: Minor reformatting 2004-04-05 Geert Bosch * eval_fat.adb (Machine): Remove unnecessary suppression of warning. (Leading_Part): Still perform truncation to machine number if the specified radix_digits is greater or equal to machine_mantissa. 2004-04-05 Javier Miranda * par-ch3.adb: Complete documentation of previous change Correct wrong syntax documentation of the OBJECT_DECLARATION rule (aliased must appear before constant). * par-ch4.adb: Complete documentation of previous change. * par-ch6.adb: Complete documentation of previous change. * sinfo.ads: Fix typo in commment. 2004-04-05 Ed Schonberg * sem_ch3.adb (Inherit_Components): If derived type is private and has stored discriminants, use its discriminants to constrain parent type, as is done for non-private derived record types. * sem_ch4.adb (Remove_Abstract_Operations): New subprogram to implement Ada 2005 AI-310: an abstract non-dispatching operation is not a candidate interpretation in an overloaded call. * tbuild.adb (Unchecked_Convert_To): Preserve conversion node if expression is Null and target type is not an access type (e.g. a non-private address type). 2004-04-05 Thomas Quinot * exp_ch6.adb (Rewrite_Function_Call): When rewriting an assignment statement whose right-hand side is an inlined call, save a copy of the original assignment subtree to preserve enough consistency for Analyze_Assignment to proceed. * sem_ch5.adb (Analyze_Assignment): Remove a costly copy of the complete assignment subtree which is now unnecessary, as the expansion of inlined call has been improved to preserve a consistent assignment tree. Note_Possible_Modification must be called only after checks have been applied, or else unnecessary checks will be generated. * sem_util.adb (Note_Possible_Modification): Reorganise the handling of explicit dereferences that do not Come_From_Source: - be selective on cases where we must go back to the dereferenced pointer (an assignment to an implicit dereference must not be recorded as modifying the pointer); - do not rely on Original_Node being present (Analyze_Assignment calls Note_Possible_Modification on a copied tree). * sem_warn.adb (Check_References): When an unset reference to a pointer that is never assigned is encountered, prefer ' may be null' warning over ' is never assigned a value'. 2004-04-05 Ramon Fernandez * tracebak.c: Change STOP_FRAME in ppc vxworks to be compliant with the ABI. 2004-04-05 Olivier Hainque * 5gmastop.adb (Pop_Frame): Comment out the pragma Linker_Option for libexc. We currently don't reference anything in this library and linking it in triggers linker warnings we don't want to see. * init.c: Update comments. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@80431 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/sem_util.adb | 76 +++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 54 insertions(+), 22 deletions(-) (limited to 'gcc/ada/sem_util.adb') diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 36f165f1e32..578c9340f94 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -4979,6 +4979,9 @@ package body Sem_Util is -------------------------------- procedure Note_Possible_Modification (N : Node_Id) is + Modification_Comes_From_Source : constant Boolean := + Comes_From_Source (Parent (N)); + Ent : Entity_Id; Exp : Node_Id; @@ -4993,7 +4996,9 @@ package body Sem_Util is procedure Set_Ref (E : Entity_Id; N : Node_Id) is begin if Is_Object (E) then - if Comes_From_Source (N) then + if Comes_From_Source (N) + or else Modification_Comes_From_Source + then Set_Never_Set_In_Source (E, False); end if; @@ -5015,19 +5020,60 @@ package body Sem_Util is Exp := N; loop - -- Test for node rewritten as dereference (e.g. accept parameter) + Ent := Empty; + + if Is_Entity_Name (Exp) then + Ent := Entity (Exp); + + elsif Nkind (Exp) = N_Explicit_Dereference then + declare + P : constant Node_Id := Prefix (Exp); + + begin + if Nkind (P) = N_Selected_Component + and then Present ( + Entry_Formal (Entity (Selector_Name (P)))) + then + -- Case of a reference to an entry formal + + Ent := Entry_Formal (Entity (Selector_Name (P))); + + elsif Nkind (P) = N_Identifier + and then Nkind (Parent (Entity (P))) = N_Object_Declaration + and then Present (Expression (Parent (Entity (P)))) + and then Nkind (Expression (Parent (Entity (P)))) + = N_Reference + then + -- Case of a reference to a value on which + -- side effects have been removed. + + Exp := Prefix (Expression (Parent (Entity (P)))); + + else + return; + + end if; + end; + + elsif Nkind (Exp) = N_Type_Conversion + or else Nkind (Exp) = N_Unchecked_Type_Conversion + then + Exp := Expression (Exp); - if Nkind (Exp) = N_Explicit_Dereference - and then not Comes_From_Source (Exp) + elsif Nkind (Exp) = N_Slice + or else Nkind (Exp) = N_Indexed_Component + or else Nkind (Exp) = N_Selected_Component then - Exp := Original_Node (Exp); + Exp := Prefix (Exp); + + else + return; + end if; -- Now look for entity being referenced - if Is_Entity_Name (Exp) then - Ent := Entity (Exp); - + if Present (Ent) then if (Ekind (Ent) = E_Variable or else Ekind (Ent) = E_Constant) and then Present (Renamed_Object (Ent)) then @@ -5046,20 +5092,6 @@ package body Sem_Util is Kill_Checks (Ent); return; end if; - - elsif Nkind (Exp) = N_Type_Conversion - or else Nkind (Exp) = N_Unchecked_Type_Conversion - then - Exp := Expression (Exp); - - elsif Nkind (Exp) = N_Slice - or else Nkind (Exp) = N_Indexed_Component - or else Nkind (Exp) = N_Selected_Component - then - Exp := Prefix (Exp); - - else - return; end if; end loop; end Note_Possible_Modification; -- cgit v1.2.1