Skip to content

Commit 885537e

Browse files
committed
Add a 'rule violation' tag to all rule violation message
Also add a 'warning' tag to all exemption warning messages.
1 parent d099a04 commit 885537e

File tree

56 files changed

+312
-301
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+312
-301
lines changed

lkql_checker/src/gnatcheck-diagnoses.adb

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3029,8 +3029,19 @@ package body Gnatcheck.Diagnoses is
30293029
(Ada.Strings.Fixed.Trim (Line_Number'Image (Sloc.Line), Left)
30303030
& ':' & Column_Str);
30313031
end Image;
3032+
3033+
Tag_String : constant String :=
3034+
(case Self.Diagnosis_Kind is
3035+
when Rule_Violation =>
3036+
(if Self.Justification /= Null_Unbounded_String
3037+
then "rule violation (exempted): "
3038+
else "rule violation: "),
3039+
when Exemption_Warning => "warning: ",
3040+
when others => "");
30323041
begin
3033-
return To_String (Self.File) & ":" & Image (Self.Sloc) & ": "
3042+
return To_String (Self.File) & ":"
3043+
& Image (Self.Sloc) & ": "
3044+
& Tag_String
30343045
& To_String (Self.Text);
30353046
end Image;
30363047

testsuite/tests/gnatcheck/absolute_output_files/test.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
no exempted violations detected
2-
main.adb:3:05: goto statement
2+
main.adb:3:05: rule violation: goto statement
33
no rule exemption problems detected
44
no language violations detected
55
no internal error detected
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
test.ads:2:12: declaration of local package
2-
test.ads:2:12: declaration of local package
1+
test.ads:2:12: rule violation: declaration of local package
2+
test.ads:2:12: rule violation: declaration of local package
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
main.adb:1:19: use clause for package
2-
main.adb:1:23: use clause
3-
main.adb:1:37: end of line comment
4-
main.adb:3:01: possible occurrence of KP U727-033 if float operation performed before first context switch on leon targets
5-
main.adb:3:11: declaration of library level subprogram
6-
main.adb:3:37: end of line comment
7-
main.adb:6:05: goto statement
8-
main.adb:6:37: end of line comment
1+
main.adb:1:19: rule violation: use clause for package
2+
main.adb:1:23: rule violation: use clause
3+
main.adb:1:37: rule violation: end of line comment
4+
main.adb:3:01: rule violation: possible occurrence of KP U727-033 if float operation performed before first context switch on leon targets
5+
main.adb:3:11: rule violation: declaration of library level subprogram
6+
main.adb:3:37: rule violation: end of line comment
7+
main.adb:6:05: rule violation: goto statement
8+
main.adb:6:37: rule violation: end of line comment

testsuite/tests/gnatcheck/check_package/rule_file_attr/test.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
Without additional rule file
22
============================
33

4-
main.adb:3:04: goto statement
4+
main.adb:3:04: rule violation: goto statement
55

66
With additional rule file
77
=========================
88

99
gnatcheck: error: only one LKQL configuration file is allowed
10-
main.adb:3:04: goto statement
10+
main.adb:3:04: rule violation: goto statement
1111
>>>program returned status code 6
1212

1313
With invalid attribute value

testsuite/tests/gnatcheck/check_package/rules_attr/test.out

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
Without additional rules
22
========================
33

4-
main.adb:4:04: goto statement
4+
main.adb:4:04: rule violation: goto statement
55

66
With additional rules
77
=====================
88

9-
main.adb:3:04: redundant null statement
10-
main.adb:4:04: goto statement
9+
main.adb:3:04: rule violation: redundant null statement
10+
main.adb:4:04: rule violation: goto statement
1111

1212
With invalid attribute value
1313
============================

testsuite/tests/gnatcheck/check_package/switches_attr/test.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Without additional switches
22
===========================
33

4-
main.adb:3:04: goto statement [goto_statements]
4+
main.adb:3:04: rule violation: goto statement [goto_statements]
55

66
With a disallowed switch
77
========================
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
main.adb:3:04: goto statement
2-
main.adb:4:04: redundant null statement
1+
main.adb:3:04: rule violation: goto statement
2+
main.adb:4:04: rule violation: redundant null statement
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
main.adb:1:01: [<PragmaNode gnat.adc:1:1-1:24>, <PragmaNode gnat.adc:2:1-2:75>, <PragmaNode gnat.adc:3:1-3:73>, <PragmaNode gnat.adc:4:1-4:25>, <PragmaNode gnat.adc:5:1-5:47>]
1+
main.adb:1:01: rule violation: [<PragmaNode gnat.adc:1:1-1:24>, <PragmaNode gnat.adc:2:1-2:75>, <PragmaNode gnat.adc:3:1-3:73>, <PragmaNode gnat.adc:4:1-4:25>, <PragmaNode gnat.adc:5:1-5:47>]
22

3-
main.adb:1:01: []
3+
main.adb:1:01: rule violation: []
44

5-
main.adb:1:01: [<PragmaNode gnat.adc:1:1-1:24>, <PragmaNode gnat.adc:2:1-2:75>, <PragmaNode gnat.adc:3:1-3:73>, <PragmaNode gnat.adc:4:1-4:25>, <PragmaNode gnat.adc:5:1-5:47>]
5+
main.adb:1:01: rule violation: [<PragmaNode gnat.adc:1:1-1:24>, <PragmaNode gnat.adc:2:1-2:75>, <PragmaNode gnat.adc:3:1-3:73>, <PragmaNode gnat.adc:4:1-4:25>, <PragmaNode gnat.adc:5:1-5:47>]
66

7-
main.adb:1:01: []
7+
main.adb:1:01: rule violation: []

testsuite/tests/gnatcheck/disabling_instance/test.out

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ try "gnatcheck --help" for more information.
88
Disable an instance with a previously given parameter
99
=====================================================
1010

11-
main.adb:3:04: goto statement [cond_goto|goto_statements]
12-
main.adb:8:07: goto statement [cond_goto|goto_statements]
11+
main.adb:3:04: rule violation: goto statement [cond_goto|goto_statements]
12+
main.adb:8:07: rule violation: goto statement [cond_goto|goto_statements]
1313

1414
Disabling the wrong instance
1515
============================
1616

1717
gnatcheck: error: "goto_statements" is not enabled, therefore, cannot be disabled
18-
main.adb:3:04: goto statement [cond_goto|goto_statements]
18+
main.adb:3:04: rule violation: goto statement [cond_goto|goto_statements]
1919
>>>program returned status code 5

0 commit comments

Comments
 (0)