diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2009-04-15 14:52:48 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2009-04-15 14:52:48 +0200 |
commit | 4a13695ca1f5a81aa054ff52e15705b88016bd17 (patch) | |
tree | c697b3c422f469e9dda6aebd785df1cac6bb0330 /gcc | |
parent | c3b36d484f5b232e882a0535bf275329dc91f3a4 (diff) | |
download | gcc-4a13695ca1f5a81aa054ff52e15705b88016bd17.zip gcc-4a13695ca1f5a81aa054ff52e15705b88016bd17.tar.gz gcc-4a13695ca1f5a81aa054ff52e15705b88016bd17.tar.bz2 |
[multiple changes]
2009-04-15 Bob Duff <duff@adacore.com>
* sem_ch5.adb (Analyze_Loop_Statement): Don't check for infinite loop
warnings unless the loop comes from source, because checking generated
loops is a waste of time, and makes it harder to debug
Check_Infinite_Loop_Warning.
* sem_warn.adb (Check_Infinite_Loop_Warning): If the local variable
tested in the while loop is a renaming, do not warn. Otherwise, we get
false alarms, because it's usually renaming something that we can't
deal with (an indexed component, a global variable, ...).
* gnat_rm.texi: Fix typo
2009-04-15 Thomas Quinot <quinot@adacore.com>
* sem_ch6.adb: Minor reformatting
From-SVN: r146111
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/ChangeLog | 18 | ||||
-rw-r--r-- | gcc/ada/gnat_rm.texi | 4 | ||||
-rw-r--r-- | gcc/ada/sem_ch5.adb | 7 | ||||
-rw-r--r-- | gcc/ada/sem_ch6.adb | 15 | ||||
-rw-r--r-- | gcc/ada/sem_warn.adb | 7 |
5 files changed, 37 insertions, 14 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index ff19f3a..48eac4e 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,21 @@ +2009-04-15 Bob Duff <duff@adacore.com> + + * sem_ch5.adb (Analyze_Loop_Statement): Don't check for infinite loop + warnings unless the loop comes from source, because checking generated + loops is a waste of time, and makes it harder to debug + Check_Infinite_Loop_Warning. + + * sem_warn.adb (Check_Infinite_Loop_Warning): If the local variable + tested in the while loop is a renaming, do not warn. Otherwise, we get + false alarms, because it's usually renaming something that we can't + deal with (an indexed component, a global variable, ...). + + * gnat_rm.texi: Fix typo + +2009-04-15 Thomas Quinot <quinot@adacore.com> + + * sem_ch6.adb: Minor reformatting + 2009-04-15 Hristian Kirtchev <kirtchev@adacore.com> * exp_ch7.adb (Expand_Ctrl_Function_Call): Check for the case where the diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi index adb3193..fe46355 100644 --- a/gcc/ada/gnat_rm.texi +++ b/gcc/ada/gnat_rm.texi @@ -5189,9 +5189,9 @@ also be used as a configuration pragma. The fourth form, with an On|Off parameter and a string, is used to control individual messages, based on their text. The string argument is a pattern that is used to match against the text of individual -warning messages (not including the initial "warnings: " tag). +warning messages (not including the initial "warning: " tag). -The pattern may contain asterisks which match zero or more characters in +The pattern may contain asterisks, which match zero or more characters in the message. For example, you can use @code{pragma Warnings (Off, "*bits of*unused")} to suppress the warning message @code{warning: 960 bits of "a" unused}. No other regular diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb index 6a387d6..dab9871 100644 --- a/gcc/ada/sem_ch5.adb +++ b/gcc/ada/sem_ch5.adb @@ -2031,7 +2031,12 @@ package body Sem_Ch5 is Process_End_Label (Loop_Statement, 'e', Ent); End_Scope; Kill_Current_Values; - Check_Infinite_Loop_Warning (N); + + -- No point in checking for warnings in code we generated + + if Comes_From_Source (N) then + Check_Infinite_Loop_Warning (N); + end if; -- Code after loop is unreachable if the loop has no WHILE or FOR -- and contains no EXIT statements within the body of the loop. diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 23ed091..576f9cd 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -3954,9 +3954,9 @@ package body Sem_Ch6 is procedure Possible_Freeze (T : Entity_Id); -- T is the type of either a formal parameter or of the return type. -- If T is not yet frozen and needs a delayed freeze, then the - -- subprogram itself must be delayed. If T is the limited view of - -- of an incomplete type the subprogram must be frozen as well, - -- because T may depend on local types that have not been frozen yet. + -- subprogram itself must be delayed. If T is the limited view of an + -- incomplete type the subprogram must be frozen as well, because + -- T may depend on local types that have not been frozen yet. --------------------- -- Possible_Freeze -- @@ -3964,9 +3964,7 @@ package body Sem_Ch6 is procedure Possible_Freeze (T : Entity_Id) is begin - if Has_Delayed_Freeze (T) - and then not Is_Frozen (T) - then + if Has_Delayed_Freeze (T) and then not Is_Frozen (T) then Set_Has_Delayed_Freeze (Designator); elsif Is_Access_Type (T) @@ -3975,11 +3973,10 @@ package body Sem_Ch6 is then Set_Has_Delayed_Freeze (Designator); - elsif Ekind (T) = E_Incomplete_Type - and then From_With_Type (T) - then + elsif Ekind (T) = E_Incomplete_Type and then From_With_Type (T) then Set_Has_Delayed_Freeze (Designator); end if; + end Possible_Freeze; -- Start of processing for Check_Delayed_Subprogram diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb index 29a850a..2724255 100644 --- a/gcc/ada/sem_warn.adb +++ b/gcc/ada/sem_warn.adb @@ -541,7 +541,7 @@ package body Sem_Warn is -- Start of processing for Check_Infinite_Loop_Warning begin - -- We need a while iteration with no condition actions. Conditions + -- We need a while iteration with no condition actions. Condition -- actions just make things too complicated to get the warning right. if No (Iter) @@ -556,12 +556,15 @@ package body Sem_Warn is Find_Var (Condition (Iter)); - -- Nothing to do if local variable from source not found + -- Nothing to do if local variable from source not found. If it's a + -- renaming, it is probably renaming something too complicated to deal + -- with here. if No (Var) or else Ekind (Var) /= E_Variable or else Is_Library_Level_Entity (Var) or else not Comes_From_Source (Var) + or else Nkind (Parent (Var)) = N_Object_Renaming_Declaration then return; |