Contenuto principale

Configure Sources and Build Options

Configure Polyspace to mimic your build closely to improve result precision

If you use a build command such as make or cmake for building your source code or you are able to generate a JSON compilation database using your build system, you can create a Polyspace® Platform project from the build command or compilation database. The source files and build options in the Polyspace Platform project are determined from the compiler invocations in the build command or compilation database.

Otherwise, set options explicitly in your build configuration. Specifying your compiler for the option Compilation toolchain (Static Analysis) allows the analyzer to recognize compiler-specific keywords. Work around any additional errors using options such as Preprocessor definitions (-D) or Command/script to apply to preprocessed files (-post-preprocessing-command).

Functions

polyspace-configure(System Command) Create Polyspace Platform project, workspace, or options file from build command or compilation database

Polyspace Options

expand all

Application source files (-sources, -sources-list-file)Add source files to Polyspace Platform project
Application source foldersAdd source folders to Polyspace Platform project (Since R2024a)
Include paths (-I)Specify paths to folders containing include files
Include file name patternsSpecify patterns for file names to be included in Polyspace Platform project (Since R2024a)
Exclude patternsSpecify folders or files to be excluded from static analysis or testing (Since R2024a)
Project variablesDefine environment variables for use as shorthands in Polyspace Platform project (Since R2024a)
Source code language (-lang)Specify language of source files
C standard version (-c-version)Specify C language standard followed in source code
C++ standard version (-cpp-version)Specify C++ language standard followed in source code
Compilation toolchain for static analysis (-compiler, -compiler -target)Specify the compiler that you use to build your source code for static analysis
Processor (-custom-target)Select the processor for the current build configuration
-targetSpecify size of data types and endianness by selecting a predefined target processor or creating a custom processor
Stop analysis if a file does not compile (-stop-if-compile-error)Specify that a compilation error must stop the analysis
Implicit C(C++) compiler include pathsView implicit compiler include paths extracted from your build command (Since R2024b)
Implicit C(C++) compiler definesView implicit compiler defines extracted from your build command (Since R2024b)
Source code encoding (-sources-encoding)Specify the encoding of source files
Enum type definition (-enum-type-definition)Specify how to represent an enum with a base type
-ignore-pragma-packIgnore #pragma pack directives
-sfr-typesSpecify sizes of sfr types for code developed with Keil or IAR compilers
-no-uliteralsDisable Polyspace definitions for char16_t or char32_t
Preprocessor definitions (-D)Replace macros in preprocessed code
Disabled preprocessor definitions (-U)Undefine macros in preprocessed code
Command/script to apply to preprocessed files (-post-preprocessing-command)Specify command or script to run on source files after preprocessing phase of analysis
Implicit C(C++) compiler definesView implicit compiler defines extracted from your build command (Since R2024b)
-regex-replace-rgx -regex-replace-fmtMake replacements in preprocessor directives
-dump-preprocessing-infoShow all macros implicitly defined during a particular analysis
Include paths (-I)Specify paths to folders containing include files
Additional include paths (-I)Specify build-specific include paths in addition to project-wide include paths (Since R2024a)
Forced includes (-include)Specify files to be #include-d by every source file. (Since R2023b)
Implicit C(C++) compiler include pathsView implicit compiler include paths extracted from your build command (Since R2024b)
Code from DOS or Windows file system (-dos)Consider that file paths are in MS-DOS style
-includeSpecify files to be #include-ed by each C file in analysis
Round down results of negative integer division (-div-round-down)Specify that your compiler rounds down a negative quotient from dividing two integers (Since R2023b)
Pack alignment value (-pack-alignment-value)Specify default structure packing alignment for code developed in Visual C++
Shift right on signed integers as arithmetic shift (-logical-signed-right-shift)Specify that your compiler implements right shifts on signed integers as arithmetic shifts (Since R2023b)
NameSee name of Polyspace Platform project (Since R2024a)

Topics

Get Started

Configure Options Using Build Commands

Configure Options Manually

Support for C/C++ Language Standards and Extensions

Troubleshooting

Troubleshoot Compilation and Linking Errors

Learn why Polyspace compilation can fail even if your compiler build succeeds and how to work around the failures.