Technical Specification
The Ada Analyzer is a set of support tools that
can scan large amounts of Ada code, locating items of interest and cataloging
information for developers, managers, quality-assurance personnel, and
integration and testing personnel. The key benefits of these tools are:
-
Items of interest can be located much more rapidly than with manual search,
especially when large amounts of code are involved.
-
The precision of item selection is greater than with textual searching
methods because it is based on semantic information collected by the compiler.
This precision can focus analysis on only those items that are important
for the immediate analysis objective.
-
Certain semantic information (dependencies and other construct interrelationships)
is not easily obtained through other means.
The Ada Analyzer traverses any set of compiled Ada
units (either Ada 83 or Ada 95), locates constructs that match specific
selection criteria, and places relevant information about those constructs
in a hypertable object. Hypertables contain not only textual information
about each construct located, but also traversal connections to the actual
Ada source from which the information was derived. Users thus can scan
the summary information for interesting items and then traverse to the
actual software for additional detailed analysis. Sorting options and additional
filtering switches are available to organize information into the optimal
format for analysis.
The Ada Analyzer does not attempt to rate software
with numbers or judge construct usage as good or bad. Instead, it collects
overview information so that analysts can better understand the content
of their software and make decisions about possible improvements. It provides
insight rather than value judgment. The resulting tables can be included
in documentation, printed and distributed to developers or managers for
reference, or used interactively to visit software constructs for further
inspection or repair.
The following diagram illustrates how the Ada
Analyzer facilitates interactive analysis.
Supported Analysis Objectives
The Ada Analyzer supports specific analysis objectives.
For example, if the objective is to improve execution speed and reduce
code size, a set of recommended analysis procedures is available with insight
into how the output can be used to achieve specific improvements. The tools
support the following analysis objectives:
-
Design and structure: The tools illuminate how a software system is designed
and structured. Analysis includes packaging, data typing and object declaration,
subprogram interfaces, and dependency analysis on all items. This analysis
can often suggest restructuring opportunities, identify redundancy and
obsolete items, and locate inconsistencies across the software.
-
Code correctness: The tools locate areas in the code that have a higher
likelihood of error, bringing the possibility for error to the attention
of the developer or tester.
-
Code efficiency: The tools locate constructs that generally have a high
impact on code size and run-time speed. This coupled with a good understanding
of the cross-compilation tools can rapidly identify opportunities for improvement.
-
Conformance to programming standards and readability: The tools locate
items that violate generally accepted programming and readability criteria
or check for program consistency in naming and interface definition.
-
Portability and compatibility: The tools locate constructs that generally
are not portable or are implementation-dependent. This extends semantic
checking to better match the characteristics of the target compiler.
-
Software content: The tools locate and count construct usage at various
levels of detail from the very high level to the very specific analysis
of low-level constructs.
Each of these objectives will be explained in more
detail with specific selection criteria later in this document.
Usage Scenarios
The Ada Analyzer can be used throughout the development
lifecycle by a variety of project personnel, each having different analysis
objectives.
-
Development managers can monitor the growing content of the project software
at regular intervals to judge project status, better project milestone
completion, and adjust resource allocation. Testing and integration requirements
can be estimated based on the size and complexity of project subsystems.
-
Senior designers can validate that their program structure remains consistent
as development proceeds. Design guidelines to ensure consistent use of
Ada constructs and naming can be validated. Use of data typing can be monitored
to ensure that types are used as designed and that redundancy does not
creep in with local development efforts. Critical structures such as tasking
can be located and their rendezvousing relationships analyzed. Candidates
for reuse or generic interfaces can be located, which aids iterative-development
methods.
-
Developers can check their software against project-development guidelines
and ensure that their software is compatible with the target compiler and
ready for integration release. Redundant or unused constructs that result
in any aggressive development effort can be identified and eliminated before
software is released internally for review. Aspects of code correctness
can be checked and software speed and memory utilization can be improved
in the later parts of the development cycle.
-
Test and integration personnel can use the tools to get an overview of
the contents of software that they in many cases did not develop. Branching
analysis and sub-program usage of local and global data can assist in the
development of unit- and system-level tests. When problems are isolated
to a particular Ada construct or usage pattern, the tools can be used to
rapidly locate all instances of this pattern.
-
Quality-assurance and configuration-management personnel can validate project
standards and use output from the tools as a first pass to any code-review
process. Various analysis tools can be packaged together to form a QA suite
that can be executed before any customer release is made.
-
Technical Writers can incorporate Ada Analyzer reports into appendixes
to document code content and relationships. This information is often required
by the customer.
Customization
An important aspect of the Ada Analyzer is it is
easily modifiable to support local requirements. Local development specifications
and cross-compilation tools often make it necessary to build custom analysis
tools that better match local needs. Several templates are available to
make building new locator tools, standards conformance checks, and metrics
as simple as possible. The templates handle all traversal, sorting, and
table building. The user must define only which Ada constructs should be
included and what information for that element should appear in the hypertable
output. An extensive library of utilities is available to assist in this
process. For all but the most complicated requirements, this process will
take approximately one day to develop and test.
Delivered Software
All software for the Ada Analyzer is included with
each release. Ada interfaces are annotated with descriptions of the purpose
and use of each interface, the testing performed on the interface, and
additional keywords to help in cross-referencing. Parameter explanations
have been added where necessary as well as a list of all exceptions raised
by each subprogram. Implementation software (bodies) are commented with
effective information about implementation strategy and approach. Almost
all packages have corresponding test procedures that generate consistent
reports on the success or failure of the test criteria. Test programs not
only verify tool correct-ness but also serve as an example of use and expected
output.
The software will be delivered in two layers.
The utilities (lower) layer will be delivered in code-only form with Ada
specifications; the analysis layer will be delivered in source form to
facilitate local customizations and extensions.
Documentation
In addition to annotated software, a complete Ada
Analyzer User's Guide is available both as hard copy and on-line This
document provides a tutorial on the general use of all tools and hypertable
output. It describes each analysis objective and explains which tools can
be used effectively to accomplish each objective. The content of all hypertable
output is fully explained with information on how to interpret it to achieve
the objective. An extensive cross-reference section and index are included
to enable users to find tools when they have specific analysis requirements
in mind.
A separate section of this document describes
in detail how to customize existing analysis tools or build new ones. It
provides a step-by-step method for each process. Some sorting, filtering,
and information content can be adjusted by policy switches contained in
files. An explanation of all options and the editing of these policy switches
and files is provided.
Ada 95 Support
The Ada Analyzer can analyze code compiled either
with the Apex Ada83 or Ada 85 compilers. All commands recognize Ada 95
constructs and incorporate them into report output when appropriate. In
particular, the following commands specifically address Ada95 constructs.
-
The Locate_Aliasing command will .i.software content:Locate_Aliasing;.i.locating:aliasing;.i.aliased
variables;locate use of aliased variables and constants and use of the
åAccess attribute.The use of aliasing can be risky if not performed
with case. This command can be used to locate all uses of aliasing for
inspection.
-
The Locate_Class_Hierachies command will locate
all tagged types and those types that are derived from tagged types. These
types typically form interrelated libraries of classes. Types can be displayed
either in hierarchical or flat format with cross references. Both explicit
and inherited methods can be displayed along with all components that are
also class types. This command may be most useful for creating data-dictionary
information for internal project use or delivery to the customer.
Detailed Analysis Descriptions
Software quality can be measured in many dimensions,
including correctness, efficiency, portability, maintainability, readability,
and adherence to development standards. Soft-ware quality can be evaluated
to determine its status or *goodness? measured against specific criteria
or it can be analyzed with the objective of locating areas for improvement.
Both objectives are supported by the Ada Analyzer tools, but much greater
emphasis is placed on the analysis objectives. The following sections provide
details on how the analysis objectives listed above can be achieved.
Design and Structure
The high-level structure of a program is often difficult
to see when looking through each individual package. Graphical representations
of software are extremely effective when the number of structures is small,
but they often are not effective in representing large programs with many
individual items and relationships. The following analysis objectives are
supported by the tools. Output from these tools offers additional help
in understanding the design structure of a program.
-
Understanding packaging and with dependencies
-
Determining compilation closure and compilation
order
-
Identifying subunits and subunit candidates
-
Locating declaration distribution and dependencies
-
Comparing type declarations, usage, and the dependency
relationship between types
-
Analyzing object declarations and their sets and
uses
-
Locating usage of generics and their instantiations
-
Determining a main-program call tree
-
Determining exceptions that can be propagated from
each subprogram
-
Finding program branch points (execution-path analysis)
-
Locating of elaboration code
Code Correctness
Code correctness clearly is one of the most important
goals in programming. Since programs often are very complicated, it is
all but impossible to avoid making programming mistakes. Although it is
equally impossible to judge whether a program construct is correct, constructs
with a high likelihood for error can be located for further inspection.
The following locator tools can be used to find potential problems with
code correctness:
-
Use before set of variables
-
Use of parameter defaults and other clauses
-
Complicated expressions, especially for array indexing
-
Exception raising, propagation, and handling
-
Highly nested programs
-
Divide-by-zero potential
-
Use of System.Address
-
Use of unchecked conversion (size matching, etc.)
-
Use of literals with inappropriate constraints
Code Efficiency
Software efficiency certainly is negatively affected
by the selection of inappropriate implementation algorithms. Such problems
are identified most effectively through code reviews and are difficult
to detect statically with tools. It is possible, however, to identify constructs
that either generate large amounts of code or execute more slowly. Often
it is also possible to locate redundancy in software as well as places
where compiler directives such as pragma Inline or pragma Pack would positively
or negatively affect software efficiency. Many efficiency issues are related
directly to the cross-compiler's ability to generate efficient code for
the target. When areas of compiler inefficiency are identified, Ada constructs
that affect the resulting efficiency of the software also can be identified.
-
Inline candidates using subprogram size and use
as criteria
-
Reference to parameters and global objects by subprograms
-
Use of dynamic allocation (access type and allocators)
-
Redundant expressions
-
Operator selection
-
Loop nesting (also across subprogram calls)
-
Type nesting and use of unconstrained types
-
Automatic type initialization vs. local initialization
-
Object size (measured for target)
-
Constant usage
Location of any kind of declaration, statement,
or expression (If the compiler has difficulty with specific constructs,
all usages can be quickly located and checked with the generated assembly
code).
Conformance to Programming Standards and Readability
Almost every project has a set of programming guidelines
if only to try to achieve some consistency across the software. Sometimes
these criteria are a fairly strict set of rules that must not be violated
without explanation. Tools can be used to locate violations of these standards.
Specific readability analysis is also provided.
-
Dangerous constructs (abort, goto, etc.)
-
Use of use clauses
-
Naming selection (sorted by kind of declaration)
-
Consistent renaming
See the sections titled "Standards Conformance Libraries"
at the end of this document for a complete list of all checks.
Portability and Compatibility
Software developed on the Rational Environment is
almost always cross-compiled for another target. Maintaining software that
is compatible with the target-dependent-feature support of the cross-compiler
can be performed in part with semantic checking built into the compiler.
Most projects have more stringent portability requirements than can be
checked with compiler tools, however. Additional compatibility checking
can be performed with the following tools:
-
Use of predefined types
-
Checking of representation specifications
-
Use of duplicate unit names
-
Use of Rational-specific interfaces
-
Existence of prompts
-
Ada 95 compatibility
One key benefit of this analysis is the identification
of software incompatibilities before the effort is made to download and
compile the software on the target.
Software Content
These tools offer no particular objective but can
be used to support any of the above analysis objectives:
-
Construct counting and location (locates the use
of any specific Ada construct)
-
Line counting
-
McCabe and execution path metrics
-
Detailed construct analysis for:
-
Tasking
-
Generics
-
Subprogram data reference
-
Exceptions
-
Types
-
Annotations
Summary
-
The Ada Analyzer allows users to analyze software
rapidly from a variety of perspectives to better understand the content
of their software systems. During development and maintenance phases of
the software lifecycle, the tools can continually summarize expanding interfaces
and use of key constructs, and they can gauge progress toward completion.
Projects in the later stages of development can use the tools to reduce
code size and improve execution speed. Testers can better understand the
relationship between the software modules and benefit from call-tree and
subprogram-path (branching) analysis. Maintenance projects can use similar
features to get a quick over-view of the software they are asked to update.
Finally, the Ada Analyzer tools can assist developers and QA personnel
in assessing the quality of Ada software or its conformance to required
standards
Sample Output
-
The following screen images provide two examples
of output tables generated by the Ada Analyzer. The first example displays
a hypertable containing Ada with clauses that are not used or are used
incorrectly in the analyzed software. The first two columns contain the
name of the subsystem and library unit in which the problem occurs. The
third column contains the name of the unit withed by the suspect with clause,
and the fourth column contains a description of the problem. Four different
kinds of potential problems are recognized:
-
unused with clauses
-
with clauses in specs that could be moved to the
body because they are only used there and not in the spec
-
with clauses that are necessary only to compile
an Ada use or renaming clause
-
with clauses that are redundant because they are
repeated in the code Pressing [Visit] on an entry in this table would traverse
and highlight the suspect
-
Table 1 - Unused and Misplaced "with" Clauses
Unit
|
Unused "with"
|
Status
|
Unused_With_Clauses'B |
Representation_Clauses |
Unused |
Unused_With_Clauses'S |
Ada_Program |
Movable to body |
Unused_With_Clauses'S |
Compilation_Units |
Used only for use/rena| |
Unused_With_Clauses'S |
Names_And_Expressions |
Unused |
Unused_With_Clauses'S |
Type_Information |
Repeat "with" |
Unused_With_Clauses'S |
Type_Information |
Used only for use/rena| |
Unused_With_Clauses.Subun| |
Declarations |
Repeat "with" |
Unused_With_Clauses.Subun| |
Declarations |
Unused |
Unused_With_Clauses.Subun| |
What |
Repeat "with" |
-
-
The next sample output collects all exception declarations,
handlers, and raise statements into a single hypertable. The first two
columns contain the name of the exception and kind of use. The third column
specifies whether the exception appears in a visible specification. The
table columns are sorted to highlight which handlers and raise statements
exist for each exception declaration and where these constructs are located.
Declarations without handlers and/or raise statements might indicate a
potential problem. Use of predefined exceptions or anonymous raises also
may be of interest as well as raises via the Ada 95 Ada.Exceptions.Raise_Exception
interface.
-
-
Table 1 - Exception Declarations, Handlers, and
Raise Statements
Exception
|
This Usage
|
Context
|
Unit
|
ANONYMOUS< |
Raise |
Proc body |
Some_Exceptions'B |
Except1 |
Decl |
Pkg spec |
Some_Exceptions'S |
Except1 |
Handler |
Proc body |
Some_Exceptions'B |
Except1 |
Raise |
Proc body |
Some_Exceptions'B |
Except2 |
Decl |
Pkg spec |
Some_Exceptions'S |
Except2 |
Handler |
Proc body |
Some_Exceptions'B |
Except2 |
Raise |
Proc body |
Some_Exceptions'B |
Except4 |
Decl |
Proc body |
Some_Exceptions'B |
Except4 |
Handler |
Proc body |
Some_Exceptions'B |
Exception3 |
Decl |
Pkg spec |
Some_Exceptions'S |
Exception3 |
Handler |
Proc body |
Some_Exceptions'B |
Exception3 |
Rename |
Excep rename |
Some_Exceptions'S |
via Raise Exception |
Unknown raise |
Func body |
Ada95_Exceptions'B |
Ada Analyzer Commands
Code_Correctness
-
Display_Set_Use_Problems
-
Display_Subprogram_Execution-_Problems
-
Locate_Misspellings
-
Locate_Others_Clauses
-
Locate_Potential_Programming_Errors
-
Locate_Rep_Spec_Inconsistencies
-
Locate_Static_Constraint_Violations
-
Locate_System_Address_Usage
Design_And_System_Structure
-
Display_Expanded_Type_Structure
-
Display_Inter_Subsystem_References
-
Display_Subsystem_Import_Closure
-
Display_Unit_Relationships
-
Display_With_Closure
-
Locate_Exceptions
-
Locate_Calling_Relationships
-
Locate_Class_Hierarchies
-
Locate_External_Dependencies
-
Locate_Packages_With_State
-
Locate_Similar_Record_Structures
-
Locate_Subprogram_References
-
Locate_Subprograms_Propagating_Exceptions
-
Locate_Subunit_Candidates
-
Locate_Unused_Declarations
-
Locate_Unused_With_Clauses
Execution_Analysis
-
Display_Call_Tree
-
Display_Subprogram_Branch_Points
-
Locate_Calling_Thread_Sets_And_Uses
-
Locate_Data_Synchronization_Points
-
Locate_Elaboration_Impacts
-
Locate_Calling_Relationships
-
Locate_Subprograms_Propagating_Exceptions
-
Locate_Objects_Set_And_Used
-
Locate_Recursive_Subprograms
Metrics_Collection
-
Collect_Metrics
-
Compare_Metrics
-
Locate_Suprogram_Complexities
-
Count_Lines_Of_Code
Readability
-
Locate_Renames
-
Locate_Named_Declarations
-
Locate_Name_Anomalies
-
Locate_Use_Clauses
Report_Management
-
Compare_Reports
-
Merge_Reports
-
Separate_Reports_By_Subsystem
-
Collect_Statistics
Software_Complexity
-
Locate_Complex_Expressions
-
Locate_Generic_Complexities
-
Locate_Subprogram_Complexities
Software_Content
-
Count_Ada_Constructs
-
Generate_Listing
-
Locate_Aliasing
-
Locate_Annotations
-
Locate_Attributes
-
Locate_Constants
-
Locate_Elements_Constaining_Text
-
Locate_Exceptions
-
Locate_Expressions
-
Locate_Generics
-
Locate_Pragmas
-
Locate_Rep_Specs
-
Locate_Statements
-
Locate_Tasking
-
Locate_Type_Declarations
Software_Optimization
-
Display_Set_Twice_Before_Use
-
Locate_Default_Initialization
-
Locate_Expensive_Types
-
Locate_Generic_Formal_Dependencies
-
Locate_Inline_Candidates
-
Locate_Loop_Nesting
-
Locate_Objects_By_Size
-
Locate_Operators
-
Locate_Short_Circuit_Opportunities
Standards_Conformance
-
Locate_Coding_Violations
-
Locate_Coding_Violations_Interactively
-
Locate_Ada95_Coding_Violations
-
Locate_Named_Declarations
-
Locate_Obsolescent_Ada83_Features
-
Locate_Name_Anomalies
Standards Conformance and Compatibility Rule Libraries
-
This section lists all currently
supported rules for checking the conformance of Ada software to quality
standards and guidelines. These checks are grouped into four separate rule
libraries:
-
Software Productivity Consortium's
guidelines for Ada quality and style (Version 02.00.02)
-
Little Tree Consulting's software-quality
guidelines
-
Ada 95 rules (conformance of Ada
83 code to Ada 95 specifications)
-
Rational target compatibility rules
-
Software Productivity Consortium's Guidelines:
-
SPC 3.1.4.e: Use of abbreviations
not on an approved list.
-
SPC 3.2.6.j: Use of numeric literals
in nondeclarative parts of the program.
-
SPC 4.1.1.b: Use of library-level
subprograms that are not main programs.
-
SPC 4.1.1.c: Use of child units
is encouraged over subunits.
-
SPC 4.1.1.g: Use of private child
units is encouraged over nested packages.
-
SPC 4.1.4.b: Functions with side
effects (that is, that update variables outside their scope)
-
SPC 4.1.8.a: Variables declared
in the visible part of a package.
-
SPC 4.2.4.a: Tasks declared in
the visible part of a package.
-
SPC 4.3.1.c: Declaration of exceptions
in a nonvisible part of the program.
-
SPC 4.3.1.j: Raising of predefined
exceptions.
-
SPC 5.1.1.a: Nested loops that
are not named.
-
SPC 5.1.1.b: Nested loops that
are not named.
-
SPC 5.1.2.a: Nested blocks that
are not named.
-
SPC 5.1.3.a: Exit statements without
an explicitly named loop.
-
SPC 5.2.2.a: Missing named parameter
association in subprogram and entry calls.
-
SPC 5.2.4.b: Use the most restrictive
mode possible for parameters. A parameter that is only read should be mode
"in".
-
SPC 5.4.8.a: The use of modular
types when using bit-wise boolean operators is preferred for efficiency
reasons.
-
SPC 5.6.10.c: Missing named association
in record aggregates.
-
SPC 5.2.2.b: Missing named association
in generic instantiations.
-
SPC 5.2.3.b: Default parameters
that do not appear at the end of the parameter list.
-
SPC 5.2.4.a: Missing mode indication
on procedure and entry parameters.
-
SPC 5.3.1.b: Subtype declarations
with no range constraint.
-
SPC 5.3.1.d: Derived type declarations
with no range constraint.
-
SPC 5.3.2.a: Use of anonymous types.
-
SPC 5.4.5.h Absence of length clause
to specify total allocation size for access types.
-
SPC 5.4.5.i: Use of allocators
without an handler for Storage_Error in the local scope.
-
SPC 5.5.3.a: Fully parenthesized
expressions.
-
SPC 5.5.4.a: Use of the not operator.
-
SPC 5.5.5.a: Use of the or and
and operators instead of short-circuit forms.
-
SPC 5.5.6.a: Use of the relational
operators with real operands instead of <= and =.
-
SPC 5.6.3.a: Use of an others choice
in a case statement.
-
SPC 5.6.3.b: Use of an enumeration
literal range as a choice in a case statement.
-
SPC 5.6.4.d: Use of exit statements
in while and for loops.
-
SPC 5.6.4.e: Presence of more than
one exit point from a loop.
-
SPC 5.6.5.b: Use of bare exit statements
directly inside an if statement instead of exit when.
-
SPC 5.6.7.a: Use of goto statements.
-
SPC 5.6.8.a: Functions with more
than one return statement in the body; procedures containing any return
statements.
-
SPC 5.7.1.b: Use of any use clause
not on an approved list.
-
SPC 5.7.2.f: Use of unapproved
renames.
-
SPC 5.8.1.d: Explicit raising of
exceptions that are then caught in the local scope (that is, used as a
goto).
-
SPC 5.8.2.a: Use of when others
in an exception handler.
-
SPC 5.9.1.a: Use of Unchecked_Conversion.
-
SPC 5.9.2.a: Use of Unchecked_Deallocation.
-
SPC 5.9.3.a: Use of åUnchecked_Access
attribute.
-
SPC 5.9.4.a: Use of address clauses.
-
SPC 5.9.5.a: Use of pragma Suppress.
-
SPC 5.9.6.f: Use of functions declared
in the same context to initialize object declarations (elaboration).
-
SPC 5.9.9.a: Protected types should
not invoke blocking operations in their execution closure. Blocking operations
include select statements, accept statements, entry calls, delay statements,
abort statements, external calls to protected subprograms, or external
requeues.
-
SPC 6.1.5.a: Use of dynamically
allocated tasks.
-
SPC 6.1.7.b: Use of delay statements
instead of delay until.
-
SPC 6.2.3.a: Use of the attributes
'CALLABLE, 'TERMINATED, and 'COUNT.
-
SPC 6.2.4.c: References to non-local
variables in select guards should not be made since references will not
be synchronized.
-
SPC 6.2.5.a: Use of conditional
entry calls.
-
SPC 6.2.5.b: Use of selective waits
with else parts.
-
SPC 6.3.1.a: Absence of an exception
handler in the main loop of a task.
-
SPC 6.3.2.d: Absence of a terminate
alternative in select without an else part or a delay.
-
SPC 6.3.3.a: Use of the abort statement.
-
SPC 6.3.4.a: Existence of a when
others exception handler at the end of a task body.
-
SPC 7.1.4.a: Use of parameters
in main programs.
-
SPC 7.2.1.a: Use of predefined
numeric types in package Standard.
-
SPC 7.3.2.a: Comparison of access
to subprogram values to not guaranteed.
-
SPC 7.5.2.a: Exception handlers
that handle Numeric_Error but not Constraint_Error.
-
SPC 7.6.3.a: Use of machine code
inserts.
-
SPC 7.7.1.a: Use of the Form parameter
in Text_Io.
-
SPC 8.2.4.a: Use of subtypes as
type marks when declaring generic formal objects in out.
Little Tree Consulting's Software-Quality Guidelines:
For Rational Target Compatibility
-
LTC 101: Use of predefined types.
-
LTC 102: Use of external interfaces.
-
LTC 103: Use of prompts.
-
LTC 104: Use of duplicate unit
names.
-
LTC 105: Use of unknown pragmas.
-
LTC 106: Use of names reserved
by the target compiler.
-
LTC 107: Unchecked_Conversion size
mismatch.
-
LTC 108: Use of correct declaration
order when subprograms are inlined.
-
LTC 109: Use of non-predefined
language attributes.
-
LTC 110: Use of non-predefined
language pragmas.
For Code Correctness:
-
LTC 201: Potential for divide by
zero.
-
LTC 202: Use of 'ADDRESS on parameters
and locally declared objects.
-
LTC 203: Use of 'ADDRESS on constants.
-
LTC 204: Static violations of constraints.
-
LTC 205: Inconsistent representation
specifications.
-
LTC 206: Function paths with no
return or raise statement.
-
LTC 207: Exception handlers that
handle Numeric_Error but not Constraint_Error.
-
LTC 208: Operator rename of a different
designator.
-
LTC 209: Use of the relational
operators with real operands instead of <= and =.
-
LTC 210: Use of limited private
types that are not self-initializing.
-
LTC 211: Use of allocators without
a handler for Storage_Error in the local scope.
-
LTC 212: Absence of an exception
handler in the main loop of a task.
-
LTC 213: Use of functions in the
same context to initialize object declarations.
-
LTC 214: Use of subtypes as type
marks when declaring generic formal objects of type in out.
-
LTC 215: Use of null statements.
-
LTC 216: Use of the attributes
'CALLABLE, 'TERMINATED, and 'COUNT.
-
LTC 217: Use of attribute names
as record components.
-
LTC 218: Use of pragma Suppress.
-
LTC 219: Calls to non-local subprograms
in elaboration code.
-
LTC 220: In-out parameter inconsistencies,
that is parameters that are mark as in out but only used (should be in)
or set (should be out).
-
LTC 221: Use of potentially blocking
operations in protected operations.
-
LTC 222: Use of references to non-local
variables in select guards.
-
LTC 223: Missing "when others"
exception handler at the end of a task body
-
LTC 224: Comparison of access to
subprogram values.
-
LTC 225: Use of System.Address_To_Access_Conversions
-
LTC 226: Raising exceptions through
Ada.Exceptions.Raise_Exception.
-
LTC 227: External references made
in an elaboration block of a package must also have a pragma elaborate.
-
LTC 228: Variable declarations
without and initial value.
-
LTC 229: Use of when others exception
handler with a null body.
-
LTC 230: Instantiation of the predefined
packgages Direct_Io and Sequential_Io with access types.
-
LTC 231: Use of type conversions
whose target type has a constraint that is smaller than the source expression.
For Maintainability:
-
LTC 301: Use of when others in
an exception handler.
-
LTC 302: Use of a when others in
a case statement.
-
LTC 303: Use of an enumeration
literal range as a choice in a case statement.
-
LTC 304: Use of others choices
in aggregates whose index is enumerated.
-
LTC 305: Declaration of array types
whose index type is not explicitly declared.
-
LTC 306: Absence of named parameter
association on all subprogram and entry calls.
-
LTC 307: Absence of named association
in record aggregates.
-
LTC 309: Use of numeric literals
in nondeclarative parts of the program.
-
LTC 310: Use of default parameters.
-
LTC 311: Use of raise statements
with no named exception (reraise).
-
LTC 312 Absence of named association
in array aggregates.
For Efficiency:
-
LTC 401: Use of recursive subprograms.
-
LTC 402: Use of access types.
-
LTC 403: Use of the or and and
operators instead of short-circuit forms.
-
LTC 404: Use of the package Text_Io.
-
LTC 412: Functions returning types
who size is greater than a specified limit
-
LTC 413: Functions returning unconstrained
types.
-
LTC 414: Use of record component
default initialization.
For Readability:
-
LTC 501: Declarations using names
from package Standard.
-
LTC 502: Use of unapproved renames.
-
LTC 503: References to renamed
items through their original name.
-
LTC 504: Use of any use clause
not on an approved list.
-
LTC 505: Use of abbreviations that
are not on an approved list.
-
LTC 506: Use of the not operator.
-
LTC 514: Unqualified references.
-
LTC 514: Unqualified references.
-
LTC 515: Complex expressions that
are not fully parenthesized.
-
LTC 516: Loops containing unamed
exit statements.
-
LTC 517: Declared names not following
specified naming conventions.
-
LTC 518: Name dot selection greater
than a specified limit.
For Portability:
-
LTC 601: Use of unchecked conversion
on unconstrained types.
-
LTC 602: Use of delay statements
with zero duration.
-
LTC 603: Use of representation
specifications on derived types.
-
LTC 604: Use of Text_Io Form parameters.
-
LTC 605: Absence of a representation
clause to specify the collection size for access types.
-
LTC 606: Absence of a representation
clause to specify the stack size for tasks.
-
LTC 607: Main programs with parameters.
-
LTC 608: Use of machine code inserts.
For Program Structure:
-
LTC 701: Subprograms with McCabe
cyclomatic complexity over n.
-
LTC 702: Use of the abort statement.
-
LTC 703: Use of goto statements.
-
LTC 704: Use of anonymous types.
-
LTC 705: Raising of exceptions
that are caught in the local scope (that is, used as a goto).
-
LTC 706: Raising of predefined
exceptions.
-
LTC 707: Declaration of exceptions
in a nonvisible part of the program.
-
LTC 708: Functions with more than
one return statement.
-
LTC 709: Procedures containing
return statements.
-
LTC 710: Functions with side effects
(that is, that update variables outside their scope).
-
LTC 711: Use of exit statements
in while and for loops.
-
LTC 712: Presence of more than
one exit point from a loop.
-
LTC 713: Variables declared in
the visible part of a package.
-
LTC 714: Use of radixes other than
1, 8, or 16.
-
LTC 715: Declaration of constants
in a dynamic scope.
-
LTC 716: Use of Unchecked_Conversion.
-
LTC 717: Use of Unchecked_Deallocation.
-
LTC 720: Dynamically allocated
tasks.
-
LTC 723: Use of pragma Shared.
-
LTC 740: Private parts with extraneous
declarations.
-
LTC 744: Subtype nesting that exceeds
specified limits.
-
LTC 745: Unnecessary type conversions.
-
LTC 746: Access type declarations
without associated storage pools.
For Program Format:
-
Rule 801: List with more than three
items on separate lines. Not Recommended by LTC.
-
Rule 802: Alphabetical context
clause order. Not Recommended by LTC.
-
Rule 803: Alphabetic rename clause
order. Not Recommended by LTC.
-
Rule 804: Use of multiple names
in a single context clause. It is often cleaner to have only one name per
context clause.
-
Rule 805: Use of multiple names
in declarations. Violations will be located within constant, variable,
record component, discriminant, subprogram-parameter, generic formal object,
and exception declarations. It is often cleaner and more flexible to have
one name per declaration.
-
Rule 805: Units whose line count
exceeds specified limits.
-
Rule 805: Subprograms whose line
count exceeds specified limits.
Ada 95 Rules:
-
Ada95 01: Use of the new Ada 95
key words as identifiersãabstract, aliased, protected, requeue,
tagged, and until.
-
Ada95 02: Use of the following
as identifiersãWide_Character and Wide_String.
-
Ada95 03: Use of the following
as identifiers when package System is usedãMax_Base_Digits, Max_Binary_Modulus,
Max_Nonbinary_Modulus, Null_Address, Bit_Order, Default_Bit_Order, Any_Priority,
Interrupt_Priority, High_Order_First, Low_Order_First.
-
Ada95 04: Use of library-level
compilation units namedãAda, Interfaces.
-
Ada95 05: Declaration of library-level
package specifications that do contain subprograms, tasks, deferred constants,
or incomplete types must not have a body.
-
Ada95 06: Use of the attribute
T'Base on composite types.
-
Ada95 07: Use of the exception
Numeric_Error in raise statements or exception handlers.
-
Ada95 08: Use of representation
clauses that do not immediately follow the declaration of the type they
represent.
-
Ada95 09: Use of the following
attributesã'MANTISSA, 'EMAX, 'LARGE, 'SMALL, 'EPSILON, 'SAFE_EMAX,
'SAFE_LARGE, 'SAFE_SMALL.
-
Ada95 10: Use of the following
as identifiers when package Text_Io is usedã Set_Error, Standard_Error,
Current_Error, Flush, Is_Open, Look_Ahead, Get_Immediate, Modular_Io, Decimal_Io,
File_Access.
-
Ada95 11: Use of derived types
whose parent type is declared in the same package.
-
Ada95 12: Use of, or reference
to the Standard.Character type in contexts where the new literals (now
256 instead of 128) would render the program illegal or change the program's
behavior. These contexts include use as an array index, use as a discrete
range in a loop, reference to Character'Last, or use in a case statement
expression.
-
Ada95 13: Use of character and
string literals in contexts where there subtype would be ambiguous (with
Wide_Character and Wide_String). These contexts include use in relational
expressions, discrete ranges, and some type qualifications.
-
Ada95 14: Use of, or reference
to the Text_Io.File_Mode type in contexts where the new enumeration literal
(Append_File) would render the program illegal or change the program's
behavior. These contexts include use as an array index, use as a discrete
range in a loop, reference to File_Mode'Last, or use in a case statement
expression.
-
Ada95 15: Use of functions that
return task types or type containing task types.
-
Ada95 16: Use of pragmas defined
by the Ada 83 language that are also not defined by the Ada 95 language
standard.
-
Ada95 17: Use of
ësize attributes whose attributed entity has a static size (in bits) that
is not an even multiple of the byte size of the target machine.
Real Time Restrictions (Annex D):
-
LTC 1101: Locates tasks that are
declared in a dynamic scope.
-
LTC 1102: Locates objects with
controlled parts or access types that designate such objects that are not
declared at the library level.
-
LTC 1103: Locates all abort statement
instances.
-
LTC 1104: Locates selective accept
statements with terminate alternatives.
-
LTC 1105: Locates dynamic allocation
of tasks.
-
LTC 1106: Locates usage of the
predefined Dynamic_Priorities package.
-
LTC 1107: Locates usage of the
predefined Asynchronous_Task_Control package.
-
LTC 1108: Locates select statements
whose number of alternatives is greater than the limit specified in the
standards_conformance/maximum_select_alternatives file of the current configuration
policy.
-
LTC 1109: Locates tasks whose number
of entries is greater than the limit specified in the standards_conformance/
maximum_task_entries file of the current configuration policy.
-
LTC 1110: Locates protected types
and objects whose number of entries is greater than the limit specified
in the standards_conformance/maximum_protected_entries file of the current
configuration policy.
Safety and Security Restrictions (Annex H):
-
LTC 1001: Locates instances of
protected objects and types. (also SPARK 4.2.2)
-
LTC 1002: Locates all allocator
expressions.
-
LTC 1003: Locates allocator expressions
that appear in subprograms, generic subprograms, tasks, and entry bodies.
-
LTC 1004: Locates generic instantiations
that appear in subprograms, generic subprograms, tasks, and entry bodies.
-
LTC 1005: Locates usage of the
predefined package Unchecked_Deallocation.
-
LTC 1006: Locates exception raise
statements and exception handlers. (also SPARK 6.1.1)
-
LTC 1007: Locates all definitions
or usage of floating point types.
-
LTC 1008: Locates all definitions
or usage of fixed point types.
-
LTC 1009: Locates usage of the
predefined package Unchecked_Conversion.
-
LTC 1010: Locates declarations
of access subprograms.
-
LTC 1011: Locates use of the ëUnchecked_Access
attribute.
-
LTC 1012: Locates usage of the
ëClass attribute.
-
LTC 1013: Locates references to
the predefined Io packages Sequential_Io, Direct_Io, Text_Io, Wide_Text_Io,
or Stream_Io.
-
LTC 1014: Locates all usages of
delay statements. (also SPARK 6.1.4)
-
LTC 1015: Locates references to
the predefined package Calendar.
-
LTC 1016: Locates instances of
recursive subprograms.
Spark Ada Subset Restrictions:
-
LTC 1201: Locates the declaration
of generic units (4.2.3).
-
LTC 1202: Locates library subprograms
that are not main subprograms (4.2.4).
-
LTC 1203: Locates all violations
of the visibility rules associated with private child units. In SPARK,
private child units are not visible to other public siblings (4.2.5).
-
LTC 1204: Locates all violations
of the visibility rules associated with public child units. In SPARK, a
package body cannot references its own public children (4.2.6).
-
LTC 1205: Locates packages that
are nested in other package specifications (4.2.7).
-
LTC 1206: Locates packages that
initialize non-local own variables (4.2.8).
-
LTC 1207: Locates all usages of
SPARK reserved words (4.3.1).
-
LTC 1208: Locates use of real based
literals (4.3.2).
-
LTC 1209: Locates references to
the predefined Wide_Character type (4.3.3).
-
LTC 1210: Locates references to
the predefined Wide_String type (4.3.4).
-
LTC 1211: Locates use of anonymous
types or subtypes. In SPARK, all type definitions must have an explicit
name (5.2.1).
-
LTC 1212: Locates declarations
of derived types (5.2.2).
-
LTC 1213: Locates declarations
of modular types (5.2.4).
-
LTC 1214: Locates declarations
of decimal types (5.2.5).
-
LTC 1215: Locates use of type extension
(5.2.6).
-
LTC 1216: Locates declaration of
discriminant records (5.2.7).
-
LTC 1217: Locates all constraints
that are not static (5.2.8).
-
LTC 1218: Locates the use of null
ranges (5.2.9).
-
LTC 1219: Locates overloaded enumeration
literals (5.3.1).
-
LTC 1220: Locates declaration of
user defined character types (5.3.2).
-
LTC 1221: Locates references to
predefined scalar types other than Integer (5.4.1).
-
LTC 1222: Locates references to
predefined real types other than Float (5.4.2).
-
LTC 1223: Locates declarations
of tagged types (5.5.1).
-
LTC 1224: Locates string subtypes
whose lower bound is not 1 (5.5.3).
-
LTC 1225: Locates use of array
slices or assignments that cause the bounds of the array to slide (5.5.4).
-
LTC 1226: Locates aggregates with
mixed named and positional notation used for component specification (5.6.1).
-
LTC 1227: Locates use of others
clauses in record aggregates (5.6.2).
-
LTC 1228: Locates aggregates that
are not qualified with a type mark (5.6.3).
-
LTC 1229: Locates user declaration
of operators (5.7.1).
-
LTC 1230: Locates use of infix
operators (5.7.2).
-
LTC 1231: Locates violations of
array equality restrictions (5.8.1).
-
LTC 1232: Locates use of type conversion
with out parameters at the point of call (5.8.2).
-
LTC 1233: Locates non-static expressions
in declarations (5.9.1).
-
LTC 1234: Locates use of block
statements (6.1.1).
-
LTC 1235: Locates all usage of
statement labels (6.1.3).
-
LTC 1236: Locates exit statements
that violate SPARK restrictions (6.3.1).
-
LTC 1237: Locates violation of
restrictions associated with return statements (6.4.1).
-
LTC 1238: Locates declarations
of overloaded subprograms (6.5.2).
-
LTC 1239: Locates subprogram calls
that mix named and positional parameter notation (6.7.1).
-
LTC 1240: Locates violations of
SPARK restrictions on subprogram specifications (7.1.1).
-
LTC 1241: Locates violations of
where use type clauses may appear (7.7.2).
-
LTC 1242: Locates violations of
SPARK renaming restrictions (7.7.4).
-
LTC 1243: Locates references to
predefined packages other than Standard and Ada.Charactes.Latin1 (8.4.1).
Metrics:
-
Metric 101: Number of carriage
returns (total number of ascii lines).
-
Metric 102: Number of blank lines
(lines containing only blank or tab characters).
-
Metric 103: Number of comment lines
(lines beginning with "--").
-
Metric 104: Number of non-blank,
non-comment lines.
-
Metric 105: Number of lines ending
in a ';' character.
-
Metric 201: Number of subprogram
execution paths.
-
Metric 202: McCabe cyclomatic complexity.
-
Metric 203: McCabe complexity adding
complexity metric for nested subprograms to their parent.
-
Metric 204: Number of executable
statements.
-
Metric 205: McCabe Essential complexity.
-
Metric 206: McCabe module design
complexity.
-
Metric 301: Number of unit modifications
derived from the CMVC system.
-
Metric 401: The Number of Methods metric will compute the total number
of methods available for a class (both explicit and inherited).
-
Metric 402: The Number of Attributes
metric will compute the total number of attributes that constitute the
data representation of a class. Both explicit and inherited attributes
will be counted.
-
Metric 403: The Depth of Inheritance
metric will compute the depth of inheritance of a class. This depth is
defined to be the number of derivations from parent class types to the
base class type that is not derived.
-
Metric 404: The Class Response
metric will compute the response of a class. The response of a class is
defined to be the number of methods from other classes called by the explicit
methods of a class. Inherited methods are not scanned for calls and duplicate
calls to the same method are counted only once.
-
Metric 405: The Class Coupling
metric will compute the coupling of a class. Coupling is defined to be
the number of other classes referenced by the explicit methods and attributes
of a class. Inherited methods and attributes and not scanned for references
and duplicate references are counted only once.
-
Metric 406: The Class Complexity
metric will compute the McCabe cyclomatic complexity of a class. This is
defined to be the sum of the McCabe cyclomatic complexities of all explicit
methods of a class. Inherited methods are not included in this computation.
-
products
-
ada
analyzer data sheet | ada
analyzer pdf (3.4 meg)
-
ada
analyzer/ ada repair training | ada type interchange
generator (ATIG) | ada repair
-
little
tree home | about little tree |
technical
articles | email