aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2017-12-05 11:38:00 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2017-12-05 11:38:00 +0000
commit16d92641c44532b83fc9ff6009ada3a769a15731 (patch)
tree9761b471835baf82f173c34189b9c20165525dd3 /gcc
parentab92e6e6a5f5cdd3a28d54c4626f1efb8218f561 (diff)
downloadgcc-16d92641c44532b83fc9ff6009ada3a769a15731.zip
gcc-16d92641c44532b83fc9ff6009ada3a769a15731.tar.gz
gcc-16d92641c44532b83fc9ff6009ada3a769a15731.tar.bz2
[multiple changes]
2017-12-05 Bob Duff <duff@adacore.com> * exp_ch6.adb (Build_In_Place_Formal): Search for the formal by suffix instead of the full name. * sem_ch6.adb (Create_Extra_Formals): Make sure there are extra formals in the case of an instance of a generic. 2017-12-05 Arnaud Charlet <charlet@adacore.com> (Adjust_Global_Switches): Create an alias GNAT_Annotate to map to pragma Annotate. From-SVN: r255409
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog12
-rw-r--r--gcc/ada/exp_ch6.adb18
-rw-r--r--gcc/ada/gnat1drv.adb7
-rw-r--r--gcc/ada/sem_ch6.adb7
-rw-r--r--gcc/ada/snames.ads-tmpl1
5 files changed, 41 insertions, 4 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 79417dd..d5e64b0 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,15 @@
+2017-12-05 Bob Duff <duff@adacore.com>
+
+ * exp_ch6.adb (Build_In_Place_Formal): Search for the formal by suffix
+ instead of the full name.
+ * sem_ch6.adb (Create_Extra_Formals): Make sure there are extra formals
+ in the case of an instance of a generic.
+
+2017-12-05 Arnaud Charlet <charlet@adacore.com>
+
+ (Adjust_Global_Switches): Create an alias GNAT_Annotate to map to
+ pragma Annotate.
+
2017-12-05 Sebastian Huber <sebastian.huber@embedded-brains.de>
* gcc-interface/Makefile.in (RTEMS): Define EH_MECHANISM.
diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb
index 0b36110..8a3f390 100644
--- a/gcc/ada/exp_ch6.adb
+++ b/gcc/ada/exp_ch6.adb
@@ -650,9 +650,7 @@ package body Exp_Ch6 is
(Func : Entity_Id;
Kind : BIP_Formal_Kind) return Entity_Id
is
- Formal_Name : constant Name_Id :=
- New_External_Name
- (Chars (Func), BIP_Formal_Suffix (Kind));
+ Formal_Suffix : constant String := BIP_Formal_Suffix (Kind);
Extra_Formal : Entity_Id := Extra_Formals (Func);
begin
@@ -669,9 +667,21 @@ package body Exp_Ch6 is
Extra_Formal := Extra_Formals (Func);
end if;
+ -- We search for a formal with a matching suffix. We can't search
+ -- for the full name, because of the code at the end of Sem_Ch6.-
+ -- Create_Extra_Formals, which copies the Extra_Formals over to
+ -- the Alias of an instance, which will cause the formals to have
+ -- "incorrect" names.
+
loop
pragma Assert (Present (Extra_Formal));
- exit when Chars (Extra_Formal) = Formal_Name;
+ declare
+ Name : constant String := Get_Name_String (Chars (Extra_Formal));
+ begin
+ exit when Name'Length >= Formal_Suffix'Length
+ and then Formal_Suffix =
+ Name (Name'Last - Formal_Suffix'Length + 1 .. Name'Last);
+ end;
Next_Formal_With_Extras (Extra_Formal);
end loop;
diff --git a/gcc/ada/gnat1drv.adb b/gcc/ada/gnat1drv.adb
index 3e4234b..1b3f9a3 100644
--- a/gcc/ada/gnat1drv.adb
+++ b/gcc/ada/gnat1drv.adb
@@ -136,6 +136,13 @@ procedure Gnat1drv is
-- Start of processing for Adjust_Global_Switches
begin
+ -- Define pragma GNAT_Annotate as an alias of pragma Annotate,
+ -- to be able to work around bootstrap limitations with the old syntax
+ -- of pragma Annotate, and use pragma GNAT_Annotate in compiler sources
+ -- when needed.
+
+ Map_Pragma_Name (From => Name_Gnat_Annotate, To => Name_Annotate);
+
-- -gnatd.M enables Relaxed_RM_Semantics
if Debug_Flag_Dot_MM then
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index 01c1b54..b13ca92 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -8140,6 +8140,13 @@ package body Sem_Ch6 is
(E, Formal_Typ, E, BIP_Formal_Suffix (BIP_Object_Access));
end;
end if;
+
+ -- If this is an instance of a generic, we need to have extra formals
+ -- for the Alias.
+
+ if Is_Generic_Instance (E) and then Present (Alias (E)) then
+ Set_Extra_Formals (Alias (E), Extra_Formals (E));
+ end if;
end Create_Extra_Formals;
-----------------------------
diff --git a/gcc/ada/snames.ads-tmpl b/gcc/ada/snames.ads-tmpl
index 5fcf365..e89e3ff 100644
--- a/gcc/ada/snames.ads-tmpl
+++ b/gcc/ada/snames.ads-tmpl
@@ -760,6 +760,7 @@ package Snames is
Name_Gcc : constant Name_Id := N + $;
Name_General : constant Name_Id := N + $;
Name_Gnat : constant Name_Id := N + $;
+ Name_Gnat_Annotate : constant Name_Id := N + $;
Name_Gnat_Extended_Ravenscar : constant Name_Id := N + $;
Name_Gnat_Ravenscar_EDF : constant Name_Id := N + $;
Name_Gnatprove : constant Name_Id := N + $;