BSD 4_3_Tahoe development
[unix-history] / usr / man / cat1 / cc.0
CommitLineData
362b077f
C
1
2
3
4CC(1) UNIX Programmer's Manual CC(1)
5
6
7
8N\bNA\bAM\bME\bE
9 cc - C compiler
10
11S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
12 c\bcc\bc [ option ] ... file ...
13
14D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
15 _\bC_\bc is the UNIX C compiler. _\bC_\bc accepts several types of
16 arguments:
17
18 Arguments whose names end with `.c' are taken to be C source
19 programs; they are compiled, and each object program is left
20 on the file whose name is that of the source with `.o' sub-
21 stituted for `.c'. The `.o' file is normally deleted, how-
22 ever, if a single C program is compiled and loaded all at
23 one go.
24
25 In the same way, arguments whose names end with `.s' are
26 taken to be assembly source programs and are assembled, pro-
27 ducing a `.o' file.
28
29 The following options are interpreted by _\bc_\bc. See _\bl_\bd(1) for
30 load-time options.
31
32 -\b-c\bc Suppress the loading phase of the compilation, and
33 force an object file to be produced even if only one
34 program is compiled.
35
36 -\b-g\bg Have the compiler produce additional symbol table
37 information for _\bd_\bb_\bx(1). Also pass the -\b-l\blg\bg flag to
38 _\bl_\bd(1).
39
40 -\b-g\bgo\bo Have the compiler produce additional symbol table
41 information for the obsolete debugger _\bs_\bd_\bb(1). Also
42 pass the -\b-l\blg\bg flag to _\bl_\bd(1).
43
44 -\b-w\bw Suppress warning diagnostics.
45
46 -\b-p\bp Arrange for the compiler to produce code which
47 counts the number of times each routine is called.
48 If loading takes place, replace the standard startup
49 routine by one which automatically calls _\bm_\bo_\bn_\bi_\bt_\bo_\br(3)
50 at the start and arranges to write out a _\bm_\bo_\bn._\bo_\bu_\bt
51 file at normal termination of execution of the
52 object program. An execution profile can then be
53 generated by use of _\bp_\br_\bo_\bf(1).
54
55 -\b-p\bpg\bg Causes the compiler to produce counting code in the
56 manner of -\b-p\bp,\b, but invokes a run-time recording
57 mechanism that keeps more extensive statistics and
58 produces a _\bg_\bm_\bo_\bn._\bo_\bu_\bt file at normal termination.
59 Also, a profiling library is searched, in lieu of
60
61
62
63Printed 7/9/88 June 7, 1985 1
64
65
66
67
68
69
70CC(1) UNIX Programmer's Manual CC(1)
71
72
73
74 the standard C library. An execution profile can
75 then be generated by use of _\bg_\bp_\br_\bo_\bf(1).
76
77 -\b-O\bO Invoke an object-code improver.
78
79 -\b-R\bR Passed on to _\ba_\bs, making initialized variables shared
80 and read-only.
81
82 -\b-S\bS Compile the named C programs, and leave the
83 assembler-language output on corresponding files
84 suffixed `.s'.
85
86 -\b-M\bM Run only the macro preprocessor on the named C pro-
87 grams, requesting it to generate Makefile dependen-
88 cies and send the result to the standard output.
89
90 -\b-E\bE Run only the macro preprocessor on the named C pro-
91 grams, and send the result to the standard output.
92
93 -\b-C\bC prevent the macro preprocessor from eliding com-
94 ments.
95
96 -\b-o\bo _\bo_\bu_\bt_\bp_\bu_\bt
97 Name the final output file _\bo_\bu_\bt_\bp_\bu_\bt. If this option
98 is used the file `a.out' will be left undisturbed.
99
100 -\b-D\bD_\bn_\ba_\bm_\be=_\bd_\be_\bf
101 -\b-D\bD_\bn_\ba_\bm_\be Define the _\bn_\ba_\bm_\be to the preprocessor, as if by
102 `#define'. If no definition is given, the name is
103 defined as "1".
104
105 -\b-U\bU_\bn_\ba_\bm_\be Remove any initial definition of _\bn_\ba_\bm_\be.
106
107 -\b-I\bI_\bd_\bi_\br `#include' files whose names do not begin with `/'
108 are always sought first in the directory of the _\bf_\bi_\bl_\be
109 argument, then in directories named in -\b-I\bI options,
110 then in directories on a standard list.
111
112 -\b-L\bL_\bd_\bi_\br Library archives are sought first in directories
113 named in -\b-L\bL options, then in directories on a stan-
114 dard list.
115
116 -\b-f\bf Use an alternate compiler which does not convert
117 expressions involving only floats to double. This
118 does not conform to the standard which states that
119 all intermediate results should be converted to dou-
120 ble but does provide a speed improvement for pro-
121 grams which don't require full double precision.
122 This option also makes r\bre\beg\bgi\bis\bst\bte\ber\br f\bfl\blo\boa\bat\bt variables work
123 appropriately.
124
125 -\b-B\bB_\bs_\bt_\br_\bi_\bn_\bg
126
127
128
129Printed 7/9/88 June 7, 1985 2
130
131
132
133
134
135
136CC(1) UNIX Programmer's Manual CC(1)
137
138
139
140 Find substitute compiler passes in the files named
141 _\bs_\bt_\br_\bi_\bn_\bg with the suffixes cpp, ccom and c2. If
142 _\bs_\bt_\br_\bi_\bn_\bg is empty, use a standard backup version.
143
144 -\b-t\bt[p\bp0\b01\b12\b2]
145 Find only the designated compiler passes in the
146 files whose names are constructed by a -\b-B\bB option.
147 In the absence of a -\b-B\bB option, the _\bs_\bt_\br_\bi_\bn_\bg is taken
148 to be `/usr/c/'.
149
150 Other arguments are taken to be either loader option argu-
151 ments, or C-compatible object programs, typically produced
152 by an earlier _\bc_\bc run, or perhaps libraries of C-compatible
153 routines. These programs, together with the results of any
154 compilations specified, are loaded (in the order given) to
155 produce an executable program with name a\ba.\b.o\bou\but\bt.\b.
156
157F\bFI\bIL\bLE\bES\bS
158 file.c input file
159 file.o object file
160 a.out loaded output
161 /tmp/ctm? temporary
162 /lib/cpp preprocessor
163 /lib/ccom compiler
164 /lib/sccom compiler for single precision floats
165 /usr/c/occom backup compiler
166 /usr/c/ocpp backup preprocessor
167 /lib/c2 optional optimizer
168 /lib/crt0.o runtime startoff
169 /lib/mcrt0.o startoff for profiling
170 /usr/lib/gcrt0.ostartoff for gprof-profiling
171 /lib/libc.a standard library, see _\bi_\bn_\bt_\br_\bo(3)
172 /usr/lib/libc_p.aprofiling library, see _\bi_\bn_\bt_\br_\bo(3)
173 /usr/include standard directory for `#include' files
174 mon.out file produced for analysis by _\bp_\br_\bo_\bf(1)
175 gmon.out file produced for analysis by _\bg_\bp_\br_\bo_\bf(1)
176
177S\bSE\bEE\bE A\bAL\bLS\bSO\bO
178 B. W. Kernighan and D. M. Ritchie, _\bT_\bh_\be _\bC _\bP_\br_\bo_\bg_\br_\ba_\bm_\bm_\bi_\bn_\bg
179 _\bL_\ba_\bn_\bg_\bu_\ba_\bg_\be, Prentice-Hall, 1978
180 B. W. Kernighan, _\bP_\br_\bo_\bg_\br_\ba_\bm_\bm_\bi_\bn_\bg _\bi_\bn _\bC-_\ba _\bt_\bu_\bt_\bo_\br_\bi_\ba_\bl
181 D. M. Ritchie, _\bC _\bR_\be_\bf_\be_\br_\be_\bn_\bc_\be _\bM_\ba_\bn_\bu_\ba_\bl
182 monitor(3), prof(1), gprof(1), adb(1), ld(1), dbx(1), as(1)
183
184D\bDI\bIA\bAG\bGN\bNO\bOS\bST\bTI\bIC\bCS\bS
185 The diagnostics produced by C itself are intended to be
186 self-explanatory. Occasional messages may be produced by
187 the assembler or loader.
188
189B\bBU\bUG\bGS\bS
190 The compiler currently ignores advice to put c\bch\bha\bar\br, u\bun\bns\bsi\big\bgn\bne\bed\bd
191 c\bch\bha\bar\br, s\bsh\bho\bor\brt\bt, u\bun\bns\bsi\big\bgn\bne\bed\bd s\bsh\bho\bor\brt\bt, f\bfl\blo\boa\bat\bt, or d\bdo\bou\bub\bbl\ble\be variables in
192
193
194
195Printed 7/9/88 June 7, 1985 3
196
197
198
199
200
201
202CC(1) UNIX Programmer's Manual CC(1)
203
204
205
206 registers, except as noted above. It previously produced
207 poor, and in some cases incorrect, code for such declara-
208 tions.
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261Printed 7/9/88 June 7, 1985 4
262
263
264