summaryrefslogtreecommitdiff
path: root/gcc/ada/prj-conf.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2011-08-04 15:44:22 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2011-08-04 15:44:22 +0000
commit99f85277b1dcab90426b14f39a0b9a8c24f1bbe2 (patch)
tree537a6ead5cdb714a61faecd070db42dccac0e0d7 /gcc/ada/prj-conf.adb
parent0e05fc43c31f4cceebae03e8a2bf80abe6655ff1 (diff)
downloadgcc-99f85277b1dcab90426b14f39a0b9a8c24f1bbe2.tar.gz
2011-08-04 Ed Schonberg <schonberg@adacore.com>
* sem_util.ads, sem_unit.adb (Type_Without_Stream_Operation): determine whether a type lacks user-defined Read or Write operations, or has a component that lacks them. * sem_attr.adb (Check_Stream_Attribute): if restriction No_Default_Stream_Attributes is active, verify that all subcomponent types of the target have user-defined stream operations, and report error otherwise. * exp_ch3.adb (Stream_Operqtion_OK): use Type_Without_Stream_Operation. * exp_strm.adb: Build_Elementary_Input_Call, Build_Elementary_Write_Call): remove checks for restriction No_Default_Stream_Attributes, now checked in semantics. 2011-08-04 Vincent Celier <celier@adacore.com> * prj-conf.ads, prj-conf.adb (Do_Autoconf): If there is no --RTS switches on the command line, look for all valid --RTS switches in the Builder switches and for each language use the first runtime name found to invoke gprconfig. (Get_Or_Create_Configuration_File): Warn if --RTS is specified on the command line and there is no auto-configuration. (Runtime_Name_Set_For): New function. 2011-08-04 Hristian Kirtchev <kirtchev@adacore.com> * exp_ch7.adb (Build_Object_Declarations): Do not generate the elaborate initialization expression for variable Abort when processing a package body or a declaration. (Create_Finalizer): Propagate the package context when creating the exception-related variables. * exp_ch7.ads (Build_Object_Declarations): New formal parameter For_Package along with usage comment. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@177407 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/prj-conf.adb')
-rw-r--r--gcc/ada/prj-conf.adb133
1 files changed, 125 insertions, 8 deletions
diff --git a/gcc/ada/prj-conf.adb b/gcc/ada/prj-conf.adb
index 1e0e87eab7d..2df66930277 100644
--- a/gcc/ada/prj-conf.adb
+++ b/gcc/ada/prj-conf.adb
@@ -921,10 +921,10 @@ package body Prj.Conf is
end loop;
declare
- Obj_Dir : constant String := Name_Buffer (1 .. Name_Len);
- Switches : Argument_List_Access := Get_Config_Switches;
- Args : Argument_List (1 .. 5);
- Arg_Last : Positive;
+ Obj_Dir : constant String := Name_Buffer (1 .. Name_Len);
+ Config_Switches : Argument_List_Access;
+ Args : Argument_List (1 .. 5);
+ Arg_Last : Positive;
Obj_Dir_Exists : Boolean := True;
@@ -968,6 +968,104 @@ package body Prj.Conf is
end case;
end if;
+ -- If no switch --RTS have been specified on the command line,
+ -- look for --RTS switches in the Builder switches.
+
+ if RTS_Languages.Get_First = No_Name then
+ declare
+ Builder : constant Package_Id :=
+ Value_Of (Name_Builder, Project.Decl.Packages, Shared);
+ Switch_Array_Id : Array_Element_Id;
+ Switch_Array : Array_Element;
+
+ Switch_List : String_List_Id := Nil_String;
+ Switch : String_Element;
+
+ Lang : Name_Id;
+ Lang_Last : Positive;
+
+ begin
+ if Builder /= No_Package then
+ Switch_Array_Id :=
+ Value_Of
+ (Name => Name_Switches,
+ In_Arrays =>
+ Shared.Packages.Table (Builder).Decl.Arrays,
+ Shared => Shared);
+
+ while Switch_Array_Id /= No_Array_Element loop
+ Switch_Array :=
+ Shared.Array_Elements.Table (Switch_Array_Id);
+ Switch_List := Switch_Array.Value.Values;
+
+ while Switch_List /= Nil_String loop
+ Switch :=
+ Shared.String_Elements.Table (Switch_List);
+
+ if Switch.Value /= No_Name then
+ Get_Name_String (Switch.Value);
+
+ if Name_Len >= 7 and then
+ Name_Buffer (1 .. 5) = "--RTS"
+ then
+ if Name_Buffer (6) = '=' then
+ if not Runtime_Name_Set_For (Name_Ada) then
+ Set_Runtime_For
+ (Name_Ada,
+ Name_Buffer (7 .. Name_Len));
+ end if;
+
+ elsif Name_Len > 7 and then
+ Name_Buffer (6) = ':' and then
+ Name_Buffer (7) /= '='
+ then
+ Lang_Last := 7;
+ while Lang_Last < Name_Len and then
+ Name_Buffer (Lang_Last + 1) /= '='
+ loop
+ Lang_Last := Lang_Last + 1;
+ end loop;
+
+ if
+ Name_Buffer (Lang_Last + 1) = '='
+ then
+ declare
+ RTS : constant String :=
+ Name_Buffer (Lang_Last + 2 ..
+ Name_Len);
+ begin
+ Name_Buffer (1 .. Lang_Last - 6)
+ := Name_Buffer (7 .. Lang_Last);
+ Name_Len := Lang_Last - 6;
+ To_Lower
+ (Name_Buffer (1 .. Name_Len));
+ Lang := Name_Find;
+
+ if
+ not Runtime_Name_Set_For (Lang)
+ then
+ Set_Runtime_For (Lang, RTS);
+ end if;
+ end;
+ end if;
+ end if;
+ end if;
+ end if;
+
+ Switch_List := Switch.Next;
+ end loop;
+
+ Switch_Array_Id := Switch_Array.Next;
+ end loop;
+ end if;
+ end;
+ end if;
+
+ -- Get the config switches. This should be done only now, as some
+ -- runtimes may have been found if the Builder switches.
+
+ Config_Switches := Get_Config_Switches;
+
-- Invoke gprconfig
Args (1) := new String'("--batch");
@@ -1041,9 +1139,9 @@ package body Prj.Conf is
Write_Str (Args (J).all);
end loop;
- for J in Switches'Range loop
+ for J in Config_Switches'Range loop
Write_Char (' ');
- Write_Str (Switches (J).all);
+ Write_Str (Config_Switches (J).all);
end loop;
Write_Eol;
@@ -1061,10 +1159,11 @@ package body Prj.Conf is
end if;
end if;
- Spawn (Gprconfig_Path.all, Args (1 .. Arg_Last) & Switches.all,
+ Spawn (Gprconfig_Path.all, Args (1 .. Arg_Last) &
+ Config_Switches.all,
Success);
- Free (Switches);
+ Free (Config_Switches);
Config_File_Path := Locate_Config_File (Args (3).all);
@@ -1122,6 +1221,15 @@ package body Prj.Conf is
Do_Autoconf;
end if;
+
+ -- If the config file is not auto-generated, warn if there is any --RTS
+ -- switch on the command line.
+
+ elsif RTS_Languages.Get_First /= No_Name and then
+ Opt.Warning_Mode /= Opt.Suppress
+ then
+ Write_Line
+ ("warning: --RTS is taken into account only in auto-configuration");
end if;
-- Parse the configuration file
@@ -1405,6 +1513,15 @@ package body Prj.Conf is
end if;
end Runtime_Name_For;
+ --------------------------
+ -- Runtime_Name_Set_For --
+ --------------------------
+
+ function Runtime_Name_Set_For (Language : Name_Id) return Boolean is
+ begin
+ return RTS_Languages.Get (Language) /= No_Name;
+ end Runtime_Name_Set_For;
+
---------------------
-- Set_Runtime_For --
---------------------