https://gcc.gnu.org/g:92d50b9d6478d58a99012f3c05bd144b7fcd8937

commit r15-6579-g92d50b9d6478d58a99012f3c05bd144b7fcd8937
Author: Piotr Trojanek <troja...@adacore.com>
Date:   Wed Sep 27 12:19:53 2023 +0200

    ada: Avoid null-exclusion checks for Node_Field_Table
    
    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.

Diff:
---
 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 c200abc02237..bac17ebc3560 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 47a5459792e9..f8771772b523 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 6697184fae04..16deb82973cc 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;

Reply via email to