diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-08-31 10:20:54 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-08-31 10:20:54 +0000 |
commit | 4734e88eef28ab9b9fa28af16a98fef982799f51 (patch) | |
tree | ee49770d0d5c5a94700cc68331253d52a4803116 /gcc/ada/sem_ch11.adb | |
parent | 7870823d1c823d0958171f7e14c29ed015dee61e (diff) | |
download | gcc-4734e88eef28ab9b9fa28af16a98fef982799f51.tar.gz |
2007-08-31 Hristian Kirtchev <kirtchev@adacore.com>
* einfo.ads, einfo.adb: New flag Is_Raised (Flag224). Update the
structure of E_Exception to reflect the new flag.
(Is_Raised, Set_Is_Raised): New inlined routines.
Update the usage of available flag to reflect the addition of Is_Raised.
(Is_Raised, Set_Is_Raised): Bodies of new routines.
(Write_Entity_Flags): Write the status of flag Is_Raised.
(Is_Descendent_Of_Address): New entity flag, to simplify handling of
spurious ambiguities when integer literals appear in the context of an
address type that is a visible integer type.
* sem_ch11.adb (Analyze_Exception_Handler): Add code to warn on local
exceptions never being raised.
(Analyze_Raise_Statement): When analyzing an exception, mark it as being
explicitly raised.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@127970 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/sem_ch11.adb')
-rw-r--r-- | gcc/ada/sem_ch11.adb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/ada/sem_ch11.adb b/gcc/ada/sem_ch11.adb index a6d937db950..88462033801 100644 --- a/gcc/ada/sem_ch11.adb +++ b/gcc/ada/sem_ch11.adb @@ -264,6 +264,17 @@ package body Sem_Ch11 is Error_Msg_N ("exception name expected", Id); else + -- Emit a warning at the declaration level when a local + -- exception is never raised explicitly. + + if Warn_On_Redundant_Constructs + and then not Is_Raised (Entity (Id)) + and then Scope (Entity (Id)) = Current_Scope + then + Error_Msg_NE + ("?exception & is never raised", Entity (Id), Id); + end if; + if Present (Renamed_Entity (Entity (Id))) then if Entity (Id) = Standard_Numeric_Error then Check_Restriction (No_Obsolescent_Features, Id); @@ -513,6 +524,8 @@ package body Sem_Ch11 is then Error_Msg_N ("exception name expected in raise statement", Exception_Id); + else + Set_Is_Raised (Exception_Name); end if; if Present (Expression (N)) then |