Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'leo/tgen-incomplete_types' into 'master'
TGen: Fix translation of subtypes of incomplete types Closes #3 See merge request eng/ide/libadalang-tools!17
- Loading branch information
Showing
8 changed files
with
121 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
with Ada.Streams; | ||
with Ada.Streams.Stream_IO; use Ada.Streams.Stream_IO; | ||
with Ada.Text_IO; use Ada.Text_IO; | ||
with Interfaces; use Interfaces; | ||
with Foo; use Foo; | ||
with Foo.TGen_Support; use Foo.TGen_Support; | ||
|
||
procedure Example_Gen is | ||
|
||
F : Ada.Streams.Stream_IO.File_Type; | ||
S : Stream_Access; | ||
File_Name : constant String := "scratch_pad.bin"; | ||
Bar_1, Bar_2 : Bar; | ||
Baz_1, Baz_2 : Baz; | ||
|
||
|
||
begin | ||
Create (F, Out_File, File_Name); | ||
S := Stream (F); | ||
|
||
TGen_Marshalling_foo_bar_output (S, Bar_1); | ||
TGen_Marshalling_foo_baz_output (S, Baz_2); | ||
|
||
Close (F); | ||
|
||
Open (F, In_File, File_Name); | ||
|
||
Bar_2 := TGen_Marshalling_foo_bar_input(S); | ||
Baz_2 := TGen_Marshalling_foo_baz_input(S); | ||
|
||
Close (F); | ||
|
||
if Bar_1 /= Bar_2 then | ||
Put_Line ("Error comparing Bar"); | ||
elsif Baz_1 /= Baz_2 then | ||
Put_Line ("Error comparing Baz"); | ||
end if; | ||
|
||
end Example_Gen; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
|
||
LALTOOLS_ROOT=$(dirname $(which gnattest))/.. | ||
TEMPLATES_PATH=$LALTOOLS_ROOT/share/tgen/templates | ||
RTS_PATH=$LALTOOLS_ROOT/share/tgen/tgen_rts | ||
if [ "$OS" == "Windows_NT" ]; then | ||
export GPR_PROJECT_PATH=$RTS_PATH";"$GPR_PROJECT_PATH | ||
else | ||
export GPR_PROJECT_PATH=$RTS_PATH:$GPR_PROJECT_PATH | ||
fi | ||
mkdir -p test/obj obj | ||
tgen_marshalling -P test/test.gpr --templates-dir=$TEMPLATES_PATH -o test/tgen_support test/foo.ads | ||
gprbuild -q -P test_gen.gpr | ||
./obj/example_gen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
description: | ||
test support for subtypes of incomplete types for the marshalling lib | ||
|
||
driver: shell_script | ||
control: | ||
- [XFAIL, 'x86', 'Marshalling not working for 32bits (UB03-008)'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package body Foo is | ||
procedure Qux (F : Bar; B : Baz) is | ||
begin | ||
null; | ||
end Qux; | ||
end Foo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package Foo is | ||
type Bar is private; | ||
subtype Baz is Bar; | ||
procedure Qux (F : Bar; B : Baz); | ||
private | ||
type Bar is null record; | ||
end Foo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
project Test is | ||
|
||
for Object_Dir use "obj"; | ||
|
||
end Test; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
with "test/test.gpr"; | ||
with "test/tgen_support/tgen_support.gpr"; | ||
|
||
project Test_Gen is | ||
|
||
for Main use ("example_gen.adb"); | ||
|
||
for Object_Dir use "obj"; | ||
|
||
package Builder is | ||
for Switches ("ada") use ("-g", "-gnat2022"); | ||
end Builder; | ||
|
||
package Linker is | ||
for Switches ("ada") use ("-g"); | ||
end Linker; | ||
|
||
end Test_Gen; | ||
|