MATLAB: What are the roles of include folders, include options and the #include directive,etc… in Polyspace

polyspacePolyspace Bug FinderPolyspace Bug Finder ServerPolyspace Client for C/C++Polyspace Code ProverPolyspace Code Prover Server

What are the roles of the include folders, the include options, the #include directive,etc… ?

Best Answer

By default, in the C and C++ languages, header files are included in the source files with the #include directive.
Ex.
#include <stdio.h>
...
In order to tell Polyspace where these header files to include are, the user needs to specify include folders. This is done, when setting up a project, by adding these include folders to the project (the 'Include' folder of a project, int the Project Browser view).
When Polyspace will analyze each source file at the beginning of the verification or analysis process, it will process the #include directives and will look for the requested include files (like stdio.h) in the different include folders.
NB: The corresponding command line option to define the include folders is -I.
The other way to include header files is by using the option -include, found in the Environment Settings topic on the configuration.
The role of this option is to automatically include a header file in every source files. It is equivalent to have a #include directive in every source files of the project.
With this option -include, the user will specify a header file, and not an folder.
This option can be used for example to define macros (using #define directives) in every source files without having to define them in the Polyspace project.