PREPROC_CXX

With PREPROC_CXX, the invocation of the preprocessing stage is specified for C++ files.

Example 1 (Microsoft cl):
PREPROC_CXX = %COMMAND% /E /nologo /D__CTC__ %FLAGS% %FILE% > %RESULT%
Example 2 (gcc):
PREPROC_CXX = %COMMAND% -E -D__CTC__ %FLAGS% %FILE% -o %RESULT%

Here the following variables are used: %COMMAND% is the value of the COMMAND parameter, i.e. the actual compilation command. Into %FLAGS%, ctc puts those options from the original compilation command that need to be preserved when the source file is preprocessed. %FILE% is the name of the original source file. %RESULT% is a ctc-generated internal temporary file name to receive the C-preprocessed version of the source file.

Adding the -D__CTC__ macro is a useful convention. It allows to use #ifdef __CTC__ … #endif sections in original source code, being effective only for instrumentation.

If the compiler support –o option to specify the %RESULT% file, it should be used instead of ‘>’. This is because some compiler C-preprocessors may under some conditions write messages to stdout, and so they also come to the %RESULT% file and make the net result non-compilable.

Some compilers do not support to specify the %RESULT% file for preprocessing. Instead, it is generated without influence on its name. In such situation, the parameter RUN_AFTER_CPP can be used to specify a script moving the preprocessed file to the name and location the Testwell CTC++ internal toolchain requires.