Compilation toolchain for static analysis (-compiler, -compiler -target)
Specify the compiler that you use to build your source code for static analysis
Description
Specify the compiler that you use to build your source code for static analysis. This option applies to only static analysis. For dynamic testing, specify a toolchain for building your projects using the option Compilation toolchain (Testing) (Polyspace Test).
Polyspace® fully supports the most common compilers used to develop embedded applications. See the list below. If you cannot find your compiler in the list, specify generic as compiler name. If you face compilation errors, explicitly define compiler-specific extensions to work around the errors.
Note that this option is automatically set if you create a project from your build command in the user interface or using the polyspace-configure system command.
Set Option
Set the option using one of these methods:
Polyspace Platform user interface (desktop products only) — In your project configuration, on the Build tab, select Target & Compiler and then select a value for this option.
Command line and options file — Use the option
-compiler. See Command-Line Information.
Why Use This Option
Polyspace uses this information to interpret syntax that is not part of the C/C++ Standard, but comes from language extensions.
For example, the option allows additional language keywords, such as sfr, sbit, and bit. If you do not specify your compiler, these additional keywords can cause compilation errors during Polyspace analysis.
Settings
Default: generic
Generic Compiler
genericAnalysis allows only standard syntax.
The language standard is determined by your choice for the following options:
Standard Compilers
gnux.xThe analysis allows language extensions specific to a GCC version. For instance, if you select
gnu9.x, the analysis allows language extensions supported with GCC versions 9.1 – 9.5.For more information on GCC versions, see GCC releases. If you run into compilation errors after specifying one of the GCC compilers, see Fix Polyspace Compilation Errors Related to GNU Compiler .
clangx.xThe analysis allows language extensions specific to a Clang version. For instance, if you select
clang9.x, the analysis allows language extensions supported with Clang versions 9.0.0 and 9.0.1.visualx.xThe analysis allows language extensions specific to a Microsoft® Visual Studio® version. For instance, if you select
visual16.x, the analysis allows language extensions supported with Microsoft Visual Studio 2019.For more information on the correspondence between Microsoft Visual Studio version and the compiler version, see Microsoft C++ (MSVC) compiler versioning.
Specialized Cross-Compilers
If you select one of the specialized cross-compilers below, you also have to select a processor at the same time. For instance, the selection armcc - arm specifies both a compiler and a processor and translates to the option -compiler armcc -target arm at the command line. For all other compilers, you specify processor details in the user interface using the option Processor.
To see the processor details such as sizes of types for a particular processor, navigate to , open the XML file with the same name as the compiler, and search for:polyspaceroot\polyspace\verifier\extensions
target name="processorName"
polyspaceroot is the Polyspace installation folder.If you specify one of these cross-compilers, you must also specify the path to your compiler header files. See Provide Standard Library Headers for Polyspace Analysis.
armcc - armAnalysis allows non-ANSI® C syntax and semantics associated with the ARM® v5 compiler.
To see processor details such as sizes of types, open the file
and search for the processor name, for instance:polyspaceroot\polyspace\verifier\extensions\armcc.xmltarget name="arm"
armclang - arm,armclang - arm64Analysis allows non-ANSI C syntax and semantics associated with the ARM v6 compiler.
To see processor details such as sizes of types, open the file
and search for the processor name, for instance:polyspaceroot\polyspace\verifier\extensions\armclang.xmltarget name="arm"
codewarrior - s12z,codewarrior - powerpcAnalysis allows non-ANSI C syntax and semantics associated with the NXP CodeWarrior® compiler.
To see processor details such as sizes of types, open the file
and search for the processor name, for instance:polyspaceroot\polyspace\verifier\extensions\codewarrior.xmltarget name="s12z"
cosmic - s12zAnalysis allows non-ANSI C syntax and semantics associated with the Cosmic compiler.
To see processor details such as sizes of types, open the file
and search for the processor name, for instance:polyspaceroot\polyspace\verifier\extensions\cosmic.xmltarget name="s12z"
diab - powerpc,diab - powerpc64,diab - arm,diab - coldfire,diab - i386,diab - mcore,diab - rh850,diab - superh,diab - tricoreAnalysis allows non-ANSI C syntax and semantics associated with the Wind River® Diab compiler.
To see processor details such as sizes of types, open the file
and search for the processor name, for instance:polyspaceroot\polyspace\verifier\extensions\diab.xmltarget name="powerpc"
If you run into errors after specifying the Diab compiler, see Fix Polyspace Compilation Errors Related to Diab Compiler .
greenhills - powerpc,greenhilss - powerpc64,greenhills - arm,greenhills - arm64,greenhills - tricore,greenhills - rh850,greenhills - i386,greenhills - x86_64Analysis allows non-ANSI C syntax and semantics associated with a Green Hills® compiler.
To see processor details such as sizes of types, open the file
and search for the processor name, for instance:polyspaceroot\polyspace\verifier\extensions\greenhills.xmltarget name="powerpc"
If you run into errors after specifying the Greenhills compiler, see Fix Polyspace Compilation Errors Related to Green Hills Compiler .
iar-ew - arm,iar-ew - avr,iar-ew - msp430,iar-ew - rh850,iar-ew - riscv,iar-ew - rl78Analysis allows non-ANSI C syntax and semantics associated with the IAR Embedded Workbench compiler.
To see processor details such as sizes of types, open the file
and search for the processor name, for instance:polyspaceroot\polyspace\verifier\extensions\iar-ew.xmltarget name="arm"
If you run into errors after specifying the IAR Embedded Workbench compiler, see Fix Polyspace Compilation Errors Related to Keil or IAR Compiler.
intel - x86_64Analysis allows non-ANSI C syntax and semantics associated with the Intel® C++ Compiler Classic (icc/icl) compiler.
To see processor details such as sizes of types, open the file
and search for the processor name, for instance:polyspaceroot\polyspace\verifier\extensions\intel.xmltarget name="x86_64"
microchip - picAnalysis allows non-ANSI C syntax and semantics associated with the MPLAB XC8 C compiler.
To see processor details such as sizes of types, open the file
and search for the processor name, for instance:polyspaceroot\polyspace\verifier\extensions\microchip.xmltarget name="pic"
renesas - rl78,renesas - rh850,renesas - rx,renesas - shAnalysis allows non-ANSI C syntax and semantics associated with the Renesas® compiler.
To see processor details such as sizes of types, open the file
and search for the processor name, for instance:polyspaceroot\polyspace\verifier\extensions\renesas.xmltarget name="rl78"
tasking - tricore,tasking - c166,tasking - rh850,tasking - armAnalysis allows non-ANSI C syntax and semantics associated with the TASKING compiler.
To see processor details such as sizes of types, open the file
and search for the processor name, for instance:polyspaceroot\polyspace\verifier\extensions\tasking.xmltarget name="tricore"
If you run into errors after specifying the Tasking compiler, see Fix Polyspace Compilation Errors Related to TASKING Compiler.
ti - c28x,ti - c6000,ti - arm,ti - msp430Analysis allows non-ANSI C syntax and semantics associated with the Texas Instruments® compiler.
To see processor details such as sizes of types, open the file
and search for the processor name, for instance:polyspaceroot\polyspace\verifier\extensions\ti.xmltarget name="c28x"
If you run into errors after specifying the Texas Instruments compiler, see Fix Polyspace Compilation Errors Related to TASKING Compiler.
Keil and IAR Compilers
These option values are not recommended and will be removed in a future release.
iarAnalysis allows non-ANSI C syntax and semantics associated with the compilers from IAR™ Systems (www.iar.com).
keilAnalysis allows non-ANSI C syntax and semantics associated with the Keil™ products from ARM (www.keil.com).
If you run into errors after specifying the Keil or IAR compiler, see Fix Polyspace Compilation Errors Related to Keil or IAR Compiler .
Tips
Instead of specifying a compilation toolchain explicitly, try creating a Polyspace Platform project from your build command first. For more information, see Configure Sources and Build Options in Project for Polyspace Analysis and Testing. If you cannot create a project from your build command, continue with the manual configuration of options.
Your compiler specification determines the values of many compiler-specific macros. In case you want to know how Polyspace defines a specific macro, use the option
-dump-preprocessing-info.To override the macro definition, use the option
Preprocessor definitions (-D).To undefine a macro, use the option
Disabled preprocessor definitions (-U).
If you use a Visual Studio compiler:
Set
long longto 64 bits. SeeProcessor. To setlong longto 64 bit at the command line, use the option-long-long-is-64bits.The plain
chartypes in your code is interpreted assigned charbecause Visual Studio compilers do not support a plainchar.
If you use the option , select the compiler
generic. If you use another compiler, Polyspace cannot check the JSF® coding rules that require conforming to the ISO standard. For example, AV Rule 8: “All code shall conform to ISO/IEC 14882:2002(E) standard C++.”
Command-Line Information
To specify a compiler at the command line, use the option -compiler with a compiler name.
If you specify a compiler name for the option Compilation toolchain (Static analysis) in the Polyspace Platform user interface, it translates to the option -compiler at the command line. If you specify one of the specialized cross-compilers, where the compiler name is coupled with the processor name, it translates to both options -compiler and -target. The compiler name is specified as -compiler argument and the processor name as -target argument.
-compiler
Parameter: -compiler |
Value: armcc | armclang | clang3.x | clang4.x | clang5.x | clang6.x | clang7.x | clang8.x | clang9.x | clang10.x | clang11.x | clang12.x | clang13.x | codewarrior | cosmic | diab | generic | gnu3.4 | gnu4.6 | gnu4.7 | gnu4.8 | gnu4.9 | gnu5.x | gnu6.x | gnu7.x | gnu8.x | gnu9.x | gnu10.x | gnu11.x | gnu12.x | greenhills | iar | iar-ew | intel | keil | microchip | renesas | tasking | ti | visual10.0 | visual11.0 | visual12.0 |
visual14.0 | visual15.x | visual16.x | visual9.0 |
Default:
generic |
Example 1 (Bug Finder):
polyspace-bug-finder -lang c -sources |
Example 2 (Bug Finder):
polyspace-bug-finder -lang cpp -sources |
Example 1 (Code Prover):
polyspace-code-prover -lang c -sources |
Example 2 (Code Prover):
polyspace-code-prover -lang cpp -sources |
Example 1 (Bug Finder Server):
polyspace-bug-finder-server -lang c -sources |
Example 2 (Bug Finder Server):
polyspace-bug-finder-server -lang cpp -sources |
Example 1 (Code Prover Server):
polyspace-code-prover-server -lang c -sources |
Example 2 (Code Prover Server):
polyspace-code-prover-server -lang cpp -sources |
-target
You can specify a list of named processors with the option -target.
Parameter:
-target |
Value:
i386 | sparc | m68k | powerpc | c-167 | tms320c3x | sharc21x61 | necv850 | hc08 | hc12 | mpc5xx | c18 | x86_64 | mcpu |
Default:
i386 |
Example (Bug Finder):
polyspace-bug-finder -target m68k |
Example (Code Prover):
polyspace-code-prover -target m68k |
Example (Bug Finder Server):
polyspace-bug-finder-server -target m68k |
Example (Code Prover Server):
polyspace-code-prover-server -target m68k |
For more information on the details for the named processors, see -target. Note that the option -target mcpu indicates a custom processor. With -target
mcpu and other named processors, you can use another set of options to modify the default processor properties. This is an alternative to using the option -custom-target.