diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2012-10-01 10:14:49 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2012-10-01 10:14:49 +0200 |
commit | 8e983d807e96f2b993e1bc840c915c8f461077d4 (patch) | |
tree | 6f0271e566e17f424763b6a9433eabc8f59c42de /gcc/ada/sem_warn.adb | |
parent | 7246b890962539d475f0f4737c4e87be6f197be9 (diff) | |
download | gcc-8e983d807e96f2b993e1bc840c915c8f461077d4.zip gcc-8e983d807e96f2b993e1bc840c915c8f461077d4.tar.gz gcc-8e983d807e96f2b993e1bc840c915c8f461077d4.tar.bz2 |
[multiple changes]
2012-10-01 Thomas Quinot <quinot@adacore.com>
* gnatcmd.adb, make.adb (Scan_Make_Arg, Inspect_Switches): Recognize
and reject an invalid parameter passed to -vP.
2012-10-01 Yannick Moy <moy@adacore.com>
* sem_warn.adb (Check_Infinite_Loop_Warning/Test_Ref): Improve
the detection of modifications to the loop variable by noting
that, if the type of variable is elementary and the condition
does not contain a function call, then the condition cannot be
modified by side-effects from a procedure call.
2012-10-01 Robert Dewar <dewar@adacore.com>
* checks.adb: Add comments.
2012-10-01 Javier Miranda <miranda@adacore.com>
* exp_ch3.adb (Expand_N_Object_Declaration): Improve condition catching
never-ending recursion. The previous condition erroneously disabled
silently the expansion of the class-wide interface object
initialization in cases not involving the recursion.
From-SVN: r191892
Diffstat (limited to 'gcc/ada/sem_warn.adb')
-rw-r--r-- | gcc/ada/sem_warn.adb | 57 |
1 files changed, 33 insertions, 24 deletions
diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb index c05cf3b..34bc458 100644 --- a/gcc/ada/sem_warn.adb +++ b/gcc/ada/sem_warn.adb @@ -472,32 +472,41 @@ package body Sem_Warn is return Abandon; end if; - -- If we appear in the context of a procedure call, then also - -- abandon, since there may be issues of non-visible side - -- effects going on in the call. + -- If the condition contains a function call, we consider it may + -- be modified by side-effects from a procedure call. Otherwise, + -- we consider the condition may not be modified, although that + -- might happen if Variable is itself a by-reference parameter, + -- and the procedure called modifies the global object referred to + -- by Variable, but we actually prefer to issue a warning in this + -- odd case. Note that the case where the procedure called has + -- visibility over Variable is treated in another case below. + + if Function_Call_Found then + declare + P : Node_Id; - declare - P : Node_Id; + begin + P := N; + loop + P := Parent (P); + exit when P = Loop_Statement; - begin - P := N; - loop - P := Parent (P); - exit when P = Loop_Statement; - - -- Abandon if at procedure call, or something strange is - -- going on (perhaps a node with no parent that should - -- have one but does not?) As always, for a warning we - -- prefer to just abandon the warning than get into the - -- business of complaining about the tree structure here! - - if No (P) or else Nkind (P) = N_Procedure_Call_Statement then - return Abandon; - end if; - end loop; - end; + -- Abandon if at procedure call, or something strange is + -- going on (perhaps a node with no parent that should + -- have one but does not?) As always, for a warning we + -- prefer to just abandon the warning than get into the + -- business of complaining about the tree structure here! + + if No (P) + or else Nkind (P) = N_Procedure_Call_Statement + then + return Abandon; + end if; + end loop; + end; + end if; - -- Reference to variable renaming variable in question + -- Reference to variable renaming variable in question elsif Is_Entity_Name (N) and then Present (Entity (N)) @@ -509,7 +518,7 @@ package body Sem_Warn is then return Abandon; - -- Call to subprogram + -- Call to subprogram elsif Nkind (N) in N_Subprogram_Call then |