Why is the compile stage of the Polyspace verification very slow, in Polyspace Client for C/C++ 8.3?

1 view (last 30 days)
I have a large coding project with many source and header files. When I compile my project using some compiler outside of Polyspace, it compiles in a reasonable amount of time.
However, when I try to do a Polyspace verification on my project, the Compile stage of the process is very slow (each individual source file compile takes a very long time).

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 29 Jan 2013
One possible cause of this problem are issues related to multiple and circular inclusion of header files in the source code. Multiple and circular inclusion of header files can occur when the code does not contain safeguards against this. An example of a situation where multiple inclusion can occur is when a source file includes a large number of header files, and in turn each header file individually includes the same header file or set of header files. This will cause header files to be included repeatedly during precompile unless safeguards are included in the code to prevent it.
Large amounts of redundant header file code will slow down the compile phase of the Polyspace verification, because of the way that the Polyspace compile is handled internally. The Polyspace internal compile process is different from a standard compiler, so comparing the compile times of the two is NOT valid.
To resolve this issue, please add precompiler statements to the header files that are used in the source code, to protect against multiple and circular inclusion. For example, if you have a header file named "MyHeader.h", you would add the followng to the file:
#ifndef MY_HEADER_H
#define MY_HEADER_H
/* All of the header file contents go between the #define and the #endif */
#endif

More Answers (0)

Tags

No tags entered yet.

Products


Release

R2012a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!