aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/switch-c.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2011-08-02 14:48:37 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2011-08-02 14:48:37 +0200
commit499769ec33c515c433e407ee25729018457ed295 (patch)
treec6e6b59ced72e2b75ef882519a53e462c94ac52b /gcc/ada/switch-c.adb
parentaa1e353a7a34599e90bf9b62b3a463914e242a6c (diff)
downloadgcc-499769ec33c515c433e407ee25729018457ed295.zip
gcc-499769ec33c515c433e407ee25729018457ed295.tar.gz
gcc-499769ec33c515c433e407ee25729018457ed295.tar.bz2
[multiple changes]
2011-08-02 Javier Miranda <miranda@adacore.com> * sem_ch3.adb (Check_Anonymous_Access_Components): Create extra formals associated with anonymous access to subprograms. 2011-08-02 Geert Bosch <bosch@adacore.com> * opt.ads (Preprocessing_Symbol_Defs): Move from Prepcomp.Symbol_Definitions. (Preprocessing_Symbol_Last): Move from Prepcomp.Last_Definition. * prepcomp.adb (Symbol_Definitions, Last_Definition): Move to opt.ads (Add_Symbol_Definition): Move to switch-c.adb (Process_Command_Line_Symbol_Definitions): Adjust references to above. * prepcomp.ads: Remove dependency on Ada.Unchecked_Deallocation. (Add_Symbol_Definition): Move to switch-c.adb. * sem_ch13.adb, sem_prag.adb: Add dependency on Warnsw. * sem_warn.adb (Set_Dot_Warning_Switch, Set_GNAT_Mode_Warnings, Set_Warning_Switch): Move to warnsw.adb. * sem_warn.ads (Warn_On_Record_Holes, Warn_On_Overridden_Size, Set_Dot_Warning_Switch, Set_GNAT_Mode_Warnings, Set_Warning_Switch): Move to warnsw.adb. * switch-c.adb: Replace dependency on Prepcomp and Sem_Warn by Warnsw. (Add_Symbol_Definition): Moved from Prepcomp. * switch-c.ads: Update copyright notice. Use String_List instead of Argument_List, removing dependency on System.OS_Lib. From-SVN: r177140
Diffstat (limited to 'gcc/ada/switch-c.adb')
-rw-r--r--gcc/ada/switch-c.adb45
1 files changed, 37 insertions, 8 deletions
diff --git a/gcc/ada/switch-c.adb b/gcc/ada/switch-c.adb
index a4423dc..bda476b 100644
--- a/gcc/ada/switch-c.adb
+++ b/gcc/ada/switch-c.adb
@@ -23,16 +23,18 @@
-- --
------------------------------------------------------------------------------
+-- This package is for switch processing and should not depend on higher level
+-- packages such as those for the scanner, parser, etc. Doing so may cause
+-- circularities, especially for back ends using Adabkend.
+
with Debug; use Debug;
with Lib; use Lib;
with Osint; use Osint;
with Opt; use Opt;
-with Prepcomp; use Prepcomp;
with Validsw; use Validsw;
-with Sem_Warn; use Sem_Warn;
with Stylesw; use Stylesw;
+with Warnsw; use Warnsw;
-with System.Strings;
with System.WCh_Con; use System.WCh_Con;
package body Switch.C is
@@ -40,9 +42,12 @@ package body Switch.C is
RTS_Specified : String_Access := null;
-- Used to detect multiple use of --RTS= flag
+ procedure Add_Symbol_Definition (Def : String);
+ -- Add a symbol definition from the command line
+
function Switch_Subsequently_Cancelled
(C : String;
- Args : Argument_List;
+ Args : String_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
@@ -50,13 +55,39 @@ package body Switch.C is
-- and Scan_Front_End_Switches will cancel the effect of the switch. If
-- no such switch is found, False is returned.
+ ---------------------------
+ -- Add_Symbol_Definition --
+ ---------------------------
+
+ procedure Add_Symbol_Definition (Def : String) is
+ begin
+ -- If Preprocessor_Symbol_Defs is not large enough, double its size
+
+ if Preprocessing_Symbol_Last = Preprocessing_Symbol_Defs'Last then
+ declare
+ New_Symbol_Definitions : constant String_List_Access :=
+ new String_List (1 .. 2 * Preprocessing_Symbol_Last);
+
+ begin
+ New_Symbol_Definitions (Preprocessing_Symbol_Defs'Range) :=
+ Preprocessing_Symbol_Defs.all;
+ Free (Preprocessing_Symbol_Defs);
+ Preprocessing_Symbol_Defs := New_Symbol_Definitions;
+ end;
+ end if;
+
+ Preprocessing_Symbol_Last := Preprocessing_Symbol_Last + 1;
+ Preprocessing_Symbol_Defs (Preprocessing_Symbol_Last)
+ := new String'(Def);
+ end Add_Symbol_Definition;
+
-----------------------------
-- Scan_Front_End_Switches --
-----------------------------
procedure Scan_Front_End_Switches
(Switch_Chars : String;
- Args : Argument_List;
+ Args : String_List;
Arg_Rank : Positive)
is
First_Switch : Boolean := True;
@@ -1157,11 +1188,9 @@ package body Switch.C is
function Switch_Subsequently_Cancelled
(C : String;
- Args : Argument_List;
+ Args : String_List;
Arg_Rank : Positive) return Boolean
is
- use type System.Strings.String_Access;
-
begin
-- Loop through arguments following the current one