[multiple changes]
[gcc.git] / gcc / ada / make.adb
index f716fe74b900cb0216d84c066027e1780a31e3bf..882fe6cab9a802f9882aaaf07277676cf7b83dff 100644 (file)
@@ -862,7 +862,7 @@ package body Make is
    begin
       Add_Lib_Search_Dir (N);
 
-      if Opt.Verbose_Mode then
+      if Verbose_Mode then
          Write_Str ("Adding object directory """);
          Write_Str (N);
          Write_Str (""".");
@@ -878,7 +878,7 @@ package body Make is
    begin
       Add_Src_Search_Dir (N);
 
-      if Opt.Verbose_Mode then
+      if Verbose_Mode then
          Write_Str ("Adding source directory """);
          Write_Str (N);
          Write_Str (""".");
@@ -1037,7 +1037,7 @@ package body Make is
                         --  modified.
 
                      begin
-                        if Opt.Verbose_Mode then
+                        if Verbose_Mode then
                            Write_Str ("   Adding ");
                            Write_Line (Argv);
                         end if;
@@ -1059,7 +1059,7 @@ package body Make is
                      --  We need a copy, because Name_Buffer may be modified
 
                   begin
-                     if Opt.Verbose_Mode then
+                     if Verbose_Mode then
                         Write_Str ("   Adding ");
                         Write_Line (Argv);
                      end if;
@@ -1317,11 +1317,11 @@ package body Make is
       if Read_Only then
          declare
             Saved_Check_Object_Consistency : constant Boolean :=
-                                               Opt.Check_Object_Consistency;
+                                               Check_Object_Consistency;
          begin
-            Opt.Check_Object_Consistency := False;
+            Check_Object_Consistency := False;
             Text := Read_Library_Info (Lib_File);
-            Opt.Check_Object_Consistency := Saved_Check_Object_Consistency;
+            Check_Object_Consistency := Saved_Check_Object_Consistency;
          end;
 
       else
@@ -1384,7 +1384,7 @@ package body Make is
          --  Don't take Ali file into account if it was generated without
          --  object.
 
-         if Opt.Operating_Mode /= Opt.Check_Semantics
+         if Operating_Mode /= Check_Semantics
            and then ALIs.Table (ALI).No_Object
          then
             Verbose_Msg (Full_Lib_File, "has no corresponding object");
@@ -1394,7 +1394,7 @@ package body Make is
 
          --  Check for matching compiler switches if needed
 
-         if Opt.Check_Switches then
+         if Check_Switches then
 
             --  First, collect all the switches
 
@@ -1465,7 +1465,7 @@ package body Make is
                end loop;
 
                if not Switch_Found then
-                  if Opt.Verbose_Mode then
+                  if Verbose_Mode then
                      Verbose_Msg (ALIs.Table (ALI).Sfile,
                                   "switch mismatch """ &
                                   Switches_To_Check.Table (J).all & '"');
@@ -1480,7 +1480,7 @@ package body Make is
               Integer (Units.Table (ALIs.Table (ALI).First_Unit).Last_Arg -
                        Units.Table (ALIs.Table (ALI).First_Unit).First_Arg + 1)
             then
-               if Opt.Verbose_Mode then
+               if Verbose_Mode then
                   Verbose_Msg (ALIs.Table (ALI).Sfile,
                                "different number of switches");
 
@@ -1516,7 +1516,7 @@ package body Make is
          if Modified_Source /= No_File then
             ALI := No_ALI_Id;
 
-            if Opt.Verbose_Mode then
+            if Verbose_Mode then
                Source_Name := Full_Source_Name (Modified_Source);
 
                if Source_Name /= No_File then
@@ -1532,7 +1532,7 @@ package body Make is
             if New_Spec /= No_File then
                ALI := No_ALI_Id;
 
-               if Opt.Verbose_Mode then
+               if Verbose_Mode then
                   Source_Name := Full_Source_Name (New_Spec);
 
                   if Source_Name /= No_File then
@@ -2545,14 +2545,14 @@ package body Make is
       end if;
 
       --  The following two flags affect the behavior of ALI.Set_Source_Table.
-      --  We set Opt.Check_Source_Files to True to ensure that source file
-      --  time stamps are checked, and we set Opt.All_Sources to False to
+      --  We set Check_Source_Files to True to ensure that source file
+      --  time stamps are checked, and we set All_Sources to False to
       --  avoid checking the presence of the source files listed in the
       --  source dependency section of an ali file (which would be a mistake
       --  since the ali file may be obsolete).
 
-      Opt.Check_Source_Files := True;
-      Opt.All_Sources        := False;
+      Check_Source_Files := True;
+      All_Sources        := False;
 
       Insert_Q (Main_Source);
       Mark (Main_Source);
@@ -2764,22 +2764,22 @@ package body Make is
 
                declare
                   Saved_Object_Consistency : constant Boolean :=
-                                               Opt.Check_Object_Consistency;
+                                               Check_Object_Consistency;
 
                begin
                   --  If compilation was not OK, or if output is not an
                   --  object file and we don't do the bind step, don't check
                   --  for object consistency.
 
-                  Opt.Check_Object_Consistency :=
-                    Opt.Check_Object_Consistency
+                  Check_Object_Consistency :=
+                    Check_Object_Consistency
                     and Compilation_OK
                     and (Output_Is_Object or Do_Bind_Step);
                   Text := Read_Library_Info (Lib_File);
 
                   --  Restore Check_Object_Consistency to its initial value
 
-                  Opt.Check_Object_Consistency := Saved_Object_Consistency;
+                  Check_Object_Consistency := Saved_Object_Consistency;
                end;
 
                --  If an ALI file was generated by this compilation, scan
@@ -2808,7 +2808,7 @@ package body Make is
 
                --  If we could not read the ALI file that was just generated
                --  then there could be a problem reading either the ALI or the
-               --  corresponding object file (if Opt.Check_Object_Consistency
+               --  corresponding object file (if Check_Object_Consistency
                --  is set Read_Library_Info checks that the time stamp of the
                --  object file is more recent than that of the ALI). For an
                --  example of problems caught by this test see [6625-009].
@@ -2870,7 +2870,7 @@ package body Make is
                      --  If we have a special runtime, we add the standard
                      --  library only if we can find it.
 
-                     if Opt.RTS_Switch then
+                     if RTS_Switch then
                         Add_It := Find_File (Sfile, Osint.Source) /= No_File;
                      end if;
 
@@ -2927,7 +2927,7 @@ package body Make is
             end if;
          end loop;
 
-         if Opt.Display_Compilation_Progress then
+         if Display_Compilation_Progress then
             Write_Str ("completed ");
             Write_Int (Int (Q_Front));
             Write_Str (" out of ");
@@ -3158,7 +3158,7 @@ package body Make is
       if (not Debug.Debug_Flag_N) and Main_Project /= No_Project then
          for Project in 1 .. Projects.Last loop
             if Projects.Table (Project).Config_File_Temp then
-               if Opt.Verbose_Mode then
+               if Verbose_Mode then
                   Write_Str ("Deleting temp configuration file """);
                   Write_Str (Get_Name_String
                              (Projects.Table (Project).Config_File_Name));
@@ -3405,7 +3405,7 @@ package body Make is
          --  Do not check for an object file (".o") when compiling to
          --  Java bytecode since ".class" files are generated instead.
 
-         Opt.Check_Object_Consistency := False;
+         Check_Object_Consistency := False;
       end if;
 
       --  Special case when switch -B was specified
@@ -3734,7 +3734,7 @@ package body Make is
          end if;
       end if;
 
-      if Opt.Verbose_Mode then
+      if Verbose_Mode then
          Write_Eol;
          Write_Str ("GNATMAKE ");
          Write_Str (Gnatvsn.Gnat_Version_String);
@@ -3778,8 +3778,8 @@ package body Make is
 
       --  If -M was specified, behave as if -n was specified
 
-      if Opt.List_Dependencies then
-         Opt.Do_Not_Execute := True;
+      if List_Dependencies then
+         Do_Not_Execute := True;
       end if;
 
       --  Note that Osint.Next_Main_Source will always return the (possibly
@@ -3791,7 +3791,7 @@ package body Make is
       Add_Switch ("-I-", Compiler, And_Save => True);
 
       if Main_Project = No_Project then
-         if Opt.Look_In_Primary_Dir then
+         if Look_In_Primary_Dir then
 
             Add_Switch
               ("-I" &
@@ -3815,13 +3815,13 @@ package body Make is
          --  sources for other compilation units, when there are extending
          --  projects.
 
-         Opt.Look_In_Primary_Dir := False;
+         Look_In_Primary_Dir := False;
       end if;
 
       --  If the user wants a program without a main subprogram, add the
       --  appropriate switch to the binder.
 
-      if Opt.No_Main_Subprogram then
+      if No_Main_Subprogram then
          Add_Switch ("-z", Binder, And_Save => True);
       end if;
 
@@ -3951,7 +3951,7 @@ package body Make is
 
                   --  We only output the main source file if there is only one
 
-                  if Opt.Verbose_Mode and then Osint.Number_Of_Files = 1 then
+                  if Verbose_Mode and then Osint.Number_Of_Files = 1 then
                      Write_Str ("Main source file: """);
                      Write_Str (Main_Unit_File_Name
                                 (Pos + 1 .. Main_Unit_File_Name'Last));
@@ -3971,7 +3971,7 @@ package body Make is
                --  switches (if any).
 
                if Osint.Number_Of_Files = 1 then
-                  if Opt.Verbose_Mode then
+                  if Verbose_Mode then
                      Write_Str ("Adding gnatmake switches for """);
                      Write_Str (Main_Unit_File_Name);
                      Write_Line (""".");
@@ -4004,7 +4004,7 @@ package body Make is
 
                   begin
                      if Defaults /= Nil_Variable_Value then
-                        if (not Opt.Quiet_Output)
+                        if (not Quiet_Output)
                           and then Switches /= No_Array_Element
                         then
                            Write_Line
@@ -4020,7 +4020,7 @@ package body Make is
                            The_Package => Builder_Package,
                            Program     => None);
 
-                     elsif (not Opt.Quiet_Output)
+                     elsif (not Quiet_Output)
                        and then Switches /= No_Array_Element
                      then
                         Write_Line
@@ -4046,7 +4046,7 @@ package body Make is
             --  Add binder switches from the project file for the first main
 
             if Do_Bind_Step and Binder_Package /= No_Package then
-               if Opt.Verbose_Mode then
+               if Verbose_Mode then
                   Write_Str ("Adding binder switches for """);
                   Write_Str (Main_Unit_File_Name);
                   Write_Line (""".");
@@ -4061,7 +4061,7 @@ package body Make is
             --  Add linker switches from the project file for the first main
 
             if Do_Link_Step and Linker_Package /= No_Package then
-               if Opt.Verbose_Mode then
+               if Verbose_Mode then
                   Write_Str ("Adding linker switches for""");
                   Write_Str (Main_Unit_File_Name);
                   Write_Line (""".");
@@ -4087,7 +4087,7 @@ package body Make is
             Make_Failed ("*** make failed.");
       end;
 
-      Display_Commands (not Opt.Quiet_Output);
+      Display_Commands (not Quiet_Output);
 
       Check_Steps;
 
@@ -4104,7 +4104,7 @@ package body Make is
                     not MLib.Tgt.Library_Exists_For (Proj);
 
                   if Projects.Table (Proj).Flag1 then
-                     if Opt.Verbose_Mode then
+                     if Verbose_Mode then
                         Write_Str
                           ("Library file does not exist for project """);
                         Write_Str
@@ -4280,7 +4280,7 @@ package body Make is
       --  precedence.
 
       if Saved_Maximum_Processes = 0 then
-         Saved_Maximum_Processes := Opt.Maximum_Processes;
+         Saved_Maximum_Processes := Maximum_Processes;
       end if;
 
       --  Allocate as many temporary mapping file names as the maximum
@@ -4470,15 +4470,15 @@ package body Make is
                   Most_Recent_Obj_Stamp => Youngest_Obj_Stamp,
                   Main_Unit             => Is_Main_Unit,
                   Compilation_Failures  => Compilation_Failures,
-                  Check_Readonly_Files  => Opt.Check_Readonly_Files,
-                  Do_Not_Execute        => Opt.Do_Not_Execute,
-                  Force_Compilations    => Opt.Force_Compilations,
-                  In_Place_Mode         => Opt.In_Place_Mode,
-                  Keep_Going            => Opt.Keep_Going,
+                  Check_Readonly_Files  => Check_Readonly_Files,
+                  Do_Not_Execute        => Do_Not_Execute,
+                  Force_Compilations    => Force_Compilations,
+                  In_Place_Mode         => In_Place_Mode,
+                  Keep_Going            => Keep_Going,
                   Initialize_ALI_Data   => True,
                   Max_Process           => Saved_Maximum_Processes);
 
-               if Opt.Verbose_Mode then
+               if Verbose_Mode then
                   Write_Str ("End of compilation");
                   Write_Eol;
                end if;
@@ -4491,7 +4491,7 @@ package body Make is
                  Total_Compilation_Failures + Compilation_Failures;
 
                if Total_Compilation_Failures /= 0 then
-                  if Opt.Keep_Going then
+                  if Keep_Going then
                      goto Next_Main;
 
                   else
@@ -4563,7 +4563,7 @@ package body Make is
                   end loop;
                end if;
 
-               if Opt.List_Dependencies then
+               if List_Dependencies then
                   if First_Compiled_File /= No_File then
                      Inform
                        (First_Compiled_File,
@@ -4574,13 +4574,13 @@ package body Make is
 
                elsif First_Compiled_File = No_File
                  and then not Do_Bind_Step
-                 and then not Opt.Quiet_Output
+                 and then not Quiet_Output
                  and then not Library_Rebuilt
                  and then Osint.Number_Of_Files = 1
                then
                   Inform (Msg => "objects up to date.");
 
-               elsif Opt.Do_Not_Execute
+               elsif Do_Not_Execute
                  and then First_Compiled_File /= No_File
                then
                   Write_Name (First_Compiled_File);
@@ -4598,8 +4598,8 @@ package body Make is
 
                --    4) Made unit cannot be a main unit
 
-               if (Opt.Do_Not_Execute
-                   or Opt.List_Dependencies
+               if (Do_Not_Execute
+                   or List_Dependencies
                    or not Do_Bind_Step
                    or not Is_Main_Unit)
                  and then not No_Main_Subprogram
@@ -4659,7 +4659,7 @@ package body Make is
                   --  and otherwise motivate the relink/rebind.
 
                   if not Executable_Obsolete then
-                     if not Opt.Quiet_Output then
+                     if not Quiet_Output then
                         Inform (Executable, "up to date.");
                      end if;
 
@@ -4722,7 +4722,7 @@ package body Make is
             --  library path. In this case, use the corresponding library file
             --  name.
 
-            if Main_ALI_File = No_File and then Opt.In_Place_Mode then
+            if Main_ALI_File = No_File and then In_Place_Mode then
                Get_Name_String (Get_Directory (Full_Source_Name (Src_File)));
                Get_Name_String_And_Append (ALI_File);
                Main_ALI_File := Name_Find;
@@ -5300,7 +5300,7 @@ package body Make is
 
                   exception
                      when Link_Failed =>
-                        if Osint.Number_Of_Files = 1 or not Opt.Keep_Going then
+                        if Osint.Number_Of_Files = 1 or not Keep_Going then
                            raise;
 
                         else
@@ -5402,7 +5402,7 @@ package body Make is
                   --  if any.
 
                   if Do_Bind_Step and Binder_Package /= No_Package then
-                     if Opt.Verbose_Mode then
+                     if Verbose_Mode then
                         Write_Str ("Adding binder switches for """);
                         Write_Str (Main_Unit_File_Name);
                         Write_Line (""".");
@@ -5418,7 +5418,7 @@ package body Make is
                   --  if any.
 
                   if Do_Link_Step and Linker_Package /= No_Package then
-                     if Opt.Verbose_Mode then
+                     if Verbose_Mode then
                         Write_Str ("Adding linker switches for""");
                         Write_Str (Main_Unit_File_Name);
                         Write_Line (""".");
@@ -5649,7 +5649,7 @@ package body Make is
       --  GNATMAKE since we do not need to check source consistency
       --  again once GNATMAKE has looked at the sources to check.
 
-      Opt.Check_Object_Consistency := True;
+      Check_Object_Consistency := True;
 
       --  Package initializations. The order of calls is important here.
 
@@ -5689,14 +5689,14 @@ package body Make is
 
       --  Test for trailing -o switch
 
-      elsif Opt.Output_File_Name_Present
+      elsif Output_File_Name_Present
         and then not Output_File_Name_Seen
       then
          Make_Failed ("output file name missing after -o");
 
       --  Test for trailing -D switch
 
-      elsif Opt.Object_Directory_Present
+      elsif Object_Directory_Present
         and then not Object_Directory_Seen then
          Make_Failed ("object directory missing after -D");
       end if;
@@ -5730,7 +5730,7 @@ package body Make is
 
          --  A project file was specified by a -P switch
 
-         if Opt.Verbose_Mode then
+         if Verbose_Mode then
             Write_Eol;
             Write_Str ("Parsing Project File """);
             Write_Str (Project_File_Name.all);
@@ -5740,7 +5740,7 @@ package body Make is
 
          --  Avoid looking in the current directory for ALI files
 
-         --  Opt.Look_In_Primary_Dir := False;
+         --  Look_In_Primary_Dir := False;
 
          --  Set the project parsing verbosity to whatever was specified
          --  by a possible -vP switch.
@@ -5759,7 +5759,7 @@ package body Make is
             Make_Failed ("""", Project_File_Name.all, """ processing failed");
          end if;
 
-         if Opt.Verbose_Mode then
+         if Verbose_Mode then
             Write_Eol;
             Write_Str ("Parsing of Project File """);
             Write_Str (Project_File_Name.all);
@@ -5941,7 +5941,7 @@ package body Make is
             --  is not marked.
 
             if Sfile /= No_Name and then not Is_Marked (Sfile) then
-               if Opt.Verbose_Mode then
+               if Verbose_Mode then
                   Write_Str ("Adding """);
                   Write_Str (Get_Name_String (Sfile));
                   Write_Line (""" to the queue");
@@ -5959,7 +5959,7 @@ package body Make is
             --  queue. This will allow parallel compilation processes if -jx
             --  switch is used.
 
-            if Opt.Verbose_Mode then
+            if Verbose_Mode then
                Write_Str ("Adding """);
                Write_Str (Get_Name_String (Sfile));
                Write_Line (""" as if on the command line");
@@ -6229,7 +6229,7 @@ package body Make is
 
          --  We have to provide the full library file name in In_Place_Mode
 
-         if Opt.In_Place_Mode then
+         if In_Place_Mode then
             Lib_Name := Full_Lib_File_Name (Lib_Name);
          end if;
 
@@ -6249,7 +6249,7 @@ package body Make is
             then
                null;
             else
-               if not Opt.Quiet_Output then
+               if not Quiet_Output then
                   Src_Name := Full_Source_Name (Src_Name);
                end if;
 
@@ -6479,7 +6479,7 @@ package body Make is
       --  flag (that is we have seen a -o), then the next argument is
       --  the name of the output executable.
 
-      elsif Opt.Output_File_Name_Present
+      elsif Output_File_Name_Present
         and then not Output_File_Name_Seen
       then
          Output_File_Name_Seen := True;
@@ -6511,7 +6511,7 @@ package body Make is
       --  (that is we have seen a -D), then the next argument is
       --  the path name of the object directory..
 
-      elsif Opt.Object_Directory_Present
+      elsif Object_Directory_Present
         and then not Object_Directory_Seen
       then
          Object_Directory_Seen := True;
@@ -6581,7 +6581,7 @@ package body Make is
 
          if Argv'Length > 2 and then Argv (1 .. 2) = "-I" then
             if Argv (3 .. Argv'Last) = "-" then
-               Opt.Look_In_Primary_Dir := False;
+               Look_In_Primary_Dir := False;
 
             elsif Program_Args = Compiler then
                if Argv (3 .. Argv'Last) /= "-" then
@@ -6683,9 +6683,9 @@ package body Make is
 
                --  Valid --RTS switch
 
-               Opt.No_Stdinc := True;
-               Opt.No_Stdlib := True;
-               Opt.RTS_Switch := True;
+               No_Stdinc := True;
+               No_Stdlib := True;
+               RTS_Switch := True;
 
                declare
                   Src_Path_Name : constant String_Ptr :=
@@ -6737,7 +6737,7 @@ package body Make is
          --  -I-
 
          elsif Argv (2 .. Argv'Last) = "I-" then
-            Opt.Look_In_Primary_Dir := False;
+            Look_In_Primary_Dir := False;
 
          --  Forbid  -?-  or  -??-  where ? is any character
 
@@ -6835,7 +6835,7 @@ package body Make is
          elsif Argv (2) = 'd'
            and then Argv'Last = 2
          then
-            Opt.Display_Compilation_Progress := True;
+            Display_Compilation_Progress := True;
 
          --  -i
 
@@ -6862,7 +6862,7 @@ package body Make is
          elsif Argv (2) = 'm'
            and then Argv'Last = 2
          then
-            Opt.Minimal_Recompilation := True;
+            Minimal_Recompilation := True;
 
          --  -u
 
@@ -6870,7 +6870,7 @@ package body Make is
            and then Argv'Last = 2
          then
             Unique_Compile   := True;
-            Opt.Compile_Only := True;
+            Compile_Only := True;
             Do_Bind_Step     := False;
             Do_Link_Step     := False;
 
@@ -6881,7 +6881,7 @@ package body Make is
          then
             Unique_Compile_All_Projects := True;
             Unique_Compile   := True;
-            Opt.Compile_Only := True;
+            Compile_Only := True;
             Do_Bind_Step     := False;
             Do_Link_Step     := False;
 
@@ -6962,9 +6962,9 @@ package body Make is
             --  step are not executed.
 
             Add_Switch (Argv, Compiler, And_Save => And_Save);
-            Opt.Operating_Mode := Opt.Check_Semantics;
-            Opt.Check_Object_Consistency := False;
-            Opt.Compile_Only             := True;
+            Operating_Mode := Check_Semantics;
+            Check_Object_Consistency := False;
+            Compile_Only             := True;
             Do_Bind_Step                 := False;
             Do_Link_Step                 := False;
 
@@ -6973,7 +6973,7 @@ package body Make is
             --  Don't pass -nostdlib to gnatlink, it will disable
             --  linking with all standard library files.
 
-            Opt.No_Stdlib := True;
+            No_Stdlib := True;
 
             Add_Switch (Argv, Compiler, And_Save => And_Save);
             Add_Switch (Argv, Binder, And_Save => And_Save);
@@ -6982,19 +6982,20 @@ package body Make is
 
             --  Pass -nostdinc to the Compiler and to gnatbind
 
-            Opt.No_Stdinc := True;
+            No_Stdinc := True;
             Add_Switch (Argv, Compiler, And_Save => And_Save);
             Add_Switch (Argv, Binder, And_Save => And_Save);
 
             --  By default all switches with more than one character
             --  or one character switches which are not in 'a' .. 'z'
-            --  (except 'C', 'F', and 'M') are passed to the compiler,
+            --  (except 'C', 'F', 'M' and 'B') are passed to the compiler,
             --  unless we are dealing with a debug switch (starts with 'd')
 
          elsif Argv (2) /= 'd'
            and then Argv (2 .. Argv'Last) /= "C"
            and then Argv (2 .. Argv'Last) /= "F"
            and then Argv (2 .. Argv'Last) /= "M"
+           and then Argv (2 .. Argv'Last) /= "B"
            and then (Argv'Length > 2 or else Argv (2) not in 'a' .. 'z')
          then
             Add_Switch (Argv, Compiler, And_Save => And_Save);
@@ -7214,7 +7215,7 @@ package body Make is
       Prefix : String := "  -> ")
    is
    begin
-      if not Opt.Verbose_Mode then
+      if not Verbose_Mode then
          return;
       end if;