Polyspace® as You Code checks the source code of the file that is currently active in your Eclipse™ IDE for bugs and coding standards violations.
So that the analysis runs without errors, provide Polyspace as You Code with the specificities of your build configuration, such as data type sizes and compiler macro definitions. To provide your build configuration information, you can:
Configure Polyspace as You Code to extract the build configuration information from your Eclipse project, build command, or JSON compilation database.
Manually specify analysis options that emulate your build configuration in an options file. See Options Files for Polyspace Analysis.
Import the analysis options from a Polyspace desktop product project file.
To extract your build configuration information from the Eclipse project, build command, or JSON compilation database:
Go to Polyspace > Configure Project.
Select the appropriate Build configuration option. See Configure Polyspace as You Code Plugin in Eclipse.
To extract your build configuration information from your Eclipse project:
Go to Polyspace > Configure Project.
Select Get from Eclipse project. See Configure Polyspace as You Code Plugin in Eclipse.
Each time you start an analysis, Polyspace extracts the build configuration information from the project toolchain and generates an options file. The Polyspace analysis engine uses that options file in the subsequent analysis.
To view the details of the toolchain configuration:
Select a project in the Project Explorer and go to Project > Properties.
Under the C/C++ General node, select Paths and symbols and Preprocessor Include Paths, Macros, etc.
To extract your build configuration information from your build command:
Go to Polyspace > Configure Project.
Select Get from build command line and specify your build command. See Configure Polyspace as You Code Plugin in Eclipse.
The build command that you specify must perform a full build. For instance:
"C:\Program Files\Polyspace as You
Code\R2021a\sys\tcc\win64\tcc.exe" -g -o output dll.c fib.c
hello_dll.c hello_win.c
Specify the full path of the folder where Polyspace runs the build command in the Build command working folder field. For instance:
C:\Program Files\Polyspace as You
Code\R2021a\sys\tcc\win64\examples
Click Generate build configuration.
Polyspace runs your build command, traces the build to extract the configuration information, and generates an options file. The Polyspace as You Code analysis engine uses the generated options file in subsequent analyses.
The generated options file is stored in the
.polyspace-configure folder under the
folder or one of its subfolders. The workingDirectory/projectNameworkingDirectory
path is the Results folder path that you specify in the Polyspace > Preferences. The projectName is the name of the
project that contains the files you are currently analyzing.
If your build system supports the generation of a JSON compilation database file, use this setting. The file contains compiler calls for all the translation units in your project. See JSON compilation database.
To extract your build configuration information from the JSON compilation database:
Generate a JSON compilation database file. For an example of how to generate this file, see Create Polyspace Options File from JSON Compilation Database.
If you use a JSON compilation database that was not generated on your local machine, make sure that the paths listed in the file are accessible from the location where you run Polyspace as You Code.
Go to Polyspace > Configure Project.
Select Get from JSON Compilation Database file and specify the full path to the JSON compilation database file that you generated in step 1. See Configure Polyspace as You Code Plugin in Eclipse.
Click Generate build configuration.
Polyspace extracts the build configuration information from the compilation database and generates an options file. The Polyspace as You Code analysis engine uses the generated options file in subsequent analyses.
The generated options file is stored in the
.polyspace-configure folder under the
folder or one of its subfolders. The workingDirectory/projectNameworkingDirectory
path is the Results folder path that you specify in the Polyspace > Preferences. The projectName is the name of the
project that contains the files you are currently analyzing.
If you make changes to your build configuration, for instance if you add a source file to your project or workspace or rename an existing file, update the generated options file to reflect those changes. Before you update the options file, make sure that your build completes successfully with the new configuration.
To update the options file, select Polyspace > Generate Build Configuration. You do not need to update the options file if you extract your build from an Eclipse project.
If you extract your build information from a JSON compilation database file, regenerate the compilation database before you update the build options file.
See also Troubleshoot Failed Analysis or Unexpected Results in Polyspace as You Code.
Use this setting if:
You know the details of your build system and you want to specify the Polyspace analysis options that emulate your build configuration in an options file. See Options Files for Polyspace Analysis.
For a list of available analysis options, see Polyspace as You Code Analysis Engine Options.
You reuse a Polyspace options file that you or someone else on your team has configured for your build system.
If you reuse an options file that was not configured or generated on your local machine, make sure that the paths listed in the file are accessible from the location where you run Polyspace as You Code.
To specify an analysis options file:
Go to Polyspace > Configure Project.
Select Get from Polyspace build options file and specify the full path to the options file. See Configure Polyspace as You Code Plugin in Eclipse.
The Polyspace as You Code analysis engine uses the options file that you specify in subsequent analyses.
If you make changes to your build configuration, edit the options file to reflect those changes. See Specify Target Environment and Compiler Behavior.
If you configure an analysis in the Polyspace desktop product, you can use the information from the resulting Polyspace desktop PSPRJ file to configure your Polyspace as You Code analysis.
To import the analysis options from a Polyspace desktop PSPRJ file:
Go to Polyspace > Configure Project.
Select Build options file not required. See Configure Polyspace as You Code Plugin in Eclipse.
This selection allows you to leave the Get from Polyspace build options file field empty.
Click Import options from Polyspace desktop project and select the PSPRJ file that you import from.
Polyspace generates an options file and an XML checkers activation file, and populates the corresponding fields with the paths to the generated files. The Polyspace as You Code analysis engine uses these files in subsequent analyses.
If you make changes to your build configuration, edit the options file to reflect those changes. See Specify Target Environment and Compiler Behavior.