* [Ada] Qualify internal access-to-subprogram types as not null
@ 2021-05-05 8:20 Pierre-Marie de Rodat
0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-05-05 8:20 UTC (permalink / raw)
To: gcc-patches; +Cc: Piotr Trojanek
[-- Attachment #1: Type: text/plain, Size: 463 bytes --]
When an access-to-subprogram type is qualified as not null, then the
compiler is likely to generate a more efficient code. This patch adds
such qualifiers to the internal runtime bodies, so no clients of those
runtime units are affected.
Tested on x86_64-pc-linux-gnu, committed on trunk
gcc/ada/
* libgnat/g-alleve.adb (Bit_Operation): Now a not-null type.
* libgnat/g-sechas.adb (Fill_Buffer_Access): Likewise.
* libgnat/s-dwalin.adb (Callback): Likewise.
[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 1441 bytes --]
diff --git a/gcc/ada/libgnat/g-alleve.adb b/gcc/ada/libgnat/g-alleve.adb
--- a/gcc/ada/libgnat/g-alleve.adb
+++ b/gcc/ada/libgnat/g-alleve.adb
@@ -258,7 +258,7 @@ package body GNAT.Altivec.Low_Level_Vectors is
pragma Convention (LL_Altivec, vspltisx);
type Bit_Operation is
- access function
+ not null access function
(Value : Component_Type;
Amount : Natural) return Component_Type;
diff --git a/gcc/ada/libgnat/g-sechas.adb b/gcc/ada/libgnat/g-sechas.adb
--- a/gcc/ada/libgnat/g-sechas.adb
+++ b/gcc/ada/libgnat/g-sechas.adb
@@ -38,7 +38,7 @@ package body GNAT.Secure_Hashes is
"0123456789abcdef";
type Fill_Buffer_Access is
- access procedure
+ not null access procedure
(M : in out Message_State;
SEA : Stream_Element_Array;
First : Stream_Element_Offset;
diff --git a/gcc/ada/libgnat/s-dwalin.adb b/gcc/ada/libgnat/s-dwalin.adb
--- a/gcc/ada/libgnat/s-dwalin.adb
+++ b/gcc/ada/libgnat/s-dwalin.adb
@@ -130,7 +130,7 @@ package body System.Dwarf_Lines is
Code : uint32) return String;
-- Extract a file name from the prologue
- type Callback is access procedure (C : in out Dwarf_Context);
+ type Callback is not null access procedure (C : in out Dwarf_Context);
procedure For_Each_Row (C : in out Dwarf_Context; F : Callback);
-- Traverse each .debug_line entry with a callback
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-05-05 8:20 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-05 8:20 [Ada] Qualify internal access-to-subprogram types as not null Pierre-Marie de Rodat
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).