aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/libgnat/a-cihase.adb
diff options
context:
space:
mode:
authorBob Duff <duff@adacore.com>2022-04-07 12:58:56 -0400
committerPierre-Marie de Rodat <derodat@adacore.com>2022-05-18 08:41:07 +0000
commit8502433d82079d2b01bbe0e324121dc1f658311b (patch)
tree6d8e0e24a06cc179c9907d0783caa925a28c0f33 /gcc/ada/libgnat/a-cihase.adb
parentdb67182120993abaff6bbaa1a64f1ba931a8380b (diff)
downloadgcc-8502433d82079d2b01bbe0e324121dc1f658311b.zip
gcc-8502433d82079d2b01bbe0e324121dc1f658311b.tar.gz
gcc-8502433d82079d2b01bbe0e324121dc1f658311b.tar.bz2
[Ada] Disable Vet calls when container checks are disabled
Calls to various Vet functions are used throughout the containers packages to check internal consistency. This patch improves efficiency by disabling these calls when Container_Checks are suppressed. gcc/ada/ * libgnat/a-crbtgo.ads, libgnat/a-rbtgbo.ads, libgnat/a-cbdlli.adb, libgnat/a-cbhama.adb, libgnat/a-cbhase.adb, libgnat/a-cdlili.adb, libgnat/a-cfdlli.adb, libgnat/a-cfhama.adb, libgnat/a-cfhase.adb, libgnat/a-cidlli.adb, libgnat/a-cihama.adb, libgnat/a-cihase.adb, libgnat/a-cohama.adb, libgnat/a-cohase.adb, libgnat/a-crbtgo.adb, libgnat/a-crdlli.adb, libgnat/a-rbtgbo.adb (Vet): Make the Vet functions do nothing when Container_Checks'Enabled is False, and inline them, so the calls disappear when optimizing.
Diffstat (limited to 'gcc/ada/libgnat/a-cihase.adb')
-rw-r--r--gcc/ada/libgnat/a-cihase.adb6
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/ada/libgnat/a-cihase.adb b/gcc/ada/libgnat/a-cihase.adb
index cb55bbb..090d01c 100644
--- a/gcc/ada/libgnat/a-cihase.adb
+++ b/gcc/ada/libgnat/a-cihase.adb
@@ -99,7 +99,7 @@ is
procedure Set_Next (Node : Node_Access; Next : Node_Access);
pragma Inline (Set_Next);
- function Vet (Position : Cursor) return Boolean;
+ function Vet (Position : Cursor) return Boolean with Inline;
procedure Write_Node
(Stream : not null access Root_Stream_Type'Class;
@@ -1932,6 +1932,10 @@ is
function Vet (Position : Cursor) return Boolean is
begin
+ if not Container_Checks'Enabled then
+ return True;
+ end if;
+
if Position.Node = null then
return Position.Container = null;
end if;