From 92d50b9d6478d58a99012f3c05bd144b7fcd8937 Mon Sep 17 00:00:00 2001 From: Piotr Trojanek Date: Wed, 27 Sep 2023 12:19:53 +0200 Subject: 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. --- gcc/ada/gen_il-gen.adb | 2 +- gcc/ada/impunit.adb | 2 +- gcc/ada/rtsfind.adb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'gcc') diff --git a/gcc/ada/gen_il-gen.adb b/gcc/ada/gen_il-gen.adb index c200abc..bac17eb 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 47a5459..f877177 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 6697184..16deb82 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; -- cgit v1.1