Skip to content

Commit 5a5d4d7

Browse files
committed
U224-018 Disable ASCII package as obsolescent
1 parent c7d298a commit 5a5d4d7

File tree

10 files changed

+49
-25
lines changed

10 files changed

+49
-25
lines changed

gnat/gnat.adc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pragma Restrictions (No_Obsolescent_Features);

gnat/lsp.gpr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ project LSP is
9494

9595
package Compiler is
9696
for Default_Switches ("Ada") use Ada_Switches;
97+
for Local_Configuration_Pragmas use "gnat.adc";
9798
end Compiler;
9899

99100
package Naming is

gnat/lsp_server.gpr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ project LSP_Server is
4747
for Switches ("lsp-ada_driver.adb") use
4848
LSP.Ada_Switches & ("-gnateDVERSION=""" & VERSION & """");
4949
for Switches ("s-memory.adb") use ("-g", "-O2", "-gnatpg");
50+
for Local_Configuration_Pragmas use "gnat.adc";
5051
end Compiler;
5152

5253
package Linker is

source/ada/lsp-ada_driver.adb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
--
1818
-- This is driver to run LSP server for Ada language.
1919

20+
with Ada.Characters.Latin_1;
2021
with Ada.Text_IO;
2122
with Ada.Exceptions; use Ada.Exceptions;
2223
with GNAT.Command_Line; use GNAT.Command_Line;
@@ -106,7 +107,8 @@ procedure LSP.Ada_Driver is
106107
procedure On_Uncaught_Exception (E : Exception_Occurrence) is
107108
begin
108109
Trace (Server_Trace,
109-
"EXCEPTION: " & Exception_Name (E) & ASCII.LF &
110+
"EXCEPTION: " & Exception_Name (E) &
111+
Ada.Characters.Latin_1.LF &
110112
Symbolic_Traceback (E));
111113
Handler.Handle_Error;
112114
end On_Uncaught_Exception;
@@ -118,7 +120,8 @@ procedure LSP.Ada_Driver is
118120
procedure Die_On_Uncaught (E : Exception_Occurrence) is
119121
begin
120122
Trace (Server_Trace,
121-
"EXCEPTION: " & Exception_Name (E) & ASCII.LF &
123+
"EXCEPTION: " & Exception_Name (E) &
124+
Ada.Characters.Latin_1.LF &
122125
Symbolic_Traceback (E));
123126
-- An exception occurred while fuzzing: make it fatal.
124127
GNAT.OS_Lib.OS_Exit (42);

source/ada/lsp-ada_handlers.adb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2971,19 +2971,19 @@ package body LSP.Ada_Handlers is
29712971
(Is_Error => True)
29722972
do
29732973
declare
2974-
Error_Message : VSS.Strings.Virtual_String;
2974+
Error_Message : VSS.String_Vectors.Virtual_String_Vector;
29752975

29762976
begin
29772977
for Problem of Refs.Problems loop
29782978
Error_Message.Append
29792979
(VSS.Strings.Conversions.To_Virtual_String
2980-
(Problem.Info & ASCII.LF));
2980+
(Problem.Info));
29812981
end loop;
29822982

29832983
Response.error :=
29842984
(True,
29852985
(code => LSP.Errors.InvalidRequest,
2986-
message => Error_Message,
2986+
message => Error_Message.Join_Lines (VSS.Strings.LF),
29872987
data => Empty));
29882988
end;
29892989
end return;

source/ada/lsp-common.adb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
-- of the license. --
1616
------------------------------------------------------------------------------
1717

18+
with Ada.Characters.Latin_1;
1819
with Ada.Exceptions; use Ada.Exceptions;
1920
with GNAT.Expect.TTY;
2021
with GNAT.Traceback.Symbolic; use GNAT.Traceback.Symbolic;
@@ -110,7 +111,7 @@ package body LSP.Common is
110111
end if;
111112

112113
Trace.Trace (Exception_Name (E) & ": " & Exception_Message (E)
113-
& ASCII.LF & Symbolic_Traceback (E));
114+
& Ada.Characters.Latin_1.LF & Symbolic_Traceback (E));
114115
end Log;
115116

116117
----------------

source/ada/lsp-fuzz_decorators.adb

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
with Ada.Characters.Wide_Latin_1; use Ada.Characters.Wide_Latin_1;
1919
with Ada.Containers.Hashed_Maps;
2020

21+
with VSS.String_Vectors;
2122
with VSS.Strings.Conversions;
2223
with VSS.Unicode;
2324

@@ -180,13 +181,22 @@ package body LSP.Fuzz_Decorators is
180181
if Self.Doc_Provider.Get_Open_Document (Value.textDocument.uri).Text
181182
/= LSP.Types.To_Virtual_String (Doc_Content)
182183
then
183-
Self.Trace.Trace
184-
(VSS.Strings.Conversions.To_UTF_8_String
185-
(Self.Doc_Provider.Get_Open_Document
186-
(Value.textDocument.uri).Text) &
187-
ASCII.LF & " /= " & ASCII.LF &
188-
To_UTF_8_String (Doc_Content));
189-
raise Program_Error with "document content inconsistency";
184+
declare
185+
Vector : VSS.String_Vectors.Virtual_String_Vector;
186+
begin
187+
Vector.Append
188+
(Self.Doc_Provider.Get_Open_Document (Value.textDocument.uri)
189+
.Text);
190+
191+
Vector.Append (" /= ");
192+
Vector.Append (LSP.Types.To_Virtual_String (Doc_Content));
193+
194+
Self.Trace.Trace
195+
(VSS.Strings.Conversions.To_UTF_8_String
196+
(Vector.Join_Lines (VSS.Strings.LF)));
197+
198+
raise Program_Error with "document content inconsistency";
199+
end;
190200
end if;
191201
end On_DidChangeTextDocument_Notification;
192202

source/memory/lsp-memory_statistics.adb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
-- of the license. --
1616
------------------------------------------------------------------------------
1717

18+
with Ada.Characters.Latin_1;
1819
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
1920
with GNAT.Regpat; use GNAT.Regpat;
2021
with GNAT.Traceback.Symbolic; use GNAT.Traceback.Symbolic;
@@ -34,7 +35,9 @@ package body LSP.Memory_Statistics is
3435
is
3536
Buffer : Unbounded_String := To_Unbounded_String
3637
("Dump_Memory_Statistics at 0x" &
37-
System.Address_Image (Dump_Memory_Statistics'Address) & ASCII.LF);
38+
System.Address_Image (Dump_Memory_Statistics'Address) &
39+
Ada.Characters.Latin_1.LF);
40+
3841
Traceback_Regexp : constant Pattern_Matcher :=
3942
Compile ("\s0x0+([0-9a-zA-Z]+)");
4043

@@ -84,7 +87,7 @@ package body LSP.Memory_Statistics is
8487

8588
procedure Trace_Put_Line (S : String) is
8689
begin
87-
Append (Buffer, S & ASCII.LF);
90+
Append (Buffer, S & Ada.Characters.Latin_1.LF);
8891
end Trace_Put_Line;
8992

9093
procedure Internal is new GNATCOLL.Memory.Redirectable_Dump

source/server/lsp-message_loggers.adb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
-- of the license. --
1616
------------------------------------------------------------------------------
1717

18+
with Ada.Characters.Latin_1;
1819
with Ada.Containers;
1920
with Ada.Strings.Unbounded;
2021

@@ -571,8 +572,9 @@ package body LSP.Message_Loggers is
571572
Change.a_type'Wide_Image & ";");
572573
end loop;
573574

574-
Self.Trace.Trace ("DidChangeWatchedFiles_Notification:"
575-
& ASCII.LF & To_UTF_8_String (Result));
575+
Self.Trace.Trace
576+
("DidChangeWatchedFiles_Notification:"
577+
& Ada.Characters.Latin_1.LF & To_UTF_8_String (Result));
576578
end On_DidChangeWatchedFiles_Notification;
577579

578580
-------------------------------------------

source/server/lsp-servers.adb

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ package body LSP.Servers is
4545
New_Line : constant String :=
4646
(Ada.Characters.Latin_1.CR, Ada.Characters.Latin_1.LF);
4747

48+
Line_Feed : constant Character := Ada.Characters.Latin_1.LF;
49+
4850
function "+" (Text : Ada.Strings.UTF_Encoding.UTF_8_String)
4951
return LSP.Types.LSP_String renames
5052
LSP.Types.To_LSP_String;
@@ -595,7 +597,7 @@ package body LSP.Servers is
595597
-- Catch-all case: make sure no exception in output writing
596598
-- can cause an exit of the task loop.
597599
Self.Server_Trace.Trace
598-
("Exception when reading input:" & ASCII.LF
600+
("Exception when reading input:" & Line_Feed
599601
& Exception_Name (E) & " - " & Exception_Message (E));
600602
Self.Server_Trace.Trace (Symbolic_Traceback (E));
601603
end Process_One_Message;
@@ -770,7 +772,7 @@ package body LSP.Servers is
770772
Code : LSP.Messages.ErrorCodes := LSP.Errors.InternalError)
771773
is
772774
Exception_Text : constant String :=
773-
Exception_Name (E) & ASCII.LF & Symbolic_Traceback (E);
775+
Exception_Name (E) & Line_Feed & Symbolic_Traceback (E);
774776
Response : Response_Access :=
775777
new LSP.Messages.ResponseMessage'
776778
(Is_Error => True,
@@ -791,8 +793,8 @@ package body LSP.Servers is
791793

792794
-- Log details in the traces
793795
Self.Server_Trace.Trace
794-
("Exception when processing request:" & ASCII.LF
795-
& Trace_Text & ASCII.LF
796+
("Exception when processing request:" & Line_Feed
797+
& Trace_Text & Line_Feed
796798
& Exception_Text);
797799
end Send_Exception_Response;
798800

@@ -1072,8 +1074,8 @@ package body LSP.Servers is
10721074
-- Catch-all case: make sure no exception in output writing
10731075
-- can cause an exit of the task loop.
10741076
Server.Server_Trace.Trace
1075-
("Exception when writing output:" & ASCII.LF
1076-
-- & To_String (Output) & ASCII.LF
1077+
("Exception when writing output:" & Line_Feed
1078+
-- & To_String (Output) & Line_Feed
10771079
& Exception_Name (E) & " - " & Exception_Message (E));
10781080
Server.Server_Trace.Trace (Symbolic_Traceback (E));
10791081

@@ -1154,8 +1156,8 @@ package body LSP.Servers is
11541156
when E : others =>
11551157
-- Always log an exception in the traces
11561158
Server.Server_Trace.Trace
1157-
("Exception (processing notification):" & ASCII.LF
1158-
& Exception_Name (E) & ASCII.LF &
1159+
("Exception (processing notification):" & Line_Feed
1160+
& Exception_Name (E) & Line_Feed &
11591161
Symbolic_Traceback (E));
11601162
end;
11611163

0 commit comments

Comments
 (0)