CC(1) CC(1) NAME cc, lcc - C compilers SYNOPSIS cc [ option ... ] file ... lcc [ option ... ] file ... DESCRIPTION Cc compiles the classic C language; lcc compiles ANSI. They are otherwise similar. In the absence of options, any named source files are compiled into object files and then linked, together with any named object files, into a single exe- cutable file named Compilation normally has four phases: preprocessing of # directives, compilation to assembly lan- guage, assembly, and linking. Suffixes of file names deter- mine which phases they participate in: .c C source to be preprocessed and compiled. Object code for this file is finally placed in a correspondingly named `.o' file, except when exactly one file is being compiled and linked. .i C source to be compiled without preprocessing; # direc- tives are ignored by cc, forbidden by lcc. .s Assembler source to be assembled, producing a `.o' file. .o A preexisting object file to be linked. Both compilers accept options of ld(1), the most common of which are -o (to substitute a name for a.out) and -l (to link from a library), and in addition -c Suppress the linking phase, producing .o files but no a.out. -g Produce additional symbol table information for debug- gers such as pi(9.1). -O Invoke an object-code improver; superfluous in lcc. -w Suppress warning diagnostics. In lcc, #pragma ref variable supplies a dummy reference to suppress an unused-variable diagnostic. -p Arrange for the compiler to produce code which counts the number of times each routine is called; also, if linking takes place, replace the standard startup CC(1) CC(1) routine by one which arranges to gather profiling data for later examination by prof(1). -pg Like -p but for gprof instead of prof(1). -S Compile the named C programs, and leave the assembler- language output in .s files. -E Run the preprocessor on the named C programs, and send the result to the standard output. -C Prevent the preprocessor from eliding comments. -Dname=def -Dname Define the name to the preprocessor, as if by `#define'. If no definition is given, the name is defined as `1'. Lcc predefines a few symbols on most machines; option -v exposes them. -Uname Remove any initial definition of name. -Idir `#include' files whose names do not begin with `/' are always sought first in the directory of the file argu- ment, then in directories named in -I options, then in directories on a standard list. These options are peculiar to cc: -P Run the preprocessor on each `.c' file. Produce no line numbers. Place results in `.i' files. -R Cause as(1) to make initialized variables shared and read-only. -Bstring Find substitute compiler passes in the files named string with the suffixes cpp, ccom and c2. If string is empty, use a standard backup version. -t[p012] Find only the designated compiler passes in the files whose names are constructed by a -B option. In the absence of a -B option, the string is taken to be These options are peculiar to lcc: -N Do not search standard directories for include files. Omit non-ANSI language extensions. CC(1) CC(1) -A Warn about calls to functions without prototypes. -b produce code that writes an expression-level profile into prof.out. bprint(1) produces an annotated list- ing, and -Wf-a uses the profile to improve register assignments. -dn Generate jump tables for switches with density at least n, a floating-point constant between zero and one, 0.5 by default. -P Write declarations for all defined globals on standard error. -n Produce code that reports and aborts upon dereferencing a zero pointer. -M Run only the preprocessor to generate make(1) dependen- cies on the standard output. -t Produce code to print trace messages at function entry and exit. -Wpopt Pass preprocessor option opt to the (Gnu) preprocessor. For example, -Wp-T allows ANSI trigraph sequences. -Waopt, -Wlopt, -Wfopt Pass option opt to the assembler (as(1)), loader (ld(1)), or compiler proper. -Bstr Use the compiler strrcc instead of the default version. Str usually ends with a slash. -v Report compiler steps (and some version numbers) as they are executed. A second -v causes steps to be reported but not executed. Lcc supports asm(string). The given string constant is copied to the generated assembly language output with occur- rences of %name replaced by the address or register for identifier name if it is visible. Otherwise, %name is sim- ply copied to the output. Wide-character literals are treated as plain char literals; ints and long ints are the same size, as are doubles and long doubles. EXAMPLES lcc -N -I/usr/include/libc file.c Use local include files instead of ANSI standard ones, which lack most functions of Section 2 of this manual, and often disagree (especially about const) with those CC(1) CC(1) in Section 3. See intro(3). FILES Different machines use different file names, so this list is only representative. Lcc option -v exposes the correct names. linked output temporary preprocessor, cpp(8) ANSI preprocessor cc compiler proper optional optimizer for cc assembler, as(1) lcc compiler proper runtime startoff startoff for profiling standard library, see intro(3) directory for cc `#include' files directory for ANSI standard `#include' files directory for local lcc include files SEE ALSO lint(1), ld(1), strip(1), nm(1), prof(1), bprint(1), cin(1), adb(1), pi(9.1), c++(1) B. W. Kernighan and D. M. Ritchie, The C Programming Language, 2nd Ed., Prentice-Hall, 1988 BUGS Cc cannot handle the `-y' flag of ld. Lcc currently uses the pre-ANSI library. MACHINE DEPENDENCIES VAX -pg is unimplemented. Cc and lcc use incompatible bit-field layouts and structure return conventions. MIPS Lcc does not implement -p or -pg, and its -g supports break- points but not the examination of variables. Cc and lcc use incompatible bit-field layouts. Sun Lcc options -Bdynamic and -Bstatic give the binding strat- egy; see ld(1). Cc and lcc use incompatible bit-field layouts and structure return conventions.