+2018-06-11 Bob Duff <duff@adacore.com>
+
+ * libgnat/a-ciorma.adb, libgnat/a-ciormu.adb, libgnat/a-ciorse.adb,
+ libgnat/a-coorma.adb, libgnat/a-coormu.adb, libgnat/a-coorse.adb:
+ (Element): Add code to detect dangling cursors in some cases.
+
2018-06-11 Yannick Moy <moy@adacore.com>
* sem_ch6.adb (Build_Subprogram_Declaration): Mark parameters as coming
"Position cursor of function Element is bad";
end if;
+ if Checks and then
+ (Left (Position.Node) = Position.Node
+ or else Right (Position.Node) = Position.Node)
+ then
+ raise Program_Error with "dangling cursor";
+ end if;
+
pragma Assert (Vet (Position.Container.Tree, Position.Node),
"Position cursor of function Element is bad");
raise Program_Error with "Position cursor is bad";
end if;
+ if Checks and then
+ (Left (Position.Node) = Position.Node
+ or else Right (Position.Node) = Position.Node)
+ then
+ raise Program_Error with "dangling cursor";
+ end if;
+
pragma Assert (Vet (Position.Container.Tree, Position.Node),
"bad cursor in Element");
raise Program_Error with "Position cursor is bad";
end if;
+ if Checks and then
+ (Left (Position.Node) = Position.Node
+ or else Right (Position.Node) = Position.Node)
+ then
+ raise Program_Error with "dangling cursor";
+ end if;
+
pragma Assert (Vet (Position.Container.Tree, Position.Node),
"bad cursor in Element");
"Position cursor of function Element equals No_Element";
end if;
+ if Checks and then
+ (Left (Position.Node) = Position.Node
+ or else Right (Position.Node) = Position.Node)
+ then
+ raise Program_Error with "dangling cursor";
+ end if;
+
pragma Assert (Vet (Position.Container.Tree, Position.Node),
"Position cursor of function Element is bad");
raise Constraint_Error with "Position cursor equals No_Element";
end if;
+ if Checks and then
+ (Left (Position.Node) = Position.Node
+ or else Right (Position.Node) = Position.Node)
+ then
+ raise Program_Error with "dangling cursor";
+ end if;
+
pragma Assert (Vet (Position.Container.Tree, Position.Node),
"bad cursor in Element");
raise Constraint_Error with "Position cursor equals No_Element";
end if;
+ if Checks and then
+ (Left (Position.Node) = Position.Node
+ or else Right (Position.Node) = Position.Node)
+ then
+ raise Program_Error with "dangling cursor";
+ end if;
+
pragma Assert (Vet (Position.Container.Tree, Position.Node),
"bad cursor in Element");