BSD 4_3_Reno development
[unix-history] / usr / share / man / cat1 / cc.0
CommitLineData
61212793
C
1CC(1) UNIX Reference Manual CC(1)
2
3N\bNA\bAM\bME\bE
4 c\bcc\bc - C compiler
5
6S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
7 c\bcc\bc [option] _\bf_\bi_\bl_\be ...
8
9D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
10 C\bCc\bc is the UNIX C compiler. C\bCc\bc accepts several types of arguments:
11
12 Arguments whose names end with `.c' are taken to be C source programs;
13 they are compiled, and each object program is left on the file whose name
14 is that of the source with `.o' substituted for `.c'. The `.o' file is
15 normally deleted, however, if a single C program is compiled and loaded
16 all at one go.
17
18 In the same way, arguments whose names end with `.s' are taken to be as-
19 sembly source programs and are assembled, producing a `.o' file.
20
21 The following options are interpreted by c\bcc\bc. See ld(1) for load-time op-
22 tions.
23
24 -\b-c\bc Suppress the loading phase of the compilation, and force an object
25 file to be produced even if only one program is compiled.
26
27 -\b-g\bg Have the compiler produce additional symbol table information for
28 dbx(1) Also pass the -\b-l\blg\bg flag to ld(1).
29
30 -\b-g\bgo\bo Have the compiler produce additional symbol table information for
31 the obsolete debugger sdb(1). Also pass the -\b-l\blg\bg flag to ld(1).
32
33 -\b-w\bw Suppress warning diagnostics.
34
35 -\b-p\bp Arrange for the compiler to produce code which counts the number of
36 times each routine is called. If loading takes place, replace the
37 standard startup routine by one which automatically calls moni-
38 tor(3) at the start and arranges to write out a _\bm_\bo_\bn._\bo_\bu_\bt file at
39 normal termination of execution of the object program. An execu-
40 tion profile can then be generated by use of prof(1).
41
42 -\b-p\bpg\bg Causes the compiler to produce counting code in the manner of -\b-p\bp
43 but invokes a run-time recording mechanism that keeps more exten-
44 sive statistics and produces a _\bg_\bm_\bo_\bn._\bo_\bu_\bt file at normal termination.
45 Also, a profiling library is searched, in lieu of the standard C
46 library. An execution profile can then be generated by use of
47 gprof(1).
48
49 -\b-O\bO Invoke an object-code improver.
50
51 -\b-R\bR Passed on to as(1) making initialized variables shared and read-
52 only.
53
54 -\b-S\bS Compile the named C programs, and leave the assembler-language out-
55 put on corresponding files suffixed `.s'.
56
57 -\b-M\bM Run only the macro preprocessor on the named C programs, requesting
58 it to generate Makefile dependencies and send the result to the
59 standard output.
60
61 -\b-E\bE Run only the macro preprocessor on the named C programs, and send
62 the result to the standard output.
63
64 -\b-C\bC prevent the macro preprocessor from eliding comments.
65
66 -\b-o\bo_\bo_\bu_\bt_\bp_\bu_\bt
67 Name the final output file _\bo_\bu_\bt_\bp_\bu_\bt. If this option is used the file
68 `a.out' will be left undisturbed.
69
70 -\b-D\bD_\bn_\ba_\bm_\be=_\bd_\be_\bf
71 -\b-D\bD_\bn_\ba_\bm_\be
72 Define the _\bn_\ba_\bm_\be to the preprocessor, as if by `#define'. If no de-
73 finition is given, the name is defined as "1".
74
75
76 -\b-U\bU_\bn_\ba_\bm_\be
77 Remove any initial definition of _\bn_\ba_\bm_\be.
78
79 -\b-I\bI_\bd_\bi_\br
80 `#include' files whose names do not begin with `/' are always
81 sought first in the directory of the _\bf_\bi_\bl_\be argument, then in direc-
82 tories named in -\b-I\bI options, then in directories on a standard list.
83
84 -\b-L\bL_\bd_\bi_\br
85 Library archives are sought first in directories named in -\b-L\bL op-
86 tions, then in directories on a standard list.
87
88 -\b-f\bf Use an alternate compiler which does not convert expressions in-
89 volving only floats to double. This does not conform to the stan-
90 dard which states that all intermediate results should be converted
91 to double but does provide a speed improvement for programs which
92 don't require full double precision. This option also makes
93 r\bre\beg\bgi\bis\bst\bte\ber\br f\bfl\blo\boa\bat\bt variables work appropriately.
94
95 -\b-B\bB_\bp_\ba_\bt_\bh
96 Find substitute compiler passes in the named path with the suffixes
97 cpp, ccom and c2.
98
99 -\b-t\bt[p012]
100 Find only the designated compiler passes in the files whose names
101 are constructed by a -\b-B\bB option.
102
103 Other arguments are taken to be either loader option arguments, or C-
104 compatible object programs, typically produced by an earlier c\bcc\bc run, or
105 perhaps libraries of C-compatible routines. These programs, together
106 with the results of any compilations specified, are loaded (in the order
107 given) to produce an executable program with name _\ba._\bo_\bu_\bt.
108
109F\bFI\bIL\bLE\bES\bS
110 _\bf_\bi_\bl_\be._\bc input file
111 _\bf_\bi_\bl_\be._\bo object file
112 _\ba._\bo_\bu_\bt loaded output
113 _\bc_\bt_\bm? temporary
114 /_\bu_\bs_\br/_\bb_\bi_\bn/_\bc_\bp_\bp preprocessor
115 /_\bu_\bs_\br/_\bl_\bi_\bb_\be_\bx_\be_\bc/_\bc_\bc_\bo_\bm compiler
116 /_\bu_\bs_\br/_\bl_\bi_\bb_\be_\bx_\be_\bc/_\bc_\bc_\bo_\bm compiler for single precision floats
117 /_\bu_\bs_\br/_\bl_\bi_\bb_\be_\bx_\be_\bc/_\bc_\b2 optional optimizer
118 /_\bu_\bs_\br/_\bl_\bi_\bb/_\bc_\br_\bt_\b0._\bo runtime startoff
119 /_\bu_\bs_\br/_\bl_\bi_\bb/_\bm_\bc_\br_\bt_\b0._\bo startoff for profiling
120 /_\bu_\bs_\br/_\bl_\bi_\bb/_\bg_\bc_\br_\bt_\b0._\bo startoff for gprof-profiling
121 /_\bu_\bs_\br/_\bl_\bi_\bb/_\bl_\bi_\bb_\bc._\ba standard library, see intro(3)
122 /_\bu_\bs_\br/_\bl_\bi_\bb/_\bl_\bi_\bb_\bc__\bp._\ba profiling library, see intro(3)
123 /_\bu_\bs_\br/_\bi_\bn_\bc_\bl_\bu_\bd_\be standard directory for `#include' files
124 _\bm_\bo_\bn._\bo_\bu_\bt file produced for analysis by prof(1)
125 _\bg_\bm_\bo_\bn._\bo_\bu_\bt file produced for analysis by gprof(1)
126
127
128S\bSE\bEE\bE A\bAL\bLS\bSO\bO
129 B. W. Kernighan and D. M. Ritchie, _\bT_\bh_\be _\bP_\br_\bo_\bg_\br_\ba_\bm_\bm_\bi_\bn_\bg _\bL_\ba_\bn_\bg_\bu_\ba_\bg_\be, Prentice-
130 Hall, 1978
131
132 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
133
134 D. M. Ritchie, _\bC _\bR_\be_\bf_\be_\br_\be_\bn_\bc_\be _\bM_\ba_\bn_\bu_\ba_\bl
135
136 monitor(3), prof(1), gprof(1), adb(1), ld(1), dbx(1), as(1)
137
138D\bDI\bIA\bAG\bGN\bNO\bOS\bST\bTI\bIC\bCS\bS
139 The diagnostics produced by C itself are intended to be self-explanatory.
140 Occasional messages may be produced by the assembler or loader.
141
142H\bHI\bIS\bST\bTO\bOR\bRY\bY
143 The c\bcc\bc compiler was distributed with Version 6 AT&T UNIX.
144
145B\bBU\bUG\bGS\bS
146 The compiler currently ignores advice to put c\bch\bha\bar\br, u\bun\bns\bsi\big\bgn\bne\bed\bd c\bch\bha\bar\br, s\bsh\bho\bor\brt\bt,
147 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 registers, except as noted
148 above. It previously produced poor, and in some cases incorrect, code
149 for such declarations.