Skip to content

Commit ef66245

Browse files
Update answers so no warnings
1 parent b9ec2ab commit ef66245

File tree

24 files changed

+34
-38
lines changed

24 files changed

+34
-38
lines changed

courses/ada_essentials/070_subprograms/lab/subprograms/ada95/main.adb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ procedure Main is
2626
Length : Natural := 0;
2727

2828
procedure Add (Item : Integer) is
29-
Place : Natural := Search (List (1..Length), Item);
29+
Place : constant Natural := Search (List (1..Length), Item);
3030
begin
3131
if List (Place) /= Item then
3232
Length := Length + 1;

courses/ada_essentials/070_subprograms/lab/subprograms/answer/main.adb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ procedure Main is
2929

3030
--Main
3131
procedure Add (Item : Integer) is
32-
Place : Natural := Search (List (1..Length), Item);
32+
Place : constant Natural := Search (List (1..Length), Item);
3333
begin
3434
if List (Place) /= Item then
3535
Length := Length + 1;

courses/ada_essentials/135_visibility/lab/visibility/answer/default.gpr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
project Default is
2-
for Main use ("main.adb");
2+
for Main use ("main1.adb", "main2.adb");
33
for Source_Dirs use (".");
44
package Compiler is
55
for Switches ("ada") use ("-g","-gnata","-gnatyr","-gnatwa");

courses/ada_essentials/135_visibility/lab/visibility/answer/main1.adb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ with Triangles;
44
procedure Main1 is
55

66
use type Quads.Side_T;
7-
Q_Sides : Natural renames Quads.Number_Of_Sides;
8-
Quad : Quads.Shape_T := (1, 2, 3, 4);
7+
Q_Sides : Natural renames Quads.Number_Of_Sides;
8+
Quad : constant Quads.Shape_T := (1, 2, 3, 4);
99
Quad_Total : Quads.Side_T := 0;
1010

1111
use type Triangles.Side_T;
12-
T_Sides : Natural renames Triangles.Number_Of_Sides;
13-
Triangle : Triangles.Shape_T := (1, 2, 3);
12+
T_Sides : Natural renames Triangles.Number_Of_Sides;
13+
Triangle : constant Triangles.Shape_T := (1, 2, 3);
1414
Triangle_Total : Triangles.Side_T := 0;
1515

1616
begin

courses/ada_essentials/135_visibility/lab/visibility/answer/main2.adb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ with Triangles; use Triangles;
44
procedure Main2 is
55
function Q_Image (S : Quads.Side_T) return String
66
renames Quads.Side_T'Image;
7-
Quad : Quads.Shape_T := (1, 2, 3, 4);
7+
Quad : constant Quads.Shape_T := (1, 2, 3, 4);
88
Quad_Total : Quads.Side_T := 0;
99

1010
function T_Image (S : Triangles.Side_T) return String
1111
renames Triangles.Side_T'Image;
12-
Triangle : Triangles.Shape_T := (1, 2, 3);
12+
Triangle : constant Triangles.Shape_T := (1, 2, 3);
1313
Triangle_Total : Triangles.Side_T := 0;
1414

1515
begin

courses/ada_essentials/135_visibility/lab/visibility/prompt/default.gpr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
project Default is
2-
for Main use ("main.adb");
2+
for Main use ("main1.adb", "main2.adb");
33
for Source_Dirs use (".");
44
package Compiler is
55
for Switches ("ada") use ("-g","-gnata","-gnatyr");

courses/ada_essentials/140_access_types/lab/access_types-in_depth/answer/database_list.adb

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
--Database_List_Helpers
2-
with Interfaces;
3-
with Unchecked_Deallocation;
2+
with Ada.Unchecked_Deallocation;
43
package body Database_List is
5-
use type Database.Database_T;
64

75
function Is_Empty (List : List_T) return Boolean is
86
begin
@@ -37,7 +35,7 @@ package body Database_List is
3735
--Database_List_Substance
3836
procedure Insert (List : in out List_T;
3937
Component : Database_T) is
40-
New_Component : Linked_List_Ptr_T :=
38+
New_Component : constant Linked_List_Ptr_T :=
4139
new Linked_List_T'(Next => null, Content => Component);
4240
begin
4341
if Is_Empty (List) then
@@ -63,7 +61,7 @@ package body Database_List is
6361
-- Memory_Mgmt.Print_Info;
6462
end Insert;
6563

66-
procedure Free is new Unchecked_Deallocation
64+
procedure Free is new Ada.Unchecked_Deallocation
6765
(Linked_List_T, Linked_List_Ptr_T);
6866
procedure Delete
6967
(List : in out List_T;
@@ -77,7 +75,7 @@ package body Database_List is
7775
List.Current := List.Head;
7876
else
7977
declare
80-
Previous : Linked_List_Ptr_T := List.Head;
78+
Previous : constant Linked_List_Ptr_T := List.Head;
8179
Current : Linked_List_Ptr_T := List.Head.Next;
8280
begin
8381
while Current /= null loop

courses/ada_essentials/140_access_types/lab/access_types/ada95/main.adb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
pragma Warnings (Off, "anonymous access type");
12
with Ada.Text_IO; use Ada.Text_IO;
23
with Password_Manager; use Password_Manager;
34
procedure Main is
@@ -25,3 +26,4 @@ begin
2526
end loop;
2627

2728
end Main;
29+
pragma Warnings (On, "anonymous access type");

courses/ada_essentials/140_access_types/lab/access_types/answer/main.adb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
pragma Warnings (Off, "anonymous access type");
12
with Ada.Text_IO; use Ada.Text_IO;
23
with Password_Manager; use Password_Manager;
34
procedure Main is
@@ -22,3 +23,4 @@ begin
2223
View (Login).Count'Image);
2324
end loop;
2425
end Main;
26+
pragma Warnings (On, "anonymous access type");

courses/ada_essentials/160_genericity/lab/genericity/ada95/main.adb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ procedure Main is
77
Image => Data_Type.Image);
88

99
My_List : List.List_T;
10-
Component : Data_Type.Record_T;
1110

1211
begin
1312
List.Add (My_List, (Integer_Component => 111,

0 commit comments

Comments
 (0)