aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRobert Dewar <dewar@adacore.com>2006-10-31 19:06:22 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2006-10-31 19:06:22 +0100
commit6109adeb7d392421306416182d2cf3241b7ba3ac (patch)
tree018d6da398c24e8b5af6a7dcf3965f698db9bdd0 /gcc
parent468c6c8af61691d22e832fbd9f6a3d840d00171d (diff)
downloadgcc-6109adeb7d392421306416182d2cf3241b7ba3ac.zip
gcc-6109adeb7d392421306416182d2cf3241b7ba3ac.tar.gz
gcc-6109adeb7d392421306416182d2cf3241b7ba3ac.tar.bz2
sem_ch11.adb (Analyze_Handled_Statements): Move final test for useless assignments here and conditionalize it on absence...
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. From-SVN: r118299
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/sem_ch11.adb31
1 files changed, 22 insertions, 9 deletions
diff --git a/gcc/ada/sem_ch11.adb b/gcc/ada/sem_ch11.adb
index 978c7e3..75ee081 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;