aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2023-09-27 12:19:53 +0200
committerMarc Poulhiès <dkm@gcc.gnu.org>2025-01-06 10:14:47 +0100
commit92d50b9d6478d58a99012f3c05bd144b7fcd8937 (patch)
tree1d3408071e633ebad58b19a38b2d7c63449fdbce
parenta172d6cfa0634d932d30e36636d1bd79ae70c27c (diff)
downloadgcc-92d50b9d6478d58a99012f3c05bd144b7fcd8937.zip
gcc-92d50b9d6478d58a99012f3c05bd144b7fcd8937.tar.gz
gcc-92d50b9d6478d58a99012f3c05bd144b7fcd8937.tar.bz2
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.
-rw-r--r--gcc/ada/gen_il-gen.adb2
-rw-r--r--gcc/ada/impunit.adb2
-rw-r--r--gcc/ada/rtsfind.adb2
3 files changed, 3 insertions, 3 deletions
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;