Skip to content

Commit

Permalink
Fix any violations of -gnatwj warning
Browse files Browse the repository at this point in the history
This commit fixes all uses of the obselescent syntax within Adamant from
the -gnatwj flag.
  • Loading branch information
dinkelk committed Jul 8, 2024
1 parent 49764a7 commit 9a95d8b
Show file tree
Hide file tree
Showing 167 changed files with 1,670 additions and 1,673 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package body Component.Active_Component.Implementation is
Sequence_Count => 0,
Buffer_Length => Packed_Byte.Serialization.Serialized_Length
),
Buffer => (others => 0)
Buffer => [others => 0]
);
begin
-- Set the packet data:
Expand All @@ -38,7 +38,7 @@ package body Component.Active_Component.Implementation is
Id => 0, Sequence_Count => 0,
Buffer_Length => Packed_U16.Serialization.Serialized_Length
),
Buffer => (others => 0)
Buffer => [others => 0]
);
begin
-- Set the packet data:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ package body Active_Component_Tests.Implementation is
Sequence_Count => 0,
Buffer_Length => 1
),
Buffer => (others => 0)
Buffer => [others => 0]
);
begin
-- Put some data in the component's queue:
Expand Down
2 changes: 1 addition & 1 deletion doc/example_architecture/array_representation/main.adb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ with Example_Array.Representation;

procedure Main is
-- A packed version of the type.
Packed_Type_1 : constant Example_Array.T := (11, 22, 33, 44, 55, 66, 77, 88);
Packed_Type_1 : constant Example_Array.T := [11, 22, 33, 44, 55, 66, 77, 88];
begin
-- Print the packed array to the terminal in human readable form:
Put_Line ("Human readable:");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ package body Component.Background_Component.Implementation is
Sequence_Count => 0,
Buffer_Length => 2
),
Buffer => (others => 0)
Buffer => [others => 0]
);
begin
-- Set the packet data:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ private
-- Fetch the data.
function Get_Data return Two_Byte_Array;
private
Data : Basic_Types.Byte_Array (0 .. 1) := (0, 0);
Data : Basic_Types.Byte_Array (0 .. 1) := [0, 0];
end Protected_Data;

-- The component class instance record:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ package body Background_Component_Tests.Implementation is
Sequence_Count => 0,
Buffer_Length => 2
),
Buffer => (others => 0)
Buffer => [others => 0]
);
begin
-- Put some data in the component's queue:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ package body Component.Example_Component.Implementation is
Sequence_Count => 0,
Buffer_Length => 1 -- We are using 1 byte of data.
),
Buffer => (others => 0)
Buffer => [others => 0]
);
begin
-- Set the packet data:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ package body Example_Component_Tests.Implementation is
Sequence_Count => 0,
Buffer_Length => 1
),
Buffer => (others => 0)
Buffer => [others => 0]
);
begin
-- Send the example component a tick:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ package body Example_Component_Tests.Implementation is
Sequence_Count => 0,
Buffer_Length => 1
),
Buffer => (others => 0)
Buffer => [others => 0]
);
begin
-- Send the example component a tick:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ package body Example_Component_Tests.Implementation is
Sequence_Count => 0,
Buffer_Length => 1
),
Buffer => (others => 0)
Buffer => [others => 0]
);
begin
-- Send the example component a tick:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ package body Example_Component_Tests.Implementation is
Sequence_Count => 0,
Buffer_Length => 1
),
Buffer => (others => 0)
Buffer => [others => 0]
);
begin
-- Send the example component a tick:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ package body Example_Component_Tests.Implementation is
Sequence_Count => 0,
Buffer_Length => 1
),
Buffer => (others => 0)
Buffer => [others => 0]
);
begin
-- Send the example component a tick:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ package body Component.Initialized_Component.Implementation is
-- Other computations can be performed here too!
-- Let's set the packet data to 5 + the packets_Per_Tick
Self.Pkt.Header.Buffer_Length := 7;
Self.Pkt.Buffer := (others => 5 + Unsigned_8 (Self.Packets_Per_Tick));
Self.Pkt.Buffer := [others => 5 + Unsigned_8 (Self.Packets_Per_Tick)];
end Init;

---------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ package body Packet_Component_Tests.Implementation is

-- Make sure 2 Counter packets were sent:
Natural_Assert.Eq (Self.Tester.Counter_History.Get_Count, 2);
Byte_Array_Assert.Eq (Self.Tester.Counter_History.Get (1).Buffer (0 .. 1), (0, 0));
Byte_Array_Assert.Eq (Self.Tester.Counter_History.Get (2).Buffer (0 .. 1), (0, 1));
Byte_Array_Assert.Eq (Self.Tester.Counter_History.Get (1).Buffer (0 .. 1), [0, 0]);
Byte_Array_Assert.Eq (Self.Tester.Counter_History.Get (2).Buffer (0 .. 1), [0, 1]);

-- Make sure 2 Last_Tick_Received packets were sent:
Natural_Assert.Eq (Self.Tester.Last_Tick_Received_History.Get_Count, 2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ package body Component.Parameter_Component.Implementation.Tester is
not overriding function Fetch_Parameter (Self : in out Instance; Id : in Parameter_Types.Parameter_Id; Par : out Parameter.T) return Parameter_Update_Status.E is
use Parameter_Enums.Parameter_Update_Status;
use Parameter_Enums.Parameter_Operation_Type;
Param_Update : Parameter_Update.T := (Operation => Fetch, Status => Success, Param => (Header => (Id => Id, Buffer_Length => 0), Buffer => (others => 0)));
Param_Update : Parameter_Update.T := (Operation => Fetch, Status => Success, Param => (Header => (Id => Id, Buffer_Length => 0), Buffer => [others => 0]));
begin
-- Set the ID to fetch:
Param_Update.Param.Header.Id := Id;
Expand All @@ -44,7 +44,7 @@ package body Component.Parameter_Component.Implementation.Tester is
not overriding function Update_Parameters (Self : in out Instance) return Parameter_Update_Status.E is
use Parameter_Enums.Parameter_Update_Status;
use Parameter_Enums.Parameter_Operation_Type;
Param_Update : Parameter_Update.T := (Operation => Update, Status => Success, Param => ((0, 0), (others => 0)));
Param_Update : Parameter_Update.T := (Operation => Update, Status => Success, Param => ((0, 0), [others => 0]));
begin
Self.Parameter_Update_T_Provide (Param_Update);
return Param_Update.Status;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ package body Component.Queued_Component.Implementation is
Sequence_Count => 0,
Buffer_Length => Self.Data_Length
),
Buffer => (others => 0)
Buffer => [others => 0]
);
begin
-- Set the packet data:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ private
-- The length of the packet data to send out:
Data_Length : Packet_Buffer_Length_Type := 0;
-- The content of the packet data to send out:
Data : Basic_Types.Byte_Array (0 .. 1) := (0, 0);
Data : Basic_Types.Byte_Array (0 .. 1) := [0, 0];
end record;

---------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ package body Queued_Component_Tests.Implementation is
Sequence_Count => 0,
Buffer_Length => 1
),
Buffer => (others => 0)
Buffer => [others => 0]
);
begin
-- Put some data in the component's queue:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ package body Queued_Component_Tests.Implementation is
Sequence_Count => 0,
Buffer_Length => 1
),
Buffer => (others => 0)
Buffer => [others => 0]
);
begin
-- Put some data in the component's queue:
Expand Down
2 changes: 1 addition & 1 deletion doc/example_architecture/record_validation/main.adb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ procedure Main is
-- A packed version of the type.
Packed_Type_1 : constant Example_Record.T := (Value_1 => 2, Value_2 => -1, Value_3 => Green, Value_4 => 0.5);
-- Deserialize a byte array of all 0xFF into the record.
Packed_Type_2 : constant Example_Record.T := Example_Record.Serialization.From_Byte_Array ((255, 255, 255, 255, 255, 255));
Packed_Type_2 : constant Example_Record.T := Example_Record.Serialization.From_Byte_Array ([255, 255, 255, 255, 255, 255]);
Errant_Field : Unsigned_32 := 0;
begin
if Example_Record.Validation.Valid (Packed_Type_1, Errant_Field) then
Expand Down
18 changes: 9 additions & 9 deletions gen/templates/assembly/name.ads
Original file line number Diff line number Diff line change
Expand Up @@ -118,49 +118,49 @@ package {{ name }} is

{% endfor %}
-- List of task infos for all tasks:
Task_List : aliased Task_Types.Task_Info_List := (
Task_List : aliased Task_Types.Task_Info_List := [
{% for task in task_list %}
-- {{ task.component_name }}.{{ task.name }}:
{{ task.number }} => {{ task.component_name }}_{{ task.name }}_Task_Info'Access{{ "," if not loop.last }}
{% endfor %}
);
];

{% else %}
-- List of task infos for all tasks:
Task_List : aliased Task_Types.Task_Info_List := (1 .. 0 => null); -- empty
Task_List : aliased Task_Types.Task_Info_List := [1 .. 0 => null]; -- empty

{% endif %}
{% if interrupt_list %}
-- Remove some reference style checking to deal with incorrect capitalization in system packages.
pragma Style_Checks ("-rn");

-- List of all interrupts used in the system:
Interrupt_List : aliased Interrupt_Types.Interrupt_Id_List := (
Interrupt_List : aliased Interrupt_Types.Interrupt_Id_List := [
{% for interrupt in interrupt_list %}
-- {{ interrupt.component_name }}.{{ interrupt.name }}:
{{ loop.index0 }} => {{ interrupt.id }}{{ "," if not loop.last }}
{% endfor %}
);
];

-- Remove some reference style checking to deal with incorrect capitalization in system packages.
pragma Style_Checks ("+rn");

{% else %}
-- List of all interrupts used in the system:
Interrupt_List : aliased Interrupt_Types.Interrupt_Id_List := (1 .. 0 => 0); -- empty
Interrupt_List : aliased Interrupt_Types.Interrupt_Id_List := [1 .. 0 => 0]; -- empty

{% endif %}
{% if component_kind_dict["queued"] %}
-- List of all components with positive queue sizes in the system:
Queued_Component_List : aliased Component.Component_List := (
Queued_Component_List : aliased Component.Component_List := [
{% for component in component_kind_dict["queued"] %}
{{ loop.index0 }} => {{ component.instance_name }}'Access{{ "," if not loop.last }}
{% endfor %}
);
];

{% else %}
-- List of all components with positive queue sizes in the system:
Queued_Component_List : aliased Component.Component_List := (1 .. 0 => null); -- empty
Queued_Component_List : aliased Component.Component_List := [1 .. 0 => null]; -- empty

{% endif %}
end {{ name }};
6 changes: 3 additions & 3 deletions gen/templates/commands/name_commands.adb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ package body {{ name }} is
pragma Annotate (CodePeer, False_Positive, "dead code",
"Some CodePeer can prove the Len can never be too large so this code does not execute. This is OK.");
end if;
Cmd := (Header => (Source_Id => Self.Source_Id, Id => Self.Get_{{ command.name }}_Id, Arg_Buffer_Length => Len), Arg_Buffer => (others => 0));
Cmd := (Header => (Source_Id => Self.Source_Id, Id => Self.Get_{{ command.name }}_Id, Arg_Buffer_Length => Len), Arg_Buffer => [others => 0]);

-- Serialize the argument onto the buffer:
Stat := {{ command.type_package }}.Serialization.To_Byte_Array (Cmd.Arg_Buffer, Arg, Ignore);
Expand All @@ -94,9 +94,9 @@ package body {{ name }} is
{% else %}
package Arg_Serializer is new Serializer ({{ command.type }});
{% endif %}
Cmd : {% if not command.type %}constant {% endif %}Command.T := (Header => (Source_Id => Self.Source_Id, Id => Self.Get_{{ command.name }}_Id, Arg_Buffer_Length => Arg_Serializer.Serialized_Length), Arg_Buffer => (others => 0));
Cmd : {% if not command.type %}constant {% endif %}Command.T := (Header => (Source_Id => Self.Source_Id, Id => Self.Get_{{ command.name }}_Id, Arg_Buffer_Length => Arg_Serializer.Serialized_Length), Arg_Buffer => [others => 0]);
{% else %}
Cmd : {% if not command.type %}constant {% endif %}Command.T := (Header => (Source_Id => Self.Source_Id, Id => Self.Get_{{ command.name }}_Id, Arg_Buffer_Length => 0), Arg_Buffer => (others => 0));
Cmd : {% if not command.type %}constant {% endif %}Command.T := (Header => (Source_Id => Self.Source_Id, Id => Self.Get_{{ command.name }}_Id, Arg_Buffer_Length => 0), Arg_Buffer => [others => 0]);
{% endif %}
begin
{% if command.type %}
Expand Down
12 changes: 6 additions & 6 deletions gen/templates/component/component-name.adb
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ package body Component.{{ name }} is
else
-- Id is not valid for component, so call the invalid command handler and return the the error status:
declare
P_Type : Basic_Types.Poly_Type := (others => 0);
P_Type : Basic_Types.Poly_Type := [others => 0];
begin
-- Copy id into poly type:
Byte_Array_Util.Safe_Right_Copy (P_Type, Command_Id.Serialization.To_Byte_Array ((Id => Cmd.Header.Id)));
Expand Down Expand Up @@ -807,7 +807,7 @@ package body Component.{{ name }} is
end Register_Commands;

not overriding procedure Handle_Command_Length_Error (Self : in out Base_Instance; Cmd : in Command.T) is
P_Type : Basic_Types.Poly_Type := (others => 0);
P_Type : Basic_Types.Poly_Type := [others => 0];
begin
-- Copy length into poly type:
Byte_Array_Util.Safe_Right_Copy (P_Type, Command_Arg_Buffer_Length.Serialization.To_Byte_Array ((Arg_Buffer_Length => Cmd.Header.Arg_Buffer_Length)));
Expand Down Expand Up @@ -881,7 +881,7 @@ package body Component.{{ name }} is
{% if command.type_model %}
P_Type : constant Basic_Types.Poly_Type := {{ command.type_package }}.Validation.Get_Field (Args, Errant_Field);
{% else %}
P_Type : Basic_Types.Poly_Type := (others => 0);
P_Type : Basic_Types.Poly_Type := [others => 0];
{% endif %}
begin
{% if not command.type_model %}
Expand Down Expand Up @@ -980,7 +980,7 @@ package body Component.{{ name }} is
else
-- Id is not valid for component, so call the invalid parameter handler and return the the error status:
declare
P_Type : Basic_Types.Poly_Type := (others => 0);
P_Type : Basic_Types.Poly_Type := [others => 0];
begin
-- Copy id into poly type:
Byte_Array_Util.Safe_Right_Copy (P_Type, Parameter_Id.Serialization.To_Byte_Array ((Id => Par.Header.Id)));
Expand All @@ -992,7 +992,7 @@ package body Component.{{ name }} is
end Stage_Parameter;

not overriding procedure Handle_Parameter_Length_Error (Self : in out Base_Instance; Par : in Parameter.T) is
P_Type : Basic_Types.Poly_Type := (others => 0);
P_Type : Basic_Types.Poly_Type := [others => 0];
begin
-- Copy length into poly type:
Byte_Array_Util.Safe_Right_Copy (P_Type, Parameter_Buffer_Length.Serialization.To_Byte_Array ((Buffer_Length => Par.Header.Buffer_Length)));
Expand Down Expand Up @@ -1041,7 +1041,7 @@ package body Component.{{ name }} is
{% if par.type_model %}
P_Type : constant Basic_Types.Poly_Type := {{ par.type_package }}.Validation.Get_Field (Par_To_Stage, Errant_Field);
{% else %}
P_Type : Basic_Types.Poly_Type := (others => 0);
P_Type : Basic_Types.Poly_Type := [others => 0];
{% endif %}
begin
{% if not par.type_model %}
Expand Down
16 changes: 8 additions & 8 deletions gen/templates/component/component-name.ads
Original file line number Diff line number Diff line change
Expand Up @@ -424,12 +424,12 @@ private
-- Procedure lookup table for dispatching to correct connector handler:
type Dispatch_Procedure is not null access procedure (Self : in out Base_Instance;{% if connectors.arrayed_invokee() %} Index : in Connector_Index_Type;{% endif %} Bytes : in Basic_Types.Byte_Array);
type Dispatch_Table_T is array (Connector_Identifier_Enum) of Dispatch_Procedure;
Dispatch_Table : constant Dispatch_Table_T := (
Dispatch_Table : constant Dispatch_Table_T := [
Quit => Dispatch_Quit'Access,
{% for connector in connectors.of_kind('recv_async') %}
{{ connector.name }} => Dispatch_{{ connector.name }}'Access{{ "," if not loop.last }}
{% endfor %}
);
];

---------------------------------------
-- Private methods for a component queue
Expand Down Expand Up @@ -546,11 +546,11 @@ private
-- Procedure lookup table for dispatching to correct command handler:
type Execute_Function is not null access function (Self : in out Base_Instance; Cmd : in Command.T) return Command_Response_Status.E;
type Command_Table_T is array ({{ commands.name }}.Local_Command_Id_Type) of Execute_Function;
Command_Id_Table : constant Command_Table_T := (
Command_Id_Table : constant Command_Table_T := [
{% for command in commands %}
{{ commands.name }}.{{ command.name }}_Id => Execute_{{ command.name }}'Access{{ "," if not loop.last }}
{% endfor %}
);
];

{% endif %}
{% if parameters %}
Expand Down Expand Up @@ -585,20 +585,20 @@ private
-- Procedure lookup table for dispatching to parameter stage handler:
type Stage_Function is not null access function (Self : in out Base_Instance; Par : in Parameter.T) return Parameter_Update_Status.E;
type Parameter_Table_T is array ({{ parameters.name }}.Local_Parameter_Id_Type) of Stage_Function;
Parameter_Id_Table : constant Parameter_Table_T := (
Parameter_Id_Table : constant Parameter_Table_T := [
{% for par in parameters %}
{{ parameters.name }}.{{ par.name }}_Id => Stage_{{ par.name }}'Access{{ "," if not loop.last }}
{% endfor %}
);
];

-- Procedure lookup table for dispatching to parameter fetch handler:
type Fetch_Function is not null access function (Self : in out Base_Instance; Par : in out Parameter.T) return Parameter_Update_Status.E;
type Parameter_Fetch_Table_T is array ({{ parameters.name }}.Local_Parameter_Id_Type) of Fetch_Function;
Parameter_Id_Fetch_Table : constant Parameter_Fetch_Table_T := (
Parameter_Id_Fetch_Table : constant Parameter_Fetch_Table_T := [
{% for par in parameters %}
{{ parameters.name }}.{{ par.name }}_Id => Fetch_{{ par.name }}'Access{{ "," if not loop.last }}
{% endfor %}
);
];

-- A protected object is used to store the component's staged parameters. This is because
-- the staged parameters are accessed by both the execution thread of the component and the
Expand Down
2 changes: 1 addition & 1 deletion gen/templates/data_products/name_data_products.adb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ package body {{ name }} is
{% else %}
package Data_Product_Serializer is new Serializer ({{ dp.type }});
{% endif %}
Dp : Data_Product.T := (Header => (Id => Self.Get_{{ dp.name }}_Id, Time => Timestamp, Buffer_Length => Data_Product_Serializer.Serialized_Length), Buffer => (others => 0));
Dp : Data_Product.T := (Header => (Id => Self.Get_{{ dp.name }}_Id, Time => Timestamp, Buffer_Length => Data_Product_Serializer.Serialized_Length), Buffer => [others => 0]);
begin
Dp.Buffer (Dp.Buffer'First .. Dp.Buffer'First + Data_Product_Serializer.Serialized_Length - 1) := Data_Product_Serializer.To_Byte_Array (Item);
return Dp;
Expand Down
Loading

0 comments on commit 9a95d8b

Please sign in to comment.