version 1.14r9 of August 29th, 2012
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 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 421 tests that can be performed currently by AdaControl!
|Abnormal_Function_Return||Controls a design pattern that ensures that a function always returns a result .|
|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
|Barrier_Expressions||Controls elements allowed in the expression of protected entries barriers|
|Case_Statement (x4)||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 (x142)||Controls occurrences of certain Ada declarations.|
|Default_Parameter||Controls subprogram calls and generic instantiations that use (or not) the default value for a given parameter.|
|Dependencies (x4)||Controls dependencies of units, either according to a set of allowed units, or by count.|
|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 (x28)||Controls usage of certain forms of expressions|
||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 does 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_Line_Length||Controls maximal length of source lines.|
|Max_Nesting||Controls scopes nested more deeply than a given limit.|
|Max_Size (x10)||Controls maximum length of composite statements.|
|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.|
|Multiple_Assignments (x2)||Controls multiple assignments to a same variable, or to components of a structured variable that could be replaced by aggregate assignment..|
|Naming_Convention||Controls the form of allowed (or forbidden) names in declarations.|
|No_Operator_Usage (x2)||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 (x3)||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 (x4)||Controls characteristics of parameters in callable entities (procedures, functions and entries)|
|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 (x9)||Controls declarations that could be move to more deeply nested scopes.|
|Representation_Clauses (x10)||Controls occurrences of representation clauses.|
|Return_Type (x8)||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 (x7)||Controls occurrences of various forms of expressions that could be simplified.|
|Simplifiable_Statements (x10)||Controls occurrences of various forms of statements that could be simplified.|
|Statements (x61)||Controls occurrences of Ada statements.|
|Style (x15)||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.|
|Uncheckable (x3)||Controls constructs that are not statically checkable by other rules|
|Units (x2)||Controls that all required units are analyzed, and only those.|
|Unnecessary_Use_Clause (x5)||Controls use clauses on packages, where no element of the package is referred to within the scope of the use clause.|
|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 (x11)||Controls usage of objects under certain conditions (in package specifications, read, written modified...).|
|Use_Clauses (x2)||Controls occurrences of use clauses, except for indicated packages.|
|With_Clauses (x3)||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 guide below.
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.
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, Ansaldo-STS (prev. CSEE-Transport) and SAGEM-DS. It is a mature tool, routinely used to check Ada codes at Eurocontrol (Brussels, more than 1_100_000 SLOC, Maastricht), BelgoControl, 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 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/2012 (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.
incompatibility was introduced in the
ASIS interface for Ada 2005/2012, which was necessary to properly
handle some of the new features. This changed was incorporated in Gnat
versions GnatPRO 7.1.0 and GPL-2012. The source distribution of
AdaControl is therefore provided in two flavors, "old Gnat'' for
previous versions, and "new Gnat''
for these versions and more recent ones.
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 GPL 2012
Linux Gnat GPL 2012
The current development version (unstable) is available (under GIT) from SourceForge. Through this page, you can also submit bug reports (Hosted Apps/MantisBT), and even provide you own rating of AdaControl.
|Return to home page||The text of this page is available for modification and reuse under the terms of the Creative Commons Attribution-Sharealike 3.0 Unported License and the GNU Free Documentation License (unversioned, with no invariant sections, front-cover texts, or back-cover texts).||This article has been translated to Serbo-Croatian language by Jovana Milutinovich from Web Geeks Resources.
Audience metered by Weborama