diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-10-31 18:06:22 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-10-31 18:06:22 +0000 |
commit | 383c7a1dc931107e4c27b21149969845c0365a66 (patch) | |
tree | 018d6da398c24e8b5af6a7dcf3965f698db9bdd0 /gcc/ada | |
parent | e8fc5cb04a731f8403aef07a4bc9d3c6e099bcef (diff) | |
download | gcc-383c7a1dc931107e4c27b21149969845c0365a66.tar.gz |
2006-10-31 Robert Dewar <dewar@adacore.com>
* sem_ch11.adb (Analyze_Handled_Statements): Move final test for
useless assignments here and conditionalize it on absence of exception
handlers.
(Analyze_Exception_Handlers): Small code reorganization of error
detection code, for new handling of formal packages.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@118299 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/sem_ch11.adb | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/gcc/ada/sem_ch11.adb b/gcc/ada/sem_ch11.adb index 978c7e38e96..75ee081a16d 100644 --- a/gcc/ada/sem_ch11.adb +++ b/gcc/ada/sem_ch11.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2005, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2006, 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- -- @@ -41,6 +41,7 @@ with Sem_Ch5; use Sem_Ch5; with Sem_Ch8; use Sem_Ch8; with Sem_Res; use Sem_Res; with Sem_Util; use Sem_Util; +with Sem_Warn; use Sem_Warn; with Sinfo; use Sinfo; with Stand; use Stand; with Uintp; use Uintp; @@ -271,13 +272,7 @@ package body Sem_Ch11 is while Scop /= Standard_Standard and then Ekind (Scop) = E_Package loop - -- If the exception is declared in an inner - -- instance, nothing else to check. - - if Is_Generic_Instance (Scop) then - exit; - - elsif Nkind (Declaration_Node (Scop)) = + if Nkind (Declaration_Node (Scop)) = N_Package_Specification and then Nkind (Original_Node (Parent @@ -291,6 +286,12 @@ package body Sem_Ch11 is ("\and therefore cannot appear in " & "handler ('R'M 11.2(8))", Id); exit; + + -- If the exception is declared in an inner + -- instance, nothing else to check. + + elsif Is_Generic_Instance (Scop) then + exit; end if; Scop := Scope (Scop); @@ -347,11 +348,23 @@ package body Sem_Ch11 is Kill_All_Checks; end if; + -- Analyze statements in sequence + Analyze_Statements (Statements (N)); + -- If the current scope is a subprogram, and there are no explicit + -- exception handlers, then this is the right place to check for + -- hanging useless assignments from the statement sequence of the + -- subprogram body. + + if Is_Subprogram (Current_Scope) then + Warn_On_Useless_Assignments (Current_Scope); + end if; + + -- Deal with handlers or AT END proc + if Present (Handlers) then Analyze_Exception_Handlers (Handlers); - elsif Present (At_End_Proc (N)) then Analyze (At_End_Proc (N)); end if; |