xref: /csrg-svn/old/pcc/cc/cc.1 (revision 50834)
143082Scael.\" Copyright (c) 1980, 1990 The Regents of the University of California.
2*50834Scael.\" All rights reserved.
319082Smckusick.\"
4*50834Scael.\" %sccs.include.redist.roff%
519082Smckusick.\"
6*50834Scael.\"	@(#)cc.1	6.7 (Berkeley) 08/09/91
7*50834Scael.\"
843082Scael.Dd
943082Scael.Dt CC 1
1043082Scael.Os BSD 4
1143082Scael.Sh NAME
1243082Scael.Nm cc
1343082Scael.Nd C compiler
1443082Scael.Sh SYNOPSIS
1543082Scael.Nm cc
1643082Scael.Op  option
17*50834ScaelAr ...
1843082Scael.Ar file ...
1943082Scael.Sh DESCRIPTION
2043082Scael.Nm Cc
2119082Smckusickis the UNIX C compiler.
2243082Scael.Nm Cc
2319082Smckusickaccepts several types of arguments:
2443082Scael.Pp
2519082SmckusickArguments whose names end with `.c' are taken to be
2619082SmckusickC source programs; they are compiled, and
2719082Smckusickeach object program is left on the file
2819082Smckusickwhose name is that of the source with `.o' substituted
2919082Smckusickfor `.c'.
3019082SmckusickThe `.o' file is normally deleted, however, if a single
3119082SmckusickC program is compiled and loaded all at one go.
3243082Scael.Pp
3319082SmckusickIn the same way,
3419082Smckusickarguments whose names end with `.s' are taken to be assembly source programs
3519082Smckusickand are assembled, producing a `.o' file.
3643082Scael.Pp
3719082SmckusickThe following options are interpreted by
3843082Scael.Nm cc .
3919082SmckusickSee
4043082Scael.Xr ld 1
4119082Smckusickfor load-time options.
42*50834Scael.Bl -tag -width Ds
43*50834Scael.It Fl c
4419082SmckusickSuppress the loading phase of the compilation, and force
4519082Smckusickan object file to be produced even if only one program is compiled.
46*50834Scael.It Fl g
4719082SmckusickHave the compiler produce additional symbol table information
4843082Scaelfor
4943082Scael.Xr dbx 1
5019083SmckusickAlso pass the
5143082Scael.Fl lg
5219083Smckusickflag to
5343082Scael.Xr ld 1 .
54*50834Scael.It Fl go
5519083SmckusickHave the compiler produce additional symbol table information
5619083Smckusickfor the obsolete debugger
5743082Scael.Xr sdb 1 .
5819082SmckusickAlso pass the
5943082Scael.Fl lg
6019082Smckusickflag to
6143082Scael.Xr ld 1 .
62*50834Scael.It Fl w
6319082SmckusickSuppress warning diagnostics.
64*50834Scael.It Fl p
6519082SmckusickArrange for the compiler to produce code
6619083Smckusickwhich counts the number of times each routine is called.
6719083SmckusickIf loading takes place, replace the standard startup
6819082Smckusickroutine by one which automatically calls
6943082Scael.Xr monitor 3
7019082Smckusickat the start and arranges to write out a
7143082Scael.Pa mon.out
7219082Smckusickfile at normal termination of execution of the object program.
7319082SmckusickAn execution profile can then be generated by
7419082Smckusickuse of
7543082Scael.Xr prof 1 .
76*50834Scael.It Fl pg
7719083SmckusickCauses the compiler to produce counting code in the manner of
7843082Scael.Fl p
7919083Smckusickbut invokes a run-time recording mechanism that keeps more
8043082Scaelextensive statistics and produces a
8143082Scael.Pa gmon.out
8219083Smckusickfile at normal termination.
8319083SmckusickAlso, a profiling library is searched, in lieu of the standard C library.
8419083SmckusickAn execution profile can then be generated by  use of
8543082Scael.Xr gprof 1 .
86*50834Scael.It Fl O
8719082SmckusickInvoke an
8819082Smckusickobject-code improver.
89*50834Scael.It Fl R
9019082SmckusickPassed on to
9143082Scael.Xr as 1
9219082Smckusickmaking initialized variables shared and read-only.
93*50834Scael.It Fl S
9419082SmckusickCompile the named C programs, and leave the
9519082Smckusickassembler-language output on corresponding files suffixed `.s'.
96*50834Scael.It Fl M
9719084SmckusickRun only the macro preprocessor
9819084Smckusickon the named C programs,
9919084Smckusickrequesting it to generate Makefile dependencies
10019084Smckusickand send the result to the standard output.
101*50834Scael.It Fl E
10219082SmckusickRun only the macro preprocessor
10319082Smckusickon the named C programs, and send the result to the
10419082Smckusickstandard output.
105*50834Scael.It Fl C
10619082Smckusickprevent the macro preprocessor from eliding comments.
107*50834Scael.It Fl o Ns Ar output
10819082SmckusickName the final output file
10943082Scael.Ar output .
11019082SmckusickIf this option is used the file `a.out' will be left undisturbed.
111*50834Scael.El
112*50834Scael.Bl -tag -width Ds -compact
113*50834Scael.It Fl D Ns Ar name=def
114*50834Scael.It Fl D Ns Ar name
11519082SmckusickDefine the
11643082Scael.Ar name
11719082Smckusickto the preprocessor,
11843082Scaelas if by `#define'.
11919082SmckusickIf no definition is given, the name is defined as "1".
120*50834Scael.El
121*50834Scael.Bl -tag -width Ds
122*50834Scael.It Fl U Ns Ar name
12319082SmckusickRemove any initial definition of
12443082Scael.Ar name .
125*50834Scael.It Fl I Ns Ar dir
12644952Scael`#include' files
12743082Scaelwhose names do not begin with `/'
12843082Scaelare always
12943082Scaelsought first in the directory
13019082Smckusickof the
13143082Scael.Ar file
13219082Smckusickargument,
13343082Scaelthen in directories named in
13443082Scael.Fl I
13519082Smckusickoptions,
13619082Smckusickthen in directories on a standard list.
137*50834Scael.It Fl L Ns Ar dir
13819084SmckusickLibrary archives are sought first in
13919084Smckusickdirectories named in
14043082Scael.Fl L
14119084Smckusickoptions,
14219084Smckusickthen in directories on a standard list.
143*50834Scael.It Fl f
14419084SmckusickUse an alternate compiler which does not convert expressions involving
14519084Smckusickonly floats to double. This does not conform to the standard which states
14619084Smckusickthat all intermediate results should be converted to double but does
14719084Smckusickprovide a speed improvement for programs which don't require full double
14822702Slepreauprecision.  This option also makes
14943082Scael.Sy register float
15022702Slepreauvariables work appropriately.
151*50834Scael.It Fl B Ns Ar path
15237788SbosticFind substitute compiler passes in the named path
15319082Smckusickwith the suffixes cpp, ccom and c2.
154*50834Scael.It Fl t Ns Op p012
15519082SmckusickFind only the designated compiler passes in the
15619082Smckusickfiles whose names are constructed by a
15743082Scael.Fl B
15819082Smckusickoption.
159*50834Scael.El
16043082Scael.Pp
16119082SmckusickOther arguments
16219082Smckusickare taken
16319082Smckusickto be either loader option arguments, or C-compatible
16419082Smckusickobject programs, typically produced by an earlier
16543082Scael.Nm cc
16619082Smckusickrun,
16719082Smckusickor perhaps libraries of C-compatible routines.
16819082SmckusickThese programs, together with the results of any
16919082Smckusickcompilations specified, are loaded (in the order
17019082Smckusickgiven) to produce an executable program with name
17143082Scael.Pa a.out .
17243082Scael.Sh FILES
173*50834Scael.Bl -tag -width /usr/libexec/sccom -compact
174*50834Scael.It Pa file.c
175*50834ScaelInput file.
176*50834Scael.It Pa file.o
177*50834ScaelObject file.
178*50834Scael.It Pa a.out
179*50834ScaelLoaded output.
180*50834Scael.It Pa ctm?
181*50834ScaelTemporary.
182*50834Scael.It Pa /usr/bin/cpp
183*50834ScaelPreprocessor.
184*50834Scael.It Pa /usr/libexec/ccom
185*50834ScaelCompiler.
186*50834Scael.It Pa /usr/libexec/ccom
187*50834ScaelCompiler for single precision floats.
188*50834Scael.It Pa /usr/libexec/c2
189*50834ScaelOptional optimizer.
190*50834Scael.It Pa /usr/lib/crt0.o
191*50834ScaelRuntime startoff.
192*50834Scael.It Pa /usr/lib/mcrt0.o
193*50834ScaelStartoff for profiling.
194*50834Scael.It Pa /usr/lib/gcrt0.o
195*50834ScaelStartoff for gprof-profiling.
196*50834Scael.It Pa /usr/lib/libc.a
197*50834ScaelStandard library, see.
198*50834Scael.Xr intro 3 .
199*50834Scael.It Pa /usr/lib/libc_p.a
200*50834ScaelProfiling library, see
201*50834Scael.Xr intro 3 .
202*50834Scael.It Pa /usr/include
203*50834ScaelStandard directory for `#include' files.
204*50834Scael.It Pa mon.out
205*50834ScaelFile produced for analysis by
206*50834Scael.Xr prof 1 .
207*50834Scael.It Pa gmon.out
208*50834ScaelFile produced for analysis by
209*50834Scael.Xr gprof 1 .
210*50834Scael.El
21143082Scael.Sh SEE ALSO
21243082Scael.Xr monitor 3 ,
21343082Scael.Xr prof 1 ,
21443082Scael.Xr gprof 1 ,
21543082Scael.Xr adb 1 ,
21643082Scael.Xr ld 1 ,
21743082Scael.Xr dbx 1 ,
21843082Scael.Xr as 1
219*50834Scael.Rs
220*50834Scael.%A B. W. Kernighan
221*50834Scael.%A D. M. Ritchie
222*50834Scael.%T "The Programming Language"
223*50834Scael.%I Prentice-Hall
224*50834Scael.%D 1978
225*50834Scael.Re
226*50834Scael.Rs
227*50834Scael.%A B. W. Kernighan
228*50834Scael.%T "Programming in C \- a tutorial"
229*50834Scael.Re
230*50834Scael.Rs
231*50834Scael.%A D. M. Ritchie
232*50834Scael.%T "C Reference Manual"
233*50834Scael.Re
23443082Scael.Sh DIAGNOSTICS
23519082SmckusickThe diagnostics produced by C itself are intended to be
23619082Smckusickself-explanatory.
23719082SmckusickOccasional messages may be produced by the assembler
23819082Smckusickor loader.
23943082Scael.Sh HISTORY
24043082ScaelThe
241*50834Scael.Nm \&cc
242*50834Scaelcompiler was distributed with
243*50834Scael.At v6 .
24443082Scael.Sh BUGS
24543082ScaelThe compiler currently ignores advice to put
24643082Scael.Ic char ,
24743082Scael.Ic unsigned char ,
24843082Scael.Ic short ,
24943082Scael.Ic unsigned short ,
25043082Scael.Ic float ,
25143082Scaelor
25243082Scael.Ic double
25322702Slepreauvariables in registers, except as noted above.  It previously
25419082Smckusickproduced poor, and in some cases incorrect, code for such declarations.
255