Instrumentation pragmas for Ada language

You can add special directives to the source code under test, known as instrumentation pragma directives, to modify the behavior of the source analyzer.

Usage

Following are the two kinds of pragmas for Ada language:
--#pragma attol <pragma name> <directive>
--!attol!-- <code>

The first syntax is similar to the one used in C/C++ languages.

The second syntax is specific to Ada language. It can be used to add code that is analyzed by the instrumenter.

Instrumentation pragma names

--#pragma attol stop_analyze 
--#pragma attol start_analyze

These pragmas can be used to start and stop the source code analysis. The source code analysis by default is set. If a syntax is not supported, you can ignore the pragmas by enclosing the unsupported code with stop_analyze and then start_analyze.

--#pragma attol cov_justify <directive>

This pragma provides the user to add a justification statement for non-coverage of a branch of code.

For more information on the directives, see Justification of non-covered lines of code

As this branch of code is covered, the code coverage percentage is computed. The coverage report highlights the branch in blue. The justification is displayed in the coverage viewer when you hover over this branch with your mouse.

If this branch is covered, an error is reported in the coverage report.

Instrumentation specific code

--!attol!-- <code> 

You can include code that is analyzed by the instrumenter. The analysis extends until the end of the line that contains the code.

This is useful when an Ada syntax is not supported by the instrumenter in combination with the pragmas stop_analyzeand start_analyze. If you stop the analysis of some declarations, the rest of the code might generate syntax errors. This directive can be used to introduce alternate declarations to the instrumenter, that enables the instrumenter to continue the analysis without errors.

Example:

package ptest5 is
    type mytype is new integer;
--# pragma attol stop_analyze
    myvar : mytype with Linker_Section => ".mysec";  
-- this line is ignored by the parser but used by the compiler
--# pragma attol start_analyze
--!ATTOL!--    myvar : mytype;       
-- this line is analysed by the parser but not by the compiler
    myvar2 : mytype;
    pragma Linker_Section (myvar2 , ".mysec");
    Function myfunc (para : out mytype) return Boolean;
end ptest5;