xref: /original-bsd/old/pcc/cc/cc.1 (revision e0c0d005)
1.\" Copyright (c) 1980, 1990 The Regents of the University of California.
2.\" All rights reserved.  The Berkeley software License Agreement
3.\" specifies the terms and conditions for redistribution.
4.\"
5.\"     @(#)cc.1	6.6 (Berkeley) 07/24/90
6.\"
7.Dd
8.Dt CC 1
9.Os BSD 4
10.Sh NAME
11.Nm cc
12.Nd C compiler
13.Sh SYNOPSIS
14.Nm cc
15.Op  option
16...
17.Ar file ...
18.Sh DESCRIPTION
19.Nm Cc
20is the UNIX C compiler.
21.Nm Cc
22accepts several types of arguments:
23.Pp
24Arguments whose names end with `.c' are taken to be
25C source programs; they are compiled, and
26each object program is left on the file
27whose name is that of the source with `.o' substituted
28for `.c'.
29The `.o' file is normally deleted, however, if a single
30C program is compiled and loaded all at one go.
31.Pp
32In the same way,
33arguments whose names end with `.s' are taken to be assembly source programs
34and are assembled, producing a `.o' file.
35.Pp
36The following options are interpreted by
37.Nm cc .
38See
39.Xr ld 1
40for load-time options.
41.Tw Ds
42.Tp Fl c
43Suppress the loading phase of the compilation, and force
44an object file to be produced even if only one program is compiled.
45.Tp Fl g
46Have the compiler produce additional symbol table information
47for
48.Xr dbx 1
49Also pass the
50.Fl lg
51flag to
52.Xr ld 1 .
53.Tp Fl go
54Have the compiler produce additional symbol table information
55for the obsolete debugger
56.Xr sdb 1 .
57Also pass the
58.Fl lg
59flag to
60.Xr ld 1 .
61.Tp Fl w
62Suppress warning diagnostics.
63.Tp Fl p
64Arrange for the compiler to produce code
65which counts the number of times each routine is called.
66If loading takes place, replace the standard startup
67routine by one which automatically calls
68.Xr monitor 3
69at the start and arranges to write out a
70.Pa mon.out
71file at normal termination of execution of the object program.
72An execution profile can then be generated by
73use of
74.Xr prof 1 .
75.Tp Fl pg
76Causes the compiler to produce counting code in the manner of
77.Fl p
78but invokes a run-time recording mechanism that keeps more
79extensive statistics and produces a
80.Pa gmon.out
81file at normal termination.
82Also, a profiling library is searched, in lieu of the standard C library.
83An execution profile can then be generated by  use of
84.Xr gprof 1 .
85.Tp Fl O
86Invoke an
87object-code improver.
88.Tp Fl R
89Passed on to
90.Xr as 1
91making initialized variables shared and read-only.
92.Tp Fl S
93Compile the named C programs, and leave the
94assembler-language output on corresponding files suffixed `.s'.
95.Tp Fl M
96Run only the macro preprocessor
97on the named C programs,
98requesting it to generate Makefile dependencies
99and send the result to the standard output.
100.Tp Fl E
101Run only the macro preprocessor
102on the named C programs, and send the result to the
103standard output.
104.Tp Fl C
105prevent the macro preprocessor from eliding comments.
106.Tp Cx Fl o
107.Cx \& \&
108.Ar output
109.Cx
110Name the final output file
111.Ar output .
112If this option is used the file `a.out' will be left undisturbed.
113.Tp
114.Dw Ds
115.Di L
116.Dp Cx Fl D
117.Ar name=def
118.Cx
119.Dp Cx Fl D
120.Ar name
121.Cx
122Define the
123.Ar name
124to the preprocessor,
125as if by `#define'.
126If no definition is given, the name is defined as "1".
127.Dp
128.Tw Ds
129.Tp Cx Fl U
130.Ar name
131.Cx
132Remove any initial definition of
133.Ar name .
134.Tp Cx Fl I
135.Ar dir
136.Cx
137`#include' files
138whose names do not begin with `/'
139are always
140sought first in the directory
141of the
142.Ar file
143argument,
144then in directories named in
145.Fl I
146options,
147then in directories on a standard list.
148.Tp Cx Fl L
149.Ar dir
150.Cx
151Library archives are sought first in
152directories named in
153.Fl L
154options,
155then in directories on a standard list.
156.Tp Fl f
157Use an alternate compiler which does not convert expressions involving
158only floats to double. This does not conform to the standard which states
159that all intermediate results should be converted to double but does
160provide a speed improvement for programs which don't require full double
161precision.  This option also makes
162.Sy register float
163variables work appropriately.
164.Tp Cx Fl B
165.Ar path
166.Cx
167Find substitute compiler passes in the named path
168with the suffixes cpp, ccom and c2.
169.Tp Cx Fl t
170.Op p012
171.Cx
172Find only the designated compiler passes in the
173files whose names are constructed by a
174.Fl B
175option.
176.Tp
177.Pp
178Other arguments
179are taken
180to be either loader option arguments, or C-compatible
181object programs, typically produced by an earlier
182.Nm cc
183run,
184or perhaps libraries of C-compatible routines.
185These programs, together with the results of any
186compilations specified, are loaded (in the order
187given) to produce an executable program with name
188.Pa a.out .
189.Sh FILES
190.Dw /usr/libexec/sccom
191.Di L
192.Dp Pa file.c
193input file
194.Dp Pa file.o
195object file
196.Dp Pa a.out
197loaded output
198.Dp Pa ctm?
199temporary
200.Dp Pa /usr/bin/cpp
201preprocessor
202.Dp Pa /usr/libexec/ccom
203compiler
204.Dp Pa /usr/libexec/ccom
205compiler for single precision floats
206.Dp Pa /usr/libexec/c2
207optional optimizer
208.Dp Pa /usr/lib/crt0.o
209runtime startoff
210.Dp Pa /usr/lib/mcrt0.o
211startoff for profiling
212.Dp Pa /usr/lib/gcrt0.o
213startoff for gprof-profiling
214.Dp Pa /usr/lib/libc.a
215standard library, see
216.Xr intro 3
217.Dp Pa /usr/lib/libc_p.a
218profiling library, see
219.Xr intro 3
220.Dp Pa /usr/include
221standard directory for `#include' files
222.Dp Pa mon.out
223file produced for analysis by
224.Xr prof 1
225.Dp Pa gmon.out
226file produced for analysis by
227.Xr gprof 1
228.Dp
229.Sh SEE ALSO
230B. W. Kernighan and D. M. Ritchie,
231.Em The Programming Language ,
232Prentice-Hall,
2331978
234.Pp
235B. W. Kernighan,
236.Em Programming in C \- a tutorial
237.Pp
238D. M. Ritchie,
239.Em C Reference Manual
240.Pp
241.Xr monitor 3 ,
242.Xr prof 1 ,
243.Xr gprof 1 ,
244.Xr adb 1 ,
245.Xr ld 1 ,
246.Xr dbx 1 ,
247.Xr as 1
248.Sh DIAGNOSTICS
249The diagnostics produced by C itself are intended to be
250self-explanatory.
251Occasional messages may be produced by the assembler
252or loader.
253.Sh HISTORY
254The
255.Nm
256compiler was distributed with Version 6 AT&T UNIX.
257.Sh BUGS
258The compiler currently ignores advice to put
259.Ic char ,
260.Ic unsigned char ,
261.Ic short ,
262.Ic unsigned short ,
263.Ic float ,
264or
265.Ic double
266variables in registers, except as noted above.  It previously
267produced poor, and in some cases incorrect, code for such declarations.
268