vector.com|Contact
Search tips

apple banana
Find rows that contain at least one of the two words.

+apple +juice
Find rows that contain both words.

+apple macintosh
Find rows that contain the word 'apple', but rank rows higher if they also contain 'macintosh'.

+apple -macintosh
Find rows that contain the word 'apple' but not 'macintosh'.

+apple ~macintosh
Find rows that contain the word 'apple', but if the row also contains the word 'macintosh', rate it lower than if row does not. This is "softer" than a search for '+apple -macintosh', for which the presence of 'macintosh' causes the row not to be returned at all.

+apple +(>turnover >strudel)
Find rows that contain the words 'apple' and 'turnover', or 'apple' and 'strudel' (in any order), but rank 'apple turnover' higher than 'apple strudel'.

apple*
Find rows that contain words such as 'apple', 'apples', 'applesauce', or 'applet'.

"some words"
Find rows that contain the exact phrase 'some words' (for example, rows that contain 'some words of wisdom' but not "some noise words").

By continuing to use this site you agree to the use of cookies. For more information and to find out how to change this click here. Accept Cookies
Please enable cookies in your browser for this website.
Search:
Advanced search

Inline Functions Show Coverage

Last updated: 2019-10-31
Issue:
Why do my inline functions not show coverage even though they are being called and I have turned on the option Provide code coverage in header files?
Solution:

This problem can occur when your environment has multiple units which #include the header which defines the inline functions. In this situation, the instrumented function is compiled (possibly inlined) separately in each unit. The linker may or may not link in all the separate definitions. If it retains the definition in only 1 unit, then only that unit will appear to have the function covered when it is called. If the function is inlined or defined separately in each unit, then the function will only appear to be covered in the units from which it was called.

The VectorCAST philosophy of code coverage is to show the covered source which corresponds to the executed object code. This specification is important in cases where source code from one location in your source tree is compiled into distinct pieces of object code in your executable software.

For example, consider the following C++ source code:

///////// header.h ////////////
#ifndef HEADER_H
#define HEADER_H

inline int freezing_point(void)
{
#ifdef USE_CELSIUS
  return 0;
#elif defined(USE_FAHRENHEIT)
  return 32;
#endif
}
#endif
///////////////////////////////

If header.h is #included into a file and USE_CELSIUS has been #defined, then the resulting object code will differ from the case where header.h is #included into a file where USE_FAHRENHEIT has been #defined. For this reason, the coverage information which VectorCAST generates is specific to a unit, even for inline functions that may be compiled into multiple units.
 

Because a C++ compiler might not inline a function even if it is defined with the inline keyword, it is possible for a function in a unit A to call an inline function whose definition comes from another unit. In this case the inline definition in unit A will never show code coverage.Therefore, when testing and generating code coverage results in VectorCAST, you may not be able to achieve full coverage of such inline functions.
 

To accommodate the need to show such functions as covered, VectorCAST introduced a new option called Show inlines as covered in all units. Enabling this option along with Provide code coverage in header files will allow inline functions to show the same coverage information in each unit in which they appear. To use the option with an existing environment, turn it on and then re-instrument your source files and re-execute your tests.
 

The option works by replicating the coverage data across units dynamically during the processing of the coverage data. The replication will not be explicitly recorded in coverage scripts, but the option can be utilized when importing results in a different environment as long as the destination environment contains the unit for which the original coverage data was recorded and the units in the destination environment were instrumented with the option enabled.

 
Article Options
2019-10-31
Views: 8