.\" Copyright (c) 1980, 1990 The Regents of the University of California. .\" All rights reserved. The Berkeley software License Agreement .\" specifies the terms and conditions for redistribution. .\" .\" @(#)cc.1 6.6 (Berkeley) 7/24/90 .\" .Dd July 24, 1990 .Dt CC 1 .Os BSD 4 .Sh NAME .Nm cc .Nd C compiler .Sh SYNOPSIS .Nm cc .Op option ... .Ar file ... .Sh DESCRIPTION .Nm Cc is the UNIX C compiler. .Nm Cc accepts several types of arguments: .Pp Arguments whose names end with `.c' are taken to be C source programs; they are compiled, and each object program is left on the file whose name is that of the source with `.o' substituted for `.c'. The `.o' file is normally deleted, however, if a single C program is compiled and loaded all at one go. .Pp In the same way, arguments whose names end with `.s' are taken to be assembly source programs and are assembled, producing a `.o' file. .Pp The following options are interpreted by .Nm cc . See .Xr ld 1 for load-time options. .Tw Ds .Tp Fl c Suppress the loading phase of the compilation, and force an object file to be produced even if only one program is compiled. .Tp Fl g Have the compiler produce additional symbol table information for .Xr dbx 1 Also pass the .Fl lg flag to .Xr ld 1 . .Tp Fl go Have the compiler produce additional symbol table information for the obsolete debugger .Xr sdb 1 . Also pass the .Fl lg flag to .Xr ld 1 . .Tp Fl w Suppress warning diagnostics. .Tp Fl p Arrange for the compiler to produce code which counts the number of times each routine is called. If loading takes place, replace the standard startup routine by one which automatically calls .Xr monitor 3 at the start and arranges to write out a .Pa mon.out file at normal termination of execution of the object program. An execution profile can then be generated by use of .Xr prof 1 . .Tp Fl pg Causes the compiler to produce counting code in the manner of .Fl p but invokes a run-time recording mechanism that keeps more extensive statistics and produces a .Pa gmon.out file at normal termination. Also, a profiling library is searched, in lieu of the standard C library. An execution profile can then be generated by use of .Xr gprof 1 . .Tp Fl O Invoke an object-code improver. .Tp Fl R Passed on to .Xr as 1 making initialized variables shared and read-only. .Tp Fl S Compile the named C programs, and leave the assembler-language output on corresponding files suffixed `.s'. .Tp Fl M Run only the macro preprocessor on the named C programs, requesting it to generate Makefile dependencies and send the result to the standard output. .Tp Fl E Run only the macro preprocessor on the named C programs, and send the result to the standard output. .Tp Fl C prevent the macro preprocessor from eliding comments. .Tp Cx Fl o .Cx \& \& .Ar output .Cx Name the final output file .Ar output . If this option is used the file `a.out' will be left undisturbed. .Tp .Dw Ds .Di L .Dp Cx Fl D .Ar name=def .Cx .Dp Cx Fl D .Ar name .Cx Define the .Ar name to the preprocessor, as if by `#define'. If no definition is given, the name is defined as "1". .Dp .Tw Ds .Tp Cx Fl U .Ar name .Cx Remove any initial definition of .Ar name . .Tp Cx Fl I .Ar dir .Cx `#include' files whose names do not begin with `/' are always sought first in the directory of the .Ar file argument, then in directories named in .Fl I options, then in directories on a standard list. .Tp Cx Fl L .Ar dir .Cx Library archives are sought first in directories named in .Fl L options, then in directories on a standard list. .Tp Fl f Use an alternate compiler which does not convert expressions involving only floats to double. This does not conform to the standard which states that all intermediate results should be converted to double but does provide a speed improvement for programs which don't require full double precision. This option also makes .Sy register float variables work appropriately. .Tp Cx Fl B .Ar path .Cx Find substitute compiler passes in the named path with the suffixes cpp, ccom and c2. .Tp Cx Fl t .Op p012 .Cx Find only the designated compiler passes in the files whose names are constructed by a .Fl B option. .Tp .Pp Other arguments are taken to be either loader option arguments, or C-compatible object programs, typically produced by an earlier .Nm cc run, or perhaps libraries of C-compatible routines. These programs, together with the results of any compilations specified, are loaded (in the order given) to produce an executable program with name .Pa a.out . .Sh FILES .Dw /usr/libexec/sccom .Di L .Dp Pa file.c input file .Dp Pa file.o object file .Dp Pa a.out loaded output .Dp Pa ctm? temporary .Dp Pa /usr/bin/cpp preprocessor .Dp Pa /usr/libexec/ccom compiler .Dp Pa /usr/libexec/ccom compiler for single precision floats .Dp Pa /usr/libexec/c2 optional optimizer .Dp Pa /usr/lib/crt0.o runtime startoff .Dp Pa /usr/lib/mcrt0.o startoff for profiling .Dp Pa /usr/lib/gcrt0.o startoff for gprof-profiling .Dp Pa /usr/lib/libc.a standard library, see .Xr intro 3 .Dp Pa /usr/lib/libc_p.a profiling library, see .Xr intro 3 .Dp Pa /usr/include standard directory for `#include' files .Dp Pa mon.out file produced for analysis by .Xr prof 1 .Dp Pa gmon.out file produced for analysis by .Xr gprof 1 .Dp .Sh SEE ALSO B. W. Kernighan and D. M. Ritchie, .Em The Programming Language , Prentice-Hall, 1978 .Pp B. W. Kernighan, .Em Programming in C \- a tutorial .Pp D. M. Ritchie, .Em C Reference Manual .Pp .Xr monitor 3 , .Xr prof 1 , .Xr gprof 1 , .Xr adb 1 , .Xr ld 1 , .Xr dbx 1 , .Xr as 1 .Sh DIAGNOSTICS The diagnostics produced by C itself are intended to be self-explanatory. Occasional messages may be produced by the assembler or loader. .Sh HISTORY The .Nm compiler was distributed with Version 6 AT&T UNIX. .Sh BUGS The compiler currently ignores advice to put .Ic char , .Ic unsigned char , .Ic short , .Ic unsigned short , .Ic float , or .Ic double variables in registers, except as noted above. It previously produced poor, and in some cases incorrect, code for such declarations.