tdfc2 and tcpplus have three modes which determine the form of their input and output files.
The default mode is compilation, in which an input source file, input-file.c/.cc, is translated into a TDF capsule, output-file.j. tdfc2 translates C source, and tcpplus translates C++ source. The output file can alternatively be specified using the -o option. If the output file name is omitted or is -, standard output is used. In general there can be any number of input files. If the input file name is omitted or is -, standard input is used.
In preprocessing mode, specified using the -E option, the single input source file, input-file.c/.cc, is preprocessed to an output file, output-file.j. Note that the preprocessor is built into tdfc2 and tcpplus, rather than, as with most other compilers, being a separate program.
The final mode is spec linking, invoked using the -S option, in which any number of spec input files, input-file.k/.kk, are linked and any code generated as a result (for example, template instantiations) is written to the output TDF capsule, output-file.j.
In either compilation or spec linking mode, a spec file can be generated in addition to the TDF capsule, using the -s option. The generated spec file contains information enabling intermodule analysis to be performed.
In any mode a tdfc2dump symbol table dump output file can be generated using the -d option. This outputs usage and error information suitable for processing by other tools, output as a symbol table dump file. See tdfc2dump for the dump file format.
Invocation
While it is possible to use tdfc2 and tcpplus as stand-alone programs, it is recommended that they should be invoked via tcc or tcc -ch. The TCC Users' Guide should be consulted for more details.
The 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 -Idir and -Idir are equivalent.
Most of the command-line option handling for tdfc2 and tcpplus is done by tcc and tcc -ch, however when invoking tcc, options may be passed directly to tdfc2 using -Wc,opt and to tcpplus using -Wx,opt. 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 tdfc2 or tcpplus invoked with different options) respectively.
tcc requires the -Yc++ command-line option in order to enable C++ capabilities. Files with a .C suffix are recognised as C++ source files and passed to tcpplus for processing 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.
Options
-Apredicate(tokens)
Asserts that the given predicate is true. That is to say:
#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 tdfc2pragma#assert and #unassert directives.
-Cfile
Load the given file as as a character set map. See tdfc2charset for the syntax of this file.
-Dmacro
-Dmacro=tokens
Defines the given macro to be 1 in the first case, or the given sequence of preprocessing tokens in the second case. That is to say, respectively:
#define macro 1
#define macrotokens
In fact -D and -U options to tcc are not passed as -D and -U options to tdfc2 or tcpplus. Instead a start-up file containing the equivalent #define and #undef directives is used.
-E
Enables preprocessing mode in which the input C source file is preprocessed into the output file.
-Ffile
Causes a list of options to be read from file. Other than empty lines and lines beginning with #, each line in the file is treated as if it had been specified as a separate command-line option.
-H
Enables verbose inclusion mode in which warnings are printed at the start and the end of each included source file.
-Idir
Adds the given directory to the list searched for included source files. No such directories are built in.
-Nname:dir
Is identical to -Idirdir except that it also associates the given identifier with the directory. The directory name can be used to specify a tdfc2pragma compilation profile to be used on files included from this directory.
-S
Enables spec linker mode in which any number of input spec files are linked into a single output spec file.
-Umacro
Undefines the given macro.
The special case -U- undefines all the built-in macros. These are the standard macros __FILE__, __LINE__, __TIME__, __DATE__, __STDC__ and __STDC_VERSION__, and also __cplusplus for tcpplus only. Additionally, the macro __tcpplus is undefined; by default this is 0 for tdfc2 and 1 for tcpplus.
The 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.
-V
Print the name of each function to standard output as it is compiled.
-Wopt
Give a warning in the circumstances described by opt. This sets the given compiler option thus:
#pragma TenDRA option "opt" warning
The special case -Wall enables a wide range of warnings.
-X
Disables exception handling. The current implementation can be a large run-time overhead if not required. The effect of linking any module compiled with this option with a module which throws an exception is undefined. This is equivalent to -j-e.
-Znum
Sets the maximum number of errors printed before bailing out to be num. The default is 32.
-a
Apply complete program analysis to input files. That is, assume that no other translation units need to be linked in order for the program to execute.
-c
Disables TDF output. The output file will still be a valid TDF capsule, only it will contain no information. This is equivalent to -j-c.
-dopt=dump-file
Dump information about the input source file into dump-file. opt is a set of characters describing the information to be dumped, as follows:
Specifies the given file as a start-up or end-up file respectivelyfile. This is equivalent to adding:
#include "file"
at the start or end of the input source file.
More than one start-up and end-up file may be given; they are processed in the order given.
-g
Specifies that the output TDF capsule should also contain information to allow for the generation of run-time debugging directives. This is equivalent to -jg.
-h
Causes tdfc2 to print a full list of its available command-line options. This includes a number not documented here which are unlikely to prove useful to the normal user.
-iname
Specifies the machine name for use in diagnostics. This is the hostname of the machine where the source files are to be found, given from the perspective of a debugger inspecting objects produced from those files.
The machine name defaults to the empty string, meaning the same machine as the debugger.
-jopt
Sets the TDF output options given by opt. This consists of a sequence of characters describing the options to be enabled or disabled. The available options are:
Key
Default
Description
+
–
enable subsequent options (default)
-
–
disable subsequent options
a
off
output external names for local objects
b
off
work around 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
-mopt
Sets the error formatting options given by opt. This consists of a sequence of characters describing the options to be enabled or disabled. The available options are:
Key
Default
Description
+
–
enable subsequent options (default)
-
–
disable subsequent options
c
off
show source code with error
e
off
show error name
g
off
record statement locations
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
-nport-table
Specifies that the given portability table should be used to specify the basic configuration parameters.
-ooutput-file
An alternative method of specifying the output file.
-q
Quit immediately without processing input files. This is useful primarily in version and command line queries.
-sspec-file.k/.kk
Write a spec file describing the input source file to spec-file.
-t
Include token declarations in the output TDF capsule. While these are strictly unnecessary, they help when pretty-printing the output. This is equivalent to -jt.
-uname … name
Print the unmangled forms of the given mangled identifier names. The form:
tcpplus -u name .... name
can be used to print the unmangled forms of a list of mangled identifier names to standard output.
-v
Print the producer version number to standard error, along with the versions of the source language and TDF supported.
-w
Disables all warning messages. This is equivalent to -mw.
-z
Forces tdfc2 and tcpplus to produce an output file even if compilation errors occur. The effect of installing a TDF capsule produced using this option is undefined. This is equivalent to -mz.
--
Marks the last option. Any subsequent arguments are interpreted as input and output files even if they resemble command-line options.