JavaScript is not currently enabled, but is required for full CodeSonar manual search and browse functionality.
If you are viewing this file in your hub's Web GUI, enable JavaScript in your browser: you will also need it for GUI functionality.
If you opened this file directly from disk, your browser may be directly suppressing JavaScript functionality: certain browsers perform this suppression on local files (but not files delivered by web servers) for security reasons.
| CodeSonar® 9.2p0 | CONFIDENTIAL | CodeSecure Inc |
An object-code compiler is represented in CodeSonar by a compiler model.
CodeSonar emulates the interface of a set of standard C compilers for two reasons:
Note that it is not essential to use a compiler model specific to your object-code compiler. You only need to use a compatible model: one that processes command lines and defines preprocessor symbols in an adequate way for your program.
The compiler models available on your CodeSonar system will be a combination of pre-installed models and custom models (if any).
CodeSonar comes with a number of pre-installed compiler and compiler driver models:
| Model Name | Description | Availability (X=available) | |
|---|---|---|---|
| Linux | Windows | ||
| armcc | ARM Real View Compiler Tools C/C++ compiler | X | X |
| armclang | ARM Clang compiler | X | X |
| borland | Borland C++ for Win32, Embarcadero C++ for Win32 | . | X |
| c++ppc | Wind River version of GNU C compiler | X | X |
| c251 | Keil C251 C Compiler | . | X |
| c51 | Keil C51 C Compiler | . | X |
| cc | Generic C compiler | X | X |
| cc1 | GCC/LLVM internal C compiler | X | X |
| ccppc | Wind River version of GNU C compiler | X | X |
| ccrx | Renesas C/C++ compiler for RX family | . | X |
| ch38 | Renesas C/C++ compiler for H8S, H8/300 Series | X | X |
| chc12 | Freescale CodeWarrior for HC12 | X | X |
| cl | Microsoft C compiler | X | X |
| cl30 | Texas Instruments TMS320C3x/C4x Optimizing Compiler | X | X |
| cl6x | Texas Instruments TMS320C6000 Optimizing C/C++ Compiler | X | X |
| clang | Clang C compiler | X | X |
| clangpp | Clang C++ compiler | X | X |
| cosmic | Cosmic C compilers | X | X |
| cvavr | CodeVisionAVR C compiler | . | X |
| dcc | Wind River C and C++ compilers | X | X |
| ecomppc | Green Hills C Compiler | X | X |
| gcc | GNU Compiler Collection C Compiler | X | X |
| gpp | GNU Compiler Collection C++ Compiler | X | X |
| icc430 | IAR MSP430 compiler | X | X |
| icc78k | IAR Renesas 78k compiler | X | X |
| iccarm | IAR ARM compiler | X | X |
| iccavr | IAR AVR compiler | X | X |
| iccgeneric | IAR compilers not covered by specific models | X | X |
| iccm32c | IAR M32C compiler | X | X |
| iccrx | IAR Renesas RX compiler | X | X |
| iccstm8 | IAR STM8 compiler | X | X |
| iccv850 | IAR v850 compiler | X | X |
| iccm16c | IAR Renesas M16C/R8C compiler | X | X |
| mcc18 | MPLAB C18 C Compiler | X | X |
| mcc30 | MPLAB C30 C Compiler | X | X |
| mcpcom | Intel C/C++ compiler | X | X |
| mwccarm | Freescale CodeWarrior for Embedded ARM compiler | . | X |
| mwccmcf | Freescale CodeWarrior for ColdFire compiler | . | X |
| picc | Hi-Tech C compiler | X | X |
| qcc | QNX C/C++ compiler (C interface) | X | X |
| qpp | QNX C/C++ compiler (C++ interface) | X | X |
| shc | Renesas C/C++ compilers for the SuperH RISC engine family | X | X |
| shcpp | Renesas C/C++ compilers for the SuperH RISC engine family | X | X |
| tasking | The TASKING TriCore, PCP, and C166/ST10 compilers. | X | X |
| visualdsp | The SHARC, TigerSHARC and Blackfin compilers that ship with VisualDSP++ | X | X |
| xcc | Customizable C compiler | X | X |
Source files for these models are provided in $CSONAR/csurf/include.
Additional aliases for compiler models are specific to the operating system on which CodeSonar is installed:
| Operating System | Alias | Aliased to |
|---|---|---|
| All systems | cc | gcc |
| gxx | gpp | |
| g++ | gpp |
For full details of all native compilers and drivers that CodeSonar recognizes and maps to compiler models by default, see section Compilers Recognized by CodeSonar.
(Windows Only) CodeSonar provides special handling for builds with CodeWarrior installations that use DLLs: see Using CodeSonar With CodeWarrior for details.
If none of the available compiler models are suitable, a custom model will be required. For more information, see section Authoring Compiler Models.
The following sections describe the compiler models.
| Predefined Macros | C preprocessor macros that are defined for all C compiler models. |
| armcc Compiler Model | the ARM Real View Compiler Tools (RVCT) C compiler. |
| borland Compiler Model | Borland C++ for Win32, Embarcadero C++ for Win32 |
| cc1 Compiler Models | for use with compilers such as Rowley CrossWorks, which use the GCC/LLVM cc1 compiler internally but do not have a compiler driver. |
| cl Compiler Model | the Microsoft C/C++ compiler. |
| Clang Compiler Models | the Microsoft C/C++ compiler. |
| CodeVisionAVR Compiler Model | the CodeVisionAVR C compiler. |
| Cosmic Compiler Model | the Cosmic Software C compilers. |
| dcc Compiler Driver Model | the Wind River compiler driver models. |
| ecomppc Compiler Model | the GreenHills internal compiler. |
| Freescale CodeWarrior Compiler Models | the Freescale CodeWarrior compilers for HC12, Embedded ARM, and ColdFire |
| GNU Compiler Models | the GNU C/C++ compilers. |
| IAR Compiler Models | the IAR C/C++ compilers. |
| Keil Compiler Models | the Keil C51 and C251 C compilers |
| mcc18 Compiler Model | the MPLAB C18 C compiler. |
| mcc30 Compiler Model | the MPLAB C30 C compiler. |
| mcpcom Compiler Model | the Intel compiler. |
| picc Compiler Model | the Hi-Tech C compiler. |
| QNX Compiler Models | the QNX C/C++ compiler. |
| Renesas Compiler Models | the Renesas C/C++ compilers for RX family, H8S, H8/300 Series and the SuperH RISC engine family. |
| TASKING Compiler Model | the TASKING TriCore, PCP, and C166/ST10 compilers. |
| TI CodeComposer Compiler Model | Texas Instruments TMS320C6000 Optimizing C/C++ Compiler and TMS320C3x/C4x Optimizing Compiler. |
| Using CodeSonar With CodeWarrior | notes on building CodeSonar projects based on CodeWarrior builds. |
| Other Compiler Models | what to do if you are not using one of the standard compiler models. |
| Front-End Options | options to the front end that apply to all compiler models (unless otherwise notes). |
| What If I Have No Compiler? | using the xcc model to build a project when you have no compiler. |
CodeSonar allows users to associate compilation units with ABI keys.
CodeSonar provides three mechanisms for associating ABI keys with compilation units. In most cases, the COMPILER_MODELS mechanism (described first in the following list) will be the most suitable one.
COMPILER_MODELS += path/to/mycompiler -> gcc:mykey
EDG_FRONTEND_OPTIONS_APPEND += --cs_user_abi_key myprojkey
Note that this will not cause CodeSonar to generate or use a project-compiler configuration file whose name includes K. Only ABI keys specified with COMPILER_MODELS rules have this effect.
ABI keys fall into two classes.
The following compiler models provide model-specific ABI key formats. Note that all model-specific ABI key formats allow for optional, user-specified suffixes: this permits ABIs to be distinguished (and therefore have different project-compiler configuration files) even if they do not differ in the tuple of parameters specified by the key format.
See individual compiler model manual pages for further details, including annotated examples.
| Compiler Model | Model-Specific ABI Key Format | Example |
|---|---|---|
| ch38, shc, shcpp | <Hitachi_version>.<Renesas_version>.<forceC> or <Hitachi_version>.<Renesas_version>.<forceC>.<user_string> |
0x602.0x602.1 0x602.0x602.1.abi1 0x602.0x602.1.abi2 |
| cl | <build_target>.<cl_version>.<cl_build> or <build_target>.<cl_version>.<cl_build>.<user_string> |
x64.1600.40219 x64.1600.40219.thisABI x64.1600.40219.thatABI |
| dcc | <c_compiler>.<cpp_compiler>.<assembler> or <c_compiler>.<cpp_compiler>.<assembler>.<user_string> |
ctoa.etoa.das ctoa.etoa.das.yourABI ctoa.etoa.das.myABI |
| gcc, gpp | <pointer_size>.<gcc_version>.<gnu_mode>.<gcc_invoke> or <pointer_size>.<gcc_version>.<gnu_mode>.<gcc_invoke>.<user_string> |
32.30303.1.0 32.30303.1.0.abiA 32.30303.1.0.abiB |
CodeSonar predefines some macros. They can be divided into two categories: those that are always defined, and those that are defined for a particular compiler model. The following table shows the macros that are always defined.
| Macro | Description |
|---|---|
| __CSURF__ | Always defined to 1. |
| __CODESONAR__ |
[CodeSonar only] Always defined to 1.
(Not defined for CodeSurfer projects.) |
| __CSURF_VERSION__ | Defined to an integer encoding of the CodeSurfer version number. If the CodeSurfer version is MAJOR.MINOR, the value is MAJOR*1000+MINOR. |
| __CODESONAR_VERSION__ |
[CodeSonar only] Defined to an integer encoding of the
CodeSonar version number. If the CodeSonar version is
MAJOR.MINORpPATCHLEVEL, the value is
MAJOR*10000+MINOR*100+PATCHLEVEL.
(Not defined for CodeSurfer projects.) |
| __DATE__ | The current date as a string. |
| __FILE__ | Defined to be the name of the file in which the macro occurs. |
| __LINE__ | Defined to be the line number in the file on which the macro occurs. |
| __SIGNED_CHARS__ | Defined when plain char is signed. Always defined on all current platforms. |
| __STDC__ | Always defined to 0 by the front end, but is sometimes redefined by the compiler model. |
| __STDC_VERSION__ | Always defined to 199409L, but can be overwritten by command line option. Currently, only 199409L is allowed. |
| __TIME__ | The time of day as a string. |
The set of include directories for a modeled compilation will be those that are:
In previous releases, CodeSonar has transitioned to using compiler models implemented in C++, where previously the models were implemented in STk. STk compiler models are no longer supported. If you have previously implemented a custom STk compiler model and need assistance converting it to C++ or Python, contact CodeSecure.
To report problems with this documentation, please visit https://support.codesecure.com/.