Skip to content

Commit d849b42

Browse files
committed
Merge branch 'topic/97' into 'master'
Fix off-by-one error when reaching max diagnoses to print. Closes #97 See merge request eng/libadalang/langkit-query-language!217
2 parents b571ab3 + ae7bc1b commit d849b42

File tree

4 files changed

+18
-1
lines changed

4 files changed

+18
-1
lines changed

lkql_checker/src/gnatcheck-diagnoses.adb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1845,7 +1845,7 @@ package body Gnatcheck.Diagnoses is
18451845
begin
18461846
if not Limit_Exceeded then
18471847
if Max_Diagnoses > 0 and then
1848-
Diagnoses_Reported > Max_Diagnoses
1848+
Diagnoses_Reported >= Max_Diagnoses
18491849
then
18501850
Limit_Exceeded := True;
18511851
Info ("Maximum diagnoses reached, " &
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
procedure Test is
2+
A : Integer := 0;
3+
begin
4+
if A /= 0 or else A /= 1 then null; end if; -- FLAG
5+
if A /= 0 or else A /= 1 then null; end if;
6+
if A /= 0 or else A /= 1 then null; end if;
7+
if A /= 0 or else A /= 1 then null; end if;
8+
end Test;
9+
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
test.adb:4:06: suspicious equality
2+
Maximum diagnoses reached, see the report file for full details
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
format: brief
2+
driver: gnatcheck
3+
input_sources: [test.adb]
4+
extra_args: [-m1]
5+
rules:
6+
- +Rsuspicious_equalities

0 commit comments

Comments
 (0)