File: adacontrol_ug.texi

package info (click to toggle)
adacontrol 1.16r11-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 9,008 kB
  • ctags: 709
  • sloc: ada: 55,246; python: 419; xml: 343; sh: 229; makefile: 77; sed: 30
file content (10467 lines) | stat: -rw-r--r-- 427,330 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7527
7528
7529
7530
7531
7532
7533
7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
7639
7640
7641
7642
7643
7644
7645
7646
7647
7648
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
7727
7728
7729
7730
7731
7732
7733
7734
7735
7736
7737
7738
7739
7740
7741
7742
7743
7744
7745
7746
7747
7748
7749
7750
7751
7752
7753
7754
7755
7756
7757
7758
7759
7760
7761
7762
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773
7774
7775
7776
7777
7778
7779
7780
7781
7782
7783
7784
7785
7786
7787
7788
7789
7790
7791
7792
7793
7794
7795
7796
7797
7798
7799
7800
7801
7802
7803
7804
7805
7806
7807
7808
7809
7810
7811
7812
7813
7814
7815
7816
7817
7818
7819
7820
7821
7822
7823
7824
7825
7826
7827
7828
7829
7830
7831
7832
7833
7834
7835
7836
7837
7838
7839
7840
7841
7842
7843
7844
7845
7846
7847
7848
7849
7850
7851
7852
7853
7854
7855
7856
7857
7858
7859
7860
7861
7862
7863
7864
7865
7866
7867
7868
7869
7870
7871
7872
7873
7874
7875
7876
7877
7878
7879
7880
7881
7882
7883
7884
7885
7886
7887
7888
7889
7890
7891
7892
7893
7894
7895
7896
7897
7898
7899
7900
7901
7902
7903
7904
7905
7906
7907
7908
7909
7910
7911
7912
7913
7914
7915
7916
7917
7918
7919
7920
7921
7922
7923
7924
7925
7926
7927
7928
7929
7930
7931
7932
7933
7934
7935
7936
7937
7938
7939
7940
7941
7942
7943
7944
7945
7946
7947
7948
7949
7950
7951
7952
7953
7954
7955
7956
7957
7958
7959
7960
7961
7962
7963
7964
7965
7966
7967
7968
7969
7970
7971
7972
7973
7974
7975
7976
7977
7978
7979
7980
7981
7982
7983
7984
7985
7986
7987
7988
7989
7990
7991
7992
7993
7994
7995
7996
7997
7998
7999
8000
8001
8002
8003
8004
8005
8006
8007
8008
8009
8010
8011
8012
8013
8014
8015
8016
8017
8018
8019
8020
8021
8022
8023
8024
8025
8026
8027
8028
8029
8030
8031
8032
8033
8034
8035
8036
8037
8038
8039
8040
8041
8042
8043
8044
8045
8046
8047
8048
8049
8050
8051
8052
8053
8054
8055
8056
8057
8058
8059
8060
8061
8062
8063
8064
8065
8066
8067
8068
8069
8070
8071
8072
8073
8074
8075
8076
8077
8078
8079
8080
8081
8082
8083
8084
8085
8086
8087
8088
8089
8090
8091
8092
8093
8094
8095
8096
8097
8098
8099
8100
8101
8102
8103
8104
8105
8106
8107
8108
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
8133
8134
8135
8136
8137
8138
8139
8140
8141
8142
8143
8144
8145
8146
8147
8148
8149
8150
8151
8152
8153
8154
8155
8156
8157
8158
8159
8160
8161
8162
8163
8164
8165
8166
8167
8168
8169
8170
8171
8172
8173
8174
8175
8176
8177
8178
8179
8180
8181
8182
8183
8184
8185
8186
8187
8188
8189
8190
8191
8192
8193
8194
8195
8196
8197
8198
8199
8200
8201
8202
8203
8204
8205
8206
8207
8208
8209
8210
8211
8212
8213
8214
8215
8216
8217
8218
8219
8220
8221
8222
8223
8224
8225
8226
8227
8228
8229
8230
8231
8232
8233
8234
8235
8236
8237
8238
8239
8240
8241
8242
8243
8244
8245
8246
8247
8248
8249
8250
8251
8252
8253
8254
8255
8256
8257
8258
8259
8260
8261
8262
8263
8264
8265
8266
8267
8268
8269
8270
8271
8272
8273
8274
8275
8276
8277
8278
8279
8280
8281
8282
8283
8284
8285
8286
8287
8288
8289
8290
8291
8292
8293
8294
8295
8296
8297
8298
8299
8300
8301
8302
8303
8304
8305
8306
8307
8308
8309
8310
8311
8312
8313
8314
8315
8316
8317
8318
8319
8320
8321
8322
8323
8324
8325
8326
8327
8328
8329
8330
8331
8332
8333
8334
8335
8336
8337
8338
8339
8340
8341
8342
8343
8344
8345
8346
8347
8348
8349
8350
8351
8352
8353
8354
8355
8356
8357
8358
8359
8360
8361
8362
8363
8364
8365
8366
8367
8368
8369
8370
8371
8372
8373
8374
8375
8376
8377
8378
8379
8380
8381
8382
8383
8384
8385
8386
8387
8388
8389
8390
8391
8392
8393
8394
8395
8396
8397
8398
8399
8400
8401
8402
8403
8404
8405
8406
8407
8408
8409
8410
8411
8412
8413
8414
8415
8416
8417
8418
8419
8420
8421
8422
8423
8424
8425
8426
8427
8428
8429
8430
8431
8432
8433
8434
8435
8436
8437
8438
8439
8440
8441
8442
8443
8444
8445
8446
8447
8448
8449
8450
8451
8452
8453
8454
8455
8456
8457
8458
8459
8460
8461
8462
8463
8464
8465
8466
8467
8468
8469
8470
8471
8472
8473
8474
8475
8476
8477
8478
8479
8480
8481
8482
8483
8484
8485
8486
8487
8488
8489
8490
8491
8492
8493
8494
8495
8496
8497
8498
8499
8500
8501
8502
8503
8504
8505
8506
8507
8508
8509
8510
8511
8512
8513
8514
8515
8516
8517
8518
8519
8520
8521
8522
8523
8524
8525
8526
8527
8528
8529
8530
8531
8532
8533
8534
8535
8536
8537
8538
8539
8540
8541
8542
8543
8544
8545
8546
8547
8548
8549
8550
8551
8552
8553
8554
8555
8556
8557
8558
8559
8560
8561
8562
8563
8564
8565
8566
8567
8568
8569
8570
8571
8572
8573
8574
8575
8576
8577
8578
8579
8580
8581
8582
8583
8584
8585
8586
8587
8588
8589
8590
8591
8592
8593
8594
8595
8596
8597
8598
8599
8600
8601
8602
8603
8604
8605
8606
8607
8608
8609
8610
8611
8612
8613
8614
8615
8616
8617
8618
8619
8620
8621
8622
8623
8624
8625
8626
8627
8628
8629
8630
8631
8632
8633
8634
8635
8636
8637
8638
8639
8640
8641
8642
8643
8644
8645
8646
8647
8648
8649
8650
8651
8652
8653
8654
8655
8656
8657
8658
8659
8660
8661
8662
8663
8664
8665
8666
8667
8668
8669
8670
8671
8672
8673
8674
8675
8676
8677
8678
8679
8680
8681
8682
8683
8684
8685
8686
8687
8688
8689
8690
8691
8692
8693
8694
8695
8696
8697
8698
8699
8700
8701
8702
8703
8704
8705
8706
8707
8708
8709
8710
8711
8712
8713
8714
8715
8716
8717
8718
8719
8720
8721
8722
8723
8724
8725
8726
8727
8728
8729
8730
8731
8732
8733
8734
8735
8736
8737
8738
8739
8740
8741
8742
8743
8744
8745
8746
8747
8748
8749
8750
8751
8752
8753
8754
8755
8756
8757
8758
8759
8760
8761
8762
8763
8764
8765
8766
8767
8768
8769
8770
8771
8772
8773
8774
8775
8776
8777
8778
8779
8780
8781
8782
8783
8784
8785
8786
8787
8788
8789
8790
8791
8792
8793
8794
8795
8796
8797
8798
8799
8800
8801
8802
8803
8804
8805
8806
8807
8808
8809
8810
8811
8812
8813
8814
8815
8816
8817
8818
8819
8820
8821
8822
8823
8824
8825
8826
8827
8828
8829
8830
8831
8832
8833
8834
8835
8836
8837
8838
8839
8840
8841
8842
8843
8844
8845
8846
8847
8848
8849
8850
8851
8852
8853
8854
8855
8856
8857
8858
8859
8860
8861
8862
8863
8864
8865
8866
8867
8868
8869
8870
8871
8872
8873
8874
8875
8876
8877
8878
8879
8880
8881
8882
8883
8884
8885
8886
8887
8888
8889
8890
8891
8892
8893
8894
8895
8896
8897
8898
8899
8900
8901
8902
8903
8904
8905
8906
8907
8908
8909
8910
8911
8912
8913
8914
8915
8916
8917
8918
8919
8920
8921
8922
8923
8924
8925
8926
8927
8928
8929
8930
8931
8932
8933
8934
8935
8936
8937
8938
8939
8940
8941
8942
8943
8944
8945
8946
8947
8948
8949
8950
8951
8952
8953
8954
8955
8956
8957
8958
8959
8960
8961
8962
8963
8964
8965
8966
8967
8968
8969
8970
8971
8972
8973
8974
8975
8976
8977
8978
8979
8980
8981
8982
8983
8984
8985
8986
8987
8988
8989
8990
8991
8992
8993
8994
8995
8996
8997
8998
8999
9000
9001
9002
9003
9004
9005
9006
9007
9008
9009
9010
9011
9012
9013
9014
9015
9016
9017
9018
9019
9020
9021
9022
9023
9024
9025
9026
9027
9028
9029
9030
9031
9032
9033
9034
9035
9036
9037
9038
9039
9040
9041
9042
9043
9044
9045
9046
9047
9048
9049
9050
9051
9052
9053
9054
9055
9056
9057
9058
9059
9060
9061
9062
9063
9064
9065
9066
9067
9068
9069
9070
9071
9072
9073
9074
9075
9076
9077
9078
9079
9080
9081
9082
9083
9084
9085
9086
9087
9088
9089
9090
9091
9092
9093
9094
9095
9096
9097
9098
9099
9100
9101
9102
9103
9104
9105
9106
9107
9108
9109
9110
9111
9112
9113
9114
9115
9116
9117
9118
9119
9120
9121
9122
9123
9124
9125
9126
9127
9128
9129
9130
9131
9132
9133
9134
9135
9136
9137
9138
9139
9140
9141
9142
9143
9144
9145
9146
9147
9148
9149
9150
9151
9152
9153
9154
9155
9156
9157
9158
9159
9160
9161
9162
9163
9164
9165
9166
9167
9168
9169
9170
9171
9172
9173
9174
9175
9176
9177
9178
9179
9180
9181
9182
9183
9184
9185
9186
9187
9188
9189
9190
9191
9192
9193
9194
9195
9196
9197
9198
9199
9200
9201
9202
9203
9204
9205
9206
9207
9208
9209
9210
9211
9212
9213
9214
9215
9216
9217
9218
9219
9220
9221
9222
9223
9224
9225
9226
9227
9228
9229
9230
9231
9232
9233
9234
9235
9236
9237
9238
9239
9240
9241
9242
9243
9244
9245
9246
9247
9248
9249
9250
9251
9252
9253
9254
9255
9256
9257
9258
9259
9260
9261
9262
9263
9264
9265
9266
9267
9268
9269
9270
9271
9272
9273
9274
9275
9276
9277
9278
9279
9280
9281
9282
9283
9284
9285
9286
9287
9288
9289
9290
9291
9292
9293
9294
9295
9296
9297
9298
9299
9300
9301
9302
9303
9304
9305
9306
9307
9308
9309
9310
9311
9312
9313
9314
9315
9316
9317
9318
9319
9320
9321
9322
9323
9324
9325
9326
9327
9328
9329
9330
9331
9332
9333
9334
9335
9336
9337
9338
9339
9340
9341
9342
9343
9344
9345
9346
9347
9348
9349
9350
9351
9352
9353
9354
9355
9356
9357
9358
9359
9360
9361
9362
9363
9364
9365
9366
9367
9368
9369
9370
9371
9372
9373
9374
9375
9376
9377
9378
9379
9380
9381
9382
9383
9384
9385
9386
9387
9388
9389
9390
9391
9392
9393
9394
9395
9396
9397
9398
9399
9400
9401
9402
9403
9404
9405
9406
9407
9408
9409
9410
9411
9412
9413
9414
9415
9416
9417
9418
9419
9420
9421
9422
9423
9424
9425
9426
9427
9428
9429
9430
9431
9432
9433
9434
9435
9436
9437
9438
9439
9440
9441
9442
9443
9444
9445
9446
9447
9448
9449
9450
9451
9452
9453
9454
9455
9456
9457
9458
9459
9460
9461
9462
9463
9464
9465
9466
9467
9468
9469
9470
9471
9472
9473
9474
9475
9476
9477
9478
9479
9480
9481
9482
9483
9484
9485
9486
9487
9488
9489
9490
9491
9492
9493
9494
9495
9496
9497
9498
9499
9500
9501
9502
9503
9504
9505
9506
9507
9508
9509
9510
9511
9512
9513
9514
9515
9516
9517
9518
9519
9520
9521
9522
9523
9524
9525
9526
9527
9528
9529
9530
9531
9532
9533
9534
9535
9536
9537
9538
9539
9540
9541
9542
9543
9544
9545
9546
9547
9548
9549
9550
9551
9552
9553
9554
9555
9556
9557
9558
9559
9560
9561
9562
9563
9564
9565
9566
9567
9568
9569
9570
9571
9572
9573
9574
9575
9576
9577
9578
9579
9580
9581
9582
9583
9584
9585
9586
9587
9588
9589
9590
9591
9592
9593
9594
9595
9596
9597
9598
9599
9600
9601
9602
9603
9604
9605
9606
9607
9608
9609
9610
9611
9612
9613
9614
9615
9616
9617
9618
9619
9620
9621
9622
9623
9624
9625
9626
9627
9628
9629
9630
9631
9632
9633
9634
9635
9636
9637
9638
9639
9640
9641
9642
9643
9644
9645
9646
9647
9648
9649
9650
9651
9652
9653
9654
9655
9656
9657
9658
9659
9660
9661
9662
9663
9664
9665
9666
9667
9668
9669
9670
9671
9672
9673
9674
9675
9676
9677
9678
9679
9680
9681
9682
9683
9684
9685
9686
9687
9688
9689
9690
9691
9692
9693
9694
9695
9696
9697
9698
9699
9700
9701
9702
9703
9704
9705
9706
9707
9708
9709
9710
9711
9712
9713
9714
9715
9716
9717
9718
9719
9720
9721
9722
9723
9724
9725
9726
9727
9728
9729
9730
9731
9732
9733
9734
9735
9736
9737
9738
9739
9740
9741
9742
9743
9744
9745
9746
9747
9748
9749
9750
9751
9752
9753
9754
9755
9756
9757
9758
9759
9760
9761
9762
9763
9764
9765
9766
9767
9768
9769
9770
9771
9772
9773
9774
9775
9776
9777
9778
9779
9780
9781
9782
9783
9784
9785
9786
9787
9788
9789
9790
9791
9792
9793
9794
9795
9796
9797
9798
9799
9800
9801
9802
9803
9804
9805
9806
9807
9808
9809
9810
9811
9812
9813
9814
9815
9816
9817
9818
9819
9820
9821
9822
9823
9824
9825
9826
9827
9828
9829
9830
9831
9832
9833
9834
9835
9836
9837
9838
9839
9840
9841
9842
9843
9844
9845
9846
9847
9848
9849
9850
9851
9852
9853
9854
9855
9856
9857
9858
9859
9860
9861
9862
9863
9864
9865
9866
9867
9868
9869
9870
9871
9872
9873
9874
9875
9876
9877
9878
9879
9880
9881
9882
9883
9884
9885
9886
9887
9888
9889
9890
9891
9892
9893
9894
9895
9896
9897
9898
9899
9900
9901
9902
9903
9904
9905
9906
9907
9908
9909
9910
9911
9912
9913
9914
9915
9916
9917
9918
9919
9920
9921
9922
9923
9924
9925
9926
9927
9928
9929
9930
9931
9932
9933
9934
9935
9936
9937
9938
9939
9940
9941
9942
9943
9944
9945
9946
9947
9948
9949
9950
9951
9952
9953
9954
9955
9956
9957
9958
9959
9960
9961
9962
9963
9964
9965
9966
9967
9968
9969
9970
9971
9972
9973
9974
9975
9976
9977
9978
9979
9980
9981
9982
9983
9984
9985
9986
9987
9988
9989
9990
9991
9992
9993
9994
9995
9996
9997
9998
9999
10000
10001
10002
10003
10004
10005
10006
10007
10008
10009
10010
10011
10012
10013
10014
10015
10016
10017
10018
10019
10020
10021
10022
10023
10024
10025
10026
10027
10028
10029
10030
10031
10032
10033
10034
10035
10036
10037
10038
10039
10040
10041
10042
10043
10044
10045
10046
10047
10048
10049
10050
10051
10052
10053
10054
10055
10056
10057
10058
10059
10060
10061
10062
10063
10064
10065
10066
10067
10068
10069
10070
10071
10072
10073
10074
10075
10076
10077
10078
10079
10080
10081
10082
10083
10084
10085
10086
10087
10088
10089
10090
10091
10092
10093
10094
10095
10096
10097
10098
10099
10100
10101
10102
10103
10104
10105
10106
10107
10108
10109
10110
10111
10112
10113
10114
10115
10116
10117
10118
10119
10120
10121
10122
10123
10124
10125
10126
10127
10128
10129
10130
10131
10132
10133
10134
10135
10136
10137
10138
10139
10140
10141
10142
10143
10144
10145
10146
10147
10148
10149
10150
10151
10152
10153
10154
10155
10156
10157
10158
10159
10160
10161
10162
10163
10164
10165
10166
10167
10168
10169
10170
10171
10172
10173
10174
10175
10176
10177
10178
10179
10180
10181
10182
10183
10184
10185
10186
10187
10188
10189
10190
10191
10192
10193
10194
10195
10196
10197
10198
10199
10200
10201
10202
10203
10204
10205
10206
10207
10208
10209
10210
10211
10212
10213
10214
10215
10216
10217
10218
10219
10220
10221
10222
10223
10224
10225
10226
10227
10228
10229
10230
10231
10232
10233
10234
10235
10236
10237
10238
10239
10240
10241
10242
10243
10244
10245
10246
10247
10248
10249
10250
10251
10252
10253
10254
10255
10256
10257
10258
10259
10260
10261
10262
10263
10264
10265
10266
10267
10268
10269
10270
10271
10272
10273
10274
10275
10276
10277
10278
10279
10280
10281
10282
10283
10284
10285
10286
10287
10288
10289
10290
10291
10292
10293
10294
10295
10296
10297
10298
10299
10300
10301
10302
10303
10304
10305
10306
10307
10308
10309
10310
10311
10312
10313
10314
10315
10316
10317
10318
10319
10320
10321
10322
10323
10324
10325
10326
10327
10328
10329
10330
10331
10332
10333
10334
10335
10336
10337
10338
10339
10340
10341
10342
10343
10344
10345
10346
10347
10348
10349
10350
10351
10352
10353
10354
10355
10356
10357
10358
10359
10360
10361
10362
10363
10364
10365
10366
10367
10368
10369
10370
10371
10372
10373
10374
10375
10376
10377
10378
10379
10380
10381
10382
10383
10384
10385
10386
10387
10388
10389
10390
10391
10392
10393
10394
10395
10396
10397
10398
10399
10400
10401
10402
10403
10404
10405
10406
10407
10408
10409
10410
10411
10412
10413
10414
10415
10416
10417
10418
10419
10420
10421
10422
10423
10424
10425
10426
10427
10428
10429
10430
10431
10432
10433
10434
10435
10436
10437
10438
10439
10440
10441
10442
10443
10444
10445
10446
10447
10448
10449
10450
10451
10452
10453
10454
10455
10456
10457
10458
10459
10460
10461
10462
10463
10464
10465
10466
10467
\input texinfo   @c -*-texinfo-*-
@c %**start of header
@setfilename adacontrol_ug.info
@settitle AdaControl User Guide V1.16r11
@dircategory GNU Ada tools
@direntry
* AdaControl User's Guide: (adacontrol_ug). Using AdaControl.
@end direntry
@c %**end of header
@macro rule{text}
@sp 1
@noindent @b{\text\}
@end macro

@titlepage
@title AdaControl User Guide

@c The following two commands start the copyright page.
@page
@vskip 0pt plus 1filll
@end titlepage

@ifnottex
@node Top, Introduction, (dir), (dir)
@top AdaControl User Guide
This is the AdaControl User Guide. It describes how to install and use
AdaControl. Please refer to the AdaControl Programmer Manual to learn
how to add new kinds of rules to AdaControl.
@end ifnottex

Last edited: @today{}

@menu
* Introduction::
* Installation::
* Program Usage::
* Command language reference::
* Rules reference::
* Examples of using AdaControl for common programming rules::
* Specifying an Ada entity name::
* Syntax of regular expressions::
* Non upward-compatible changes::
@end menu

AdaControl is Copyright @copyright{} 2005-2014 Eurocontrol/Adalog,
except for some specific modules that are @copyright{} 2006
Belgocontrol/Adalog, @copyright{} 2006 CSEE/Adalog, or @copyright{}
2006 SAGEM/Adalog. AdaControl is free software; you can redistribute
it and/or modify it under terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version. This unit is distributed in the hope
that it will be useful, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the GNU General Public License for more details.  You
should have received a copy of the GNU General Public License
distributed with this program; see file COPYING.  If not, write to the
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.

As a special exception, if other files instantiate generics from this
program, or if you link units from this program with other files to
produce an executable, this does not by itself cause the resulting
executable to be covered by the GNU General Public License. This
exception does not however invalidate any other reasons why the
executable file might be covered by the GNU Public License.

This document is Copyright @copyright{} 2005-2014
Eurocontrol/Adalog. This document may be copied, in whole or in part,
in any form or by any means, as is or with alterations, provided that
(1) alterations are clearly marked as alterations and (2) this
copyright notice is included unmodified in any copy.

@iftex
@contents
@end iftex

@node Introduction, Installation, Top, Top
@chapter Introduction
AdaControl is an Ada rules controller. It is used to control that Ada
software meets the requirements of a number of parameterizable
rules. It is not intended to supplement checks made by the compiler,
but rather to search for particular violations of good-practice rules,
or to check that some rules are obeyed project-wide. AdaControl can
also be handy to make statistics about certain usages of language
features, or simply to search for the occurrences of particular
constructs; its scope is therefore not limited to enforcing
programming rules, although it is of course one of its main goals.

AdaControl is a commercial product of
@url{http://www.adalog.fr/adalog2.htm,Adalog} with professional grade
support available. Getting support is highly recommended for
industrial projects. Adacontrol can also be customized or extended to
match your special needs, please refer to @ref{Support} or contact
Adalog at @email{info@@adalog.fr}.

@menu
* Features::
* Support::
* History::
* References::
@end menu

@node Features, Support, Introduction, Introduction
@section Features
AdaControl analyzes a set of Ada units, according to parameterizable
controls.  Controls can be given from the command line, from a file,
or interactively. There is a wide range of controls available. Some
are quite simple (although very useful):
@itemize @bullet
@item
Control physical layout of the program (Maximum line length, no use of
tabulations...)
@item
Control occurences of special strings in comments (like TBD for ``To
Be Defined''), with full wildcarding.
@item
Use of features (goto statement, tasking, pointers, variables in
package specifications...)
@item
Use of any declared entity, with full overloading resolution
@end itemize
Other rules are quite sophisticated:
@itemize @bullet
@item
Control series of ``if''...''elsif'' that could be replaced by
``case'' statements
@item
Verify usage of declarations (variables that should be constant,
variables read but not written...)
@item
Control declarations that could be moved to a more reduced, internal
scope
@item
Limit the call depth of a program (and diagnose recursive subprograms)
@item
Enforce a pattern that guarantees that exceptions are not handled
silently
@item
Enforce a pattern for paired calls (like semaphore's ``P'' and ``V'')
that guarantees that the closing call is always executed, even in
presence of exceptions.
@item
Check that there is no aliasing between out parameters
@item
Ensure that no protected operation calls a potentially blocking operation
@end itemize
and much, much more... See @ref{Rules reference} for the complete
reference for all possible controls.

AdaControl is very simple to use. It takes, as parameters, a list of
units to process and a list of commands that define the controls to
apply. The complete syntax of the commands is described in chapter
@ref{Command language reference}.

AdaControl produces messages to the standard output, unless
redirected. Several levels of messages are defined (i.e. error or found),
depending on the kind of the control (i.e. check or search).

Rules can be locally disabled for a part of the source code, and various
options can be passed to the program.

Ex:

Given the following package:
@example
@b{package} Pack @b{is}
   @b{pragma} Pure (Pack);
   ...
@b{end} Pack;
@end example
The following command:
@example
adactl -l "search pragmas (pure)" pack
@end example
produces the following result (displayed to standard output):
@example
pack.ads:2:4: Found: PRAGMAS: use of pragma Pure
@end example

AdaControl integrates nicely in environments such as GPS
(@pxref{Running AdaControl from GPS}), AdaGide (@pxref{Running
AdaControl from AdaGide}), or emacs (@pxref{Control kinds and report
messages}). In those environments, you can run AdaControl from menus
or by just clicking on a button!

@node Support, History, Features, Introduction
@section Support
@subsection Commercial support
Adalog provides commercial support for AdaControl. Support includes
the following benefits:
@itemize @bullet
@item
Help with installation procedures.
@item
Explanations regarding the use of the tool, and help for translating
coding standards into AdaControl rules.
@item
Dedicated account into our MantisBT system for priority handling of
problem reports.
@item
Correction of problems encountered in the use of AdaControl.
Pre-releases versions of AdaControl are provided for each corrected
problem.
@item
Access to beta-versions before they are released
@item
Keeping in sync customer's own custom rules with the latest version of
AdaControl.
@item
Reduced rate for on-demand development of custom rules.
@item
Priority consideration of enhancement requests. Satisfying enhancement
requests is not part of the support contract; however, Adalog is
constantly improving AdaControl, and suggestions originating from
supported customers are given a high priority in our todo list.
@end itemize

Adalog cannot correct problems whose origin is due to compiler bugs or
defects in the implementation of ASIS (contact your compiler provider
for support on these problems). However, Adalog will do its best
effort to find workarounds for such problems.

In addition, Adalog can provide various services:
@itemize @bullet
@item
Custom improvements to AdaControl, including application-specific
rules;
@item
consulting services for defining coding standards;
@item
consulting services in all areas related to Ada, real-time,
compilation, etc. See @url{http://www.adalog.fr/adalog2.htm,Adalog's site} for details.
@end itemize

For pricing information about support contract and other services,
please contact @email{info@@adalog.fr}.

@subsection Other support
There is a Wiki for questions about AdaControl at @*
@url{https://sourceforge.net/p/adacontrol/wiki/Home/}. This is the
place to ask for information, make suggestions, or get help from the
community.

For problem reports, please use our MantisBT system at @*
@url{http://sourceforge.net/apps/mantisbt/adacontrol}.

@subsection Your support to us, too!
If you enjoy AdaControl, there are several things you can do to help
us continue and improve this nice project.
@itemize @bullet
@item
Rate it, or even better post a review, on the
@url{http://sourceforge.net/projects/adacontrol/reviews/,SourceForge
review page}
@item
Click ``I use it'' from
@url{http://www.adalog.fr/adacontrol2.htm,AdaControl's home page}.
@item
Rate it on @url{http://www.ohloh.net/p/11353?ref=sample, AdaControl's
Ohloh page}
@item
Get a support contract, or encourage your company, your friends, or
anybody else to get a support contract!
@item
Provide good ideas, new rules, suggestions for improvements...
@end itemize
And remember: developing AdaControl is an expensive effort (according
to Ohlo's COCOMO model, it is worth 13 man.year of development). We
need support from our users to keep it running!

@node History, References, Support, Introduction
@section History
The development of AdaControl was initially funded by Eurocontrol
(@url{http://www.eurocontrol.int}), which needed a tool to help in
verifying the million+ lines of code that does Air Traffic Flow
Management over Europe. Because it was felt that such a tool would
benefit the community at-large, and that further improvements made by
the community would benefit Eurocontrol, it was decided to release
AdaControl as free software. Later, Eurocontrol, Belgocontrol, Ansaldo
(formerly CSEE-Transport), and SAGEM-DS sponsored the development of
more rules.

The requirements for AdaControl were written by Philippe Waroquiers
(Eurocontrol-Brussels), who also conducted extensive testing of
AdaControl over the Eurocontrol software. The software was developped
by Arnaud Lecanu and Jean-Pierre Rosen (Adalog). Rules, improvements,
etc. were contributed by Pierre-Louis Escouflaire (Adalog), Alain
Fontaine (ABF consulting), Richard Toy (Eurocontrol-Maastricht), and
Isidro Ilasa Veloso (GMV). AdaGide support and improvement of icons
were contributed by Gautier de Montmollin. Emmanuel Masker (Alstom)
and Yannick Duchene contributed to GPS integration.

See file @code{HISTORY} for a description of the various versions of
AdaControl, including enhancements of the current version over the
previous ones. Users of a previous version are warned that the rules
are not 100% upward-compatible: this is necessary to make the rules
more consistent and easier to use. However, the incompatibilities are
straightforward to fix and should affect only a very limited number of
files. See @ref{Non upward-compatible changes} for details.

@node  References,  , History, Introduction
@section References
@enumerate
@item
``On the benefits for industrials of sponsoring free software
development'', @i{Ada User Journal}, Volume 26, n� 4, december 2005

@url{http://www.adalog.fr/publicat/Free-software.pdf}
@item
``A Comparison of Industrial Coding Rules'', @i{Ada User Journal},
Volume 29, n� 4, december 2008

@url{http://www.adalog.fr/publicat/coding-rules.pdf}
@item
``A Methodology for Avoiding Known Compiler Problems
Using Static Analysis'', @i{proceedings of the ACM SIGAda Annual International Conference (SIGAda 2010)}

@url{http://www.adalog.fr/publicat/compiler-probs.pdf}
@end enumerate

@node Installation, Program Usage, Introduction, Top
@chapter Installation
Like any ASIS application, AdaControl can be run only if the compiler
available on the system has exactly the same version as the one used
to compile AdaControl itself. The executable distribution of
AdaControl will work only with GNAT version GPL 2014, as distributed
by AdaCore. If you are using any other version,  please use the source
distribution of AdaControl and compile it as indicated below.

Another reason for using the source distribution of AdaControl is that
the user may not be interested in all provided rules. It is very easy
to remove some rules from AdaControl to increase its
speed. @xref{Customizing AdaControl}.

@menu
* Building AdaControl from source::
* Installing AdaControl::
* Installing support for GPS::
* Installing support for AdaGide::
@end menu

@node Building AdaControl from source, Installing AdaControl, Installation, Installation
@section Building AdaControl from source
This section is only for the source distribution of AdaControl. If you
downloaded an executable distribution (and are using the latest
version of GNAT GPL), you may skip to the next section.

@anchor{Getting the correct version of the sources for your Gnat version}
@subsection Getting the correct version of the sources for your Gnat version
ASIS is continuously evolving to support Ada-2005/2012 features, and
so is AdaControl. As a consequence, the full set of features of
AdaControl is supported only with the latest versions of Gnat, namely
GnatPRO 7.2.0 and GnatGPL-2013 (and higher). We refer to these versions as the
``new Gnat'', and we encourage all users to use these versions.

Some user may however need to use an older version of Gnat. We provide
also a version of AdaControl that is compatible with versions GnatPRO
7.0.x and GnatGPL2011 and older (before some incompatible -but
necessary- changes in ASIS happened). We refer to these versions as
the ``old Gnat''.

The release whose distribution files start with ``adactl'' is for the
new Gnat, and the one whose distribution files start with
``adactl-old'' is for the old-gnat.  Both versions provide the same
features, except that controls related to Ada-2012 (or that depend on
new features of ASIS) are not available in the old-gnat
version. Moreover, the old-gnat version is now frozen, and will not
receive any new features or improvements in the future, unless
requested by a supported customer (such requests will be honoured as
part of the support contract). See @ref{Support} for
information on becoming a supported user.

Note that intermediate releases of Gnat (GnatPRO-7.1.x, GnatGPL2012)
are not fully compatible with either of these distribution. Depending
on exact version, problems may range from compilation errors to
incorrect results in some rare (Ada 2012) cases. Compatible sources
can be obtained from the Git repository of AdaControl on SourceForge
(@url{http://adacontrol.sourceforge.net}). We will be happy to help
our supported customers who must use one of these versions.

@subsection Prerequisites
The following software must be installed in order to compile
AdaControl from source:
@itemize
@item
A GNAT compiler, any version (but please consider @ref{Getting the
correct version of the sources for your Gnat version} above). Note
that the compiler must also be available on the machine in order to
run AdaControl (all ASIS application need the compiler).
@item
ASIS for GNAT
@end itemize

Make sure to have the same version of GNAT and ASIS. The version used
for running AdaControl must be the same as the one used to compile
AdaControl itself.

@subsection Build with installer (Windows)
Run the installer (@code{adactl_src-setup.exe}). This will
automatically build and install AdaControl, no other installation is
necessary.

@anchor{Build with project file}
@subsection Build with project file
Simply go to the @code{src} directory and type:
@example
gnatmake -Pbuild.gpr
@end example
You're done!

Caveat (@i{old gnat only}): Due to a bug in some versions, if you are using GNATPro
6.1.2 and above, you must set the variable GNAT_FIX to 1; i.e. invoke
the command as:
@example
gnatmake -Pbuild.gpr -XGNAT_FIX=1
@end example

@subsection Build with Makefile
The previous method may fail if Asis is not installed in an usual
place. As an alternative method, it is possible to build AdaControl
with a regular Makefile.

The file @code{Makefile} (in directory @code{src}) should be modified
to match the  commands and paths of the target system. The following
variables are to be set:
@itemize
@item
ASIS_TOP
@item
ASIS_INCLUDE
@item
ASIS_OBJ
@item
ASIS_LIB
@item
RM
@item
EXT
@end itemize
How to set these variables properly is documented in @code{Makefile}.
See also the compilation options in this file; a change is needed if
you are using GNATPro 6.1.2 and above.

Then, run the make command:
@example
$ cd src
$ make build
@end example

It is also possible to delete object files and do other actions with
this  ``Makefile'', run the following command to get more information:
@example
$ make help
@end example

NOTE: Building AdaControl needs the ``make'' command provide with GNAT; it
works both with WIN32 shell and UNIX shell.

@subsection Build with a compiler other than GNAT
It should be possible to compile AdaControl with other compilers than
GNAT, although we didn't have an opportunity to try it. If you have
another compiler that supports ASIS, note that it may require some
easy changes in the package @code{Implementation_Options} to give
proper parameters to the @code{Associate} procedure of ASIS.  Rules
that need string pattern matchings need the package
@code{Gnat.Regpat}. If you compile AdaControl with another compiler,
you can either port @code{Gnat.Regpat} to your system, or use a
(limited) portable implementation of a simple pattern matching
(package @code{String_Matching_Portable}). Edit the file
@code{string_matching.ads} and change it as indicated in the comments.
No other change should be necessary.

Alternatively, if you are using another compiler, you can try and
compile your program with GNAT just to be able to run
AdaControl. However, compilers often differ in their support of
representation clauses, which can cause your program to be rejected by
GNAT. In that case, we provide a sed script to comment-out all
representation clauses; this can be sufficient to allow you to use
AdaControl. @xref{unrepr.sed}.

@subsection Testing AdaControl
Testing AdaControl needs a UNIX shell, so it works only with UNIX
systems.  However, it is possible to run the tests on a WIN32 system
by using an UNIX-like shell for WIN32, such as those provided by
CYGWIN or MSYS. To run the tests, enter the following commands:
@example
$ cd test
$ ./run.sh
@end example

All tests must report PASSED. If they don't, it may be due to one of
the following issues:
@itemize
@item
You are using an old version of GNAT.  AdaControl runs without any
known problem (and it has been checked against the whole ACATS) only
with the latest GNATPro and GNATGPL versions; earlier versions are
known to have bugs and unimplemented features that will not allow
AdaControl to run correctly in some cases. We strongly recommend to
always use the most recent version of GNAT.
@item
You run an old-gnat version of AdaControl with GNATPro (6.1.2 and
above) and you forgot to specify the ``-XGNAT_FIX=1''
option. @xref{Build with project file}.
@item
It may happen that the test @code{tfw_check} reports ``FAILED''
on some sytems, because it depends on the order in which the operating
system lists files. If this happens, try (from the @code{test}
directory):
@example
diff res/tfw_check.txt ref/
@end example
If the only difference is that some lines are at different places, the
test is OK.
@end itemize

@anchor{Customizing AdaControl}
@subsection Customizing AdaControl
If there are some rules that you are not interested in, it is very easy
to remove them from AdaControl:
@enumerate
@item
In the @code{src} directory, edit the file
@code{framework-plugs.adb}. There is a @code{with} clause for each
rule (children of package @code{Rules}). Comment out the ones you
don't want.
@item
Recompile @code{framework-plugs.adb}. There will be error messages
about unknown procedure calls. Comment out the corresponding lines.
@item
Compile AdaControl normally. That's all!
@end enumerate

It is also possible to add new rules to AdaControl. If your favorite
rules are not currently supported, you have several options:
@enumerate
@item
If you have some funding available, please contact
@url{mailto::info@@adalog.fr,,info@@adalog.fr}. We'll be happy to
make an offer to customize AdaControl to your needs.
@item
If you @i{don't} have funding, but have some knowledge of ASIS
programming, you can add the rule yourself. We have made every effort
to make this as simple as possible. Please refer to the AdaControl
programmer's manual for details. If you do so, please send your rules
to @url{mailto::rosen@@adalog.fr,,rosen@@adalog.fr}, and we'll be
happy to integrate them in the general release of AdaControl to make them
available to everybody.
@item
If you have good ideas, but don't feel like implementing them yourself
(nor financing them), please send a note to
@url{mailto::rosen@@adalog.fr,,rosen@@adalog.fr}. We will eventually
incorporate all good suggestions, but we can't of course commit to any
dead-line in that case.
@end enumerate

@node Installing AdaControl, Installing support for GPS, Building AdaControl from source, Installation
@section Installing AdaControl
All you need to run AdaControl is the executable named  @code{adactl}
under Linux or @code{adactl.exe} under Windows. In addition,
@code{pfni} (or @code{pfni.exe} under Windows) is a convenient
utility, required by the GPS support. @xref{pfni}.

If you downloaded the Windows installer executable version of
AdaControl, simply run @code{adactl_exe-setup.exe}. This will install
all the files in the recommended locations (as has been done with the
Windows installer source version), including GPS support if you have
GPS installed and/or AdaGide support if you have AdaGide installed.

If you built AdaControl from source without an installer, the
executables are in the @code{src} directory of the distribution. If
you downloaded an executable distribution, they are in the root
directory of the distribution. Copy the executables to any convenient
directory on your path; a good place, for example, is in the
@code{bin} directory of your GNAT installation.

@node Installing support for GPS, Installing support for AdaGide, Installing AdaControl, Installation
@section Installing support for GPS
Integration of AdaControl into GPS with all functionalities requires
GPS version 4.2 or above (delivered since GNAT/GPL2008).

To add AdaControl support to GPS, copy the file
@code{GPS/adacontrol.xml} into the @code{<GNAT_dir>/share/gprconfig}
directory; copy all other files from the @code{GPS} directory into the
@code{<GPS_dir>/share/gps/plug-ins} directory. Copy also HTML files
from the @code{doc} directory into the
@code{<GPS_dir>/share/doc/gps/html} to access AdaControl's guides from
the "Help" menu of GPS.

@node Installing support for AdaGide,  , Installing support for GPS, Installation
@section Installing support for AdaGide
To add AdaControl support to AdaGide, copy the file
@code{AdaControl.tdf} from the @code{AdaGide} directory into AdaGide's
root directory. Note that AdaControl support requires AdaGide version
7.42 or above.

@node Program Usage, Command language reference, Installation, Top
@chapter Program Usage
AdaControl is a command-line program, i.e. it is normally called
directly from the system shell. @i{Options} are introduced by a ``-''
followed by a letter and can be grouped as usual. Some options take
the following word on the command line as a value; such options must
appear last in a group of options. @i{Parameters} are words on the command
line that stand by themselves. Options and parameters can be given in
any order.

The syntax for invoking AdaControl in regular mode is:
@example
adactl [-deEirsTuvwx]
       [-p <project file>]     [-f <rules file>]    [-l <rules list>]
       [-o <output file>]      [-t <trace file>]    [-F <format>]
       [-S <statistics level>] [-m <warning limit>] [-M <message limit>]
       @{<unit>[+|-<unit>]|[@@]<file>@} [-- <ASIS options>]
@end example

AdaControl can process Ada-2005 as well as Ada-95 programs, even if
there are currently few Ada-2005 related controls - but we hope to
improve that situation in the near future.

If you are using Ada-2005 (or Ada-2012) features, make sure that GNAT is set up for
Ada-2005/2012 (this is the default for GNAT-GPL). Due to technical reasons,
the -gnat05 option cannot be passed to the compiler in ``compile on
the fly'' mode, but you can do any of the following:
@itemize
@item
have a ``gnat.adc'' file in the current directory that contains a
@code{@b{pragma} Ada_05;} (or @code{@b{pragma} Ada_12;})
@item
put a @code{@b{pragma} Ada_05} (or @code{@b{pragma} Ada_12;}) on top
of every compilation unit that uses Ada-2005/2012 features;
@item
generate the tree files manually (@pxref{Generating tree files
manually}) with the ``-gnat05'' (or ``-gnat12)'') option. Note that
this allows you to pass any other GNAT option as well.
@end itemize

Note that if your program is pure Ada-95 and you are using a version
of GNAT where Ada-2005 is the default (especially GNAT-GPL), and in
the rare cases where your program would not compile in Ada-2005 mode
(notably if you have a function that returns a task type), you can
force Ada-95 the same way by using @code{@b{pragma} Ada_95} instead.

@menu
* Command line parameters and options::
* Return codes::
* Environment variable and default settings::
* Interactive mode::
* Other execution modes::
* Running AdaControl from GPS::
* Running AdaControl from AdaGide::
* Helpful utilities::
* Optimizing Adacontrol::
* In case of trouble::
@end menu

@node Command line parameters and options, Return codes, Program Usage, Program Usage
@section Command line parameters and options
@menu
* Input units::
* Commands::
* Output file::
* Output format::
* Output limits::
* Project files::
* Local disabling control::
* Verbose and debug mode::
* Treatment of warnings::
* Exit on error::
* ASIS options::
@end menu

@node Input units, Commands, Command line parameters and options, Command line parameters and options
@subsection Input units
Units to be processed are given as parameters on the command
line. Note that they are Ada @emph{compilation unit} names, not
@emph{file names}: case is not significant, and there should be no
extension! Child units are allowed following normal Ada naming rules:
@code{Parent.Child}, but be aware that specifying a child unit will
automatically include its parent unit in the analysis. Subunits are
processed during the analysis of the including unit; there is
therefore no need to specify subunits explicitely. If you do specify a
subunit explicitly, it will result in the whole enclosing unit being
analyzed.

However, as a convenience to the user, units can be specified as file
names, provided they follow the default GNAT naming convention. More
precisely, if a parameter ends in ``.ads'' or ``.adb'', the unit name
is extracted from it (and all ``-'' in the name are substituted with
``.''). File names can include a path; in this case, the path is
automatically added to the list of directories searched (``-I'' ASIS
option). The file notation is convenient to process all units in a
directory, as in the following example:
@example
adactl -f my_rules.aru *.adb
@end example

In the unlikely case where you have a child unit called @code{Ads} or
@code{Adb}, use the ``-u'' option to force interpretation of all
parameters as unit names.

By default, both the specification and body of the unit are processed;
however, it is possible to specify processing of the specification
only by providing the ``-s'' option. If only file names are given, the
``-s'' option is assumed if all files are specifications (``.ads''
files). It is not possible to specify processing of bodies only, since
rules dealing with visibility would not work.

The ``-r'' option tells AdaControl to process (recursively) all user
units that the specified units depend on (including parent units if
the unit is a child unit or a subunit). Predefined Ada units and units
belonging to the compiler's run-time library are never processed.

Ex:
@example
adactl -r -f my_rules.aru my_main
@end example
will process @code{my_main} and all units that @code{my_main} depends
on. If @code{my_main} is the main procedure, this means that the whole
program will be processed.

It is possible to specify more than one unit (not file) to process in
a parameter by separating the names with ``+''.  Conversely, it is
possible to specify units that are @i{not} to be processed, separated
by ``-''. When a unit is subtracted from the unit list, it is never
processed even if it is included via the recursive option, and all its
child and separate units are also excluded. This is convenient to
avoid processing reusable components, that are not part of a
project. For example, if you want to run AdaControl on itself, you
should use the following command:
@example
adactl -f my_rules_file.aru -r adactl-asis-a4g
@end example
This applies the rules from the file @code{my_rules_files.aru} to
AdaControl itself, but not to units that are part of ASIS (units
@code{Asis}, @code{A4G}, and their children) that would be found by
the ``-r'' (recursive) option otherwise.

Alternatively, it is possible to provide units indirectly with a
parameter consisting of an ``@@'' followed by the name of a file. This
file must contain a list of unit names (not files), one on each
line. Only the first ``word'' of the line is considered,
i.e. everything after the first blank is ignored. This can be useful
to annotate unit names.  All units whose names are given in the file
will be processed. If a name in the file starts with ``@@'', it will
also be treated as an indirect file (i.e. the same process will be
invoked recursively). If a line in the file starts with ``#'' or
``-@w{}-'', it is ignored. This can be useful to temporarily disable
the processing of some files or to add comments.

Ex:
@example
adactl -f my_rules.aru @@unit_file.txt
@end example

@node Commands, Output file, Input units, Command line parameters and options
@subsection Commands
Commands specify which processing AdaControl should apply to
units. See @ref{Command language reference} for a detailed description
of all commands.

Commands can be given directly on the command line with the ``-l''
option. A commands list must be quoted with ``"''.

Ex:
@example
adactl pack.ads proc.adb -l "check instantiations (My_Generic);"
@end example
It is possible to pass several commands separated by ``;'',
but as a convenience to the user, the last ``;'' may be omitted.

Commands can also be read from a file, whose name is given after the
``-f'' option (the ``@code{.aru}'' extension is taken by default). As
a special case, if the file name is ``-'', commands are read from the
standard input. This is intended to allow AdaControl to be pipelined
behind something that generates commands; if you want to type commands
directly to AdaControl, the interactive mode is more
appropriate. @xref{Interactive mode}.

Ex:
@example
adactl -f my_rules.aru proc.adb
@end example

Note that the ``-l'' and ``-f'' options are @i{not} exclusive: if both
are specified, the commands to be performed include those in the file
(first) and then those given on the command line.

@node Output file, Output format, Commands, Command line parameters and options
@subsection Output file
Messages produced by controls are output to the output file; by
default, it is the standard output, but it can be changed by
specifying the ``-o'' option.

Ex:
@example
adactl -f my_rules.aru -o my_output.txt proc.adb
@end example
If the output file exists, new messages are appended to it. This
allows running AdaControl under several directories that make up the
project, and gathering the results in a single file. However, if the
``-w'' option is given, AdaControl overwrites the output file if it
exists.

All other messages, including syntax error messages, units processed
(in verbose mode), and possible internal error mesages from AdaControl
itself are output to the standard error file.

@node  Output format, Output limits, Output file, Command line parameters and options
@subsection Output format
The ``-F'' option selects the output format. It must be followed by
``Gnat'', ``Gnat_Short'', ``CSV'', ``CSV_Short'', ``Source'',
``Source_Short'', or ``None'' (case insensitive).  By default, the output
is in ``Gnat'' format. See @ref{Control kinds and report messages} for
details.

The ``-S'' option selects which statistics are output after each
run. It must be followed by a value in the range 0..3. See
@ref{Control kinds and report messages} for details on the various
statistics levels.

The ``-T'' option prints a summary of timing at the end of each run. This
indicates how long (in real-time seconds) was spent in processing each rule.

Ex:
@example
adactl -F CSV -S 2 -f my_rules.aru -o my_output.csv proc.adb
@end example

@node Output limits, Project files, Output format, Command line parameters and options
@subsection Output limits
The ``-m'' and ``-M'' options are used to limit the output of
AdaControl. These options are followed by an integer value that
specifies the maximum number of error messages (``-m'') or warning and
error messages (``-M''). If the value is omitted, a previous
limitation (comming for example from a command file)  is cancelled.

If the indicated number of messages is exceeded during a run,
AdaControl stops immediately.

@node Project files, Local disabling control, Output limits, Command line parameters and options
@subsection Project files
An emacs project file (the file with a ``.adp'' extension used by the
Ada mode of Emacs) can be specified with the `` -p''
option. AdaControl will automatically consider all the directories
mentioned in ``src_dir'' lines from the project file.

Ex:
@example
adactl -f my_rules.aru -p proj.adp proc.adb
@end example

Note that AdaControl does not accept ``.gpr'' project files, because
ASIS does not currently accept the ``-P'' option like other GNAT
commands do. However, when run from GPS, the interface will
automatically use the source directories from the current (root)
project (unless you have explicitely set a ``.adp'' file in the
switches @ref{AdaControl switches}).

If you have a project that uses ``.gpr'' project files and you want to
run AdaControl from the command line (not from GPS), you can generate
a ``.adp'' project file from a ``.gpr'' project file from within GPS,
by using the ``Tools/AdaControl/Generate .adp project''
menu. @xref{Running AdaControl from GPS}. Alternatively, it is also
possible to use GPS project files by generating the tree files
manually. @pxref{Generating tree files manually} for details.

@node  Local disabling control, Verbose and debug mode, Project files, Command line parameters and options
@subsection Local disabling control
The ``-i'' option tells AdaControl to ignore disabling markers in Ada
source code (@pxref{Disabling controls}); i.e. all controls will be
performed, regardless of the presence of disabling markers. This is
equivalent to the command ``@code{set ignore ON;}''. Note that if you
you have many messages, setting this option can speed-up AdaControl
considerably.  It is therefore advisable to always set this option
when you know that there is no disabling marker in your source code.

The ``-j'' option tells AdaControl to invert the meaning of disabling
markers, i.e. only messages marked as disabled will be printed. This
is useful to check which messages have been disabled. This is
equivalent to the command ``@code{set ignore INVERTED;}''.

@node Verbose and debug mode, Treatment of warnings, Local disabling control, Command line parameters and options
@subsection Verbose and debug mode
In the default mode, AdaControl displays only messages from triggered
controls. It is possible to get more information with the verbose
option (``-v''). In this mode, AdaControl displays a a progress
indicator  and unit names as they are processed, and its global
execution time when it finishes. Note that the progress indicator
includes an indication of the run number if there are more than one
``go'' command.

The ``-d'' option enables debug mode. This mode provides more
information in case of an internal program error, and is of little
interest for the casual user. Note that if you hit Ctrl-C in debug
mode, AdaControl aborts with a message telling the currently active
rule and module. This can be useful if you suspect AdaControl to be
stuck in an infinite loop.

In debug mode, AdaControl may also, in rare occasions (and only with
some versions of GNAT), display ASIS ``bug boxes''; this does not mean
that something went wrong with the program, but simply that an ASIS
failure was properly recovered by AdaControl.

Output of the messages printed by the ``-d'' option can be directed to
a ``trace'' file (instead of being printed to the standard error
file). This is done by the ``-t'' option, which must be followed by
the file name. If the trace file exists, new messages are appended to
it.

@node Treatment of warnings, Exit on error, Verbose and debug mode, Command line parameters and options
@subsection Treatment of warnings
The ``-e'' option tells AdaControl to treat warnings as errors,
i.e. to report a return code of 1 even if only ``search'' controls
were triggered. @xref{Return codes}. It does not change the messages
however.

Conversely, the ``-E'' option tells AdaControl to @i{not} report
warnings at all, i.e. only errors are reported. However, if you ask
for statistics, the number of warning messages is still
counted. @xref{Control kinds and report messages}.

@node Exit on error, ASIS options, Treatment of warnings, Command line parameters and options
@subsection Exit on error
If an internal error is encountered during the processing of a unit,
AdaControl will continue to process other units. However, if the
``-x'' option is given, AdaControl will stop on the first error
encountered. This option is mainly useful if you want to debug
AdaControl itself (or your own rules). @xref{In case of trouble}.

Ex:
@example
adactl -x -f my_rules.aru proc.adb
@end example

@node ASIS options,  , Exit on error, Command line parameters and options
@subsection ASIS options
Everything that appears on the command line after ``-@w{}-'' will be
treated as an ASIS option, as described in the ASIS user manual.

Casual users don't need to care about ASIS options, except in one
case: if you are running AdaControl from the command line (not from
GPS), and if the units that you are processing reference other units
whose source is not in the same directory, AdaControl needs to know
how to access these units (as GNAT would). This can be done either by
using an Emacs project file with the ``-p'' option (see @ref{Project
files}), by putting the appropriate directories into the
ADA_INCLUDE_PATH environment variable, or by passing ``-I'' options to
ASIS.

It is possible to pass one or several ``-I'' options to ASIS, to
provide other directories where sources can be found. The syntax is
the same as the ``-I'' option for GNAT.

Other ASIS options, like the ``-Cx'' and/or ``-Fx'' options, can be
specified. Most users can ignore this feature; however, specifying
these options can improve the processing time of big
projects. @xref{Optimizing Adacontrol}.

@node Return codes, Environment variable and default settings, Command line parameters and options, Program Usage
@section Return codes
In order to ease the automation of controlling programs with shell
scripts, AdaControl returns various error codes depending on how
successful it was. Values returned are:
@itemize
@item
0: At most ``search'' controls (i.e. warnings) were triggered (no control
at all with ``-e'' option)
@item
1: At least one ``check'' control (i.e. error) was triggered (or at
least one ``search'' or ``check'' control with ``-e'' option)
@item
2: AdaControl was not run due to a syntax error in the rules or in the
specification of units.
@item
10: There was an internal failure of AdaControl.
@end itemize

@node Environment variable and default settings, Interactive mode, Return codes, Program Usage
@section Environment variable and default settings
If the environment variable ``ADACTLINI'' is set, its content is taken
as a set of commands (separated by semi-colons) that are executed
before any other command. Although any command can be specified, this
is intended to allow changing default settings with ``set''
commands. @xref{Set command}.

For example, you can set ADACTLINI to ``set format Gnat_Short'' if you
prefer having you messages in short format rather than the (default)
long format.

@node Interactive mode, Other execution modes, Environment variable and default settings, Program Usage
@section Interactive mode
The ``-I'' option tells AdaControl to operate interactively. In this
mode, commands  specified with ``-l'' or ``-f'' options are first
processed, then AdaControl prompts for commands on the terminal. Note
that the ``quit'' command (@pxref{Quit command}) is used to terminate
AdaControl.

The syntax of commands run interactively is exactly the same as the
one used for files; especially, each command must be terminated with a
``;''. Note that the prompt (``Command:'') becomes ``.......:'' when
AdaControl requires more input because a command is not completely
given, and especially if you forget the final ``;''.

As with files, it is possible to give several commands on a single
line in interactive mode. If a command contains syntax errors, all
``go'' commands (@pxref{Go command}) on the same line are temporarily
disabled. Other commands that do not have errors are normally
processed however.

The interactive mode is useful when you want to do some analysis of
your code, but don't know beforehand what you want to control. Since
the ASIS context is open only once when the program is loaded, queries
will be much faster than running AdaControl entirely with a new query
given in a ``-l'' option each time. It is also useful to experiment
with AdaControl, and to check interactively commands before putting
them into a file.

@node  Other execution modes, Running AdaControl from GPS, Interactive mode, Program Usage
@section Other execution modes
In addition to normal usage, AdaControl features special options to
ease its use; no Ada unit is analyzed when using these options.

@menu
* Getting help::
* Checking commands syntax::
* Generating a units list::
@end menu

@node Getting help, Checking commands syntax, Other execution modes, Other execution modes
@subsection Getting help
The ``-h'' option provides help about Adacontrol usage. If the ``-h''
option is given, no other option is analyzed and no further processing
happens.

Syntax:
@example
adactl -h [<keyword> | <rule name> | variables ["<pattern>"] ...]
<keyword> ::= all | commands | license | list | options | rules | version
@end example

The ``-h'' option without parameter displays a help message about usage of the
AdaControl program, the various options,  and  the rule names.

Otherwise, the ``-h'' must be followed by one or several keywords or
rule names (case irrelevant); its effect is:
@itemize @bullet
@item
<rule name>: if <rule name> is exactly the name of rule, display the
help message for the indicated rule. Otherwise, <rule name> is
interpreted as a pattern, and help messages for all rules that match
the pattern is displayed. Patterns are given using the full
Regexp syntax. @pxref{Syntax of regular expressions} for details.
@item
``variables'' lists the values of all variables whose name matches <pattern>,
or all variables if there is no <pattern>. Patterns are given using the full
Regexp syntax. @pxref{Syntax of regular expressions} for details.
@item
``all'':  display the help message for all rules.
@item
``commands'': display a summary of all commands
@item
``license'': display the license information
@item
``list'': display the names of all rules (note that ``rules'' also
displays the list of rules, in a prettier format; the ``list'' option
is mainly useful for the integration of AdaControl into GPS).
@item
``options'': display help about the command-line options
@item
``rules'': display the names of all rules.
@item
``version'': display AdaControl and ASIS implementation version numbers.
@end itemize

Ex:
@example
adactl -h pragmas Unnecessary_Use_Clause
adactl -h all
adactl -h version license
adactl -h stat
@end example
Note in the last example that ``stat'' is not the name of a rule; it
is therefore interpreted as a pattern, and help will be displayed for
all rules that include the string ``stat'' in their name. This can be
very convenient to retrieve the name of a rule if you don't remember
exactly how it is spelled.

@node Checking commands syntax, Generating a units list, Getting help, Other execution modes
@subsection Checking commands syntax
The ``-C'' option is used to check syntax of commands without
executing any control.

Syntax:
@example
adactl -C [-dv] [-f <rules file>] [-l <rules list>]
@end example

In this mode, AdaControl simply checks the syntax of the commands
provided with the ``-l'' option, or of the commands provided in the
file named by the ``-f'' option (at least one of these options must be
provided). No other processing will happen.

AdaControl will exit with a return code of 0 if the syntax is correct,
and 2 if any errors are found. A confirming message that no errors
were found is output if the ``-v'' option is given.

This option is especially useful when you have modified a rules file,
before trying it on many units. The way AdaControl works, it must open
the ASIS context (a lengthy operation) @i{before} analyzing the
rules. This option can therefore save a lot of time if the rules file
contains errors.

@node Generating a units list,  , Checking commands syntax, Other execution modes
@subsection Generating a units list
The ``-D'' options produces a list of units that can be reused as an
indirect file in later runs.  Syntax:
@example
adactl -D [-rsvw] [-o <output file>] [-p <project file>]
          @{<unit>[+|-<unit>]|[@@]<file>@} [-- <ASIS options>]
@end example
In this mode, AdaControl outputs the list of units that would be
processed. It is especially useful when used with the ``-r'' option
and given the main unit name, since it will then generate the whole
list of dependent units (hence the name ``D'').

This list can be directed to a file with the ``-o'' option (if the
file exists, it won't be overwritten unless the ``-w'' option is
specified).  This file can then be used in an indirect list of
units. @xref{Input units}. Note that it is more efficient to create
the list of units once and then use the indirect file than to specify
all applicable units or use the ``-r'' option each time AdaControl is
run.

@node Running AdaControl from GPS, Running AdaControl from AdaGide, Other execution modes, Program Usage
@section Running AdaControl from GPS
If you want to use AdaControl from GPS, make sure you have copied the
necessary files into the required places. @xref{Installing AdaControl}.

AdaControl integrates nicely into GPS, making it even easier to
use. It can  be launched from menu commands, and parameters can be set
like any other GPS project parameters.  When run from within GPS,
AdaControl will automatically retrieve all needed directories from the
current GPS project.

After running AdaControl, the ``locations'' panel will open, and you
can retrieve the locations of errors from there, just like with a
regular compilation. Errors will be marked in red in the source,
warning will be marked orange, and you will have corresponding marks
showing the places of errors and warnings in the speedbar. Note that
AdaControl errors appear under the ``AdaControl'' category, but if
there were compilation errors, they will appear under the
``Compilation'' category. Final counts from ``count'' control kinds will
appear under the ``Counts summary'' category, and statistics under the
``Statistics'' category.

@menu
* The AdaControl menu and buttons::
* Contextual menu::
* AdaControl switches::
* AdaControl preferences::
* AdaControl language::
* AdaControl help::
* Caveat::
@end menu

@node The AdaControl menu and buttons, Contextual menu, Running AdaControl from GPS, Running AdaControl from GPS
@subsection The AdaControl menu and buttons
GPS now features an ``AdaControl'' menu, with several submenus:
@itemize @bullet
@item
``Control Current File (rules file)'' runs AdaControl on the currently
edited file, with rules taken from the current rules file; this menu
is greyed-out if no rules file is defined, if no file window is
currently active, or if the associated language is not ``Ada''. The
name of the rules file can be set from the ``Library'' tab from the
``Project/Edit Project Properties'' menu.
@item
``Control Root Project (rules file)'' runs AdaControl on all units
that are part of the root project, with rules taken from the current
rules file; this menu is greyed-out if no rules file is defined. The
name of the rules file can be set from the ``Library'' tab from the
``Project/Edit Project Properties'' menu.
@item
``Control Units from List (rules file)'' runs AdaControls on units
given in a indirect file, with rules taken from the current rules
file. This menu is greyed-out if no rules file is defined or if no
indirect file is defined. The name of the rules file and of the
indirect file can be set from the ``Library'' tab from the
``Project/Edit Project Properties'' menu.
@item
``Control Current File (interactive)'' runs AdaControl on the
currently edited file, with a rule asked interactively from a pop-up;
this menu is greyed-out if no file window is currently active, or if
the associated language is not ``Ada''.
@item
``Control Root Project (interactive)'' runs AdaControl on all units
that are part of the root project, with a rule asked interactively
from a pop-up.
@item
``Control Units from List (interactive)'' runs AdaControls on units
given in a indirect file, with a rule asked interactively from a
pop-up. This menu is greyed-out if no indirect file is defined. The
name of the indirect file can be set from the ``Library'' tab from the
``Project/Edit Project Properties'' menu.
@item
``Check Rules File'' checks the syntax of the current rules file. This
menu is deactivated if the current window does not contain an
AdaControl rules file.
@item
``Open Rules File'' opens the rules file. This menu is deactivated if
there is no current rules file defined.
@item
``Open Units File'' opens the units file. This menu is deactivated if
there is no current units file defined.
@item
``Create units file'' creates a text file containing all units (not
files) names from the current root project. This file is appropriate
as an indirect file for the ``... from list'' commands.
@item
``Create .adp project'' creates an Emacs-style project file from the
current GPS project, which can be used with the ``-p'' option if you
want to run AdaControl from the command line. This file has the same
name as the current GPS project, with a ``.adp''
extension. @xref{Project files}.
@item
``Delete Tree Files'' removes existing tree files from the current
directory.  This is convenient when AdaControl complains that the tree
files are not up-to-date. Note that you can set the preferences for
automatic deletion of tree files after each run (see below). Note that
the name of this menu is changed to ``Delete Tree and .ali Files'' if
you have chosen to delete .ali files in the preferences (see below).
@item
``Load results file'' loads in the location window the result file
obtained from a previous run of AdaControl. The file must have been
produced with the ``Gnat'' or ``Gnat_Short'' format. @xref{Control kinds
and report messages}.
@end itemize

There are also two buttons representing Lady Ada in a magnifier glass
in the toolbar, one with a red question mark in the background. These
buttons launch AdaControl, by default on the file currently being
edited; however, you can change this behaviour from the preferences to
control either files from a list, or all files from the project. The
button without the question mark uses rules from the current rules
file, while the one with the question mark asks for the control to
apply interactively.

Here are some tips about using the ``interactive'' menus (or the
button with the question mark):
@itemize @bullet
@item
When you use the ``interactive'' menus several times, the
previously entered command(s) is used as a default.
@item
You can enter any command from AdaControl's language in the dialog;
you can even enter several commands separated by ``;''.
@item
Especially, if you want to run AdaControl with a rules file that is
not the one defined by the switches, you can use one of the
``interactive'' commands, and give ``source <file name>'' as the
command.
@end itemize

@node Contextual menu, AdaControl switches, The AdaControl menu and buttons, Running AdaControl from GPS
@subsection Contextual menu
AdaControl adds two entries to the contextual menus (right click) of
Ada files.  They call the @code{pfni} utility on the current
entity. @xref{pfni}.  The entry ``Print full name'' displays the full
name of the entity in simple form, while the entry ``Print full name
(with overloading)'' ) prints it with overloading information. If the
name refers to an entity which is initialized (or to a parameter with
a default value), the initial value is printed. If the entity is a
discrete type, its range is printed.  If the entity is an array type,
the ranges of its indices are printed.

This is convenient to find how to name entities in rule
files. @xref{Specifying an Ada entity name}. It is also convenient to
find where an entity is declared, and which of several overloaded
entities is being referred to.

This is also convenient to find the actual value of a constant from
anywhere in the program text, since the printed value is completely
evaluated if it is a (static) expression.

@node AdaControl switches, AdaControl preferences, Contextual menu, Running AdaControl from GPS
@subsection AdaControl switches
The tab ``switches'' from the ``Project/Edit Project Properties'' menu
includes a page for AdaControl, which allows you to set various
parameters. Since the GPS interface analyzes the output of AdaControl,
you should not set options directly in the bottom window of this page
(the one that displays the actual options passed to AdaControl).

@subsubsection Files
This section controls the definition of various files used by AdaControl.
@itemize @bullet
@item
``Rules file''. This is the name of a file that contains the
definition of the controls to be applied to your project. This file is
required for all ``control (rules file)'' commands.
@item
``Units file''. This is the name of a file that contains the list of
units to be controlled.  This file is required for all ``control from
list'' commands.
@item
``.adp project file''. This is the name of an emacs project file
(.adp). If this name is  not empty, AdaControl will use it instead of
providing all libraries as ``-I'' options on the command line. This
may be necessary if you have many libraries and the command line that
launches AdaControl becomes too long. Note that this file can be
created using the ``AdaControl/Create .adp project'' menu.
@end itemize

@subsubsection Processing
This section offers options that control how units are processed.
@itemize @bullet
@item
``Recursive mode''. This sets the ``-r'' option. @xref{Input units}.
@item
``Ignore local deactivation''. This sets the ``-i''
option. @xref{Local disabling control}.
@item
``Process specs only''. This sets the ``-s'' option. @xref{Input
units}.
@item
``Compilation unit mode''. This sets the ``-u'' option. @xref{Input
units}.
@end itemize

@subsubsection Debug
This section controls the debugging options of AdaControl.
@itemize @bullet
@item
``Debug messages''. This sets the ``-d'' option. @xref{Verbose and
debug mode}.
@item
``Halt on error''. This sets the ``-x'' option. @xref{Exit on error}.
@end itemize

@subsubsection Output
This section offers options that control where and how the output of
AdaControl is displayed.
@itemize @bullet
@item
``Display only errors''. This sets the ``-E'' option. @xref{Treatment
of warnings}.
@item
``Warnings as errors''. This sets the ``-e'' option. @xref{Treatment
of warnings}.
@item
``Statistics''. This sets the ``-S'' option from a pull-down
menu. @xref{Control kinds and report messages}.
@item
``Send results to GPS''. When checked (default), the output of
AdaControl is sent to the ``locations'' window of GPS.
@item
``Send results to File''. When checked, the output of AdaControl is
sent to the file indicated in the box below.
@item
``Send results to File and GPS''. When checked, the output of
AdaControl is sent to the file indicated in the box below, and the
content of the file is then automatically reloaded in the
``locations'' window of GPS. If this option is set, the file format is
always ``Gnat'' (the file format option is ignored).
@item
``File name''. This is the name of the file that will contain the
results when sent to ``File'' or ``File and GPS''.  If the results are
sent to ``File'' and the file exists, AdaControl will ask for the
permission to overwrite it. If the results are sent to ``File and
GPS'', the result file is always overriden without asking.
@item
``File format''. This is a pull-down menu that allows you to select
the desired format when output is directed to a file (``-F'' option).
@xref{Control kinds and report messages}.
@end itemize

@subsubsection ASIS
This section controls the ASIS parameters passed to AdaControl. The
content of the input field ``ASIS options'' is used in place of the
standard (``-CA -FM'') one.

Casual users don't need to change the default ASIS options. For more
details, @pxref{ASIS options}.

@node AdaControl preferences, AdaControl language, AdaControl switches, Running AdaControl from GPS
@subsection AdaControl preferences
There is an entry for AdaControl in the ``edit/preferences'' menu:
@itemize @bullet
@item
``delete trees''. If this box is checked, tree files are automatically
deleted after each run of AdaControl. This avoids having problems with
out-of-date tree files, at the expanse of slightly slowing down
AdaControl if you run it several times in a row without changing the
source files.
@item
``Delete .ali files with tree files''. If this box is checked, the
``.ali'' files in the current directory will also be deleted together
with the tree files (either automatically if the previous box is
checked, or when the ``AdaControl/Delete Tree Files'' menu is
selected). This is normally what you want, unless the current
directory is also used as the object directory for compilations; in
the latter case, deleting ``.ali'' files would cause a full
recompilation for the next build of the project.
@item
``Help on rule''. This allows you to select how rule specific help
(from the ``Help/AdaControl/Help on rule'' menu) is displayed. If you
select ``Pop-up'', a summary of the rule's purpose and syntax is
displayed in a pop-up. If you select ``User Guide'', the user guide
opens in a browser at the page that explains the rule. (Caveat: due to
a problem in GPS under Windows, the ``User Guide'' option may not work
at all, or the browser will not find the right anchor; hopefully, this
will be fixed in an upcomming release of GPS. No such problem under
Linux).
@item
``Use separate categories''. If this box is checked, there will be one
category (i.e. tree in the locations window) for each rule type or
label, otherwise all messages will be grouped under the single
category ``AdaControl''. In practice, this means that with the box
checked, messages will be sorted by rules first, then by files, while
otherwise, the messages will be sorted by files first, then by rules.
In any case, compilation errors appear under the ``Compilation''
category, final counts under the ``Counts summary'' category, and
statistics under the ``Statistics'' category.
@item
``Auto save files''. If this box is checked, all modified files are
automatically saved without asking before running
AdaControl. Otherwise, a dialog appears allowing the user to choose
which files to save.
@item
``Buttons operate on''. This defines the behaviour of the buttons.
If ``Current File'' is selected, the buttons operate on the file being
currently edited. If ``Root Project'' is selected, the buttons operate
on all files that are part of the current project. If ``Units from List''
is selected, the buttons operate on all units from the units file.
@item
``Display AdaControl run''. If this box is checked, the command line used
to launch AdaControl and the output messages are displayed in the ``Messages''
window.
@item
``Max allowed error messages''. If non zero, run will stop if the
number of error messages exceeds this limit. @xref{Output limits}.
@item
``Max allowed messages (all kinds)''. If non zero, run will stop if
the number of error and warning messages exceeds this
limit. @xref{Output limits}.
@end itemize

@node AdaControl language, AdaControl help, AdaControl preferences, Running AdaControl from GPS
@subsection AdaControl language
If you check ``AdaControl'' in the ``Languages'' tab, GPS
will recognize files with extension @code{.aru} as AdaControl rules
files, and provide appropriate colorization.

@node AdaControl help, Caveat, AdaControl language, Running AdaControl from GPS
@subsection AdaControl help
The AdaControl User Manual (this manual) and the AdaControl
Programmer Manual are available from the "Help/AdaControl" menu of GPS.

The "Help on rule" entry displays the list of all rules; if you click
on one of them, you get help for the particular rule. Depending on the
setting of the ``Help on rule'' preference (see above), it opens a
pop-up that displays the rule(s) purpose and the syntax of its
parameters, or opens the user guide at the appropriate location.

The ``About'' entry displays a popup with AdaControl's version number
and license condition.

@node Caveat,  , AdaControl help, Running AdaControl from GPS
@subsection Caveat
GPS may crash when the output of a command is too big (i.e. hundreds
of messages with AdaControl).  If this happens, use the
``preferences'' menu to limit the number of messages.

@node Running AdaControl from AdaGide, Helpful utilities, Running AdaControl from GPS, Program Usage
@section Running AdaControl from AdaGide
If you want to use AdaControl from AdaGide, make sure you have copied
the necessary file into the required place. @xref{Installing
AdaControl}. Note that AdaGide does not have all the parameterization
facilities of sophisticated environments like GPS, but all AdaControl
options, like the name of  the rules file or the output format, can
easily be changed by editing the tool description file
@code{AdaControl.tdf}.

AdaGide now features several AdaControl commands from the ``tool'' menu:
@itemize @bullet
@item
``AdaControl'' runs AdaControl on the currently
edited file, with rules taken from the file named @code{verif.aru}.
@item
``AdaControl recursive'' works like the previous command, with the
addition of the ``-r'' (recursive) option. When used on the main
program, it will analyze the whole set of compilation units in the
program.
@item
``AdaControl interactive'' runs AdaControl on the currently
edited file, with a rule asked interactively from a pop-up.
@item
``AdaControl: delete .adt'' removes existing tree files from the
current directory.  This is convenient when AdaControl complains that
the tree files are not up-to-date.
@end itemize

@node Helpful utilities, Optimizing Adacontrol, Running AdaControl from AdaGide, Program Usage
@section Helpful utilities
This section describe utilities that are handy to use in conjunction
with AdaControl.

@menu
* pfni::
* makepat.sed::
* unrepr.sed::
@end menu

@node pfni, makepat.sed, Helpful utilities, Helpful utilities
@subsection pfni
The convention used to refer to entities (as described in
@ref{Specifying an Ada entity name}) is very powerful, but it may be
difficult to spell out correctly the name of some entities, especially
when using the overloaded syntax.

@code{pfni} (which stands for @i{Print Full Name Image}) can be used
to get the correct spelling for any Ada entity. The syntax of
@code{pfni} is:
@example
pfni [-sofdq] [-p <project-file>] <unit>[:<span>]
     [-- <ASIS options>]
<span> ::=   <line_number>
           | [<first_line>]-[<last_line>]
           | <line_number>:<column_number>
@end example
or
@example
pfni -h
@end example
If called with the ``-h'' option, @code{pfni} prints a help message
and exits.

Otherwise, @code{pfni} prints the full name image of all identifiers
declared in the indicated unit, unless there is a ``-f'' (full)
option, in which case it prints the full name image of all identifiers
(i.e. including those that are used, but not declared, in the
unit). The image is printed without overloading information, unless
the ``-o'' option is given.

In addition, @code{pfni} prints the initial value of variables if
there is one, the range of discrete types, and the range of the
indices of array types.

The <unit> is given either as an Ada unit, or as a file name, provided
the extension is ``.ads'' or ``.adb'' (as in AdaControl). If a span is
given, only identifiers within the span are printed. In the first
form, the span includes only the indicated line; in the second form,
the span includes all lines from <first_line> to <last_line> (if
omitted, they are taken as the first and last line of the file,
respectively). In the third form, the span includes only the place at
the specified <line_number> and <column_number>.

Normally, the source line corresponding to the names is printed above
the names. The ``-q'' (quiet) option suppresses this.

If the ``-s'' option is given (or the unit is a file name with a
``.ads'' extension), the specification of the unit is processed,
otherwise the body is processed. The ``-p'' option specifies the name
of an Emacs project file, and the ``-d'' option is the debug mode, as
for AdaControl itself. ASIS options can be passed, like for
AdaControl, after a ``-@w{}-'' (but -FS is the default). @xref{ASIS
options}.

As a side usage of @code{pfni}, if you are calling a subprogram that
has several overloadings and you are not sure which one is called, use
@code{pfni} with the ``-o'' option on that line: the program will tell
you the full name and profile of the called subprogram.

@node makepat.sed, unrepr.sed, pfni, Helpful utilities
@subsection makepat.sed
This file (provided in the ``src'' directory) is a sed script that
transforms a text file into a set of correponding regular expressions.
It is useful to generate model header files. @xref{Header_Comments}.

@node unrepr.sed,  , makepat.sed, Helpful utilities
@subsection unrepr.sed
This file (provided in the ``src'' directory) is a sed script that
comments out all representation clauses. It is typically useful if you
use a different compiler that accepts representation clauses not
supported by GNAT.

Typically, you would copy all your sources in a different directory,
copy ``unrepr.sed'' in that directory, then run:
@example
sed -i -f unrepr.sed *.ads *.adb
@end example
You can now run AdaControl on the patched files. Of course, you won't
be able to check rules related to representation clauses any more...

Note that the script adds ``-@w{}-UNREPR '' to all representation
clauses. Its effect can thus easily be undone with the following
commad:
@example
sed -i -e "s/--UNREPR //" *.ads *.adb
@end example

@node Optimizing Adacontrol, In case of trouble, Helpful utilities, Program Usage
@section Optimizing Adacontrol
There are many factors that may influence dramatically the speed of
AdaControl when processing many units. For example, on our canonical
test (same controls, same units), the extreme points for execution time
were 111s. vs 13s.! Unfortunately, this seems to depend on a number of
parameters that are beyond AdaControl's control, like the relative
speed of the CPU to the speed of the hard-disk, or the caching
strategy of the file system.

This section will give some hints that may help you increase the speed
of AdaControl, but it will not change the output of the program; you
don't really need to read it if you just use AdaControl
occasionnally. This section is concerned only with the GNAT
implementation of ASIS; other implementations work differently.

Bear in mind that the best strategy depends heavily on how your
program is organized, and on the particular OS and hardware you are
using. Therefore, no general rule can be given, you'll have to
experiment yourself. Hint: if you specify the ``-v'' option to
AdaControl, it will print in the end the elapsed time for running the
tests; this is very helpful to make timing comparisons.

Note: all options described in this section are ASIS options,
i.e. they must appear last on the command line, after a ``-@w{}-''.

@menu
* Tree files and the ASIS context::
* Generating tree files manually::
* Choosing an appropriate combination of options::
@end menu

@node Tree files and the ASIS context, Generating tree files manually, Optimizing Adacontrol, Optimizing Adacontrol
@subsection Tree files and the ASIS context
Since AdaControl is an ASIS application, it is useful to explain here
how ASIS works. ASIS (and therefore AdaControl) works on a set of
units constituting a ``context''. Any reference to an Ada entity which
is not in the context (nor automatically added, see below) will be
ignored; especially, if you specify to AdaControl the name of a unit
which is not included in the current context, the unit will simply not
be processed.

ASIS works by exploring tree files (same name as the corresponding Ada
unit, with a ``.adt'' extension), which are ``predigested'' views of
the corresponding Ada units. By default, the tree files are generated
automatically when needed, and kept after each run, so that subsequent
runs do not have to recreate them.

A context in ASIS-for-Gnat is a set of tree files. Which trees are
part of the context is defined by the ``-C'' option:
@itemize
@item
-C1 Only one tree makes up the context. The name of the tree file must
follow the option.
@item
-CN Several explicit trees make up the context. The name of the tree
files must follow the option.
@item
-CA All available trees make up the context. These are the tree files
found in the current directory, and in any directory given with a
``-T'' option (which works like the ``-I'' option, but for tree files
instead of source files).
@end itemize

The ``-F'' option specifies what to do if the program tries to access
an Ada unit which is not part of the context:
@itemize
@item
-FT Only consider tree files, do not attempt to compile units
on-the-fly
@item
-FS Always compile units on-the-fly, ignore existing tree files
@item
-FM Compile on-the-fly units for which there is no already existing
tree file
@end itemize
Note that ``-FT'' is the only allowed mode, and @i{must} be specified,
with the ``-C1'' and ``-CN'' options.

The default combination used by AdaControl is ``-CA -FM''.

@node Generating tree files manually, Choosing an appropriate combination of options, Tree files and the ASIS context, Optimizing Adacontrol
@subsection Generating tree files manually
It is also possible to generate the tree files manually before running
AdaControl. Although this mode of operation is less practical, it is
recommended by AdaCore for any ASIS tool that deals with many
compilation units.  Some reasons why you might want to generate the
tree files manually are:
@itemize @bullet
@item
Your project uses GNAT project files, but you don't want to run
AdaControl from GPS;
@item
Your project has several source directories (ASIS had problems with
ADA_INCLUDE_PATH, until releases dated later than Sept. 1st,
2006). Note that an alternative solution is to specify source
directories with the -I option;
@item
It is faster to generate tree files once than to use ``compile on the
fly'' mode.
@end itemize

To generate tree files manually, simply recompile your project with
the ``-gnatct'' option.  This option can be passed to @code{gnatmake}
normally. Of course, you will need all other options needed by your
project (like the ``-P'' option if you are using GNAT project files).

Tree files may be copied into a different directory if you don't want
your current directory to be cluttered by them. In this case, use the
``-T'' ASIS option to indicate the directory where the tree files are
located.

If you chose to generate the tree files manually, you may want to
specify the ``-FT'' ASIS option (see above) to prevent from accidental
automatic recompilation.

@node Choosing an appropriate combination of options,  , Generating tree files manually, Optimizing Adacontrol
@subsection Choosing an appropriate combination of options
In order to optimize the use of AdaControl, it is important to
remember that reading tree files is a time-consuming operation. On the
other hand, a single tree file contains not only information for the
corresponding unit, but also for the @i{specifications} of all units
that the given unit depends on. Moreover, our measures showed that
reading an existing tree file may be @i{slower} than compiling the
corresponding unit on-the-fly (but once again, YMMV).

Here are some hints to help you find the most efficient combination of
options.
@itemize
@item
If you want to run AdaControl on all units of your program, use the
``-D'' option to create a file containing the list of all required
units, then use this file as an indirect file. Using the the ``-r''
option (recursive mode) of AdaControl implies an extra pass over the
whole program tree to determine the necessary units.
@item
If you have not disabled any rule (and have many messages), specifying
the ``-i'' option (ignore disabling) saves AdaControl the burden of
checking whether rules are disabled, which can result in a
sensible speed-up.
@item
Avoid having unnecessary tree files. All tree files in the context are
read by ASIS, even if they are not later used.  If you don't want to
run AdaControl on the whole project, deleting tree files from a
previous run can save a lot of time.
@item
When using an indirect file, the order in which units are given may
influence the speed of the program. As a rule of thumb, units that are
closely related should appear close to each other in the file. A good
starting point is to sort the file in alphabetical order: this way,
child units will appear immediately after their parent. You can then
reorder units, and measure if it has a significant effect on speed.
@item
If you want to check a unit individually, try using the ``-C1'' option
(especially if the current directory contains many tree files from
previous runs). Remember that you must specify the unit to check to
AdaControl, and the tree file to ASIS. I.e., if you want to check the
unit ``Example'', the command line should look like:
@example
adactl -f rules_file.aru example -- -FT -C1 example.adt
@end example
provided the tree file already exists.
@item
For each strategy, first run AdaControl with the default options
(which will create all necessary tree files). Compare execution time
with the one you get with ``-FT'' and ``-FS''. This will tell you if
compiling on-the-fly is more efficient than loading tree files, or not.
@end itemize

@node In case of trouble,  , Optimizing Adacontrol, Program Usage
@section In case of trouble
@subsection Known issues
If you are using an old version of GNAT and your project includes
source files located in several directories, the ADA_INCLUDE_PATH
environment variable may not be considered by ASIS, resulting in error
messages that tell you that the bodies of some units have not been
found (and hence have not been processed). This problem has been fixed
in GNAT dated later than Sept. 1st, 2006. If this happens, either
provide your source directories as ``-I'' options (@pxref{ASIS
options}), or generate the tree files manually (@pxref{Generating tree
files manually}). Note that this problem does not happen if you are
using Emacs project files (@pxref{Project files}), nor if you are
running AdaControl from GPS.

@subsection AdaControl or ASIS failure
Like any sophisticated piece of software, AdaControl may fail when
encountering some special case of construct. ASIS may also fail
occasionnally; actually, we discovered several ASIS bugs during the
development of AdaControl. These were reported to ACT, and have been
corrected in the wavefront version of GNAT - but you may be using an
earlier version. In this case, try to upgrade to a newer version of
ASIS. If an AdaControl or ASIS problem is not yet solved, AdaControl
is designed in such a way that an occasionnal bug won't prevent you
from using it.

If AdaControl detects an unexpected exception during the processing of
a unit (an ASIS error or an internal error), it will abandon the unit,
clean up everything, and go on processing the remaining units. This
way, an error due to a special case in a unit will @i{not} affect the
processing of other units. AdaControl will return a Status of 10 in
this case.

However, if it is run with the ``-x'' option (eXit on error), it will
stop immediately, and no further processing will happen.

If you don't want the garbage from a failing rule to pollute your
report, you may chose to disable the rule for the unit that has a
problem. @xref{Inhibit command}.

If you encounter a problem while using AdaControl, you are very
welcome to report it through our
@url{https://sourceforge.net/apps/mantisbt/adacontrol/my_view_page.php,Mantis bug
tracking system} (under Windows, you can click on ``Report problem''
in the AdaControl Start menu). Please include the exact control and
the unit that caused the problem, as well as the captured output of
the program (with ``-dx'' option).

@node Command language reference, Rules reference, Program Usage, Top
@chapter Command language reference
AdaControl is about @i{controlling rules}. @i{Rules} are built in
AdaControl; each rule has a name, and may require parameters. For the
complete description of each rule, @pxref{Rules reference}.

To run AdaControl, you need to define which rules you want to apply to
your Ada units, what are the parameters, etc. In addition, you may
want to define various things, like the file where the results should
go, the output format, etc.

AdaControl defines a small command language which is used to describe
how you want to process your units. Commands can be specified either
on the command line or in a file, that we call here a rules
file. Commands can also be given interactively; @xref{Interactive
mode}.

@menu
* General::
* Controls::
* Other commands::
* Example of commands::
@end menu

@node General, Controls, Command language reference, Command language reference
@section General
The command language is not case-sensitive, i.e. the case of the
keywords, rule names, and parameters is not significant.  The layout
of commands is free (i.e. a command can extend over several lines, and
spaces are freely allowed between syntactic elements).

Comments are allowed in and between commands. Comments begin with a
``#'' or a ``-@w{}-'', and extend to the end of the line.

Since wide characters are allowed in Ada programs, AdaControl accepts
wide characters in commands as well. With GNAT, the encoding scheme is
Hex ESC encoding (see the GNAT User-Guide/Reference-Manual). This is
the prefered method, since few people require wide characters in
programs anyway, and that keeping the default bracket encoding would
not conveniently allow brackets for regular expressions, like those
used by some rules. @xref{Syntax of regular expressions}.

If a syntax error is encountered in a command, an appropriate error
message is output, and analysis of the rules file continues in order
to output all errors, but no analysis of user code will be performed.

@node Controls, Other commands, General, Command language reference
@section Controls
A @i{control command} is a command that declares one (or several)
controls. A control defines how a rule is applied to Ada units. The
syntax of a control command is as follows:
@example
<control_command> ::= [<label> ":"] <control> @{"," <control>@} ";"
<control>   ::= <ctrl_kind> <Rule_Name> [<parameters>]
<parameters ::= "(" [<modifiers>] <value> @{"," [<modifiers>] <value>@} ")"
<ctrl_kind> ::= "check"|"search"|"count"
@end example

If present, the label gives a name to the control(s); it will be
printed whenever each control is activated, and can be used to disable
the control(s).  @xref{Disabling controls}. If no label is present,
the rule name is printed instead. The label must have the syntax of an
Ada identifier, or else the label must be included within double
quotes (@code{"}), in which case it can contain any character.

Each control consists of a <ctrl_kind> followed by a rule name, and
(optionally) parameters. Some parameters may be preceded by modifiers
(such as ``not'' or ``case_sensitive''). The meaning of the rule
parameters and modifiers depends on the rule.

Here are some examples of commands:
@example
check unnecessary_use_clause;
All_Imports: search pragmas (Import);
"Why do you need that?": check entities (Unchecked_Conversion,
                                         all 'Address);
@end example

Specifying several controls with the same label is a shorthand which
is equivalent to specifying the same label for several controls. It is
handy when the label is long, and/or to stress that several controls are
part of the same programming rule. For example:
@example
"Check why this obsolete stuff is still used":
   check entities (obsolete_unit_1),     -- Note comma here!
   check instantiations (some_obsolete_generic);
@end example

@menu
* Control kinds and report messages::
* Parameters::
* Multiple controls::
* Disabling controls::
@end menu

@node Control kinds and report messages, Parameters, Controls, Controls
@subsection Control kinds and report messages
There are three control kinds: ``check'', ``search'', and ``count''.

``Check'' is intended to search for rules that must be obeyed in your
programs. Normally, if a ``Check'' control fails, you should fix the
program. ``Search'' is intended to report some situations, but you
should consider what to do on a case-by-case basis. Roughly, use
``check'' when you consider that the failure of the control is an
error, and ``search'' when you consider it as a warning. AdaControl
will exit with a status of 1 if any ``Check'' control is triggered,
and a status of 0 if only ``Search'' controls were triggered (or no
control was triggered at all).

``Count'' works like ``Search'', but instead of printing a message for
each control which is triggered, it simply counts occurrences and prints
a summary at the end of the run. There is a separate count for each
control label (or if no label is given, the rule name is taken instead);
if you give the same label to different controls, this allows you to
accumulate the counts.

A report message (except for the final report of ``count'') comprises
the following elements:
@itemize
@item
the file name (where the control matches)
@item
the line number (where the control matches)
@item
the column number (where the control matches)
@item
the label (if there is one) and/or the rule name (the rule that matches).
@item
a message (why the control matches). A control whose kind is ``check''
will produce an error report message (i.e. containing the keyword
``Error'') and a control whose kind is ``search'' will produce a
found report message (i.e. containing the keyword ``Found'').
@end itemize

The formatting of the report message depends on the format option,
which can be selected with the ``-F'' command-line option or the ``set
format'' command.

If the format is ``Gnat'' (the default) or ``Gnat_Short'', items are
separated by ':'; this is the same format as the one used by GNAT
error messages. Editors (like Emacs or GPS) that recognize this format
allow you to go directly to the place of the message by clicking on
it.  In order to avoid too long messages, only the label appears,
unless there is none, in which case it is replaced with the rule name.

If the format is ``CSV'' or ``CSV_Short'', items are separated by ','
and surrounded by double quotes. This is the ``Comma Separated
Values'' format, which can be read by any known spreadsheet program,
except Excel(tm) by default, which uses the semicolon and not the
comma to separate fields. Therefore, the formats ``CSVX'' and
``CSVX_Short'' do the same thing, but using semi-colons (';') instead
of commas. Both the label (replaced by an empty column if there is
none) and the rule name appear. Note that when an output file is
created in one of the ``CSV'' formats, a title line is issued as the
first line, following normal CSV convention.

If the format is ``Source'' or ``Source_Short'', the offending source
line is output, and the message is output behind it, with a ``!''
pointing to the exact location of the problem.

If the format is ``None'', no error message is output at all. This is
useful when only the return code of running AdaControl is desired
(just to check if a program is OK or not). Note that this does @i{not}
prevent the output of statistics, since these are under control of the
``-S'' option or the ``set statistics'' command. In this case,
statistics are output in CSVX format, since asking for statistics with
a ``none'' format is mainly useful for analysing the statistics with a
spreadsheet program.

With recent versions of GNAT, the file name includes the full path of
the source file. If the ``_Short'' form of the format option is used,
the file name is stripped from any path. This can make it easier to
compare the results of controlling units from various directories.
Note that with older versions of GNAT, the file name never includes
the full path, and the ``_Short'' form of the format option has no
effect.

After each run (@pxref{Go command}), statistics may be output,
depending on the statistics level which is set with the ``-S'' option
or the ``set statistics'' command. The meaning of the various levels
is as follows:
@itemize
@item
0: No statistics are output (default)
@item
1: A count of error and warning messages is output
@item
2: The rule name and label (if any) of any control @i{not} triggered are
output
@item
3: The rule name and label (if any) of every control is output,
together with a count of each triggering kind (``check'', ``search'',
``count''), or ``not triggered'' if the control was not triggered.
@end itemize

@node Parameters, Multiple controls, Control kinds and report messages, Controls
@subsection Parameters
Most rules accept parameters. Parameters can be:
@itemize
@item
a keyword for the rule
@item
a numerical value
@item
a character string (often a regular expression)
@item
an Ada entity name
@end itemize

A numerical value is given with the syntax of an Ada integer or real
literal (underscores and exponents are allowed as in Ada). Based
literals are supported for integer values; if somebody can justify a
need for supporting them for reals, we'll be happy to add this feature
later...

A character string is given within double quotes ``"''. As usual, quotes
appearing within the string are doubled. The tilde character (``~'') can be
used as a replacement delimiter, but the same character must be used at both
ends of the string. The latter has been chosen as a character not used
by the various shells, and can be useful to pass quoted strings from
parameters on the command line (unfortunately, we could not use the
percent (``%'') sign, because it plays a special role in DOS/Windows).

An Ada entity name is the full name (prefixed with the names of all
units that include it) of something declared in a program. It can be
followed by overloading information, in order to uniquely identify the
Ada entity. If an Ada entity is overloaded and no overloading
information is provided, the rule is applied to all (overloaded) Ada
entities that match the name. Alternatively, it can be ``all''
followed by a simple name, in wich case  it applies to all entities
with that name. See @ref{Specifying an Ada entity name} for the full
description of the syntax. Here are some examples of entity names:
@example
Ada.Text_IO.Put                      -- All Put defined in Ada.Text_IO
Ada.Text_IO.Put@{Standard.Character@}  -- The Put on Character
all Put                              -- All Put
Standard.Integer'Image               -- The 'Image function on Integer
all 'Image                           -- All 'Image functions
@end example

@node Multiple controls, Disabling controls, Parameters, Controls
@subsection Multiple controls
Most rules can be used in more than one control (with different
parameters). There is no difference between a single or a multiple
configuration rule use: outputs, efficiency, etc. are the same.

The following rules files produce an identical configuration:
@example
Search Pragmas (Pure, Elaborate_All);
@end example
and
@example
Search Pragmas (Pure);
Search Pragmas (Elaborate_All);
@end example

However, the second form can be used to give different labels. Consider:
@example
Search Pragmas (Pure);
No_Elaborate: Search Pragmas (Elaborate_All);
@end example

The messages for pragma @code{Pure} will contain ``PRAGMAS'', while
those for @code{Elaborate_All} will contain ``No_Elaborate''. If a
disabling comment mentions @code{pragmas}, it will disable both controls,
but a disabling comment that mentions @code{No_Elaborate} will disable
only the second one.

@node  Disabling controls,  , Multiple controls, Controls
@subsection Disabling controls
It is possible to disable controls on parts of the source code by
placing markers in the source code. A marker is an Ada comment, where
the comment mark (@code{--}) is immediately followed by the special
tag ``@code{##}'' (by default).

There are two kinds of markers: block markers and line markers.  Both
kinds specify a list of controls to disable/re-enable. A list of
controls is a list of rule names (to disable/re-enable all controls on
the indicated rule(s)) or control labels (to disable/re-enable all
controls with that label), separated by spaces. Alternatively, the
list of controls can be the word ``all'' to disable/re-enable all
controls.

In a ``@code{--##}'' line, everything appearing after another ``##''
tag (by default) is ignored. This allows the insertion of a comment
explaining why the control is disabled at that point.

Both tags can be changed with the ``set'' command. @xref{Set command}.

@subsubsection Block disabling
A control is disabled from a ``rule off'' marker that applies to it
until a ``rule on'' marker that applies to it. If there is no
appropriate ``rule on'' marker, the control is disabled up to the end
of file.

Syntax:
@example
--## rule off <control_list>
Ada code block
--## rule on <control_list>
@end example

Ex:
@example
--## rule off rule1 rule2 ## Authorized by QA ref 1234
I := I + 1;
Proc (I);
--## rule on rule2
@end example

@subsubsection Line disabling
A control is disabled only for the line where a marker that applies to
it appears.

Syntax:
@example
Ada code line --## rule line off <rule_list>
@end example
Ex:
@example
I := I + 1; --## rule line off rule3 rule_label_1
@end example
Conversely, it is possible to re-enable a control for just the current
line in a block where it is disabled:

Syntax:
@example
Ada code line --## rule line on <rule_list>
@end example
Ex:
@example
--## rule off rule1 rule2
...
I := I + 1; --## rule line on rule2
@end example

@subsection Limitation
Since the disabling is based on special comments, there is a conflict
with the rule ``header_comments'' which is based on the content of
comments. Line disabling is not possible with this rule, and block
disabling needs special care. @xref{Header_Comments}.

@node  Other commands, Example of commands, Controls, Command language reference
@section Other commands
In addition to controls, AdaControl recognizes a number
of commands. Although these commands are especially useful when using
the interactive mode (@pxref{Interactive mode}), they can be used in
command files as well.

@menu
* Go command::
* Quit command::
* Message command::
* Help command::
* Clear command::
* Set command::
* Source command::
* Inhibit command::
@end menu

@node Go command, Quit command, Other commands, Other commands
@subsection Go command
This command starts processing of the controls that have been
specified.

Syntax:
@example
go;
@end example
Controls are @i{not} reset after a ``go'' command; for example, the
following program:
@example
search entities (pack1);
go;
search entities (pack2);
go;
@end example
will first output all usages of @code{Pack1}, then all usages of both
@code{Pack1} and @code{Pack2}. See @ref{Clear command} to reset
controls.

If not in interactive mode, a ``go'' command is automatically added at
the end, therefore it is not required in rules files.

@node Quit command, Message command, Go command, Other commands
@subsection Quit command
This command terminates AdaControl.

Syntax:
@example
quit;
@end example
If given in a file, all subsequent commands will be ignored. This
command is really useful only in interactive mode. @xref{Interactive
mode}.

@node Message command, Help command, Quit command, Other commands
@subsection Message command
This command prints a message on the output file.

Syntax:
@example
message "<any string>" [pause];
@end example
The length of the message is limited to 250 characters. If the word
``pause'' (case irrelevant) is specified after the message, AdaControl
will wait for the user to press the Return key before proceeding.

Note that the message is syntactically a string, and must therefore be
quoted (double quotes).

@node Help command, Clear command, Message command, Other commands
@subsection Help command
This command prints various informations about the rules and AdaControl
itself.

Syntax:
@example
Help [<help_item> @{,<help_item>@}]
<Help_Item> ::=<keyword> | <rule name> | variables ["<pattern>"]
<keyword>   ::= all | commands | license | list | options | rules | version
@end example
Without any argument, this command prints a summary of all commands
and rule names. If given one or more keywords or rule names, it prints the
corresponding help message. See @ref{Getting help} for the details.

@node Clear command, Set command, Help command, Other commands
@subsection Clear command
This command command clears (i.e. removes) controls that have been
previously given.

Syntax:
@example
Clear all | <rule name>@{,<rule name>@} ;
@end example
The command clears all controls given for the indicated rules, of for
all rules if the @code{all} keyword is given. Rule variables
(@pxref{Set command}) associated to cleared rules are returned to
their default values. For example, the following program:
@example
search entities (pack1);
go;
clear all;
search entities (pack2);
go;
@end example
will first output all usages of @code{Pack1}, then all usages of
@code{Pack2}. Without the ``clear all'' command, the second ``go''
would output all usages of @code{Pack1} together with all usages of
@code{Pack2}.

@node Set command, Source command, Clear command, Other commands
@subsection Set command
This command sets various parameters of AdaControl.

Syntax:
@example
set Format Gnat|Gnat_Short|CSV|CSV_Short|Source|Source_short|None;
set Check_Key|Search_Key "<value>"
set Max_Errors [<value>];
set Max_Messages [<value>];
set Output|New_Output <output file>;
set Statistics <level>;
set Tag1|Tag2 "<value>";
set Trace <trace file>;
set Debug|Exit_On_Error|Verbose|Warning|Warning_As_Error
      On|Off;
set Timing On|Off|Global
set Ignore On|Off|Inverted;
set <Rule_Name>.<Variable> <Value>
@end example
The ``set format'' command selects the output format for the messages,
like the ``-F'' option; see @ref{Control kinds and report messages} for
details.

The ``set check_key'' command defines a string which is used in place
of ``Error'' in messages issued by a ``check'' control. Similarly, the
``set search_key'' command defines a string which is used in place of
``Found'' in messages issued by a ``search'' control. This can be
useful when AdaControl is used, for example, to detect places where
manual inspection is required; having the word ``Error'' in the
message could be misleading to the persons in charge of the
review. Note however that if you set these keys, the GPS interface
will not be able to recognize properly the messages.

The ``set max_errors'' and ``set max_messages'' limit the output of
AdaControl, like the ``-m'' and ``-M'' options; see @ref{Output
limits} for details. If no <value> is given after the command name,
the corresponding limitation is removed.

The ``set output'' and ``set new_output'' commands redirect the output
of subsequent controls to the indicated file. If the string
@code{console} (case irrelevant) is given as the <output file>, output
is redirected to the console.

The ``set new_output'' always create a new file (or overwrites an
existing file with the same name).

The ``set output'' command appends if the file exists, unless the
``-w'' option is given, in which case it is overwritten. However, the
file is overwritten only the first time it is mentionned in an
``output'' command. This means that you can switch forth and back
between two output files, all results from the same run will be
kept. Note however that for this to work, you need to specify the
output file exactly the same way: if you specify it once as
``result.txt'', and then as ``./result.txt'', the second one will
overwrite the first one.

The ``set statistics'' command sets the statistics level, like the
``-S'' option;  see @ref{Control kinds and report messages} for details.

The ``set Tag1|Tag2'' command changes the tags used to disable (or
enable) rules. ``Tag1'' is the string that appears immediately after
the comment indicator (@code{--}), and ``tag2'' is the tag that
terminates the special comment. Note that these tags must be given as
strings (in quotes) and that case is relevant. See @ref{Disabling
controls} for details.

The ``set trace'' command redirects the trace messages of the
``-d'' option to the indicated file. If the string @code{console}
(case irrelevant) is given as the <trace file>, trace messages are
redirected to the console.  As with the ``-t'' option, if the file
exists, output is appended to it.

The ``set Debug|Exit_On_Error|Verbose|Warning|Warning_As_Error''
command activates (``on'') or deactivates (``off'') options. ``Debug''
corresponds to the ``-d'' option, ``Exit_On_Error'' to the ``-x''
option, ``Ignore'' to the ``-i'' option, ``Timing'' to the ``-T''
option, ``Verbose'' to the ``-v'' option, ``Warning'' to the ``-E''
option, and ``Warning_As_Error'' to the ``-e'' option. See
@ref{Verbose and debug mode}, @ref{Exit on error}, @ref{Treatment of
warnings}, @ref{Output format}, and @ref{Local disabling control} for
details.

The ``set Timing'' command activates (``on'') or deactivates (``off'')
the printing of the time spent in each rule after each ``go''
command. If set to ``global'' instead of ``on'', the timings are
accumulated over all ``go'' commands, and output when the program
terminates.

The ``set Ignore'' command governs handling of disabled messages
(@pxref{Disabling controls}). In default mode (``set Ignore Off''),
disabled messages are not printed. When set to ``on'' (``set Ignore
On''), all messages are printed, including those that are
disabled. Setting this option can result in considerable speed-up of
the printing of messages. When set to ``Inverted'' (``set Ignore
Inverted''), @i{only} disabled messages are printed. This is useful to
check which messages have been disabled.

Some rules may also have user-settable global variables that affect
their behaviour; the last form of the ``set'' command allows changing
their value. The variable name is of the form of a qualified name
(i.e. ``rule.var''), and the value depends on the variable. The
description of the variables (if any) and appropriate values is given
for each rule.

@node Source command, Inhibit command, Set command, Other commands
@subsection Source command
This command inputs commands from another file.

Syntax:
@example
Source <input file>;
@end example
Commands are read and executed from the indicated file, then control
is returned to the place after the ``source'' command. There is no
restriction on the content of the sourced file; especially, it may
itself include other ``source'' commands.

If <input file> is a relative file path, it is taken relatively to the
file where the ``source'' command is given. Especially, if no path is
specified, the sourced file will be taken from the same directory as
the sourcing file (irrespectively of where the command is being run
from). If the file is not found there, it is searched on the path given
by the environment variable @code{ADACTL_PATH}.

The default extension is @code{.aru}, i.e. if <input file> is not
found as given, AdaControl will retry the same name with @code{.aru}
appended. It is a syntax error if the file is not found either.

If the string @code{console} (case irrelevant) is given as the <input
file>, commands are read from the console until a ``quit'' command is
given. This command is of course useful only from files, and allows to
pass temporarily control to the user in interactive mode.

@node Inhibit command,  , Source command, Other commands
@subsection Inhibit command
This command prevents execution of certain controls on particular units.

Syntax:
@example
Inhibit <rule name>|all ([all] <unit> @{,[all] <unit>@});
@end example
Controls refering to the given rule (or all rules if ``all'' is
specified in place of a rule name) for the indicated unit(s) are not
performed. In addition, if ``all'' is specified in front of the unit
name, the unit will not be accessed at all, even from rules that
follow call graphs, and could thus access this unit while analyzing
other units.

There are several reasons why you might want to inhibit a control of
a rule for certain units:
@itemize
@item
The unit is known not to obey the rule in many places, and you don't
want the output to be cluttered with too many messages (of course,
you'll fix the unit in the near future!);
@item
The unit is known to obey the rule, execution of the rule is
time-consuming, and you want to save some processing time;
@item
The unit is known to raise an ASIS bug, and until you upgrade to the
appropriate version of GNAT, you don't want to be bothered by the
error messages.
@end itemize

The ``all'' option for a unit is intended for the last case, to
prevent ASIS bugs from spoiling any unit that calls something from an
offending unit.

@node Example of commands,  , Other commands, Command language reference
@section Example of commands
Below is an example of a file with multiple commands:
@example
message "Searching Unchecked_Conversion";
search entitities (ada.unchecked_conversion);
set output uc_usage.txt;
go;
clear all;
message "Searching 'Address";
search entities (all 'Address);
set output address_usage.txt;
go;
@end example
This file will output all usages of @code{Ada.Unchecked_Conversion}
into the file @code{uc_usage.txt}, then output all usages of the
@code{'Address} attribute into the file
@code{address_usage.txt}. Messages are output to tell the user about
what's happenning.

@node  Rules reference, Examples of using AdaControl for common programming rules, Command language reference, Top
@chapter Rules reference
This chapter describes each rule currently provided by
AdaControl. Note that the @code{rules} directory of the distribution
contains a file named @code{verif.aru} that contains an example of a
set of rules appropriate to check on almost any software.

A general limitation applies to all rules. AdaControl is a @i{static}
checking tool, and therefore cannot check usages that depend on
run-time values. For example, it is not possible to check rules
applying to an entity when this entity is aliased and accessed through
an access value, or rules applying to subprogram calls when the call
is a dispatching call.

@menu
* Abnormal_Function_Return::
* Allocators::
* Array_Declarations::
* Aspects::
* Assignments::
* Barrier_Expressions::
* Case_Statement::
* Characters::
* Comments::
* Declarations::
* Default_Parameter::
* Dependencies::
* Directly_Accessed_Globals::
* Duplicate_Initialization_Calls::
* Entities::
* Entity_Inside_Exception::
* Exception_Propagation::
* Expressions::
* Generic_Aliasing::
* Global_References::
* Header_Comments::
* Improper_Initialization::
* Instantiations::
* Insufficient_Parameters::
* Local_Access::
* Local_Hiding::
* Max_Blank_Lines::
* Max_Call_Depth::
* Max_Line_Length::
* Max_Nesting::
* Max_Size::
* Max_Statement_Nesting::
* Movable_Accept_Statements::
* Naming_Convention::
* No_Operator_Usage::
* Non_Static::
* Not_Elaboration_Calls::
* Not_Selected_Name::
* Object_Declarations::
* Parameter_Aliasing::
* Parameter_Declarations::
* Positional_Associations::
* Potentially_Blocking_Operations::
* Pragmas::
* Record_Declarations::
* Reduceable_Scope::
* Representation_Clauses::
* Return_Type::
* Side_Effect_Parameters::
* Silent_Exceptions::
* Simplifiable_Expressions::
* Simplifiable_Statements::
* Statements::
* Style::
* Terminating_Tasks::
* Type_Initial_Values::
* Type_Usage::
* Uncheckable::
* Unit_Pattern::
* Units::
* Unnecessary_Use_Clause::
* Unsafe_Elaboration::
* Unsafe_Paired_Calls::
* Unsafe_Unchecked_Conversion::
* Usage::
* Use_Clauses::
* With_Clauses::
@end menu

@node Abnormal_Function_Return, Allocators, Rules reference, Rules reference
@section Abnormal_Function_Return
This rule controls functions that may not terminate normally, i.e. where
@code{Program_Error} could be raised due to reaching the end of the
function without encountering a @code{@b{return}} statement.

@subsection Syntax
@example
<control_kind> abnormal_function_return;
@end example

@subsection Action
The rule controls that the sequence of statements of each function
body, as well as each of its exception handlers, ends with:
@itemize @bullet
@item
a @code{@b{return}} statement (including extended return statements)
@item
a @code{@b{raise}} statement (or equivalently, a call to
@code{Ada.Exceptions.Raise_Exception} or
@code{Ada.Exceptions.Reraise_Occurrence});
@item
a call to a procedure which is the target of a @code{@b{pragma} No_Return};
@item
a block statement, whose last statement of its sequence and any
exception handler is one of these;
@item
an @code{@b{if}} statement that includes an @code{@b{else}} path, and
where the last statement of every  path is one of these;
@item
a @code{@b{case}} statement where the last statement of every  path is
one of these.
@end itemize

This is a sufficient (but of course not necessary) condition to ensure
that no function raises @code{Program_Error} due to reaching the end
of its statements without encountering a @code{@b{return}}.

This rule can be specified only once.

Ex:
@example
check abnormal_function_return;
@end example

@subsection Tips
This rule checks that a function always returns correctly, but does not
prevent multiple @code{@b{return}} statements in functions. If you want
to ensure that there is exactly one @code{@b{return}} statement in functions,
and that this statement is always the last one, use this rule together with
the rule @code{statements(function_return)}.
@xref{Statements}.

It is possible to exit from an extended return statement with an
@code{@b{exit}} or @code{@b{goto}} statement. If this happens, the
return statement is not considered a proper return statement, and an
appropriate message is issued.

@node Allocators, Array_Declarations, Abnormal_Function_Return, Rules reference
@section Allocators
This rule controls the use of allocators (i.e. dynamic memory allocation).
@subsection Syntax
@example
<control_kind> allocators [(<target> @{, <target>@})];
<target>   ::= [anonymous | inconsistent | not] [<category>|<entity>]
<category> ::= ()  | access    | array | delta  | digits |
               mod | protected | range | record | tagged | task
@end example

@subsection Action
If one or several <entity> or <category> are given, only allocators
whose allocated type matches the <entity>, or whose type belongs to
the indicated <category>, are controlled; otherwise all allocators are
controlled. As usual, the whole syntax for entities is allowed for
<entity>. @xref{Specifying an Ada entity name}. The meaning of
<category> is:
@itemize @bullet
@item
``()'': The allocated value is of an enumerated type.
@item
``access'':  The allocated value is of an access type.
@item
``array'': The allocated value is of an array type.
@item
``delta'': The allocated value is of a fixed point type (it is not currently
possible to distinguish ordinary fixed point types from decimal fixed
point types).
@item
``digits'': The allocated value is of a floating point type.
@item
``mod'': The allocated value is of a modular type.
@item
``protected'': The allocated value is of a protected type.
@item
``range'': The allocated value is of a signed integer type.
@item
``record'': The allocated value is of an (untagged) record type.
@item
``tagged'': The allocated value is of a tagged type (including type
extensions).
@item
``task'': The allocated value is of a task type.
@end itemize

This rule is especially useful for finding memory leaks, since it
tells all the places where dynamic allocation occurs.

If a parameter is preceded by the word ``not'', allocators for the
corresponding type or category are not controlled (i.e. they are
always allowed). If a control includes only ``not'' parameters, an
implicit check for all allocators is assumed.

If a parameter is preceded by the word ``anonymous'', only allocators
whose expected type is an anonymous access type are controlled.

If a parameter is preceded by the word ``inconsistent'', only
allocators whose allocator subtype (the name after ``@code{@b{new}}'')
is not the same as the designated subtype (from the access type
declaration) are controlled. However an allocator is not considered
inconsistent when the designated subtype imposes no special
constraint:
@itemize @bullet
@item
when it is a class-wide type, since the allocator subtype will
generally be of some descendant specific type;
@item
when it is an unconstrained array type, since the allocated subtype is
necessarily constrained;
@item
when it is a base type (of the form @code{T'Base}).
@end itemize

Note that if the access type includes a constraint like in the
following example:
@example
   @b{type} Acc @b{is} @b{access} integer @b{range} 1..10;
@end example
all allocators will necessarilly be inconsistent, since there is no
way to repeat the constraint at the place of the allocator.

``Inconsistent'' can be given alone, in which case all inconsistent
allocators are controlled.

Ex:
@example
search allocators (standard.string);
check allocators (T'Class);
check allocators (array);
check allocators (Inconsistent standard.Integer);
check allocators (Inconsistent);

 -- all task allocators, except when the type is called "special":
check allocators (task, not all Special);
@end example

@subsection Tips
The type given as an <entity> in the rule must be a first named
subtype, and the rule will also find allocators that use a subtype of
this type. If the type is declared within a generic package, the rule
will control all corresponding types from instantiations.

The type mentionned in the rule is the one following the
@code{@b{new}} keyword, which is not necessarily the same as the
expected type in presence of implicit conversions like this:

@example
   @b{type} T @b{is} @b{tagged} ...;
   @b{type} Class_Access @b{is} @b{access} T'Class;
   X : Class_Access;
begin
   X := @b{new} T;
@end example

This allocator will be found for type @code{T}, not for type @code{T'Class}.

For <categories>, note that the rule ``sees through'' derived and
private types (i.e. it will trigger if the ultimate type belongs to
the indicated category).

The reason for the ``inconsistent'' modifier is that inconsistent
allocators may cost a double check. Given:
@example
   @b{type} Acc @b{is} @b{access} Positive;
   V : Acc;
@b{begin}
   V := @b{new} Natural'(...);
@end example
The compiler will first check the constraint for Natural, then the
constraint for Positive.  To avoid confusion, it is better to always
use the same subtype for the allocator as used in the access type
declaration.

The reason for the ``anonymous'' modifier is that allocators of
an anonymous type (especially access parameters) create a terrible mess in
accessibility rules, and are better avoided.
@subsection Limitations
In some (rare) cases involving anonymous access types as array or
record components, ASIS provides no way to determine the target type
of the (anonymous) acccess type. Inconsistent allocators will thus not
be controlled. Such cases are detected by the rule ``uncheckable''.
@xref{Uncheckable}.

@node Array_Declarations, Aspects, Allocators, Rules reference
@section Array_Declarations
This rule controls properties of arrays, by enforcing a consistent
value or range of values for the lower or upper bound, or by limiting
the possible size. It can also control various aspects of the
component type of the array.
@subsection Syntax
@example
<control_kind> array_declarations (first,      <value> | <bounds>);
<control_kind> array_declarations (last,       <value> | <bounds>);
<control_kind> array_declarations (dimensions, <value> | <bounds>);
<control_kind> array_declarations (length,     <bounds>);
<control_kind> array_declarations (component,  <type> @{,<repr_cond>@});
<control_kind> array_declarations (index,      <type> | <> @{,<type> | <>@});
<bounds>    ::= min|max <value> [, min|max <value> ]
<type>      ::= <entity>|<category>
<category > ::= () | access    | array | delta  | digits | mod | private
                   | protected | range | record | tagged | task
<repr_cond> ::= [not] pack | size | component_size
@end example
@subsection Action
The first parameter is a subrule keyword:
@itemize
@item
``First'' and ``Last'' control the lower (respectively upper) bound of
each dimension of arrays (even unconstrained array types). If a single
value is specified without the ``min'' or ``max'' modifiers, the
subrule controls the bounds that are not exactly this value;
otherwise, it controls the bounds that are smaller than the given
``min'' value or greater than the given ``max'' value. It is possible,
but not required to specify both ``min'' and ``max''. If this subrule
is given both for ``search'' and for ``check'', the value(s) for
``search'' is interpreted as the prefered one, and the value(s) for
``check'' is interpreted as an alternative acceptable one; i.e., it is
a warning if the value is the one given for ``check'', and an error if
it is neither. In short:
@example
search array_declarations (first, 1);
check array_declarations (first, min -1, max 1);
@end example
will be silent if the lower bound of an array is 1, it will issue a
warning  if it is in the range -1 .. 1, and an error otherwise.
@item
``Dimensions''controls the number of dimensions of arrays. If a single
value is specified without the ``min'' or ``max'' modifiers, the
subrule controls arrays whose number of dimensions is not exactly this
value; otherwise, it controls arrays whose number of dimensions are
smaller than the given ``min'' value or greater than the given ``max''
value. It is possible, but not required to specify both ``min'' and
``max''. If this subrule is given both for ``search'' and for
``check'', the value(s) for ``search'' is interpreted as the prefered
one, and the value(s) for ``check'' is interpreted as an alternative
acceptable one; i.e., it is a warning if the value is the one given
for ``check'', and an error if it is neither. In short:
@example
search array_declarations (Dimensions, 1);
check array_declarations (Dimensions, min 2, max 3);
@end example
will be silent for one-dimensional arrays, it will issue a warning for
2- and 3-dimensional arrays, and an error otherwise.
@item
``Length'' controls arrays that have a dimension whose number of
elements is smaller than the given ``min'' value or greater than the
given ``max'' value (except for unconstrained array types). At least
one of ``min'' or ``max'' must be specified, but it is not required to
specify both.
@item
``Component'' controls arrays whose component type is the indicated
<entity>, or whose component type belongs to the indicated
<category>. If the <entity> is a subtype, only arrays whose components
are of that subtype are controlled. If the indicated <entity> is a
type, all arrays whose components are of that type (including
subtypes) are controlled. The meaning of <category> is:
@itemize @bullet
@item
``()'': The component is of an enumerated type.
@item
``access'':  The component is of an access type.
@item
``array'': The component is of an array type.
@item
``delta'': The component is of a fixed point type (it is not currently
possible to distinguish ordinary fixed point types from decimal fixed
point types).
@item
``digits'': The component is of a floating point type.
@item
``mod'': The component is of a modular type.
@item
``private'': The component is of a private type (including private
extensions).
@item
``protected'': The component is of a protected type.
@item
``range'': The component is of a signed integer type.
@item
``record'': The component is of an (untagged) record type.
@item
``tagged'': The component is of a tagged type (including type
extensions).
@item
``task'': The component is of a task type.
@end itemize
If <repr_cond> are specified, the rule controls only arrays to which
all the corresponding representation items apply:
@itemize @bullet
@item
``pack'': A pragma Pack applies to the array.
@item
``not pack'': No pragma Pack applies to the array.
@item
``size'': A size representation clause applies to the array.
@item
``not size'': No size representation clause applies to the array.
@item
``component_size'': A component_size representation clause applies to
the array.
@item
``not component_size'': No component_size representation clause
applies to the array.
@end itemize

@item
``index'' controls arrays whose index types are the indicated
<entity>, or whose index types belong to the indicated <category>. If
the <entity> is a subtype, only arrays whose indexes are of that
subtype are controlled. If the indicated <entity> is a type, all
arrays whose indexes are of that type (including subtypes) are
controlled. The meaning of <category> is the same as for
``component'', but obviously only ``()'', ``range'', and ``mod'' are
allowed.

The number of <entity> given determines the dimensionality of the
controlled arrays.  If a ``<>'' is given in place of an entity, it
means that any type matches at that position.
@end itemize

This rule can be specified several times for the ``component'' and
``index'' subrules.  For other subrules, it can be specified at most
once for each subrule and for each of ``check'', ``search'' and
``count''. It is thus possible for each subrule to have a value
considered a warning, and a value considered an error.

Ex:
@example
-- All arrays should start at 1:
check array_declarations (first, 1);

-- No arrray of more than 100 elements:
check array_declarations (length, max 100);

-- No empty array:
check array_declarations (length, min 1);

-- Arrays whose component type is private:
check array_declarations (component, private);

-- Packed arrays of Character
check array_declarations (component, Standard.Character, pack);

-- Packed arrays of record without size clause
check array_declarations (component, record, packed, not size);

-- One-dimensional arrays indexed by Integer
check array_declarations (index, standard.integer);

-- Three dimensional arrays whose second index is an enumeration
check array_declarations (index, <>, (), <>);
@end example

@subsection Tips
The subrule @code{Max_Length} ignores index constraints that are not
static.  Non static index constraints can be controlled with the rule
@code{Non_Static (Index_Constraint)}. @xref{Non_Static}.

Requiring the same @i{upper} bound for all arrays is not very useful, but:
@example
check array_declarations (last, min 1);
@end example
can be used to check that no array has a negative or zero upper bound.

The subrule ``index'' controls  a precise pattern of types used as
indices. To control the use of a type as an index at any position and
irrespectively of the number of indices of the array, use the rule
``type_usage''. @xref{Type_Usage}.

@node Aspects, Assignments, Array_Declarations, Rules reference
@section Aspects
This rule controls aspect specifications (new feature in Ada 2012), either
all of them or specific ones.
@subsection Syntax
@example
<control_kind> aspects [(all | <aspect mark> @{, <aspect mark>@})];
@end example
@subsection Action
Without parameters (or if ``all'' is given), controls all aspect
specifications. Otherwise, controls only the aspect specifications
corresponding to the given aspect marks.

Ex:
@example
search aspects;
DBC: check aspects (Pre, Post, Pre'Class, Post'Class);
@end example

@node  Assignments, Barrier_Expressions, Aspects, Rules reference
@section Assignments
This rule controls various issues related to the assignment
statement: assignments that involve array sliding, redundant
assignments to the same variable, or groups of assignments that are
replaceable by aggregate assignment.

@subsection Syntax
@example
<control_kind> assignments (sliding);
<control_kind> assignments (repeated);
<control_kind> assignments (groupable, <filter> @{,<filter>@});
<filter> ::= given <min_val> | missing <max_val> | ratio <min_val> |
             total <max_val>
@end example

@subsection Action
The first form (keyword ``sliding'') controls array assignments where
the target variable has a different lower bound than the assigned
expression; this is allowed by the language only in so-called
``sliding'' contexts.

Other subrules control properties of groups of assignment statements. A
group is made of consecutive assignments, without any other
intervening kind of statements (except null statements).

The second form (keyword ``repeated'') controls when a same variable
(or a same subcomponent of a structured variable) is assigned several
times in the same group of assignments. This form of the rule can be
given only once.

The third form (keyword ``groupable'') controls assignments to
different subcomponents of a same structured variable; such
assignments are often replaceable by a global assignment of an
aggregate to the variable. One or several <filter> parameters
indicate under which conditions a group is reported:
@itemize @bullet
@item
``given'': <min_val> (an integer value) indicates the minimum number
of assigned subcomponents that will trigger the rule (i.e. the rule is
triggered if  the number of assignments to subcomponents of a same
variable is greater or equal to the indicated value).
@item
``missing'': <max_val> (an integer value) indicates the maximum number
of subcomponents not assigned that will trigger the rule (i.e. the
rule is triggered if  the number of subcomponents not assigned to is
lesser or equal to the indicated value).
@item
``ratio'': <min_val> (an integer value) indicates the minimum
percentage of assigned subcomponents that will trigger the rule
(i.e. the rule is triggered if  the percentage of assigned
subcomponents is greater or equal to the indicated value).
@item
``total'': <max_val> (an integer value) indicates the maximum number
of subcomponents of the type that will trigger the rule (i.e. the
rule is triggered if  the number of subcomponents of the record type is
lesser or equal to the indicated value).
@end itemize

If several filters are given, the rule is triggered if all conditions
are met (``and'' logic). Note however that this rule can be given
several times, thus achieving ``or'' logic.

The rule is @i{not} triggered on an object if a subcomponent of that object
is of a limited type, since global assignment would not be allowed in
that case.

For other structured objects, a subcomponent is counted as assigned if
it has been assigned in full, or if it @i{should} have been assigned
in full (in other words: if the rule is triggered on those
subcomponents as well) - recursively, of course.

Ex:
@example
search Assignments (sliding);
check  Assignments (repeated);

-- Warn if a at least 3 fields are given and at most
-- two fields are missing, or if 80% of the fields are given:
search assignments (groupable, given 3, missing 2);
search assignments (groupable, ratio 80);
@end example

@subsection Tip
The ``sliding'' subrule is not intended to prevent all cases of
slidings (the dynamic ones are uncheckable), it is rather an
indication of ``obvious'' cases that could be avoided.

Note that for the ``groupable'' subrule, it is possible to give 1 for
the ``given'' criterion; in this case, any assignment to parts of a
structured variable will be reported, only global assignment is
allowed.

@subsection Limitations
As usual, AdaControl can control only static aspects of
assignments. Therefore, it cannot control assignments whose target is
not statically known (like dynamic indexing of arrays). Slices are
always considered dynamic (the cases where it would be useful did not
seem  worth the additional complexity).

For the ``sliding'' subrule, if the assigned expression is a
multidimensional aggregate, only the first dimension is checked for
sliding, other dimensions are ignored. This is not considered an
important issue, since in any case the rule can detect only static
cases, and the handling of sliding in multi-dimensional array
aggregates is extremely touchy (see RM 4.3.3 for details).

For the ``groupable'' subrule, if the number of subcomponents is not
statically determinable (dynamic arrays, discriminated records), only
the ``given'' criterion can be met.

@node Barrier_Expressions, Case_Statement, Assignments, Rules reference
@section Barrier_Expressions
Although the language allows any expression as the barrier of a
protected entry, it is generally better to use only ``simple''
expressions. This rule controls the kind of constructs allowed in
barrier expressions.
@subsection Syntax
@example
<control_kind> Barrier_Expressions ([<allowable> @{, <allowable>@}]);
<allowable>    ::= <entity> | <keyword>
<keyword> ::= allocation          | any_component   | any_variable        |
              arithmetic_operator | array_aggregate | comparison_operator |
              conversion          | dereference     | indexing            |
              function_attribute  | local_function  | logical_operator    |
              record_aggregate    | value_attribute
@end example
@subsection Action
Without parameters, the only elements allowed in barriers are
references to boolean components of the protected element and
litterals (this corresponds to what is allowed for the Ravenscar
profile). Parameters specify other constructs that are allowed:
@itemize @bullet
@item
Any <entity> (like a global variable, a function...) can be specified
and is thus allowed. As usual, the whole syntax for entities is allowed for
<entity>. @xref{Specifying an Ada entity name}.
@item
``allocation'' allows use of allocators.
@item
``any_component'' allows use of protected components that are not of
type @code{Standard.Boolean}.
@item
``any_variable'' allows use of any variable (i.e. variables external to
the protected element).
@item
``arithmetic_operator'' allows use of predefined arithmetic operators
(@code{"+"}, @code{"**"}, etc.).
@item
``array_aggregate'' allows use of array aggregates.
@item
``comparison_operator'' allows use of predefined comparison and
membership operators (@code{"="}, @code{">"}, @code{@b{in}}, etc.).
@item
``conversion'' allows use of type conversions and type qualifications.
@item
``dereference'' allows use of dereferencing of access types (both implicit
and explicit dereferences).
@item
``indexing'' allows use of array indexing and slices.
@item
``function_attribute'' allows use of attributes that are functions
(like @code{'Pred}, @code{'Image}, etc.).
@item
``local_function'' allows use of (protected) functions declared in the
same protected object.
@item
``logical_operator'' allows use of predefined logical operators and
short-circuit forms (@code{@b{and}}, @code{@b{or else}}, etc.).
@item
``record_aggregate'' allows use of record aggregates and extension
aggregates.
@item
``value_attribute'' allows use of attributes that are simple values
(like @code{'First}, @code{'Terminated}, etc.).
@end itemize

This rule can be given only once for each of ``check'', ``search'' and
``count''.

Ex:
@example
search barrier_expressions;
check  barrier_expressions (logical_operator, comparison_operator,
                            any_component,
                            Pack.Global_State);
@end example

@subsection Tips
The goal of the ``Simple_Barrier'' restriction from the Ravenscar
profile is to ensure that evaluation of barriers never raise
exceptions. Even simple things like a qualified expression can raise
exceptions, but in practice more than the restriction of the Ravenscar
profile can be ``reasonably'' allowed.

Note that the various ``operator'' keywords allow only the use of
predefined operators. If a user defined operator should be allowed,
provide it explicitely as an <entity>. There is no way to allow any
function call, since this would boil down to allowing pretty much
anything, but you can of course specify explicitely functions that can
be called.

You can provide this rule both for ``check'' and ``search'', but of
course it makes sense only if the set of allowed features for
``search'' is a superset of those allowed for ``check''.  This way, the
use of certain features can be interpreted only as a warning.

@node Case_Statement, Characters, Barrier_Expressions, Rules reference
@section Case_Statement
This rule controls various metrics related to the @code{@b{case}}
statement.  It is intended for cases where it is desired to limit the
complexity of @code{@b{case}} statements.
@subsection Syntax
@example
<control_kind> Case_Statement (<subrule>, <bound> [, <bound>]);
<subrule> ::= others_span | paths | range_span | values | values_if_others
<bound>   ::= min | max <value>
@end example

@subsection Action
The first parameter is a subrule keyword. The second (and optionnally
third) parameter give the minimum and/or maximum allowed values
(i.e. the rule will control values outside the indicated interval). If
not specified, the minimum value is defaulted to 0 and the maximum
value to infinity. The parameters controlled by each subrule are:
@itemize
@item
``others_span'' controls the number of values covered by
@code{@b{when}} @code{@b{others}} case alternatives.
@item
``paths'' controls the number of paths (i.e. @code{@b{when}} branches).
@item
``range_span'' controls the number of values covered by ranges used as
choices.
@item
``values'' controls the number of values covered by the subtype
of the @code{@b{case}} selector.
@item
``values_if_others'' is like ``values'', but is activated only for
@code{@b{case}} statements with a @code{@b{when}} @code{@b{others}}
alternative.
@end itemize

This rule can be specified at most once for each subrule and for each
of ``check'', ``search'' and ``count''. It is thus possible for each
subrule to have a value considered a warning, and a value considered
an error.

Ex:
@example
check  Case_Statement (others_span, min 1);
search Case_Statement (others_span, min 5);

check  Case_Statement (values, max 10);
check  Case_Statement (paths, min 3, max 30);
@end example

@subsection Tips
To control that no range is used as a choice in a @code{@b{case}}
statement:
@example
check case_statement (range_span, max 0);
@end example

To control ``@code{@b{when}} @code{@b{others}}'' that
cover no value at all:
@example
check case_statement (others_span, min 1);
@end example

@subsection Limitations
If some characteristic of the @code{@b{case}} statement depend on a
generic formal type, it is not possible to control some of the
features statically. Such cases are detected by the rule
``uncheckable''. @xref{Uncheckable}.

@node  Characters, Comments, Case_Statement, Rules reference
@section Characters
This rule makes sure that the program text does not use
``undesirable'' characters.
@subsection Syntax
@example
<control_kind> characters [(<subrule> @{, <subrule>@})];
<subrule> ::= control | not_iso_646 | trailing_space | wide
@end example

@subsection Action
The rule controls the occurrence in the source file of characters
belonging to the classe(s) defined by the subrules. Without
parameters, all classes are controlled.  The classes are defined as
follows:
@itemize @bullet
@item
``control'': control characters that are allowed by the language
(ASCII HT,  ASCII VT and ASCII FF).
@item
``not_iso_646'': characters outside the ISO-646 set (aka ASCII).
@item
``trailing_space'': space characters appearing at the end of the
source line.
@item
``wide'': wide characters that are not in @code{Standard.Character}.
@end itemize

This rule can be given only once for each class of characters.

Ex:
@example
check characters (control, trailing_space);
search characters (not_iso_646);
@end example

@subsection Limitations
With the ``wide'' subrule, the error message may seem to not always
appear at the right place; this depends on the encoding scheme
used. For example, if your source contains (using bracket encoding):
@example
S : Wide_String := "["1041"]["1042"]";
@end example
it will appear to AdaControl as a string containing two characters,
and therefore the error message for the second wide character will
point at two characters after the opening quote of the string.

This rule controls only the characters in the source file; other means
of having characters in the corresponding classes (like using the
@code{'Val} attribute) are not controlled.

@node  Comments, Declarations, Characters, Rules reference
@section Comments
This rule controls comments that must, or must not, appear in certain cases.

@subsection Syntax
@example
<control_kind> comments (pattern, "<pattern>" @{, "<pattern>"@});
<control_kind> comments (position, <value> | <bounds>);
<control_kind> comments (terminating @{, "<pattern>" | begin | end@});
<control_kind> comments (unnamed_begin, <kind> @{, <kind>@});
<bounds>    ::= min|max <value> [, min|max <value> ]
<kind>      ::= [<condition>] <unit_kind>
<condition> ::= always | declaration | program_unit
<unit_kind> ::= all | procedure | function | entry | package | task
@end example

@subsection Action
The first parameter is a subrule name which detemines what is being
controlled.
@itemize @bullet
@item
``pattern'' controls comments that match one of the given patterns
(given as strings). Only the ``useful'' part of the comment is
matched against the patterns, i.e. the part after the ``@code{--}''
and spaces following it. Patterns are given using the full Regexp
syntax. @pxref{Syntax of regular expressions} for details. Pattern
matching is always case insensitive.

This subrule is especially useful to find lines with comments like
``TBSL'' (To Be Supplied Later) or ``fixme'', which are often used to
mark places where something should be done before releasing the
program.
@item
``position'' controls the starting position of comments. If a single
value is specified without the ``min'' or ``max'' modifiers, the
subrule controls comments that do not start exactly at the indicated
column position; otherwise, it controls comments whose starting column
is smaller than the given ``min'' value or greater than the given
``max'' value. It is possible, but not required to specify both
``min'' and ``max''. If this subrule is given both for ``search'' and
for ``check'', the value(s) for ``search'' is interpreted as the
prefered one, and the value(s) for ``check'' is interpreted as an
alternative acceptable one; i.e., it is a warning if the value is the
one given for ``check'', and an error if it is neither. In short:
@example
search comments (position, 1);
check  comments (first, min 1, max 6);
@end example
will be silent for comments that start in column 1, it will issue a
warning for comments that start at columns 2 to 6, and an error otherwise.

@item
``terminating'' controls comments that are at the end of an otherwise
non empty line (i.e. that appear on the same line as a declaration or
statement). If ``begin'' is specified, comments appearing on a line
that contains only a @code{@b{begin}} are allowed (not reported);
similarly, if ``end'' is specified, comments appearing on a line that
contains only an @code{@b{end}} are allowed. Otherwise, the other
parameters are patterns that specify forms of comments that are
allowed. Patterns are given using the full Regexp syntax.
@pxref{Syntax of regular expressions} for details. Pattern matching is
always case insensitive.
@item
``unnamed_begin'' controls @code{@b{begin}} of various constructs that
do not have a comment that repeats the name of the program unit
associated to the @code{@b{begin}}. Except for spaces, the comment
must not contain anything else than the unit name.

The <condition> keyword determines circumstances where the comment is required:
@itemize
@item
''always'' (default): the comment is always required.
@item
``declaration'': the comment is required only if the preceding
declaration part is non-empty (not counting pragmas).
@item
``program_unit'': the comment is required only if the preceding
declaration part contains the declarations of other program units
(subprograms, packages, protected objects, or tasks).
@end itemize

The <unit_kind> keyword detemines the kind of program unit to which
the rule applies (``all'' stands for all kinds).  The subrule can be
given only once of each kind of program unit.
@end itemize

Ex:
@example
check comments (pattern, "TBSL");

-- Report places where rules are disabled:
search comments (pattern, "##.* off");

-- End of line comments are not allowed, except for the
-- comment that repeats the name of a procedure on the "begin"
-- line, and special AdaControl comments
check comments (terminating, begin, "^ *##");

-- Named begin required for packages unless they have no
-- declaration, and subprograms if they have nested units
check comments (unnamed_begin, declaration package);
check comments (unnamed_begin, program_unit procedure);
check comments (unnamed_begin, program_unit function);
@end example

@subsection Tips
Remember that a Regexp matches if the pattern matches any part of the
identifier.  Use ``^'' and ``$'' to match the beginning (resp. end) of
the comment, or both.

@subsection Limitations
This rule does not support wide characters outside the basic Latin-1 set.

@node Declarations, Default_Parameter, Comments, Rules reference
@section Declarations
This rule controls usage of various kinds of declarations, possibly only
those occurring at specified locations.
@subsection Syntax
@example
<control_kind> declarations (<subrule> @{, <subrule>@});
<subrule>     ::= @{<location_kw>@} <declaration_kw>
<location_kw> ::= all | block   | library | local      | nested |
                  own | private | public  | in_generic | task_body
<declaration_kw> ::=
   any_declaration                   | abstract_function                 |
   abstract_operator                 | abstract_procedure                |
   abstract_type                     | access_all_type                   |
   access_constant_type              | access_constrained_array_type     |
   access_def_discriminated_type     | access_formal_Type                |
   access_language_type              | access_nondef_discriminated_type  |
   access_protected_type             | access_subprogram_type            |
   access_task_type                  | access_unconstrained_array_type   |
   access_unknown_discriminated_type | access_type                       |
   aliased_array_component           | aliased_constant                  |
   aliased_protected_component       | aliased_record_component          |
   aliased_variable                  | anonymous_access_component        |
   anonymous_access_constant         | anonymous_access_discriminant     |
   anonymous_access_parameter        | anonymous_access_variable         |
   anonymous_subtype_allocator       | anonymous_subtype_case            |
   anonymous_subtype_declaration     | anonymous_subtype_for             |
   anonymous_subtype_indexing        | array                             |
   array_type                        | binary_modular_type               |
   box_defaulted_formal_function     | box_defaulted_formal_procedure    |
   character_literal                 | child_unit                        |
   class_wide_constant               | class_wide_variable               |
   constant                          | constrained_array_constant        |
   constrained_array_type            | constrained_array_variable        |
   controlled_type                   | decimal_fixed_type                |
   defaulted_discriminant            | defaulted_generic_parameter       |
   defaulted_parameter               | deferred_constant                 |
   derived_type                      | discriminant                      |
   empty_private_part                | empty_visible_part                |
   enumeration_type                  | entry                             |
   equality_operator                 | exception                         |
   expression_function               | extension                         |
   fixed_type                        | float_type                        |
   formal_function                   | formal_package                    |
   formal_procedure                  | formal_type                       |
   function                          | function_call_renaming            |
   function_instantiation            | generic                           |
   generic_function                  | generic_package                   |
   generic_procedure                 | handlers                          |
   incomplete_type                   | in_out_generic_parameter          |
   in_out_parameter                  | initialized_protected_component   |
   initialized_record_component      | initialized_variable              |
   instantiation                     | integer_type                      |
   interface_type                    | library_unit_renaming             |
   limited_private_type              | modular_type                      |
   multiple_names                    | multiple_protected_entries        |
   name_defaulted_formal_function    | name_defaulted_formal_procedure   |
   name_defaulted_formal_function    | name_defaulted_formal_procedure   |
   named_number                      | non_binary_modular_type           |
   non_identical_operator_renaming   | non_identical_renaming            |
   non_joint_ce_ne_handler           | non_limited_private_type          |
   non_ravenscar_task                | not_operator_renaming             |
   null_defaulted_formal_procedure   | null_extension                    |
   null_ordinary_record_type         | null_procedure                    |
   null_procedure_body               | null_procedure_declaration        |
   null_tagged_type                  | operator                          |
   operator_renaming                 | ordinary_fixed_type               |
   ordinary_fixed_type_no_small      | ordinary_fixed_type_with_small    |
   ordinary_record_type              | ordinary_record_variable          |
   out_parameter                     | package                           |
   package_instantiation             | package_statements                |
   predefined_operator               | private_extension                 |
   procedure                         | procedure_instantiation           |
   protected                         | protected_discriminant            |
   protected_entry                   | protected_type                    |
   protected_variable                | record_type                       |
   renaming                          | renaming_as_body                  |
   renaming_as_declaration           | scalar_variable                   |
   self_calling_function             | self_calling_procedure            |
   separate                          | signed_type                       |
   single_array                      | single_protected                  |
   single_task                       | subtype                           |
   tagged_private_type               | tagged_type                       |
   tagged_variable                   | task                              |
   task_discriminant                 | task_entry                        |
   task_type                         | task_variable                     |
   type                              | unconstrained_array_constant      |
   unconstrained_array_type          | unconstrained_array_variable      |
   unconstrained_subtype             | uninitialized_protected_component |
   uninitialized_record_component    | uninitialized_variable            |
   unknown_discriminant              | variable                          |
   variant_part
@end example

@subsection Action
The <location_kw> restricts the places where the occurrence of the
declaration is controlled.  Several <location_kw> can be given, in
which case the declaration is controlled at places where all the
keywords apply. If there is no <location_kw>, it is assumed to be
``all''.
@itemize @bullet
@item
@code{all}: puts no special restriction to the location. This keyword
can be specified for readability purposes, and if specified must
appear alone (not with other <location_kw>).
@item
@code{block}: only declarations appearing in block statements are controlled.
@item
@code{library}: only library level declarations are controlled.
@item
@code{local}: only local declarations are controlled (i.e. only declarations
appearing in (generic) packages, possibly nested, are allowed).
@item
@code{nested}: only declarations nested in another declaration are
controlled (i.e. only library level declarations are allowed).
@item
@code{own}: only declarations that are local to a (generic) package body
are controlled.
@item
@code{public}: only declarations appearing in the visible part of
(generic) packages are controlled.
@item
@code{private}: only declarations appearing directly in a private
part are controlled.
@item
@code{in_generic}: only declarations appearing directly or indirectly in a generic
specification or body are controlled.
@item
@code{task_body}: only declarations appearing directly in a task body
are controlled. Note that it would not make sense to have a
<location_kw> for task @i{specifications}, since only entries can
appear there, and they cannot appear anywhere else.
@end itemize

The <declaration_kw> specifies what kind of declaration to control:
@itemize @bullet
@item
Declaration keywords that are Ada keywords match the corresponding Ada
declarations.
@item
@code{any_declaration} controls all declarations. This is of course not
intended to forbid all declarations in a program (!), but
@emph{counting} all declarations can be quite useful.
@item
@code{abstract_function}, @code{abstract_operator}, and
@code{abstract_procedure} control the declarations of abstract
functions, abstract operators, and abstract procedures, respectively.
@item
@code{abstract_type} controls the declaration of non-formal abstract
types.
@item
@code{access_type} controls all access type declarations, while
@code{access_subprogram_type}, @code{access_protected_type}, and
@code{access_task_type} control only access to procedures or
functions, access to protected types, or access to task types,
respectively. Similarly, @code{access_constrained_array_type} and
@code{access_unconstrained_array_type} control access to constrained
or unconstrained array types, @code{access_def_discriminated_type},
@code{access_nondef_discriminated_type}, and
@code{access_unknown_discriminated_type} control access to types with
discriminants with default values, without default values, and unknown
discriminants, respectively. @code{access_formal_type} controls access
to (generic) formal types, @code{access_all_type} control generalized
access to variables types (aka "@code{@b{access} @b{all} T}", and
@code{access_constant_type} control generalized access to constants
types (aka "@code{@b{access} @b{constant} T}"). @code{access_language_type}
controls access to language defined private types.
@item
@code{aliased_variable} and @code{aliased_constant} control the
declarations of aliased variables or constants, respectively.
@item
@code{aliased_array_component} controls the declaration of arrays
(array types or single arrays) whose components are declared aliased.
@item
@code{aliased_record_component} and @code{aliased_protected_component}
control the declarations of aliased record (respectively protected)
components.
@item
@code{anonymous_access_component} controls array and record components
that are of an anonymous access type (but not discriminants, which are
controlled by @code{anonymous_access_discriminant}). Similarly,
@code{anonymous_access_constant} and  @code{anonymous_access_variable}
control constants and  variables that are of an anonymous access type
(including generic formal @code{@b{in}} and @code{@b{in} @b{out}}
parameters, respectively). @code{anonymous_access_parameter} controls
subprogram parameters that are of an anonymous access type, the only
ones that existed in Ada 95. Note that to avoid unnecessary messages,
if a subprogram has an explicit specification, the message for
@code{anonymous_access_parameter} is given on the specification and
not repeated on the body.
@item
@code{anonymous_subtype_declaration} controls the declarations of
anonymous subtypes and ranges that are part of some other
declaration. Similarly, @code{anonymous_subtype_allocator},
@code{anonymous_subtype_case}, @code{anonymous_subtype_for}, and
@code{anonymous_subtype_indexing} control anonymous subtype
declarations and ranges that are part of allocators, @code{@b{case}}
statements (ranges in the @code{@b{when}} path), @code{@b{for}} loop
statements, and indexing of slices or array aggregates, respectively.
@item
@code{array} controls all array definitions (array types and single
arrays), while @code{array_type} controls only array types and
@code{single_array} controls only single arrays (objects of an
anonymous array type). @code{constrained_array_type} controls only
constrained array types, while @code{unconstrained_array_type}
controls only unconstrained array
types. @code{constrained_array_variable} controls variable
declarations where the given (or anonymous) array type is constrained,
while @code{unconstrained_array variable} controls variable
declarations where the given (or anonymous) array type is
unconstrained (and the constraint is provided by the initial value).
@code{constrained_array_constant} and
@code{unconstrained_array_constant} do the same with constants instead
of variables.
@item
@code{character_literal} controls the declaration of new character
literals, i.e. character literals defined as part of the values of an
enumeration type.
@item
@code{child_unit} controls the declaration of all child units.
@item
@code{constant} controls all constants, while
@code{class_wide_constant} control the declaration of constants of a
class-wide type, and @code{deferred_constant} controls the declaration
of deferred constants.
@item
@code{controlled_type} controls the declaration of controlled types,
i.e. descendants of @code{Ada.Finalization.Controlled} or
@code{Ada.Finalization.Limited_Controlled}. Note that this includes
also private types that are not visibly controlled.
@item
@code{defaulted_parameter} controls subprogram or entry (@b{in})
parameters that provide a default value, while
@code{defaulted_generic_parameter} controls generic formal objects
that provide a default value.
@item
@code{derived_type} controls regular derived types, but not type
extensions (derivations of tagged types). These are controlled by
@code{extension} and @code{private_extension}.
@item
@code{discriminant} controls all declarations of types with
discriminants, while @code{protected_discriminant} and
@code{task_discriminant} control only discriminants of protected types
and task types, respectively.  @code{defaulted_discriminants} controls
only discriminants where default values are
provided. @code{unknown_discriminants} controls only unknown
discriminants (AKA ``@code{(<>)}'' discriminants).
@item
@code{empty_private_part} controls package specification with an empty
private part, i.e. where the word @code{@b{private}} appears, but the
private part contains no declaration (even if it contains pragmas).
@item
@code{empty_visible_part} controls package specifications that contain
no declaration in the visible part (before the word @code{@b{private}}
if any), even if it contains pragmas.
@item
@code{enumeration_type} controls the declaration of enumeration types.
@item
@code{exception} controls exception declarations.
@item
@code{expression_function} controls declaration of expression functions
@item
@code{fixed_type} controls all declarations of fixed point types while
@code{ordinary_fixed_type} controls only ordinary (binary) fixed point
types, @code{ordinary_fixed_type_no_small} controls ordinary fixed
point type without a representation clause for @code{'SMALL},
@code{ordinary_fixed_type_with_small} controls ordinary fixed point
type with an explicit representation clause for @code{'SMALL}, and
@code{decimal_fixed_type} controls only decimal fixed point types
(those can never have a representation clause for @code{'SMALL}).
@item
@code{float_type} controls declarations of floating point types.
@item
@code{formal_function}, @code{formal_package},
@code{formal_procedure}, and @code{formal_type} control all generic
formal functions, packages, procedures, and types,
respectively. @code{box_defaulted_formal_function},
@code{box_defaulted_formal_procedure}, @code{name_defaulted_formal_function},
@code{name_defaulted_formal_procedure}, and
@code{null_defaulted_formal_procedure} control generic formal
functions and procedures with a box default, a name default, and a
null default, respectively.
@item
@code{generic_function}, @code{generic_package},
@code{generic_procedure} control generic function (respectively
package, procedure) declarations.
@item
@code{handlers} controls the presence of exception handlers in any
handled sequence of statements.
@item
@code{in_out_parameter} and @code{out_parameter} control subprogram
and entry parameters of modes @code{@b{in}} @code{@b{out}} and
@code{@b{out}} (respectively), while @code{in_out_generic_parameter}
and @code{out_generic_parameter} do the same for @i{generic} formal
parameters. Note that to avoid unnecessary messages, if a subprogram
has an explicit specification, the message is given on the
specification and not repeated on the body.
@item
@code{incomplete_type} controls incomplete type declaration.
@item
@code{initialized_variable} controls variable declarations that
include an initialization expression, unless they are of a class-wide
type since initialization is required in that case.
@item
@code{instantiation} controls all instantiations, while
@code{function_instantiation}, @code{package_instantiation},
@code{procedure_instantiation} control function (respectively package,
procedure) instantiations.
@item
@code{integer_type} controls all declarations of integer types, while
@code{signed_type} controls only signed integer types, and
@code{modular_type} controls only modular types (both kinds);
@code{binary_modular_type} controls only modular types whose modulus
is a power of 2, and @code{non_binary_modular_type} controls only
modular types whose modulus is not a power of 2.
@item
@code{initialized_record_component} and
@code{initialized_protected_component} control the declaration of
record (respectively protected) component that include a default
initialization, while @code{uninitialized_record_component} and
@code{uninitialized_protected_component} control the declaration of record
(respectively protected) component that do not include a default
initialization, unless they are of a limited type since initialization would
not be allowed in that case.
@item
@code{limited_private_type} controls limited private type
declarations, while @code{non_limited_private_type} controls regular
(non limited) private type declarations. @code{tagged_private_type}
controls tagged private type declarations.
@item
@code{multiple_names} controls declarations where more than one
defining identifier is given in the same declaration.
@item
@code{multiple_protected_entries} controls protected definitions (from
protected types or single protected objects) that have more than one
entry declaration. Note that a protected definition with a single
entry family declaration is counted as a single entry declaration.
@item
@code{named_number} controls declarations of named numbers,
i.e. untyped constants.
@item
@code{non_joint_CE_NE_handler} controls exception handlers whose
choices include @code{Constraint_Error} or @code{Numeric_Error}, but
not both. This is intended for legacy Ada 83 code that required to
always handle these exceptions together; it makes little sense for
Ada95 or Ada2005 code (and to be honnest, this subrule is provided
because Gnatcheck has it).
@item
@code{null_extension} controls record extensions (derived tagged
types) that contain no new elements.  Similarly,
@code{null_ordinary_record_type} and @code{null_tagged_type} control
ordinary records and tagged types that contain no elements. Note that
the record definitions may be plain ``@code{@b{null}}
@code{@b{record}}'' definitions, or full record definitions that
contain only null components. However, a definition is not considered
null if it contains a variant part.
@item
@code{null_procedure_body} controls procedure declarations whose
sequence of statements contain only @code{@b{null}} statements (or
blocks without declarations and containing only @code{@b{null}}
statements).  @code{null_procedure_declaration} controls Ada2005 null
procedure declarations (i.e., ``@b{procedure} P @b{is}
@b{null};''). @code{null_procedure} controls both.
@item
@code{operator} controls the definition of operators (things like
@code{"+"}); note that the message is given on the specification if
there is an explicit specification, on the body
otherwise. @code{equality_operator} controls only equality operators
(@code{"="} and @code{"/="}) and @code{predefined_operator} controls
only operator definitions that overload a predefined operator (like
@code{"+"} on a numeric type, for example).
@item
@code{package_statements} controls the presence of elaboration
statements in the bodies of packages (or generic packages).
@item
@code{private_extension} controls private extensions, i.e. derivations
from a tagged type with a @code{@b{with private}} extension part.
@item
@code{record_type} controls all record type declarations (tagged or
not), while @code{ordinary_record_type} controls only non-tagged
record types, and @code{tagged_type} controls only tagged record types.
@item
@code{interface_type} controls interface type declarations.
@item
@code{renaming} controls all renaming declarations, while
@code{renaming_as_body} controls only those that are renamings as
bodies of subprograms, @code{renaming_as_declaration} controls only
those that are regular renamings of subprograms (i.e. not as bodies),
@code{operator_renaming} controls only those that are renamings of an
operator, @code{not_operator_renaming} controls only those that are
@emph{not} renamings of an operator, @code{function_call_renaming}
controls renaming of the result of a function call, and
@code{library_unit_renaming} controls renaming of library units.
@code{non_identical_renaming} controls only renamings where the new
name and the old name are not the same, and
@code{non_identical_operator_renaming} does the same, but only for
renamings of operators.
@item
@code{self_calling_function} controls functions whose body contains
only a single (simple) @code{@b{return}} statement, and the return
expression is a (recursive) call to the same function. Similarly,
@code{self_calling_procedure} controls procedures whose body contains
only a single statement which is a (recursive) call to the same
procedure. Note that this corresponds to bodies automatically
generated by gnatstub.
@item
@code{subtype} controls all explicit subtype declarations (i.e. not
all anonymous subtypes that appear at various places in the
language), while @code{unconstrained_subtype} controls only the
subtype declarations that do not include a constraint.
@item
@code{task} controls task type declarations as well as single tasks
declarations while @code{single_task} and @code{task_type} control
only single task declarations or task type declarations respectively
(and similarly for @code{protected}). @code{non_ravenscar_task} controls
all task type and task object declarations from a unit to which no
@code{pragma Profile (Ravenscar)} applies.
@item
@code{type} controls all type (but not subtype) declarations.
@item
@code{variable} controls all variable declarations, while
@code{uninitialized_variable} controls only variable declarations that
do not include an initialization expression, unless they are of a
limited type since initialization would not be allowed in that case.
@code{scalar_variable} controls the declarations of variables of a
scalar type (integer, enumeration, float, fixed).
@code{ordinary_record_variable} controls declarations of variables of
an untagged record type.  @code{tagged_variable} controls declarations
of variables of a tagged type (including class-wide ones), while
@code{class_wide_variable} controls only the declarations of variables
of a class-wide type.  @code{task_variable} and
@code{protected_variable} control task and protected objects
(respectively), whether given with a named or anonymous type.
@item
@code{variant_part} controls variant parts in record defintions.
@end itemize

Ex:
@example
search declarations (task, exception);
check declarations (block procedure, block function, block package);
check declarations (public task);
@end example

@subsection Tips
Certain keywords are @i{not} exclusive, and it may be the case that
several keywords apply to the same declaration; in this case, they are
all reported.  For example, if you specify:
@example
check declarations (record_type, tagged_type);
@end example
tagged types will be reported both as ``record_type'' and
``tagged_type''.

There is no subrule for checking functions whose result type is from
an anonymous access type; these are controlled by the rule
@code{return_type (anonymous_access)}. @xref{Return_Type}.

Some of the keyword do not seem very useful; it would be strange to
have a programming rule that prevents all type declarations... But
bear in mind that the <location_kw> can be used to restrict the check
to certain locations; moreover, AdaControl can be used not only for
checking, but also for searching; finding all type declarations in a
set of units can make sense. As another example, ``search declarations
(own variable);'' will find all variables declared directly in package
bodies.

Some modifiers do not make sense with certain declarations; for
example,  a ``private out_parameter'' is impossible (a parameter
occurs in a subprogram declaration, not @i{directly} in a private
part). This is not a problem as far as the rule is concerned, but
don't expect to find any...

Generally, discriminants are considered components of record
types. However, discriminants of an anonymous access type (so-called
access discriminants) play such a special role in the language that
they deserved their own control
(@code{anonymous_access_discriminant}).

Private types are normally followed in determining the kind of access
type (i.e., an access to a private type will be controlled according
to the full declaration). However, this is not done for an access type
that designates a private type defined in a language defined unit
(since the full type depends on the implementation); these are
controlled as ``access_language_type'' instead. Of course, language
defined @i{visible} types are controlled normally.

@subsection Limitation
In some rare cases, AdaControl may not be able to evaluate the modulus
of a modular type definition, thus preventing correct operation of
``binary_modular_type'' and ``non_binary_modular_type'' subrules. Such
cases are detected by the rule ``uncheckable''.  @xref{Uncheckable}.

@node Default_Parameter, Dependencies, Declarations, Rules reference
@section Default_Parameter
This rule checks usage (or non-usage) of defaulted parameters.
@subsection Syntax
@example
<control_kind> default_parameter (<place>, <formal>, <usage>);
<place>  ::= <entity> | calls | instantiations
<formal> ::= <formal name> | all
<usage>  ::= used | positional | not_used
@end example

@subsection Action
The rule controls subprogram calls or generic instantiations that use
the default value for the indicated parameter, or conversely don't use
it, either in positional notation or in any notation. If a subprogram
is called, or a generic instantiated, whose name matches <entity>, and
it has a formal whose name is <formal name>, then:
@itemize @bullet
@item
If the string @code{used} (case irrelevant) is given as the third
parameter, the rule reports when there is no corresponding actual
parameter (i.e. the default value is used for the parameter).
@item
If the string @code{positional} (case irrelevant) is given as the
third parameter, the rule reports when there is an explicit
corresponding actual parameter (i.e. the default is not used for the
parameter), and the actual uses positional (not named) notation.
@item
If the string @code{not_used} (case irrelevant) is given as the third
parameter, the rule reports when there is an explicit corresponding
actual parameter (i.e. the default is not used for the parameter),
independently of whether it uses positional or named notation.
@end itemize

As usual, the whole syntax for entities is allowed for
<entity>. @xref{Specifying an Ada entity name}. On the other hand,
<formal> is the simple name of the formal parameter.

Alternatively, the <entity> can be specified as @code{calls}, to
control all calls or @code{instantiations}, to control all
instantiations. The <formal name> can be replaced by @code{all}, in
which case all formals are controlled.

Ex:
@example
check default_parameter (P, X, used);
check default_parameter (P, Y, not used);
search default_parameter (calls, all, positional);
@end example

@subsection Tip
If the <entity> is a generic subprogram, it is also possible to give a
formal parameter  (a parameter of the subprogram, not a generic
parameter) as the <formal name>; in this case, all instantiations of
the indicated generic subprogram will be controlled for the use of the
indicated parameter.

@node Dependencies, Directly_Accessed_Globals, Default_Parameter, Rules reference
@section Dependencies
This rule controls dependencies of units (i.e. @code{@b{with}}
clauses, parents, child units...), either according to a set of
allowed/forbidden units, or by count.

@subsection Syntax
@example
<control_kind> dependencies (others, <unit> @{,<unit>@});
<control_kind> dependencies (with, <unit> @{,<unit>@});
<control_kind> dependencies (public_child | private_child);
<control_kind> dependencies (<counter>, <bound> [, <bound>]);
<counter> ::= raw | direct | parent
<bound>   ::= min | max <value>
@end example

@subsection Action
The kind of action depends on the specified subrule.

The ``others'' subrule controls semantic dependencies to units other
than those indicated. This subrule can be specified only once, and at
least one unit must be given.

The ``with'' subrule controls with clauses that reference the
indicated units. At least one unit must be given.

Note that for these two rules, renamings are followed: if you give the
basic name of a unit, it will be identified even if used with other
names. Similarly, if you give the name of a generic, all of its
instantiations will also be controlled.

``public_child'' and ``private_child'' control units that depend on
their own public (respectively private) child units. Since these
subrules have no parameters, they can be given only once.

Other subrules control that the number of various dependencies is
whithin a specified range.  The second (and optionnally third)
parameter give the minimum and/or maximum allowed values (i.e. the
rule will control values outside the indicated interval). If not
specified, the minimum value is defaulted to 0 and the maximum value
to infinity.
@itemize @bullet
@item
``raw'' controls the number of units textually given in
@code{@b{with}} clauses. Redundant @code{@b{with}} clauses are
counted, and a child unit counts for one.
@item
``direct'' controls the number of different units that this unit
really depends on: if a unit is mentionned in several @code{@b{with}}
clauses, it is counted only once, but if a child unit is mentionned,
all parents of this child unit are added to the count.
@item
``parent'' counts the number of parents of the current unit. A root
unit has no parent, a child of a root unit has one parent, etc.
@end itemize

Ex:
@example
check dependencies (others, Ada.Text_IO);
check dependencies (raw, max 15);

-- child units should not be nested more than 5 levels:
check dependencies (parent, max 5);

-- units that depend on nothing:
search dependencies (direct, min 1);

-- units that depend on their public children:
check dependencies (public_child);
@end example

@subsection Tips
If you give a name that's already a renaming to the ``others'' or
``with'' subrules, the rule will only apply to this name, not to what
has been renamed. Therefore:
@example
 -- Allow only Ada.Text_IO:
check dependencies (others, Ada.Text_IO);

-- But not if the plain name Text_IO is used:
check dependencies (with, Text_IO);
@end example

The notion of public or private for the rules ``public_child'' or
``private_child'' refer to the real unit, which is not necessarily the
name used in the with clause, if for example you have a private
library renaming of a public unit.

There is a slight overlap between this rule and the rule
``entities'. But ``entities'' will find all uses of an entity (not
necessarily a compilation unit), while ``dependencies'' will control
occurrences only of compilation units, and only in @code{@b{with}}
clauses. @xref{Entities}.

In certain contexts, only a set of the Ada predefined units is
allowed. For example, it can be useful to forbid units defined in
special needs annexes. The @code{rules} directory of Adacontrol
contains files with ``Dependencies'' rules that forbid the use of
various predefined Ada units. Comment out the lines for the units that
you want to allow.  You can then simply ``source'' these files from
your own rule file (or copy the content) if you want to disallow these
units. @xref{Rules files provided with AdaControl}.

@node Directly_Accessed_Globals, Duplicate_Initialization_Calls, Dependencies, Rules reference
@section Directly_Accessed_Globals
This rule checks that global variables in package bodies are accessed
only through dedicated subprograms. Especially, it can be used to
prevent race conditions in multi-tasking programs.
@subsection Syntax
@example
<control_kind> directly_accessed_globals [(<kind> @{,<kind>@})];
<kind> ::= plain | accept | protected
@end example
@subsection Action
The rule controls global variables declared directly in (generic)
package bodies that are accessed outside of dedicated callable
entities (i.e. procedure or function, possibly protected, protected
entries, and @code{@b{accept}} statements).

This rule can be specified only once.  The parameters indicate which
kinds of callable entity are allowed: ``plain'' for non-protected
subprograms, ``protected'' for protected subprograms, and ``accept''
for @code{@b{accept}} statements). Without parameters, all forms are
allowed.

More precisely, the rule ensures that the global variables are read
from a single callable entity, and  written by a single callable
entity. Note that the same callable entity can read and write a
variable, but in this case no other callable entity is allowed to read
or write the variable.
@itemize @bullet
@item
Subprograms used to read/write the variables must be declared at the
same level as the variable itself (i.e. not nested), and must not be
generic.
@item
Protected subprograms used to read/write the variables must both be
part of the same single protected object, which must be declared at
the same level as the variable itself (i.e. not nested); they are not
allowed to be declared in a protected @i{type}, since if there are
several protected objects of the same type, mutual exclusion would not
be enforced.
@item
@code{@b{accept}} statements used to read/write the variables must
both be part of the same single task object, which must be declared at
the same level as the variable itself (i.e. not nested); they are not
allowed to be declared in a task @i{type}, since if there are several
task objects of the same type, mutual exclusion would not be enforced.
@end itemize
In short, this rule enforces that all global variables are accessed by
dedicated access subprograms, and that only those subprograms access
the variables directly. If given with the keyword ``protected'' and/or
``accept'', it enforces that global variables are accessed only by
dedicated protected subprograms or tasks, ensuring that no race condition is
possible.

Ex:
@example
check directly_accessed_globals
@end example

@subsection Tips
Note that this rule controls global variables from package @i{bodies},
not those from the specification. This is intended, since it makes
little sense to declare a variable in a specification, and then
require it not to be accessed directly, but through provided
subprograms.  Obviously, in this case the variable should be moved to
the body.

Note that AdaControl can check that no variable is declared in a
package specification with the following rule:
@example
check usage (variable, from_spec);
@end example
@pxref{Usage} for details.

@subsection Limitations
AdaControl cannot check entities accessed through dynamic names
(dynamic renaming, access on aliased variables). Use of such
constructs is detected by the rule ``uncheckable''.
@xref{Uncheckable}.

Due to a weakness in the ASIS standard, it is not possible to know the
mode (@b{in}, @b{out}) of variables used as parameters of dispatching
calls. Such variables are considered to be read and written at the
point of the call, therefore possibly creating false positives (which
is safer than false negatives). Use of such constructs is detected by
the rule ``uncheckable''.  @xref{Uncheckable}.

@node Duplicate_Initialization_Calls, Entities, Directly_Accessed_Globals, Rules reference
@section Duplicate_Initialization_Calls
This rule checks that some procedures (notably initialization
procedures) are not called several times in identical conditions.
@subsection Syntax
@example
<control_kind> duplicate_initialization_calls (<entity> @{, <entity>@});
@end example
@subsection Action
This rule controls calls to initialization procedures that are
duplicated. The <entity> parameters are the initialization procedures
to be controlled. As usual, the whole syntax for entities is allowed for
<entity>. @xref{Specifying an Ada entity name}.

More precisely, the initialization procedures must follow one of these
patterns:
@itemize @bullet
@item
The procedure only has @code{@b{in}} parameters. All actual parameters
used in calls are static, and not two calls have the same values for
all parameters.
@item
The procedure has exactly one @code{@b{out}} parameter (and no
@code{@b{in out}} parameter). Not two calls refer the same actual variable
for the @code{@b{out}} parameter.
@end itemize

The rule controls any violation of these patterns. If a procedure passed as parameter
does not have a profile that corresponds to one of the above patterns, it is an error.

Ex:
@example
check duplicate_initialization_calls (pack.init_proc);
@end example

@subsection Limitation
If a variable passed as an @code{@b{out}} parameter is not statically
determinable, it is not controlled by the rule. Such a case is
detected by the rule ``uncheckable''.  @xref{Uncheckable}.

@node Entities, Entity_Inside_Exception, Duplicate_Initialization_Calls, Rules reference
@section Entities
This rule is used to control usage of Ada entities, i.e. any declared
element (type, variables, packages, etc).
@subsection Syntax
@example
<control_kind> entities (@{<location>@} <entity> @{, @{<location>@} <entity>@});
<location> ::= block   | library | local      | nested    | own |
               private | public  | in_generic | task_body

@end example

@subsection Action
This rule controls all uses of the indicated entities,or only those
that appear within the specified locations. As usual, the whole syntax
for entities is allowed for <entity>. @xref{Specifying an Ada entity
name}.

When present, the <location_kw> restricts the places where the entity
is controlled.  Several <location_kw> can be given, in which case the
entity is controlled at places where all the keywords apply.
@itemize @bullet
@item
@code{block}: the entity appears in a block statement.
@item
@code{library}: the entity appears at library level.
@item
@code{local}: the entity appears in a local scope (i.e. not in
(generic) packages, possibly nested)
@item
@code{nested}: the entity appears in a nested context (i.e. not at
library level).
@item
@code{own}: the entity appers in a (generic) package body.
@item
@code{public}: the entity appears in the visible part of a
(generic) package.
@item
@code{private}: the entity appears directly in a private
part.
@item
@code{in_generic}: the entity appears directly or indirectly in a generic
specification or body.
@item
@code{task_body}: the entity appears directly in a task body.
@end itemize

Note that this rules reports on the use of the @i{entity}, not the
@i{name}: if an entity has been renamed, it will be found under its
various names.  Similarly, if the given entity is a generic unit or an
entity declared inside a generic unit, all corresponding uses in all
instances will be reported.

Ex:
@example
search entities (Debug.Trace);
check  entities (Ada.Text_IO.Float_IO.Put);
@end example
The second line will report on any use of a @code{Put} from any
instantiation of @code{Float_IO}.

@subsection Tips
This rule is not intended to replace cross-references, but can
be quite handy to check, for example, that a program does not contain
any more calls to debugging procedures before fielding it.

This rule can also be used to check for all occurrences of certain
attributes with the ``@code{all <Attribute>}'' syntax. For example,
the following will report on any usage of @code{'Unchecked_Access}:
@example
check entities (all 'Unchecked_Access);
@end example

If you want to make sure that certain compilation units are not used,
it is preferable to use the rule ``Depencies (with,...)'' rather than
``Entities'', because ``Entities'' will control all uses of the unit,
while ``Dependencies'' will control only those in @code{@b{with}}
clauses (which is of course sufficient).

In certain contexts, it can be useful to forbid certain entities, like
those from @code{Standard}, @code{System}, or entities defined in
special needs annexes packages. The @code{rules} directory of
Adacontrol contains files with ``Dependencies'' and ``Entities'' rules
that forbid the use of various predefined Ada elements. Comment out
the lines for the elements that you want to allow.  You can then
simply ``source'' these files from your own rule file (or copy the
content) if you want to disallow these elements. @xref{Rules files
provided with AdaControl}.

@subsection Limitation
GNAT defines @code{Unchecked_Conversion} and
@code{Unchecked_Deallocation} as separate entities, rather than
renamings of @code{Ada.Unchecked_Conversion} and
@code{Ada.Unchecked_Deallocation}. As a consequence, it is necessary
to specify explicitely both forms if you want to make sure that the
corresponding generics are not used.

@node Entity_Inside_Exception, Exception_Propagation, Entities, Rules reference
@section Entity_Inside_Exception
This rule controls entities that appear within exception handlers.
@subsection Syntax
@example
<control_kind> entity_inside_exception (<spec> @{, <spec>@});
<spec> ::= [not] <entity> | calls | entry_calls
@end example

@subsection Action
This rule controls exception handlers that contain references to one
or several Ada entities specified as parameters. If the keyword
``calls'' is given, it stands for all subprogram and entry calls.  If
the keyword ``entry_calls'' is given, it stands for all entry calls
(task or protected).  If an <entity> (or ``calls'' or ``entry_calls'')
is preceded by the keyword ``not'', it is not included in the list of
controlled entities (i.e.  the entity is allowed in the exception
hhandler). This allows to make exceptions to a more general
specification of an entity, or to allow calls to well-defined
procedures if the keyword ``calls'' is given.

Ex:
@example
-- No Put_Line in exception handlers:
check entity_inside_exception (ada.text_io.put_line);

-- No entry calls in exception handlers:
check entity_inside_exception (entry_calls);

-- No calls allowed, except to the Report_Exception procedure:
check entity_inside_exception (calls, not Reports.Report_Exception);

-- No Put allowed, except the one on Strings:
check entity_inside_exception (all Put,
                               not Ada.Text_IO.Put@{Standard.String@});
@end example

@node Exception_Propagation, Expressions, Entity_Inside_Exception, Rules reference
@section Exception_Propagation
This rule controls that certain program units are guaranteed to never
propagate exceptions, or that local exceptions cannot propagate out of
their scope.
@subsection Syntax
@example
<control_kind> exception_propagation
   (local_exception);
<control_kind> exception_propagation
   ([<level>,] interface, <convention> @{, <convention> @});
<control_kind> exception_propagation
   ([<level>,] parameter, <entity> @{, <entity>@});
<control_kind> exception_propagation
   ([<level>,] task);
<control_kind> exception_propagation
   (<level>, declaration);
@end example

@subsection Action
The ``local_exception'' subrule controls a design pattern that ensures
that a local exception cannot propagate outside the scope where it is
declared. If an exception is declared within a block, a subprogram
body, an entry body, or a task body, then this body must have either a
handler for this exception or for @code{@b{others}}; this handler must
not reraise the exception; and no handler is allowed to raise
explicitely the exception. The subrule controls explicit
@code{@b{raise}} statements and calls to @code{Raise_Exception} and
@code{Reraise_Occurrence}, but it does not control exceptions raised
as a consequence of calling other subprograms.

The other subrules control subprograms, tasks, or all declarations
that can propagate exceptions, while being used in contexts where it
is desirable to ensure that no exception can be propagated.

A subprogram or task is considered as @emph{not} propagating if:
@enumerate
@item
it has an exception handler with a ``@code{@b{when others}}'' choice
@item
no exception handler contains a @code{@b{raise}} statement, nor any
call to @code{Ada.Exception.Raise_Exception} or
@code{Ada.Exception.Reraise_Occurrence}.
@item
no declaration from its own declarative part propagates exceptions.
@end enumerate

A declaration is considered propagating if it includes elements that
could propagate exceptions. This is impossible to assess fully using
only static analysis, therefore the <level> parameter determines how
pessimistic (or optimistic) AdaControl is in determining the possibility
of exceptions.  Possible values of the <level> parameter, and
their effect, are:
@itemize @bullet
@item
0: expressions in declarative parts are not considered as propagating
(anything allowed, this is the default value for ``interface'',
``parameter'' and ``task''. Not allowed for ``declaration'').
@item
1: all function calls (including operators) in declarations are
considered as potentially propagating exceptions, except those
appearing in named number declarations or scalar types declarations,
since those are required by the language to be static.
@item
2: same as 1, plus every use of variables in expressions is considered
as potentially propagating.
@item
3: same as 2, plus any declaration of objects (constants or variables)
is considered potentially propagating (not very useful for
``declaration'').
@end itemize

These subrules serve several purposes:
@itemize @bullet
@item
The ``interface'' subrule  analyzes all subprograms to which an
@code{Interface} or @code{Export} pragma applies (with the given
convention(s)), and reports on those that can propagate
exceptions.

Since it is dangerous to call an Ada subprogram that can propagate
exceptions from a language that has no exception (and especially C),
any such subprogram should have a ``catch-all'' exception handler.
@item
The ``parameter'' subrule accepts one or more fully qualified formal
parameter names (i.e. in the form of the parameter name prefixed by
the full name of its subprogram, see @ref{Specifying an Ada entity
name}). The subrule reports any subprogram that can propagate
exceptions and is used as the prefix of a @code{'Access} or
@code{'Address} attribute that appears as part of an actual value for
the indicated formal. Similarly, the indicated formal can also be the
name of a formal procedure or function of a generic. In this case, the
rule will report on any subprogram that can propagate exceptions and
is used as an actual in an instantiation for the given formal.

Many systems (typically windowing systems) use call-back
subprograms. Although the native interface is generally hidden behind
an Ada binding, the call-back subprograms will eventually be called
from another language, and like for the ``interface'' subrule, any
such subprogram should have a ``catch-all'' exception handler.
@item
The ``task'' subrule reports any task that can propagate exceptions.

Since tasks die silently if an exception is propagated out of
their body, it is generally desirable to ensure that every task has an
exception handler that (at least) reports that the task is being
completed due to an exception.
@item
The ``declaration'' subrule reports
any declaration that can propagate exceptions, irrespectively of where
it appears.  In this case, the specification of <level> is required
and cannot be 0.

It is sometimes desirable to make sure that no declaration raises an
exception, ever.
@end itemize

Ex:
@example
-- Make sure that C-compatible subprograms don't propagate exceptions:
check exception_propagation (interface, C);

-- Parameter CB of of procedure Pack.Register is used as a call-back
-- Make sure that not procedure passed to it can propagate exceptions.
check exception_propagation (parameter, Pack.Register.CB);

-- Make sure that tasks do not die silently due to unhandled exception:
check exception_propagation (task);

-- Make sure that no exception is raised by elaboration of declarations:
check exception_propagation (2, declaration);
@end example

The first example will report on any subprogram to which a
@code{@b{pragma} Interface (C,...)} applies that can propagate
exceptions.

If @code{Proc} is a procedure that can propagate exceptions, the
second example will report on every call like:
@example
Pack.Register (CB => Proc'Access);
@end example

The third example will report on any task that can terminate silently due
to an unhandled exception.

The fourth example will report on any declaration that makes use of
function calls or variables.

@subsection Tips
Note that the registration procedure for a call-back can be designated
by an access type, but in this case, use the name of the formal for
the access type. For example, given:
@example
@b{package} Pack @b{is}
   @b{type} Acc_Proc @b{is} @b{access} @b{procedure};
   @b{type} Acc_Reg @b{is} @b{access} @b{procedure} (CB : Acc_Proc);
   ...
   Ptr : Acc_Reg := ...;
@end example

You can give a rule such as:
@example
check exception_propagation (parameter, Pack.Acc_Reg.CB);
@end example
All procedures registered by a call to @code{Pack.Ptr.@b{all}} will be considered.

The declaration of a @b{for} loop parameter is not checked by this
rule. In other words, the rule ``check exception_propagation (2,
declaration)'' will not issue a message for:
@example
@b{for} I @b{in} Positive @b{range} 1 .. X @b{loop} ...
@end example
although formally the @i{declaration} of I could raise
Constraint_Error if X is negative. We consider that for the casual
user, Constraint_Error appears to be raised by the @b{for} loop
@i{statement}.

@subsection Limitations
An exception may be raised in a subprogram considered as not
propagating by this rule, if an exception handler calls a subprogram
that propagates an exception.

The rule will not consider subprograms whose body is missing, or that
are not statically known (i.e. if a subprogram is registered through a
dereference of a pointer to subprogram), like in the following
example:
@example
Pack.Register (CB => Pointer.@b{all}'Access);
@end example

Due to a weakness of the ASIS standard, references to subprograms that
appear in dispatching calls are not considered. This limitation will
be removed as soon as we find a way to work around this problem, but
the issue is quite difficult!

These last two cases are detected by the rule
``uncheckable''. @xref{Uncheckable}.

@node Expressions, Generic_Aliasing, Exception_Propagation, Rules reference
@section Expressions
This rule controls usage of various kinds of expressions.
@subsection Syntax
@example
<control_kind> expressions (<subrule> @{, <subrule>@});
<subrule> ::= @{<category>@} <expression_kw>
<expression_kw> ::=
   and                              | and_array                  |
   and_binary                       | and_boolean                |
   and_then                         | array_aggregate            |
   array_named_others               | array_non_static_range     |
   array_others                     | array_partial_others       |
   array_positional_others          | array_range                |
   case                             | complex_parameter          |
   downward_conversion              | extendable_aggregate       |
   extension_aggregate              | explicit_dereference       |
   fixed_multiplying_op             | for_all                    |
   for_some                         | if                         |
   if_elsif                         | if_no_else                 |
   implicit_dereference             | in                         |
   inconsistent_attribute_dimension | inherited_function_call    |
   mixed_operators                  | not_in                     |
   or                               | or_array                   |
   or_binary                        | or_boolean                 |
   or_else                          | parameter_view_conversion  |
   prefixed_operator                | real_equality              |
   record_partial_others            | record_aggregate           |
   record_others                    | slice                      |
   static_membership                | type_conversion            |
   upward_conversion                | unconverted_multiplying_op |
   underived_conversion             | universal_range            |
   unqualified_aggregate            | xor                        |
   xor_array                        | xor_binary                 |
   xor_boolean
<category> ::=
   <>     | ()     | range  | mod | delta   | digits | array    |
   record | tagged | access | new | private | task   | protected
@end example
@subsection Action
This rule controls usage of certain forms of expressions. The rule can
be specified at most once for each subrule (i.e. subrules that accept
categories can be specified once for each combination of categories
and expression keyword).

Categories are used by certain subrules to further refine the control.
They define categories of types to which they apply:
@itemize @bullet
@item
``<>'': Any type
@item
``()'': Enumerated types
@item
``range'': Signed integer types
@item
``mod'': Modular types
@item
``delta'': Fixed point types (no possibility to differentiate ordinary
and decimal fixed point types yet).
@item
``digits'': Floating point types
@item
``array'': Array types
@item
``record'': (untagged) record types
@item
``tagged'': Tagged types (including type extensions)
@item
``access'': Access types
@item
``new'': Derived types
@item
``private'': Private types
@item
``task'': Task types
@item
``protected'': Protected types
@end itemize

The subrule define the kind of expression being controlled:
@itemize @bullet
@item
@code{and}, @code{or}, @code{xor}, @code{and_then}, @code{or_else},
@code{in}, and @code{not_in} control usage of the corresponding
logical operator (or short circuit form, or membership test).
@item
@code{and_array}, @code{or_array}, and @code{xor_array} do the same,
but only for operators whose result type is an array type.
@item
@code{and_binary}, @code{or_binary}, and @code{xor_binary} do the same,
but only for operators whose result type is a modular type.
@item
@code{and_boolean}, @code{or_boolean}, and @code{xor_boolean} do the same,
but only for operators whose result type is @code{Standard.Boolean}.
@item
@code{array_aggregate} and @code{record_aggregate} control array and
record aggregates, respectively, while @code{unqualified_aggregate}
controls aggregates (both arrays and records) that do not appear
directly within a qualified expression. @code{extension_aggregate}
controls extension aggregates, while @code{extendable_aggregate}
controls aggregates that are @i{not} extension aggregates, but whose
type is a non-root tagged type, or are extension aggregates whose ancestor part
is not their immediate parent (such aggregates could be written as
extension aggregates).
@item
@code{array_others} and @code{record_others} control the occurrence of
a @code{@b{others} =>} association in array and record
aggregates, respectively.
@item
@code{array_partial_others} and @code{record_partial_others} do the
same, but only if there are other associations in addition to the
@code{@b{others} =>} in the aggregate. @code{array_named_others} and
@code{array_positional_others} do the same, but only for named
(respectively positional) array aggregates.
@item
@code{array_range} controls array aggregates that include a range
(i.e. an association like @code{A .. B =>}).
@code{array_non_static_range} does the same, but only if (at least)
one of the bounds is not static.
@item
@code{case} controls @b{case} expressions (introduced in Ada 2012).
@item
@code{complex_parameter} controls complex expressions used as actual
parameters in subprogram (or entry) calls. A complex expression is any
expression that includes a function call (including operators). This
rule is not applied to the parameters of operators, since otherwise
it would forbid any expression with more than a single operator.
@item
@code{explicit_dereference} controls explicit dereferences of access
values (i.e. with an explicit @code{.@b{all}}).
@item
@code{fixed_multiplying_op} controls calls to predefined fixed-point
multiplication and division (regular fixed-point or decimal-fixed
point). @code{unconverted_fixed_multiplying_op} does the same, but
only when both operands are objects (not literals) of a fixed_point
type (not Integer); this is when type conversion is required by Ada
83.
@item
@code{for_all} and @code{for_some} control the two forms of
quantifiers introduced by Ada 2012.
@item
@code{if} controls all @b{if} expressions (introduced in Ada 2012),
while @code{if_elsif} only controls those that have an @b{elsif} part,
and @code{if_no_else} only controls those that have no @b{else} part.
@item
@code{implicit_dereference} controls implicit dereferences of access
values (i.e. when the @code{.@b{all}} is omitted).
@item
@code{inconsistent_attribute_dimension} controls when no dimension is
explicitely given for a @code{'First}, @code{'Last}, @code{'Range} or
@code{'Length} attribute and the attribute applies to a
multi-dimensional array, or conversely, when an explicit dimension is
given, but the attribute applies to a one-dimensional array.
@item
@code{inherited_function_call} controls calls to functions that have
been inherited by a derived type and not redefined. If a category is
specified, only calls whose result type belongs to the category are
controlled.

Derived types are followed, i.e. the ``real'' category from the
original type is used for the matching; as a consequence, the ``new''
category cannot be specified for this subrule.
@item
@code{mixed_operators} controls expressions that involve several
different operators, without parentheses. In a sense, it extends the
language rule that forbids mixing @code{@b{and}} and @code{@b{or}} in
logical expressions to all other operators. Note that for the purpose
of this subrule, membership tests (@code{@b{in}}, @code{@b{not in}})
and short circuit forms (@code{@b{and then}}, @code{@b{or else}}) are
considered operators.
@item
@code{prefixed_operator} controls calls to operators that use prefixed
notation (i.e. @code{"+"(A, B)}). If a category is specified, only
calls whose result type belongs to the category are controlled.

Derived types are followed, i.e. the ``real'' category from the
original type is used for the matching; as a consequence, the ``new''
category cannot be specified for this subrule.
@item
@code{real_equality} controls usage of predefined exact equality or
inequality (``='' or ``/='') between real (floating point or fixed
point) values.
@item
@code{slice} controls usage of array slices.
@item
@code{static_membership} controls membership tests (@code{@b{in}} and
@code{@b{not in}}) where the expression on the left is statically
known to belong to the range (or subtype) on the right, and is
therefore always True (or false for @code{@b{not in}}).
@item
@code{type_conversion} controls all (sub)type conversions, while
@code{underived_conversion} controls conversions between types that do
@i{not} belong to the same derivation
family. @code{downward_conversion} and @code{upward_conversion}
control conversions between types that belong to the same family,
converting away from the root or toward the root,
respectively. @code{parameter_view_conversion} controls conversions
that appear as @code{@b{out}} or @code{@b{in out}} actual parameters.

One or two categories can be specified; if only one category is
specified, only conversions whose result type belong to that category
are controlled. If two categories are specified, only conversions
whose souce type belongs to the first category and whose target type
belong to the second category are controlled.

Derived types are followed, i.e. the ``real'' category from the
original type is used for the matching; as a consequence, the ``new''
category cannot be specified for this subrule.
@item
@code{universal_range} controls discrete ranges that are a part of an
index constraint, constrained array definition, or for-loop parameter
specification (but not type or subtype defintions), and whose bounds
are both of type universal_integer.
@end itemize

Ex:
@example
search expressions (real_equality, slice);
check  expressions (mixed_operators);

-- Find logical operators that could be replaced by short-circuits forms:
check expressions (and_boolean, or_boolean);

-- Find all conversions between integer and floating point types
search expression (range digits type_conversion);

-- Find all conversions from a fixed point type:
search expressions (delta <> type_conversion);

-- Find all view conversions between array types:
search expressions (array parameter_view_conversions);

-- Find all "structural" conversions between arrays
search expressions (array underived_conversion);

-- Some think that downward conversions of tagged types are evil:
check expressions (tagged downward_conversion);
@end example

@subsection Tips
The @code{real_equality} subrule does not control calls to an equality
operator that has been defined by the user; actually, it would make
little sense to write a function and then forbid its use! However, if
control of calls to such a function is desired, it can be easily
accomplished by using the @code{entities} rule. @xref{Entities}.

This rule does not check the use of allocators (@code{@b{new}}), use
the rule @code{Allocators} instead. @xref{Allocators}.

``inherited_function_call'' controls only @i{function} calls. For
procedure calls, see rule @ref{Statements}.

Specifying @code{array_partial_others} is the same as specifying both
@code{array_named_others} and @code{array_positional_others}. It is
retained for compatibility, and also for symetry with
@code{record_partial_others}.

Per language rules, underived conversions are allowed only between
numeric types, and between structurally equivalent array types.

``static_membership'' is handy for finding a common misuse of
membership tests, where the user assigns an external value (obtained
with Unchecked_Conversion for example) to a variable, then checks that the
variable belongs to its subtype to make sure the value is valid. Such a check
can be optimized away by the compiler; the 'Valid attribute should be
used instead.

@subsection Limitations
``static_membership'' does not control the complex membership tests
with several choices that are possible with Ada 2012.

@node Generic_Aliasing, Global_References, Expressions, Rules reference
@section Generic_Aliasing
This rule controls instantiations where the same actual is given to
more than one formal.
@subsection Syntax
@example
<control_kind> generic_aliasing [(<subrule> @{, <subrule>@})];
<subrule>   ::= [<condition>] <entity>
<condition> ::= unlikely | possible | certain
<entity>    ::= all | variable | type | subprogram | package
@end example

@subsection Action
This rule identifies instantiations where the same variable, type,
subprogram, or package is given several times (to different formal
parameters). Such aliasing of variables is dangerous, since it can
induce subtile bugs. Other elements are less dangerous, although often
questionable (depending on the generic).

The <entity> parameter indicates for which elements aliasing is
controlled; ``all'' stands for all kinds of elements.

There are many cases where aliasing cannot be determined
statically. The optional parameter specifies how aggressively the rule
will check for possible aliasings (see @ref{Parameter_Aliasing} for a
more detailed description of these modifiers). Possible values are
(case irrelevant):
@itemize
@item
Certain (default): Only cases where aliasing is statically certain are
output.
@item
Possible: In addition, cases where aliasing may occur depending on the
value of an indexed component are output. This can be specified only
for variables.
@item
Unlikely: In addition, cases where aliasing may occur due to access
variables designating the same element are output. This can be
specified only for variables and subprograms.
@end itemize

Without any parameter, the rule is the same as ``certain all''. The
rule can be specified only once for each combination of <condition>
and <entity>.

Ex:
@example
check  generic_aliasing (certain  variable);
search generic_aliasing (possible variable, type, subprogram, package);
@end example

@subsection Limitations
Due to a limitation of ASIS for Gnat, AdaControl might not be able to
differentiate predefined operators of different types, and may thus
give false positives if a generic is instantiated with, for example,
two different functions that are actually @code{"+"} on Integer and
@code{"+"} on Float. This possibility of  false positives is detected
by the rule ``uncheckable''. @xref{Uncheckable}.

@node   Global_References, Header_Comments, Generic_Aliasing, Rules reference
@section Global_References
This rule controls accesses to global elements that may be subject to
race conditions, or otherwise shared.

@subsection Syntax
@example
<control_kind> global_references (<subrule> @{, <root>@});
<subrule> ::= all | read | written | multiple | multiple_non_atomic
<root>    ::=  <entity> | function | procedure | task | protected
@end example

@subsection Action
This rule controls access to global variables from several entities
(the roots). The @code{<entity>} must be subprograms, task types,
single task objects, protected types, or single protected objects. As
usual, the whole syntax for entities is allowed for <entity>.
@xref{Specifying an Ada entity name}. The special keywords
@code{function}, @code{procedure}, @code{task}, and @code{protected}
are used to refer to all functions, procedures, tasks, and protected
entities, respectively.

The <subrule> determines the kind of references that are
controlled. If it is @code{all}, all references to global elements
from the indicated entities are reported. If <subrule> is @code{read}
or @code{written}, only read (respectively write) accesses are
reported. If <subrule> is @code{multiple}, only global elements that
are accessed by more than one of the indicated entities (i.e. shared
elements) are reported. Note however that if a reference is found from
a task type or protected type, it is always reported, since there are
potentially several objects of the same type. If <subrule> is
@code{multiple_non_atomic}, references reported are the same as with
@code{multiple}, except that global variables that are @code{atomic}
or @code{atomic_components} and written from at most one of the
indicated entities are not reported. Note that this latter case
corresponds to a safe reader/writer use of atomic variables.

This rule follows the call graph, and therefore finds references from
subprogram and protected calls made (directly or indirectly) from the
indicated entities. However, calls to subprograms from the Ada
standard library are not followed.

Ex:
@example
-- Find global variables used by P1 or P2:
search global_references (all, P1, P2);

-- Find global variables modified by functions:
check global_references (written, function);

-- Find possible race conditions:
check global_references (multiple, task, protected);
@end example

This rule can be given several times, and conflicts (with
@code{multiple}) are reported on a per-rule basis, i.e. given:
@example
check global_references (multiple, P1, P2);
check global_references (multiple, P1, P3);
@end example

the first rule will report on global variables shared between P1 and
P2, and the second rule will report on global variables shared between
P1 and P3.

@subsection Tips
The notion of ``global'' is relative, i.e. it designates every
variable whose scope encloses (strictly) the indicated entities. This
means that a same reference may or may not be global, depending on the
indicated entity. Consider:

@example
@b{procedure} Outer @b{is}
   Inner_V : Integer;

   @b{procedure} Inner_P @b{is}
   @b{begin}
      Inner_V := 1;
   @b{end} Inner_P;
@b{begin}
   Inner_P;
@b{end} Outer;
@end example

The rule
@example
check global_references (all, outer);
@end example
will not report any global reference, while the rule
@example
check global_references (all, outer.inner_p);
@end example
will report a reference to @code{Inner_V}. This is as it should be,
since there is no race condition if several tasks call @code{Outer},
while there is a risk if several tasks (declared inside @code{Outer})
call @code{Inner_P}.

Specifying:
@example
check global_references (all, function);
@end example
will report on any function that access variables outside of their
scope, i.e. all functions that have potential side effects. On the
other hand, this check must follow the whole call graph for any
function encountered, and can therefore be quite costly in execution
time.

@subsection Limitations
Calls through pointers to subprograms and dispatching calls are
unknown statically; they are assumed to not access any global. Such
calls are detected by the rule ``uncheckable''. @xref{Uncheckable}.

@node Header_Comments, Improper_Initialization, Global_References, Rules reference
@section Header_Comments
This rule controls that every compilation unit starts with a
standardized comment.
@subsection Syntax
@example
<control_kind> header_comments (minimum, <comment lines>);
<control_kind> header_comments (model, "<file name>");
@end example
@subsection Action
If the keyword ``minimum'' is given as first parameter, this rule
controls that every compilation unit starts with at least the number
of comment lines indicated by the second parameter. If several forms
of headers are possible, checking that the headers follow the
project's standard requires manual inspection, but this rule is useful
to control that unit headers have not been inadvertantly forgotten.

If the keyword ``model'' is given as first parameter, the second
parameter is a string, interpreted as a file name. If the file name is
not an absolute path, it is interpreted as relative to the directory
of the file that contains the rule, or to the current directory if the
rule is given on the command line.  Each line of the indicated file is
a regular expression, and the rule controls that the corresponding
line of the source file matches the expression. @xref{Syntax of
regular expressions}. In addition, it is possible to specify a repetition
for a line. If the first character of a line is a @code{'@{'}, the line
must have the following syntax:
@example
@{<min>,[<max>]@}
@end example
where <min> and <max> specify the minimum and maximum number of
occurrences of the pattern in the line that follows this one. <min>
must be at least 0, and <max> must be at least 1, and be equal or
greater than <min>. If <max> is omitted, it means that the line may
occur any number of times.

As a convenience, if the first character of a line is a @code{'*'}
it means that the next line is a pattern that can occur any number of
times (same as @code{@{0,@}}). If the first character is a
@code{'+'}, it means that the next line is a pattern that must occur
at least once (same as @code{@{1,@}}). If the first character is a
@code{'?'}, it means that the next line is an optional pattern (same
as @code{@{0,1@}}).

Note that the repetition lines all start with a special character
which is not allowed at the start of a regular expression; there is
therefore no ambiguity. Everything after the special character (or the
closing @code{'@}'}) is ignored, and can be used to provide comments.

This rule can be given at most once with ``minimum'' for each of
``check'', ``search'', and ``count''. The rule can be given only once
with ``model'' (but it can be given together with one or more
``minimum'' rules).

Ex:
@example
check header_comments (minimum, 10);
search header_comments (model, "header.pat");
count header_comments (minimum, 20);
@end example
This makes an error for every unit that starts with less than 10
comment lines, and a warning for units that do not follow the pattern
contained in the file @code{header.pat}. A count of units that start
with less than 20 comment lines is reported.

Example of a pattern file:
@example
@{1,3@} 1 to 3 occurrences of next line
^--$
^-- Author: .+$
^-- Date: \d@{2@}/\d@{2@}/\\d@{4@}$
@end example

@subsection Tips
Remember that the lines of the file are regular expressions; every
character that is specially interpreted (like ``+'', ``*'', etc.) must
be quoted with ``\'' if it must appear textually. To ease the process
of generating the model file, the directory @code{source} contains a
script file for sed named @code{makepat.sed}; if you run this script
on a file that contains a standard header, it will produce a pattern
file where each line starts with ``^'', ends with ``$'', and every
special character is quoted with ``\''.

When the model contains an indication of repeated lines (``*''), the
repetition is not ``greedy'', i.e. matching will stop as soon as what
follows the repetition matches. This is very useful to check header
comments that have sections, but where you don't want to impose a
precise content to each section. Imagine for example that the structure is:
@itemize
@item
A comment with ``HISTORY''
@item
Any number of comment lines
@item
A comment with ``AUTHORS''
@item
Any number of comment lines
@end itemize
the following pattern will work as expected:
@example
^-- HISTORY$
*
^--
^-- AUTHORS
*
^--
@end example

@subsection Limitation
Since the ``model'' subrule analyzes the content of comments, there is
a conflict with the disabling mechanism of AdaControl that uses
special comments. @xref{Disabling controls}.

Specifically, line disabling is not possible at all. Block disabling
is possible, provided the disabling line is allowed by the pattern. In
short, if you want to be able to disable this rule, the first lines of
the model file should be:
@example
?
--##
@end example
i.e. allow an optional block disabling comment as the first line of
the file. Note that there is no need to re-enable this rule, since it
is checked only at the start of a compilation unit.

@node  Improper_Initialization, Instantiations, Header_Comments, Rules reference
@section Improper_Initialization
This rule enforces a coding pattern that ensures that variables and
@code{@b{out}} parameters are properly initialized befor use.
@subsection Syntax
@example
<control_kind> improper_initialization [(<subrule> @{,<subrule>@})]
<subrule> ::= @{<extra>@} <target>
<extra>   ::= access | limited | package | return
<target>  ::= out_parameter | variable | initialized_variable
@end example
@subsection Action
This rule controls variables and/or @code{@b{out}} parameters that are
not ``properly'' initialized, i.e. those that are not ``safely''
initialized, those that have a useless initialization in their
declaration, and those where the value is known to be used before
having been assigned. The notion of variable includes the return
object of an extended return statement (Ada 2005+).

A variable (or @code{@b{out}} parameter) is considered safely
initialized if there is an initialization expression in its
declaration, or if it is given a value in the first statements of the
corresponding body, before any ``non-trivial'' statement. The goal is
not to perform a complete data-flow analysis, but rather to follow a
design pattern where all variables are initialized before entering the
``active'' part of the algorithm. This makes it easier to ensure that
variables are properly initialized.

``Trivial'' statements are:
@itemize @bullet
@item
@code{null} statements;
@item
assignment statements;
@item
procedure calls;
@item
return statements;
@item
extended return statements, unless they contain a nested non-trivial
statement.
@item
@code{@b{if}} and @code{@b{case}} statements, unless they contain a
nested non-trivial statement.
@end itemize
The <target> parameters determines what is to be checked:
@itemize @bullet
@item
@code{out_parameter} controls that @code{@b{out}} parameters are
safely initialized before the first non-trivial statement, and before
every (trivial) @code{return} statement.
@item
@code{variable} controls that local variables are safely initialized
before the first non-trivial statement. If the <extra> modifier
@code{return} is specified, only return objects of extended return
statements are controlled.
@item
@code{initialized_variable} controls variables that are safely
initialized before the first non-trivial statement, but also have an
explicit (and therefore useless) explicit initialization in their
declaration. If the modifier @code{return} is specified, only return
objects of extended return statements  are controlled.
@end itemize
In all cases, variables used in trivial statements before being
initialized are reported.

A variable is considered initialized if it is the target of an
assignment statement, or if it is used as an actual for an
@code{@b{out}} (but not @code{@b{in out}}) parameter of a procedure
call. Variables assigned in @code{@b{if}} or @code{@b{case}}
statements must receive a value in all paths to be considered
initialized after the statement.  Note that the variable must be
assigned to globally, i.e. assigning to some elements of an array, or
some fields of a record, does not count as an initialization of the
variable.

Some variables are @i{not} controlled, unless the corresponding
<extra> modifier is given:
@itemize
@item
Variables declared immediately within a (generic) package
specification or body, since in general, package state variables are
initialized through calls to dedicated procedures. Use the ``package''
modifier to control also package variables.
@item
Variables of an access types, or arrays whose components are of an
access type, since these are always initialized by the compiler. Use
the ``access'' modifier to control also variables of an access type.
@item
Variables of a limited type, since global assignment is not available
for them. Use the ``limited'' modifier to control also variables of a
limited type.
@end itemize

This rule can be given only once for each value of <target>. Without
parameters, it is equivalent to giving all, without any <extra>.

Ex:
@example
check improper_initialization (out_parameter);
check improper_initialization (access limited variable);
search improper_initialization (initialized_variable);
@end example

@subsection Tips
@code{variable} and @code{initialized_variable} control also return
objects from extended return statements, since it would be strange to
guarantee  safe initialization of local variables and not return
objects. On the other hand, the design pattern enforced by this rule
may seem to limitative for regular variables, but it might be
desirable to enforce it for return objects; hence the possibility to
limit the rule to return objects by specifying the @code{return}
modifier.

@subsection Limitations
Due to a weakness of the ASIS standard, dispatching calls and calls to
procedures that are attributes are not considered for the
initialization of variables. Note that for attributes, only
@code{'Read} and @code{'Input} have an @code{@b{out}} parameter.

In the rare case where a variable is initialized by a dispatching call
or an attribute call, this limitation will result in a false
positive. Such a case is detected by the rule
``uncheckable''. @xref{Uncheckable}. It is then easy to disable the
rule for this variable. @xref{Disabling controls}.

The rule analyzes only initializations and uses that are directly in
the unit, not those from nested units, since these are in the general
case not statically checkable.

There are other cases where an object is automatically initialized by
the declaration, like controlled types that have redefined the
@code{Initialize} procedure, records where all components have a
default initialization, etc. The rule does not consider these as
automatically initialized, as it does for access types. Maybe later...

@node Instantiations, Insufficient_Parameters, Improper_Initialization, Rules reference
@section Instantiations
This rule controls all instantiations of a generic, or only
instantiations that are made with specific values of the
parameters. Control can be restricted to instantiations in specified
places.

@subsection Syntax
@example
<control_kind> instantiations (<generic_spec>);
<generic_spec> ::= @{<location_kw>@} <entity> @{, <formal_spec>@}
<formal_spec>  ::= <entity> | <category> | <> | =
<location_kw>  ::= all | block   | library | local      | nested |
                   own | private | public  | in_generic | task_body
<category>     ::= ()      | access    | array | delta  | digits | mod  |
                   private | protected | range | record | tagged | task
@end example

@subsection Action
The rule controls instantiations of the specified <entity>. As usual,
the whole syntax for entities is allowed for <entity>.
@xref{Specifying an Ada entity name}.

The <location_kw> restricts the places where the occurrence of the
instantiation is controlled.  Several <location_kw> can be given, in
which case the instantiation is controlled at places where all the
keywords apply. If there is no <location_kw>, it is assumed to be
``all''.
@itemize @bullet
@item
@code{all}: puts no special restriction to the location. This keyword
can be specified for readability purposes, and if specified must
appear alone (not with other <location_kw>).
@item
@code{block}: only instantiations appearing in block statements are
controlled.
@item
@code{library}: only library level instantiations are controlled.
@item
@code{local}: only local instantiations are controlled (i.e. only
instantiations appearing in (generic) packages, possibly nested, are
allowed).
@item
@code{nested}: only instantiations nested in another declaration are
controlled (i.e. only library level instantiations are allowed).
@item
@code{own}: only instantiations that are local to a (generic) package
body are controlled.
@item
@code{public}: only declarations appearing in the visible part of
(generic) packages are controlled.
@item
@code{private}: only instantiations appearing directly in a private
part are controlled.
@item
@code{in_generic}: only instantiations appearing directly or indirectly in a generic
specification or body are controlled.
@item
@code{task_body}: only instantiations appearing directly in a task
body are controlled. Note that it would not make sense to have a
<location_kw> for task @i{specifications}, since instantiations are
not allowed there.
@end itemize

An instantiation matches if it appears at a specified location (if
any) and either:
@enumerate
@item
No <formal_spec> is given in the rule
@item
The actual parameters of the instantiation match the corresponding
<formal_spec>, in order (there can be more actual parameters in the
instantiation than specified in the rule). An actual parameter matches
an <entity> at a given place if it is the same entity, or if the
<entity> designates a (sub)type and  the actual is a subtype of this
type. As usual, the whole syntax for entities is allowed for
<entity>. @xref{Specifying an Ada entity name}.  In addition, it
matches if the actual is a type name that belongs to the indicated
category:
@itemize @bullet
@item
``()'': The parameter is of an enumerated type.
@item
``access'':  The parameter is of an access type.
@item
``array'': The parameter is of an array type.
@item
``delta'': The parameter is of a fixed point type (it is not currently
possible to distinguish ordinary fixed point types from decimal fixed
point types).
@item
``digits'': The parameter is of a floating point type.
@item
``mod'': The parameter is of a modular type.
@item
``private'': The parameter is of a private type (including private
extensions).
@item
``protected'': The parameter is of a protected type.
@item
``range'': The parameter is of a signed integer type.
@item
``record'': The parameter is of an (untagged) record type.
@item
``tagged'': The parameter is of a tagged type (including type
extensions).
@item
``task'': The parameter is of a task type.
@end itemize

In addition, two special signs can be given instead of an <entity> (or
<category>): a box (@code{<>}) matches any actual parameter
(i.e. it stands for any value), and an equal sign (@code{=}) matches
if there has been already an instantiation with the same value for
this parameter (i.e. it matches the second time it is encountered).
@end enumerate

If an actual is an expression (which is possible only for a formal
@code{@b{in}} object), it cannot be matched.

Ex:
@example
-- Check all instantiations of Unchecked_Deallocation:
search instantiations (ada.unchecked_deallocation);

-- Check all instantiations of Unchecked_Conversion from or to String:
check instantiations (ada.unchecked_conversion, standard.string);
check instantiations (ada.unchecked_conversion, <>, standard.string);

-- Check all instantiations of Unchecked_Conversion from address
-- to an integer type:
check instantiations (ada.unchecked_conversion, system.address, range);

-- Check that Unchecked_Conversion is instantiated only once
-- for any pair of arguments:
check instantiations (ada.unchecked_conversion, =, =);
@end example

@subsection Tips
The various forms of <formal_spec> make the rule quite powerful. For
example:
@example
-- Not two instantiations of Gen with the same first parameter:
check instantations (Gen, =);

-- Not two instantiations of Gen with the same first and third parameter:
check instantiations (Gen, =, <>, =);

-- Not two instantiations of Gen with the same first parameter if the
-- second parameter is Pack.Proc:
check instantiations (Gen, =, Pack.Proc);

-- Not two instantiations of Gen with the same first parameter if the
-- second parameter is any procedure named Proc:
check instantiations (Gen, =, all Proc);
@end example

Note that a generic actual wich is a subtype matches all types (and subtypes)
above it. Therefore,
@example
check instantiations (ada.unchecked_deallocation (standard.natural));
@end example
will find only instantiations that use @code{Natural}, while:
@example
check instantiations (ada.unchecked_deallocation (standard.integer));
@end example
will find instantiations that use either @code{Integer},
@code{Positive}, or @code{Natural}.

@subsection Limitation
GNAT defines @code{Unchecked_Conversion} and
@code{Unchecked_Deallocation} as separate entities, rather than
renamings of @code{Ada.Unchecked_Conversion} and
@code{Ada.Unchecked_Deallocation}. As a consequence, it is necessary
to specify explicitely both forms if you want to make sure that the
corresponding generics are not instantiated.

@node  Insufficient_Parameters, Local_Access, Instantiations, Rules reference
@section Insufficient_Parameters
This rule controls calls to subprograms and entries where the values
of parameters does not provide sufficient information to the reader to
correctly identify the parameter's purpose.

@subsection Syntax
@example
<control_kind> insufficient_parameters (<max_allowed> @{, <entity>@});
@end example
@subsection Action
<max_allowed> is the maximum number of  allowed ``insufficient''
parameters (can be 0). The <entity> parameters designate enumeration
types whose values should be included in the check. As usual, the
whole syntax for entities is allowed for <entity>. @xref{Specifying an
Ada entity name}.

An actual parameter is deemed "insufficient"  if it is given in
positional (as opposed to named) notation, it is an expression whose
primaries are all numeric literals, or enumeration literals belonging
to one of the types passed as parameters to the rule
(@code{Standard.Boolean} for example).

This rule can be given once for each of check, search, and count. This
way, it is possible to have a level considered a warning (search), and
one considered an error (check).

Ex:
@example
search Insufficient_Parameters (1, Standard.Boolean);
check  Insufficient_Parameters (2, Standard.Boolean);
@end example

@subsection Tips
This rule does not apply to operators that use infix notation, nor to
calls to subprograms that are attributes, since named notation is not
allowed for these.

This rule controls the use of positional parameters according to their
values; it is also possible to control the use of positional
parameters according to the number of parameters with the rule
@code{positional_associations}. @xref{Positional_Associations}.

Note also that this rules applies only to calls, while
@code{positional_associations} applies to all forms of associations.

@node Local_Access, Local_Hiding, Insufficient_Parameters, Rules reference
@section Local_Access
This rule controls the taking of access values (through the  @code{'Access},
 @code{'Unchecked_Access}, or the  GNAT specific  @code{'Unrestricted_Access}
attributes) of local (i.e. non global) entities.

@subsection Syntax
@example
<control_kind> local_access [(<subrule> @{,<subrule>@})];
<subrule>   ::= constant | variable | procedure | function |
                protected_procedure | protected_function
@end example

@subsection Action
Without parameters, the rule controls all entities given as prefixes
of  @code{'Access}, @code{'Unchecked_Access}, or
@code{'Unrestricted_Access} attributes and reports on those that are
not global, i.e. not defined in (possibly nested) library packages.

If parameters are specified, only entities belonging to the
corresponding categories are controlled.

Ex:
@example
Dangerous_Objects: check local_access (Constant, Variable);
@end example

@subsection Tips
In Ada 95, accessibility rules make sure that taking the
@code{'Access} of an entity cannot create dangling pointers, but this
check can be circumvented by using @code{'Unchecked_Access} (but not
on subprograms), or in GNAT, by using
@code{'Unrestricted_Access}. Moreover, Ada 2005 generalized anonymous
access types create more cases where accessibility levels are
dynamically checked.

Taking an access value on a global entity is never a risk, but every
use of access values designating local entities has a potential of a
failing dynamic accessibility check or even of a dangling
pointer. This rule is helpful in finding the places that need careful
inspection - of for disallowing taking accesses on anything but global
entities.

@node Local_Hiding, Max_Blank_Lines, Local_Access, Rules reference
@section Local_Hiding
This rule controls declarations that hide an outer declaration with
the same name.

@subsection Syntax
@example
<control_kind> local_hiding [(<subrule> @{,"<allowed pattern>"@})];
<subrule>   ::= @{<exception>@}  strict | overloading
<exception> ::= not_operator           | not_enumeration       |
                not_identical_renaming | not_different_families
@end example

@subsection Action
If ``strict'' is given (or if there is no subrule), the rule controls
strict hiding (an inner subprogram that overloads an outer one is not
considered hiding). If ``overloading'' is given, only subprograms that
overload another subprogram in the same scope or in an outer scope are
controlled. Note that following the normal Ada model, the declarations
of enumeration literals are considered functions (and thus
controlled).

Modifiers are used to exclude some controls (i.e. to allow the corresponding hiding):
@itemize @bullet
@item
``not_operator'': the subrule does not apply to the declarations of
operators (i.e. things like ``@code{"+"}'').
@item
``not_enumeration'': the subrule does not apply to the
hiding/overloading of enumeration literals by other enumeration
literals (the  rule still applies to the hiding/overloading of
functions by enumeration litterals, for example).
@item
``not_identical_renaming'' (only allowed with ``strict''): the subrule
does not apply to renamings where the renaming name is the same as the
name of the renamed entity. Such renamings are commonly used to
provide visibility of identifiers in a controlled way.
@item
``not_different_families'' (only allowed with ``strict''): the subrule
does not apply  if the hiding identifier and the hidden one do not
belong to the same ``family''. Families are either data (constant,
variables, numbers, etc.), types, subprograms (including entries),
packages, generics, exceptions, and labels (including block and loop
names).
@end itemize
If one or more <allowed pattern> are given, hiding (or overloading) of
identifiers that match one of the patterns are not reported. The whole
syntax for regular expressions is allowed for the pattern, but the
matching is always case insensitive. @xref{Syntax of regular
expressions}.

This rule can be given only once for ``strict'' and once for
``overloading''.

Ex:
@example
Hiding: check local_hiding (strict);
Overloading: search local_hiding (not_operator overloading);
@end example

@subsection Variables
The rule provides a variable that allows to adjust the verbosity
of messages for the subrule ``overloading''.

@need 800
@multitable @columnfractions .20 .20 .10 .50
@item
@b{Variable} @tab @b{Values} @tab @b{Default} @tab @b{Effect}
@item
Overloading_Report @tab compact/detailed @tab detailed @tab if
``detailed'',  when a construct that overloads several other constructs
is encountered, ``overloading'' will issue a message for each
overloaded construct; if ``compact'', it will issue a single
message mentionning how many constructs are overloaded, and a pointer
to the last one.
@end multitable

@subsection Tips
If you have a naming convention like having all tagged types named
``instance'' (with a meaningful name for the enclosing package), and
if in addition your package structure follows the inheritance
hierarchy (i.e. a descendent class is in a child package), then all
``instance'' will hide each other - but this is of course
intended. Specifying ``@code{^instance$}'' as an allowed pattern will
prevent error messages for these declarations.

Note that the name is given between ``@code{^}'' and
``@code{$}''. Otherwise, following normal regexp syntax, any
identifier @i{containing} ``instance'' would be allowed.

A confusion between names belonging to different ``families'' (as
defined here) always leads to a compilation error; it may be
acceptable to allow local hiding of names belonging to different
families, since there is no risk involved.

@node Max_Blank_Lines, Max_Call_Depth, Local_Hiding, Rules reference
@section Max_Blank_Lines
This rule controls excessive spacing in the program text.

@subsection Syntax
@example
<control_kind> max_blank_lines (<max allowed blank lines>);
@end example

@subsection Action
This rule controls the occurrence of more than the indicated number of
consecutive blank lines (empty lines, or lines that contain only
spaces). This rule can be given once for each of check, search, and
count. This way, it is possible to have a number of blank lines
considered a warning (search), and one considered an error (check). Of
course, this makes sense only if the number for search is less than
the one for check.

Ex:
@example
search max_blank_lines (2);
check max_blank_lines (5);
@end example

@node Max_Call_Depth, Max_Line_Length, Max_Blank_Lines, Rules reference
@section Max_Call_Depth
This rule controls the maximum depth of subprograms (or entry) calls.
@subsection Syntax
@example
<control_kind> max_call_depth (<allowed depth> | finite);
@end example
@subsection Action
Roughly, the call depth is the number of frames that are stacked by a
call: if you call a subprogram that calls another subprogram that
calls nothing, then the call depth is 2. Note that a call to a task
(not protected) entry has always a depth of 1, since the accept body
that corresponds to the entry is executed on a different stack.

The value of the parameter is the maximum @i{allowed} depth, i.e. the
rule will trigger if the call depth is strictly greater than the
indicated value. A call to a (directly or indirectly) recursive
procedure is considered of infinite depth, and will be therefore
signaled (with an appropriate message) for any value of <allowed
depth>. Alternatively, the keyword ``finite'' can be given in place of
the <allowed depth>: in this case, only calls to recursive subprograms
will be signalled.

This rule can be given once for each of check, search, and count. This
way, it is possible to have a call depth considered a warning
(search), and one considered an error (check). Of course, this makes
sense only if the number for search is less than the one for check.

Ex:
@example
search max_call_depth (9);
check  max_call_depth (finite);
@end example

@subsection Tip
It is possible to give the value 0 for <allowed depth>. Of course,
it would not make sense to forbid all subprogram calls in an Ada program,
but this can be useful for inspection purposes, since every call will be
reported, and the message indicates the depth of the call.

If the message says that the call depth ``is N'', it is exactly N. If
the message says that the call depth is ``at least N'', it means that
the call chain includes a call to a subprogram whose depth is unknown
(see ``Limitations'' below); ``N'' is the call depth if this
subprogram does not call anything else. Of course, the rule issues a
message if this minimal value is greater than the maximum allowed
value.

@subsection Limitations
Calls to subprograms that are attributes are assumed to have a depth
of 1. Calls to predefined operators are assumed to be in-lined (i.e. a
depth of 0).

Calls through pointers to subprograms and dispatching calls are
unknown statically; in addition, some subprograms may not have a body
available for analysis, like imported subprograms, or possibly
subprograms from the standard library; they are all assumed to have a
depth of 1. Such calls are detected by the rule
``uncheckable''. @xref{Uncheckable}.

@node  Max_Line_Length, Max_Nesting, Max_Call_Depth, Rules reference
@section Max_Line_Length
This rule controls that no line exceeds a given length.

@subsection Syntax
@example
<control_kind> max_line_length (<max allowed length>);
@end example

@subsection Action
This rule controls the maximum length of source lines.  This rule can
be given once for each of check, search, and count. This way, it
is possible to have a length considered a warning (search), and one
considered an error (check). Of course, this makes sense only if the
length for search is less than the one for check.

Ex:
@example
search max_line_length (80);
check max_line_length (120);
@end example

@node Max_Nesting, Max_Size, Max_Line_Length, Rules reference
@section Max_Nesting
This rule controls excessive nesting of declarations.

@subsection Syntax
@example
<control_kind> max_nesting ([<subrule>,] <max allowed depth>);
<subrule> ::= all | generic | separate | task
@end example

@subsection Action
If ``all'' (or no subrule) is given as the first parameter, this rule
controls the nesting of declarative constructs (like subprograms,
packages, generics, block statements@dots{}) that exceed a given
depth. Nesting of statements (@code{@b{loop}}, @code{@b{case}}) is not
considered.

If ``generic'' is given as the first parameter, this rule controls the
nesting of generics, ignoring all non-generic units.

If ``separate'' is given as the first parameter, this rule controls the
nesting of separate bodies.

If ``task'' is given as the first parameter, this rule controls the
nesting of tasks (task types and single task objects), ignoring all
non-task units.

This rule can be given once for each subrule and each of check,
search, and count. This way, it is possible to have a level considered
a warning (search), and one considered an error (check). Of course,
this makes sense only if the level for search is less than the one for
check.

Note that the value given is the maximum @i{allowed} nesting; f.e. if the
value given for ``generic'' is 1, it means that a generic inside a
generic is allowed, but not more.

Ex:
@example
search max_nesting (5);
check max_nesting (all, 7);
check max_nesting (generic, 1);
check max_nesting (separate, 0); -- Do not allow separate in separate
check max_nesting (task, 0);     -- Do not allow a task in another task
@end example

@node Max_Size, Max_Statement_Nesting, Max_Nesting, Rules reference
@section Max_Size
This rule controls the maximum size, in source lines of code, of
various statements and declarations.

@subsection Syntax
@example
<control_kind> max_size (<subrule>, <max allowed lines>);
<subrule> ::= accept        | block          | case  | case_branch   |
              if            | if_branch      | loop  | simple_block  |
              unnamed_block | unnamed_loop   |
              package_spec  | package_body   | procedure_body |
              function_body | protected_spec | protected_body |
              entry_body    | task_spec      | task_body      |
              unit
@end example
@subsection Action
The first parameter is a subrule keyword that determines which
elements are controlled:
@itemize @bullet
@item
``accept'' controls accept statements.
@item
``block'' controls all block statements, while ``simple_block''
controls only blocks without a @code{@b{declare}} part, and
``unnamed_block'' controls only blocks without a name.
@item
``loop'' controls all loop statement, while ``unnamed_loop'' controls
only loops without a name.
@item
``if_branch'' and ``case_branch'' control the length of each
alternative of an @code{@b{if}} (respectively @code{@b{case}})
statement.
@item
``package_spec'', ``package_body'', ``procedure_body'',
``function_body'', ``protected_spec'', ``protected_body'',
``entry_body'', ``task_spec'', and ``task_body'' control the length of
the declaration of the corresponding element.
@item
``unit'' controls the whole length of compilation units.
@end itemize

For each kind of element, the indicated value is the maximum allowed
size of the full element; however, for branches (``if_branch'' and
``case_branch'') it is the maximum size of the sequence of statements
in the branch (i.e., the line that contains the @code{@b{elsif}} is
not counted as part of an ``if_branch'').

This rule can be given once for each of check, search, and count for
each kind of element. This way, it is possible to have a level
considered a warning (search), and one considered an error (check). Of
course, this makes sense only if the number of lines for search is
less than the one for check.

Ex:
@example
check Max_Size (if_branch, 30);
search Max_Size (if_branch, 50);
check Max_Size (unnamed_loop, 20);
@end example

@subsection Tip
Note that ``procedure_body'' and ``function_body'' apply to protected
subprograms as well as regular ones, and that there is no subrule for
the length of the declaration of subprograms. Such fine specifications
didn't seem useful, but could be added if someone expresses a need for
it.

@node Max_Statement_Nesting, Movable_Accept_Statements, Max_Size, Rules reference
@section Max_Statement_Nesting
This rule controls the nesting of compound statements.

@subsection Syntax
@example
<control_kind> max_statement_nesting (<subrule>, <max allowed depth>);
<subrule> ::= block | case | if | loop | all
@end example
@subsection Action
If one of ``block'', ``case'', ``if'', or ``loop'' is specified, it
controls the nesting of statements of the same kind, i.e. an
@code{@b{if}} within a @code{@b{loop}} within an @code{@b{if}} counts
only 2 for the ``if'' keyword. If ``all'' is specified, all kinds of
compound statements are counted together, i.e. an @code{@b{if}} within
a @code{@b{loop}} within an @code{@b{if}} counts for 3. This rule can
be given once for each of check, search, and count, and for each of
the subrules. This way, it is possible to have a level considered a
warning (search), and one considered an error(check). Of course, this
makes sense only if the level for search is less than the one for
check.

Ex:
@example
check max_statement_nesting (loop, 3);
search max_statement_nesting (all, 5);
@end example

@node Movable_Accept_Statements, Naming_Convention, Max_Statement_Nesting, Rules reference
@section Movable_Accept_Statements
This rule controls statements that are inside accept statements and
could safely be moved outside.

@subsection Syntax
@example
<control_kind> movable_accept_statements (certain|possible @{, <entity>@})
@end example
@subsection Action
Since it is good practice to block a client for the shortest time
possible, any action that does not depend on the accept parameters
should not be part of an accept statement.

Statements that involve synchronisation (delay statements, accept or
entry calls...) are not movable.  Statements (including compound
statements) that reference the parameters of the enclosing accept are
not movable.  In addition, statements that use one of the <entity>
given as parameters are never considered movable. As usual, the whole
syntax for entities is allowed for <entity>. @xref{Specifying an Ada
entity name}.  Note that if a generic entity, or an entity declared in
a generic package, is given, all statements that use the corresponding
instantiated entity are considered not movable.

If the first parameter of the rule is @code{certain}, only statements
after the last non-movable statement are reported.  If the first
parameter is @code{possible}, a simple data flow analysis is
performed, and every statement that does not reference a variable that
appears to depend (directly or indirectly) on a parameter is also
reported.

Ex:
@example
check movable_accept_statements (possible, Log.Report_Rendezvous);
@end example

@subsection Tips
The list of <entity> given to the rule can be, for example, procedures
whose execution must be part of the accept statement for logical
reasons. They can also be global variables, when the rendezvous is
intended to prevent concurrent access to these variables.

@node Naming_Convention, No_Operator_Usage, Movable_Accept_Statements, Rules reference
@section Naming_Convention
This rule controls the form of identifiers to make sure that they
follow the project's naming conventions. Different naming conventions
can be specified, depending on the kind of Ada entity that the name is
refering to.

@subsection Syntax
@example
<control_kind> naming_convention
   ([root] [others] @{<location>@} [<type_spec>] <filter_kind>,
    [case_sensitive|case_insensitive] [not] "<pattern>"
    @{, ...@});
<location>  ::= global | local | unit
<type_spec> ::= <entity> | @{<category>@}
<category>  ::= ()      | access    | array | delta  | digits | mod |
                private | protected | range | record | tagged | task
<filter_kind> ::= All |
                    Type |
                       Discrete_Type |
                          Enumeration_Type |
                          Integer_Type |
                             Signed_Integer_Type |
                             Modular_Integer_Type |
                          Floating_Point_Type |
                          Fixed_Point_Type |
                             Binary_Fixed_Point_Type |
                             Decimal_Fixed_Point_Type |
                       Array_Type |
                       Record_Type |
                          Regular_Record_Type |
                          Tagged_Type |
                          Interface_Type |
                          Class_Type |
                       Access_Type |
                          Access_To_Regular_Type |
                          Access_To_Tagged_Type |
                          Access_To_Class_Type |
                          Access_To_SP_Type |
                          Access_To_Task_Type |
                          Access_To_Protected_Type |
                       Private_Type |
                          Private_Extension |
                       Generic_Formal_Type |
                    Variable |
                       Regular_Variable |
                       Field |
                          Discriminant |
                          Record_Field |
                          Protected_Field |
                       Procedure_Formal_Out |
                       Procedure_Formal_In_Out |
                       Generic_Formal_In_Out |
                    Constant |
                       Regular_Constant |
                          Regular_Static_Constant |
                          Regular_Nonstatic_Constant |
                       Named_Number |
                          Integer_Number |
                          Real_Number |
                       Enumeration |
                       Sp_Formal_In |
                       Generic_Formal_In |
                       Loop_Control |
                       Occurrence_Name |
                       Entry_Index |
                    Label |
                    Stmt_Name |
                       Loop_Name |
                       Block_Name |
                    Subprogram |
                       Procedure |
                          Regular_Procedure |
                          Protected_Procedure |
                          Generic_Formal_Procedure |
                       Function |
                          Regular_Function |
                          Protected_Function |
                          Generic_Formal_Function |
                       Entry |
                          Task_Entry |
                          Protected_Entry |
                    Package |
                       Regular_Package |
                       Generic_Formal_Package |
                    Task |
                       Task_Type |
                       Task_Object |
                    Protected |
                       Protected_Type |
                       Protected_Object |
                    Exception |
                    Generic |
                       Generic_Package |
                       Generic_Sp |
                          Generic_Procedure |
                          Generic_Function |
                    Renaming |
                       Object_Renaming |
                       Exception_Renaming |
                       Package_Renaming |
                       Subprogram_Renaming |
                          Procedure_Renaming |
                          Function_Renaming |
                       Generic_Renaming |
                          Generic_Package_Renaming |
                          Generic_Sp_Renaming |
                             Generic_Procedure_Renaming |
                             Generic_Function_Renaming
@end example

@subsection Action
The first parameter defines the kind of declaration to which the rule
is applicable, and other parameters are strings, interpreted as
regular expressions that define the patterns that must be
matched (or not). @xref{Syntax of regular expressions}.

If one or more <location> keyword is specified, the pattern applies
only to identifiers declared at the corresponding place. Otherwise,
the pattern applies to all identifiers, irrespectively of where they
are declared. The definition of locations is as follows:
@itemize @bullet
@item
``unit'': The identifier is the defining name of a compilation unit.
@item
``global'': The identifier is  declared in a package or a  generic
package, possibly nested in other packages or generic packages.
@item
``local'': All other cases.
@end itemize

In the case of objects (corresponding to filters  in the ``variable''
and ``constant'' families) and functions (in the ``function'' family),
it is possible to be more specific, depending on the type of the
object (or the return type of the function), as specified by the
<type_spec> modifier. The <type_spec> modifier is either a single
<entity> giving the type of the object or one or more <category>
keywords. As usual, the whole syntax for entities is allowed for
<entity>. @xref{Specifying an Ada entity name}. The meaning of
<category> is:
@itemize @bullet
@item
``()'': The object is of an enumerated type.
@item
``access'':  The object is of an access type.
@item
``array'': The object is of an array type.
@item
``delta'': The object is of a fixed point type (it is not currently
possible to distinguish ordinary fixed point types from decimal fixed
point types).
@item
``digits'': The object is of a floating point type.
@item
``mod'': The object is of a modular type.
@item
``private'': The object is of a private type (including private
extensions).
@item
``protected'': The object is of a protected type.
@item
``range'': The object is of a signed integer type.
@item
``record'': The object is of an (untagged) record type.
@item
``tagged'': The object is of a tagged type (including type
extensions).
@item
``task'': The object is of a task type.
@end itemize

For a given layer of the hierarchy (i.e. ``variable'',
``regular_variable''), only the most specific filter is applicable,
i.e. ``standard.boolean variable'' will apply to all boolean
variables, while plain ``variable'' will apply to other variables. See
examples below.

If ``case_sensitive'' is specified, pattern matching considers
casing. Otherwise (``case_insensitive''), casing is irrelevant. The
default is ``case_insensitive'', and can be changed by setting the
variable ``Default_Case_Sensitivity'', see below. Note that the rule
checks the name only at the place where it is declared; casing might
be different when the name is used later.

If a pattern is preceded by ``not'', then the pattern must @i{not} be
matched (i.e. the rule reports when there is a match).

The rule will be activated if an identifier is declared that does not
match any of the ``positive'' patterns (the ones without ``not''), or
if it matches any of the ''negative'' patterns (the ones with a
``not''). If only negative patterns are given, it is implicitely
assumed that all other identifiers are OK. In other words, accepted
identifiers must have the form of (at least) one of the ``positive''
patterns (if any), but not the form of one of the ``negative''
patterns.

The filter kinds are organized hierarchically, as reflected in the
syntax above. To be valid, the name must match the patterns specified
for its own filter, and for all filters above it in the hierarchy.
For example, a modular type declaration must follow the rules (if
specified) for ``all'', ``type'',''discrete_type'', ``integer_type''
and ``modular_integer_type''. However, if a filter kind is preceded by
``others'', the rule will apply only if there is no applicable
positive pattern deeper in the hierarchy; similarly, if a filter kind
is preceded by ``root'', no rule above it in the hierarchy is
considered (neither for itself nor its children). This is useful to
make exceptions to a more general rule. For example:
@example
-- All identifiers must have at least 3 characters:
check naming_convention (all, "...");
-- And start with an upper-case letter
-- (will not apply to types and access types, because of "others" and
--  other rules given below)
check naming_convention (others all, case_sensitive "^[A-Z]");

-- Exception to the rule for "all":
-- No minimum length for "for loop" identifiers, but must be
-- all uppercase
check naming_convention (root loop_control, case_sensitive "^[A-Z]+$");

-- Types must start with "t", then an upper-case letter:
-- (will not apply to access types, because of "others" and
--  other rule given below)
check naming_convention (others type, case_sensitive "^t[A-Z]");

-- Access types must start with "ta", then an upper-case letter:
check naming_convention (access_type, case_sensitive "^ta[A-Z]");

-- Boolean variables, and only these, must start with "Is_" or
-- "Has_":
check naming_convention (variable, not "^Is_", not "^Has_");
check naming_convention (standard.boolean variable, "^Is_", "^Has_");

-- Functions returning Wide_String must start with "Wide_", and
-- similarly for Wide_Wide_String, and no other:
check naming_convention (standard.wide_string function,
   "^Wide_",
   not "^Wide_Wide_");
check naming_convention (standard.wide_wide_string function,
   "^Wide_Wide_");
check naming_convention (function, not "^Wide_");
@end example

It is of course not necessary to specify all the filter kinds, nor to
specify filters down to the deepest level; if you specify a rule for
``type'', it will be applied to all type declarations, whether there
is a more specific rule or not.

Subtypes and derived types must follow the rule for their respective
original (full) type. Incomplete type declarations are @i{not}
checked, since their corresponding full declaration is (normally)
checked. Private types (including of course the full declaration of a
private type) follow the rule for private types, @i{not} the rules for
their full type view (otherwise it would be privacy breaking).

Renamings are treated specially: if there is no explicit rule for a
given renaming, the applicable rule is the one for the renamed entity.

Ex:
@example
-- Predefined name is forbidden:
check naming_convention (all, not "Integer");

-- Types must either start or end with T
check naming_convention (type, case_sensitive "^T_",
                               case_sensitive "_T$");

-- "Upper_Initials" naming convention:
check naming_convention
   (all, case_sensitive "^[A-Z][a-z0-9]*(_[A-Z0-9][a-z0-9]*)*$");

-- All global variables must start with "G_"
check naming_convention (global variable, "G_");
@end example

@subsection Variables
The rule provides a variable that allows to specify the default
casing.

@need 800
@multitable @columnfractions .30 .10 .10 .50
@item
@b{Variable} @tab @b{Values} @tab @b{Default} @tab @b{Effect}
@item
Default_Case_Sensitivity @tab on/off @tab off @tab if ``on'', controls that do not explicitely specify case sensitivity are case sensitive.
@end multitable

@subsection Tips
The rule only checks the casing of identifiers at the place where they
are declared. A useful companion rule is ``style (casing_identifier,
original)'', which ensures that every use of the identifier will use
the same casing as in the declaration. @xref{Style}.  Similarly, in
the case of a subprogram and its parameters, the check is not done on
the body if there is an explicit specification (since specification
and body have to match anyway).

The rule does @i{not} check the names of operators, since it would
make little sense to have naming conventions for things whose name is
imposed. If you want to prevent the definition of operators, refer to
the rule ``declarations'' and its subrules ``operator'',
``equality_operator'', and``predefined_operator''.
@xref{Declarations}.

Remember that a Regexp matches if the pattern matches any part of the
identifier.  Use ``^'' and ``$'' to match the beginning (resp. end) of
the name, or both.

A constant is considered static for the purpose of
``Regular_Static_Constant'' and ``Regular_Nonstatic_Constant'' if it
is of a discrete type initialized by a static expression, or if it is
an aggregate whose components all have static values. This is
different from the official definition of ``static'' in the language,
but corresponds to what most users would expect.

``class_type'' is applicable to subtypes that designate a class-wide
type. Similarly, ``access_to_class_type'' is applicable to access
types whose designated type is class-wide.

If you don't want any special rule for renamings (not even the one that
applies to the renamed entity), specify:
@example
check naming_convention (renaming, "");
@end example
This imposes no constraint on renamings, but since it is specified
explicitely, the implicit rule for the renamed entity won't apply.

The @code{rules} directory of Adacontrol contains two files named
@code{no_standard_entity.aru} and @code{no_system_entity.aru}. These
are files that contain a naming_convention rule that forbids the
declaration of names declared in packages @code{Standard} and @code{System},
respectively. You can simply ``source'' these files from your own rule
file (or copy the content) if you want to disallow these identifiers.

Like usual, naming_convention rule can be given multiple times, and
can be disabled. However, consider the following:
@example
Rule1 : check naming_convention (constant, "^c_");
Rule2 : check naming_convention (constant, "^const_");
@end example
The rule will trigger if a constant is declared that does not start
with either ``c_'' or ``const_''. But here, we have two different
rule labels. The message will refer to the first label encountered in the
rule file; this is the label that must be mentionned in a disabling
comment, unless you simply disable ``naming_convention''.

@subsection Limitations
This rule does not support wide characters outside the basic Latin-1 set.

@node No_Operator_Usage, Non_Static, Naming_Convention, Rules reference
@section No_Operator_Usage
This rule controls integer types that do not use any arithmetic
operators, which indicates that they might be replaceable with other
kinds of types.
@subsection Syntax
@example
<control_kind> no_operator_usage [(<parameter> [,<parameter>])];
<parameter> ::= [<filter>] <observed>
<filter>    ::= not | ignore | report
<observed>  ::= relational | logical | indexing
@end example
@subsection Action
This rule controls integer types (both signed and modular) where no
arithmetic operator of the type is used in the program.

When such a type is found, it migh be interesting to find out other
usages to determine a possible better kind of type. ``relational''
means that relational operators (@code{<}, @code{<=}, @code{>},
@code{>=}, @code{@b{in}}, @code{@b{not in}}) are used, ``logical''
means that logical operators (@code{@b{and}}, @code{@b{or}},
@code{@b{xor}}) are used, and  ``indexing'' means  that the type is
used as an index in some array type.

If an <observed> property is given as parameter, only types that
feature the property are controlled, or those that do @i{not} feature
the property if the <observed> is preceded by ``not''. If the
<observed> is preceded by ``ignore'' the type is controlled
irrrespectively of the property, and the message does not mention it
at all, while if it is preceded by ``report'', the message still
mentions whether the <observed> is used or not.

Without parameters, the rule is equivalent to ``ignore relational,
ignore logical, ignore indexing'' (i.e. it controls all types that do
not use any arithmetic operator).

This rule can be given only once for each combination of values of the
parameters.

Ex:
@example
-- Simply report types that don't use arithmetic operators:
check no_operator_usage;

-- Do the same, but mention if indexing/logical ops are used:
check no_operator_usage (report indexing, report logical);

-- Find integer types that use only logical operators:
check no_operator_usage (logical);

-- Find integer types that don't use artihmetic operators and are
-- not used for indexing nor in relational operators:
check no_operator_usage (not indexing, not relational);
@end example

@subsection Tips
An integer type that uses no operator at all is a good candidate to be
replaced by an enumerated type. A modular type where only logical
operators are used is likely to be used as a bit field or a set, and
is a good canditate for being replaced by an array of booleans.

The rule does not make a distinction between predefined and
user-defined operators. On the other hand, only calls to operators are
considered, operators used for example as actual generic parameters in
instantiations are not considered.

The rule applies also to private types whose full declaration is an
integer type.

@node Non_Static, Not_Elaboration_Calls, No_Operator_Usage, Rules reference
@section Non_Static
This rule controls that expressions used in certain contexts are
static.
@subsection Syntax
@example
<control_kind> non_static [(<subrule> @{, <subrule>@})];
<subrule> ::= constant_initialization | variable_initialization |
              index_constraint        | discriminant_constraint |
              instantiation           | index_check
@end example

@subsection Action
The <subrule> defines the elements that are required to be static:
@itemize @bullet
@item
``constant_initialization'': expressions used as initial value in
constant declarations.
@item
``variable_initialization'': expressions used as initial value in
variable declarations.
@item
``index_constraint'': expressions used in index constraints (aka array
sizes).
@item
``discriminant_constraint'': expressions used in discriminant
constraints
@item
``instantiation'': expressions used as generic actual parameters in
instantiations.
@item
``index_check'': expressions used as indices must satisfy statically
the index check. I.e., the expression needs not be static, but it
should be statically provable that the index check cannot fail.
@end itemize

If no keyword is given, all contexts are controlled.

Ex:
@example
check non_static (index_constraint);
@end example

@subsection Limitations
Currently, ``constant_initialization'' and ``variable_initialization''
do not control structured (record and array) variables. For access
variables, the initial value is considered static only if it is a plain
@code{@b{null}}. This may improve in future versions of AdaControl.

@subsection Tips
If all index and discriminant constraints are static, the space
occupied by data structures is computable from the program text. This
rule is useful to enforce this in contexts where the memory space must
be statically determined.

@node Not_Elaboration_Calls, Not_Selected_Name, Non_Static, Rules reference
@section Not_Elaboration_Calls
This rule controls that certain subprograms (or allocators) are called
only during program initialization.
@subsection Syntax
@example
<control_kind> not_elaboration_calls (<entity>|new @{, <entity>|new@});
@end example

@subsection Action
The <entity> parameters are callable entities (procedure, function or
entry calls). As usual, the whole syntax for entities is allowed for
<entity>. @xref{Specifying an Ada entity name}. This rule controls
calls to the indicated callable entities, or allocators if ``new'' is
given, that are performed at any time except during the elaboration of
library packages.

Ex:
@example
search not_elaboration_calls (Data.Initialize, new);
@end example

@subsection Limitations
Due to an (allowed by ASIS standard) limitation of ASIS-for-Gnat, the
rule will not detect calls to subprograms that are implicitely
defined, like calling a @code{"+"} on @code{Integer}. Fortunately,
it is very unlikely that the user would want to forbid that kind of
calls in non-elaboration code.

Note also that calls that cannot be statically determined, like calls
to dispatching operations or calls through pointers to subprograms
cannot be detected either.

@node Not_Selected_Name, Object_Declarations, Not_Elaboration_Calls, Rules reference
@section Not_Selected_Name
This rule controls that certain entities are always refered to using
selected notation, even in the presence of @code{@b{use}} clauses.
@subsection Syntax
@example
<control_kind> not_selected_name
   (<exception places>, <entity> @{, <entity>@});
<exception places> ::= none | unit | compilation | family
@end example
@subsection Action
A name is ``selected'' if it is prefixed by the name of the construct
where it is declared. Only one level of prefix is required, unless the
prefix itself is the target of a not_selected_name rule.

The first parameter specifies places where the rule is @i{not}
enforced, i.e. where simple notation is allowed:
@itemize @bullet
@item
``none'': selected notation is always required.
@item
``unit'': selected notation is not required within the program unit
where the entity is declared.
@item
``compilation'': selected notation is not required within the
compilation unit where the entity is declared.
@item
``family'': selected notation is not required within the compilation
unit where the entity is declared, nor within its (direct or indirect)
children.
@end itemize

Other parameters indicate the <entity> to which the rule applies. As
usual, the whole syntax for entities is allowed for <entity>.
@xref{Specifying an Ada entity name}.

Ex:
@example
check not_selected_name (unit, all Instance);
search not_selected_name (none, Pack.T);
@end example

@subsection Tip
Note that, as usual, the entity can be given in the form ``all
name''. This is especially useful for types that must always be
declared with a special name (like @code{Instance}, @code{Object},
@code{T}) and are intended to be always used with the name of the
enclosing package.

@node  Object_Declarations, Parameter_Aliasing, Not_Selected_Name, Rules reference
@section Object_Declarations
This rule controls various aspects of object (constants and variables)
declarations.

@subsection Syntax
@example
<control_kind> object_declarations (min_integer_span, <min_spec>
                                                   @{, <min_spec>@});
<control_kind> object_declarations (type, <type_spec> @{, <type_spec>@});
<control_kind> object_declarations (volatile_no_address);
<control_kind> object_declarations (address_not_volatile);
<min_spec>  ::= [constant | variable] <value>
<type_spec> ::= [constant | variable] <entity>
@end example

@subsection Action
The action depends on the subrule.
@itemize @bullet
@item
``min_integer_span'': controls that every object of an integer type
has a subtype that covers at least the indicated number of
values. Different values can be specified for variables and constants;
if no modifier (``constant'' or ``variable'') is supplied, the value
applies to both.

This subrule can be given only once for each combination of
check/search/count and constant/variable.
@item
``type'': controls every object whose (sub)type matches <entity>. As usual,
the whole syntax for entities is allowed for
<entity>. @xref{Specifying an Ada entity name}.  If the <entity> is a
subtype, only objects of that exact subtype are controlled; if the
<entity> is a type, objects declared with the type or any subtype of
it are controlled. The control can be restricted to only variables or
only constants; if no modifier (``constant'' or ``variable'') is
supplied, both are controlled.

This subrule can be given only once for each combination of <entity>
and constant/variable.
@item
``volatile_no_address'': controls variables that are the target of a
pragma volatile, but have no address clause. Constants are not
controlled, since it would be very strange to have a volatile
constant...

Since this subrule has no parameters, it can be given only once.
@item
``address_not_volatile'': controls variables that have an address
clause, but are not the target of a pragma volatile. Constants are not
controlled, since it would be very strange to have a volatile
constant...

Since this subrule has no parameters, it can be given only once.
@end itemize

Ex:
@example
check object_declarations (min_integer_span, variable 5, constant 10);

count object_declarations (min_integer_span, 8);
-- Same value for variables and constants

search object_declarations (volatile_no_address);
search object_declarations (address_not_volatile);
@end example

@subsection Tip
The ``min_integer_span'' rule can be useful for detecting variables
that should use an enumerated type rather than an integer type.

@subsection Limitation
Due to a shortcomming of the ASIS interface, the subrules
``volatile_no_address'' and ``address_not_volatile'' will not detect
variables of a class-wide type that are volatile due to a pragma
volatile applying to the class-wide type. If the pragma applies to the
variable, the subrule will work correctly. A pragma volatile applied
to a class-wide type is detected by the rule
``uncheckable''. @xref{Uncheckable}.

Declaring a class-wide @emph{type} as volatile seems very peculiar
anyway...

@node  Parameter_Aliasing, Parameter_Declarations, Object_Declarations, Rules reference
@section Parameter_Aliasing
This rule controls aliased use of variables in subprogram
calls.

@subsection Syntax
@example
<control_kind> parameter_aliasing [([with_in] <level>)];
<level> ::= Certain | Possible | Unlikely
@end example

@subsection Action
This rule identifies calls where the same variable is given as an
actual to more than one @code{@b{out}} or @code{@b{in out}} parameter,
like in the following example:
@example
@b{procedure} Proc (X, Y : @b{out} Integer);
   ...
Proc (X => V, Y => V);
@end example

If the modifier ``@code{with_in}'' is given, aliasing between
@code{@b{out}} or @code{@b{in out}} parameters and @code{@b{in}}
parameters is also considered (unless the @code{@b{in}} parameter is
of a user-defined by-copy type). Although aliasing of @code{@b{in}}
parameters is generally considered less of an issue, it can lead to
unexpected results when the parameter is passed by reference.

There are many cases where aliasing cannot be determined
statically. The optional parameter specifies how aggressively the
rule will check for possible aliasings. Possible values are (case
irrelevant):
@itemize
@item
Certain (default): Only cases where aliasing is statically certain are
output.
@item
Possible: In addition, cases where aliasing may occur depending on
the value of an indexed component are output. These may or may not be
true aliasing, depending on the algorithm. For example, given:
@example
Swap (Tab (I), Tab (J));
@end example
there is no aliasing, unless @code{I} equals @code{J}.

If all expressions used for indexing in both variables are static, the
rule will be able to eliminate the diagnosis of aliasing (if the
values are different). This avoids unnecessary messages in cases like:
@example
Swap (Tab (1), Tab (2));
@end example

@item
Unlikely: In addition, cases where aliasing may occur due to access
variables pointing to the same variable are output. These may or may
not be true aliasing, depending on the algorithm, but should normally
occur only as the result of very strange practices, like in the
following example:
@example
@b{type} R @b{is}
   @b{record}
      X : @b{aliased} Integer;
   @b{end} @b{record};
X : R;
Y : Access_All_Integer := R.X'access;
   ...
P (X, Y.all);
@end example
@end itemize
There will be no false positive with ``Certain''. There will be no
false negative with ``Unlikely'' (but many false
positives). ``Possible'' is somewhere in-between.

The rule may be specified at most once for each value of the
parameter. This allows for example to ``check'' for ``Certain'' and
``search'' for ``Possible''.

Ex:
@example
check parameter_aliasing (with_in certain);
search parameter_aliasing (Possible);
@end example

Note that the rule is quite clever: it will consider partial aliasing
(like a record variable as one parameter, and one of its components as
another parameter), and will not be fooled by renamings.

@subsection Limitation
Due to a weakness of the ASIS standard, dispatching calls  are not
analyzed. Some calls cannot obviously have aliasing (if there is only
one parameter, or if there are no variables in the parameters f.e.);
other calls are detected by the rule ``uncheckable''. @xref{Uncheckable}.

@node Parameter_Declarations, Positional_Associations, Parameter_Aliasing, Rules reference
@section Parameter_Declarations
This rule controls various characteristics of the declaration of parameters
for all callable entities (i.e. functions, procedures and entries).

@subsection Syntax
@example
<control_kind> parameter_declarations (<subrule> [,<bounds>] @{,<callable>@});
<subrule>  ::= all_parameters       | in_parameters         |
               defaulted_parameters | out_parameters        |
               in_out_parameters    | access_parameters     |
               tagged_parameters    | class_wide_parameters |
               single_out_parameter
<bounds>    ::= min|max <value> [, min|max <value> ]
<callable> ::= function             | procedure             |
               dispatching_function | dispatching_procedure |
               protected_function   | protected_procedure   |
               protected_entry      | task_entry
@end example

@subsection Action
The first parameter is a subrule keyword. ``single_out_parameter'' has
no parameter; all other subrules require one or two bounds.
@itemize @bullet
@item
``all_parameters'': Controls callable entities whose number of
parameters is less than the given ``min'' or greater than the given
``max''. ``min'' defaults to 0 and ``max'' to infinity.
@item
``in_parameters'', ``out_parameters'', ``in_out_parameters'': Do the
same, counting only parameters of modes @code{@b{in}},
@code{@b{out}}, or @code{@b{in out}} respectively.
@item
``defaulted_parameters'': Does the same, counting only parameters
declared with an explicit default expression.
@item
``access_parameters'': Does the same, counting only (anonymous) access
parameters.
@item
``tagged_parameters'': Does the same, counting only parameters of
a specific tagged type.
@item
``class_wide_parameters'': Does the same, counting only parameters of
a class-wide type.
@item
``single_out_parameter'': Controls callable entities that have exactly
one @code{@b{out}} parameter. Procedures with a single  @code{@b{out}}
parameter might be candidates to becoming functions.
@end itemize

If one or more <callable_kind> is specified after the <value>, the
rule applies only to the corresponding declaration(s), otherwise it
applies to all callable entities. ``dispatching_function'' and
``dispatching_procedure'' allow different counts for dispatching
subprograms (i.e. primitive subprograms of a tagged type).  If
``dispatching_function'' or ``dispatching_procedure'' is not
explicitely specified, ``function'' (conversely ``procedure'') applies
also to dispatching functions (conversely dispatching procedures).

This rule can be given once for each of check, search, and count for
each subrule and each kind of entity. This way, it is possible to have
a level considered a warning (search), and one considered an error
(check).

Ex:
@example
-- Callable entities should preferably not have more than 5
-- parameters, and in any case not have more that 10 parameters,
check  parameter_declarations (all_parameters, max 10);
search parameter_declarations (all_parameters, max 5);

-- All functions must have parameters and no out or in out
-- parameters (allowed in Ada 2012):
check parameter_declarations (all_parameters,    min 1, function);
check parameter_declarations (out_parameters,    max 0, function);
check parameter_declarations (in_out_parameters, max 0, function);

-- A regular (not protected) procedure with one out parameter
-- should be replaced by a function
check parameter_declarations (single_out_parameter, procedure);

-- Find all callable entities with class-wide parameters:
search parameter_declarations (class_wide_parameters, max 0);

-- Dispatching operations may have only one parameter of a tagged type:
check parameter_declarations (tagged_parameter,
                              max 1,
                              dispatching_function,
                              dispatching_procedure);
@end example

@subsection Tips
This rule applies to generic subprograms as well as to regular ones.
On the other hand, it does not apply to generic formal subprograms,
since instantiations would only be possible with subprograms which
are supposed to have been already controlled.

Instantiations are also controlled; the number of parameters is taken
from the corresponding generic.

Note that this rule controls only ``regular'' parameters, not generic
formal parameters.

Note that dispatching operations have necessarily at least one tagged
parameter, although a ``max 0'' could be specified in the example
above. If you do this, all declarations of dispatching subprograms
will be controlled. Maybe that's what you want...

@node Positional_Associations, Potentially_Blocking_Operations, Parameter_Declarations, Rules reference
@section Positional_Associations
This rule controls the use of positional associations (as opposed to
named associations) in all kinds of associations.

@subsection Syntax
@example
<control_kind> positional_associations [(<subrule>, <max_allowed>
                                         [, <category> @{, <entity>@}])];
<subrule>  ::= all | all_positional | same_type
<category> ::=  [not_operator] call | pragma          | discriminant     |
                instantiation       | array_aggregate | record_aggregate |
                enumeration_representation
@end example

@subsection Action
The rule controls pragmas, discriminants, calls, aggregates, or
instantiations that use too many positional associations. The
definition of ``too many'' depends on the subrule:
@itemize
@item
``all'': when positional associations are given in a place where there
is more than <max_allowed> associations (both positional and named).
@item
``all_positional'': when there is more than <max_allowed> positional
associations.
@item
``same_type'': when more than <max_allowed> positional parameters are
of the same type.
@end itemize

In addition, a <category> can be specified to restrict the rule to
specific kinds of associations; if not specified, all associations are
controlled. The categories carry their obvious meaning, with the
distinction that ``array_aggregate'' applies only to ``true'' array
aggregates, while ``enumeration_representation'' applies to the
special array aggregate used in enumeration representation
clauses. Note that the ``same_type'' subrule is not allowed for the
``pragma'' category. For ``pragma'', ''call'', and ``instantiation'',
entities can also be specified; such entities are exempted from the
rule (i.e. the rule will not control these entities). See examples
below.

For calls, positional association is @i{not} reported for operators
that use infix notation (since named notation is not possible); in
addition, if the ``not_operator'' modifier is specified before the
``call'' keyword (not allowed elsewhere), positional association is
never reported for operators, even if they are called with the syntax
of a normal function call (i.e. @code{Pack."+" (A,B)}).  Calls to
subprograms that are attributes are not reported either, since named
notation is not allowed for them.

This rule can be specified once for each combination of <subrule>,
<category>, and <control_kind>.  This way, it is possible to have a
number of positional associations considered a warning (search),  and
one considered an error (check). Of course, this makes sense only if
<max_allowed> for search is greater than the one for check. It is also
possible to have different criteria for each category.

If no parameter is given, it is equivalent to
``@code{positional_associations (all, 0)}'', i.e. all positional
associations are controlled.

Ex:
@example
 -- All positional associations:
check positional_associations;

-- All positional associations in aggregates:
check positional_associations(all, 0, array_aggregate);
check positional_associations(all, 0, record_aggregate);

 -- All positional associations with more than 3 elements:
search positional_associations (all, 3);

-- Positional associations in calls with more than 3 params of the same type
search positional_associations (same_type, 3, call);

-- Positional associations in calls with more than 2 elements (except
-- calls to any subprogram called Put)
search positional_associations(all, 2, call, all put);
@end example

@subsection Tips
There are two kinds of calls where the rule does not complain about
usage of positional association: infix operator calls (since requiring
named notation would not allow infix notation any more), and calls to
subprograms that are attributes (since named notation is not allowed
for these).

For the purpose of the ``same_type'' subrule, integer literals are
considered of the same type as any parameter of an integer type, and
similarly for other universal values. The reason is that this rule is
intended to avoid confusion between parameters, when strong typing
would not detect an inversion of parameters for example; such a case
would happen between parameters of a universal type.

For calls, another rule controls positional associations according to
the value of parameters rather than their number:
@xref{Insufficient_Parameters}.

@node  Potentially_Blocking_Operations, Pragmas, Positional_Associations, Rules reference
@section Potentially_Blocking_Operations
This rule controls usage of potentially blocking operations (as
defined in LRM 9.5.1 (8..16)) from within protected operations.

@subsection Syntax
@example
<control_kind> potentially_blocking_operations;
@end example

@subsection Action
The rule follows the call graph, starting from every protected
operation, and identifies all (direct and indirect) potentially
blocking operations encountered. All protected types in the program
are controlled.

Of course, calls to standard subprograms (notably IOs) that are
defined to be potentially blocking are recognized.

Ex:
@example
check potentially_blocking_operation;
@end example

@subsection Tips
This rule is very clever at finding potentially blocking operations
resulting from external calls (or requeues) to the current protected
object, even if this happens through a long chain of subprogram
calls. Typically, this happens when a protected operation calls a
subprogram, which in turn makes a call to an operation of the same
protected object. Such calls generally result in dead-locks.

Therefore, it is advisable to run this rule on any program that
exhibits mysterious (and hard to find) deadlocks that seem to involve
protected objects.

When a single protected object is being analyzed, the rule will
diagnose a circularity if there is a call to an operation of the same
object in the call chain; however, if a protected type is being
analyzed, the rule will diagnose a circularity if there is a call to
any object of the same type in the call chain. Although it is possible
to construct examples of this latter case where there is no risk of
deadlock, it is so contrieved that it certainly deserves being looked
at. But since the call is not 100% certain to be potentially blocking,
the message will tell ``possible external call'' instead of ``external
call'' in this case.

@subsection Limitation
There is one case defined in LRM E.4(17) which is not recognized:
remote subprograms calls.

Calls through pointers to subprograms and dispatching calls are
unknown statically; they are assumed to be non potentially
blocking. Such calls are detected by the rule
``uncheckable''. @xref{Uncheckable}.

@node Pragmas, Record_Declarations, Potentially_Blocking_Operations, Rules reference
@section Pragmas
This rule controls usage of one or several specific pragmas.

@subsection Syntax
@example
<control_kind> pragmas (<pragma spec> @{, <pragma spec>@});
<pragma spec> ::= [multiple] all|nonstandard|<pragma name>