summaryrefslogtreecommitdiff
path: root/gcc/ada/switch-c.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2010-06-17 07:42:04 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2010-06-17 07:42:04 +0000
commit16827112ee60f6b6601da6d2d8494025632df4f6 (patch)
tree24565076b0bd54cc2731f9f111de628d53b3aa07 /gcc/ada/switch-c.adb
parenta88034c0084be36cf49bbe9b0dbf29ed4eb6b56f (diff)
downloadgcc-16827112ee60f6b6601da6d2d8494025632df4f6.tar.gz
2010-06-17 Ed Schonberg <schonberg@adacore.com>
* sem_ch12.adb: propagate Pragma_Enabled flag to generic. * get_scos.adb: Set C2 flag in decision entry of pragma to 'e' (enabled) * par_sco.ads, par_sco.adb (Set_SCO_Pragma_Enabled): New procedure Remove use of Node field in SCOs table (Output_Header): Set 'd' to initially disable pragma entry * put_scos.adb (Put_SCOs): New flag indicating if pragma is enabled * scos.ads, scos.adb: Remove Node field from internal SCOs table. Use C2 field of pragma decision header to indicate enabled. * sem_prag.adb: Add calls to Set_SCO_Pragma_Enabled. * gcc-interface/Make-lang.in: Update dependencies. 2010-06-17 Vincent Celier <celier@adacore.com> * back_end.adb (Next_Arg): Moved to procedure Scan_Compiler_Arguments (Scan_Compiler_Arguments): Call Scan_Front_End_Switches with Next_Arg (Switch_Subsequently_Cancelled): Function moved to the body of Switch.C * back_end.ads (Scan_Front_End_Switches): Function moved to the body of Switch.C. * switch-c.adb: Copied a number of global declarations from back_end.adb (Len_Arg): New function copied from back_end.adb (Switch_Subsequently_Cancelled): New function moved from back_end.adb (Scan_Front_End_Switches): New parameter Arg_Rank used to call Switch_Subsequently_Cancelled. * switch-c.ads (Scan_Front_End_Switches): New parameter Arg_Rank. * gcc-interface/Makefile.in: Add line so that shared libgnat is linked with -lexc on Tru64. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@160878 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/switch-c.adb')
-rw-r--r--gcc/ada/switch-c.adb79
1 files changed, 76 insertions, 3 deletions
diff --git a/gcc/ada/switch-c.adb b/gcc/ada/switch-c.adb
index 8beaec8482f..1ad7c3c2f49 100644
--- a/gcc/ada/switch-c.adb
+++ b/gcc/ada/switch-c.adb
@@ -23,7 +23,6 @@
-- --
------------------------------------------------------------------------------
-with Back_End; use Back_End;
with Debug; use Debug;
with Lib; use Lib;
with Osint; use Osint;
@@ -39,14 +38,57 @@ with System.WCh_Con; use System.WCh_Con;
package body Switch.C is
+ type Arg_Array is array (Nat) of Big_String_Ptr;
+ type Arg_Array_Ptr is access Arg_Array;
+ -- Types to access compiler arguments
+
+ save_argc : Nat;
+ pragma Import (C, save_argc);
+ -- Saved value of argc (number of arguments), imported from toplev.c
+
+ save_argv : Arg_Array_Ptr;
+ pragma Import (C, save_argv);
+ -- Saved value of argv (argument pointers), imported from toplev.c
+
RTS_Specified : String_Access := null;
-- Used to detect multiple use of --RTS= flag
+ function Len_Arg (Arg : Pos) return Nat;
+ -- Determine length of argument number Arg on original gnat1 command line
+
+ function Switch_Subsequently_Cancelled
+ (C : String;
+ Arg_Rank : Pos)
+ 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
+ -- "-gnat-" & C, where C is the argument. If so, then True is returned,
+ -- and Scan_Front_End_Switches will cancel the effect of the switch. If
+ -- no such switch is found, False is returned.
+
+ -------------
+ -- Len_Arg --
+ -------------
+
+ function Len_Arg (Arg : Pos) return Nat is
+ begin
+ for J in 1 .. Nat'Last loop
+ if save_argv (Arg).all (Natural (J)) = ASCII.NUL then
+ return J - 1;
+ end if;
+ end loop;
+
+ raise Program_Error;
+ end Len_Arg;
+
-----------------------------
-- Scan_Front_End_Switches --
-----------------------------
- procedure Scan_Front_End_Switches (Switch_Chars : String) is
+ procedure Scan_Front_End_Switches
+ (Switch_Chars : String;
+ Arg_Rank : Pos)
+ is
First_Switch : Boolean := True;
-- False for all but first switch
@@ -665,7 +707,7 @@ package body Switch.C is
-- Skip processing if cancelled by subsequent -gnat-p
- if Switch_Subsequently_Cancelled ("p") then
+ if Switch_Subsequently_Cancelled ("p", Arg_Rank) then
Store_Switch := False;
else
@@ -1078,4 +1120,35 @@ package body Switch.C is
end if;
end Scan_Front_End_Switches;
+ -----------------------------------
+ -- Switch_Subsequently_Cancelled --
+ -----------------------------------
+
+ function Switch_Subsequently_Cancelled
+ (C : String;
+ Arg_Rank : Pos)
+ return Boolean
+ is
+ Arg : Pos;
+
+ begin
+ Arg := Arg_Rank + 1;
+ while Arg < save_argc 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
+ if Argv = "-gnat-" & C then
+ return True;
+ end if;
+ end;
+
+ Arg := Arg + 1;
+ end loop;
+
+ return False;
+ end Switch_Subsequently_Cancelled;
+
end Switch.C;