summaryrefslogtreecommitdiff
path: root/gcc/ada/switch-c.adb
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2011-08-25 19:29:43 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2011-08-25 19:29:43 +0000
commit46dfcc3ee85a4a02abce4d45ee619f240c116af6 (patch)
tree6c3dc3d53cd17d62447673b81abbcfc69bacd2f3 /gcc/ada/switch-c.adb
parent2a8624373adc103f943e22e781c2d6fadb828eae (diff)
downloadgcc-46dfcc3ee85a4a02abce4d45ee619f240c116af6.tar.gz
2011-08-25 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 178073 using svnmerge. 2011-08-25 Basile Starynkevitch <basile@starynkevitch.net> * gcc/melt-runtime.c (melt_linemap_compute_current_location): Use the linemap_position_for_column function for GCC 4.7 when merging with GCC trunk rev 178073. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@178087 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/switch-c.adb')
-rw-r--r--gcc/ada/switch-c.adb56
1 files changed, 47 insertions, 9 deletions
diff --git a/gcc/ada/switch-c.adb b/gcc/ada/switch-c.adb
index a4423dc3143..58d4e13e7ac 100644
--- a/gcc/ada/switch-c.adb
+++ b/gcc/ada/switch-c.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2010, Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2011, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -23,16 +23,19 @@
-- --
------------------------------------------------------------------------------
+-- 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 Ada.Unchecked_Deallocation;
with System.WCh_Con; use System.WCh_Con;
package body Switch.C is
@@ -40,9 +43,16 @@ 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
+
+ procedure Free is
+ new Ada.Unchecked_Deallocation (String_List, String_List_Access);
+ -- Avoid using System.Strings.Free, which also frees the designated strings
+
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 +60,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;
@@ -1022,6 +1058,10 @@ package body Switch.C is
Osint.Fail
("-gnatZ is no longer supported: consider using --RTS=zcx");
+ -- Note on language version switches: whenever a new language
+ -- version switch is added, Switch.M.Normalize_Compiler_Switches
+ -- must be updated.
+
-- Processing for 83 switch
when '8' =>
@@ -1157,11 +1197,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