Version 1.21r3 of July 10th, 2019
AdaControl is a free (GMGPL) tool that detects the use of various kinds of constructs in Ada programs. Its first goal is to control proper usage of style or programming rules, but it can also be used as a powerful tool to search for use (or non-use) of various forms of programming styles or design patterns. Searched elements range from very simple, like the occurrence of certaine entities, declarations, or statements, to very sophisticated, like verifying that certain programming patterns are being obeyed..
Which elements or constructs are searched is defined by a set of rules; the following table gives a short summary of the 71 rules currently checked by AdaControl. The number in parentheses after the rule name gives the number of subrules, if any. Considering all possible rules and subrules, this makes 579 tests that can be performed currently by AdaControl!
|Abnormal_Function_Return||Controls a design pattern that ensures that a function always returns a result .|
|Actual_Parameters (x4)||Controls properties of actual parameters of calls and instantiations, like use (or not) of the default value or of certain entities.|
|Allocators||Controls ocurrences of allocators, either all of them, or those targeting specified types.|
|Array_Declarations (x6)||Controls several metrics in array declarations and types
used as indices
|Aspects (x3)||Controls aspect specifications (Ada 2012)
|Assignments (x5)||Controls issues related to assignments, like array sliding, access values duplication, multiple assignments to a same variable, or assignments to components of a structured variable that could be replaced by aggregate assignment.|
|Barrier_Expressions||Controls elements allowed in the expression of protected entries barriers|
|Case_Statement (x5)||Controls several metrics in case statements.|
|Characters (x4)||Controls occurrences of control characters (like tabs) in the source.|
|Comments (x4)||Controls the content or placement of certain comments.|
|Declarations (x167)||Controls occurrences of certain Ada declarations.|
|Dependencies (x7)||Controls dependencies of units, either according to a set of allowed units, or by count.|
|Derivations (x4)||Controls properties of declarations and primitive operations of derived types: type and number of ancestors, presence of overriding indicators.|
|Directly_Accessed_Globals||Controls a design pattern that ensures that all global variables are accessed only through dedicated subprograms.|
|Duplicate_Initialization_Calls||Controls design patterns that prevent double initialization of packages or variables.|
|Entities||Controls occurrences of any Ada entity.|
|Entity_Inside_Exception||Controls occurrences of entities inside exception handlers.|
|Exception_Propagation (x5)||Controls that certain subprograms (or tasks) cannot propagate exceptions, that no elaboration can propagate exceptions, or that an exception cannot propagate outside its scope of declaration.|
|Expressions (x58)||Controls usage of certain forms of expressions|
where the same element corresponds to several formal
||Controls unsynchronized accesses to global variables.|
|Header_Comments (x2)||Controls the presence of comments at the start of each module.|
|Improper_Initialization (x3)||Controls a design pattern that ensures that any variable is initialized before being used, and is not uselesly initialized.|
|Instantiations||Controls generic instantiations, either all of them, or those that use specified entities.|
|Insufficient_Parameters||Controls the use of positional parameters in calls where the value dœs not provide sufficient information.|
||Controls the use of access
values that designate non global entities.
|Local_Hiding (x2)||Controls occurrences of local identifiers that hide an identical outer one.|
|Max_Blank_Lines||Controls the occurrence of more than a specified number of consecutive empty lines.|
|Max_Call_Depth||Controls the maximum depth of subprogram calls.|
|Max_Expression_Items||Controls the maximum complexity of expressions.|
|Max_Line_Length||Controls maximal length of source lines.|
||Controls scopes nested more deeply than a given limit.|
|Max_Primitives (x2)||Controls the number of primitive operations of (tagged or untagged) types.|
|Max_Size (x20)||Controls maximum length of composite statements and compilation units.|
|Max_Statement_Nesting (x5)||Controls composite statements nested more deeply than a given limit.|
|Movable_Accept_Statements||Controls statements that could be moved outside an accept statement.|
|Naming_Convention||Controls the form of allowed (or forbidden) names in declarations.|
|No_Operator_Usage||Controls integer types where no operator, or only logical operators, are used.|
|Non_Static (x6)||Controls non static expressions in index or discriminant constraints, or in instantiations.|
|Not_Elaboration_Calls||Controls subprogram calls performed from places outside package elaboration code.|
|Not_Selected_Name||Controls that certain entities are always named using selected notation.|
|Object_Declarations (x5)||Controls various parameters of object declarations (constants and variables).|
|Parameter_Aliasing||Controls subprograms and entry calls where a variable is provided to more than one [in] out parameter.|
|Parameter_Declarations (x9)||Controls characteristics of parameters in callable entities (procedures, functions and entries)|
||Controls positional associations (as opposed to named associations).|
|Potentially_Blocking_Operations||Controls the use of potentially blocking operations from within protected operations.|
|Pragmas||Controls the use of specific pragmas.|
|Record_Declarations||Controls various aspects of the components of a record type.|
|Reduceable_Scope (x11)||Controls declarations that could be move to more deeply nested scopes.|
|Representation_Clauses (x12)||Controls occurrences of representation clauses.|
|Return_Statements (x3)||Controls various metrics related to the use of return statements, like number of statements or nesting depth.|
|Return_Type (x9)||Controls the use of certain kinds of types as return types of functions.|
|Side_Effect_Parameters||Controls subprogram calls and generic instantiations that call functions with side effect, thus creating a dependance to the order of evaluation.|
|Silent_Exceptions||Controls exception handlers that do not reraise exceptions nor call indicated subprograms.|
|Simplifiable_Expressions (x8)||Controls occurrences of various forms of expressions that could be simplified.|
|Simplifiable_Statements (x15)||Controls occurrences of various forms of statements that could be simplified.|
|Statements (x78)||Controls occurrences of Ada statements.|
|Style (x17)||Controls various forms of constructs generally recommended in style rules.|
|Terminating_Tasks||Controls a design pattern that ensures that tasks never terminate.|
|Type_Initial_Values||Controls that every declared type features an associated initialization constant.|
||Controls use of types or type categories at various places.|
|Uncheckable (x3)||Controls constructs that are not statically checkable by other rules|
||Controls usage patterns of program units and elements declared in them.|
|Units (x2)||Controls that all required units are analyzed, and only those.|
|Unnecessary_Use_Clause (x6)||Controls use clauses on packages, where no element of the package is referred to within the scope of the use clause.|
|Unsafe_Elaboration||Controsl packages that may be subject to incorrect elaboration order dependencies.|
|Unsafe_Paired_Calls||Controls a design pattern that ensures that certain calls are allways paired (like P/V procedures).|
|Unsafe_Unchecked_Conversion||Controls instantiations of Unchecked_Conversion between types of different or unspecified sizes.|
|Usage (x14)||Controls usage of objects under certain conditions (in package specifications, read, written modified...).|
|Use_Clauses (x9)||Controls occurrences of use clauses, except for indicated packages.|
|With_Clauses (x7)||Controls proper usage of with clauses.|
For more details on these rules, or on the use of AdaControl in general, please refer to the user's guide.
AdaControl is a command line tool, but it has been fully integrated into AdaCore's GPS environment. From GPS, you can run AdaControl, fix the violations, or edit the rules file with just a few clicks.
AdaControl can now help you fix violations: under GPS, just click on the little wrench icon, just like with compiler messages.
You can also fix all violations at once from a menu command. And a new command line utility is provided to fix all fixable violations automatically!
But AdaControl is more than a set of coding rules: it is a complete environment, designed to be easily extended. If your favorite rule is not provided, you can add it yourself! And of course, we will continue to extend the number of rules in the future. If you want to look into how this is possible, please refer to the AdaControl programmer guide.
Initial development of AdaControl was sponsored by Eurocontrol. Some rules were sponsored by BelgoControl, Alstom-Transport, Ansaldo-STS (prev. CSEE-Transport), and SAGEM-DS. It is a mature tool, routinely used to check Ada codes at Eurocontrol (Brussels, more than 2_000_000 SLOC, Maastricht), BelgoControl, Alstom, Ansaldo-STS, Faiveley, SAGEM-DS (level DO178B/A)... It has also been run against all executable tests from the ACATS.
AdaControl is an ASIS application.
AdaControl is a free tool under GMGPL license. Nonetheless, it is a commercial product from Adalog, for which we offer a support and maintenance contract. We offer also services for the development of rules for your specific needs, or more generally assistance for the definition and usage of programming rules. For information, please contact firstname.lastname@example.org.
AdaControl, like any ASIS application, can run only if compiled with the exact same version of the compiler that it uses itself when executing. It is therefore provided as executable only for GNAT GPL/2017 (Windows and Linux); for use with any other version of GNAT, please download the source version and recompile (which is quite easy to do, provided ASIS has been installed). It has been tested only with GNAT, but should be easily portable to any other compiler that provides an ASIS interface.
The ZIP or TGZ versions allow you to install AdaControl as you please; under Windows, the installers install everything automatically - provided the <GNAT>\bin directory is on your execution path.
|Windows Gnat Community 2019||Linux Gnat Community 2019||MacOS|
(1.21r3 is not yet available,
download 1.19r10 instead)
WARNING: An incompatibility was introduced in the ASIS interface for Ada 2005/2012, which was necessary to properly handle some of the new features. The source distribution of AdaControl requires at least GnatPro-7.2.0 or GnatGPL 2013. If you want to use an earlier version of Gnat, please dowload a source version from SourceForge (cf. below), using branch "master-old_gnat" for versions up to GnatPro-7.0.x and GnatGPL2011, and branch "GPL2012" for GnatPro-7.1.x and GnatGPL2012.
Below is a downloadable ZIP file that contains plug-ins for using AdaControl as a measuring tool under GnatHub (AdaCore) and allowing results analysis with GnatDashboard/SONARQube.
Installation and usage directives are part of AdaControl's User Guide
|GnatHub Integration||ZIP file
The current development version (unstable) is available (under GIT) from SourceForge. You can also find there intermediate versions between official releases that may be appropriate to certain versions of Gnat and even provide you own rating of AdaControl. You can submit bug reports, suggest improvements, etc. by clicking on "Ticket" on the SourceForge page or clicking on this direct link.
Support and maintenance contract
Adalog provides commercial support for AdaControl. Support includes the following services:
- Help with installation procedures.
- Explanations regarding the use of the tool, and help for translating coding standards into AdaControl rules.
- Priority handling of tickets reported through our BT system.
- Correction of problems encountered in the use of AdaControl. Pre-releases versions of AdaControl are provided for each corrected problem.
- Access to beta-versions before they are released.
- Keeping in sync customer's own custom rules with the latest version of AdaControl.
- Reduced rate for on-demand development of custom rules.
- 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.
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 help reporting such problems to the compiler vendor, and to find workarounds until the problem is fixed.
For pricing information or any question about AdaControl, please write to: email@example.com
Customization of AdaControl
AdaControl can be customized with special rules according to clients needs. For example:
- Business rules
- Rules to enforce coding practices required by hardware
- Special rules due to certification constraints
Adalog has developped custom versions of AdaControl for various clients. If you have any special need related to controlling your software, please get in touch with us by writing to firstname.lastname@example.org.
Publications about AdaControl
A number of papers have been published about AdaControl or its usage for various verification tasks:
- Jean-Pierre Rosen: "On the benefits for industrials of sponsoring free software development", Ada User Journal, Volume 26, number 4, december 2005
- Jean-Pierre Rosen: "A Comparison of Industrial Coding Rules", Ada User Journal, Volume 29, number 4, december 2008
- Jean-Pierre Rosen: "A Methodology for Avoiding Known Compiler Problems Using Static Analysis", proceedings of the ACM SIGAda Annual International Conference (SIGAda 2010)
- Jacob Sparre Andersen: "Introducing static analysis to a mature project", Proceedings of the 22nd Ada-Europe International Conference on Reliable Software Technologies - Ada-Europe 2017, Vienna, Austria, 12-16 June 2017.
This article has been translated to Serbo-Croatian language by Jovana Milutinovich from Web Geeks Resources.