Exception_Id : constant Node_Id := Name (N);
Exception_Name : Entity_Id := Empty;
P : Node_Id;
- Nkind_P : Node_Kind;
begin
Check_Unreachable_Code (N);
if No (Exception_Id) then
P := Parent (N);
- Nkind_P := Nkind (P);
-
- while Nkind_P /= N_Exception_Handler
- and then Nkind_P /= N_Subprogram_Body
- and then Nkind_P /= N_Package_Body
- and then Nkind_P /= N_Task_Body
- and then Nkind_P /= N_Entry_Body
+ while not Nkind_In (P, N_Exception_Handler,
+ N_Subprogram_Body,
+ N_Package_Body,
+ N_Task_Body,
+ N_Entry_Body)
loop
P := Parent (P);
- Nkind_P := Nkind (P);
end loop;
if Nkind (P) /= N_Exception_Handler then
else
Set_Local_Raise_Not_OK (P);
- Check_Restriction (No_Exception_Propagation, N);
+
+ -- Do not check the restriction if the reraise statement is part
+ -- of the code generated for an AT-END handler. That's because
+ -- if the restriction is actually active, we never generate this
+ -- raise anyway, so the apparent violation is bogus.
+
+ if not From_At_End (N) then
+ Check_Restriction (No_Exception_Propagation, N);
+ end if;
end if;
-- Normal case with exception id present
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2008, 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- --
return Flag5 (N);
end Forwards_OK;
+ function From_At_End
+ (N : Node_Id) return Boolean is
+ begin
+ pragma Assert (False
+ or else NT (N).Nkind = N_Raise_Statement);
+ return Flag4 (N);
+ end From_At_End;
+
function From_At_Mod
(N : Node_Id) return Boolean is
begin
Set_Flag5 (N, Val);
end Set_Forwards_OK;
+ procedure Set_From_At_End
+ (N : Node_Id; Val : Boolean := True) is
+ begin
+ pragma Assert (False
+ or else NT (N).Nkind = N_Raise_Statement);
+ Set_Flag4 (N, Val);
+ end Set_From_At_End;
+
procedure Set_From_At_Mod
(N : Node_Id; Val : Boolean := True) is
begin
UI_From_Int (Int (S) - Int (Sloc (N))));
end Set_End_Location;
- --------------------------------
- -- Node_Kind Membership Tests --
- --------------------------------
+ --------------
+ -- Nkind_In --
+ --------------
function Nkind_In
(T : Node_Kind;
T = V8;
end Nkind_In;
+ -----------------
+ -- Pragma_Name --
+ -----------------
+
+ function Pragma_Name (N : Node_Id) return Name_Id is
+ begin
+ return Chars (Pragma_Identifier (N));
+ end Pragma_Name;
+
end Sinfo;
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2008, 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- --
-- could not determine that either direction is definitely safe, and a
-- runtime check is required.
+ -- From_At_End (Flag4-Sem)
+ -- This flag is set on an N_Raise_Statement node if it corresponds to
+ -- the reraise statement generated as the last statement of an AT END
+ -- handler when SJLJ exception handling is active. It is used to stop
+ -- a bogus violation of restriction (No_Exception_Propagation), bogus
+ -- because if the restriction is set, the reraise is not generated.
+
-- From_At_Mod (Flag4-Sem)
-- This flag is set on the attribute definition clause node that is
-- generated by a transformation of an at mod phrase in a record
-- N_Pragma
-- Sloc points to pragma identifier
- -- Chars (Name1) identifier name from pragma identifier
-- Pragma_Argument_Associations (List2) (set to No_List if none)
-- Debug_Statement (Node3) (set to Empty if not Debug, Assert)
-- Pragma_Identifier (Node4)
-- Psect_Object is always converted to Common_Object, but there are
-- undoubtedly many other similar notes required ???
- -- Note: we don't really need the Chars field, since it can trivially
- -- be obtained as Chars (Pragma_Identifier (Node)). However, it is
- -- convenient to have this directly available, and historically the
- -- Chars field has been around for ever, whereas the Pragma_Identifier
- -- field was added much later (when we found the need to be able to get
- -- the Sloc of the pragma identifier).
+ -- Note: a utility function Pragma_Name may be applied to pragma nodes
+ -- to conveniently obtain the Chars field of the Pragma_Identifier.
--------------------------------------
-- 2.8 Pragma Argument Association --
-- Sloc points to RAISE
-- Name (Node2) (set to Empty if no exception name present)
-- Expression (Node3) (set to Empty if no expression present)
+ -- From_At_End (Flag4-Sem)
-------------------------------
-- 12.1 Generic Declaration --
-- N_Has_Chars
N_Empty,
- N_Pragma,
N_Pragma_Argument_Association,
-- N_Has_Etype
N_Conditional_Expression,
N_Explicit_Dereference,
N_Function_Call,
-
N_Indexed_Component,
N_Integer_Literal,
-
N_Null,
N_Or_Else,
N_Procedure_Call_Statement,
N_Package_Specification,
N_Parameter_Association,
N_Parameter_Specification,
+ N_Pragma,
N_Protected_Definition,
N_Range_Constraint,
N_Real_Range_Specification,
function Forwards_OK
(N : Node_Id) return Boolean; -- Flag5
+ function From_At_End
+ (N : Node_Id) return Boolean; -- Flag4
+
function From_At_Mod
(N : Node_Id) return Boolean; -- Flag4
procedure Set_From_At_Mod
(N : Node_Id; Val : Boolean := True); -- Flag4
+ procedure Set_From_At_End
+ (N : Node_Id; Val : Boolean := True); -- Flag4
+
procedure Set_From_Default
(N : Node_Id; Val : Boolean := True); -- Flag6
pragma Inline (Nkind_In);
-- Inline all above functions
+ -----------------------
+ -- Utility Functions --
+ -----------------------
+
+ function Pragma_Name (N : Node_Id) return Name_Id;
+ pragma Inline (Pragma_Name);
+ -- Convenient function to obtain Chars field of Pragma_Identifier
+
-----------------------------
-- Syntactic Parent Tables --
-----------------------------
pragma Inline (Float_Truncate);
pragma Inline (Formal_Type_Definition);
pragma Inline (Forwards_OK);
+ pragma Inline (From_At_End);
pragma Inline (From_At_Mod);
pragma Inline (From_Default);
pragma Inline (Generic_Associations);
pragma Inline (Set_Float_Truncate);
pragma Inline (Set_Formal_Type_Definition);
pragma Inline (Set_Forwards_OK);
+ pragma Inline (Set_From_At_End);
pragma Inline (Set_From_At_Mod);
pragma Inline (Set_From_Default);
pragma Inline (Set_Generic_Associations);