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