1.\" Copyright (c) 1980, 1990 The Regents of the University of California. 2.\" All rights reserved. 3.\" 4.\" %sccs.include.redist.roff% 5.\" 6.\" @(#)cc.1 6.7 (Berkeley) 08/09/91 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 17Ar ... 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.Bl -tag -width Ds 43.It 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.It 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.It 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.It Fl w 63Suppress warning diagnostics. 64.It 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.It 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.It Fl O 87Invoke an 88object-code improver. 89.It Fl R 90Passed on to 91.Xr as 1 92making initialized variables shared and read-only. 93.It Fl S 94Compile the named C programs, and leave the 95assembler-language output on corresponding files suffixed `.s'. 96.It 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.It Fl E 102Run only the macro preprocessor 103on the named C programs, and send the result to the 104standard output. 105.It Fl C 106prevent the macro preprocessor from eliding comments. 107.It Fl o Ns Ar output 108Name the final output file 109.Ar output . 110If this option is used the file `a.out' will be left undisturbed. 111.El 112.Bl -tag -width Ds -compact 113.It Fl D Ns Ar name=def 114.It Fl D Ns Ar name 115Define the 116.Ar name 117to the preprocessor, 118as if by `#define'. 119If no definition is given, the name is defined as "1". 120.El 121.Bl -tag -width Ds 122.It Fl U Ns Ar name 123Remove any initial definition of 124.Ar name . 125.It Fl I Ns Ar dir 126`#include' files 127whose names do not begin with `/' 128are always 129sought first in the directory 130of the 131.Ar file 132argument, 133then in directories named in 134.Fl I 135options, 136then in directories on a standard list. 137.It Fl L Ns Ar dir 138Library archives are sought first in 139directories named in 140.Fl L 141options, 142then in directories on a standard list. 143.It Fl f 144Use an alternate compiler which does not convert expressions involving 145only floats to double. This does not conform to the standard which states 146that all intermediate results should be converted to double but does 147provide a speed improvement for programs which don't require full double 148precision. This option also makes 149.Sy register float 150variables work appropriately. 151.It Fl B Ns Ar path 152Find substitute compiler passes in the named path 153with the suffixes cpp, ccom and c2. 154.It Fl t Ns Op p012 155Find only the designated compiler passes in the 156files whose names are constructed by a 157.Fl B 158option. 159.El 160.Pp 161Other arguments 162are taken 163to be either loader option arguments, or C-compatible 164object programs, typically produced by an earlier 165.Nm cc 166run, 167or perhaps libraries of C-compatible routines. 168These programs, together with the results of any 169compilations specified, are loaded (in the order 170given) to produce an executable program with name 171.Pa a.out . 172.Sh FILES 173.Bl -tag -width /usr/libexec/sccom -compact 174.It Pa file.c 175Input file. 176.It Pa file.o 177Object file. 178.It Pa a.out 179Loaded output. 180.It Pa ctm? 181Temporary. 182.It Pa /usr/bin/cpp 183Preprocessor. 184.It Pa /usr/libexec/ccom 185Compiler. 186.It Pa /usr/libexec/ccom 187Compiler for single precision floats. 188.It Pa /usr/libexec/c2 189Optional optimizer. 190.It Pa /usr/lib/crt0.o 191Runtime startoff. 192.It Pa /usr/lib/mcrt0.o 193Startoff for profiling. 194.It Pa /usr/lib/gcrt0.o 195Startoff for gprof-profiling. 196.It Pa /usr/lib/libc.a 197Standard library, see. 198.Xr intro 3 . 199.It Pa /usr/lib/libc_p.a 200Profiling library, see 201.Xr intro 3 . 202.It Pa /usr/include 203Standard directory for `#include' files. 204.It Pa mon.out 205File produced for analysis by 206.Xr prof 1 . 207.It Pa gmon.out 208File produced for analysis by 209.Xr gprof 1 . 210.El 211.Sh SEE ALSO 212.Xr monitor 3 , 213.Xr prof 1 , 214.Xr gprof 1 , 215.Xr adb 1 , 216.Xr ld 1 , 217.Xr dbx 1 , 218.Xr as 1 219.Rs 220.%A B. W. Kernighan 221.%A D. M. Ritchie 222.%T "The Programming Language" 223.%I Prentice-Hall 224.%D 1978 225.Re 226.Rs 227.%A B. W. Kernighan 228.%T "Programming in C \- a tutorial" 229.Re 230.Rs 231.%A D. M. Ritchie 232.%T "C Reference Manual" 233.Re 234.Sh DIAGNOSTICS 235The diagnostics produced by C itself are intended to be 236self-explanatory. 237Occasional messages may be produced by the assembler 238or loader. 239.Sh HISTORY 240The 241.Nm \&cc 242compiler was distributed with 243.At v6 . 244.Sh BUGS 245The compiler currently ignores advice to put 246.Ic char , 247.Ic unsigned char , 248.Ic short , 249.Ic unsigned short , 250.Ic float , 251or 252.Ic double 253variables in registers, except as noted above. It previously 254produced poor, and in some cases incorrect, code for such declarations. 255