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