]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Avoid null-exclusion checks for Node_Field_Table
authorPiotr Trojanek <trojanek@adacore.com>
Wed, 27 Sep 2023 10:19:53 +0000 (12:19 +0200)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Mon, 6 Jan 2025 09:14:47 +0000 (10:14 +0100)
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.

gcc/ada/gen_il-gen.adb
gcc/ada/impunit.adb
gcc/ada/rtsfind.adb

index c200abc0223702a74a792361cbb31ef81ea78060..bac17ebc3560d2d65e26fb412bc6af6ce206b9d2 100644 (file)
@@ -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
index 47a5459792e980c7011b5544c89bf46499766935..f8771772b5231bbd476c9a312ade7046d23215fa 100644 (file)
@@ -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
index 6697184fae0453caaa156337c615e0d878e882a8..16deb82973cc7e20eb46b219fdcc261129ce5530 100644 (file)
@@ -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;