Skip to content

Commit d1f3c3d

Browse files
author
automatic-merge
committed
Merge remote branch 'origin/master' into edge
2 parents ceb6f72 + ea839bb commit d1f3c3d

12 files changed

+411
-48
lines changed

.github/workflows/build-binaries.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,16 @@ jobs:
4343
- name: Get GNAT toolchain with alire
4444
shell: bash
4545
run: |
46-
# alire-project/setup-alire doesn't work for ARM64 Mac OS X for now.
47-
# https://github.com/alire-project/setup-alire/pull/74
48-
# Also it depends on `engineerd/configurator@v0.0.10` not approved by IT.
49-
# https://github.com/alire-project/setup-alire/issues/75
50-
# So we fetch Alire with curl then toolchain with Alire.
46+
# alire-project/setup-alire works for ARM64 Mac OS X now. Shall we use it?
5147
if [[ "$RUNNER_ARCH" == ARM64 ]] ; then
52-
ZIP=nightly/alr-nightly-bin-aarch64-macos.zip
48+
ZIP=v2.0.2/alr-2.0.2-bin-aarch64-${RUNNER_OS}.zip
5349
else
54-
ZIP=v2.0.1/alr-2.0.1-bin-x86_64-${RUNNER_OS}.zip
50+
ZIP=v2.0.2/alr-2.0.2-bin-x86_64-${RUNNER_OS}.zip
5551
fi
5652
curl -L -O https://github.com/alire-project/alire/releases/download/$ZIP
5753
unzip $(basename $ZIP)
5854
bin/alr index --reset-community
59-
bin/alr toolchain --select gnat_native^14 gprbuild
55+
bin/alr toolchain --select gnat_native gprbuild
6056
echo $PWD/bin >> $GITHUB_PATH
6157
- name: Get cross GNAT toolchain (Linux)
6258
if: ${{ runner.os == 'Linux' }}

.github/workflows/release.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ if [[ -z "$NODE_ARCH_PLATFORM" ]]; then
1414
NODE_PLATFORM=$(node -e "console.log(process.platform)")
1515
NODE_ARCH=$(node -e "console.log(process.arch)")
1616
NODE_ARCH_PLATFORM=$NODE_ARCH/$NODE_PLATFORM
17-
NAME=$NODE_ARCH-$NODE_PLATFORM
17+
NAME=als-$TAG-$NODE_PLATFORM-$NODE_ARCH
1818
else
19-
NAME=${NODE_ARCH_PLATFORM%/*}-${NODE_ARCH_PLATFORM#*/}
19+
NAME=als-$TAG-${NODE_ARCH_PLATFORM#*/}-${NODE_ARCH_PLATFORM%/*}
2020
fi
2121

2222
function release_notes() {

source/ada/lsp-ada_definition.adb

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ package body LSP.Ada_Definition is
122122
Manual_Fallback : Libadalang.Analysis.Defining_Name;
123123
Definition_Node : Libadalang.Analysis.Basic_Decl;
124124
Decl_For_Find_Overrides : Libadalang.Analysis.Basic_Decl;
125-
Entry_Decl_Node : Libadalang.Analysis.Entry_Decl;
126125

127126
Ignore : Boolean;
128127
begin
@@ -186,7 +185,37 @@ package body LSP.Ada_Definition is
186185

187186
-- Search for accept statements only if we are on an entry
188187
if Definition_Node.Kind in Libadalang.Common.Ada_Entry_Decl_Range then
189-
Entry_Decl_Node := Definition_Node.As_Entry_Decl;
188+
declare
189+
Entry_Decl_Node : constant Libadalang.Analysis.Entry_Decl :=
190+
Definition_Node.As_Entry_Decl;
191+
Entry_Parent_Node : constant Libadalang.Analysis.Basic_Decl :=
192+
Entry_Decl_Node.P_Parent_Basic_Decl;
193+
begin
194+
-- P_Accept_Stmts is only valid for entries declared in tasks
195+
if Entry_Parent_Node.Kind in
196+
Libadalang.Common.Ada_Task_Type_Decl_Range
197+
then
198+
for Accept_Node of Entry_Decl_Node.P_Accept_Stmts loop
199+
Self.Parent.Context.Append_Location
200+
(Self.Response,
201+
Self.Filter,
202+
Accept_Node.F_Body_Decl.F_Name);
203+
end loop;
204+
205+
-- Others entries are are handled as simple subprograms
206+
else
207+
declare
208+
Other_Part_For_Decl : constant
209+
Libadalang.Analysis.Basic_Decl :=
210+
Laltools.Common.Find_Next_Part_For_Decl
211+
(Definition_Node, Trace);
212+
begin
213+
if not Other_Part_For_Decl.Is_Null then
214+
Other_Part := Other_Part_For_Decl.P_Defining_Name;
215+
end if;
216+
end;
217+
end if;
218+
end;
190219

191220
elsif Definition_Node.Kind in
192221
Libadalang.Common.Ada_Single_Task_Type_Decl_Range |
@@ -265,15 +294,6 @@ package body LSP.Ada_Definition is
265294
end loop;
266295
end;
267296
end if;
268-
269-
if not Entry_Decl_Node.Is_Null then
270-
for Accept_Node of Entry_Decl_Node.P_Accept_Stmts loop
271-
Self.Parent.Context.Append_Location
272-
(Self.Response,
273-
Self.Filter,
274-
Accept_Node.F_Body_Decl.F_Name);
275-
end loop;
276-
end if;
277297
end Execute_Ada_Request;
278298

279299
end LSP.Ada_Definition;

source/ada/lsp-ada_driver.adb

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,10 @@ procedure LSP.Ada_Driver is
230230
LSP.GNATCOLL_Tracers.Create ("ALS.MAIN", From_Config);
231231
-- Main trace for the LSP.
232232

233+
Server_Logger_Trace : constant LSP.GNATCOLL_Tracers.Tracer :=
234+
LSP.GNATCOLL_Tracers.Create ("ALS.MAIN.LOGGER", Off);
235+
-- Trace that logs all the requests/responses parameters.
236+
233237
In_Trace : constant LSP.GNATCOLL_Tracers.Tracer :=
234238
LSP.GNATCOLL_Tracers.Create ("ALS.IN", Off);
235239
Out_Trace : constant LSP.GNATCOLL_Tracers.Tracer :=
@@ -456,8 +460,8 @@ begin
456460
& "ALS.OUT=no" & Ada.Characters.Latin_1.LF;
457461
begin
458462
W_Traces_File := Traces_File.Write_File;
459-
W_Traces_File.Write (Default_Traces_File_Contents);
460-
W_Traces_File.Close;
463+
Write (W_Traces_File, Default_Traces_File_Contents);
464+
Close (W_Traces_File);
461465
end;
462466
end if;
463467
end if;
@@ -499,8 +503,8 @@ begin
499503
end;
500504
end if;
501505

502-
In_Stream.Initialize (Trace_Handle (Server_Trace));
503-
Out_Stream.Initialize (Trace_Handle (Server_Trace));
506+
In_Stream.Initialize (Trace_Handle (Server_Logger_Trace));
507+
Out_Stream.Initialize (Trace_Handle (Server_Logger_Trace));
504508

505509
Tracer.Initialize (Server_Trace, In_Trace, Out_Trace);
506510
Tracer.Trace ("ALS version: " & $VERSION & " (" & $BUILD_DATE & ")");

source/ada/lsp-ada_handlers-open_als_log_file_commands.adb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,18 @@ package body LSP.Ada_Handlers.Open_ALS_Log_File_Commands is
4545
is
4646
pragma Unreferenced (Response);
4747

48-
Log_File_Path : constant LSP.Structures.Virtual_String := Handler.Tracer.Location;
49-
begin
48+
Log_File_Path : constant LSP.Structures.Virtual_String :=
49+
Handler.Tracer.Location;
50+
5051
Message : constant LSP.Structures.ShowDocumentParams :=
5152
(uri => (Log_File_Path with null record),
5253
takeFocus => LSP.Constants.True,
5354
others => <>);
5455

5556
New_Id : constant LSP.Structures.Integer_Or_Virtual_String :=
56-
Handler.Server.Allocate_Request_Id;
57+
Handler.Server.Allocate_Request_Id;
58+
59+
begin
5760
Handler.Sender.On_ShowDocument_Request (New_Id, Message);
5861
end Execute;
5962

source/ada/lsp-ada_handlers-open_project_file_commands.adb

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,20 +48,22 @@ package body LSP.Ada_Handlers.Open_Project_File_Commands is
4848
pragma Unreferenced (Response);
4949

5050
Project_File : constant Virtual_File :=
51-
Handler.Project_Status.Get_Project_File;
52-
begin
53-
if Project_File.Is_Regular_File then
54-
URI : constant LSP.Structures.DocumentUri :=
55-
Handler.To_URI (Project_File.Display_Full_Name);
51+
LSP.Ada_Project_Loading.Get_Project_File (Handler.Project_Status);
52+
53+
URI : constant LSP.Structures.DocumentUri :=
54+
(if Project_File.Is_Regular_File
55+
then Handler.To_URI (Project_File.Display_Full_Name)
56+
else "");
5657

57-
Message : constant LSP.Structures.ShowDocumentParams :=
58-
(uri => (VSS.Strings.Virtual_String (URI) with null record),
59-
takeFocus => LSP.Constants.True,
60-
others => <>);
58+
Message : constant LSP.Structures.ShowDocumentParams :=
59+
(uri => (VSS.Strings.Virtual_String (URI) with null record),
60+
takeFocus => LSP.Constants.True,
61+
others => <>);
6162

62-
New_Id : constant LSP.Structures.Integer_Or_Virtual_String :=
63-
Handler.Server.Allocate_Request_Id;
64-
Handler.Sender.On_ShowDocument_Request (New_Id, Message);
63+
begin
64+
if Project_File.Is_Regular_File then
65+
Handler.Sender.On_ShowDocument_Request
66+
(Handler.Server.Allocate_Request_Id, Message);
6567
else
6668
Handler.Sender.On_ShowMessage_Notification (
6769
(LSP.Enumerations.Error,

source/ada/lsp-ada_project_loading.adb

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -170,23 +170,28 @@ package body LSP.Ada_Project_Loading is
170170
use GPR2.Message;
171171
begin
172172
for Msg of GPR2_Messages loop
173-
if Msg.Level in GPR2.Message.Warning .. GPR2.Message.Error then
173+
-- Display a diagnostic only if we are dealing with an error or
174+
-- a warning, with a non-empty message attached to it.
175+
if Msg.Level in GPR2.Message.Warning .. GPR2.Message.Error
176+
and then Msg.Message /= ""
177+
then
174178
declare
175179
Sloc : constant GPR2.Source_Reference.Object :=
176180
GPR2.Message.Sloc (Msg);
177181
File : constant GPR2.Path_Name.Object :=
178-
(if Sloc.Is_Defined then
179-
GPR2.Path_Name.Create_File
180-
(GPR2.Filename_Type (Sloc.Filename))
181-
else
182-
GPR2.Path_Name.Undefined);
182+
(if Sloc.Is_Defined
183+
then
184+
GPR2.Path_Name.Create_File
185+
(GPR2.Filename_Type (Sloc.Filename))
186+
else GPR2.Path_Name.Undefined);
183187
begin
184188
-- Display a diagnostic for GPR2 messages only if the file
185189
-- attached to the message is defined.
186190
if File.Is_Defined and then File.Has_Value then
187191
Parent_Diagnostic.relatedInformation.Append
188192
(LSP.Structures.DiagnosticRelatedInformation'
189-
(location => LSP.Structures.Location'
193+
(location =>
194+
LSP.Structures.Location'
190195
(uri => LSP.Utils.To_URI (File),
191196
a_range => LSP.Utils.To_Range (Sloc),
192197
others => <>),

subprojects/libadalang.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ GPR_PROJECT_PATH.prepend = "${CRATE_ROOT}/build"
1414

1515
[[actions]]
1616
type = "pre-build"
17-
command = ["bash", "-c", "-x", "source setenv.sh; pip install -r REQUIREMENTS.dev; python manage.py generate"]
17+
command = ["bash", "-c", "-x", "source setenv.sh; pip install -rrequirements-{github,pypi}.txt && python manage.py generate"]
1818

1919
[[depends-on]]
2020
gnatcoll = "^24"
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
with Ada.Text_IO; use Ada.Text_IO;
2+
3+
procedure Show_Protected_Objects_Entries is
4+
5+
protected Obj is
6+
procedure Set (V : Integer);
7+
entry Get (V : out Integer);
8+
private
9+
Local : Integer;
10+
Is_Set : Boolean := False;
11+
end Obj;
12+
13+
protected body Obj is
14+
procedure Set (V : Integer) is
15+
begin
16+
Local := V;
17+
Is_Set := True;
18+
end Set;
19+
20+
entry Get (V : out Integer)
21+
when Is_Set is
22+
-- Entry is blocked until the
23+
-- condition is true. The barrier
24+
-- is evaluated at call of entries
25+
-- and at exits of procedures and
26+
-- entries. The calling task sleeps
27+
-- until the barrier is released.
28+
begin
29+
V := Local;
30+
Is_Set := False;
31+
end Get;
32+
end Obj;
33+
34+
N : Integer := 0;
35+
36+
task T is
37+
entry Seize;
38+
end T;
39+
40+
task body T is
41+
begin
42+
43+
accept Seize;
44+
Put_Line
45+
("Task T will delay for 4 seconds...");
46+
delay 4.0;
47+
48+
accept Seize;
49+
Put_Line
50+
("Task T will set Obj...");
51+
Obj.Set (5);
52+
53+
accept Seize;
54+
Put_Line
55+
("Task T has just set Obj...");
56+
end T;
57+
begin
58+
Put_Line
59+
("Main application will get Obj...");
60+
Obj.Get (N);
61+
62+
Put_Line
63+
("Main application has retrieved Obj...");
64+
Put_Line
65+
("Number is: " & Integer'Image (N));
66+
67+
end Show_Protected_Objects_Entries;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
project Test is
2+
end Test;

0 commit comments

Comments
 (0)