Skipping of Code

With two Testwell CTC++ specific pragmas, parts of code can be skipped during instrumentation.

To skip code inside a source file, this pair of Testwell CTC++ specific pragmas can be used:
/*Pair of SKIP pragmas*/
#pragma CTC SKIP
#pragma CTC ENDSKIP

Code between these pragmas is not instrumented. They can be nested and they have effect over include boundaries. So, if an included file has a starting CTC SKIP but not an ending CTC ENDSKIP, the skip mode continues in the including file.

Example:
/*Embracing SKIP pragmas*/
#include <stdio.h>
#include <bfile.h>
...
int foo1() {
   ...
}
...
#pragma CTC SKIP
int foo2() {
   ...
}
#pragma CTC ENDSKIP
...
int foo3() {
...
}
...
#pragma CTC SKIP
#include "somecode.inc"
#pragma CTC ENDSKIP
...

It is recommended that these pragmas are used outside of function bodies only. If they are used inside function bodies, it is required to use them only in such places where an imaginary {…} block could be added without making the program syntax erroneous or changing the program logic.

Using these pragmas inside a function invalidates statement coverage reporting for the function. The reason is that reliable control flow analysis cannot be done, because some control structures and their executions are hidden from the Testwell CTC++ toolchain (in any meaningful use of these pragmas inside a function). Statement coverage TER for the function is reported as "N.A.".

Inside macro definitions, where the pragmas cannot be used, the constructs "CTC SKIP"; and "CTC ENDSKIP"; can be used as alternative.

Example:
/*Alternative construct CTC SKIP / ENDSKIP*/
#define MY_ASSERT (cond){ “CTC SKIP”; \
   if(!(cond)) { \
      printf(“\nMY_ASSERT failure at line %i\n”, __LINE__); \
      exit(1); \
   } \
   “CTC ENDSKIP”; }