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 |
The Windows cl compiler model models the behavior of the Microsoft Visual C compiler.
The cl compiler model supports the following file extensions:
| Compiler model |
Modeled native compiler | Source file extensions | Description |
|---|---|---|---|
| cl | cl | .c, .cpp, .cxx (case insensitive) | Microsoft's C/C++ compiler. Source file extensions indicate the source language. Extension .c indicates the C language; extensions .cpp and .cxx indicate C++. The language can be explicitly specified by /TC or /Tcfile (for C) or /TP or /Tpfile (for C++). |
| Platform Availability | The cl compiler model is available for all platforms. | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Default Recognition/Handling | By default, compilations
are recognized and handled as follows.
|
||||||||||||||||||
| Specifying Additional Mappings | If your compiler executable has a different name, specify a corresponding COMPILER_MODELS rule to map your executable name to the cl model. |
For full details of all native compilers recognized by CodeSonar by default, see section Compilers Recognized by CodeSonar.
The model-specific ABI key format for the cl compiler model is:
as
If an ABI key with this format is specified for a compilation that is modeled with the cl compiler model, the following settings will be applied. These settings take precedence over those determined by invoking cl.
Suppose we want to specify that cl compilations should be modeled as if the target is x64, the cl version is 1600, and the cl build number is 40219 (that is, Visual C++ 10.0 SP1). Then we add the following rule to the configuration file.
COMPILER_MODELS += cl.exe -> cl:x64.1600.40219
For more information, see Compiler Models: ABI Keys.
The following table lists command arguments that receive additional treatment in the cl compiler model.
| Argument | Additional Treatment in Model | |||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @file | Extracts the options specified in file and appends them to the command line. | |||||||||||||||||
| /AIdirname | -AIdirname | Passed to native compiler invocation; no additional handling in model. | ||||||||||||||||
| /arch[:arg] | -arch[:arg] | Controls value of macro _M_IX86_FP. | ||||||||||||||||
| /await | -await | Specifies front end option --ms_await. | ||||||||||||||||
| /C | -C | Specifies front end option -C. | ||||||||||||||||
| /clr[:arg] | -clr[:arg] |
Handling depends on the version
and on the value of arg
if specified, as shown in the following table.
|
||||||||||||||||
| /constexpr:deptharg /constexpr:backtracearg /constexpr:stepsarg |
-constexpr:deptharg -constexpr:backtracearg -constexpr:stepsarg |
Passed to native compiler invocation; no additional handling in model. | ||||||||||||||||
| /Dmacro | -Dmacro | Defines macro macro to 1. See note on /D, /U evaluation order. | ||||||||||||||||
| /Dmacro=defn | -Dmacro=defn | Defines macro macro with defn as its definition. See note on /D, /U evaluation order. | ||||||||||||||||
| /EHa | -EHa | Defines macro _CPPUNWIND. | ||||||||||||||||
| /EHa- | -EHa- | Undefines macro _CPPUNWIND. | ||||||||||||||||
| /EHs | -EHs | Defines macro _CPPUNWIND. | ||||||||||||||||
| /EHs- | -EHs- | Undefines macro _CPPUNWIND. | ||||||||||||||||
| /experimental:preprocessor | -experimental:preprocessor | Specifies front end option --ms_std_preprocessor. | ||||||||||||||||
| /Farg | -Farg | Passed to native compiler invocation; no additional handling in model. | ||||||||||||||||
| /Feprojname | -Feprojname | Sets the CodeSonar project name to projname. | ||||||||||||||||
| /FIfilename | -FIfilename | Specifies front end option --preinclude filename. | ||||||||||||||||
| /Fparg | -Fparg | Specifies front end option --cs_pch_name arg. | ||||||||||||||||
| /FUfilename | -FUfilename | Specifies front end option --preusing filename. | ||||||||||||||||
| /G5 | -G5 |
|
||||||||||||||||
| /G6 | -G6 |
|
||||||||||||||||
| /G7 | -G7 |
|
||||||||||||||||
| /GB | -GB |
|
||||||||||||||||
| /Gd | -Gd | Specifies front end option --default_calling_convention __cdecl. | ||||||||||||||||
| /Gr | -Gr | Specifies front end option --default_calling_convention __stdcall. | ||||||||||||||||
| /GR | -GR | Defines macro _CPPRTTI and specifies front end option --rtti. | ||||||||||||||||
| /GR- | -GR- | Affects definition of macro _CPPRTTI. | ||||||||||||||||
| /GX | -GX | Defines macro _CPPUNWIND. | ||||||||||||||||
| /GX- | -GX- | Undefines macro _CPPUNWIND. | ||||||||||||||||
| /Gz | -Gz | Specifies front end option --default_calling_convention __fastcall. | ||||||||||||||||
| /Harg | -Harg | Passed to native compiler invocation; no additional handling in model. | ||||||||||||||||
| /Idir | -Idir | Append directory dir to the list of directories searched for include files. | ||||||||||||||||
| /J | -J | Defines macro _CHAR_UNSIGNED and specifies front end option --unsigned_chars. | ||||||||||||||||
| /kernel | -kernel | Specifies front end options --no_exceptions and --no_rtti; defines macro _KERNEL_MODE. | ||||||||||||||||
| /kernel- | -kernel- | Any earlier occurrence of /kernel will not incur the described additional treatment. | ||||||||||||||||
| /LDd | -LDd | If version is Visual C++ 7.0 or later, defines macro _DEBUG. | ||||||||||||||||
| /MD, /MDd | -MD, -MDd | Defines macros _DLL and _MT. If /MDd, also defines macro _DEBUG. | ||||||||||||||||
| /MLd | -MLd | Defines macro _DEBUG. | ||||||||||||||||
| /MT, /MTd | -MT, -MTd | Defines macro_MT. If /MTd, also defines macro _DEBUG. | ||||||||||||||||
| /openmp | -openmp | If version is Visual Studio 2005 or later, defines macro _OPENMP=200203. | ||||||||||||||||
| /RTC | -RTC | Defines macro__MSVC_RUNTIME_CHECKS=1. | ||||||||||||||||
| /std:c11 | -std:c11 | Specifies front end option --ms_c11. | ||||||||||||||||
| /std:c17 | -std:c17 | Specifies front end option --c17. | ||||||||||||||||
| /std:c++14 | -std:c++14 | Specifies front end option --ms_c++14; affects setting of macro _MSVC_LANG. | ||||||||||||||||
| /std:c++17 | -std:c++17 | Specifies front end option --ms_c++17; affects setting of macro _MSVC_LANG. | ||||||||||||||||
| /std:c++latest | -std:c++latest | Specifies front end option --ms_c++latest; affects setting of macro _MSVC_LANG. | ||||||||||||||||
| /TC | -TC | Compile all files as C (takes precedence over /Tpfname). | ||||||||||||||||
| /Tcfname | -Tcfname | Treat fname as a C source file. | ||||||||||||||||
| /TP | -TP | Compile all files as C++ (takes precedence over /Tcfname ). | ||||||||||||||||
| /Tpfname | -Tpfname | Treat fname as a C++ source file. | ||||||||||||||||
| /Umacro | -Umacro | Undefines macro macro. See note on /D, /U evaluation order. | ||||||||||||||||
| /Varg | -Varg | Passed to native compiler invocation; no additional handling in model. | ||||||||||||||||
| /w | -w | Passed to native compiler invocation; no additional handling in model. | ||||||||||||||||
| /w1arg /w2arg /w3arg /w4arg |
-w1arg -w2arg -w3arg -w4arg |
Passed to native compiler invocation; no additional handling in model. | ||||||||||||||||
| /wdarg /woarg |
-wdarg -woarg |
Passed to native compiler invocation; no additional handling in model. | ||||||||||||||||
| /Wearg | -Wearg | Passed to native compiler invocation; no additional handling in model. | ||||||||||||||||
| /Wp64 | -Wp64 | If version is Visual C++ 7.0, 7.1, 8.0 or 9.0, defines macro_Wp64=1. | ||||||||||||||||
| /Yc /Ycarg |
-Yc /Ycarg |
Specifies front end option --cs_create_pch. If arg is present, also specifies front end option --cs_create_pch_hdrstop arg. |
||||||||||||||||
| /Yu /Yuarg |
-Yu /Yuarg |
Specifies front end option --cs_use_pch. If arg is present, also specifies front end option --cs_use_pch_hdrstop arg. |
||||||||||||||||
| /Za | -Za | Defines macro _MSC_EXTENSIONS. | ||||||||||||||||
| /Zc:forscope | -Zc:forscope | Specifies front end option --new_for_init. | ||||||||||||||||
| /Zc:forscope- | -Zc:forscope- | Specifies front end option --old_for_init. | ||||||||||||||||
| /Zc:preprocessor | -Zc:preprocessor | Specifies front end option --ms_std_preprocessor. | ||||||||||||||||
| /Zc:ternary | -Zc:ternary | Specifies front end option --ms_strict_ternary. | ||||||||||||||||
| /Zc:ternary- | -Zc:ternary- | Specifies front end option --no_ms_strict_ternary. | ||||||||||||||||
| /Zc:wchar_t | -Zc:wchar_t | Specifies front end option --wchar_t_keyword. | ||||||||||||||||
| /Zc:wchar_t- | -Zc:wchar_t- | Specifies front end option --no_wchar_t_keyword. | ||||||||||||||||
| /Zl | -Zl | If version is Visual C++ 8.0 and later, defines macro_VC_NODEFAULTLIB=1. | ||||||||||||||||
| /Zs | -Zs | Specifies front end option --no_code_gen. | ||||||||||||||||
The evaluation order for /D and /U instances on the command line depends on the version being used.
| Visual C++ 7.0 and later | Instances of /D and /U on the command line are processed in order of appearance. |
|---|---|
| Earlier versions: | All instances of /D on the command line are processed before any /U instances. |
If any of the following are specified, CodeSonar will ignore the compilation and will not generate any corresponding internal representation. If a CodeSonar project is based only on ignored compilations, it will have no contents and so will not be finalized.
Predefined macros and include paths are listed below.
| Paths |
The cl compiler model...
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Macros Always Defined |
The cl compiler model defines
the following in addition to the standard CodeSonar
predefined macros.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Conditionally Defined Macros |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Front End Options |
The following front end options are always specified.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Environment Variables | The Visual C++ setup program creates a batch file called VCVARS32.BAT (for MS Visual Studio version 6) or VSVARS32.BAT (for MS Visual Studio .NET) which automatically sets up all of the Visual Studio environment variables that the cl compiler model relies upon. This batch file can be found in the /bin subdirectory of the Visual Studio installation directory. |
The cl compiler model determines version number, build number, revision number, and build target as follows, in order of precedence.
The build environment is 64-bit if the build target is x64, itanium, or ddk64; 32-bit otherwise.
To report problems with this documentation, please visit https://support.codesecure.com/.