mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-22 11:31:05 +08:00
[Ada] Fix bogus compilation error with Elaborate_Body and -gnatN
This fixes a bogus compilation error when a unit with SPARK_Mode containing a pragma Elaborate_Body is with-ed by a generic unit containing an inlined subprogram, and front-end inlining is enabled. 2019-08-19 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * sem_prag.adb (Is_Before_First_Decl): Deal with rewritten pragmas. gcc/testsuite/ * gnat.dg/elab8.adb, gnat.dg/elab8_gen.adb, gnat.dg/elab8_gen.ads, gnat.dg/elab8_pkg.adb, gnat.dg/elab8_pkg.ads: New testcase. From-SVN: r274664
This commit is contained in:
parent
bfa6962fc2
commit
8fafa0b420
@ -1,3 +1,8 @@
|
||||
2019-08-19 Eric Botcazou <ebotcazou@adacore.com>
|
||||
|
||||
* sem_prag.adb (Is_Before_First_Decl): Deal with rewritten
|
||||
pragmas.
|
||||
|
||||
2019-08-19 Bob Duff <duff@adacore.com>
|
||||
|
||||
* sem_warn.adb (Warn_On_Unreferenced_Entity): Suppress warning
|
||||
|
@ -7146,10 +7146,11 @@ package body Sem_Prag is
|
||||
Item : Node_Id := First (Decls);
|
||||
|
||||
begin
|
||||
-- Only other pragmas can come before this pragma
|
||||
-- Only other pragmas can come before this pragma, but they might
|
||||
-- have been rewritten so check the original node.
|
||||
|
||||
loop
|
||||
if No (Item) or else Nkind (Item) /= N_Pragma then
|
||||
if No (Item) or else Nkind (Original_Node (Item)) /= N_Pragma then
|
||||
return False;
|
||||
|
||||
elsif Item = Pragma_Node then
|
||||
|
@ -1,3 +1,9 @@
|
||||
2019-08-19 Eric Botcazou <ebotcazou@adacore.com>
|
||||
|
||||
* gnat.dg/elab8.adb, gnat.dg/elab8_gen.adb,
|
||||
gnat.dg/elab8_gen.ads, gnat.dg/elab8_pkg.adb,
|
||||
gnat.dg/elab8_pkg.ads: New testcase.
|
||||
|
||||
2019-08-19 Bob Duff <duff@adacore.com>
|
||||
|
||||
* gnat.dg/warn29.adb, gnat.dg/warn29.ads: New testcase.
|
||||
|
12
gcc/testsuite/gnat.dg/elab8.adb
Normal file
12
gcc/testsuite/gnat.dg/elab8.adb
Normal file
@ -0,0 +1,12 @@
|
||||
-- { dg-do compile }
|
||||
-- { dg-options "-gnatN" }
|
||||
|
||||
with Elab8_Gen;
|
||||
|
||||
procedure Elab8 is
|
||||
|
||||
package My_G is new Elab8_Gen (Integer);
|
||||
|
||||
begin
|
||||
My_G.Compare (0, 1);
|
||||
end;
|
12
gcc/testsuite/gnat.dg/elab8_gen.adb
Normal file
12
gcc/testsuite/gnat.dg/elab8_gen.adb
Normal file
@ -0,0 +1,12 @@
|
||||
with Elab8_Pkg;
|
||||
|
||||
package body Elab8_Gen is
|
||||
|
||||
procedure Compare (Arg1, Arg2 : T) is
|
||||
begin
|
||||
if Arg1 = Arg2 then
|
||||
raise Program_Error;
|
||||
end if;
|
||||
end;
|
||||
|
||||
end Elab8_Gen;
|
8
gcc/testsuite/gnat.dg/elab8_gen.ads
Normal file
8
gcc/testsuite/gnat.dg/elab8_gen.ads
Normal file
@ -0,0 +1,8 @@
|
||||
generic
|
||||
type T is private;
|
||||
package Elab8_Gen is
|
||||
|
||||
procedure Compare (Arg1, Arg2 : T);
|
||||
pragma Inline (Compare);
|
||||
|
||||
end Elab8_Gen;
|
5
gcc/testsuite/gnat.dg/elab8_pkg.adb
Normal file
5
gcc/testsuite/gnat.dg/elab8_pkg.adb
Normal file
@ -0,0 +1,5 @@
|
||||
package body Elab8_Pkg is
|
||||
|
||||
procedure Dummy is null;
|
||||
|
||||
end Elab8_Pkg;
|
5
gcc/testsuite/gnat.dg/elab8_pkg.ads
Normal file
5
gcc/testsuite/gnat.dg/elab8_pkg.ads
Normal file
@ -0,0 +1,5 @@
|
||||
package Elab8_Pkg with SPARK_Mode is
|
||||
|
||||
pragma Elaborate_Body;
|
||||
|
||||
end Elab8_Pkg;
|
Loading…
x
Reference in New Issue
Block a user