绿丘编译器 (-compiler greenhills
)
指定 Green Hills 编译器
描述
如果使用 Green Hills® 编译器编译代码,请在编译器 (-compiler)
处指定 greenhills。当您使用的语法不是标准语法,而是来自语言扩展时,通过指定您的编译器,可以避免此类语法导致编译错误。
然后,指定您的目标处理器类型。如果将编译器设置为 greenhills,则在 Polyspace® 桌面端产品的用户界面中,您只会看到允许用于 Green Hills 编译器的处理器。您选择的目标处理器决定了基础数据类型的大小、目标计算机的端序,以及特定的关键字定义。
如果指定了 greenhills 编译器,则必须指定编译器头文件的路径。请参阅为 Polyspace 分析提供标准库头文件。
设置
对于各个基础类型,目标使用以下默认大小(以位为单位)。您在 Polyspace 桌面端产品的用户界面中看不到这些大小。
目标 | char | short | int | long | long long | float | double | long double | ptr | char 默认符号 | 端序 | 对齐 | size_t 的定义 | wchar_t 的定义 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
powerpc | 8 | 16 | 32 | 32 | 64 | 32 | 64 | 64 | 32 | 无符号 | Big | 64 | unsigned int | long |
powerpc64 | 8 | 16 | 32 | 64 | 64 | 32 | 64 | 64 | 64 | 无符号 | Big | 64 | unsigned long | int |
arm | 8 | 16 | 32 | 32 | 64 | 32 | 64 | 64 | 32 | 无符号 | Little | 32 | unsigned int | unsigned short |
arm64 | 8 | 16 | 32 | 64 | 64 | 32 | 64 | 64 | 64 | 无符号 | Little | 64 | unsigned long | int |
tricore | 8 | 16 | 32 | 32 | 64 | 32 | 64 | 64 | 32 | signed | Little | 32 | unsigned int | unsigned int |
rh850 | 8 | 16 | 32 | 32 | 64 | 32 | 64 | 64 | 32 | signed | Little | 64 | unsigned int | long |
i386 | 8 | 16 | 32 | 32 | 64 | 32 | 64 | 96 | 32 | signed | Little | 32 | unsigned int | long |
x86_64 | 8 | 16 | 32 | 64 | 64 | 32 | 64 | 128 | 64 | signed | Little | 128 | unsigned long | int |
您的编译器设定还决定了许多编译器特定的宏的值。如果要了解 Polyspace 如何定义特定宏,请使用 -dump-preprocessing-info
选项。
要覆盖宏定义,请使用
预处理器定义 (-D)
选项。要取消定义某个宏,请使用
已禁用的预处理器定义 (-U)
选项。
提示
如果您在进行 Polyspace 分析时遇到错误,请参阅 Fix Polyspace Compilation Errors Related to Green Hills Compiler。
Polyspace 支持 i386 目标的嵌入式配置。如果您的 x86 Green Hills 编译器配置为本地 Windows® 开发,则可能会看到 Code Prover 显示编译错误或分析结果不正确。联系技术支持。
例如,Green Hills 编译器为嵌入式目标将
long double
的大小设为 12 字节,但对于原生 Windows 则设为 8 字节。Polyspace 默认使用 12 字节。如果您使用 Green Hills 编译器从编译命令创建了一个 Polyspace 工程,则编译器选项
-os_dir
不会在工程中实现。要模拟-os_dir
选项,您可以显式地将该选项的路径参量作为包含文件夹添加到 Polyspace 工程中。如果您使用 IDE 中的 Polyspace as You Code 扩展,请在分析选项文件中输入此选项。请参阅选项文件。
命令行信息
参数:-compiler greenhills -target |
值:powerpc | powerpc64 | arm | arm64 | tricore | rh850 | arm | i386 | x86_64 |
默认值:powerpc |
示例 (Bug Finder):polyspace-bug-finder -compiler greenhills -target arm |
示例 (Code Prover):polyspace-code-prover -compiler greenhills -target arm |
示例 (Bug Finder Server):polyspace-bug-finder-server -compiler greenhills -target arm |
示例 (Code Prover Server):polyspace-code-prover-server -compiler greenhills -target arm |