Skip to content

Commit

Permalink
Merge branch 'mr/backport/release-25.1-issue-eng/ide/libadalang-tools…
Browse files Browse the repository at this point in the history
…_208' into '25.1'

[25.1] Backport of eng/ide/libadalang-tools#208

See merge request eng/ide/libadalang-tools!281
  • Loading branch information
leocreuse committed Dec 19, 2024
2 parents dc88d7b + 5a0fce6 commit 741bf7d
Show file tree
Hide file tree
Showing 16 changed files with 73 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/test-skeleton-source_table.adb
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,13 @@ package body Test.Skeleton.Source_Table is
Importing := P.Find_All_Projects_Importing (Direct_Only => True);
Increase_Indent (Me, "importing projects:");
while Current (Importing) /= No_Project loop
PR.Importing_List.Append (Current (Importing).Name);

-- Ensure to only reference the extending-most project, as
-- extended projects are skipped.

PR.Importing_List.Append
(Current (Importing)
.Extending_Project (Recurse => True).Name);
Trace (Me, Current (Importing).Name);
Next (Importing);
end loop;
Expand Down
2 changes: 2 additions & 0 deletions src/utils-projects.adb
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ package body Utils.Projects is
and then Index (S, "not found") /= 0
then
return;
elsif Index (S, "warning:") /= 0 then
Err_Out.Put_Str (S);
else
Cmd_Error_No_Tool_Name (S);
end if;
Expand Down
8 changes: 8 additions & 0 deletions testsuite/tests/test/208-gpr-warnings/pkg.adb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package body Pkg is

procedure Foo (X : in out Integer) is
begin
X := X + 1;
end Foo;

end Pkg;
5 changes: 5 additions & 0 deletions testsuite/tests/test/208-gpr-warnings/pkg.ads
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package Pkg is

procedure Foo (X : in out Integer);

end Pkg;
11 changes: 11 additions & 0 deletions testsuite/tests/test/208-gpr-warnings/prj.gpr
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
library project Prj is
for Object_Dir use "obj";
for Library_Dir use "lib";
for Library_Name use "prj";

-- Add linker switches to trigger a gpr warning
package Linker is
for Default_Switches ("Ada") use ("-static-libstdc++");
end Linker;

end Prj;
3 changes: 3 additions & 0 deletions testsuite/tests/test/208-gpr-warnings/test.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
prj.gpr:1:17: warning: Linker switches not taken into account in library projects
Units remaining: 2 Units remaining: 1
prj.gpr:1:17: warning: Linker switches not taken into account in library projects
Expand Down
3 changes: 3 additions & 0 deletions testsuite/tests/test/208-gpr-warnings/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

gnattest -P prj.gpr && gprbuild -q -P obj/gnattest/harness/test_driver.gpr
6 changes: 6 additions & 0 deletions testsuite/tests/test/208-gpr-warnings/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
description:
Test that gnattest does not exit with an error if there are warnings when
loading the project file. Instead, only output those warnings and still
proceed with the rest of the tool.

driver: shell_script
2 changes: 2 additions & 0 deletions testsuite/tests/test/208-stub_extension/failing.gpr
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
project Failing extends "libext/libext.gpr" is
end Failing;
5 changes: 5 additions & 0 deletions testsuite/tests/test/208-stub_extension/libext/d.ads
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
with E;

package D is
function Lighted return Integer is (0);
end D;
4 changes: 4 additions & 0 deletions testsuite/tests/test/208-stub_extension/libext/libext.gpr
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
with "libinc/libinc.gpr";

project LibExt is
end LibExt;
2 changes: 2 additions & 0 deletions testsuite/tests/test/208-stub_extension/libext/libinc/e.adb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
package body E is
end E;
3 changes: 3 additions & 0 deletions testsuite/tests/test/208-stub_extension/libext/libinc/e.ads
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package E is
pragma Elaborate_Body;
end E;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
project LibInc is
end LibInc;
4 changes: 4 additions & 0 deletions testsuite/tests/test/208-stub_extension/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#! /bin/sh

gnattest -q -P failing.gpr --stub
gprbuild -q -P gnattest_stub/harness/test_drivers.gpr
6 changes: 6 additions & 0 deletions testsuite/tests/test/208-stub_extension/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
description:
Test that gnattest does no crash when generating a harness with stubbing
for a project tree in which an extending project is present. This used to
crash due to a mis-management of the project table.

driver: shell_script

0 comments on commit 741bf7d

Please sign in to comment.