Skip to content

Commit 665ae70

Browse files
committed
minor: Cleanup dot notation usages in 'gnatcheck-diagnoses.adb'
1 parent c70ca6d commit 665ae70

File tree

1 file changed

+39
-57
lines changed

1 file changed

+39
-57
lines changed

lkql_checker/src/gnatcheck-diagnoses.adb

Lines changed: 39 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -588,10 +588,11 @@ package body Gnatcheck.Diagnoses is
588588
(SF : SF_Id;
589589
Unit : LAL.Analysis.Analysis_Unit)
590590
is
591-
Sloc : constant Source_Location := End_Sloc (Unit.Root.Sloc_Range);
592591
use Parametrized_Exemption_Sections;
593592

594-
Next_Section : Parametrized_Exemption_Sections.Cursor;
593+
Sloc : constant Source_Location :=
594+
End_Sloc (Unit.Root.Sloc_Range);
595+
Next_Section : Cursor;
595596
Id : Exemption_Id;
596597
To_Turn_Off : Exemption_Id_Vec.Vector;
597598
begin
@@ -633,15 +634,14 @@ package body Gnatcheck.Diagnoses is
633634
Store_Diagnosis
634635
(Full_File_Name => Short_Source_Name (SF),
635636
Sloc =>
636-
(Line_Number (Parametrized_Exemption_Sections.Element
637-
(Next_Section).Exempt_Info.Line_Start),
638-
Column_Number (Parametrized_Exemption_Sections.Element
639-
(Next_Section).Exempt_Info.Col_Start)),
637+
(Line_Number
638+
(Element (Next_Section).Exempt_Info.Line_Start),
639+
Column_Number
640+
(Element (Next_Section).Exempt_Info.Col_Start)),
640641
Message =>
641642
"no matching 'exempt_OFF' annotation for " &
642643
To_String
643-
(Parametrized_Exemption_Sections.Element
644-
(Next_Section).Exempt_Info.Exempted_Name),
644+
(Element (Next_Section).Exempt_Info.Exempted_Name),
645645
Diagnosis_Kind => Exemption_Warning,
646646
SF => SF);
647647
Turn_Off_Parametrized_Exemption (Id, Next_Section, Sloc, SF);
@@ -695,9 +695,7 @@ package body Gnatcheck.Diagnoses is
695695
end Count_Diagnoses;
696696

697697
begin
698-
Error_Messages_Storage.Iterate
699-
(Container => All_Error_Messages,
700-
Process => Count_Diagnoses'Access);
698+
All_Error_Messages.Iterate (Count_Diagnoses'Access);
701699

702700
for SF in First_SF_Id .. Last_Argument_Source loop
703701
if Source_Status (SF) in Not_A_Legal_Source | Error_Detected then
@@ -1042,10 +1040,8 @@ package body Gnatcheck.Diagnoses is
10421040
is
10431041
use Parametrized_Exemption_Sections;
10441042

1045-
Result : Parametrized_Exemption_Sections.Cursor
1046-
:= Parametrized_Exemption_Sections.No_Element;
1047-
Next_Section : Parametrized_Exemption_Sections.Cursor
1048-
:= First (Exem_Sections);
1043+
Result : Cursor := No_Element;
1044+
Next_Section : Cursor := First (Exem_Sections);
10491045

10501046
Diag_In_Section : Boolean := True;
10511047
Diag_Before_Sections : Boolean := False;
@@ -1055,8 +1051,7 @@ package body Gnatcheck.Diagnoses is
10551051
Next_Section_El : Parametrized_Exemption_Info;
10561052
begin
10571053
while Has_Element (Next_Section) loop
1058-
Next_Section_El :=
1059-
Parametrized_Exemption_Sections.Element (Next_Section);
1054+
Next_Section_El := Element (Next_Section);
10601055

10611056
Diag_Before_Sections :=
10621057
Line < Next_Section_El.Exempt_Info.Line_Start
@@ -1129,7 +1124,7 @@ package body Gnatcheck.Diagnoses is
11291124
use Parametrized_Exemption_Sections;
11301125

11311126
Id : constant Exemption_Id := Find_Exemption_Id (Name);
1132-
Matching_Section : Parametrized_Exemption_Sections.Cursor;
1127+
Matching_Section : Cursor;
11331128
begin
11341129
-- Check if the given name is exempted at the given location with the
11351130
-- given params.
@@ -1146,8 +1141,7 @@ package body Gnatcheck.Diagnoses is
11461141

11471142
if Has_Element (Matching_Section) then
11481143
Increase_Diag_Counter (Exem_Sections, Matching_Section);
1149-
return Parametrized_Exemption_Sections.Element
1150-
(Matching_Section).Exempt_Info.Justification;
1144+
return Element (Matching_Section).Exempt_Info.Justification;
11511145
end if;
11521146
end if;
11531147
end;
@@ -1194,8 +1188,7 @@ package body Gnatcheck.Diagnoses is
11941188
Next_Section := First (Rule_Param_Exempt_Sections (Id));
11951189

11961190
while Has_Element (Next_Section) loop
1197-
if Params = Parametrized_Exemption_Sections.Element
1198-
(Next_Section).Params
1191+
if Params = Element (Next_Section).Params
11991192
then
12001193
return Next_Section;
12011194
end if;
@@ -1505,9 +1498,7 @@ package body Gnatcheck.Diagnoses is
15051498
end Print_Specified_Diagnoses;
15061499

15071500
begin
1508-
Error_Messages_Storage.Iterate
1509-
(Container => All_Error_Messages,
1510-
Process => Print_Specified_Diagnoses'Access);
1501+
All_Error_Messages.Iterate (Print_Specified_Diagnoses'Access);
15111502
end Print_Diagnoses;
15121503

15131504
--------------------------
@@ -1751,9 +1742,7 @@ package body Gnatcheck.Diagnoses is
17511742
end Counted_Print_Diagnosis;
17521743

17531744
begin
1754-
Error_Messages_Storage.Iterate
1755-
(Container => All_Error_Messages,
1756-
Process => Counted_Print_Diagnosis'Access);
1745+
All_Error_Messages.Iterate (Counted_Print_Diagnosis'Access);
17571746
end Print_Out_Diagnoses;
17581747

17591748
-------------------------
@@ -1960,7 +1949,7 @@ package body Gnatcheck.Diagnoses is
19601949
Id : constant Exemption_Id := Find_Exemption_Id (Exempted_Name);
19611950
R_Id : constant Exemption_Id := Find_Exemption_Id (R_Name);
19621951

1963-
Exempted_At : Parametrized_Exemption_Sections.Cursor;
1952+
Exempted_At : Cursor;
19641953
Action : Exempt_Action := Self;
19651954
Param : Unbounded_String;
19661955

@@ -2186,8 +2175,7 @@ package body Gnatcheck.Diagnoses is
21862175
-- for this rule and this parameter(s). So we can just add the
21872176
-- corresponding record to Rule_Param_Exempt_Sections:
21882177
if not Rule_Param_Exempt_Sections.Contains (Id) then
2189-
Rule_Param_Exempt_Sections.Insert
2190-
(Id, Parametrized_Exemption_Sections.Empty);
2178+
Rule_Param_Exempt_Sections.Insert (Id, Empty);
21912179
end if;
21922180
Insert
21932181
(Rule_Param_Exempt_Sections (Id),
@@ -2450,10 +2438,11 @@ package body Gnatcheck.Diagnoses is
24502438
----------------------------------
24512439

24522440
procedure Process_Postponed_Exemptions is
2441+
use Parametrized_Exemption_Sections;
2442+
24532443
Next_Postponed_Section : Postponed_Rule_Exemption_Info_Access;
24542444
Current_Exemption : Exemption_Id;
2455-
Next_Post_Param_Section : Parametrized_Exemption_Sections.Cursor;
2456-
use Parametrized_Exemption_Sections;
2445+
Next_Post_Param_Section : Cursor;
24572446

24582447
Next_Par_S_Info : Parametrized_Exemption_Info;
24592448

@@ -2544,19 +2533,14 @@ package body Gnatcheck.Diagnoses is
25442533
end if;
25452534

25462535
if Is_Exempted then
2547-
Error_Messages_Storage.Replace_Element
2548-
(Container => All_Error_Messages,
2549-
Position => Position,
2550-
New_Item => Diag);
2536+
All_Error_Messages.Replace_Element (Position, Diag);
25512537
end if;
25522538
end Map_Diagnosis;
25532539

25542540
-- Start of processing for Process_Postponed_Exemptions
25552541

25562542
begin
2557-
Error_Messages_Storage.Iterate
2558-
(Container => All_Error_Messages,
2559-
Process => Map_Diagnosis'Access);
2543+
All_Error_Messages.Iterate (Map_Diagnosis'Access);
25602544

25612545
-- Now, iterate through the stored exemption and generate exemption
25622546
-- warnings for those of them for which no exempted diagnoses are found.
@@ -2604,8 +2588,7 @@ package body Gnatcheck.Diagnoses is
26042588
(Postponed_Param_Exempt_Sections (Current_Exemption) (SF));
26052589

26062590
while Has_Element (Next_Post_Param_Section) loop
2607-
Next_Par_S_Info := Parametrized_Exemption_Sections.Element
2608-
(Next_Post_Param_Section);
2591+
Next_Par_S_Info := Element (Next_Post_Param_Section);
26092592

26102593
if Next_Par_S_Info.Exempt_Info.Detected = 0 then
26112594
Store_Diagnosis
@@ -2677,29 +2660,31 @@ package body Gnatcheck.Diagnoses is
26772660
(Id : Exemption_Id;
26782661
Params : Exemption_Parameters.Set;
26792662
Par : out Unbounded_String)
2680-
return Parametrized_Exemption_Sections.Cursor
2663+
return Parametrized_Exemption_Sections.Cursor
26812664
is
26822665
Next_Par : Exemption_Parameters.Cursor :=
26832666
Exemption_Parameters.First (Params);
2684-
2685-
use Parametrized_Exemption_Sections;
26862667
Next_Section : Parametrized_Exemption_Sections.Cursor;
2687-
26882668
begin
26892669
if Is_Param_Exempted (Id) then
26902670
while Exemption_Parameters.Has_Element (Next_Par) loop
2691-
Next_Section := First (Rule_Param_Exempt_Sections (Id));
2692-
2693-
while Has_Element (Next_Section) loop
2694-
if Element (Next_Section).Params.Contains
2695-
(Exemption_Parameters.Element (Next_Par))
2671+
Next_Section := Parametrized_Exemption_Sections.First
2672+
(Rule_Param_Exempt_Sections (Id));
2673+
2674+
while Parametrized_Exemption_Sections.Has_Element
2675+
(Next_Section)
2676+
loop
2677+
if Parametrized_Exemption_Sections.Element
2678+
(Next_Section).Params.Contains
2679+
(Exemption_Parameters.Element (Next_Par))
26962680
then
26972681
Par := To_Unbounded_String
26982682
(Exemption_Parameters.Element (Next_Par));
26992683
return Next_Section;
27002684
end if;
27012685

2702-
Next_Section := Next (Next_Section);
2686+
Next_Section := Parametrized_Exemption_Sections.Next
2687+
(Next_Section);
27032688
end loop;
27042689

27052690
Next_Par := Exemption_Parameters.Next (Next_Par);
@@ -2934,11 +2919,8 @@ package body Gnatcheck.Diagnoses is
29342919

29352920
-- Insert the exemption in the postponed list for later handling, then
29362921
-- remove the original exemption from the map.
2937-
Parametrized_Exemption_Sections.Insert
2938-
(Container => Postponed_Param_Exempt_Sections (Id) (SF),
2939-
New_Item => New_Section);
2940-
Parametrized_Exemption_Sections.Delete
2941-
(Rule_Param_Exempt_Sections (Id), Exempted_At);
2922+
Postponed_Param_Exempt_Sections (Id) (SF).Insert (New_Section);
2923+
Rule_Param_Exempt_Sections (Id).Delete (Exempted_At);
29422924
end Turn_Off_Parametrized_Exemption;
29432925

29442926
--------------------------

0 commit comments

Comments
 (0)