diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-06-17 09:06:41 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-06-17 09:06:41 +0000 |
commit | a050681322cb0bb78bfc0900406c132ede630f81 (patch) | |
tree | 25c725c1b73e3d2b69447a18fb45899560dec4d2 /gcc | |
parent | d3ef794cfe8397e3339bdefa952bb32e9874d22c (diff) | |
download | gcc-a050681322cb0bb78bfc0900406c132ede630f81.tar.gz |
2010-06-17 Vincent Celier <celier@adacore.com>
* back_end.adb (Scan_Compiler_Arguments): Put all arguments in new
local Argument_List variable Args.
* switch-c.adb (Scan_Front_End_Switches): New Argument_List argument
Args.
(Switch_Subsequently_Cancelled): New Argument_List argument Args. Look
for subsequent switches in Args.
* switch-c.ads (Scan_Front_End_Switches): New Argument_List argument
Args.
* gcc-interface/Make-lang.in: Update dependencies.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@160890 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/ChangeLog | 12 | ||||
-rw-r--r-- | gcc/ada/back_end.adb | 32 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/Make-lang.in | 77 | ||||
-rw-r--r-- | gcc/ada/switch-c.adb | 28 | ||||
-rw-r--r-- | gcc/ada/switch-c.ads | 9 |
5 files changed, 88 insertions, 70 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 2a2e2986031..339925d656d 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,15 @@ +2010-06-17 Vincent Celier <celier@adacore.com> + + * back_end.adb (Scan_Compiler_Arguments): Put all arguments in new + local Argument_List variable Args. + * switch-c.adb (Scan_Front_End_Switches): New Argument_List argument + Args. + (Switch_Subsequently_Cancelled): New Argument_List argument Args. Look + for subsequent switches in Args. + * switch-c.ads (Scan_Front_End_Switches): New Argument_List argument + Args. + * gcc-interface/Make-lang.in: Update dependencies. + 2010-06-17 Robert Dewar <dewar@adacore.com> * einfo.adb: Minor code fix, allow E_Class_Wide_Type for diff --git a/gcc/ada/back_end.adb b/gcc/ada/back_end.adb index 28ce1bd6c7e..41372fc33f3 100644 --- a/gcc/ada/back_end.adb +++ b/gcc/ada/back_end.adb @@ -40,6 +40,8 @@ with Switch.C; use Switch.C; with System; use System; with Types; use Types; +with System.OS_Lib; use System.OS_Lib; + package body Back_End is type Arg_Array is array (Nat) of Big_String_Ptr; @@ -162,7 +164,7 @@ package body Back_End is procedure Scan_Compiler_Arguments is - Next_Arg : Pos; + Next_Arg : Positive; -- Next argument to be scanned Output_File_Name_Seen : Boolean := False; @@ -222,6 +224,11 @@ package body Back_End is end if; end Scan_Back_End_Switches; + -- Local variables + + Arg_Count : constant Natural := Natural (save_argc - 1); + Args : Argument_List (1 .. Arg_Count); + -- Start of processing for Scan_Compiler_Arguments begin @@ -229,15 +236,26 @@ package body Back_End is Opt.Stack_Checking_Enabled := (flag_stack_check /= 0); + -- Put the arguments in Args + + for Arg in Pos range 1 .. save_argc - 1 loop + declare + Argv_Ptr : constant Big_String_Ptr := save_argv (Arg); + Argv_Len : constant Nat := Len_Arg (Arg); + Argv : constant String := + Argv_Ptr (1 .. Natural (Argv_Len)); + + begin + Args (Positive (Arg)) := new String'(Argv); + end; + end loop; + -- Loop through command line arguments, storing them for later access Next_Arg := 1; - while Next_Arg < save_argc loop + while Next_Arg < Args'Last loop Look_At_Arg : declare - Argv_Ptr : constant Big_String_Ptr := save_argv (Next_Arg); - Argv_Len : constant Nat := Len_Arg (Next_Arg); - Argv : constant String := - Argv_Ptr (1 .. Natural (Argv_Len)); + Argv : constant String := Args (Next_Arg).all; begin -- If the previous switch has set the Output_File_Name_Present @@ -284,7 +302,7 @@ package body Back_End is Opt.No_Stdlib := True; elsif Is_Front_End_Switch (Argv) then - Scan_Front_End_Switches (Argv, Integer (Next_Arg)); + Scan_Front_End_Switches (Argv, Args, Next_Arg); -- All non-front-end switches are back-end switches diff --git a/gcc/ada/gcc-interface/Make-lang.in b/gcc/ada/gcc-interface/Make-lang.in index 881213f0a1a..6103dd8a74b 100644 --- a/gcc/ada/gcc-interface/Make-lang.in +++ b/gcc/ada/gcc-interface/Make-lang.in @@ -120,7 +120,6 @@ GNAT1_C_OBJS = ada/b_gnat1.o ada/adadecode.o ada/adaint.o ada/cstreams.o \ GNAT_ADA_OBJS = \ ada/a-charac.o \ ada/a-chlat1.o \ - ada/a-comlin.o \ ada/a-elchha.o \ ada/a-except.o \ ada/a-ioexce.o \ @@ -2913,16 +2912,10 @@ ada/prepcomp.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/table.adb ada/tree_io.ads ada/types.ads ada/uintp.ads \ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads -ada/put_scos.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ - ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/debug.ads \ - ada/einfo.ads ada/gnat.ads ada/g-table.ads ada/g-table.adb \ - ada/hostparm.ads ada/namet.ads ada/opt.ads ada/output.ads \ - ada/put_scos.ads ada/put_scos.adb ada/scos.ads ada/sinfo.ads \ - ada/snames.ads ada/system.ads ada/s-exctab.ads ada/s-memory.ads \ - ada/s-os_lib.ads ada/s-parame.ads ada/s-stalib.ads ada/s-string.ads \ - ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \ - ada/table.adb ada/tree_io.ads ada/types.ads ada/uintp.ads \ - ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads +ada/put_scos.o : ada/ada.ads ada/a-unccon.ads ada/gnat.ads ada/g-table.ads \ + ada/g-table.adb ada/put_scos.ads ada/put_scos.adb ada/scos.ads \ + ada/system.ads ada/s-exctab.ads ada/s-memory.ads ada/s-stalib.ads \ + ada/s-unstyp.ads ada/types.ads ada/unchconv.ads ada/unchdeal.ads ada/repinfo.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \ @@ -3851,30 +3844,30 @@ ada/sem_prag.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/lib.ads ada/lib.adb ada/lib-list.adb ada/lib-sort.adb \ ada/lib-writ.ads ada/lib-xref.ads ada/namet.ads ada/namet.adb \ ada/namet-sp.ads ada/nlists.ads ada/nlists.adb ada/nmake.ads \ - ada/nmake.adb ada/opt.ads ada/output.ads ada/restrict.ads \ - ada/restrict.adb ada/rident.ads ada/rtsfind.ads ada/scans.ads \ - ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads ada/sem_aggr.ads \ - ada/sem_attr.ads ada/sem_aux.ads ada/sem_cat.ads ada/sem_ch12.ads \ - ada/sem_ch13.ads ada/sem_ch3.ads ada/sem_ch4.ads ada/sem_ch6.ads \ - ada/sem_ch8.ads ada/sem_disp.ads ada/sem_dist.ads ada/sem_elab.ads \ - ada/sem_elim.ads ada/sem_eval.ads ada/sem_eval.adb ada/sem_intr.ads \ - ada/sem_mech.ads ada/sem_prag.ads ada/sem_prag.adb ada/sem_res.ads \ - ada/sem_res.adb ada/sem_scil.ads ada/sem_type.ads ada/sem_util.ads \ - ada/sem_util.adb ada/sem_vfpt.ads ada/sem_warn.ads ada/sinfo.ads \ - ada/sinfo.adb ada/sinfo-cn.ads ada/sinput.ads ada/sinput.adb \ - ada/snames.ads ada/snames.adb ada/stand.ads ada/stringt.ads \ - ada/stringt.adb ada/style.ads ada/styleg.ads ada/styleg.adb \ - ada/stylesw.ads ada/system.ads ada/s-carun8.ads ada/s-crc32.ads \ - ada/s-exctab.ads ada/s-exctab.adb ada/s-htable.ads ada/s-imenne.ads \ - ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.ads \ - ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \ - ada/s-stoele.ads ada/s-stoele.adb ada/s-string.ads ada/s-traent.ads \ - ada/s-unstyp.ads ada/s-utf_32.ads ada/s-wchcon.ads ada/table.ads \ - ada/table.adb ada/targparm.ads ada/tbuild.ads ada/tbuild.adb \ - ada/tree_io.ads ada/ttypes.ads ada/types.ads ada/types.adb \ - ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \ - ada/unchdeal.ads ada/urealp.ads ada/urealp.adb ada/validsw.ads \ - ada/widechar.ads + ada/nmake.adb ada/opt.ads ada/output.ads ada/par_sco.ads \ + ada/restrict.ads ada/restrict.adb ada/rident.ads ada/rtsfind.ads \ + ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads \ + ada/sem_aggr.ads ada/sem_attr.ads ada/sem_aux.ads ada/sem_cat.ads \ + ada/sem_ch12.ads ada/sem_ch13.ads ada/sem_ch3.ads ada/sem_ch4.ads \ + ada/sem_ch6.ads ada/sem_ch8.ads ada/sem_disp.ads ada/sem_dist.ads \ + ada/sem_elab.ads ada/sem_elim.ads ada/sem_eval.ads ada/sem_eval.adb \ + ada/sem_intr.ads ada/sem_mech.ads ada/sem_prag.ads ada/sem_prag.adb \ + ada/sem_res.ads ada/sem_res.adb ada/sem_scil.ads ada/sem_type.ads \ + ada/sem_util.ads ada/sem_util.adb ada/sem_vfpt.ads ada/sem_warn.ads \ + ada/sinfo.ads ada/sinfo.adb ada/sinfo-cn.ads ada/sinput.ads \ + ada/sinput.adb ada/snames.ads ada/snames.adb ada/stand.ads \ + ada/stringt.ads ada/stringt.adb ada/style.ads ada/styleg.ads \ + ada/styleg.adb ada/stylesw.ads ada/system.ads ada/s-carun8.ads \ + ada/s-crc32.ads ada/s-exctab.ads ada/s-exctab.adb ada/s-htable.ads \ + ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads \ + ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \ + ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-string.ads \ + ada/s-traent.ads ada/s-unstyp.ads ada/s-utf_32.ads ada/s-wchcon.ads \ + ada/table.ads ada/table.adb ada/targparm.ads ada/tbuild.ads \ + ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads ada/types.ads \ + ada/types.adb ada/uintp.ads ada/uintp.adb ada/uname.ads \ + ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/urealp.adb \ + ada/validsw.ads ada/widechar.ads ada/sem_res.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \ @@ -4200,17 +4193,17 @@ ada/switch-b.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \ ada/types.ads ada/unchconv.ads ada/unchdeal.ads -ada/switch-c.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ - ada/a-uncdea.ads ada/alloc.ads ada/back_end.ads ada/debug.ads \ +ada/switch-c.o : ada/ada.ads ada/a-comlin.ads ada/a-except.ads \ + ada/a-unccon.ads ada/a-uncdea.ads ada/alloc.ads ada/debug.ads \ ada/gnatvsn.ads ada/hostparm.ads ada/lib.ads ada/namet.ads ada/opt.ads \ ada/osint.ads ada/output.ads ada/prepcomp.ads ada/sem_warn.ads \ ada/stylesw.ads ada/switch.ads ada/switch-c.ads ada/switch-c.adb \ ada/system.ads ada/s-exctab.ads ada/s-memory.ads ada/s-os_lib.ads \ - ada/s-parame.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \ - ada/s-stoele.ads ada/s-stoele.adb ada/s-string.ads ada/s-traent.ads \ - ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \ - ada/tree_io.ads ada/types.ads ada/unchconv.ads ada/unchdeal.ads \ - ada/validsw.ads + ada/s-parame.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \ + ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-string.ads \ + ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \ + ada/table.adb ada/tree_io.ads ada/types.ads ada/unchconv.ads \ + ada/unchdeal.ads ada/validsw.ads ada/switch.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \ ada/a-uncdea.ads ada/alloc.ads ada/debug.ads ada/gnatvsn.ads \ diff --git a/gcc/ada/switch-c.adb b/gcc/ada/switch-c.adb index 39bda75af2a..09a87e040b2 100644 --- a/gcc/ada/switch-c.adb +++ b/gcc/ada/switch-c.adb @@ -32,9 +32,7 @@ with Validsw; use Validsw; with Sem_Warn; use Sem_Warn; with Stylesw; use Stylesw; -with Ada.Command_Line; use Ada.Command_Line; - -with System.OS_Lib; use System.OS_Lib; +with System.Strings; with System.WCh_Con; use System.WCh_Con; package body Switch.C is @@ -44,6 +42,7 @@ package body Switch.C is function Switch_Subsequently_Cancelled (C : String; + Args : Argument_List; Arg_Rank : Positive) return Boolean; -- This function is called from Scan_Front_End_Switches. It determines if -- the switch currently being scanned is followed by a switch of the form @@ -57,6 +56,7 @@ package body Switch.C is procedure Scan_Front_End_Switches (Switch_Chars : String; + Args : Argument_List; Arg_Rank : Positive) is First_Switch : Boolean := True; @@ -677,7 +677,7 @@ package body Switch.C is -- Skip processing if cancelled by subsequent -gnat-p - if Switch_Subsequently_Cancelled ("p", Arg_Rank) then + if Switch_Subsequently_Cancelled ("p", Args, Arg_Rank) then Store_Switch := False; else @@ -1096,25 +1096,17 @@ package body Switch.C is function Switch_Subsequently_Cancelled (C : String; + Args : Argument_List; Arg_Rank : Positive) return Boolean is - Arg : Positive; - Max : constant Natural := Argument_Count; - + use type System.Strings.String_Access; begin -- Loop through arguments following the current one - Arg := Arg_Rank + 1; - while Arg < Max loop - declare - Argv : constant String := Argument (Arg); - begin - if Argv = "-gnat-" & C then - return True; - end if; - end; - - Arg := Arg + 1; + for Arg in Arg_Rank + 1 .. Args'Last loop + if Args (Arg).all = "-gnat-" & C then + return True; + end if; end loop; -- No match found, not cancelled diff --git a/gcc/ada/switch-c.ads b/gcc/ada/switch-c.ads index db7ffc3ddf4..1595858a28d 100644 --- a/gcc/ada/switch-c.ads +++ b/gcc/ada/switch-c.ads @@ -29,10 +29,13 @@ -- switches that are recognized. In addition, package Debug documents -- the otherwise undocumented debug switches that are also recognized. +with System.OS_Lib; use System.OS_Lib; + package Switch.C is procedure Scan_Front_End_Switches (Switch_Chars : String; + Args : Argument_List; Arg_Rank : Positive); -- Procedures to scan out front end switches stored in the given string. -- The first character is known to be a valid switch character, and there @@ -42,8 +45,8 @@ package Switch.C is -- a fatal error exit and control does not return. The call also sets -- Usage_Requested to True if a switch -gnath is encountered. -- - -- Arg_Rank is the position of the switch in the command line arguments. - -- It is used for certain switches -gnatx to check if a subsequent switch - -- -gnat-x cancels the switch -gnatx. + -- Args is the full list of command line arguments. Arg_Rank is the + -- position of the switch in Args. It is used for certain switches -gnatx + -- to check if a subsequent switch -gnat-x cancels the switch -gnatx. end Switch.C; |