CC User Commands CC NNAAMMEE cc - GNU project C Compiler SSYYNNOOPPSSIISS cccc [ option ] ... file ... WWAARRNNIINNGG This man page is an extract of the documentation of the _G_N_U _C _c_o_m_p_i_l_e_r and is limited to the meaning of the options. It is updated only occasionally, because the GNU project does not use nroff. For complete, current documentation, refer to the Info file ggcccc or the DVI file ggcccc..ddvvii which are made from the Texinfo source file ggcccc..tteexxiinnffoo DDEESSCCRRIIPPTTIIOONN The _G_N_U _C _c_o_m_p_i_l_e_r uses a command syntax much like the Unix C compiler. The _c_c program accepts options and file names as operands. Multiple single-letter options may _n_o_t be grouped: `--ddrr' is very different from `--dd --rr'. When you invoke _G_N_U _C_C, it normally does preprocessing, compilation, assem- bly and linking. File names which end in `..cc' are taken as C source to be preprocessed and compiled; compiler output files plus any input files with names ending in `..ss' are assembled; then the resulting object files, plus any other input files, are linked together to produce an executable. Command options allow you to stop this process at an inter- mediate stage. For example, the `--cc' option says not to run the linker. Then the output consists of object files output by the assembler. Other command options are passed on to one stage. Some options control the preprocessor and others the compiler itself. OOPPTTIIOONNSS Here are the options to control the overall compilation pro- cess, including those that say whether to link, whether to assemble, and so on. --oo _f_i_l_e Place linker output in file _f_i_l_e. This applies regard- less to whatever sort of output is being produced, whether it be an executable file, an object file, an assembler file or preprocessed C code. If `--oo' is not specified, the default is to put an executable file in `aa..oouutt', the object file `_s_o_u_r_c_e..cc' in `_s_o_u_r_c_e..oo', an assembler file in `_s_o_u_r_c_e..ss', and preprocessed C on standard output. --mm_t_m Compile code for the target machine given by _t_m. If this switch is not given, then the default is to com- pile for the machine given by the MMAACCHHIINNEE environment variable. The following machine types are currently defined: 6688000000, 6688001100, and ssuunn22 (all of which compile Version 1.33 19 January 1989 1 CC User Commands CC for the 68000 instruction set); 6688002200 and ssuunn33 (both of which compile for the 68020 instruction set); and ssppuurr. See below for additional --mm switches to control other machine-dependent features. --cc Compile or assemble the source files, but do not link. Produce object files with names made by replacing `..cc' or `..ss' with `..oo' at the end of the input file names. Do nothing at all for object files specified as input. --SS Compile into assembler code but do not assemble. The assembler output file name is made by replacing `..cc' with `..ss' at the end of the input file name. Do noth- ing at all for assembler source files or object files specified as input. --EE Run only the C preprocessor. Preprocess all the C source files specified and output the results to stan- dard output. --vv Compiler driver program prints the commands it executes as it runs the preprocessor, compiler proper, assembler and linker. Some of these are directed to print their own version numbers. --BB_p_r_e_f_i_x Compiler driver program tries _p_r_e_f_i_x as a prefix for each program it tries to run. These programs are `ccpppp', `cccc11..IIttmm' (where _t_m is the target machine for which code is being generated, such as given in the --mm switch), `aass' and `lldd'. For each subprogram to be run, the compiler driver first tries the `--BB' prefix, if any. If that name is not found, or if `--BB' was not Specified, the driver tries standard prefixes corresponding to system directories. If neither of those results in a file name that is found, the unmodi- fied program name is searched for using the directories specified in your `PPAATTHH' environment variable. The run-time support file `ggnnuulliibb' is also searched for using the `--BB' prefix, if needed. If it is not found there, the two standard prefixes above are tried, and that is all. The file is left out of the link if it is not found by those means. Most of the time, on most machines, you can do without it. These options control the C preprocessor, which is run on each C source file before actual compilation. If you use the `--EE' option, nothing is done except C preprocessing. Some of these options make sense only together with `--EE' because they request preprocessor output that is not suit- able for actual compilation. Version 1.33 19 January 1989 2 CC User Commands CC --CC Tell the preprocessor not to discard comments. Used with the `--EE' option. --II_d_i_r Search directory _d_i_r for include files. --II-- Any directories specified with `--II' options before the `--II--' option are searched only for the case of `##iinncclluuddee ""_f_i_l_e""'; they are not searched for `##iinncclluuddee <<_f_i_l_e>>'. If additional directories are specified with `--II' options after the `--II--', these directories are searched for all `##iinncclluuddee' directives. (Ordinally _a_l_l `--II' directories are used this way.) In addition, the `--II--' option inhibits the use of the current directory as the first search directory for `##iinncclluuddee ""_f_i_l_e""'. Therefore, the current directory is searched only if it is requested explicitly with `--II..'. Specifying both `--II--' and `--II..' allows you to control precisely which directories are searched before the current one and which are searched after. --nnoossttddiinncc Do not search the standard system directories for header files. Only the directories you have specified with `--II' options (and the current directory, if appropriate) are searched. Between `--nnoossttddiinncc' and `--II--', you can eliminate all directories from the search path except those you specify. --MM Tell the preprocessor to output a rule suitable for mmaakkee describing the dependencies of each source file. For each source file, the preprocessor outputs one mmaakkee-rule whose target is the object file name for that source file and whose dependencies are all the files `##iinncclluuddee'd in it. This rule may be a single line or may be continued `\\'-newline if it is long.`--MM' implies `--EE'. --MMMM Like `--MM' but the output mentions only the user-header files included with `##iinncclluuddee ""_f_i_l_e""'. System header files included with `##iinncclluuddee <<_f_i_l_e>>' are omitted.`--MMMM' implies `--EE'. --DD_m_a_c_r_o Define macro _m_a_c_r_o with the empty string as its defini- tion. --DD_m_a_c_r_o=_d_e_f_n Define macro _m_a_c_r_o as _d_e_f_n. --UU_m_a_c_r_o Undefine macro _m_a_c_r_o. Version 1.33 19 January 1989 3 CC User Commands CC --TT Support ANSI C trigraphs. You don't want to know about this brain-damage. The `--aannssii' option also has this effect. These options control the details of C compilation itself. --aannssii Support all ANSI standard C programs. This turns off certain features of GNU C that are incompatible with ANSI C, such as the aassmm, iinnlliinnee and ttyyppeeooff keywords, and predefined macros such as uunniixx and vvaaxx that iden- tify the type of system you are using. It also enables the undesirable and rarely used ANSI trigraph feature. The `--aannssii' option does not cause non-ANSI programs to be rejected gratuitously. For that, `--ppeeddaannttiicc' is required in addition to `--aannssii'. The macro ____SSTTRRIICCTT__AANNSSII____ is predefined when the `-ansi' option is used. Some header files may notice this macro and refrain from declaring certain functions or defining certain macros that the ANSI standard doesn't call for; this is to avoid interfering with any programs that might use these names for other things. --ttrraaddiittiioonnaall Attempt to support some aspects of traditional C com- pilers. Specifically: * All eexxtteerrnn declarations take effect globally even if they are written inside of a function definition. This includes implicit declarations of functions. * The keywords ttyyppeeooff, iinnlliinnee, ssiiggnneedd, ccoonnsstt and vvoollaa-- ttiillee are not recognized. * Comparisons between pointers and integers are always allowed. * Integer types uunnssiiggnneedd sshhoorrtt and uunnssiiggnneedd cchhaarr pro- mote to uunnssiiggnneedd iinntt. * Out-of-range floating point literals are not an error. * All automatic variables not declared rreeggiisstteerr are preserved by lloonnggjjmmpp. Ordinarily, GNU C follows ANSI C: automatic variables not declared vvoollaattiillee may be clobbered. * In the preprocessor, comments convert to nothing at all, rather than to a space. This allows traditional token concatenation. * In the preprocessor, macro arguments are recognized within string constants in a macro definition (and their values are stringified, though without additional quote marks, when they appear in such a context). The preprocessor also considers a string constant to end at a newline. * The predefined macro ____SSTTDDCC____ is not defined when you use `--ttrraaddiittiioonnaall', but ____GGNNUUCC____ is (since the GNU Version 1.33 19 January 1989 4 CC User Commands CC extensions which ____GGNNUUCC____ indicates are not affected by `--ttrraaddiittiioonnaall'). If you need to write header files that work differently depending on whether `--ttrraaddii-- ttiioonnaall' is in use, by testing both of these predefined macros you can distinguish four situations: GNU C, traditional GNU C, other ANSI C compilers, and other old C compilers. --OO Optimize. Optimizing compilation takes somewhat more time, and a lot more memory for a large function. Without `--OO', the compiler's goal is to reduce the cost of compilation and to make debugging produce the expected results. Statements are independent: if you stop the program with a breakpoint between statements, you can then assign a new value to any variable or change the program counter to any other statement in the function and get exactly the results you would expect from the source code. Without `--OO', only vari- ables declared rreeggiisstteerr are allocated in registers. The resulting compiled code is a little worse than pro- duced by PCC without `--OO'. With `--OO', the compiler tries to reduce code size and execution time. Some of the `--ff' options described below turn specific kinds of optimization on or off. --gg Produce debugging information in the operating system's native format (for DBX or SDB). GDB also can work with this debugging information. Unlike most other C com- pilers, GNU CC allows you to use `--gg' with`--OO'. The short cuts taken by optimized code may occasionally produce surprising results: some variables you declared may not exist at all; flow of control may briefly move where you did not expect it; some statements may not be executed because they compute constant results or their values were already at hand; some statements may exe- cute in different places because they were moved out of loops. Nevertheless it proves possible to debug optim- ized output. This makes it reasonable to use the optimizer for programs that might have bugs. --gggg Produce debugging information in GDB's (the GNU Debugger's) own format. This requires the GNU assem- bler and linker in order to work. This feature will probably be eliminated. It was intended to enable GDB to read the symbol table faster, but it doesn't result in enough of a speedup to be worth the larger object files and executables. We are working on other ways of making GDB start even faster, which work with DBX for- mat debugging information and could be made to work with SDB format. --ww Inhibit all warning messages. Version 1.33 19 January 1989 5 CC User Commands CC --WW Print extra warning messages for these events: * An automatic variable is used without first being initialized. These warnings are possible only in optimizing compilation, because they require data flow information that is computed only when optimizing. They occur only for variables that are candidates for regis- ter allocation. Therefore, they do not occur for a variable that is declared vvoollaattiillee,, or whose address is taken, or whose size is other than 1,2,4 or 8 bytes. Also, they do not occur for structures, unions or arrays, even when they are in registers. Note that there may be no warning about a variable that is used only to compute a value that itself is never used, because such computations may be deleted by the flow analysis pass before the warnings are printed. These warnings are made optional because GNU CC is not smart enough to see all the reasons why the code might be correct despite appearing to have an error. * A nonvolatile automatic variable might be changed by a call to lloonnggjjmmpp. These warnings as well are possible only in optimizing compilation. The compiler sees only the calls to sseettjjmmpp. It cannot know where lloonnggjjmmpp will be called; in fact, a signal handler could call it at any point in the code. As a result, you may get a warn- ing even when there is in fact no problem because lloonnggjjmmpp cannot in fact be called at the place which would cause a problem. * A function can return either with or without a value. (Falling off the end of the function body is considered returning without a value.) Spurious warning can occur because GNU CC does not realize that certain functions (including aabboorrtt and lloonnggjjmmpp) will never return. * An expression-statement contains no side effects. --WWiimmpplliicciitt Warn whenever a function is implicitly declared. --WWrreettuurrnn--ttyyppee Warn whenever a function is defined with a return-type that defaults to iinntt. Also warn about any rreettuurrnn state- ment with no return-value in a function whose return- type is not vvooiidd. --WWuunnuusseedd Warn whenever a local variable is unused aside from its declaration. --WWccoommmmeenntt Warn whenever a comment-start sequence `/*' appears in a comment. --WWaallll Version 1.33 19 January 1989 6 CC User Commands CC All of the above --WW options combined. --WWwwrriittee--ssttrriinnggss Give string constants the type ccoonnsstt cchhaarr[[_l_e_n_g_t_h]] so that copying the address of one into a non-ccoonnsstt cchhaarr ** pointer will get a warning. These warnings will help you find at compile time code that can try to write into a string constant, but only if you have been very careful about using ccoonnsstt in declarations and proto- types. Otherwise, it will just be a nuisance; this is why we did not make --WWaallll request these warnings. --pp Generate extra code to write profile information suit- able for the analysis program pprrooff. --ppgg Generate extra code to write profile information suit- able for the analysis program ggpprrooff. --ll_l_i_b_r_a_r_y Search a standard list of directories for a library named _l_i_b_r_a_r_y, which is actually a file named `lliibb_l_i_b_r_a_r_y..aa'. The linker uses this file as if it had been specified precisely by name. The directories searched include several standard system directories plus any that you specify with `--LL'. Normally the files found this way are library files - archive files whose members are object files. The linker handles an archive file by scanning through it for members which define symbols that have so far been referenced but not defined. But if the file that is found is an ordinary object file, it is linked in the usual fashion. The only difference between an `--ll' option and specifying a file name is that `--ll' searches several directories. --LL_d_i_r Add directory _d_i_r to the list of directories to be searched for `--ll'. --nnoossttddlliibb Don't use the standard system libraries and startup files when linking. Only the files you specify (plus `ggnnuulliibb') will be passed to the linker. --mm_m_a_c_h_i_n_e_s_p_e_c Machine-dependent option specifying something about the type of target machine. These are the `--mm' options defined for 68000-class machines: --mm6688888811 Generate output containing 68881 instructions for Version 1.33 19 January 1989 7 CC User Commands CC floating point. This is the default if you use the unmodified sources. --mmffppaa Generate output containing Sun FPA instructions for floating point. --mmssoofftt--ffllooaatt Generate output containing library calls for floating point. --mmsshhoorrtt Consider type iinntt to be 16 bits wide, like sshhoorrtt iinntt. --mmnnoobbiittffiieelldd Do not use the bit-field instructions. ``--mm6688000000'' implies ``--mmnnoobbiittffiieelldd''.. --mmbbiittffiieelldd Do use the bit-field instructions. ``--mm6688002200'' implies ``--mmbbiittffiieelldd''.. This is the default if you use the unmodified sources. --mmrrttdd Use a different function-calling convention, in which functions that take a fixed number of argu- ments return with the rrttdd instruction, which pops their arguments while returning. This saves one instruction in the caller since there is no need to pop the arguments there. This calling conven- tion is incompatible with the one normally used on Unix, so you cannot use it if you need to call libraries compiled with the Unix compiler. Also, you must provide function prototypes for all func- tions that take variable numbers of arguments (including pprriinnttff); otherwise incorrect code will be generated for calls to those functions. In addition, seriously incorrect code will result if you call a function with too many arguments. (Normally, extra arguments are harmlessly ignored.) The rrttdd instruction is supported by the 68010 and 68020 processors, but not by the 68000. These are the `--mm' options defined in the VAX machine description: --mmuunniixx Do not output certain jump instructions (aaoobblleeqq and so on) that the Unix assembler for the VAX cannot handle across long ranges. Version 1.33 19 January 1989 8 CC User Commands CC --mmggnnuu Do output those jump instructions, on the assump- tion that you will assemble with the GNU assem- bler. --mmgg Output code for g-format floating point numbers instead of d-format. --ff_f_l_a_g Specify machine-independent flags. Most flags have both positive and negative forms; the negative form of `--ffffoooo' would be `--ffnnoo--ffoooo'. In the table below, only one of the forms is listed---the one which is not the default. You can figure out the other form by either removing `nnoo--' or adding it. --ffffllooaatt--ssttoorree Do not store floating-point variables in regis- ters. This prevents undesirable excess precision on machines such as the 68000 where the floating registers (of the 68881) keep more precision than a ddoouubbllee is supposed to have. For most programs, the excess precision does only good, but a few programs rely on the precise definition of IEEE floating point. Use `--ffffllooaatt--ssttoorree' for such pro- grams. --ffnnoo--aassmm Do not recognize aassmm, iinnlliinnee or ttyyppeeooff as a key- word. These words may then be used as identifiers. --ffnnoo--ddeeffeerr--ppoopp Always pop the arguments to each function call as soon as that function returns. Normally the com- piler (when optimizing) lets arguments accumulate on the stack for several function calls and pops them all at once. --ffssttrreennggtthh--rreedduuccee Perform the optimizations of loop strength reduc- tion and elimination of iteration variables. --ffccoommbbiinnee--rreeggss Allow the combine pass to combine an instruction that copies one register into another. This might or might not produce better code when used in addition to `--OO'. --ffffoorrccee--mmeemm Force memory operands to be copied into registers before doing arithmetic on them. This may produce Version 1.33 19 January 1989 9 CC User Commands CC better code by making all memory references poten- tial common subexpressions. When they are not common subexpressions, instruction combination should eliminate the separate register-load. --ffffoorrccee--aaddddrr Force memory address constants to be copied into registers before doing arithmetic on them. This may produce better code just as `--ffffoorrccee--mmeemm' may. --ffoommiitt--ffrraammee--ppooiinntteerr Don't keep the frame pointer in a register for functions that don't need one. This avoids the instructions to save, set up and restore frame pointers; it also makes an extra register avail- able in many functions. IItt aallssoo mmaakkeess ddeebbuuggggiinngg iimmppoossssiibbllee.. On some machines, such as the VAX, this flag has no effect, because the standard calling sequence automatically handles the frame pointer and noth- ing is saved by pretending it doesn't exist. The machine-description macro FFRRAAMMEE__PPOOIINNTTEERR__RREEQQUUIIRREEDD controls whether a target machine supports this flag. --ffiinnlliinnee--ffuunnccttiioonnss Integrate all simple functions into their callers. The compiler heuristically decides which functions are simple enough to be worth integrating in this way. If all calls to a given function are integrated, and the function is declared ssttaattiicc, then the function is normally not output as assem- bler code in its own right. --ffkkeeeepp--iinnlliinnee--ffuunnccttiioonnss Even if all calls to a given function are integrated, and the function is declared ssttaattiicc, nevertheless output a separate run-time callable version of the function. --ffwwrriittaabbllee--ssttrriinnggss Store string constants in the writable data seg- ment and don't uniquize them. This is for compa- tibility with old programs which assume they can write into string constants. Writing into string constants is a very bad idea; ``constants'' should be constant. --ffccoonndd--mmiissmmaattcchh Allow conditional expressions with mismatched types in the second and third arguments. The value of such an expression is void. Version 1.33 19 January 1989 10 CC User Commands CC --ffnnoo--ffuunnccttiioonn--ccssee Do not put function addresses in registers; make each instruction that calls a constant function contain the function's address explicitly. This option results in less efficient code, but some strange hacks that alter the assembler output may be confused by the optimizations performed when this option is not used. --ffvvoollaattiillee Consider all memory references through pointers to be volatile. --ffsshhaarreedd--ddaattaa Requests that the data and non-ccoonnsstt variables of this compilation be shared data rather than private data. The distinction makes sense only on certain operating systems, where shared data is shared between processes running the same program, while private data exists in one copy per process. --ffuunnssiiggnneedd--cchhaarr Let the type cchhaarr be the unsigned, like uunnssiiggnneedd cchhaarr. Each kind of machine has a default for what cchhaarr should be. It is either like uunnssiiggnneedd cchhaarr by default of like ssiiggnneedd cchhaarr by default. (Actually, at present, the default is always signed.) The type cchhaarr is always a distinct type from either ssiiggnneedd cchhaarr or uunnssiiggnneedd cchhaarr, even though its behavior is always just like one of those two. Note that this is equivalent to `--ffnnoo--ssiiggnneedd-- cchhaarr', which is the negative form of `--ffssiiggnneedd-- cchhaarr'. --ffssiiggnneedd--cchhaarr Let the type cchhaarr be the same as ssiiggnneedd cchhaarr. Note that this is equivalent to `--ffnnoo--uunnssiiggnneedd-- cchhaarr', which is the negative form of `--ffuunnssiiggnneedd-- cchhaarr'. --ffffiixxeedd--_r_e_g Treat the register named _r_e_g as a fixed register; generated code should never refer to it (except perhaps as a stack pointer, frame pointer or in some other fixed role). _r_e_g must be the name of a register. The register names accepted are machine-specific and are defined in the RREEGGIISSTTEERR__NNAAMMEESS macro in the machine description macro file. This flag does not have a negative form, because it specifies a three-way choice. --ffccaallll--uusseedd--_r_e_g Version 1.33 19 January 1989 11 CC User Commands CC Treat the register named _r_e_g as an allocatable register that is clobbered by function calls. It may be allocated for temporaries or variables that do not live across a call. Functions compiled this way will not save and restore the register _r_e_g. Use of this flag for a register that has a fixed pervasive role in the machine's execution model, such as the stack pointer or frame pointer, will produce disastrous results. This flag does not have a negative form, because it specifies a three-way choice. --ffccaallll--ssaavveedd--_r_e_g Treat the register named _r_e_g as an allocatable register saved by functions. It may be allocated even for temporaries or variables that live across a call. Functions compiled this way will save and restore the register _r_e_g if they use it. Use of this flag for a register that has a fixed per- vasive role in the machine's execution model, such as the stack pointer or frame pointer, will pro- duce disastrous results. A different sort of disaster will result from the use of this flag for a register in which function values may be returned. This flag does not have a negative form, because it specifies a three-way choice. --dd_l_e_t_t_e_r_s Says to make debugging dumps at times specified by _l_e_t_t_e_r_s. Here are the possible letters: rr Dump after RTL generation. jj Dump after first jump optimization. JJ Dump after last jump optimization. ss Dump after CSE (including the jump optimization that sometimes follows CSE). LL Dump after loop optimization. ff Dump after flow analysis. cc Dump after instruction combination. ll Dump after local register allocation. gg Dump after global register allocation. mm Print statistics on memory usage, at the end of the run. Version 1.33 19 January 1989 12 CC User Commands CC --ppeeddaannttiicc Issue all the warnings demanded by strict ANSI standard C; reject all programs that use forbidden extensions. Valid ANSI standard C programs should compile properly with or without this option (though a rare few will require `--aannssii'. However, without this option, certain GNU extensions and traditional C features are supported as well. With this option, they are rejected. There is no reason to _u_s_e this option; it exists only to satisfy pedants. FFIILLEESS file.c input file file.o object file a.out loaded output /tmp/cc? temporary /sprite/cmds/cpp preprocessor /sprite/cmds/cc1._t_m compiler /usr/local/lib/gcc-gnulib library need by GCC on some machines /sprite/lib/include/_t_m.md standard directory for machine- dependent `#include' files /sprite/lib/_t_m.md/libc.a standard library /sprite/lib/include standard directory for `#include' files SSEEEE AALLSSOO adb(1), ld(1), dbx(1), as(1) BBUUGGSS Bugs should be reported to bug-gcc@prep.ai.mit.edu. Bugs tend actually to be fixed if they can be isolated, so it is in your interest to report them in such a way that they can be easily reproduced. CCOOPPYYIINNGG Copyright (c) 1988 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this per- mission notice are preserved on all copies. Permission is granted to copy and distribute modified ver- sions of this manual under the conditions for verbatim copy- ing, provided that the entire resulting derived work is dis- tributed under the terms of a permission notice identical to this one. Permission is granted to copy and distribute translations of this manual into another language, under the above condi- tions for modified versions, except that this permission notice may be included in translations approved by the Free Software Foundation instead of in the original English. Version 1.33 19 January 1989 13 CC User Commands CC AAUUTTHHOORRSS See the GNU CC Manual for the contributors to GNU CC. Version 1.33 19 January 1989 14