C and C++


The TASKING Compiler Model

The tasking compiler model models the behavior of the TASKING TriCore, PCP, and C166/ST10 compilers.



Overview

The following file extensions are supported:

Source file extensions Description
.cc, .cpp, .cxx, .CPP, .CPP, .ii Always treated as a C++ source file.
otherwise (including no file extension) Treated as a C source file unless the native compiler name is cptc or cp166, in which case it is treated as a C++ source file.

Availability

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

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

Command Arguments

The following command arguments are interpreted by the tasking compiler model. All others are silently ignored by the model.

Argument Alias Additional Treatment in Model
--cpu val
--cpu=val
-C val
-Cval
Defines the following macros, unless superseded by a later occurrence of --cpu/-C.
  • __CPU__=can
  • __CPU_can__=1
where can is the canonicalized version of core or CPU name val: uppercased, hyphens replaced with underscores, and everything after the '.' character removed.
--define m
--define=m
-D m
-Dm
Defines macro m to 1.
--define m=d
--define=m=d
-D m=d
-Dm=d
Defines macro m to d.
- -I dir
-Idir
Specifies front end option -Idir.
--exceptions -x Defines macro __EXCEPTIONS=1.
- -fsigned-char Specifies front end option --signed_chars.
- -funsigned-char Specifies front end option --unsigned_chars.
--include-file fname
--include-file=fname
- Specifies front end option --preinclude fname.
--no-double -F Defines macro __DOUBLE_FP__=1.
--optimize
--optimize val
--optimize=val
-O
-O val
-Oval
Specifies front end option --optimize and defines macro __OPTIMIZE__=1.
If optional argument val is specified and is s, also defines macro __OPTIMIZE_SIZE__=1.
--option-file fname
--option-file=fname
-f fname
-ffname
Extracts the options specified in file and appends them to the argument list for processing.
--schar -s Specifies front end option --signed_chars.
--uchar -u Specifies front end option --unsigned_chars.
--undefine m -U m Undefines macro m.

Predefined Paths and Macros; Keyword Handling

Include path One or more -Idir settings will be specified, with the dir values determined as follows.
Preinclude path The model will specify --preinclude fname for every --include-file=fname specified on the command line.
Macros Always Defined The tasking compiler model defines the following in addition to the standard CodeSonar predefined macros.
__CORE_PCP2__ =1  
__CORE__ =PCP2  
__BUILD__ =082  
__REVISION__ =1  
__TASKING__ =1  
ptrdiff_t =unsigned int  
size_t =unsigned int  
ssize_t =int  
__malloc__ = (hard-defined)
__format(x,y,z)__ = (hard-defined)
__noreturn__ = (hard-defined)
Macros Conditionally Defined The tasking compiler model defines the following macros under specific conditions.
__NO_LONG_LONG =1 Unless --long-long is specified.
__STDC_VERSION__ =199901L For C compilations.
__CHAR_MIN =0 For C++ compilations.
__CHAR_MAX =255 For C++ compilations.
_BOOL =1 For C++ compilations.
_WCHAR_T =1 For C++ compilations.
_GLIBCPP_USE_WCHAR_T =1 For C++ compilations.
__ABI_COMPATIBILITY_VERSION =9999 For C++ compilations.
__ABI_CHANGES_FOR_RTTI =1 For C++ compilations.
__ABI_CHANGES_FOR_ARRAY_NEW_AND_DELETE =1 For C++ compilations.
__ABI_CHANGES_FOR_PLACEMENT_DELETE =1 For C++ compilations.
__ARRAY_OPERATORS =1 For C++ compilations.
__RUNTIME_USES_NAMESPACES =1 For C++ compilations.
__NAMESPACES =1 For C++ compilations, unless --no-namespaces is specified.
__EXCEPTIONS =1 If --exceptions or -x is specified.
__DOUBLE_FP__ =1 If --no-double or -F is specified.
__OPTIMIZE__ =1 If -O or --optimize is specified (with or without arguments).
__OPTIMIZE_SIZE__ =1 If -Os or --optimize=s is specified.
__CPU__ =can When --cpu=val or -Cval is specified (and is the last such), where can is the canonicalized version of core or CPU name val: uppercased, hyphens replaced with underscores, and everything after the '.' character removed.
__CPU_can__ =1 When --cpu=val or -Cval is specified (and is the last such), where can is the canonicalized version of core or CPU name val: uppercased, hyphens replaced with underscores, and everything after the '.' character removed.
Macros Hard-Undefined The tasking compiler model hard-undefines macro __GNUC__.
Keywords The compiler model scans and ignores the following TASKING compiler keywords.
  • __near
  • __huge
  • __shuge
  • __far
Front end options The following front end options are always specified.

The following front end options are specified for all C compilations.

The following front end options are specified for all C++ compilations.

The following front end options are specified only if certain command line arguments are provided.

--optimize If -O or --optimize is specified (with or without arguments).
--signed_chars If -s, -schar, or -fsigned-char is specified.
--unsigned_chars If -u, -uchar, or -funsigned-char is specified.