File tree Expand file tree Collapse file tree 6 files changed +44
-0
lines changed
lkql_checker/share/lkql/kp Expand file tree Collapse file tree 6 files changed +44
-0
lines changed Original file line number Diff line number Diff line change 1+ @check(help="possible occurrence of KP 20186",
2+ message="possible occurrence of KP 20186")
3+ fun kp_20186(node) =
4+ |" Flag private type declarations which full type is a scalar type with a
5+ |" size representation clause.
6+ node is BaseTypeDecl(p_is_private(): true) when
7+ node.p_full_view() is t@BaseTypeDecl(
8+ p_is_scalar_type(): true,
9+ p_has_aspect("size"): true
10+ )
Original file line number Diff line number Diff line change 1+ package Main is
2+ type Pub_Range is range 1 .. 2 with Size => 8 ; -- NOFLAG
3+ type Priv_Range is private ; -- FLAG
4+ subtype Priv_Range_Sub is Priv_Range; -- NOFLAG
5+ type Priv_Float_Range is private ; -- FLAG
6+ type Priv_Enum is private ; -- FLAG
7+ type Priv_Range_No_Size is private ; -- NOFLAG
8+ type Priv_Arr is private ; -- NOFLAG
9+ private
10+ type Priv_Range is range 1 .. 2 with Size => 8 ;
11+ type Priv_Float_Range is digits 8 with Size => 64 ;
12+ type Priv_Enum is (A, B, C) with Size => 8 ;
13+ type Priv_Range_No_Size is range 1 .. 2 ;
14+ type Priv_Arr is array (1 .. 2 ) of Integer with Size => 64 ;
15+ 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.ads:3:9: rule violation: possible occurrence of KP 20186
2+ 3 | type Priv_Range is private; -- FLAG
3+ | ^^^^^^^^^^
4+
5+ main.ads:5:9: rule violation: possible occurrence of KP 20186
6+ 5 | type Priv_Float_Range is private; -- FLAG
7+ | ^^^^^^^^^^^^^^^^
8+
9+ main.ads:6:9: rule violation: possible occurrence of KP 20186
10+ 6 | type Priv_Enum is private; -- FLAG
11+ | ^^^^^^^^^
12+
Original file line number Diff line number Diff line change 1+ driver : checker
2+ rule_name : kp_20186
3+ project : prj.gpr
Original file line number Diff line number Diff line change @@ -99,6 +99,7 @@ testsuite_driver: No output file generated by gnatcheck
9999 <check switch="+Rkp_20023" label="possible occurrence of KP 20023"/>
100100 <check switch="+Rkp_20089" label="possible occurrence of KP 20089"/>
101101 <check switch="+Rkp_20113" label="possible occurrence of KP 20113"/>
102+ <check switch="+Rkp_20186" label="possible occurrence of KP 20186"/>
102103 <check switch="+Rkp_ob03_009" label="possible occurrence of KP OB03-009"/>
103104 <check switch="+Rkp_p226_024" label="possible occurrence of KP P226-024 - global analysis required"/>
104105 <check switch="+Rkp_q309_014" label="possible occurrence of KP Q309-014"/>
@@ -623,6 +624,7 @@ testsuite_driver: No output file generated by gnatcheck
623624 <check switch="+Rkp_20023" label="possible occurrence of KP 20023"/>
624625 <check switch="+Rkp_20089" label="possible occurrence of KP 20089"/>
625626 <check switch="+Rkp_20113" label="possible occurrence of KP 20113"/>
627+ <check switch="+Rkp_20186" label="possible occurrence of KP 20186"/>
626628 <check switch="+Rkp_ob03_009" label="possible occurrence of KP OB03-009"/>
627629 <check switch="+Rkp_p226_024" label="possible occurrence of KP P226-024 - global analysis required"/>
628630 <check switch="+Rkp_q309_014" label="possible occurrence of KP Q309-014"/>
You can’t perform that action at this time.
0 commit comments