diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-10-15 13:53:48 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-10-15 13:53:48 +0000 |
commit | 96da32848363deea28bde71dc3d42c34e7067f7a (patch) | |
tree | a52f2a80bd9bc0b3d34328c89d877fdc3113b84f /gcc/ada/sem_ch8.adb | |
parent | 0d5864d449195511725a88a264cf43006c3a342e (diff) | |
download | gcc-96da32848363deea28bde71dc3d42c34e7067f7a.tar.gz |
2007-10-15 Robert Dewar <dewar@adacore.com>
* s-taprop-solaris.adb, s-taprop-vms.adb, s-taprop-mingw.adb,
s-taprop-vxworks.adb, s-taprop-posix.adb, a-calend-vms.adb,
a-calend.adb, a-nuflra.adb, a-tigeau.adb, a-wtgeau.adb,
checks.adb, bindgen.adb, eval_fat.adb, exp_fixd.adb, fmap.adb,
freeze.adb, g-awk.adb, g-calend.adb, g-diopit.adb, g-expect.adb,
gnatchop.adb, gnatlink.adb, g-spipat.adb, g-thread.adb, make.adb,
mdll.adb, mlib.adb, mlib-prj.adb, osint.adb, par-ch3.adb, prj.adb,
prj-makr.adb, sem_prag.adb, sem_type.adb, s-fatgen.adb, s-fileio.adb,
sinfo.ads, sinput-d.adb, s-taasde.adb, s-tasdeb.ads, s-tasren.adb,
s-tassta.adb, s-tpobop.adb, s-tposen.adb, stylesw.adb, types.ads,
uintp.adb, validsw.adb, makegpr.adb, a-rbtgso.adb, a-crbtgo.adb,
a-coorse.adb, a-convec.adb, a-coinve.adb, a-cohama.adb, a-ciorse.adb,
a-cihama.adb, a-cidlli.adb, a-chtgop.adb, a-cdlili.adb, a-cdlili.adb,
a-coormu.adb, a-ciormu.adb, a-cihase.adb, a-cohase.adb, a-ciorma.adb,
a-coorma.adb, a-ztgeau.adb, symbols-vms.adb, a-crdlli.adb,
a-calari.adb, a-calfor.adb, s-os_lib.adb, s-regpat.adb, a-ngrear.adb:
Minor reformatting.
Add Unreferenced and Warnings (Off) pragmas for cases of
variables modified calls where they are IN OUT or OUT parameters and
the resulting values are not subsequently referenced. In a few cases,
we also remove redundant code found by the new warnings.
* ug_words, vms_data.ads, usage.adb, sem_util.adb, sem_util.ads,
sem_warn.adb, sem_warn.ads, sem_res.adb, sem_ch7.adb, sem_ch8.adb,
sem_ch5.adb, opt.ads, lib-xref.adb, lib-xref.ads, exp_smem.adb,
sem_ch11.adb, exp_ch6.adb, einfo.ads, einfo.adb: implement a new
warning controlled by -gnatw.o that warns on cases of out parameter
values being ignored.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@129318 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/sem_ch8.adb')
-rw-r--r-- | gcc/ada/sem_ch8.adb | 45 |
1 files changed, 40 insertions, 5 deletions
diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb index fff20546516..8a5ae003e5f 100644 --- a/gcc/ada/sem_ch8.adb +++ b/gcc/ada/sem_ch8.adb @@ -3014,6 +3014,15 @@ package body Sem_Ch8 is -- entity requires special handling because it may be use-visible -- but hides directly visible entities defined outside the instance. + function Is_Actual_Parameter return Boolean; + -- This function checks if the node N is an identifier that is an actual + -- parameter of a procedure call. If so it returns True, otherwise it + -- return False. The reason for this check is that at this stage we do + -- not know what procedure is being called if the procedure might be + -- overloaded, so it is premature to go setting referenced flags or + -- making calls to Generate_Reference. We will wait till Resolve_Actuals + -- for that processing + function Known_But_Invisible (E : Entity_Id) return Boolean; -- This function determines whether the entity E (which is not -- visible) can reasonably be considered to be known to the writer @@ -3094,6 +3103,23 @@ package body Sem_Ch8 is end From_Actual_Package; ------------------------- + -- Is_Actual_Parameter -- + ------------------------- + + function Is_Actual_Parameter return Boolean is + begin + return + Nkind (N) = N_Identifier + and then + (Nkind (Parent (N)) = N_Procedure_Call_Statement + or else + (Nkind (Parent (N)) = N_Parameter_Association + and then N = Explicit_Actual_Parameter (Parent (N)) + and then Nkind (Parent (Parent (N))) = + N_Procedure_Call_Statement)); + end Is_Actual_Parameter; + + ------------------------- -- Known_But_Invisible -- ------------------------- @@ -3837,7 +3863,9 @@ package body Sem_Ch8 is -- If no homonyms were visible, the entity is unambiguous if not Is_Overloaded (N) then - Generate_Reference (E, N); + if not Is_Actual_Parameter then + Generate_Reference (E, N); + end if; end if; -- Case of non-overloadable entity, set the entity providing that @@ -3856,10 +3884,11 @@ package body Sem_Ch8 is if Nkind (Parent (N)) = N_Label then declare R : constant Boolean := Referenced (E); - begin - Generate_Reference (E, N); - Set_Referenced (E, R); + if not Is_Actual_Parameter then + Generate_Reference (E, N); + Set_Referenced (E, R); + end if; end; -- Normal case, not a label: generate reference @@ -3870,9 +3899,15 @@ package body Sem_Ch8 is -- determine whether this reference modifies the denoted object -- (because implicit derefences cannot be identified prior to -- full type resolution). + -- + -- ??? The Is_Actual_Parameter routine takes care of one of these + -- cases but there are others probably else - Generate_Reference (E, N); + if not Is_Actual_Parameter then + Generate_Reference (E, N); + end if; + Check_Nested_Access (E); end if; |