aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ada/ChangeLog13
-rw-r--r--gcc/ada/gnat1drv.adb2
-rw-r--r--gcc/ada/opt.ads19
-rwxr-xr-xgcc/ada/set_targ.adb67
-rw-r--r--gcc/ada/switch-c.adb35
-rw-r--r--gcc/ada/usage.adb8
6 files changed, 97 insertions, 47 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 49f89b6..e71c877 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,16 @@
+2013-04-12 Robert Dewar <dewar@adacore.com>
+
+ * gnat1drv.adb (Gnat1drv): Test Target_Dependent_Info_Write_Name.
+ * opt.ads (Target_Dependent_Info_Read): Add _Name, now an access
+ type (Target_Dependent_Info_Write): Add _Name, now an access type.
+ * set_targ.adb (Write_Target_Dependent_Values): Use name
+ from -gnatet switch stored in Target_Dependent_Info_Write_Name
+ (Read_Target_Dependent_Values): Use name from -gnateT switch
+ stored in Target_Dependent_Info_Read_Name.
+ * switch-c.adb: New form of -gnatet and -gnateT switches.
+ * usage.adb: New form of -gnatet and -gnateT switches with
+ file name.
+
2013-04-11 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/decl.c (elaborate_expression_1): Skip only constant
diff --git a/gcc/ada/gnat1drv.adb b/gcc/ada/gnat1drv.adb
index 4bfe7a6..47337aa07 100644
--- a/gcc/ada/gnat1drv.adb
+++ b/gcc/ada/gnat1drv.adb
@@ -881,7 +881,7 @@ begin
-- Generate target dependent output file if requested
- if Target_Dependent_Info_Write then
+ if Target_Dependent_Info_Write_Name /= null then
Set_Targ.Write_Target_Dependent_Values;
end if;
diff --git a/gcc/ada/opt.ads b/gcc/ada/opt.ads
index 330c8bf..68429a8 100644
--- a/gcc/ada/opt.ads
+++ b/gcc/ada/opt.ads
@@ -1331,18 +1331,19 @@ package Opt is
-- types and dispatching calls, assuming the underlying target supports
-- it (e.g. in the JVM case).
- Target_Dependent_Info_Read : Boolean := False;
+ Target_Dependent_Info_Read_Name : String_Ptr := null;
-- GNAT
- -- Set True to override the normal processing in Get_Targ and set the
- -- necessary information by reading the target dependent information
- -- file (see packages Get_Targ and Set_Targ for full details). Set True
- -- by use of the -gnateT switch.
+ -- Set non-null to override the normal processing in Get_Targ and set the
+ -- necessary information by reading the target dependent information file
+ -- whose name is given here (see packages Get_Targ and Set_Targ for full
+ -- details). Set to non-null file name by use of the -gnateT switch.
- Target_Dependent_Info_Write : Boolean := False;
+ Target_Dependent_Info_Write_Name : String_Ptr := null;
-- GNAT
- -- Set True to enable a call to Set_Targ.Write_Target_Dependent_Info which
- -- writes a target independent information file (see packages Get_Targ and
- -- Set_Targ for full details). Set True by use of the -gnatet switch.
+ -- Set non-null to enable a call to Set_Targ.Write_Target_Dependent_Info
+ -- which writes a target independent information file (see packages
+ -- Get_Targ and Set_Targ for full details) using the name given by
+ -- this switch. Set to non-null file name by use of the -gnatet switch.
Task_Dispatching_Policy : Character := ' ';
-- GNAT, GNATBIND
diff --git a/gcc/ada/set_targ.adb b/gcc/ada/set_targ.adb
index 4b0c75c4..6699b418 100755
--- a/gcc/ada/set_targ.adb
+++ b/gcc/ada/set_targ.adb
@@ -35,12 +35,9 @@ with Unchecked_Conversion;
package body Set_Targ is
- ---------------------------------------------
- -- Data Used to Read/Write target.atp File --
- ---------------------------------------------
-
- File_Name : aliased constant String := "target.atp";
- -- Name of file to read/write
+ --------------------------------------------------------
+ -- Data Used to Read/Write Target Dependent Info File --
+ --------------------------------------------------------
-- Table of string names written to file
@@ -369,8 +366,9 @@ package body Set_Targ is
AddC (ASCII.LF);
if Buflen /= Write (Fdesc, Buffer'Address, Buflen) then
- Delete_File (File_Name'Address, OK);
- Fail ("disk full writing target.atp");
+ Delete_File (Target_Dependent_Info_Write_Name'Address, OK);
+ Fail ("disk full writing file "
+ & Target_Dependent_Info_Write_Name.all);
end if;
Buflen := 0;
@@ -379,10 +377,11 @@ package body Set_Targ is
-- Start of processing for Write_Target_Dependent_Values
begin
- Fdesc := Create_File (File_Name'Address, Text);
+ Fdesc :=
+ Create_File (Target_Dependent_Info_Write_Name.all'Address, Text);
if Fdesc = Invalid_FD then
- Fail ("cannot create target.atp");
+ Fail ("cannot create file " & Target_Dependent_Info_Write_Name.all);
end if;
-- Loop through values
@@ -459,7 +458,8 @@ package body Set_Targ is
Close (Fdesc, OK);
if not OK then
- Fail ("disk full writing target.atp");
+ Fail ("disk full writing file "
+ & Target_Dependent_Info_Write_Name.all);
end if;
end Write_Target_Dependent_Values;
@@ -471,7 +471,7 @@ begin
-- First step: see if the -gnateT switch is present. As we have noted,
-- this has to be done very early, so can not depend on the normal circuit
-- for reading switches and setting switches in Opt. The following code
- -- will set Opt.Target_Dependent_Info_Read if an option starting -gnateT
+ -- will set Opt.Target_Dependent_Info_Read_Name if the switch -gnateT=name
-- is present in the options string.
declare
@@ -513,11 +513,14 @@ begin
declare
Argv_Ptr : constant Big_String_Ptr := save_argv (Arg);
Argv_Len : constant Nat := Len_Arg (Arg);
+
begin
- if Argv_Len = 7
- and then Argv_Ptr (1 .. 7) = "-gnateT"
+ if Argv_Len > 8
+ and then Argv_Ptr (1 .. 8) = "-gnateT="
then
- Opt.Target_Dependent_Info_Read := True;
+ Opt.Target_Dependent_Info_Read_Name :=
+ new String'(Argv_Ptr (9 .. Natural (Argv_Len)));
+
elsif Argv_Len >= 8
and then Argv_Ptr (1 .. 8) = "-gnatd.b"
then
@@ -529,7 +532,7 @@ begin
-- If the switch is not set, we get all values from the back end
- if not Opt.Target_Dependent_Info_Read then
+ if Opt.Target_Dependent_Info_Read_Name = null then
-- Set values by direct calls to the back end
@@ -560,7 +563,7 @@ begin
Register_Back_End_Types (Register_Float_Type'Access);
- -- Case of reading the target dependent values from target.atp
+ -- Case of reading the target dependent values from file
-- This is bit more complex than might be expected, because it has to be
-- done very early. All kinds of packages depend on these values, and we
@@ -569,7 +572,7 @@ begin
-- too early to be using Osint directly.
else
- Read_File : declare
+ Read_Target_Dependent_Values : declare
File_Desc : File_Descriptor;
N : Natural;
@@ -592,9 +595,9 @@ begin
-- Checks that we have one or more spaces and skips them
procedure FailN (S : String);
- -- Calls Fail prefixing "target.atp: " to the start of the given
- -- string, and " name" to the end where name is the currently
- -- gathered name in Nam_Buf, surrounded by quotes.
+ -- Calls Fail adding " name in file xxx", where name is the currently
+ -- gathered name in Nam_Buf, surrounded by quotes, and xxx is the
+ -- name of the file.
procedure Get_Name;
-- Scan out name, leaving it in Nam_Buf with Nam_Len set. Calls
@@ -628,7 +631,8 @@ begin
procedure FailN (S : String) is
begin
- Fail ("target.atp: " & S & " """ & Nam_Buf (1 .. Nam_Len) & '"');
+ Fail (S & " """ & Nam_Buf (1 .. Nam_Len) & """ in file "
+ & Target_Dependent_Info_Read_Name.all);
end FailN;
--------------
@@ -700,19 +704,19 @@ begin
end loop;
end Skip_Spaces;
- -- Start of processing for Read_File
+ -- Start of processing for Read_Target_Dependent_Values
begin
- File_Desc := Open_Read ("target.atp", Text);
+ File_Desc := Open_Read (Target_Dependent_Info_Read_Name.all, Text);
if File_Desc = Invalid_FD then
- Fail ("cannot read target.atp file");
+ Fail ("cannot read file " & Target_Dependent_Info_Read_Name.all);
end if;
Buflen := Read (File_Desc, Buffer'Address, Buffer'Length);
if Buflen = Buffer'Length then
- Fail ("target.atp file is too long");
+ Fail ("file is too long: " & Target_Dependent_Info_Read_Name.all);
end if;
-- Scan through file for properly formatted entries in first section
@@ -753,20 +757,23 @@ begin
for J in DTR'Range loop
if not DTR (J) then
- Fail ("missing entry in target.atp for " & DTN (J).all);
+ Fail ("missing entry for " & DTN (J).all & " in file "
+ & Target_Dependent_Info_Read_Name.all);
end if;
end loop;
-- Now acquire FPT entries
if N >= Buflen then
- Fail ("target.atp is missing entries for FPT modes");
+ Fail ("missing entries for FPT modes in file "
+ & Target_Dependent_Info_Read_Name.all);
end if;
if Buffer (N) = ASCII.LF then
N := N + 1;
else
- Fail ("target.atp is missing blank line");
+ Fail ("missing blank line in file "
+ & Target_Dependent_Info_Read_Name.all);
end if;
Num_FPT_Modes := 0;
@@ -810,6 +817,6 @@ begin
N := N + 1;
end;
end loop;
- end Read_File;
+ end Read_Target_Dependent_Values;
end if;
end Set_Targ;
diff --git a/gcc/ada/switch-c.adb b/gcc/ada/switch-c.adb
index 4ebecc9..9102507 100644
--- a/gcc/ada/switch-c.adb
+++ b/gcc/ada/switch-c.adb
@@ -597,7 +597,6 @@ package body Switch.C is
if Ptr >= Max or else Switch_Chars (Ptr) /= '=' then
Bad_Switch ("-gnateO");
-
else
Object_Path_File_Name :=
new String'(Switch_Chars (Ptr + 1 .. Max));
@@ -651,9 +650,25 @@ package body Switch.C is
-- -gnatet (write target dependent information)
when 't' =>
- Target_Dependent_Info_Write := True;
+ if not First_Switch then
+ Osint.Fail
+ ("-gnatet must be first if combined with "
+ & "other switches");
+ end if;
+
+ -- Check for '='
+
Ptr := Ptr + 1;
+ if Ptr >= Max or else Switch_Chars (Ptr) /= '=' then
+ Bad_Switch ("-gnatet");
+ else
+ Target_Dependent_Info_Write_Name :=
+ new String'(Switch_Chars (Ptr + 1 .. Max));
+ end if;
+
+ return;
+
-- -gnateT (read target dependent information)
when 'T' =>
@@ -663,9 +678,23 @@ package body Switch.C is
& "other switches");
end if;
- Target_Dependent_Info_Read := True;
+ -- Check for '='
+
Ptr := Ptr + 1;
+ if Ptr >= Max or else Switch_Chars (Ptr) /= '=' then
+ Bad_Switch ("-gnateT");
+ else
+ -- This parameter was stored by Set_Targ earlier
+
+ pragma Assert
+ (Target_Dependent_Info_Read_Name.all =
+ Switch_Chars (Ptr + 1 .. Max));
+ null;
+ end if;
+
+ return;
+
-- -gnateV (validity checks on parameters)
when 'V' =>
diff --git a/gcc/ada/usage.adb b/gcc/ada/usage.adb
index 7df00c9..dd0f2af 100644
--- a/gcc/ada/usage.adb
+++ b/gcc/ada/usage.adb
@@ -243,13 +243,13 @@ begin
-- Line for -gnatet switch
- Write_Switch_Char ("et");
- Write_Line ("Write target dependent information file");
+ Write_Switch_Char ("et=?");
+ Write_Line ("Write target dependent information file ?, e.g. gnatet=tdf");
-- Line for -gnateT switch
- Write_Switch_Char ("eT");
- Write_Line ("Read target dependent information file");
+ Write_Switch_Char ("eT=?");
+ Write_Line ("Read target dependent information file ?, e.g. gnateT=tdf");
-- Line for -gnateV switch