aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/atree.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2014-02-24 18:06:34 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2014-02-24 18:06:34 +0100
commit158d55fa393867c794df5aa43b693f61e5916b83 (patch)
tree7b2b58757fa8dde2e0d1161f993fb42856cfee7f /gcc/ada/atree.adb
parent5c20e503ba3644e0037b09db9384f70aaa1daaa5 (diff)
downloadgcc-158d55fa393867c794df5aa43b693f61e5916b83.zip
gcc-158d55fa393867c794df5aa43b693f61e5916b83.tar.gz
gcc-158d55fa393867c794df5aa43b693f61e5916b83.tar.bz2
[multiple changes]
2014-02-24 Robert Dewar <dewar@adacore.com> * a-tags.adb, s-os_lib.adb: Minor reformatting. 2014-02-24 Thomas Quinot <quinot@adacore.com> * g-sercom-mingw.adb, g-sercom-linux.adb (Raise_Error): Include strerror message, not just numeric errno value. 2014-02-24 Doug Rupp <rupp@adacore.com> * raise-gcc.c (exception_class_eq): Make endian neutral. 2014-02-24 Ed Schonberg <schonberg@adacore.com> * atree.ads, atree,adb (Copy_Separate_Tree): Remove Syntax_Only flag, and reset Etype and Analyzed attributes unconditionally when copying a tree that may be partly analyzed. * freeze.adb: Change calls to Copy_Separate_Tree accordingly. * sem_ch6.adb (Check_Inline_Pragma): If the Inline pragma appears within a subprogram body and applies to it, remove it from the body before making a copy of it, to prevent spurious errors when analyzing the copied body. From-SVN: r208086
Diffstat (limited to 'gcc/ada/atree.adb')
-rw-r--r--gcc/ada/atree.adb65
1 files changed, 28 insertions, 37 deletions
diff --git a/gcc/ada/atree.adb b/gcc/ada/atree.adb
index 8b0ef2b..1e4e251 100644
--- a/gcc/ada/atree.adb
+++ b/gcc/ada/atree.adb
@@ -772,9 +772,7 @@ package body Atree is
-- Copy_Separate_Tree --
------------------------
- function Copy_Separate_Tree
- (Source : Node_Id;
- Syntax_Only : Boolean := False) return Node_Id
+ function Copy_Separate_Tree (Source : Node_Id) return Node_Id
is
New_Id : Node_Id;
@@ -796,9 +794,7 @@ package body Atree is
New_Ent : Entity_Id;
begin
- -- Build appropriate node. Note that in this case, we do not need to
- -- do any special casing for Syntax_Only, since the new node has no
- -- Etype set, and is always unanalyzed.
+ -- Build appropriate node.
case N_Entity (Nkind (E)) is
when N_Defining_Identifier =>
@@ -835,7 +831,7 @@ package body Atree is
if Has_Extension (E) then
Append (Copy_Entity (E), NL);
else
- Append (Copy_Separate_Tree (E, Syntax_Only), NL);
+ Append (Copy_Separate_Tree (E), NL);
end if;
Next (E);
@@ -855,7 +851,7 @@ package body Atree is
begin
if Field in Node_Range then
New_N :=
- Union_Id (Copy_Separate_Tree (Node_Id (Field), Syntax_Only));
+ Union_Id (Copy_Separate_Tree (Node_Id (Field)));
if Parent (Node_Id (Field)) = Source then
Set_Parent (Node_Id (New_N), New_Id);
@@ -906,45 +902,40 @@ package body Atree is
Set_Entity (New_Id, Empty);
end if;
- -- This is the point at which we do the special processing for
- -- the Syntax_Only flag being set:
+ -- Reset all Etype fields and Analyzed flags, because tree may
+ -- have been partly analyzed.
- if Syntax_Only then
-
- -- Reset all Etype fields and Analyzed flags
-
- if Nkind (New_Id) in N_Has_Etype then
- Set_Etype (New_Id, Empty);
- end if;
+ if Nkind (New_Id) in N_Has_Etype then
+ Set_Etype (New_Id, Empty);
+ end if;
- Set_Analyzed (New_Id, False);
+ Set_Analyzed (New_Id, False);
- -- Rather special case, if we have an expanded name, then change
- -- it back into a selected component, so that the tree looks the
- -- way it did coming out of the parser. This will change back
- -- when we analyze the selected component node.
+ -- Rather special case, if we have an expanded name, then change
+ -- it back into a selected component, so that the tree looks the
+ -- way it did coming out of the parser. This will change back
+ -- when we analyze the selected component node.
- if Nkind (New_Id) = N_Expanded_Name then
+ if Nkind (New_Id) = N_Expanded_Name then
- -- The following code is a bit kludgy. It would be cleaner to
- -- Add an entry Change_Expanded_Name_To_Selected_Component to
- -- Sinfo.CN, but that's an earthquake, because it has the wrong
- -- license, and Atree is used outside the compiler, e.g. in the
- -- binder and in ASIS, so we don't want to add that dependency.
+ -- The following code is a bit kludgy. It would be cleaner to
+ -- Add an entry Change_Expanded_Name_To_Selected_Component to
+ -- Sinfo.CN, but that's an earthquake, because it has the wrong
+ -- license, and Atree is used outside the compiler, e.g. in the
+ -- binder and in ASIS, so we don't want to add that dependency.
- -- Consequently we have no choice but to hold our noses and do
- -- the change manually. At least we are Atree, so this odd use
- -- of Atree.Unchecked_Access is at least all in the family.
+ -- Consequently we have no choice but to hold our noses and do
+ -- the change manually. At least we are Atree, so this odd use
+ -- of Atree.Unchecked_Access is at least all in the family.
- -- Change the node type
+ -- Change the node type
- Atree.Unchecked_Access.Set_Nkind (New_Id, N_Selected_Component);
+ Atree.Unchecked_Access.Set_Nkind (New_Id, N_Selected_Component);
- -- Clear the Chars field which is not present in a selected
- -- component node, so we don't want a junk value around.
+ -- Clear the Chars field which is not present in a selected
+ -- component node, so we don't want a junk value around.
- Set_Node1 (New_Id, Empty);
- end if;
+ Set_Node1 (New_Id, Empty);
end if;
-- All done, return copied node