diff options
Diffstat (limited to 'gcc/ada/sem_ch11.adb')
-rw-r--r-- | gcc/ada/sem_ch11.adb | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/gcc/ada/sem_ch11.adb b/gcc/ada/sem_ch11.adb index 3e71b54..13ba280 100644 --- a/gcc/ada/sem_ch11.adb +++ b/gcc/ada/sem_ch11.adb @@ -165,8 +165,24 @@ package body Sem_Ch11 is begin Handler := First (L); - Check_Restriction (No_Exceptions, Handler); - Check_Restriction (No_Exception_Handlers, Handler); + + -- Pragma Restriction_Warnings has more related semantics than pragma + -- Restrictions in that it flags exception handlers as violators. Note + -- that the compiler must still generate handlers for certain critical + -- scenarios such as finalization. As a result, these handlers should + -- not be subjected to the restriction check when in warnings mode. + + if not Comes_From_Source (Handler) + and then (Restriction_Warnings (No_Exception_Handlers) + or else Restriction_Warnings (No_Exception_Propagation) + or else Restriction_Warnings (No_Exceptions)) + then + null; + + else + Check_Restriction (No_Exceptions, Handler); + Check_Restriction (No_Exception_Handlers, Handler); + end if; -- Kill current remembered values, since we don't know where we were -- when the exception was raised. |