Skip to content

Commit 3ee4ec6

Browse files
committed
Merge branch 'topic/fix_exemptions' into 'master'
Fix the exemption post processing process Closes #369 See merge request eng/libadalang/langkit-query-language!317
2 parents e2b95d5 + 65b5f84 commit 3ee4ec6

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

lkql_checker/src/gnatcheck-diagnoses.adb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1219,9 +1219,7 @@ package body Gnatcheck.Diagnoses is
12191219
end if;
12201220

12211221
-- Traverse exemption section chain
1222-
while Section /= null
1223-
and then For_Line <= Section.Exemption_Section.Line_End
1224-
loop
1222+
while Section /= null loop
12251223
if For_Line in
12261224
Section.Exemption_Section.Line_Start ..
12271225
Section.Exemption_Section.Line_End

testsuite/tests/gnatcheck/exemptions/comment_annotations_check/main.adb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,16 @@ procedure Main is
3030
procedure Poo (A : Integer) is null; --## rule line off implicit_in ## justify line off -- FLAG in valid exemptions
3131

3232
-- Check that there is a warning for "rule line on"
33-
procedure Poo (A : Integer) is null; --## rule line on implicit_in -- FLAG (2)
33+
procedure Roo (A : Integer) is null; --## rule line on implicit_in -- FLAG (2)
34+
35+
-- Check that exempting with a comment after exempting with a pragma is working as expected
36+
--## rule off implicit_in ## Because
37+
procedure Zoo (A : Integer) is null; -- FLAG
38+
--## rule on implicit_in
39+
40+
pragma Annotate (Gnatcheck, Exempt_On, "implicit_in", "Because");
41+
procedure Woo (A : Integer) is null; -- FLAG
42+
pragma Annotate (Gnatcheck, Exempt_Off, "implicit_in");
3443
begin
3544
null;
3645
end Main;

testsuite/tests/gnatcheck/exemptions/comment_annotations_check/test.out

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
non-exempted violations : 3
1111
rule exemption warnings : 5
1212
compilation errors : 0
13-
exempted violations : 5
13+
exempted violations : 7
1414
internal errors : 0
1515

1616
2. Exempted Coding Standard Violations
@@ -25,6 +25,10 @@ main.adb:30:19: implicit IN mode in parameter specification
2525
(justify line off -- FLAG in valid exemptions)
2626
main.adb:33:19: implicit IN mode in parameter specification
2727
(unjustified)
28+
main.adb:37:19: implicit IN mode in parameter specification
29+
(Because)
30+
main.adb:41:19: implicit IN mode in parameter specification
31+
(Because)
2832

2933
3. Non-exempted Coding Standard Violations
3034

0 commit comments

Comments
 (0)