From 2db262f29a4b1495885b1f23335b6dc363bf1143 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Wed, 11 Mar 2020 07:56:34 -0400 Subject: [PATCH] [Ada] AI12-0311 New checks for language-defined units 2020-06-10 Arnaud Charlet gcc/ada/ * snames.ads-tmpl (Name_Characters_Assertion_Check, Name_Containers_Assertion_Check, Name_Interfaces_Assertion_Check, Name_IO_Assertion_Check, Name_Numerics_Assertion_Check, Name_Strings_Assertion_Check, Name_System_Assertion_Check): New constants. * types.ads (Characters_Assertion_Check, Containers_Assertion_Check, Interfaces_Assertion_Check, IO_Assertion_Check, Numerics_Assertion_Check, Strings_Assertion_Check, System_Assertion_Check): New constants. (All_Checks): Update accordingly. --- gcc/ada/snames.ads-tmpl | 9 ++++++- gcc/ada/types.ads | 54 +++++++++++++++++++++++------------------ 2 files changed, 39 insertions(+), 24 deletions(-) diff --git a/gcc/ada/snames.ads-tmpl b/gcc/ada/snames.ads-tmpl index 0f39a975cd4..a1a7bf7bfca 100644 --- a/gcc/ada/snames.ads-tmpl +++ b/gcc/ada/snames.ads-tmpl @@ -1206,21 +1206,28 @@ package Snames is Name_Alignment_Check : constant Name_Id := N + $; -- GNAT Name_Allocation_Check : constant Name_Id := N + $; Name_Atomic_Synchronization : constant Name_Id := N + $; -- GNAT + Name_Characters_Assertion_Check : constant Name_Id := N + $; + Name_Containers_Assertion_Check : constant Name_Id := N + $; Name_Discriminant_Check : constant Name_Id := N + $; Name_Division_Check : constant Name_Id := N + $; Name_Duplicated_Tag_Check : constant Name_Id := N + $; -- GNAT Name_Elaboration_Check : constant Name_Id := N + $; Name_Index_Check : constant Name_Id := N + $; + Name_Interfaces_Assertion_Check : constant Name_Id := N + $; + Name_IO_Assertion_Check : constant Name_Id := N + $; Name_Length_Check : constant Name_Id := N + $; + Name_Numerics_Assertion_Check : constant Name_Id := N + $; Name_Overflow_Check : constant Name_Id := N + $; Name_Predicate_Check : constant Name_Id := N + $; -- GNAT + Name_Program_Error_Check : constant Name_Id := N + $; Name_Range_Check : constant Name_Id := N + $; Name_Storage_Check : constant Name_Id := N + $; + Name_Strings_Assertion_Check : constant Name_Id := N + $; + Name_System_Assertion_Check : constant Name_Id := N + $; Name_Tag_Check : constant Name_Id := N + $; Name_Validity_Check : constant Name_Id := N + $; -- GNAT Name_Container_Checks : constant Name_Id := N + $; -- GNAT Name_Tampering_Check : constant Name_Id := N + $; -- GNAT - Name_Program_Error_Check : constant Name_Id := N + $; Name_Tasking_Check : constant Name_Id := N + $; Name_All_Checks : constant Name_Id := N + $; Last_Check_Name : constant Name_Id := N + $; diff --git a/gcc/ada/types.ads b/gcc/ada/types.ads index 655a28e9741..6a1d94db8b0 100644 --- a/gcc/ada/types.ads +++ b/gcc/ada/types.ads @@ -668,32 +668,39 @@ package Types is No_Check_Id : constant := 0; -- Check_Id value used to indicate no check - Access_Check : constant := 1; - Accessibility_Check : constant := 2; - Alignment_Check : constant := 3; - Allocation_Check : constant := 4; - Atomic_Synchronization : constant := 5; - Discriminant_Check : constant := 6; - Division_Check : constant := 7; - Duplicated_Tag_Check : constant := 8; - Elaboration_Check : constant := 9; - Index_Check : constant := 10; - Length_Check : constant := 11; - Overflow_Check : constant := 12; - Predicate_Check : constant := 13; - Range_Check : constant := 14; - Storage_Check : constant := 15; - Tag_Check : constant := 16; - Validity_Check : constant := 17; - Container_Checks : constant := 18; - Tampering_Check : constant := 19; - Program_Error_Check : constant := 20; - Tasking_Check : constant := 21; + Access_Check : constant := 1; + Accessibility_Check : constant := 2; + Alignment_Check : constant := 3; + Allocation_Check : constant := 4; + Atomic_Synchronization : constant := 5; + Characters_Assertion_Check : constant := 6; + Containers_Assertion_Check : constant := 7; + Discriminant_Check : constant := 8; + Division_Check : constant := 9; + Duplicated_Tag_Check : constant := 10; + Elaboration_Check : constant := 11; + Index_Check : constant := 12; + Interfaces_Assertion_Check : constant := 13; + IO_Assertion_Check : constant := 14; + Length_Check : constant := 15; + Numerics_Assertion_Check : constant := 16; + Overflow_Check : constant := 17; + Predicate_Check : constant := 18; + Program_Error_Check : constant := 19; + Range_Check : constant := 20; + Storage_Check : constant := 21; + Strings_Assertion_Check : constant := 22; + System_Assertion_Check : constant := 23; + Tag_Check : constant := 24; + Validity_Check : constant := 25; + Container_Checks : constant := 26; + Tampering_Check : constant := 27; + Tasking_Check : constant := 28; -- Values used to represent individual predefined checks (including the -- setting of Atomic_Synchronization, which is implemented internally using -- a "check" whose name is Atomic_Synchronization). - All_Checks : constant := 22; + All_Checks : constant := 29; -- Value used to represent All_Checks value subtype Predefined_Check_Id is Check_Id range 1 .. All_Checks; @@ -717,7 +724,8 @@ package Types is -- To add a new check type to GNAT, the following steps are required: -- 1. Add an entry to Snames spec for the new name - -- 2. Add an entry to the definition of Check_Id above + -- 2. Add an entry to the definition of Check_Id above (very important: + -- these definitions should be in the same order in Snames and here) -- 3. Add a new function to Checks to handle the new check test -- 4. Add a new Do_xxx_Check flag to Sinfo (if required) -- 5. Add appropriate checks for the new test -- 2.30.2