[Ada] Confusion in Transform_Function_Array and internal subprograms
authorArnaud Charlet <charlet@adacore.com>
Sat, 7 Nov 2020 18:53:05 +0000 (19:53 +0100)
committerPierre-Marie de Rodat <derodat@adacore.com>
Mon, 30 Nov 2020 14:16:15 +0000 (09:16 -0500)
gcc/ada/

* ali-util.adb (Get_File_Checksum): Remove dead code.
* exp_ch4.adb (Expand_Boolean_Operator, Expand_N_Op_Not,
Make_Boolean_Array_Op): Take Transform_Function_Array into
account.
* exp_ch6.adb (Expand_Call_Helper): Update comment. Code
cleanup.
* exp_util.adb (Build_Procedure_Form): Use new predefined name
Name_UP_RESULT.
* snames.ads-tmpl (Name_UP_RESULT): New predefined name.  Code
cleanup: remove unused names from the project parser, moved to
gprbuild sources.
* xsnamest.adb: Add support for uppercase names.

gcc/ada/ali-util.adb
gcc/ada/exp_ch4.adb
gcc/ada/exp_ch6.adb
gcc/ada/exp_util.adb
gcc/ada/snames.ads-tmpl
gcc/ada/xsnamest.adb

index 9dcc656..7dabbfb 100644 (file)
@@ -31,7 +31,6 @@ with Osint;   use Osint;
 with Scans;   use Scans;
 with Scng;
 with Sinput.C;
-with Snames;  use Snames;
 with Stringt;
 with Styleg;
 
@@ -154,15 +153,6 @@ package body ALI.Util is
 
       Scanner.Initialize_Scanner (Source_Index);
 
-      --  Make sure that the project language reserved words are not
-      --  recognized as reserved words, but as identifiers. The byte info for
-      --  those names have been set if we are in gnatmake.
-
-      Set_Name_Table_Byte (Name_Project,          0);
-      Set_Name_Table_Byte (Name_Extends,          0);
-      Set_Name_Table_Byte (Name_External,         0);
-      Set_Name_Table_Byte (Name_External_As_List, 0);
-
       --  Scan the complete file to compute its checksum
 
       loop
index 5ee5613..d65dac9 100644 (file)
@@ -2183,21 +2183,54 @@ package body Exp_Ch4 is
          then
             return;
          else
-
             Func_Body := Make_Boolean_Array_Op (Etype (L), N);
             Func_Name := Defining_Unit_Name (Specification (Func_Body));
             Insert_Action (N, Func_Body);
 
             --  Now rewrite the expression with a call
 
-            Rewrite (N,
-              Make_Function_Call (Loc,
-                Name                   => New_Occurrence_Of (Func_Name, Loc),
-                Parameter_Associations =>
-                  New_List (
-                    L,
-                    Make_Type_Conversion
-                      (Loc, New_Occurrence_Of (Etype (L), Loc), R))));
+            if Transform_Function_Array then
+               declare
+                  Temp_Id : constant Entity_Id := Make_Temporary (Loc, 'T');
+                  Call    : Node_Id;
+                  Decl    : Node_Id;
+
+               begin
+                  --  Generate:
+                  --    Temp : ...;
+
+                  Decl :=
+                    Make_Object_Declaration (Loc,
+                      Defining_Identifier => Temp_Id,
+                      Object_Definition   =>
+                        New_Occurrence_Of (Etype (L), Loc));
+
+                  --  Generate:
+                  --    Proc_Call (L, R, Temp);
+
+                  Call :=
+                    Make_Procedure_Call_Statement (Loc,
+                      Name => New_Occurrence_Of (Func_Name, Loc),
+                      Parameter_Associations =>
+                        New_List (
+                          L,
+                          Make_Type_Conversion
+                            (Loc, New_Occurrence_Of (Etype (L), Loc), R),
+                          New_Occurrence_Of (Temp_Id, Loc)));
+
+                  Insert_Actions (Parent (N), New_List (Decl, Call));
+                  Rewrite (N, New_Occurrence_Of (Temp_Id, Loc));
+               end;
+            else
+               Rewrite (N,
+                 Make_Function_Call (Loc,
+                   Name => New_Occurrence_Of (Func_Name, Loc),
+                   Parameter_Associations =>
+                     New_List (
+                       L,
+                       Make_Type_Conversion
+                         (Loc, New_Occurrence_Of (Etype (L), Loc), R))));
+            end if;
 
             Analyze_And_Resolve (N, Typ);
          end if;
@@ -9998,12 +10031,21 @@ package body Exp_Ch4 is
    --       return B;
    --     end Nnnn;
 
+   --  or in the case of Transform_Function_Array:
+
+   --     procedure Nnnn (A : arr; RESULT : out arr) is
+   --     begin
+   --       for J in a'range loop
+   --          RESULT (J) := not A (J);
+   --       end loop;
+   --     end Nnnn;
+
    --  Here arr is the actual subtype of the parameter (and hence always
-   --  constrained). Then we replace the not with a call to this function.
+   --  constrained). Then we replace the not with a call to this subprogram.
 
    procedure Expand_N_Op_Not (N : Node_Id) is
       Loc  : constant Source_Ptr := Sloc (N);
-      Typ  : constant Entity_Id  := Etype (N);
+      Typ  : constant Entity_Id  := Etype (Right_Opnd (N));
       Opnd : Node_Id;
       Arr  : Entity_Id;
       A    : Entity_Id;
@@ -10099,7 +10141,13 @@ package body Exp_Ch4 is
       end if;
 
       A := Make_Defining_Identifier (Loc, Name_uA);
-      B := Make_Defining_Identifier (Loc, Name_uB);
+
+      if Transform_Function_Array then
+         B := Make_Defining_Identifier (Loc, Name_UP_RESULT);
+      else
+         B := Make_Defining_Identifier (Loc, Name_uB);
+      end if;
+
       J := Make_Defining_Identifier (Loc, Name_uJ);
 
       A_J :=
@@ -10134,33 +10182,82 @@ package body Exp_Ch4 is
       Func_Name := Make_Temporary (Loc, 'N');
       Set_Is_Inlined (Func_Name);
 
-      Insert_Action (N,
-        Make_Subprogram_Body (Loc,
-          Specification =>
-            Make_Function_Specification (Loc,
-              Defining_Unit_Name => Func_Name,
-              Parameter_Specifications => New_List (
-                Make_Parameter_Specification (Loc,
-                  Defining_Identifier => A,
-                  Parameter_Type      => New_Occurrence_Of (Typ, Loc))),
-              Result_Definition => New_Occurrence_Of (Typ, Loc)),
+      if Transform_Function_Array then
+         Insert_Action (N,
+           Make_Subprogram_Body (Loc,
+             Specification =>
+               Make_Procedure_Specification (Loc,
+                 Defining_Unit_Name => Func_Name,
+                 Parameter_Specifications => New_List (
+                   Make_Parameter_Specification (Loc,
+                     Defining_Identifier => A,
+                     Parameter_Type      => New_Occurrence_Of (Typ, Loc)),
+                   Make_Parameter_Specification (Loc,
+                     Defining_Identifier => B,
+                     Out_Present         => True,
+                     Parameter_Type      => New_Occurrence_Of (Typ, Loc)))),
+
+             Declarations => New_List,
+
+             Handled_Statement_Sequence =>
+               Make_Handled_Sequence_Of_Statements (Loc,
+                 Statements => New_List (Loop_Statement))));
 
-          Declarations => New_List (
-            Make_Object_Declaration (Loc,
-              Defining_Identifier => B,
-              Object_Definition   => New_Occurrence_Of (Arr, Loc))),
+         declare
+            Temp_Id : constant Entity_Id := Make_Temporary (Loc, 'T');
+            Call    : Node_Id;
+            Decl    : Node_Id;
 
-          Handled_Statement_Sequence =>
-            Make_Handled_Sequence_Of_Statements (Loc,
-              Statements => New_List (
-                Loop_Statement,
-                Make_Simple_Return_Statement (Loc,
-                  Expression => Make_Identifier (Loc, Chars (B)))))));
+         begin
+            --  Generate:
+            --    Temp : ...;
 
-      Rewrite (N,
-        Make_Function_Call (Loc,
-          Name                   => New_Occurrence_Of (Func_Name, Loc),
-          Parameter_Associations => New_List (Opnd)));
+            Decl :=
+              Make_Object_Declaration (Loc,
+                Defining_Identifier => Temp_Id,
+                Object_Definition   => New_Occurrence_Of (Typ, Loc));
+
+            --  Generate:
+            --    Proc_Call (Opnd, Temp);
+
+            Call :=
+              Make_Procedure_Call_Statement (Loc,
+                Name => New_Occurrence_Of (Func_Name, Loc),
+                Parameter_Associations =>
+                  New_List (Opnd, New_Occurrence_Of (Temp_Id, Loc)));
+
+            Insert_Actions (Parent (N), New_List (Decl, Call));
+            Rewrite (N, New_Occurrence_Of (Temp_Id, Loc));
+         end;
+      else
+         Insert_Action (N,
+           Make_Subprogram_Body (Loc,
+             Specification =>
+               Make_Function_Specification (Loc,
+                 Defining_Unit_Name => Func_Name,
+                 Parameter_Specifications => New_List (
+                   Make_Parameter_Specification (Loc,
+                     Defining_Identifier => A,
+                     Parameter_Type      => New_Occurrence_Of (Typ, Loc))),
+                 Result_Definition => New_Occurrence_Of (Typ, Loc)),
+
+             Declarations => New_List (
+               Make_Object_Declaration (Loc,
+                 Defining_Identifier => B,
+                 Object_Definition   => New_Occurrence_Of (Arr, Loc))),
+
+             Handled_Statement_Sequence =>
+               Make_Handled_Sequence_Of_Statements (Loc,
+                 Statements => New_List (
+                   Loop_Statement,
+                   Make_Simple_Return_Statement (Loc,
+                     Expression => Make_Identifier (Loc, Chars (B)))))));
+
+         Rewrite (N,
+           Make_Function_Call (Loc,
+             Name                   => New_Occurrence_Of (Func_Name, Loc),
+             Parameter_Associations => New_List (Opnd)));
+      end if;
 
       Analyze_And_Resolve (N, Typ);
    end Expand_N_Op_Not;
@@ -13898,6 +13995,15 @@ package body Exp_Ch4 is
    --       return C;
    --    end Annn;
 
+   --    or in the case of Transform_Function_Array:
+
+   --    procedure Annn (A : typ; B: typ; RESULT: out typ) is
+   --    begin
+   --       for J in A'range loop
+   --          RESULT (J) := A (J) op B (J);
+   --       end loop;
+   --    end Annn;
+
    --  Here typ is the boolean array type
 
    function Make_Boolean_Array_Op
@@ -13908,9 +14014,10 @@ package body Exp_Ch4 is
 
       A : constant Entity_Id := Make_Defining_Identifier (Loc, Name_uA);
       B : constant Entity_Id := Make_Defining_Identifier (Loc, Name_uB);
-      C : constant Entity_Id := Make_Defining_Identifier (Loc, Name_uC);
       J : constant Entity_Id := Make_Defining_Identifier (Loc, Name_uJ);
 
+      C   : Entity_Id;
+
       A_J : Node_Id;
       B_J : Node_Id;
       C_J : Node_Id;
@@ -13922,6 +14029,12 @@ package body Exp_Ch4 is
       Loop_Statement : Node_Id;
 
    begin
+      if Transform_Function_Array then
+         C := Make_Defining_Identifier (Loc, Name_UP_RESULT);
+      else
+         C := Make_Defining_Identifier (Loc, Name_uC);
+      end if;
+
       A_J :=
         Make_Indexed_Component (Loc,
           Prefix      => New_Occurrence_Of (A, Loc),
@@ -13984,28 +14097,52 @@ package body Exp_Ch4 is
           Defining_Identifier => B,
           Parameter_Type      => New_Occurrence_Of (Typ, Loc)));
 
+      if Transform_Function_Array then
+         Append_To (Formals,
+           Make_Parameter_Specification (Loc,
+             Defining_Identifier => C,
+             Out_Present         => True,
+             Parameter_Type      => New_Occurrence_Of (Typ, Loc)));
+      end if;
+
       Func_Name := Make_Temporary (Loc, 'A');
       Set_Is_Inlined (Func_Name);
 
-      Func_Body :=
-        Make_Subprogram_Body (Loc,
-          Specification =>
-            Make_Function_Specification (Loc,
-              Defining_Unit_Name       => Func_Name,
-              Parameter_Specifications => Formals,
-              Result_Definition        => New_Occurrence_Of (Typ, Loc)),
+      if Transform_Function_Array then
+         Func_Body :=
+           Make_Subprogram_Body (Loc,
+             Specification =>
+               Make_Procedure_Specification (Loc,
+                 Defining_Unit_Name       => Func_Name,
+                 Parameter_Specifications => Formals),
 
-          Declarations => New_List (
-            Make_Object_Declaration (Loc,
-              Defining_Identifier => C,
-              Object_Definition   => New_Occurrence_Of (Typ, Loc))),
+             Declarations => New_List,
 
-          Handled_Statement_Sequence =>
-            Make_Handled_Sequence_Of_Statements (Loc,
-              Statements => New_List (
-                Loop_Statement,
-                Make_Simple_Return_Statement (Loc,
-                  Expression => New_Occurrence_Of (C, Loc)))));
+             Handled_Statement_Sequence =>
+               Make_Handled_Sequence_Of_Statements (Loc,
+                 Statements => New_List (Loop_Statement)));
+
+      else
+         Func_Body :=
+           Make_Subprogram_Body (Loc,
+             Specification =>
+               Make_Function_Specification (Loc,
+                 Defining_Unit_Name       => Func_Name,
+                 Parameter_Specifications => Formals,
+                 Result_Definition        => New_Occurrence_Of (Typ, Loc)),
+
+             Declarations => New_List (
+               Make_Object_Declaration (Loc,
+                 Defining_Identifier => C,
+                 Object_Definition   => New_Occurrence_Of (Typ, Loc))),
+
+             Handled_Statement_Sequence =>
+               Make_Handled_Sequence_Of_Statements (Loc,
+                 Statements => New_List (
+                   Loop_Statement,
+                   Make_Simple_Return_Statement (Loc,
+                     Expression => New_Occurrence_Of (C, Loc)))));
+      end if;
 
       return Func_Body;
    end Make_Boolean_Array_Op;
index d986249..f5a1d66 100644 (file)
@@ -3637,9 +3637,9 @@ package body Exp_Ch6 is
                --  For internally generated calls ensure that they reference
                --  the entity of the spec of the called function (needed since
                --  the expander may generate calls using the entity of their
-               --  body). See for example Expand_Boolean_Operator().
+               --  body).
 
-               if not (Comes_From_Source (Call_Node))
+               if not Comes_From_Source (Call_Node)
                  and then Nkind (Unit_Declaration_Node (Func_Id)) =
                             N_Subprogram_Body
                then
index 5d58110..6d043fd 100644 (file)
@@ -3712,12 +3712,10 @@ package body Exp_Util is
 
       --  Add an extra out parameter to carry the function result
 
-      Name_Len := 6;
-      Name_Buffer (1 .. Name_Len) := "RESULT";
       Append_To (Proc_Formals,
         Make_Parameter_Specification (Loc,
           Defining_Identifier =>
-            Make_Defining_Identifier (Loc, Chars => Name_Find),
+            Make_Defining_Identifier (Loc, Name_UP_RESULT),
           Out_Present         => True,
           Parameter_Type      => New_Occurrence_Of (Etype (Subp), Loc)));
 
index d08ab53..9ad2f55 100644 (file)
@@ -757,8 +757,9 @@ package Snames is
    Name_DLL                            : constant Name_Id := N + $;
    Name_Win32                          : constant Name_Id := N + $;
 
-   --  Other special names used in processing attributes and pragmas
+   --  Other special names used in processing attributes, aspects, and pragmas
 
+   Name_Aggregate                      : constant Name_Id := N + $;
    Name_Allow                          : constant Name_Id := N + $;
    Name_Amount                         : constant Name_Id := N + $;
    Name_As_Is                          : constant Name_Id := N + $;
@@ -845,6 +846,7 @@ package Snames is
    Name_No_Vector                      : constant Name_Id := N + $;
    Name_Nominal                        : constant Name_Id := N + $;
    Name_Non_Volatile                   : constant Name_Id := N + $;
+   Name_None                           : constant Name_Id := N + $;
    Name_On                             : constant Name_Id := N + $;
    Name_Optional                       : constant Name_Id := N + $;
    Name_Policy                         : constant Name_Id := N + $;
@@ -1359,186 +1361,17 @@ package Snames is
 
    Name_Raise_Exception                  : constant Name_Id := N + $;
 
-   --  Additional reserved words and identifiers used in GNAT Project Files
-   --  Note that Name_External is already previously declared.
-
-   --  Names with a -- GB annotation are only used in gprbuild or gprclean
-
-   Name_Active                           : constant Name_Id := N + $;
-   Name_Aggregate                        : constant Name_Id := N + $;
-   Name_Archive_Builder                  : constant Name_Id := N + $;
-   Name_Archive_Builder_Append_Option    : constant Name_Id := N + $;
-   Name_Archive_Indexer                  : constant Name_Id := N + $;
-   Name_Archive_Suffix                   : constant Name_Id := N + $;
-   Name_Artifacts                        : constant Name_Id := N + $;
-   Name_Artifacts_In_Exec_Dir            : constant Name_Id := N + $; -- GB
-   Name_Artifacts_In_Object_Dir          : constant Name_Id := N + $; -- GB
-   Name_Binder                           : constant Name_Id := N + $;
-   Name_Body_Suffix                      : constant Name_Id := N + $;
-   Name_Builder                          : constant Name_Id := N + $;
-   Name_Clean                            : constant Name_Id := N + $;
-   Name_Compiler                         : constant Name_Id := N + $;
-   Name_Compiler_Command                 : constant Name_Id := N + $; -- GB
-   Name_Config_Body_File_Name            : constant Name_Id := N + $;
-   Name_Config_Body_File_Name_Index      : constant Name_Id := N + $;
-   Name_Config_Body_File_Name_Pattern    : constant Name_Id := N + $;
-   Name_Config_File_Switches             : constant Name_Id := N + $;
-   Name_Config_File_Unique               : constant Name_Id := N + $;
-   Name_Config_Spec_File_Name            : constant Name_Id := N + $;
-   Name_Config_Spec_File_Name_Index      : constant Name_Id := N + $;
-   Name_Config_Spec_File_Name_Pattern    : constant Name_Id := N + $;
-   Name_Configuration                    : constant Name_Id := N + $;
-   Name_Cross_Reference                  : constant Name_Id := N + $;
-   Name_Default_Language                 : constant Name_Id := N + $;
-   Name_Default_Switches                 : constant Name_Id := N + $;
-   Name_Dependency_Driver                : constant Name_Id := N + $;
-   Name_Dependency_Kind                  : constant Name_Id := N + $;
-   Name_Dependency_Switches              : constant Name_Id := N + $;
-   Name_Driver                           : constant Name_Id := N + $;
-   Name_Excluded_Source_Dirs             : constant Name_Id := N + $;
-   Name_Excluded_Source_Files            : constant Name_Id := N + $;
-   Name_Excluded_Source_List_File        : constant Name_Id := N + $;
-   Name_Exec_Dir                         : constant Name_Id := N + $;
-   Name_Exec_Subdir                      : constant Name_Id := N + $;
-   Name_Excluded_Patterns                : constant Name_Id := N + $;
-   Name_Executable                       : constant Name_Id := N + $;
-   Name_Executable_Suffix                : constant Name_Id := N + $;
-   Name_Extends                          : constant Name_Id := N + $;
-   Name_External_As_List                 : constant Name_Id := N + $;
-   Name_Externally_Built                 : constant Name_Id := N + $;
-   Name_Finder                           : constant Name_Id := N + $;
-   Name_Global_Compilation_Switches      : constant Name_Id := N + $;
-   Name_Global_Configuration_Pragmas     : constant Name_Id := N + $;
-   Name_Global_Config_File               : constant Name_Id := N + $; -- GB
-   Name_Gnatls                           : constant Name_Id := N + $;
-   Name_Gnatstub                         : constant Name_Id := N + $;
-   Name_Gnu                              : constant Name_Id := N + $;
-   Name_Ide                              : constant Name_Id := N + $;
-   Name_Ignore_Source_Sub_Dirs           : constant Name_Id := N + $;
-   Name_Implementation                   : constant Name_Id := N + $;
-   Name_Implementation_Exceptions        : constant Name_Id := N + $;
-   Name_Implementation_Suffix            : constant Name_Id := N + $;
-   Name_Included_Artifact_Patterns       : constant Name_Id := N + $;
-   Name_Included_Patterns                : constant Name_Id := N + $;
-   Name_Include_Switches                 : constant Name_Id := N + $;
-   Name_Include_Path                     : constant Name_Id := N + $;
-   Name_Include_Path_File                : constant Name_Id := N + $;
-   Name_Inherit_Source_Path              : constant Name_Id := N + $;
-   Name_Install                          : constant Name_Id := N + $;
-   Name_Install_Name                     : constant Name_Id := N + $;
-   Name_Languages                        : constant Name_Id := N + $;
-   Name_Language_Kind                    : constant Name_Id := N + $;
-   Name_Leading_Library_Options          : constant Name_Id := N + $;
-   Name_Leading_Required_Switches        : constant Name_Id := N + $;
-   Name_Leading_Switches                 : constant Name_Id := N + $;
-   Name_Lib_Subdir                       : constant Name_Id := N + $;
-   Name_Link_Lib_Subdir                  : constant Name_Id := N + $;
-   Name_Library                          : constant Name_Id := N + $;
-   Name_Library_Ali_Dir                  : constant Name_Id := N + $;
-   Name_Library_Auto_Init                : constant Name_Id := N + $;
-   Name_Library_Auto_Init_Supported      : constant Name_Id := N + $;
-   Name_Library_Builder                  : constant Name_Id := N + $;
-   Name_Library_Dir                      : constant Name_Id := N + $;
-   Name_Library_GCC                      : constant Name_Id := N + $;
-   Name_Library_Install_Name_Option      : constant Name_Id := N + $;
-   Name_Library_Interface                : constant Name_Id := N + $;
-   Name_Library_Kind                     : constant Name_Id := N + $;
-   Name_Library_Name                     : constant Name_Id := N + $;
-   Name_Library_Major_Minor_Id_Supported : constant Name_Id := N + $;
-   Name_Library_Options                  : constant Name_Id := N + $;
-   Name_Library_Partial_Linker           : constant Name_Id := N + $;
-   Name_Library_Reference_Symbol_File    : constant Name_Id := N + $;
-   Name_Library_Rpath_Options            : constant Name_Id := N + $; -- GB
-   Name_Library_Standalone               : constant Name_Id := N + $;
-   Name_Library_Encapsulated_Options     : constant Name_Id := N + $; -- GB
-   Name_Library_Encapsulated_Supported   : constant Name_Id := N + $; -- GB
-   Name_Library_Src_Dir                  : constant Name_Id := N + $;
-   Name_Library_Support                  : constant Name_Id := N + $;
-   Name_Library_Symbol_File              : constant Name_Id := N + $;
-   Name_Library_Symbol_Policy            : constant Name_Id := N + $;
-   Name_Library_Version                  : constant Name_Id := N + $;
-   Name_Library_Version_Switches         : constant Name_Id := N + $;
-   Name_Linker                           : constant Name_Id := N + $;
-   Name_Linker_Executable_Option         : constant Name_Id := N + $;
-   Name_Linker_Lib_Dir_Option            : constant Name_Id := N + $;
-   Name_Linker_Lib_Name_Option           : constant Name_Id := N + $;
-   Name_Local_Config_File                : constant Name_Id := N + $; -- GB
-   Name_Local_Configuration_Pragmas      : constant Name_Id := N + $;
-   Name_Locally_Removed_Files            : constant Name_Id := N + $;
-   Name_Map_File_Option                  : constant Name_Id := N + $;
-   Name_Mapping_File_Switches            : constant Name_Id := N + $;
-   Name_Mapping_Spec_Suffix              : constant Name_Id := N + $;
-   Name_Mapping_Body_Suffix              : constant Name_Id := N + $;
-   Name_Max_Command_Line_Length          : constant Name_Id := N + $;
-   Name_Metrics                          : constant Name_Id := N + $;
-   Name_Multi_Unit_Object_Separator      : constant Name_Id := N + $;
-   Name_Multi_Unit_Switches              : constant Name_Id := N + $;
-   Name_Naming                           : constant Name_Id := N + $;
-   Name_None                             : constant Name_Id := N + $;
-   Name_Object_Artifact_Extensions       : constant Name_Id := N + $;
-   Name_Object_File_Suffix               : constant Name_Id := N + $;
-   Name_Object_File_Switches             : constant Name_Id := N + $;
-   Name_Object_Generated                 : constant Name_Id := N + $;
-   Name_Object_List                      : constant Name_Id := N + $;
-   Name_Object_Path_Switches             : constant Name_Id := N + $;
-   Name_Objects_Linked                   : constant Name_Id := N + $;
-   Name_Objects_Path                     : constant Name_Id := N + $;
-   Name_Objects_Path_File                : constant Name_Id := N + $;
-   Name_Object_Dir                       : constant Name_Id := N + $;
-   Name_Option_List                      : constant Name_Id := N + $;
-   Name_Path_Syntax                      : constant Name_Id := N + $;
-   Name_Pic_Option                       : constant Name_Id := N + $;
-   Name_Pretty_Printer                   : constant Name_Id := N + $;
-   Name_Prefix                           : constant Name_Id := N + $;
-   Name_Project                          : constant Name_Id := N + $;
-   Name_Project_Dir                      : constant Name_Id := N + $;
-   Name_Project_Files                    : constant Name_Id := N + $;
-   Name_Project_Path                     : constant Name_Id := N + $;
-   Name_Project_Subdir                   : constant Name_Id := N + $;
-   Name_Remote                           : constant Name_Id := N + $;
-   Name_Required_Artifacts               : constant Name_Id := N + $;
-   Name_Response_File_Format             : constant Name_Id := N + $;
-   Name_Response_File_Switches           : constant Name_Id := N + $;
-   Name_Root_Dir                         : constant Name_Id := N + $;
-   Name_Roots                            : constant Name_Id := N + $; -- GB
-   Name_Required_Switches                : constant Name_Id := N + $;
-   Name_Run_Path_Option                  : constant Name_Id := N + $;
-   Name_Run_Path_Origin                  : constant Name_Id := N + $;
-   Name_Separate_Run_Path_Options        : constant Name_Id := N + $;
-   Name_Shared_Library_Minimum_Switches  : constant Name_Id := N + $;
-   Name_Shared_Library_Prefix            : constant Name_Id := N + $;
-   Name_Shared_Library_Suffix            : constant Name_Id := N + $;
-   Name_Separate_Suffix                  : constant Name_Id := N + $;
-   Name_Source_Artifact_Extensions       : constant Name_Id := N + $;
-   Name_Source_Dirs                      : constant Name_Id := N + $;
-   Name_Source_File_Switches             : constant Name_Id := N + $;
-   Name_Source_Files                     : constant Name_Id := N + $;
-   Name_Source_List_File                 : constant Name_Id := N + $;
-   Name_Sources_Subdir                   : constant Name_Id := N + $;
-   Name_Spec                             : constant Name_Id := N + $;
-   Name_Spec_Suffix                      : constant Name_Id := N + $;
-   Name_Specification                    : constant Name_Id := N + $;
-   Name_Specification_Exceptions         : constant Name_Id := N + $;
-   Name_Specification_Suffix             : constant Name_Id := N + $;
-   Name_Stack                            : constant Name_Id := N + $;
-   Name_Switches                         : constant Name_Id := N + $;
-   Name_Symbolic_Link_Supported          : constant Name_Id := N + $;
-   Name_Synchronize                      : constant Name_Id := N + $;
-   Name_Toolchain_Description            : constant Name_Id := N + $;
-   Name_Toolchain_Version                : constant Name_Id := N + $;
-   Name_Trailing_Required_Switches       : constant Name_Id := N + $;
-   Name_Trailing_Switches                : constant Name_Id := N + $;
-   Name_Runtime_Library_Dir              : constant Name_Id := N + $;
-   Name_Runtime_Source_Dir               : constant Name_Id := N + $;
-
    --  Additional names used by the Repinfo unit
 
    Name_Discriminant                     : constant Name_Id := N + $;
    Name_Operands                         : constant Name_Id := N + $;
 
    --  Other miscellaneous names used in front end
+   --  Note that the UP_ prefix means use the rest of the name in uppercase,
+   --  e.g. Name_UP_RESULT corresponds to the name "RESULT".
 
    Name_Unaligned_Valid                  : constant Name_Id := N + $;
+   Name_UP_RESULT                        : constant Name_Id := N + $;
    Name_Suspension_Object                : constant Name_Id := N + $;
    Name_Synchronous_Task_Control         : constant Name_Id := N + $;
 
index 834d3c4..941e2e8 100644 (file)
@@ -260,11 +260,14 @@ begin
                Replace (M, Translate (A, Xlate_U_Und));
                Translate (Name0, Lower_Case_Map);
 
-            elsif not Match (Name0, "Op_", "") then
-               Translate (Name0, Lower_Case_Map);
+            elsif Match (Name0, "UP_", "") then
+               Translate (Name0, Upper_Case_Map);
 
-            else
+            elsif Match (Name0, "Op_", "") then
                Name0 := 'O' & Translate (Name0, Lower_Case_Map);
+
+            else
+               Translate (Name0, Lower_Case_Map);
             end if;
 
             if not Match (Name0, Chk_Low) then