In this section it is described how the C++ to TDF producer,
tcpplus
, fits into the overall compilation scheme controlled
by the TenDRA compiler front-end, tcc
, or the TenDRA
checker front-end, tchk
. While it is possible to use
tcpplus
as a stand-alone program, it is recommended that
it should be invoked via tcc
or tchk
. The
tcc
users' guide should be consulted for more details.
tcc
and tchk
require the -Yc++
command-line option in order to enable their C++ capabilities. Files
with a .C
suffix are recognised as C++ source files and
passed to tcpplus
for processing (see
below). It is possible to change the suffix
used for C++ source files; for example -sC:cc
causes
.cc
files to be recognised as C++ source files. An interesting
variation is -sC:c
which causes C source files to be
processed by the C++ producer. Similarly .I
files are
recognised as preprocessed C++ source files and .K
files are recognised as C++ spec files.
Most of the command-line option handling for tcpplus
is done by tcc
and tchk
, however it is possible
to pass the option opt directly to tcpplus
using
the option -Wx,
opt to tcc
or tchk
.
Similarly -Wg,
opt and -WS,
opt
can be used to pass options to the C++ preprocessor and the C++ spec
linker (both of which are actually tcpplus
invoked with
different options) respectively.
The overall compilation scheme controlled by tcc
, as
it relates to the C++ producer, can be represented as follows:
a.C
say, is processed using
tcpplus
to give an output TDF capsule, a.j
,
which is passed to the installer phase of tcc
. The capsule
is linked with any target dependent token definition libraries, translated
to assembler and assembled to give a binary object file,
a.o
. The various object files comprising the program
are then linked with the system libraries to give a final executable,
a.out
.
In addition to this main compilation scheme, tcpplus
can additionally be made to output a C++ spec
file
for each C++ source file, a.K
say. These C++ spec files
can be linked, using tcpplus
in its spec linker mode,
to give an additional TDF capsule, x.j
say, and a combined
C++ spec file, x.K
. The main purpose of this C++ spec
linking is to perform intermodule checks on the program, however in
the course of this checking exported templates which are defined in
one module and used in another are instantiated. This extra code
is output to x.j
, which is then installed and linked
in the normal way.
Note that intermodule checks, and hence intermodule template instantiations,
are only performed if the -im
option is passed to tcc
.
The TenDRA checker, tchk
, is similar to tcc
except that it disables TDF output and has intermodule analysis enabled
by default.
The general form for the invocation of tcpplus
is as
follows:
tcpplus [ options ] [ input-file ] .... [ output-file ]The output file can alternatively be specified using the
-o
option. If no output file is
given, or the output file is -
, the standard output is
used. In general there can be any number of input files. If no input
file is given, or the input file is -
, the standard input
is used.
tcpplus
has three modes which determine the form of its
input and output files. The default mode is compilation, in which
a single input C++ source file is translated into an output TDF capsule.
In preprocessing mode, specified using the
-E
option, a single input C++
source file is preprocessed into an output C++ source file. Note
that the preprocessor is built into tcpplus
, rather than,
as with most other compilers, being a separate program. The final
mode is
C++ spec linking, specified using the
-S
option. Any number of C++ spec
input files are linked and any code generated as a result (for example,
template instantiations) is written to the output TDF capsule.
In either compilation or spec linking mode, a C++ spec output file
can be generated, in addition to the TDF capsule, using the
-s
option. In any mode a symbol
table dump output file can generated using the -d
option.
Command-line options can appear in any order and can be interspersed
with the input and output files, except following a --
option. All the multi-part options can be given either as one or
two command-line arguments, so that -I
directory
and
-I
directory are equivalent. The recognised options
are as follows:
#assert predicate ( tokens )The special case
-A-
undefines all the built-in predicates
(of which there are none). Use of this option automatically enables
support for the #assert
and
#unassert
directives.
#define macro 1 #define macro tokensrespectively. In fact
-D
and -U
options
to
tcc
are not passed as -D
and -U
options to tcpplus
. Instead a
start-up file containing the equivalent
#define
and #undef
directives is used.
#
, each
line in the file is treated as if it had been specified as a separate
command-line option.
-I
directory except that it
also associates the given identifier with the directory. The directory
name can be used to specify a compilation
profile to be used on files included from this directory.
#undef macroThe special case
-U-
undefines all the built-in macros.
These may be described as follows:
#define __FILE__ (current file) #define __LINE__ (current line) #define __TIME__ (current time) #define __DATE__ (current date) #define __STDC__ 1 #define __STDC_VERSION__ 199409L #define __cplusplus 199711LThe actual value of
__cplusplus
gives the date of the
draft ISO C++ standard on which the current version of the producer
is based. The value given above gives the expected date of the final
C++ standard.
#pragma TenDRA option "option" warningThe special case
-Wall
enables a wide range of warnings.
-j-e
.
-j-c
.
Key | Description |
---|---|
a |
equivalent to ehlmu |
c |
dump string literals |
e |
dump error messages |
h |
dump header information |
k |
dump keyword identifiers |
l |
dump local variables |
m |
dump macro identifiers |
s |
dump scope information |
u |
dump identifier usage information |
Note that these correspond to the tcc -sym
options.
#include "file"at the end of the input source file. More than one end-up file may be given; they are processed in the order given.
#include "file"at the start of the input source file. More than one start-up file may be given; they are processed in the order given.
-jg
.
+
, the options are enabled;
following a -
they are disabled. The available options
are as follows:
Key | Default | Description |
---|---|---|
a |
off | output external names for local objects |
b |
off | work round old installer bugs |
c |
on | output TDF capsule |
d |
off | output termination function |
e |
on | output exceptions |
f |
on | mangle template function signatures |
g |
off | output debugging information |
i |
off | output dynamic initialisers as a function |
n |
on | mangle object names |
o |
off | order class data members by access |
p |
on | output partial destructors |
r |
on | output run-time type information |
s |
on | output shared string literals |
t |
off | output token declarations |
u |
on | output unused static variables |
v |
off | output local virtual function tables |
+
, the options are
enabled; following a -
they are disabled. The available
options are as follows:
Key | Default | Description |
---|---|---|
c |
off | show source code with error |
e |
off | show error name |
f |
on | reliable fseek function |
g |
off | record statement locations |
i |
on | reliable stat function |
k |
off | enable C++ spec output |
l |
off | output full error location |
s |
on | output ISO section number |
t |
off | use typedef names in errors |
w |
off | disable warnings |
z |
off | continue after error |
-jt
.
tcpplus -u name .... namecan be used to print the unmangled forms of a list of mangled identifier names to the standard output.
-mw
.
-mz
.
Part of the TenDRA Web.
Crown
Copyright © 1998.