[Ada] Optimization of System.Value_N
authorBob Duff <duff@adacore.com>
Tue, 6 Apr 2021 14:27:26 +0000 (10:27 -0400)
committerPierre-Marie de Rodat <derodat@adacore.com>
Mon, 21 Jun 2021 10:45:20 +0000 (06:45 -0400)
gcc/ada/

* libgnat/s-valuen.ads (Value_Enumeration,
Valid_Enumeration_Value): Inline.
(Value_Enumeration_Pos): Add Pure_Function.

gcc/ada/libgnat/s-valuen.ads

index 258d279..7ef0539 100644 (file)
@@ -48,7 +48,7 @@ package System.Value_N is
       Hash    : Hash_Function_Ptr;
       Num     : Natural;
       Str     : String)
-      return    Natural;
+      return    Natural with Inline;
    --  Used to compute Enum'Value (Str) where Enum is some enumeration type
    --  other than those defined in package Standard. Names is a string with
    --  a lower bound of 1 containing the characters of all the enumeration
@@ -73,7 +73,7 @@ package System.Value_N is
       Hash    : Hash_Function_Ptr;
       Num     : Natural;
       Str     : String)
-      return    Boolean;
+      return    Boolean with Inline;
    --  Returns True if Str is a valid Image of some enumeration literal, False
    --  otherwise. That is, returns False if and only if Value_Enumeration would
    --  raise Constraint_Error. The parameters have the same meaning as for
@@ -87,7 +87,7 @@ package System.Value_N is
       Hash    : Hash_Function_Ptr;
       Num     : Natural;
       Str     : String)
-      return    Integer;
+      return    Integer with Pure_Function;
    --  Same as Value_Enumeration, except returns Invalid if Value_Enumeration
    --  would raise Constraint_Error.