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
C and C++


The borland Compiler Model

The borland compiler model models the behavior of the Borland C++ compiler for Win32 and the Embarcadero C++ compiler for Win32.



Overview

The following file extensions are supported:

Compiler model Modeled native compilers Source file extensions Description
borland Borland C++ compiler for Win32 and Embarcadero C++ compiler for Win32 .c, .C C source files.
.cc, .ccp, .ccx, .cp, .cpp, .cpx, .cx, .cxp, .cxx (case-insensitive) C++ source files.

Availability

Platform Availability The borland compiler model is available for Windows only.
Default Recognition/Handling By default, compilations are recognized and handled as follows.
Platform Native Compiler Model Used
Windows only bcc32.exe borland
Specifying Additional Mappings If your compiler executable has a different name, specify a corresponding COMPILER_MODELS rule to map your executable name to the borland model.

Embarcadero Notes

For full details of all native compilers recognized by CodeSonar by default, see section Compilers Recognized by CodeSonar.

Command Arguments

The borland compiler model supports the following command arguments.

Option Additional Treatment in Model
@file Extracts the options specified in file and appends them to the command line.
+file Extracts the options specified in file and appends them to the command line.
-a- Specifies front end option --pack_alignment=1.
-aval
-a val
If val is an integer such that 1≤val<8, specifies front end option --pack_alignment=val. Otherwise, no additional handling.
-A
-Aval
-A val
If val is n, specifies front end option --c99. Otherwise, no additional handling.
-b Any earlier occurrence of -b- will not incur the described additional handling.
-b- Specifies front end option --short_enums.
-Dmlist
-D mlist
For each m in the semicolon-separated string mlist, specifies front end option -Dm. Each m may be a macro name or a macro=defn rule.
-Idlist
-I dlist
For each directory dir in the semicolon-separated string dlist, specifies front end option -Idir.
-K Specifies front end option --unsigned_chars (in all other cases, specifies front end option --signed_chars). Supersedes any previous occurrence of -K-.
-K- Any earlier occurrence of -K will not incur the described additional handling.
-P
-Pext
-P ext
Sets compilation mode to C++ for both C and C++ source files (as identified by file extension).

If ext is specified, only source files with (case-insensitive) extension .ext will be treated as C++. This is in addition to the default C++ extension list provided in the overview. If -Pext is specified multiple times, only the last ext value will be used.

-P- Supersedes the compilation mode effects of any previous occurrence of -P (with or without argument).

Note: does not affect changes to recognized C++ file extensions due to -Pext.

--replacehdr=fname
--replacehdr fname
Specifies front end option --cs_ext_header_map fname.
-RT Specifies front end option --rtti. Supersedes any previous occurrence of -RT-.
-RT- Specifies front end option --no_rtti. Supersedes any previous occurrence of -RT or --xrtti.
--sysinc=dir
--sysinc dir
Specifies front end option --sys_include dir. If --sysroot=s has been specified for some nonempty s, also specifies front end option --sys_include s/dir.
--sysroot=s
--sysroot s
Specifies an additional root directory to use in handling --sysinc arguments.
-tWM Defines macro __MT__=1.
-Umlist
-U mlist
For each macro m in the semicolon-separated string mlist, specifies front end option -Um.
-VI- Specifies front end option -I..
--xrtti Specifies front end option --rtti. Supersedes any previous occurrence of -RT-.

Compilation Mode

The compilation mode controls some of the front end options specified by the model. Compilation mode depends on the modeled build command as follows.

Source File Extension Compilation Mode
.c, .C
-P specified
(with or without argument)
C++ mode
-P not specified
(or superseded by subsequent -P-)
C mode
.cc, .ccp, .ccx, .cp, .cpp, .cpx, .cx, .cxp, .cxx
(case insensitive)
C++ mode
.ext
where the modeled command line includes argument -Pext. The file extension is case insensitive.
C++ mode
otherwise compilation not modeled

Macros, Front End Options, and Predefined Paths

The borland compiler model defines the following macros.

Macros Always Defined _M_IX86=300
Macros Conditionally Defined
_CHAR_UNSIGNED =1 if -K is not specified, or is specified but all occurrences are superseded by a later occurrence of -K-.
__MT__ =1 when -tWM is specified.
Front End Options Always Specified The borland model specifies --wchar_t_keyword when compilation mode is C++.
Front End Options Conditionally Specified
--c99 When -An is specified (with no subsequent occurrence of -A or -Aval).
--cs_ext_header_map fname when --replacehdr=fname is specified.
--no_rtti if neither -RT nor --xrtti is specified, or if every occurrence is superseded by a subsequent occurrence of -RT-.
--pack_alignment=val When -aval is specified with val an integer such that 1≤val<8.
--rtti if -RT or --xrtti is specified without a subsequent occurrence of -RT-.
--short_enums if -b- is specified without a subsequent occurrence of -b.
--signed_chars if -K is not specified, or if every occurrence is superseded by a subsequent occurrence of -K-.
--unsigned_chars if -K is specified without a subsequent occurrence of -K-.
System Include Directories The model will specify system include directories with one or more --sys_include D settings as follows.
  • --sys_include includebase is always specified, where includebase is the Include/ subdirectory of the directory above the one containing the native compiler executable.

    For example, if the native compiler path is path/to/bcc32.exe, then includebase is path/Include/.

  • If CodeSonar is able to deduce that the native compiler is Embarcadero C++, the following are also specified (where--sys_include includebase is defined as described above).
    • --sys_include includebase/dinkumware
    • --sys_include includebase/windows
    • --sys_include includebase/windows/crtl
    • --sys_include includebase/windows/fmx
    • --sys_include includebase/windows/rtl
    • --sys_include includebase/windows/sdk
    • --sys_include includebase/windows/vcl
  • --sys_include dirname will be specified for every --sysincdirname command argument encountered.
 

To report problems with this documentation, please visit https://support.codesecure.com/.