Contenido principal

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:

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

generic

Analysis allows only standard syntax.

The language standard is determined by your choice for the following options:

Standard Compilers

gnux.x

The 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.x

The 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.x

The 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 polyspaceroot\polyspace\verifier\extensions, open the XML file with the same name as the compiler, and search for:

target name="processorName"
Here, 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 - arm

Analysis 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 polyspaceroot\polyspace\verifier\extensions\armcc.xml and search for the processor name, for instance:

target name="arm"

armclang - arm, armclang - arm64

Analysis 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 polyspaceroot\polyspace\verifier\extensions\armclang.xml and search for the processor name, for instance:

target name="arm"

codewarrior - s12z, codewarrior - powerpc

Analysis 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 polyspaceroot\polyspace\verifier\extensions\codewarrior.xml and search for the processor name, for instance:

target name="s12z"

cosmic - s12z

Analysis allows non-ANSI C syntax and semantics associated with the Cosmic compiler.

To see processor details such as sizes of types, open the file polyspaceroot\polyspace\verifier\extensions\cosmic.xml and search for the processor name, for instance:

target name="s12z"

diab - powerpc, diab - powerpc64, diab - arm, diab - coldfire, diab - i386, diab - mcore, diab - rh850, diab - superh, diab - tricore

Analysis 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 polyspaceroot\polyspace\verifier\extensions\diab.xml and search for the processor name, for instance:

target 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_64

Analysis 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 polyspaceroot\polyspace\verifier\extensions\greenhills.xml and search for the processor name, for instance:

target 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 - rl78

Analysis 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 polyspaceroot\polyspace\verifier\extensions\iar-ew.xml and search for the processor name, for instance:

target 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_64

Analysis 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 polyspaceroot\polyspace\verifier\extensions\intel.xml and search for the processor name, for instance:

target name="x86_64"

microchip - pic

Analysis 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 polyspaceroot\polyspace\verifier\extensions\microchip.xml and search for the processor name, for instance:

target name="pic"

renesas - rl78, renesas - rh850, renesas - rx, renesas - sh

Analysis allows non-ANSI C syntax and semantics associated with the Renesas® compiler.

To see processor details such as sizes of types, open the file polyspaceroot\polyspace\verifier\extensions\renesas.xml and search for the processor name, for instance:

target name="rl78"

tasking - tricore, tasking - c166, tasking - rh850, tasking - arm

Analysis allows non-ANSI C syntax and semantics associated with the TASKING compiler.

To see processor details such as sizes of types, open the file polyspaceroot\polyspace\verifier\extensions\tasking.xml and search for the processor name, for instance:

target 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 - msp430

Analysis 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 polyspaceroot\polyspace\verifier\extensions\ti.xml and search for the processor name, for instance:

target 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.

iar

Analysis allows non-ANSI C syntax and semantics associated with the compilers from IAR™ Systems (www.iar.com).

keil

Analysis 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.

  • If you use a Visual Studio compiler:

    • Set long long to 64 bits. See Processor. To set long long to 64 bit at the command line, use the option -long-long-is-64bits.

    • The plain char types in your code is interpreted as signed char because Visual Studio compilers do not support a plain char.

  • If you use the option Check JSF AV C++ rules (-jsf-coding-rules), 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 "file1.c,file2.c" -compiler gnu4.6
Example 2 (Bug Finder): polyspace-bug-finder -lang cpp -sources "file1.cpp,file2.cpp" -compiler visual9.0
Example 1 (Code Prover): polyspace-code-prover -lang c -sources "file1.c,file2.c" -lang c -compiler gnu4.6
Example 2 (Code Prover): polyspace-code-prover -lang cpp -sources "file1.cpp,file2.cpp" -compiler visual9.0
Example 1 (Bug Finder Server): polyspace-bug-finder-server -lang c -sources "file1.c,file2.c" -compiler gnu4.6
Example 2 (Bug Finder Server): polyspace-bug-finder-server -lang cpp -sources "file1.cpp,file2.cpp" -compiler visual9.0
Example 1 (Code Prover Server): polyspace-code-prover-server -lang c -sources "file1.c,file2.c" -lang c -compiler gnu4.6
Example 2 (Code Prover Server): polyspace-code-prover-server -lang cpp -sources "file1.cpp,file2.cpp" -compiler visual9.0

-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.

Version History

expand all