BSD 4_1c_2 release
[unix-history] / usr / man / man1 / cc.1
CommitLineData
3bcca438
C
1.TH CC 1 "9 February 1982"
2.UC 4
3.SH NAME
4cc \- C compiler
5.SH SYNOPSIS
6.B cc
7[ option ] ... file ...
8.SH DESCRIPTION
9.I Cc
10is the UNIX C compiler.
11.I Cc
12accepts several types of arguments:
13.PP
14Arguments whose names end with `.c' are taken to be
15C source programs; they are compiled, and
16each object program is left on the file
17whose name is that of the source with `.o' substituted
18for `.c'.
19The `.o' file is normally deleted, however, if a single
20C program is compiled and loaded all at one go.
21.PP
22In the same way,
23arguments whose names end with `.s' are taken to be assembly source programs
24and are assembled, producing a `.o' file.
25.PP
26The following options are interpreted by
27.IR cc .
28See
29.IR ld (1)
30for load-time options.
31.TP 8
32.B \-c
33Suppress the loading phase of the compilation, and force
34an object file to be produced even if only one program is compiled.
35.TP
36.B \-g
37Have the compiler produce additional symbol table information
38for
39.IR dbx (1).
40Also pass the
41.B \-lg
42flag to
43.IR ld (1).
44.TP
45.B \-go
46Have the compiler produce additional symbol table information
47for
48.IR adb (1)
49or
50.IR sdb (1).
51Also pass the
52.B \-lg
53flag to
54.IR ld (1).
55.TP
56.B \-w
57Suppress warning diagnostics.
58.TP
59.B \-p
60Arrange for the compiler to produce code
61which counts the number of times each routine is called.
62If loading takes place, replace the standard startup
63routine by one which automatically calls
64.IR monitor (3)
65at the start and arranges to write out a
66.I mon.out
67file at normal termination of execution of the object program.
68Also, a profiling library is searched, in lieu of the standard C library.
69An execution profile can then be generated by
70use of
71.IR prof (1).
72.TP
73.B \-pg
74Causes the compiler to produce counting code in the manner of
75.B \-p,
76but invokes a run-time recording mechanism that keeps more
77extensive statistics and produces a
78.I gmon.out
79file at normal termination.
80An execution profile can then be generated by use of
81.IR gprof (1).
82.TP
83.SM
84.B \-O
85Invoke an
86object-code improver.
87.TP
88.SM
89.B \-R
90Passed on to
91.I as,
92making initialized variables shared and read-only.
93.TP
94.SM
95.B \-S
96Compile the named C programs, and leave the
97assembler-language output on corresponding files suffixed `.s'.
98.TP
99.SM
100.B \-E
101Run only the macro preprocessor
102on the named C programs, and send the result to the
103standard output.
104.TP
105.SM
106.B \-C
107prevent the macro preprocessor from eliding comments.
108.TP
109.BI \-o " output"
110Name the final output file
111.IR output .
112If this option is used the file `a.out' will be left undisturbed.
113.TP
114.SM
115.BI \-D name=def
116.br
117.ns
118.TP
119.SM
120.BI \-D \*Sname
121Define the
122.I name
123to the preprocessor,
124as if by
125`#define'.
126If no definition is given, the name is defined as "1".
127.TP
128.SM
129.BI \-U \*Sname
130Remove any initial definition of
131.IR name .
132.TP
133.SM
134.BI \-I \*Sdir
135`#include' files
136whose names do not begin with `/' are always
137sought first in the directory
138of the
139.I file
140argument,
141then in directories named in
142.B \-I
143options,
144then in directories on a standard list.
145.TP
146.SM
147.BI \-B \*Sstring
148Find substitute compiler passes in the files named
149.I string
150with the suffixes cpp, ccom and c2.
151If
152.I string
153is empty, use a standard backup version.
154.TP
155.BR \-t [ p012 ]
156Find only the designated compiler passes in the
157files whose names are constructed by a
158.B \-B
159option.
160In the absence of a
161.B \-B
162option, the
163.I string
164is taken to be `/usr/c/'.
165.PP
166Other arguments
167are taken
168to be either loader option arguments, or C-compatible
169object programs, typically produced by an earlier
170.I cc
171run,
172or perhaps libraries of C-compatible routines.
173These programs, together with the results of any
174compilations specified, are loaded (in the order
175given) to produce an executable program with name
176.B a.out.
177.SH FILES
178.ta \w'/usr/c/occom 'u
179file.c input file
180.br
181file.o object file
182.br
183a.out loaded output
184.br
185/tmp/ctm? temporary
186.br
187/lib/cpp preprocessor
188.br
189/lib/ccom compiler
190.br
191/usr/c/occom backup compiler
192.br
193/usr/c/ocpp backup preprocessor
194.br
195/lib/c2 optional optimizer
196.br
197/lib/crt0.o runtime startoff
198.br
199/lib/mcrt0.o startoff for profiling
200.br
201/lib/gcrt0.o startoff for gprof-profiling
202.br
203/lib/libc.a standard library, see
204.IR intro(3)
205.br
206/lib/libc_p.a profiling library, see
207.IR intro(3)
208.br
209/usr/include standard directory for `#include' files
210.br
211mon.out file produced for analysis by prof(1)
212.br
213gmon.out file produced for analysis by gprof(1)
214.SH "SEE ALSO"
215B. W. Kernighan and D. M. Ritchie,
216.I The C Programming Language,
217Prentice-Hall,
2181978
219.br
220B. W. Kernighan,
221.I
222Programming in C\(ema tutorial
223.br
224D. M. Ritchie,
225.I
226C Reference Manual
227.br
228monitor(3), prof(1), gprof(1), adb(1), ld(1), dbx(1), as(1)
229.SH DIAGNOSTICS
230The diagnostics produced by C itself are intended to be
231self-explanatory.
232Occasional messages may be produced by the assembler
233or loader.
234.SH BUGS
235(VAX only) The compiler currently ignores advice to put
236\fBchar\fR, \fBunsigned char\fR,
237\fBshort\fR or \fBunsigned short\fR variables in registers. It previously
238produced poor, and in some cases incorrect, code for such declarations.
239.br
240(SUN only) There are currently two floating-point formats,
241trading off precision and range with speed. The default C floating point
242is fast.
243To produce C modules using the alternate floating format, you must give
244the
245.B \-f
246flag when compiling or linking using cc.
247This will go away very soon.