cc(1)cc(1)Namecc - C compiler
Syntaxcc [options...] file...
Description
The command invokes the ULTRIX C compiler and accepts the following
types of arguments:
· Arguments whose names end with .c
· Arguments whose names end with .s
· Other arguments that are interpreted as either loader option argu‐
ments or
C-compatible object programs
Arguments ending in .c are interpreted as C source programs. They are
compiled, and each object program is left on a file whose name is the
same as the source file except .o is substituted for .c. If a single C
program is compiled and loaded all at once, the .o file is deleted.
Arguments ending with .s are interpreted as assembly source programs.
They are assembled, producing an .o file.
Arguments other than those ending with .c or .s were produced by previ‐
ous runs or by libraries of C-compatible routines.
The first argument passed to the loader is always one of the three
files used for start up. The compiler uses when the -p flag is given,
when the -pg is given, and otherwise. If loading executables by hand,
you must include the appropriate file.
Options
These options are accepted by See for load-time options.
-b Does not pass -lc to by default.
-Bstring Finds substitute compiler passes in the files named
string with the suffixes cpp, ccom, and c2.
-bswitch Instructs the compiler to use discrete tests for switch
case statements rather than casel instructions.
-c Suppresses the loading phase of the compilation and
forces an object file to be produced even if only one
program is compiled.
-C Stops the macro preprocessor from omitting comments.
-Dname=def
-Dname Defines the name to the processor, as if by #define. If
no definition is given, the name is defined as 1.
-E Runs only the macro preprocessor on the named C programs
and sends the result to the standard output.
-Em Runs only the macro preprocessor on the named C programs
and produces the makefile dependencies.
-f Specifies that computations involving only FFLOAT num‐
bers be done in single precision and not promoted to
double. Procedure arguments are still promoted to dou‐
ble. Programs with a large number of single-precision
computations will run faster with this option; however,
a slight loss in precision may result due to the saving
of intermediate results in a single-precision represen‐
tation.
-g Directs the compiler to produce additional symbol table
information for Also passes the -lg flag to
-Idir Searches first in the directory of the dir argument for
#include files whose names do not begin with a slash
(/), then in directories named in -I options, and,
finally, in directories on a standard list.
-J Uses long branches to resolve jumps when byte-displace‐
ment branches are insufficient. This must be used when
a compiler-generated assembly contains branches of more
than 32k bytes.
-lx Abbreviates the library name /lib/libx.a, where x is a
string. If that library name does not exist, ld
searches /usr/lib/libx.a and then /usr/local/lib/libx.a.
The placement of the -l library option is significant
because a library is searched when its name is encoun‐
tered.
-M Specifies the floating point type to be used for double-
precision floating point and is passed on to as the map
option.
-Md Specifies the default DFLOAT and passes the -lc flag to
-Mg Specifies GFLOAT and passes the -lcg flag to causing the
GFLOAT version of libc to be used. If the math library
is used with code compiled with the -Mg flag, it is
linked to the GFLOAT version by specifying -lmg on the
or command.
-o output Names the final output file output. If this option is
used, the file a.out is left alone. If the named file
has either .o or .a as a suffix, the following error
message is displayed: -o would overwrite.
-O Uses the object code optimizer.
-p Arranges for the compiler to produce code which counts
the number of times each routine is called. If loading
takes place, the -p option replaces the standard startup
routine with one that automatically calls and that
arranges to write out a mon.out file at normal termina‐
tion of execution of the object program. An execution
profile can then be generated using
-pg Causes the compiler to produce counting code as with -p,
but invokes a run-time recorder that keeps more exten‐
sive statistics and produces a file. Also, the -pg
option searches a profiling library in lieu of the stan‐
dard C library. An execution profile can then be gener‐
ated by using
-R Passed on to as, which makes initialized variables
shared and read-only.
-S Compiles programs and writes output to .s files.
-t [p02al] Finds the designated compiler passes in the files whose
names are constructed by a -B option. In the absence of
a -B option, the string is taken to be /usr/c/.
-Uname Removes any initial definition of name.
-w Suppresses warning diagnostics.
-Yenvironment Compiles C programs for environment. If environment is
SYSTEM_FIVE or is omitted, it defines SYSTEM_FIVE for
the preprocessor, If the loader is invoked, it specifies
that the System V version of the C runtime library is
used. Also, if the math library is specified with the
-lm option, the System V version is used. If environ‐
ment is POSIX, it defines POSIX for the preprocessor.
If the environment variable PROG_ENV has the value SYS‐
TEM_FIVE or POSIX, the effect is the same as when speci‐
fying the corresponding -Yenvironment option to The -Y
option overrides the PROG_ENV variable; -YBSD can be
used to override all special actions.
Default Symbols
The ULTRIX C compiler provides the following default symbols for your
use. These symbols are useful in ifdef statements to isolate code for
one of the particular cases. Thus, these symbols can be useful for
ensuring portable code.
unix Any UNIX system
bsd4_2 Berkeley UNIX Version 4.2
ultrix ULTRIX only
vax VAX only (as opposed to PDP-11)
Restrictions
The compiler ignores advice to put char, unsigned char, short or
unsigned short variables in registers.
If the -Mg flag is used to produce GFLOAT code, it must be used when
compiling all the modules which are to be linked. Use the -Mg flag if
you use the cc command to invoke indirectly to link the modules. If is
invoked directly, use the -lcg flag rather than -lc. If the math
library is used, specify the -lmg flag rather than the -lm flag in
order to use the GFLOAT version.
The compiler and the linker cannot detect the use of mixed double
floating point types. If you use them, your program's results may be
erroneous.
The compiler can exit with a core dump when syntax errors are encoun‐
tered in a C program.
The command occasionally dumps core. If you encounter this problem, use
the command to work around this problem.
VAX Only Restriction
The conversion of an unsigned long to a double results in the double
becoming a signed number.
The use of prototypes can confuse the compiler and generate incorrect
code. For instanced, in the following example, the add() returns the
incorrect results because of the arguments to sub() being present.
extern sub(a,b);
add(x,y)
{
return (x+y);
}
Divide by zero does not generate a signal or a core dump.
The optimizer does not correctly handle some loops (loop inversion).
For example:
int bar [1];
show_opt_error(z)
int z;
{
int c, d;
while ( c <= d )
{
bar[z]++; /*this instr will be re-arranged incorrectly */
}
}
The maximum number of cases within a switch statement is limited to
500.
Diagnostics
The diagnostics produced by C are intended to be self-explanatory.
Occasional messages may be produced by the assembler or loader.
Files
input file
object file
loaded output
temporary
preprocessor
compiler
optional optimizer
runtime startoff
startoff for profiling
startoff for gprof-profiling
standard library, see intro(3)
GFLOAT version of the standard library, see intro(3)
profiling library, see intro(3)
standard directory for #include files
file produced for analysis by prof(1)
file produced for analysis by gprof(1)See Alsoadb(1), as(1), cpp(1), dbx(1), error(1), gprof(1) (unsupported), ld(1),
prof(1), monitor(3)
VAX cc(1)