[Ada] fix build and -margs for gnatmake

Laurent Guerby guerby@acm.org
Thu Apr 4 14:07:00 GMT 2002


I'm commiting the following patch to 3.1, tested by bootstrap on 
x86-linux, ACATS
and playing with gnatmake.

-- 
Laurent Guerby <guerby@acm.org>

2002-04-04  Laurent Guerby  <guerby@acm.org>

	* make.adb: Implement -margs, remove restriction about file name placement.
	* makeusg.adb: Documentation update.


Index: make.adb
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ada/make.adb,v
retrieving revision 1.10
diff -c -3 -p -r1.10 make.adb
*** make.adb	2001/12/22 11:58:51	1.10
--- make.adb	2002/04/04 21:58:44
*************** package body Make is
*** 449,462 ****
      --  Set to True after having scanned the file_name for
      --  switch "-o file_name"

-    File_Name_Seen : Boolean := False;
-    --  Set to true after having seen at least one file name.
-    --  Used in Scan_Make_Arg only, but must be a global variable.
-
      type Make_Program_Type is (None, Compiler, Binder, Linker);

      Program_Args : Make_Program_Type := None;
!    --  Used to indicate if we are scanning gcc, gnatbind, or gnatbl
      --  options within the gnatmake command line.
      --  Used in Scan_Make_Arg only, but must be a global variable.

--- 449,458 ----
      --  Set to True after having scanned the file_name for
      --  switch "-o file_name"

      type Make_Program_Type is (None, Compiler, Binder, Linker);

      Program_Args : Make_Program_Type := None;
!    --  Used to indicate if we are scanning gnatmake, gcc, gnatbind, or 
gnatbind
      --  options within the gnatmake command line.
      --  Used in Scan_Make_Arg only, but must be a global variable.

*************** package body Make is
*** 4089,4105 ****
         elsif (Argv (1) = Switch_Character or else Argv (1) = '-')
           and then (Argv (2 .. Argv'Last) = "cargs"
                      or else Argv (2 .. Argv'Last) = "bargs"
!                    or else Argv (2 .. Argv'Last) = "largs")
         then
-          if not File_Name_Seen then
-             Fail ("-cargs, -bargs, -largs ",
-                   "must appear after unit or file name");
-          end if;
-
            case Argv (2) is
               when 'c' => Program_Args := Compiler;
               when 'b' => Program_Args := Binder;
               when 'l' => Program_Args := Linker;

               when others =>
raise Program_Error;
--- 4085,4098 ----
         elsif (Argv (1) = Switch_Character or else Argv (1) = '-')
           and then (Argv (2 .. Argv'Last) = "cargs"
                      or else Argv (2 .. Argv'Last) = "bargs"
!                     or else Argv (2 .. Argv'Last) = "largs"
!                     or else Argv (2 .. Argv'Last) = "margs")
         then
            case Argv (2) is
               when 'c' => Program_Args := Compiler;
               when 'b' => Program_Args := Binder;
               when 'l' => Program_Args := Linker;
+             when 'm' => Program_Args := None;

               when others =>
raise Program_Error;
*************** package body Make is
*** 4458,4464 ****
         --  If not a switch it must be a file name

         else
-          File_Name_Seen := True;
            Set_Main_File_Name (Argv);
         end if;
      end Scan_Make_Arg;
--- 4451,4456 ----
Index: makeusg.adb
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ada/makeusg.adb,v
retrieving revision 1.2
diff -c -3 -p -r1.2 makeusg.adb
*** makeusg.adb	2001/12/05 21:25:25	1.2
--- makeusg.adb	2002/04/04 21:58:44
*************** begin
*** 49,59 ****
      Write_Str ("Usage: ");
      Osint.Write_Program_Name;
      Write_Str ("  opts  name  ");
!    Write_Str ("{[-cargs opts] [-bargs opts] [-largs opts]}");
      Write_Eol;
      Write_Eol;
!    Write_Str ("  name  is a file name from which you can omit the");
!    Write_Str (" .adb or .ads suffix");
      Write_Eol;
      Write_Eol;

--- 49,59 ----
      Write_Str ("Usage: ");
      Osint.Write_Program_Name;
      Write_Str ("  opts  name  ");
!    Write_Str ("{[-cargs opts] [-bargs opts] [-largs opts] [-margs 
opts]}");
      Write_Eol;
      Write_Eol;
!    Write_Str ("  name is one or more file name from which you");
!    Write_Str (" can omit the .adb or .ads suffix");
      Write_Eol;
      Write_Eol;

*************** begin
*** 280,285 ****
--- 280,291 ----

      Write_Switch_Char;
      Write_Str ("largs opts   opts are passed to the linker");
+    Write_Eol;
+
+    --  Line for -largs
+
+    Write_Switch_Char;
+    Write_Str ("margs opts   opts are passed to gnatmake");
      Write_Eol;

      --  Add usage information for gcc



More information about the Gcc-patches mailing list