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 Wind River Compiler Driver Models

CodeSonar provides models for the Wind River C and C++ compiler drivers.



Overview

Compiler
model
Source file extensions Native driver Description
dcc .c, .cpp, .cxx, .cc, .C dcc Wind River C/C++ compiler driver that assumes C libraries. Model is based on diab5.0ppc.
dplus Wind River C/C++ compiler driver that assumes C++ libraries. Model is based on diab5.0ppc.
ccppc .c, .C, .cc, .cpp, .cxx, .ii ccppc Wind River version of GNU C compiler. Not recognized by default, because the name conflicts with the Green Hills compiler. Model is based on gcc model.
c++ppc .c, .C, .cc, .cpp, .cxx, .ii c++ppc Wind River version of GNU C compiler. Not recognized by default, for consistency with ccppc. Model is based on gpp model.

Availability

The Wind River models are available on all platforms.

For availability information, see the individual sections below.

Using the dcc Model

Wind River dcc and dplus are compiler drivers: they parse command lines and decide which compiler, assembler, and linker to invoke, and with what arguments. The CodeSonar dcc model bases the project build on these invocations.

Availability

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

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

Model-Specific ABI Key Format

The model-specific ABI key format for the dcc compiler model is:

<c_compiler>.<cpp_compiler>.<assembler>[.<user_string>]

as

string.string.string[.string]

If an ABI key with this format is specified for a compilation that is modeled with the dcc compiler model, the following settings will be applied.

Command Arguments and Language Extensions

The dcc compiler model provides specific handling for the following command line options. Other options are parsed but do not receive additional handling.

Option Additional Treatment in Model
-A- Various conditionally-defined macros will not be defined if this is specified.
-A pred(ident)
-Apred(ident)
Specifies front end option --cs_diab_assert pred(ident).
-Dmacro
-D macro
Defines macro macro to 1. -D and -U options are evaluated in order of appearance
-Dmacro=defn
-D macro=defn
Defines macro macro with defn as its definition. -D and -U options are evaluated in order of appearance
-I@
Specifies front end options -I. and --cs_no_I_dot.
-Idir
-I dir
Specifies front end option -Idir.
-if1=f2
-i f1=f2
Specifies front end option --cs_diab_include_replace f1=f2.
-ifname=
-i fname =
Specifies front end option --cs_diab_include_replace fname=.
-i=fname
-i =fname
Specifies front end option --preinclude fname.
-Umacro
-U macro
Undefines macro macro. -D and -U options are evaluated in order of appearance
-w Specifies front end option -w.
-X12
-X12=n
-Xbit-fields-signed
-Xbit-fields-unsigned
-Xsigned-bitfields
-Xunsigned-bitfields
By default, the model treats bit fields as unsigned for C compilations. These arguments modify this treatment as follows; later arguments take precedence over earlier ones.
bit fields treated as options handling (C only)
signed -X12=0
-Xbit-fields-signed
-Xsigned-bitfields
Model specifies front end option -- cs_targ_plain_int_bit_field_is_signed.
unsigned (default)
-X12
-X12=n for n≠0
-Xbit-fields-unsigned
-Xunsigned-bitfields
Model specifies front end option -- cs_targ_plain_int_bit_field_is_unsigned.
-X119=4
-X119=44
-Xbool-is-char
-Xbool-is-int
By default, the model treats bool as if implemented as plain char for C++ compilations. These arguments modify the treatment as follows; later arguments take precedence over earlier ones.
bool implemented as options handling (C++ only)
plain char (default)
-X119=44
-Xbool-is-char
Model specifies front end option --cs_targ_bool_int_kind char.
signed int -X119=4
-Xbool-is-int
Model specifies front end option --cs_targ_bool_int_kind int.
-X213
-X213=n
-Xbool-off
-Xbool-on
By default, the model treats bool as enabled for C++ compilations. These arguments modify the enabling status as follows; later arguments take precedence over earlier ones.
bool options handling (C++ only)
enabled (default)
-X213=0
-Xbool-on
Model specifies front end option --bool and defines macro __bool=1 (unless -A- is specified).
disabled -X213
-X213=n for n≠0
-Xbool-off
Model specifies front end option --no-bool.
-Xc++-old
-Xc++-old=n
By default, the model will define macro __ETOA__=1 unless -A- is specified. If either of the following are specified, it will not define this macro.
  • -Xc++-old
  • -Xc++-old=n for n≠0
-X23
-X23=n
-Xchar-signed
-Xchar-unsigned
-Xsigned-char
-Xunsigned-char
By default, the model treats plain char as unsigned. These arguments modify the treatment of plain char as follows; later arguments take precedence over earlier ones.
plain char options handling
signed -X23=0
-Xchar-signed
-Xsigned-char
C and C++: Model specifies front end option --signed_chars.
C++ only: Model defines macro __SIGNED_CHARS__=1 (unless -A- is specified).
unsigned (default)
-X23
-X23=n for n≠0
-Xchar-unsigned
-Xunsigned-char
C and C++: Model specifies front end option --unsigned_chars.
-X7
-X7=n
-X230
-X230=n
-Xa
-Xansi
-Xc
-Xdialect-ansi
-Xdialect-c89
-Xdialect-c99
-Xdialect-k-and-r
-Xdialect-pcc
-Xdialect-strict-ansi
-Xk-and-r
-Xpcc
-Xstrict-ansi
-Xt
Language mode determines some of the macros and front end options specified by the model. By default, the model uses ANSI mode. These arguments modify the language mode as follows; later arguments take precedence over earlier ones. Note that option -Xc-mode also modifies language mode.
language mode options handling
ANSI (default)
-X7
-X7=1
-X7=n for n≥5
-Xa
-Xansi
-Xdialect-ansi
C and C++: Model defines macro__STDC__=0 (unless -A- is specified).
KR -X7=0
-Xdialect-k-and-r
-Xk-and-r
-Xt
C++ only: Model defines macro__STDC__=0 (unless -A- is specified).
STRCT -X7=2
-Xc
-Xdialect=c89
-Xdialect-strict-ansi
-Xstrict-ansi
C only: Model specifies front end option --strict.
C and C++: Model defines macros __STDC__=1 and __STRICT_ANSI__=1 (unless -A- is specified).
PCC -X7=3
-Xdialect-pcc
-Xpcc
C++ only: Model defines macro__STDC__=0 (unless -A- is specified).
C99 -X7=4
-X230
-X230=n for n≠0
-Xdialect-c99
C only: Model specifies front end option --c99.
-X202
-X202=n
-Xdigraphs-off
-Xdigraphs-on
-Xno-digraphs
By default, the model treats digraphs as enabled for C++ compilations. These arguments modify the enabling status as follows; later arguments take precedence over earlier ones.
digraphs options handling (C++ only)
enabled (default)
-X202=0
-Xdigraphs-on
Model specifies front end option --alternative_tokens.
disabled -X202
-X202=n for n≠0
-Xdigraphs-off
-Xno-digraphs
Model specifies front end option --no_alternative_tokens.
-X67
-X67=n
-Xdollar-in-ident
By default, the model does not accept dollar signs in identifiers. These options modify this treatment as follows; later arguments take precedence over earlier ones.
dollar signs in identifiers options handling
accepted -X67
-X67=n for n≠0
-Xdollar-in-ident
Model specifies front end option --dollar.
not accepted (default)
-X67=0
No additional handling.
-X8
-X8=n
-Xenum-is-best
-Xenum-is-int
-Xenum-is-short
-Xenum-is-small
-Xenum-is-unsigned

By default, the model treats enum type as unspecified. These options modify the type as follows; later arguments take precedence over earlier ones.

enum type options handling
BEST -X8=2
-Xenum-is-best
C and C++: Model specifies front end options --cs_targ_enum_types_can_be_smaller_than_int and --short_enums.
INT -X8
-X8=1
-X8=n for n≥5
-Xenum-is-int
No additional handling.
SHORT -X8=3
-Xenum-is-short
C and C++: Model specifies front end option --cs_targ_enum_types_can_be_smaller_than_int.
SMALL -X8=0
-Xenum-is-small
C and C++: Model specifies front end options --cs_targ_enum_types_can_be_smaller_than_int and --short_enums.
UNSIGNED -X8=4
-Xenum-is-unsigned
No additional handling.
UNSPECIFIED (default) C++ only: Model specifies front end options --cs_targ_enum_types_can_be_smaller_than_int and --short_enums.
-X200
-X200=n
-Xexception
-Xexceptions
-Xexceptions-off
-Xno-exceptions
By default, the model treats exception handling as enabled for C++ compilations. These arguments modify the enabling status as follows; later arguments take precedence over earlier ones.
exception handling options handling (C++ only)
enabled (default)
-X200
-X200=n for n≠0
-Xexceptions
-Xexception
Model specifies front end option --exceptions and defines macro __EXCEPTIONS=1 (unless -A- is specified).
disabled -X200=0
-Xexceptions-off
-Xno-exceptions
Model specifies front end option --no_exceptions.
-X217
-X217=n
-Xfor-init-scope-for
-Xfor-init-scope-outer
-Xold-scoping
By default, the model uses "new" for scope rules for C++ compilations. These options modify the enabling status as follows; later arguments take precedence over earlier ones.
for scope rules options handling (C++ only)
"new" -X217=0
-Xfor-init-scope-for
Model specifies front end option --new_for_init.
(A for statement has its own implicit scope.)
"old" (default)
-X217
-X217=n for n≠0
-Xfor-init-scope-outer
-Xold-scoping
Model specifies front end option --old_for_init.
(A declaration in a for statement belongs to the scope to which the for statement belongs.)
-X207
-X207=n
-Ximplicit-templates
-Ximplicit-templates-off
-Xno-implicit-template
By default, the model treats templates as implicitly instantiated for C++ compilations. These options modify this treatment as follows; later arguments take precedence over earlier ones.
template instantiation options handling (C++ only)
implicit (default)
-X207=0
-Ximplicit-templates
Model specifies front end option --auto_instantiation.
explicit only -X207
-X207
=n for n≠0
-Ximplicit-templates-off
-Xno-implicit-template
No additional handling.
-X75
-X75=n
-Ximport
By default, the model does not treat #include directives as #import directives. These options modify the treatment as follows; later arguments take precedence over earlier ones.
#include treated as #import? options handling
YES -X75
-X75=n for n≠0
-Ximport
Model specifies front end option --cs_diab_include_as_import.
NO (default)
-X75=0
No additional handling.
-Xincfile-missing-ignore Specifies front end option --cs_ignore_missing_include.
-X219
-X219=n
-Xnamespace-on
-Xnamespace-off
By default, the model recognizes namespace and using constructs in C++ compilations. These options modify the enabling status as follows; later arguments take precedence over earlier ones.
namespace and using options handling (C++ only)
recognized (default)
-X219=0
-Xnamespace=on
Model specifies front end option --namespaces.
not recognized -X219
-X219=n for n≠0
-Xnamespace=off
Model specifies front end option --no_namespaces.
-X205
-X205=n
-Xno-rtti
-Xrtti
-Xrtti-off
By default, the model treats RTTI as enabled for C++ compilations. These options modify the enabling status as follows; later arguments take precedence over earlier ones.
RTTI options handling (C++ only)
enabled (default)
-X205
-X205=n for n≠0

-Xrtti
Model specifies front end option --rtti and defines macro __RTTI=1 (unless -A- is specified).
disabled -X205=0
-Xno-rtti
-Xrtti-off
Model specifies front end option --no_rtti.
-Xusing-std-on
-Xusing-std-off
By default, the model treats implicit use of the std namespace as enabled for C++ compilations. These arguments modify the enabling status as follows; later arguments take precedence over earlier ones.
implicit use of std options handling (C++ only)
enabled (default)
-using-std-on
Model specifies front end option --using_std and defines macro __ETOA_IMPLICIT_USING_STD=1 (unless -A- is specified).
disabled -using-std-off Model specifies front end option --no_using_std.
-Xvoid-ptr-arith-ok C compilations only: model specifies front end option --cs_void_ptr_arith.
-X214
-X214=n
-Xwchar_t-on
-Xwchar_t-off
-Xno-wchar
By default, the model treats the wchar_t keyword as enabled for C++ compilations. These arguments modify the enabling status as follows; later arguments take precedence over earlier ones.
wchar_t keyword options handling (C++ only)
enabled (default)
-X214=0
-Xwchar_t-on
Model specifies front end option --wchar_t_keyword and defines macro __wchar_t=1 (unless -A- is specified).
disabled -X214
-X214=n for n≠0
-Xwchar_t-off
-Xno-wchar
Model specifies front end option --no_wchar_t_keyword.
-Xc-mode
-Xc-mode=1
Compilations are modeled in C mode, even if the designated C++ compiler is invoked. Language mode is set to C99.
-X86=n
-Xwchar=n
Sets the corresponding type for wchar_t as specified by n. If these options are not specified, or are specified with an empty argument, the default value is 4.
The model specifies front end option --cs_targ_sizeof_wchar_t n exactly once per modeled compilation. Later arguments take precedence over earlier ones.
-X78=mask
-Xkeywords=mask
Sets the keyword mask to mask. If these options are not specified, or are specified with an empty argument, the default value is 0x0
The model specifies front end option --cs_diab_keywords mask exactly once per modeled compilation. Later arguments take precedence over earlier ones.

No CodeSonar Build

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.

Modeled Compilation Mode

The dcc model is applied to each compiler invocation from the compiler driver.

We use the following definitions.

designated C compiler If a model-specific ABI key is provided, the compiler specified in its first position. Otherwise, ctoa.
designated C++ compiler If a model-specific ABI key is provided, the compiler specified in its second position. Otherwise, etoa.
designated assembler If a model-specific ABI key is provided, the assembler specified in its third position. Otherwise, das.

Then the modeled compilation mode for each invocation is determined as follows.

Macros, Include Paths, Front End Options

Include Directories The model always specifies the following include directories. base_include_dir is compdir/../../include where compdir is the native compiler installation directory.
  • -I base_include_dir
  • -I base_include_dir/diab
  • -I base_include_dir/cpp
  • -I base_include_dir/cpp/std
Front End Options Always Specified The model always specifies the following front end options.
--asm_functions -
--cs_allow_empty_braced_init -
--cs_diab_keywords mask where mask is the keyword mask (default 0)
--cs_targ_sizeof_wchar_t n where n denotes the corresponding type for wchar_t (default 4)
--extended_variadic_macros -
Front End Options Conditionally Specified

The following front end options depend on modeled compilation mode and the specified command options.

C compilations only

--c99 if language mode is c99
--cs_targ_plain_int_bit_field_is_unsigned if bit fields are unsigned
--cs_targ_plain_int_bit_field_is_signed if bit fields are signed
--cs_void_ptr_arith if -Xvoid-ptr-arith-ok is specified
--strict if language mode is STRCT

C++ compilations only

--alternative_tokens if digraphs are enabled
--auto_instantiation if templates are implicitly instantiated
--bool if bool is enabled
--cs_targ_bool_int_kind k where the value of k depends on the implementation of bool.
--cs_targ_enum_types_can_be_smaller_than_int if enum type is UNSPECIFIED
--exceptions if exception handling is enabled
--namespaces if namespace and using are recognized
--new_for_init if new for scope rules are used
--no_alternative_tokens if digraphs are disabled
--no_bool if bool is disabled
--no_exceptions if exception handling is disabled
--no_namespaces if namespace and using are not recognized
--no_rtti if RTTI is disabled
--no_using_std if implicit use of the std namespace is disabled
--no_wchar_t_keyword if wchar_t keyword is disabled
--old_for_init if old for scope rules are used
--rtti if RTTI is enabled
--short_enums if enum type is UNSPECIFIED
--using_std if implicit use of the std namespace is enabled
--wchar_t_keyword if wchar_t keyword is enabled

C and C++ compilations

--cs_diab_include_as_import if #include directives are treated as #import directives
--cs_targ_enum_types_can_be_smaller_than_int if enum type is BEST or SHORT or SMALL
--dollar if dollar signs are_accepted in identifiers
--cs_ignore_missing_include if -Xincfile-missing-ignore is specified
--short_enums if enum type is BEST or SMALL
--signed_chars if plain char is signed
--unsigned_chars if plain char is unsigned
Macros Always Defined The following macros are defined for all uses of the dcc compiler model.
-D__attribute__(x) =1
Macros Conditionally Defined

The following macros are only defined if option -A- is not specified. Additional constraints are noted below.

C and C++ compilations

__DCC__ =1 -
__STDC__ =1 if language_mode is STRCT
__STDC__ =0 if language_mode is ANSI (includes default case)
__STRICT_ANSI__ =1 if language_mode is STRCT

C++ compilations only

__bool =1 if bool is enabled
__DCPLUSPLUS__ =1 -
__ETOA__ =1 if -Xc++-old is not specified
__ETOA_IMPLICIT_USING_STD =1 if implicit use of the std namespace is enabled
__ETOA_NAMESPACES =1 -
__EXCEPTIONS =0 if exception handling is enabled
__RTTI =1 if RTTI is enabled (includes default case)
__SIGNED_CHARS__ =1 if plain char is signed
__STDC__ =0 if language_mode is KR or PCC
__wchar_t =1 if wchar_t is enabled (includes default case)

Using the ccppc and c++ppc Models

Availability

Platform Availability The ccppc and c++ppc compiler models are available for all platforms.
Default Recognition/Handling The models are disabled by default on all platforms.
Specifying Mappings CodeSonar does not recognize Wind River ccppc or c++ppc compilations by default. When you are building a project with one or both of these, they must be explicitly enabled using the COMPILER_MODELS configuration file parameter.

Windows:

COMPILER_MODELS += ccppc.exe -> ccppc
COMPILER_MODELS += c++ppc.exe -> c++ppc

Other systems:

COMPILER_MODELS += ccppc -> ccppc
COMPILER_MODELS += c++ppc -> c++ppc

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

Behavior

The ccppc and c++ppc models accept the same command arguments and define the same macros and include paths as the GNU compiler models.

 

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