From: Piotr Trojanek <troja...@adacore.com>

By generating the type of Node_Field_Table with a "not null" qualifier
we check the null exclusion of its elements only once, at the object
declaration.

Tiny performance improvement for the debug builds (because in production
builds checks are disabled anyway); semantics is unaffected.

gcc/ada/ChangeLog:

        * gen_il-gen.adb (Put_Tables): Add "not null" to the generated code.
        * rtsfind.adb (Cstring_Ptr): Same for table with predefined RE_Id
        error messages.
        * impunit.adb (Aunit_Record): Same for array of alternative unit names.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/gen_il-gen.adb | 2 +-
 gcc/ada/impunit.adb    | 2 +-
 gcc/ada/rtsfind.adb    | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/gcc/ada/gen_il-gen.adb b/gcc/ada/gen_il-gen.adb
index c200abc0223..bac17ebc356 100644
--- a/gcc/ada/gen_il-gen.adb
+++ b/gcc/ada/gen_il-gen.adb
@@ -2214,7 +2214,7 @@ package body Gen_IL.Gen is
               Field_Enum_Type_Name & "_Index range <>) of " &
               Field_Enum_Type_Name & ";" & LF);
          Put (S, "type " & Field_Enum_Type_Name &
-              "_Array_Ref is access constant " & Field_Enum_Type_Name &
+              "_Array_Ref is not null access constant " & Field_Enum_Type_Name 
&
               "_Array;" & LF);
          Put (S, "subtype A is " & Field_Enum_Type_Name & "_Array;" & LF);
          --  Short name to make allocators below more readable
diff --git a/gcc/ada/impunit.adb b/gcc/ada/impunit.adb
index 47a5459792e..f8771772b52 100644
--- a/gcc/ada/impunit.adb
+++ b/gcc/ada/impunit.adb
@@ -649,7 +649,7 @@ package body Impunit is
 
    type Aunit_Record is record
       Fname : String (1 .. 6);
-      Aname : String_Ptr_Const;
+      Aname : not null String_Ptr_Const;
    end record;
 
    --  Array of alternative unit names
diff --git a/gcc/ada/rtsfind.adb b/gcc/ada/rtsfind.adb
index 6697184fae0..16deb82973c 100644
--- a/gcc/ada/rtsfind.adb
+++ b/gcc/ada/rtsfind.adb
@@ -153,7 +153,7 @@ package body Rtsfind is
 
    --    packed component size of 43 is not supported
 
-   type CString_Ptr is access constant String;
+   type CString_Ptr is not null access constant String;
 
    type PRE_Id_Entry is record
       Str : CString_Ptr;
-- 
2.43.0

Reply via email to