aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier Miranda <miranda@adacore.com>2016-04-21 08:14:08 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2016-04-21 10:14:08 +0200
commit29a56f611a6c48dc6af556a02c0494ef928274d3 (patch)
tree1ff9cef286d4a241dd8a12d5405aa182e5dc3484
parente379beb56f0b1e597c8aeb10c84813c8326197a9 (diff)
downloadgcc-29a56f611a6c48dc6af556a02c0494ef928274d3.zip
gcc-29a56f611a6c48dc6af556a02c0494ef928274d3.tar.gz
gcc-29a56f611a6c48dc6af556a02c0494ef928274d3.tar.bz2
frontend.adb: Update call to Unnest_Subprograms.
2016-04-21 Javier Miranda <miranda@adacore.com> * frontend.adb: Update call to Unnest_Subprograms. * exp_ch6.ads, exp_ch6.adb, exp_unst.ads, exp_unst.adb (Unnest_Subprograms): Moved to package exp_unst. * exp_unst.ads (Unnest_Subprogram): Moved to the body of the package. * exp_dbug.adb (Qualify_Entity_Name): Enable qualification of enumeration literals when generating C code. From-SVN: r235303
-rw-r--r--gcc/ada/ChangeLog10
-rw-r--r--gcc/ada/exp_ch6.adb56
-rw-r--r--gcc/ada/exp_ch6.ads5
-rw-r--r--gcc/ada/exp_dbug.adb13
-rw-r--r--gcc/ada/exp_unst.adb69
-rw-r--r--gcc/ada/exp_unst.ads13
-rw-r--r--gcc/ada/frontend.adb4
7 files changed, 97 insertions, 73 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 6c2a5c9..917345b 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,5 +1,15 @@
2016-04-21 Javier Miranda <miranda@adacore.com>
+ * frontend.adb: Update call to Unnest_Subprograms.
+ * exp_ch6.ads, exp_ch6.adb, exp_unst.ads, exp_unst.adb
+ (Unnest_Subprograms): Moved to package exp_unst.
+ * exp_unst.ads (Unnest_Subprogram): Moved to the body of the
+ package.
+ * exp_dbug.adb (Qualify_Entity_Name): Enable qualification of
+ enumeration literals when generating C code.
+
+2016-04-21 Javier Miranda <miranda@adacore.com>
+
* frontend.adb: Remove call to initialize Exp_Ch6.
* exp_ch6.ads, exp_ch6.adb (Initialize): removed.
(Unest_Entry/Unest_Bodies): Removed.
diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb
index 7a3a22f..d2cded5 100644
--- a/gcc/ada/exp_ch6.adb
+++ b/gcc/ada/exp_ch6.adb
@@ -42,7 +42,6 @@ with Exp_Dist; use Exp_Dist;
with Exp_Intr; use Exp_Intr;
with Exp_Pakd; use Exp_Pakd;
with Exp_Tss; use Exp_Tss;
-with Exp_Unst; use Exp_Unst;
with Exp_Util; use Exp_Util;
with Freeze; use Freeze;
with Ghost; use Ghost;
@@ -8434,59 +8433,4 @@ package body Exp_Ch6 is
end loop;
end Set_Enclosing_Sec_Stack_Return;
- ------------------------
- -- Unnest_Subprograms --
- ------------------------
-
- procedure Unnest_Subprograms (N : Node_Id) is
-
- function Search_Subprograms (N : Node_Id) return Traverse_Result;
- -- Tree visitor that search for outer level procedures with nested
- -- subprograms and invokes Unnest_Subprogram()
-
- ------------------------
- -- Search_Subprograms --
- ------------------------
-
- function Search_Subprograms (N : Node_Id) return Traverse_Result is
- begin
- if Nkind_In (N, N_Subprogram_Body,
- N_Subprogram_Body_Stub)
- then
- declare
- Spec_Id : constant Entity_Id := Unique_Defining_Entity (N);
-
- begin
- -- We are only interested in subprograms (not generic
- -- subprograms), that have nested subprograms.
-
- if Is_Subprogram (Spec_Id)
- and then Has_Nested_Subprogram (Spec_Id)
- and then Is_Library_Level_Entity (Spec_Id)
- then
- Unnest_Subprogram (Spec_Id, N);
- end if;
- end;
- end if;
-
- return OK;
- end Search_Subprograms;
-
- ---------------
- -- Do_Search --
- ---------------
-
- procedure Do_Search is new Traverse_Proc (Search_Subprograms);
- -- Subtree visitor instantiation
-
- -- Start of processing for Unnest_Subprograms
-
- begin
- if not Opt.Unnest_Subprogram_Mode then
- return;
- end if;
-
- Do_Search (N);
- end Unnest_Subprograms;
-
end Exp_Ch6;
diff --git a/gcc/ada/exp_ch6.ads b/gcc/ada/exp_ch6.ads
index ec85973..5d23e47 100644
--- a/gcc/ada/exp_ch6.ads
+++ b/gcc/ada/exp_ch6.ads
@@ -209,9 +209,4 @@ package Exp_Ch6 is
-- parameter to identify the accessibility level of the function result
-- "determined by the point of call".
- procedure Unnest_Subprograms (N : Node_Id);
- -- Called to unnest subprograms. If we are in unnest subprogram mode, this
- -- is the call that traverses the tree N and locates all the library level
- -- subprograms with nested subprograms to process them.
-
end Exp_Ch6;
diff --git a/gcc/ada/exp_dbug.adb b/gcc/ada/exp_dbug.adb
index 2c1d518..1f706d6 100644
--- a/gcc/ada/exp_dbug.adb
+++ b/gcc/ada/exp_dbug.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1996-2015, Free Software Foundation, Inc. --
+-- Copyright (C) 1996-2016, 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- --
@@ -1441,6 +1441,17 @@ package body Exp_Dbug is
Name_Len := Full_Qualify_Len;
Name_Buffer (1 .. Name_Len) := Full_Qualify_Name (1 .. Name_Len);
+ -- Qualification needed for enumeration literals when generating C code
+ -- (to simplify their management in the backend).
+
+ elsif Generate_C_Code
+ and then Ekind (Ent) = E_Enumeration_Literal
+ and then Scope (Ultimate_Alias (Ent)) /= Standard_Standard
+ then
+ Fully_Qualify_Name (Ent);
+ Name_Len := Full_Qualify_Len;
+ Name_Buffer (1 .. Name_Len) := Full_Qualify_Name (1 .. Name_Len);
+
elsif Qualify_Needed (Scope (Ent)) then
Name_Len := 0;
Set_Entity_Name (Ent);
diff --git a/gcc/ada/exp_unst.adb b/gcc/ada/exp_unst.adb
index 12204d8..d5eb07d 100644
--- a/gcc/ada/exp_unst.adb
+++ b/gcc/ada/exp_unst.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2014-2015, Free Software Foundation, Inc. --
+-- Copyright (C) 2014-2016, 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- --
@@ -47,6 +47,18 @@ with Uintp; use Uintp;
package body Exp_Unst is
+ -----------------------
+ -- Local Subprograms --
+ -----------------------
+
+ procedure Unnest_Subprogram (Subp : Entity_Id; Subp_Body : Node_Id);
+ -- Subp is a library-level subprogram which has nested subprograms, and
+ -- Subp_Body is the corresponding N_Subprogram_Body node. This procedure
+ -- declares the AREC types and objects, adds assignments to the AREC record
+ -- as required, defines the xxxPTR types for uplevel referenced objects,
+ -- adds the ARECP parameter to all nested subprograms which need it, and
+ -- modifies all uplevel references appropriately.
+
-----------
-- Calls --
-----------
@@ -1704,4 +1716,59 @@ package body Exp_Unst is
return;
end Unnest_Subprogram;
+ ------------------------
+ -- Unnest_Subprograms --
+ ------------------------
+
+ procedure Unnest_Subprograms (N : Node_Id) is
+
+ function Search_Subprograms (N : Node_Id) return Traverse_Result;
+ -- Tree visitor that search for outer level procedures with nested
+ -- subprograms and invokes Unnest_Subprogram()
+
+ ------------------------
+ -- Search_Subprograms --
+ ------------------------
+
+ function Search_Subprograms (N : Node_Id) return Traverse_Result is
+ begin
+ if Nkind_In (N, N_Subprogram_Body,
+ N_Subprogram_Body_Stub)
+ then
+ declare
+ Spec_Id : constant Entity_Id := Unique_Defining_Entity (N);
+
+ begin
+ -- We are only interested in subprograms (not generic
+ -- subprograms), that have nested subprograms.
+
+ if Is_Subprogram (Spec_Id)
+ and then Has_Nested_Subprogram (Spec_Id)
+ and then Is_Library_Level_Entity (Spec_Id)
+ then
+ Unnest_Subprogram (Spec_Id, N);
+ end if;
+ end;
+ end if;
+
+ return OK;
+ end Search_Subprograms;
+
+ ---------------
+ -- Do_Search --
+ ---------------
+
+ procedure Do_Search is new Traverse_Proc (Search_Subprograms);
+ -- Subtree visitor instantiation
+
+ -- Start of processing for Unnest_Subprograms
+
+ begin
+ if not Opt.Unnest_Subprogram_Mode then
+ return;
+ end if;
+
+ Do_Search (N);
+ end Unnest_Subprograms;
+
end Exp_Unst;
diff --git a/gcc/ada/exp_unst.ads b/gcc/ada/exp_unst.ads
index e6b7c5c..c013e25 100644
--- a/gcc/ada/exp_unst.ads
+++ b/gcc/ada/exp_unst.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2014-2015, Free Software Foundation, Inc. --
+-- Copyright (C) 2014-2016, 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- --
@@ -686,12 +686,9 @@ package Exp_Unst is
function Subp_Index (Sub : Entity_Id) return SI_Type;
-- Given the entity for a subprogram, return corresponding Subp's index
- procedure Unnest_Subprogram (Subp : Entity_Id; Subp_Body : Node_Id);
- -- Subp is a library-level subprogram which has nested subprograms, and
- -- Subp_Body is the corresponding N_Subprogram_Body node. This procedure
- -- declares the AREC types and objects, adds assignments to the AREC record
- -- as required, defines the xxxPTR types for uplevel referenced objects,
- -- adds the ARECP parameter to all nested subprograms which need it, and
- -- modifies all uplevel references appropriately.
+ procedure Unnest_Subprograms (N : Node_Id);
+ -- Called to unnest subprograms. If we are in unnest subprogram mode, this
+ -- is the call that traverses the tree N and locates all the library level
+ -- subprograms with nested subprograms to process them.
end Exp_Unst;
diff --git a/gcc/ada/frontend.adb b/gcc/ada/frontend.adb
index 1020da7..3861903 100644
--- a/gcc/ada/frontend.adb
+++ b/gcc/ada/frontend.adb
@@ -30,8 +30,8 @@ with Checks;
with CStand;
with Debug; use Debug;
with Elists;
-with Exp_Ch6;
with Exp_Dbug;
+with Exp_Unst;
with Fmap;
with Fname.UF;
with Ghost; use Ghost;
@@ -439,7 +439,7 @@ begin
-- At this stage we can unnest subprogram bodies if required
- Exp_Ch6.Unnest_Subprograms (Cunit (Main_Unit));
+ Exp_Unst.Unnest_Subprograms (Cunit (Main_Unit));
-- List library units if requested