File tree Expand file tree Collapse file tree 6 files changed +67
-0
lines changed
lkql_checker/share/lkql/kp Expand file tree Collapse file tree 6 files changed +67
-0
lines changed Original file line number Diff line number Diff line change 1+ @check(help="possible occurrence of KP 20227",
2+ message="possible occurrence of KP 20227")
3+ fun kp_20227(node) =
4+ |" Flags unchecked union types.
5+ node is BaseTypeDecl(p_has_aspect("unchecked_union"): true)
Original file line number Diff line number Diff line change 1+ procedure Main is
2+ type R_1 (B : Boolean) is record -- FLAG
3+ case B is
4+ when True =>
5+ I : Integer;
6+
7+ when False =>
8+ C : Character;
9+ end case ;
10+ end record ;
11+
12+ pragma Unchecked_Union (R_1);
13+
14+ type R_2 (B : Boolean) is record -- FLAG
15+ case B is
16+ when True =>
17+ I : Integer;
18+
19+ when False =>
20+ C : Character;
21+ end case ;
22+ end record
23+ with Unchecked_Union ;
24+
25+ type R_3 (B : Boolean) is record -- NOFLAG
26+ case B is
27+ when True =>
28+ I : Integer;
29+
30+ when False =>
31+ C : Character;
32+ end case ;
33+ end record ;
34+
35+ subtype S_R_1 is R_1; -- FLAG
36+ type D_R_1 is new R_1; -- FLAG
37+ begin
38+ null ;
39+ end Main ;
Original file line number Diff line number Diff line change 1+ project Prj is
2+ end Prj;
Original file line number Diff line number Diff line change 1+ main.adb:2:9: rule violation: possible occurrence of KP 20227
2+ 2 | type R_1 (B : Boolean) is record -- FLAG
3+ | ^^^
4+
5+ main.adb:14:9: rule violation: possible occurrence of KP 20227
6+ 14 | type R_2 (B : Boolean) is record -- FLAG
7+ | ^^^
8+
9+ main.adb:35:12: rule violation: possible occurrence of KP 20227
10+ 35 | subtype S_R_1 is R_1; -- FLAG
11+ | ^^^^^
12+
13+ main.adb:36:9: rule violation: possible occurrence of KP 20227
14+ 36 | type D_R_1 is new R_1; -- FLAG
15+ | ^^^^^
16+
Original file line number Diff line number Diff line change 1+ driver : checker
2+ rule_name : kp_20227
3+ project : prj.gpr
Original file line number Diff line number Diff line change @@ -101,6 +101,7 @@ testsuite_driver: No output file generated by gnatcheck
101101 <check switch="+Rkp_20112" label="possible occurrence of KP 20112"/>
102102 <check switch="+Rkp_20113" label="possible occurrence of KP 20113"/>
103103 <check switch="+Rkp_20186" label="possible occurrence of KP 20186"/>
104+ <check switch="+Rkp_20227" label="possible occurrence of KP 20227"/>
104105 <check switch="+Rkp_ob03_009" label="possible occurrence of KP OB03-009"/>
105106 <check switch="+Rkp_p226_024" label="possible occurrence of KP P226-024 - global analysis required"/>
106107 <check switch="+Rkp_q309_014" label="possible occurrence of KP Q309-014"/>
@@ -627,6 +628,7 @@ testsuite_driver: No output file generated by gnatcheck
627628 <check switch="+Rkp_20112" label="possible occurrence of KP 20112"/>
628629 <check switch="+Rkp_20113" label="possible occurrence of KP 20113"/>
629630 <check switch="+Rkp_20186" label="possible occurrence of KP 20186"/>
631+ <check switch="+Rkp_20227" label="possible occurrence of KP 20227"/>
630632 <check switch="+Rkp_ob03_009" label="possible occurrence of KP OB03-009"/>
631633 <check switch="+Rkp_p226_024" label="possible occurrence of KP P226-024 - global analysis required"/>
632634 <check switch="+Rkp_q309_014" label="possible occurrence of KP Q309-014"/>
You can’t perform that action at this time.
0 commit comments