summaryrefslogtreecommitdiff
path: root/gcc/ada/prj-conf.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2014-10-20 14:17:37 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2014-10-20 14:17:37 +0000
commitd296be94466019bfce6e46c5b2c7b5d4862502a9 (patch)
tree8c8a012641abada9742f42f3abdd710ad7999737 /gcc/ada/prj-conf.adb
parent7d6fb253c105bc78929749d990a5200c9a52dbbf (diff)
downloadgcc-d296be94466019bfce6e46c5b2c7b5d4862502a9.tar.gz
2014-10-20 Eric Botcazou <ebotcazou@adacore.com>
* inline.adb (List_Inlining_Info): Minor tweaks. (Add_Inlined_Body): Inline the enclosing package if it is not internally generated, even if it doesn't come from source. 2014-10-20 Ed Schonberg <schonberg@adacore.com> * sem_ch4.adb (Process_Function_Call): If the first actual denotes a discrete type, the mode must be interpreted as a slice of an array returned by a parameterless call. 2014-10-20 Vasiliy Fofanov <fofanov@adacore.com> * prj-env.ads, prj-env.adb (Get_Runtime_Path): No longer inhibit searching for runtime referenced by a simple name on a project path. 2014-10-20 Olivier Hainque <hainque@adacore.com> * vxworks-x86-link.spec: New file. * system-vxworks-x86.ads: Add pragma Linker_Options to link with vxworks-x86-link.spec. 2014-10-20 Vincent Celier <celier@adacore.com> * opt.ads (Origin_Of_Target): New type. (Target_Origin): New variable. * prj-conf.adb (Parse_Project_And_Apply_Config): Record Target_Value and Target_Origin. If target was not specified on the command line with --target=, check if attribute Target is declared in the main project. If it is and it is not the native target, parse again the projects so that 'Target get the new value. Fail if the target has changed again. Invoke Process_Project_And_Apply_Config with Do_Phase_1 set to False is Process_Project_Tree_Phase_1 has already been invoked. * prj-conf.ads (Process_Project_And_Apply_Config): New Boolean parameter Do_Phase_1, defaulted to True. * prj-proc.adb (Expression): Check the special values and defaults for attribute Target. 2014-10-20 Ed Schonberg <schonberg@adacore.com> * sem_ch3.adb (Handle_Late_Controlled_Primitive): Do not analyze the subprogram spec of the body in full, because it will be reanalyzed when the declaration itself is analyzed; otherwise. a formal may end up duplicated in the list of formals leading to spurious conformance errors with an existing declaration. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@216473 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/prj-conf.adb')
-rw-r--r--gcc/ada/prj-conf.adb100
1 files changed, 84 insertions, 16 deletions
diff --git a/gcc/ada/prj-conf.adb b/gcc/ada/prj-conf.adb
index 6d5cdc7cc15..206fa4c7228 100644
--- a/gcc/ada/prj-conf.adb
+++ b/gcc/ada/prj-conf.adb
@@ -1584,9 +1584,24 @@ package body Prj.Conf is
Implicit_Project : Boolean := False;
On_New_Tree_Loaded : Prj.Proc.Tree_Loaded_Callback := null)
is
+ Success : Boolean := False;
+ Try_Again : Boolean := True;
+
begin
pragma Assert (Prj.Env.Is_Initialized (Env.Project_Path));
+ -- Record Target_Value and Target_Origin.
+
+ if Target_Name = "" then
+ Opt.Target_Value := new String'(Normalized_Hostname);
+ Opt.Target_Origin := Default;
+ else
+ Opt.Target_Value := new String'(Target_Name);
+ Opt.Target_Origin := Specified;
+ end if;
+
+ <<Parse_Again>>
+
-- Parse the user project tree
Prj.Initialize (Project_Tree);
@@ -1609,6 +1624,55 @@ package body Prj.Conf is
return;
end if;
+ -- If --target was not specified on the command line, then do Phase 1 to
+ -- check if attribute Target is declared in the main project.
+
+ if Opt.Target_Origin /= Specified then
+ Main_Project := No_Project;
+ Process_Project_Tree_Phase_1
+ (In_Tree => Project_Tree,
+ Project => Main_Project,
+ Packages_To_Check => Packages_To_Check,
+ Success => Success,
+ From_Project_Node => User_Project_Node,
+ From_Project_Node_Tree => Project_Node_Tree,
+ Env => Env,
+ Reset_Tree => True,
+ On_New_Tree_Loaded => On_New_Tree_Loaded);
+
+ if not Success then
+ Main_Project := No_Project;
+ return;
+ end if;
+
+ declare
+ Variable : constant Variable_Value :=
+ Value_Of
+ (Name_Target,
+ Main_Project.Decl.Attributes,
+ Project_Tree.Shared);
+ begin
+ if Variable /= Nil_Variable_Value
+ and then not Variable.Default
+ and then
+ Get_Name_String (Variable.Value) /= Opt.Target_Value.all
+ then
+ if Try_Again then
+ Opt.Target_Value :=
+ new String'(Get_Name_String (Variable.Value));
+ Try_Again := False;
+ goto Parse_Again;
+
+ else
+ Fail_Program
+ (Project_Tree,
+ "inconsistent value of attribute Target");
+ end if;
+ end if;
+ end;
+
+ end if;
+
Process_Project_And_Apply_Config
(Main_Project => Main_Project,
User_Project_Node => User_Project_Node,
@@ -1624,7 +1688,8 @@ package body Prj.Conf is
Target_Name => Target_Name,
Normalized_Hostname => Normalized_Hostname,
On_Load_Config => On_Load_Config,
- On_New_Tree_Loaded => On_New_Tree_Loaded);
+ On_New_Tree_Loaded => On_New_Tree_Loaded,
+ Do_Phase_1 => Opt.Target_Origin = Specified);
end Parse_Project_And_Apply_Config;
--------------------------------------
@@ -1647,7 +1712,8 @@ package body Prj.Conf is
Normalized_Hostname : String;
On_Load_Config : Config_File_Hook := null;
Reset_Tree : Boolean := True;
- On_New_Tree_Loaded : Prj.Proc.Tree_Loaded_Callback := null)
+ On_New_Tree_Loaded : Prj.Proc.Tree_Loaded_Callback := null;
+ Do_Phase_1 : Boolean := True)
is
Shared : constant Shared_Project_Tree_Data_Access :=
Project_Tree.Shared;
@@ -1692,23 +1758,25 @@ package body Prj.Conf is
-- Start of processing for Process_Project_And_Apply_Config
begin
- Main_Project := No_Project;
Automatically_Generated := False;
- Process_Project_Tree_Phase_1
- (In_Tree => Project_Tree,
- Project => Main_Project,
- Packages_To_Check => Packages_To_Check,
- Success => Success,
- From_Project_Node => User_Project_Node,
- From_Project_Node_Tree => Project_Node_Tree,
- Env => Env,
- Reset_Tree => Reset_Tree,
- On_New_Tree_Loaded => On_New_Tree_Loaded);
-
- if not Success then
+ if Do_Phase_1 then
Main_Project := No_Project;
- return;
+ Process_Project_Tree_Phase_1
+ (In_Tree => Project_Tree,
+ Project => Main_Project,
+ Packages_To_Check => Packages_To_Check,
+ Success => Success,
+ From_Project_Node => User_Project_Node,
+ From_Project_Node_Tree => Project_Node_Tree,
+ Env => Env,
+ Reset_Tree => Reset_Tree,
+ On_New_Tree_Loaded => On_New_Tree_Loaded);
+
+ if not Success then
+ Main_Project := No_Project;
+ return;
+ end if;
end if;
if Project_Tree.Source_Info_File_Name /= null then