aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/frontend.adb
diff options
context:
space:
mode:
authorRobert Dewar <dewar@adacore.com>2014-07-29 14:59:26 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2014-07-29 16:59:26 +0200
commitfc27e20e722d17c847d82062e70787388b6d6997 (patch)
tree86609ef51a606089072c0dc69e1f4a0b146dddb9 /gcc/ada/frontend.adb
parent1c4ff014fe1f6b440b4df75ca6f419ebc00fcac0 (diff)
downloadgcc-fc27e20e722d17c847d82062e70787388b6d6997.zip
gcc-fc27e20e722d17c847d82062e70787388b6d6997.tar.gz
gcc-fc27e20e722d17c847d82062e70787388b6d6997.tar.bz2
frontend.adb, [...]: Minor reformatting and code clean up.
2014-07-29 Robert Dewar <dewar@adacore.com> * frontend.adb, inline.adb, sem_util.adb, sem_res.adb, prepcomp.ads: Minor reformatting and code clean up. * exp_ch6.adb (Expand_Actuals): Generate predicate test unconditionally for case of OUT or IN OUT actual (before this was generated only for certain subcases, which is wrong, the test is always needed). From-SVN: r213208
Diffstat (limited to 'gcc/ada/frontend.adb')
-rw-r--r--gcc/ada/frontend.adb88
1 files changed, 75 insertions, 13 deletions
diff --git a/gcc/ada/frontend.adb b/gcc/ada/frontend.adb
index 8d59e6c..292cab1 100644
--- a/gcc/ada/frontend.adb
+++ b/gcc/ada/frontend.adb
@@ -71,6 +71,39 @@ procedure Frontend is
Config_Pragmas : List_Id;
-- Gather configuration pragmas
+ function Need_To_Be_In_The_Dependencies (Pragma_List : List_Id)
+ return Boolean;
+ -- Check if a configuration pragmas file that contains the Pragma_List
+ -- should be a dependency for the source being compiled. Returns
+ -- False if Pragma_List is Error_List or contains only pragmas
+ -- Source_File_Name_Project, returns True otherwise.
+
+ ------------------------------------
+ -- Need_To_Be_In_The_Dependencies --
+ ------------------------------------
+
+ function Need_To_Be_In_The_Dependencies (Pragma_List : List_Id)
+ return Boolean
+ is
+ Prag : Node_Id;
+ Pname : Name_Id;
+ begin
+ if Pragma_List /= Error_List then
+ Prag := First (Pragma_List);
+ while Present (Prag) loop
+ Pname := Pragma_Name (Prag);
+
+ if Pname /= Name_Source_File_Name_Project then
+ return True;
+ end if;
+
+ Next (Prag);
+ end loop;
+ end if;
+
+ return False;
+ end Need_To_Be_In_The_Dependencies;
+
begin
-- Carry out package initializations. These are initializations which might
-- logically be performed at elaboration time, were it not for the fact
@@ -144,8 +177,6 @@ begin
Prag : Node_Id;
- Temp_File : Boolean;
-
begin
-- We always analyze config files with style checks off, since
-- we don't want a miscellaneous gnat.adc that is around to
@@ -166,10 +197,23 @@ begin
Name_Len := 8;
Source_gnat_adc := Load_Config_File (Name_Enter);
+ -- Case of gnat.adc file present
+
if Source_gnat_adc /= No_Source_File then
+
+ -- Parse the gnat.adc file for configuration pragmas
+
Initialize_Scanner (No_Unit, Source_gnat_adc);
Config_Pragmas := Par (Configuration_Pragmas => True);
+
+ -- We unconditionally add a compilation dependency for gnat.adc
+ -- so that if it changes, we force a recompilation. This is a
+ -- fairly recent (2014-03-28) change.
+
Prepcomp.Add_Dependency (Source_gnat_adc);
+
+ -- Case of no gnat.adc file present
+
else
Config_Pragmas := Empty_List;
end if;
@@ -196,15 +240,17 @@ begin
-- Now deal with specified config pragmas files if there are any
if Opt.Config_File_Names /= null then
+
+ -- Loop through config pragmas files
+
for Index in Opt.Config_File_Names'Range loop
+
+ -- See if extension is .TMP/.tmp indicating a temporary config
+ -- file (which we ignore from the dependency point of view).
+
Name_Len := Config_File_Names (Index)'Length;
Name_Buffer (1 .. Name_Len) := Config_File_Names (Index).all;
- Temp_File :=
- Name_Len > 4
- and then
- (Name_Buffer (Name_Len - 3 .. Name_Len) = ".TMP"
- or else
- Name_Buffer (Name_Len - 3 .. Name_Len) = ".tmp");
+ -- Load the file, error if we did not find it
Source_Config_File := Load_Config_File (Name_Enter);
@@ -213,13 +259,29 @@ begin
("cannot find configuration pragmas file "
& Config_File_Names (Index).all);
- elsif not Temp_File then
- Prepcomp.Add_Dependency (Source_Config_File);
+ -- If we did find the file, and it contains pragmas other than
+ -- Source_File_Name_Project, then we unconditionally add a
+ -- compilation dependency for it so that if it changes, we force
+ -- a recompilation. This is a fairly recent (2014-03-28) change.
+
+ else
+
+ -- Parse the config pragmas file, and accumulate results
+
+ Initialize_Scanner (No_Unit, Source_Config_File);
+
+ declare
+ Pragma_List : constant List_Id :=
+ Par (Configuration_Pragmas => True);
+ begin
+ if Need_To_Be_In_The_Dependencies (Pragma_List) then
+ Prepcomp.Add_Dependency (Source_Config_File);
+ end if;
+
+ Append_List_To (Config_Pragmas, Pragma_List);
+ end;
end if;
- Initialize_Scanner (No_Unit, Source_Config_File);
- Append_List_To
- (Config_Pragmas, Par (Configuration_Pragmas => True));
end loop;
end if;