diff options
author | Hristian Kirtchev <kirtchev@adacore.com> | 2007-08-31 12:20:54 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2007-08-31 12:20:54 +0200 |
commit | d5e96bc62a2cbda21d1d69d4c08b1bd22e9d3bbc (patch) | |
tree | ee49770d0d5c5a94700cc68331253d52a4803116 /gcc/ada/sem_ch11.adb | |
parent | bb6e3d4145581f36d908c9a0868d6b72f3503176 (diff) | |
download | gcc-d5e96bc62a2cbda21d1d69d4c08b1bd22e9d3bbc.zip gcc-d5e96bc62a2cbda21d1d69d4c08b1bd22e9d3bbc.tar.gz gcc-d5e96bc62a2cbda21d1d69d4c08b1bd22e9d3bbc.tar.bz2 |
einfo.ads, einfo.adb: New flag Is_Raised (Flag224).
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.
From-SVN: r127970
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 a6d937d..8846203 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 |