home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / msdos / djgpp / docs / gcc / invoke.tex < prev    next >
Encoding:
Text File  |  1993-05-29  |  132.0 KB  |  3,525 lines

  1. @c Copyright (C) 1988, 1989, 1992, 1993 Free Software Foundation, Inc.
  2. @c This is part of the GCC manual.
  3. @c For copying conditions, see the file gcc.texi.
  4.  
  5. @node Invoking GCC
  6. @chapter GNU CC Command Options
  7. @cindex GNU CC command options
  8. @cindex command options
  9. @cindex options, GNU CC command
  10.  
  11. When you invoke GNU CC, it normally does preprocessing, compilation,
  12. assembly and linking.  The ``overall options'' allow you to stop this
  13. process at an intermediate stage.  For example, the @samp{-c} option
  14. says not to run the linker.  Then the output consists of object files
  15. output by the assembler.
  16.  
  17. Other options are passed on to one stage of processing.  Some options
  18. control the preprocessor and others the compiler itself.  Yet other
  19. options control the assembler and linker; most of these are not
  20. documented here, since you rarely need to use any of them.
  21.  
  22. @cindex C compilation options
  23. Most of the command line options that you can use with GNU CC are useful
  24. for C programs; when an option is only useful with another language
  25. (usually C++), the explanation says so explicitly.  If the description
  26. for a particular option does not mention a source language, you can use
  27. that option with all supported languages.
  28.  
  29. @cindex C++ compilation options
  30. @xref{Invoking G++,,Compiling C++ Programs}, for a summary of special
  31. options for compiling C++ programs.
  32.  
  33. @cindex grouping options
  34. @cindex options, grouping
  35. The @code{gcc} program accepts options and file names as operands.  Many
  36. options have multiletter names; therefore multiple single-letter options
  37. may @emph{not} be grouped: @samp{-dr} is very different from @w{@samp{-d
  38. -r}}.
  39.  
  40. @cindex order of options
  41. @cindex options, order
  42. You can mix options and other arguments.  For the most part, the order
  43. you use doesn't matter.  Order does matter when you use several options
  44. of the same kind; for example, if you specify @samp{-L} more than once,
  45. the directories are searched in the order specified.
  46.  
  47. Many options have long names starting with @samp{-f} or with
  48. @samp{-W}---for example, @samp{-fforce-mem},
  49. @samp{-fstrength-reduce}, @samp{-Wformat} and so on.  Most of
  50. these have both positive and negative forms; the negative form of
  51. @samp{-ffoo} would be @samp{-fno-foo}.  This manual documents
  52. only one of these two forms, whichever one is not the default.
  53.  
  54. @menu
  55. * Option Summary::    Brief list of all options, without explanations.
  56. * Overall Options::     Controlling the kind of output:
  57.                         an executable, object files, assembler files,
  58.                         or preprocessed source.
  59. * Invoking G++::    Compiling C++ programs.
  60. * C Dialect Options::   Controlling the variant of C language compiled.
  61. * C++ Dialect Options:: Variations on C++.
  62. * Warning Options::     How picky should the compiler be?
  63. * Debugging Options::   Symbol tables, measurements, and debugging dumps.
  64. * Optimize Options::    How much optimization?
  65. * Preprocessor Options:: Controlling header files and macro definitions.
  66.                          Also, getting dependency information for Make.
  67. * Assembler Options::   Passing options to the assembler.
  68. * Link Options::        Specifying libraries and so on.
  69. * Directory Options::   Where to find header files and libraries.
  70.                         Where to find the compiler executable files.
  71. * Target Options::      Running a cross-compiler, or an old version of GNU CC.
  72. * Submodel Options::    Specifying minor hardware or convention variations,
  73.                         such as 68010 vs 68020.
  74. * Code Gen Options::    Specifying conventions for function calls, data layout
  75.                         and register usage.
  76. * Environment Variables:: Env vars that affect GNU CC.
  77. * Running Protoize::    Automatically adding or removing function prototypes.
  78. @end menu
  79.  
  80. @node Option Summary
  81. @section Option Summary
  82.  
  83. Here is a summary of all the options, grouped by type.  Explanations are
  84. in the following sections.
  85.  
  86. @table @emph
  87. @item Overall Options
  88. @xref{Overall Options,,Options Controlling the Kind of Output}.
  89. @smallexample
  90. -c  -S  -E  -o @var{file}  -pipe  -v  -x @var{language} 
  91. @end smallexample
  92.  
  93. @item C Language Options
  94. @xref{C Dialect Options,,Options Controlling C Dialect}.
  95. @smallexample
  96. -ansi  -fcond-mismatch  -fno-asm  -fno-builtin
  97. -fsigned-bitfields  -fsigned-char 
  98. -funsigned-bitfields  -funsigned-char  -fwritable-strings
  99. -traditional  -traditional-cpp  -trigraphs
  100. @end smallexample
  101.  
  102. @item C++ Language Options
  103. @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
  104. @smallexample
  105. -fall-virtual  -fdollars-in-identifiers
  106. -felide-constructors  -fenum-int-equiv  -fmemoize-lookups
  107. -fno-strict-prototype  -fnonnull-objects
  108. -fthis-is-variable  -nostdinc++
  109. @end smallexample
  110.  
  111. @item Warning Options
  112. @xref{Warning Options,,Options to Request or Suppress Warnings}.
  113. @smallexample
  114. -fsyntax-only  -pedantic  -pedantic-errors
  115. -w  -W  -Wall  -Waggregate-return  -Wcast-align  
  116. -Wcast-qual  -Wchar-subscript  -Wcomment  -Wconversion
  117. -Wenum-clash  -Werror  -Wformat  -Wid-clash-@var{len}
  118. -Wimplicit  -Wimport  -Winline  -Wmissing-prototypes
  119. -Wnested-externs  -Woverloaded-virtual  -Wparentheses
  120. -Wpointer-arith  -Wredundant-decls  -Wreturn-type
  121. -Wshadow  -Wstrict-prototypes  -Wswitch
  122. -Wtemplate-debugging  -Wtraditional  -Wtrigraphs
  123. -Wuninitialized  -Wunused  -Wwrite-strings
  124. @end smallexample
  125.  
  126. @item Debugging Options
  127. @xref{Debugging Options,,Options for Debugging Your Program or GCC}.
  128. @smallexample
  129. -a  -d@var{letters}  -fpretend-float 
  130. -g  -g@var{level} -ggdb  -gdwarf -gdwarf+
  131. -gstabs  -gstabs+  -gcoff -gxcoff  -gxcoff+
  132. -p  -pg  -save-temps  -print-libgcc-file-name
  133. @end smallexample
  134.  
  135. @item Optimization Options
  136. @xref{Optimize Options,,Options that Control Optimization}.
  137. @smallexample
  138. -fcaller-saves  -fcse-follow-jumps  -fcse-skip-blocks
  139. -fdelayed-branch   -fexpensive-optimizations  
  140. -ffast-math  -ffloat-store  -fforce-addr  -fforce-mem
  141. -finline-functions  -fkeep-inline-functions  
  142. -fno-default-inline  -fno-defer-pop  -fno-function-cse
  143. -fno-inline  -fno-peephole  -fomit-frame-pointer  
  144. -frerun-cse-after-loop  -fschedule-insns  
  145. -fschedule-insns2  -fstrength-reduce  -fthread-jumps 
  146. -funroll-all-loops  -funroll-loops
  147. -O  -O2
  148. @end smallexample
  149.  
  150. @item Preprocessor Options
  151. @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
  152. @smallexample
  153. -A@var{assertion}  -C  -dD  -dM  -dN
  154. -D@var{macro}@r{[}=@var{defn}@r{]}  -E  -H
  155. -idirafter @var{dir}
  156. -include @var{file}  -imacros @var{file}
  157. -iprefix @var{file}  -iwithprefix @var{dir}
  158. -M  -MD  -MM  -MMD  -nostdinc  -P  -trigraphs  -U@var{macro}
  159. @end smallexample
  160.  
  161. @item Assembler Option
  162. @xref{Assembler Options,,Passing Options to the Assembler}.
  163. @smallexample
  164. -Wa,@var{option}
  165. @end smallexample
  166.  
  167. @item Linker Options
  168. @xref{Link Options,,Options for Linking}.
  169. @smallexample
  170. @var{object-file-name}
  171. -l@var{library}  -nostartfiles  -nostdlib  
  172. -static  -shared  -symbolic  
  173. -Wl,@var{option}  -Xlinker @var{option}
  174. -u @var{symbol}
  175. @end smallexample
  176.  
  177. @item Directory Options
  178. @xref{Directory Options,,Options for Directory Search}.
  179. @smallexample
  180. -B@var{prefix}  -I@var{dir}  -I-  -L@var{dir}
  181. @end smallexample
  182.  
  183. @item Target Options
  184. @c I wrote this xref this way to avoid overfull hbox. -- rms
  185. @xref{Target Options}.
  186. @smallexample
  187. -b @var{machine}  -V @var{version}
  188. @end smallexample
  189.  
  190. @item Machine Dependent Options
  191. @xref{Submodel Options,,Hardware Models and Configurations}.
  192. @smallexample
  193. @emph{M680x0 Options}
  194. -m68000  -m68020  -m68020-40  -m68030  -m68040  -m68881  
  195. -mbitfield  -mc68000  -mc68020  -mfpa  -mnobitfield  
  196. -mrtd  -mshort  -msoft-float 
  197.  
  198. @emph{VAX Options}
  199. -mg  -mgnu  -munix
  200.  
  201. @emph{SPARC Options}
  202. -mepilogue  -mfpu  -mhard-float
  203. -mno-fpu  -mno-epilogue  -msoft-float
  204. -msparclite  -mv8
  205.  
  206. @emph{Convex Options}
  207. -mc1  -mc2  -mc32  -mc34  -mc38
  208. -margcount  -mnoargcount
  209. -mlong32  -mlong64
  210. -mbolatile-cache  -mvolatile-nocache
  211.  
  212. @emph{AMD29K Options} 
  213. -m29000  -m29050  -mbw  -mdw  -mkernel-registers
  214. -mlarge  -mnbw  -mnodw  -msmall  -mstack-check
  215. -muser-registers
  216.  
  217. @emph{M88K Options}
  218. -m88000  -m88100  -m88110  -mbig-pic  
  219. -mcheck-zero-division  -mhandle-large-shift 
  220. -midentify-revision  -mno-check-zero-division 
  221. -mno-ocs-debug-info  -mno-ocs-frame-position 
  222. -mno-optimize-arg-area  -mno-serialize-volatile
  223. -mno-underscores  -mocs-debug-info
  224. -mocs-frame-position  -moptimize-arg-area
  225. -mserialize-volatile  -mshort-data-@var{num}  -msvr3 
  226. -msvr4  -mtrap-large-shift  -muse-div-instruction 
  227. -mversion-03.00  -mwarn-passed-structs
  228.  
  229. @emph{RS/6000 Options}
  230. -mfp-in-toc  -mno-fop-in-toc
  231.  
  232. @emph{RT Options}
  233. -mcall-lib-mul  -mfp-arg-in-fpregs  -mfp-arg-in-gregs
  234. -mfull-fp-blocks  -mhc-struct-return  -min-line-mul
  235. -mminimum-fp-blocks  -mnohc-struct-return
  236.  
  237. @emph{MIPS Options}
  238. -mcpu=@var{cpu  type}  -mips2  -mips3  -mint64
  239. -mlong64  -mlonglong128  -mmips-as  -mgas  -mrnames
  240. -mno-rnames  -mgpopt  -mno-gpopt  -mstats  -mno-stats
  241. -mmemcpy  -mno-memcpy  -mno-mips-tfile  -mmips-tfile
  242. -msoft-float  -mhard-float  -mabicalls  -mno-abicalls
  243. -mhalf-pic  -mno-half-pic -mlong-calls -mno-long-calls
  244. -G  @var{num}  -nocpp
  245.  
  246. @emph{i386 Options}
  247. -m486  -mno-486  -msoft-float  -msvr3-shlib  -mieee-fp
  248. -mno-fp-ret-in-387
  249.  
  250. @emph{HPPA Options}
  251. -mpa-risc-1-0
  252. -mpa-risc-1-1
  253. -mkernel
  254. -mshared-libs
  255. -mno-shared-libs
  256. -mlong-calls
  257. -mdisable-fpregs
  258. -mdisable-indexing
  259. -mtrailing-colon
  260.  
  261. @emph{Intel 960 Options}
  262. -m@var{cpu type}
  263. -mnumerics  -msoft-float
  264. -mcode-align  -mno-code-align
  265. -mleaf-procedures  -mno-leaf-procedures
  266. -mtail-call  -mno-tail-call
  267. -mcomplex-addr  -mno-complex-addr
  268. -mclean-linkage  -mno-clean-linkage
  269. -mic-compat  -mic2.0-compat  -mic3.0-compat
  270. -masm-compat  -mintel-asm
  271. -mstrict-align  -mno-strict-align
  272. -mold-align  -mno-old-align
  273.  
  274. @emph{DEC Alpha Options}
  275. -mfp-regs  -mno-fp-regs  -mno-soft-float
  276. -msoft-float
  277.  
  278. @emph{System V Options}
  279. -G  -Qy  -Qn  -YP,@var{paths}  -Ym,@var{dir}
  280. @end smallexample
  281.  
  282. @item Code Generation Options
  283. @xref{Code Gen Options,,Options for Code Generation Conventions}.
  284. @smallexample
  285. -fcall-saved-@var{reg}  -fcall-used-@var{reg} 
  286. -ffixed-@var{reg}  -finhibit-size-directive 
  287. -fno-common  -fno-ident
  288. -fno-gnu-linker  -fpcc-struct-return  -fpic  -fPIC 
  289. -freg-struct-return  -fshared-data  -fshort-enums
  290. -fshort-double  -fvolatile  -fvolatile-global
  291. -fverbose-asm
  292. @end smallexample
  293. @end table
  294.  
  295. @menu
  296. * Overall Options::     Controlling the kind of output:
  297.                         an executable, object files, assembler files,
  298.                         or preprocessed source.
  299. * C Dialect Options::   Controlling the variant of C language compiled.
  300. * C++ Dialect Options:: Variations on C++.
  301. * Warning Options::     How picky should the compiler be?
  302. * Debugging Options::   Symbol tables, measurements, and debugging dumps.
  303. * Optimize Options::    How much optimization?
  304. * Preprocessor Options:: Controlling header files and macro definitions.
  305.                          Also, getting dependency information for Make.
  306. * Assembler Options::   Passing options to the assembler.
  307. * Link Options::        Specifying libraries and so on.
  308. * Directory Options::   Where to find header files and libraries.
  309.                         Where to find the compiler executable files.
  310. * Target Options::      Running a cross-compiler, or an old version of GNU CC.
  311. @end menu
  312.  
  313. @node Overall Options
  314. @section Options Controlling the Kind of Output
  315.  
  316. Compilation can involve up to four stages: preprocessing, compilation
  317. proper, assembly and linking, always in that order.  The first three
  318. stages apply to an individual source file, and end by producing an
  319. object file; linking combines all the object files (those newly
  320. compiled, and those specified as input) into an executable file.
  321.  
  322. @cindex file name suffix
  323. For any given input file, the file name suffix determines what kind of
  324. compilation is done:
  325.  
  326. @table @code
  327. @item @var{file}.c
  328. C source code which must be preprocessed.
  329.  
  330. @item @var{file}.i
  331. C source code which should not be preprocessed.
  332.  
  333. @item @var{file}.ii
  334. C++ source code which should not be preprocessed.
  335.  
  336. @item @var{file}.m
  337. Objective-C source code.  Note that you must link with the library
  338. @file{libobjc.a} to make an Objective-C program work.
  339.  
  340. @item @var{file}.h
  341. C header file (not to be compiled or linked).
  342.  
  343. @item @var{file}.cc
  344. @itemx @var{file}.cxx
  345. @itemx @var{file}.C
  346. C++ source code which must be preprocessed.
  347.  
  348. @item @var{file}.s 
  349. Assembler code.
  350.  
  351. @item @var{file}.S
  352. Assembler code which must be preprocessed.
  353.  
  354. @item @var{other}
  355. An object file to be fed straight into linking.
  356. Any file name with no recognized suffix is treated this way.
  357. @end table
  358.  
  359. You can specify the input language explicitly with the @samp{-x} option:
  360.  
  361. @table @code
  362. @item -x @var{language}
  363. Specify explicitly the @var{language} for the following input files
  364. (rather than letting the compiler choose a default based on the file
  365. name suffix).  This option applies to all following input files until
  366. the next @samp{-x} option.  Possible values for @var{language} are:
  367. @example
  368. c  objective-c  c++
  369. c-header  cpp-output  c++-cpp-output
  370. assembler  assembler-with-cpp
  371. @end example
  372.  
  373. @item -x none
  374. Turn off any specification of a language, so that subsequent files are
  375. handled according to their file name suffixes (as they are if @samp{-x}
  376. has not been used at all).
  377. @end table
  378.  
  379. If you only want some of the stages of compilation, you can use
  380. @samp{-x} (or filename suffixes) to tell @code{gcc} where to start, and
  381. one of the options @samp{-c}, @samp{-S}, or @samp{-E} to say where
  382. @code{gcc} is to stop.  Note that some combinations (for example,
  383. @samp{-x cpp-output -E} instruct @code{gcc} to do nothing at all.
  384.  
  385. @table @code
  386. @item -c
  387. Compile or assemble the source files, but do not link.  The linking
  388. stage simply is not done.  The ultimate output is in the form of an
  389. object file for each source file.
  390.  
  391. By default, the object file name for a source file is made by replacing
  392. the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
  393.  
  394. Unrecognized input files, not requiring compilation or assembly, are
  395. ignored.
  396.  
  397. @item -S
  398. Stop after the stage of compilation proper; do not assemble.  The output
  399. is in the form of an assembler code file for each non-assembler input
  400. file specified.
  401.  
  402. By default, the assembler file name for a source file is made by
  403. replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
  404.  
  405. Input files that don't require compilation are ignored.
  406.  
  407. @item -E
  408. Stop after the preprocessing stage; do not run the compiler proper.  The
  409. output is in the form of preprocessed source code, which is sent to the
  410. standard output.
  411.  
  412. Input files which don't require preprocessing are ignored.
  413.  
  414. @cindex output file option
  415. @item -o @var{file}
  416. Place output in file @var{file}.  This applies regardless to whatever
  417. sort of output is being produced, whether it be an executable file,
  418. an object file, an assembler file or preprocessed C code.
  419.  
  420. Since only one output file can be specified, it does not make sense to
  421. use @samp{-o} when compiling more than one input file, unless you are
  422. producing an executable file as output.
  423.  
  424. If @samp{-o} is not specified, the default is to put an executable file
  425. in @file{a.out}, the object file for @file{@var{source}.@var{suffix}} in
  426. @file{@var{source}.o}, its assembler file in @file{@var{source}.s}, and
  427. all preprocessed C source on standard output.@refill
  428.  
  429. @item -v
  430. Print (on standard error output) the commands executed to run the stages
  431. of compilation.  Also print the version number of the compiler driver
  432. program and of the preprocessor and the compiler proper.
  433.  
  434. @item -pipe
  435. Use pipes rather than temporary files for communication between the
  436. various stages of compilation.  This fails to work on some systems where
  437. the assembler is unable to read from a pipe; but the GNU assembler has
  438. no trouble.
  439. @end table
  440.  
  441. @node Invoking G++
  442. @section Compiling C++ Programs
  443.  
  444. @cindex suffixes for C++ source
  445. @cindex C++ source file suffixes
  446. C++ source files conventionally use one of the suffixes @samp{.C},
  447. @samp{.cc}, or @samp{.cxx}; preprocessed C++ files use the suffix
  448. @samp{.ii}.  GNU CC recognizes files with these names and compiles
  449. them as C++ programs even if you call the compiler the same way as for
  450. compiling C programs (usually with the name @code{gcc}).
  451.  
  452. @findex g++
  453. @findex c++
  454. However, C++ programs often require class libraries as well as a
  455. compiler that understands the C++ language---and under some
  456. circumstances, you might want to compile programs from standard input,
  457. or otherwise without a suffix that flags them as C++ programs.
  458. @code{g++} is a shell script that calls GNU CC with the default language
  459. set to C++, and automatically specifies linking against the GNU class
  460. library libg++.
  461. @cindex @code{g++ 1.@var{xx}}
  462. @cindex @code{g++}, separate compiler
  463. @cindex @code{g++} older version
  464. @footnote{Prior to release 2 of the compiler,
  465. there was a separate @code{g++} compiler.  That version was based on GNU
  466. CC, but not integrated with it.  Versions of @code{g++} with a
  467. @samp{1.@var{xx}} version number---for example, @code{g++} version 1.37
  468. or 1.42---are much less reliable than the versions integrated with GCC
  469. 2.  Moreover, combining G++ @samp{1.@var{xx}} with a version 2 GCC will
  470. simply not work.} On many systems, the script @code{g++} is also
  471. installed with the name @code{c++}.
  472.  
  473. @cindex invoking @code{g++}
  474. When you compile C++ programs, you may specify many of the same
  475. command-line options that you use for compiling programs in any
  476. language; or command-line options meaningful for C and related
  477. languages; or options that are meaningful only for C++ programs.
  478. @xref{C Dialect Options,,Options Controlling C Dialect}, for
  479. explanations of options for languages related to C.
  480. @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
  481. explanations of options that are meaningful only for C++ programs.
  482.  
  483. @node C Dialect Options
  484. @section Options Controlling C Dialect
  485. @cindex dialect options
  486. @cindex language dialect options
  487. @cindex options, dialect
  488.  
  489. The following options control the dialect of C (or languages derived
  490. from C, such as C++ and Objective C) that the compiler accepts:
  491.  
  492. @table @code
  493. @cindex ANSI support
  494. @item -ansi
  495. Support all ANSI standard C programs.
  496.  
  497. This turns off certain features of GNU C that are incompatible with ANSI
  498. C, such as the @code{asm}, @code{inline} and @code{typeof} keywords, and
  499. predefined macros such as @code{unix} and @code{vax} that identify the
  500. type of system you are using.  It also enables the undesirable and
  501. rarely used ANSI trigraph feature, and disallows @samp{$} as part of
  502. identifiers.
  503.  
  504. The alternate keywords @code{__asm__}, @code{__extension__},
  505. @code{__inline__} and @code{__typeof__} continue to work despite
  506. @samp{-ansi}.  You would not want to use them in an ANSI C program, of
  507. course, but it useful to put them in header files that might be included
  508. in compilations done with @samp{-ansi}.  Alternate predefined macros
  509. such as @code{__unix__} and @code{__vax__} are also available, with or
  510. without @samp{-ansi}.
  511.  
  512. The @samp{-ansi} option does not cause non-ANSI programs to be
  513. rejected gratuitously.  For that, @samp{-pedantic} is required in
  514. addition to @samp{-ansi}.  @xref{Warning Options}.
  515.  
  516. The macro @code{__STRICT_ANSI__} is predefined when the @samp{-ansi}
  517. option is used.  Some header files may notice this macro and refrain
  518. from declaring certain functions or defining certain macros that the
  519. ANSI standard doesn't call for; this is to avoid interfering with any
  520. programs that might use these names for other things.
  521.  
  522. The functions @code{alloca}, @code{abort}, @code{exit}, and
  523. @code{_exit} are not builtin functions when @samp{-ansi} is used.
  524.  
  525. @item -fno-asm
  526. Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
  527. keyword.  These words may then be used as identifiers.  You can use the
  528. keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
  529. instead.  @samp{-ansi} implies @samp{-fno-asm}.
  530.  
  531. @item -fno-builtin
  532. Don't recognize built-in functions that do not begin with two leading
  533. underscores.  Currently, the functions affected include @code{abort},
  534. @code{abs}, @code{alloca}, @code{cos}, @code{exit}, @code{fabs},
  535. @code{ffs}, @code{labs}, @code{memcmp}, @code{memcpy}, @code{sin},
  536. @code{sqrt}, @code{strcmp}, @code{strcpy}, and @code{strlen}.
  537.  
  538. The @samp{-ansi} option prevents @code{alloca} and @code{ffs} from being
  539. builtin functions, since these functions do not have an ANSI standard
  540. meaning.
  541.  
  542. @item -trigraphs
  543. Support ANSI C trigraphs.  You don't want to know about this
  544. brain-damage.  The @samp{-ansi} option implies @samp{-trigraphs}.
  545.  
  546. @cindex traditional C language
  547. @cindex C language, traditional
  548. @item -traditional
  549. Attempt to support some aspects of traditional C compilers.
  550. Specifically:
  551.  
  552. @itemize @bullet
  553. @item
  554. All @code{extern} declarations take effect globally even if they
  555. are written inside of a function definition.  This includes implicit
  556. declarations of functions.
  557.  
  558. @item
  559. The keywords @code{typeof}, @code{inline}, @code{signed}, @code{const}
  560. and @code{volatile} are not recognized.  (You can still use the
  561. alternative keywords such as @code{__typeof__}, @code{__inline__}, and
  562. so on.)
  563.  
  564. @item
  565. Comparisons between pointers and integers are always allowed.
  566.  
  567. @item
  568. Integer types @code{unsigned short} and @code{unsigned char} promote
  569. to @code{unsigned int}.
  570.  
  571. @item
  572. Out-of-range floating point literals are not an error.
  573.  
  574. @item
  575. Certain constructs which ANSI regards as a single invalid preprocessing
  576. number, such as @samp{0xe-0xd}, are treated as expressions instead.
  577.  
  578. @item
  579. String ``constants'' are not necessarily constant; they are stored in
  580. writable space, and identical looking constants are allocated
  581. separately.  (This is the same as the effect of
  582. @samp{-fwritable-strings}.)
  583.  
  584. @cindex @code{longjmp} and automatic variables
  585. @item
  586. All automatic variables not declared @code{register} are preserved by
  587. @code{longjmp}.  Ordinarily, GNU C follows ANSI C: automatic variables
  588. not declared @code{volatile} may be clobbered.
  589.  
  590. @item
  591. In the preprocessor, comments convert to nothing at all, rather than
  592. to a space.  This allows traditional token concatenation.
  593.  
  594. @item
  595. In the preprocessor, macro arguments are recognized within string
  596. constants in a macro definition (and their values are stringified,
  597. though without additional quote marks, when they appear in such a
  598. context).  The preprocessor always considers a string constant to end
  599. at a newline.
  600.  
  601. @item
  602. @cindex detecting @w{@samp{-traditional}}
  603. The predefined macro @code{__STDC__} is not defined when you use
  604. @samp{-traditional}, but @code{__GNUC__} is (since the GNU extensions
  605. which @code{__GNUC__} indicates are not affected by
  606. @samp{-traditional}).  If you need to write header files that work
  607. differently depending on whether @samp{-traditional} is in use, by
  608. testing both of these predefined macros you can distinguish four
  609. situations: GNU C, traditional GNU C, other ANSI C compilers, and other
  610. old C compilers.  @xref{Standard Predefined,,Standard Predefined
  611. Macros,cpp.info,The C Preprocessor}, for more discussion of these and other
  612. predefined macros.
  613.  
  614. @item
  615. @cindex string constants vs newline
  616. @cindex newline vs string constants
  617. The preprocessor considers a string constant to end at a newline (unless
  618. the newline is escaped with @samp{\}).  (Without @w{@samp{-traditional}},
  619. string constants can contain the newline character as typed.)
  620.  
  621. @item
  622. @kindex \x
  623. @kindex \a
  624. @cindex escape sequences, traditional
  625. The character escape sequences @samp{\x} and @samp{\a} evaluate as the
  626. literal characters @samp{x} and @samp{a} respectively.  Without
  627. @w{@samp{-traditional}}, @samp{\x} is a prefix for the hexadecimal
  628. representation of a character, and @samp{\a} produces a bell.
  629.  
  630. @item
  631. In C++ programs, assignment to @code{this} is permitted with
  632. @samp{-traditional}.  This is the same as the effect of
  633. @samp{-fthis-is-variable}.
  634. @end itemize
  635.  
  636. You may wish to use @samp{-fno-builtin} as well as @samp{-traditional}
  637. if your program uses names that are normally GNU C builtin functions for
  638. other purposes of its own.
  639.  
  640. @item -traditional-cpp
  641. Attempt to support some aspects of traditional C preprocessors.
  642. This includes the last three items in the table immediately above,
  643. but none of the other effects of @samp{-traditional}.
  644.  
  645. @item -fcond-mismatch
  646. Allow conditional expressions with mismatched types in the second and
  647. third arguments.  The value of such an expression is void.
  648.  
  649. @item -funsigned-char
  650. Let the type @code{char} be unsigned, like @code{unsigned char}.
  651.  
  652. Each kind of machine has a default for what @code{char} should
  653. be.  It is either like @code{unsigned char} by default or like
  654. @code{signed char} by default.
  655.  
  656. Ideally, a portable program should always use @code{signed char} or
  657. @code{unsigned char} when it depends on the signedness of an object.
  658. But many programs have been written to use plain @code{char} and
  659. expect it to be signed, or expect it to be unsigned, depending on the
  660. machines they were written for.  This option, and its inverse, let you
  661. make such a program work with the opposite default.
  662.  
  663. The type @code{char} is always a distinct type from each of
  664. @code{signed char} or @code{unsigned char}, even though its behavior
  665. is always just like one of those two.
  666.  
  667. @item -fsigned-char
  668. Let the type @code{char} be signed, like @code{signed char}.
  669.  
  670. Note that this is equivalent to @samp{-fno-unsigned-char}, which is
  671. the negative form of @samp{-funsigned-char}.  Likewise, the option
  672. @samp{-fno-signed-char} is equivalent to @samp{-funsigned-char}.
  673.  
  674. @item -fsigned-bitfields
  675. @itemx -funsigned-bitfields
  676. @itemx -fno-signed-bitfields
  677. @itemx -fno-unsigned-bitfields
  678. These options control whether a bitfield is signed or unsigned, when the
  679. declaration does not use either @code{signed} or @code{unsigned}.  By
  680. default, such a bitfield is signed, because this is consistent: the
  681. basic integer types such as @code{int} are signed types.
  682.  
  683. However, when @samp{-traditional} is used, bitfields are all unsigned
  684. no matter what.
  685.  
  686. @item -fwritable-strings
  687. Store string constants in the writable data segment and don't uniquize
  688. them.  This is for compatibility with old programs which assume they can
  689. write into string constants.  The option @samp{-traditional} also has
  690. this effect.
  691.  
  692. Writing into string constants is a very bad idea; ``constants'' should
  693. be constant.
  694. @end table
  695.  
  696. @node C++ Dialect Options
  697. @section Options Controlling C++ Dialect
  698.  
  699. @cindex compiler options, C++
  700. @cindex C++ options, command line
  701. @cindex options, C++
  702. This section describes the command-line options that are only meaningful
  703. for C++ programs; but you can also use most of the GNU compiler options
  704. regardless of what language your program is in.  For example, you
  705. might compile a file @code{firstClass.C} like this:
  706.  
  707. @example
  708. g++ -g -felide-constructors -O -c firstClass.C
  709. @end example
  710.  
  711. @noindent
  712. In this example, only @samp{-felide-constructors} is an option meant
  713. only for C++ programs; you can use the other options with any
  714. language supported by GNU CC.
  715.  
  716. Here is a list of options that are @emph{only} for compiling C++ programs:
  717.  
  718. @table @code
  719. @item -fall-virtual
  720. Treat all possible member functions as virtual, implicitly.
  721. All member functions (except for constructor functions and @code{new} or
  722. @code{delete} member operators) are treated as virtual functions of the
  723. class where they appear.
  724.  
  725. This does not mean that all calls to these member functions will be made
  726. through the internal table of virtual functions.  Under some
  727. circumstances, the compiler can determine that a call to a given virtual
  728. function can be made directly; in these cases the calls are direct in
  729. any case.
  730.  
  731. @item -fdollars-in-identifiers
  732. Accept @samp{$} in identifiers.  You can also explicitly prohibit use of
  733. @samp{$} with @samp{-fno-dollars-in-identifiers}.  (GNU C++ allows
  734. @samp{$} by default on some target systems but not others.)  Traditional
  735. C allowed the character @samp{$} to form part of identifiers.  However,
  736. ANSI C and C++ forbid @samp{$} in identifiers.
  737.  
  738. @item -felide-constructors
  739. Elide constructors when this seems plausible.  With this option, GNU C++
  740. initializes @code{y} directly from the call to @code{foo} without going
  741. through a temporary in the following code:
  742.  
  743. @smallexample
  744. A foo ();
  745. A y = foo ();
  746. @end smallexample
  747.  
  748. Without this option, GNU C++ (1) initializes @code{y} by calling the
  749. appropriate constructor for type @code{A}; (2) assigns the result of
  750. @code{foo} to a temporary; and, finally, (3) replaces the initial value of
  751. @code{y} with the temporary.
  752.  
  753. The default behavior (@samp{-fno-elide-constructors}) is specified by
  754. the draft ANSI C++ standard.  If your program's constructors have side
  755. effects, @samp{-felide-constructors} can change your program's behavior,
  756. since some constructor calls may be omitted.
  757.  
  758. @item -fenum-int-equiv
  759. Permit implicit conversion of @code{int} to enumeration types.  Normally
  760. GNU C++ allows conversion of @code{enum} to @code{int}, but not the
  761. other way around.
  762.  
  763. @item -fmemoize-lookups
  764. @itemx -fsave-memoized
  765. Use heuristics to compile faster.  These heuristics are not enabled by
  766. default, since they are only effective for certain input files.  Other
  767. input files compile more slowly.
  768.  
  769. The first time the compiler must build a call to a member function (or
  770. reference to a data member), it must (1) determine whether the class
  771. implements member functions of that name; (2) resolve which member
  772. function to call (which involves figuring out what sorts of type
  773. conversions need to be made); and (3) check the visibility of the member
  774. function to the caller.  All of this adds up to slower compilation.
  775. Normally, the second time a call is made to that member function (or
  776. reference to that data member), it must go through the same lengthy
  777. process again.  This means that code like this:
  778.  
  779. @smallexample
  780. cout << "This " << p << " has " << n << " legs.\n";
  781. @end smallexample
  782.  
  783. @noindent
  784. makes six passes through all three steps.  By using a software cache, a
  785. ``hit'' significantly reduces this cost.  Unfortunately, using the cache
  786. introduces another layer of mechanisms which must be implemented, and so
  787. incurs its own overhead.  @samp{-fmemoize-lookups} enables the software
  788. cache.
  789.  
  790. Because access privileges (visibility) to members and member functions
  791. may differ from one function context to the next, G++ may need to flush
  792. the cache.  With the @samp{-fmemoize-lookups} flag, the cache is flushed
  793. after every function that is compiled.  The @samp{-fsave-memoized} flag
  794. enables the same software cache, but when the compiler determines that
  795. the context of the last function compiled would yield the same access
  796. privileges of the next function to compile, it preserves the cache.
  797. This is most helpful when defining many member functions for the same
  798. class: with the exception of member functions which are friends of other
  799. classes, each member function has exactly the same access privileges as
  800. every other, and the cache need not be flushed.
  801.  
  802. @item -fno-strict-prototype
  803. Treat a function declaration with no arguments, such as @w{@samp{int foo
  804. ();}}, as C would treat it---as saying nothing about the number of
  805. arguments or their types.  Normally, such a declaration in C++ means
  806. that the function @code{foo} takes no arguments.
  807.  
  808. @item -fnonnull-objects
  809. Assume that objects reached through references are not null.
  810.  
  811. Normally, GNU C++ makes conservative assumptions about objects reached
  812. through references.  For example, the compiler must check that @code{a}
  813. is not null in code like the following:
  814.  
  815. @example
  816. obj &a = g ();
  817. a.f (2);
  818. @end example
  819.  
  820. Checking that references of this sort have non-null values requires
  821. extra code, however, and it is unnecessary for many programs.  You can
  822. use @w{@samp{-fnonnull-objects}} to omit the checks for null, if your
  823. program doesn't require checking.
  824.  
  825. @item -fthis-is-variable
  826. Permit assignment to @code{this}.  The incorporation of
  827. user-defined free store management into C++ has made assignment to
  828. @samp{this} an anachronism.  Therefore, by default it is invalid to
  829. assign to @code{this} within a class member function; that is, GNU C++
  830. treats the type of @samp{this} in a member function of class @code{X}
  831. to be @samp{X *const}.  However, for backwards compatibility, you can
  832. make it valid with @samp{-fthis-is-variable}.
  833.  
  834. @item -nostdinc++
  835. Do not search for header files in the standard directories specific to
  836. C++, but do still search the other standard directories.  (This option
  837. is used when building libg++.)
  838.  
  839. @item -traditional
  840. For C++ programs (in addition to the effects that apply to both C and
  841. C++), this has the same effect as @samp{-fthis-is-variable}.
  842. @xref{C Dialect Options,, Options Controlling C Dialect}.
  843. @end table
  844.  
  845. In addition, these optimization, warning, and code generation options
  846. have meanings only for C++ programs:
  847.  
  848. @table @code
  849. @item -fno-default-inline
  850. Do not assume @samp{inline} for functions defined inside a class scope.
  851. @xref{Optimize Options,,Options That Control Optimization}.
  852.  
  853. @item -Wenum-clash
  854. @itemx -Woverloaded-virtual
  855. @itemx -Wtemplate-debugging
  856. Warnings that apply only to C++ programs.  @xref{Warning
  857. Options,,Options to Request or Suppress Warnings}.
  858.  
  859. @item +e@var{n}
  860. Control how virtual function definitions are used, in a fashion
  861. compatible with @code{cfront} 1.x.  @xref{Code Gen Options,,Options for
  862. Code Generation Conventions}.
  863. @end table
  864.  
  865. @node Warning Options
  866. @section Options to Request or Suppress Warnings
  867. @cindex options to control warnings
  868. @cindex warning messages
  869. @cindex messages, warning
  870. @cindex suppressing warnings
  871.  
  872. Warnings are diagnostic messages that report constructions which
  873. are not inherently erroneous but which are risky or suggest there
  874. may have been an error.
  875.  
  876. You can request many specific warnings with options beginning @samp{-W},
  877. for example @samp{-Wimplicit} to request warnings on implicit
  878. declarations.  Each of these specific warning options also has a
  879. negative form beginning @samp{-Wno-} to turn off warnings;
  880. for example, @samp{-Wno-implicit}.  This manual lists only one of the
  881. two forms, whichever is not the default.
  882.  
  883. These options control the amount and kinds of warnings produced by GNU
  884. CC:
  885.  
  886. @table @code
  887. @cindex syntax checking
  888. @item -fsyntax-only
  889. Check the code for syntax errors, but don't do anything beyond that.
  890.  
  891. @item -w
  892. Inhibit all warning messages.
  893.  
  894. @item -Wno-import
  895. Inhibit warning messages about the use of @samp{#import}.
  896.  
  897. @item -pedantic
  898. Issue all the warnings demanded by strict ANSI standard C; reject
  899. all programs that use forbidden extensions.  
  900.  
  901. Valid ANSI standard C programs should compile properly with or without
  902. this option (though a rare few will require @samp{-ansi}).  However,
  903. without this option, certain GNU extensions and traditional C features
  904. are supported as well.  With this option, they are rejected.
  905.  
  906. @samp{-pedantic} does not cause warning messages for use of the
  907. alternate keywords whose names begin and end with @samp{__}.  Pedantic
  908. warnings are also disabled in the expression that follows
  909. @code{__extension__}.  However, only system header files should use
  910. these escape routes; application programs should avoid them.
  911. @xref{Alternate Keywords}.
  912.  
  913. This option is not intended to be @i{useful}; it exists only to satisfy
  914. pedants who would otherwise claim that GNU CC fails to support the ANSI
  915. standard.
  916.  
  917. Some users try to use @samp{-pedantic} to check programs for strict ANSI
  918. C conformance.  They soon find that it does not do quite what they want:
  919. it finds some non-ANSI practices, but not all---only those for which
  920. ANSI C @emph{requires} a diagnostic.
  921.  
  922. A feature to report any failure to conform to ANSI C might be useful in
  923. some instances, but would require considerable additional work and would
  924. be quite different from @samp{-pedantic}.  We recommend, rather, that
  925. users take advantage of the extensions of GNU C and disregard the
  926. limitations of other compilers.  Aside from certain supercomputers and
  927. obsolete small machines, there is less and less reason ever to use any
  928. other C compiler other than for bootstrapping GNU CC.
  929.  
  930. @item -pedantic-errors
  931. Like @samp{-pedantic}, except that errors are produced rather than
  932. warnings.
  933.  
  934. @item -W
  935. Print extra warning messages for these events:
  936.  
  937. @itemize @bullet
  938. @cindex @code{longjmp} warnings
  939. @item
  940. A nonvolatile automatic variable might be changed by a call to
  941. @code{longjmp}.  These warnings as well are possible only in
  942. optimizing compilation.
  943.  
  944. The compiler sees only the calls to @code{setjmp}.  It cannot know
  945. where @code{longjmp} will be called; in fact, a signal handler could
  946. call it at any point in the code.  As a result, you may get a warning
  947. even when there is in fact no problem because @code{longjmp} cannot
  948. in fact be called at the place which would cause a problem.
  949.  
  950. @item
  951. A function can return either with or without a value.  (Falling
  952. off the end of the function body is considered returning without
  953. a value.)  For example, this function would evoke such a
  954. warning:
  955.  
  956. @smallexample
  957. @group
  958. foo (a)
  959. @{
  960.   if (a > 0)
  961.     return a;
  962. @}
  963. @end group
  964. @end smallexample
  965.  
  966. @item
  967. An expression-statement contains no side effects.
  968.  
  969. @item
  970. An unsigned value is compared against zero with @samp{>} or @samp{<=}.
  971.  
  972. @item
  973. A comparison like @samp{x<=y<=z} appears; this is equivalent to
  974. @samp{(x<=y ? 1 : 0) <= z}, which is a different interpretation from
  975. that of ordinary mathematical notation.
  976.  
  977. @item
  978. Storage-class specifiers like @code{static} are not the first things in
  979. a declaration.  According to the C Standard, this usage is obsolescent.
  980.  
  981. @item
  982. An aggregate has a partly bracketed initializer.
  983. For example, the following code would evoke such a warning,
  984. because braces are missing around the initializer for @code{x.h}:
  985.  
  986. @smallexample
  987. struct s @{ int f, g; @};
  988. struct t @{ struct s h; int i; @};
  989. struct t x = @{ 1, 2, 3 @};
  990. @end smallexample
  991. @end itemize
  992.  
  993. @item -Wimplicit
  994. Warn whenever a function or parameter is implicitly declared.
  995.  
  996. @item -Wreturn-type
  997. Warn whenever a function is defined with a return-type that defaults
  998. to @code{int}.  Also warn about any @code{return} statement with no
  999. return-value in a function whose return-type is not @code{void}.
  1000.  
  1001. @item -Wunused
  1002. Warn whenever a local variable is unused aside from its declaration,
  1003. whenever a function is declared static but never defined, and whenever
  1004. a statement computes a result that is explicitly not used.
  1005.  
  1006. If you want to prevent a warning for a particular variable, you can use
  1007. this macro:
  1008.  
  1009. @smallexample
  1010. #define USE(var) \
  1011.   static void * use_##var = (&use_##var, (void *) &var)
  1012.  
  1013. USE (string);
  1014. @end smallexample
  1015.  
  1016. @item -Wswitch
  1017. Warn whenever a @code{switch} statement has an index of enumeral type
  1018. and lacks a @code{case} for one or more of the named codes of that
  1019. enumeration.  (The presence of a @code{default} label prevents this
  1020. warning.)  @code{case} labels outside the enumeration range also
  1021. provoke warnings when this option is used.
  1022.  
  1023. @item -Wcomment
  1024. Warn whenever a comment-start sequence @samp{/*} appears in a comment.
  1025.  
  1026. @item -Wtrigraphs
  1027. Warn if any trigraphs are encountered (assuming they are enabled).
  1028.  
  1029. @item -Wformat
  1030. Check calls to @code{printf} and @code{scanf}, etc., to make sure that
  1031. the arguments supplied have types appropriate to the format string
  1032. specified.
  1033.  
  1034. @item -Wchar-subscripts
  1035. Warn if an array subscript has type @code{char}.  This is a common cause
  1036. of error, as programmers often forget that this type is signed on some
  1037. machines.
  1038.  
  1039. @item -Wuninitialized
  1040. An automatic variable is used without first being initialized.
  1041.  
  1042. These warnings are possible only in optimizing compilation,
  1043. because they require data flow information that is computed only
  1044. when optimizing.  If you don't specify @samp{-O}, you simply won't
  1045. get these warnings.
  1046.  
  1047. These warnings occur only for variables that are candidates for
  1048. register allocation.  Therefore, they do not occur for a variable that
  1049. is declared @code{volatile}, or whose address is taken, or whose size
  1050. is other than 1, 2, 4 or 8 bytes.  Also, they do not occur for
  1051. structures, unions or arrays, even when they are in registers.
  1052.  
  1053. Note that there may be no warning about a variable that is used only
  1054. to compute a value that itself is never used, because such
  1055. computations may be deleted by data flow analysis before the warnings
  1056. are printed.
  1057.  
  1058. These warnings are made optional because GNU CC is not smart
  1059. enough to see all the reasons why the code might be correct
  1060. despite appearing to have an error.  Here is one example of how
  1061. this can happen:
  1062.  
  1063. @smallexample
  1064. @{
  1065.   int x;
  1066.   switch (y)
  1067.     @{
  1068.     case 1: x = 1;
  1069.       break;
  1070.     case 2: x = 4;
  1071.       break;
  1072.     case 3: x = 5;
  1073.     @}
  1074.   foo (x);
  1075. @}
  1076. @end smallexample
  1077.  
  1078. @noindent
  1079. If the value of @code{y} is always 1, 2 or 3, then @code{x} is
  1080. always initialized, but GNU CC doesn't know this.  Here is
  1081. another common case:
  1082.  
  1083. @smallexample
  1084. @{
  1085.   int save_y;
  1086.   if (change_y) save_y = y, y = new_y;
  1087.   @dots{}
  1088.   if (change_y) y = save_y;
  1089. @}
  1090. @end smallexample
  1091.  
  1092. @noindent
  1093. This has no bug because @code{save_y} is used only if it is set.
  1094.  
  1095. Some spurious warnings can be avoided if you declare all the functions
  1096. you use that never return as @code{volatile}.  @xref{Function
  1097. Attributes}.
  1098.  
  1099. @item -Wparentheses
  1100. Warn if parentheses are omitted in certain contexts, such
  1101. as when there is an assignment in a context where a truth value
  1102. is expected, or when operators are nested whose precedence people
  1103. often get confused about.
  1104.  
  1105. @item -Wenum-clash
  1106. @cindex enumeration clash warnings
  1107. @cindex warning for enumeration conversions
  1108. Warn about conversion between different enumeration types.
  1109. (C++ only).
  1110.  
  1111. @item -Wtemplate-debugging
  1112. @cindex template debugging
  1113. When using templates in a C++ program, warn if debugging is not yet
  1114. fully available (C++ only).
  1115.  
  1116. @item -Wall
  1117. All of the above @samp{-W} options combined.  These are all the
  1118. options which pertain to usage that we recommend avoiding and that we
  1119. believe is easy to avoid, even in conjunction with macros.
  1120. @end table
  1121.  
  1122. The remaining @samp{-W@dots{}} options are not implied by @samp{-Wall}
  1123. because they warn about constructions that we consider reasonable to
  1124. use, on occasion, in clean programs.
  1125.  
  1126. @table @code
  1127. @item -Wtraditional
  1128. Warn about certain constructs that behave differently in traditional and
  1129. ANSI C.
  1130.  
  1131. @itemize @bullet
  1132. @item
  1133. Macro arguments occurring within string constants in the macro body.
  1134. These would substitute the argument in traditional C, but are part of
  1135. the constant in ANSI C.
  1136.  
  1137. @item
  1138. A function declared external in one block and then used after the end of
  1139. the block.
  1140.  
  1141. @item
  1142. A @code{switch} statement has an operand of type @code{long}.
  1143. @end itemize
  1144.  
  1145. @item -Wshadow
  1146. Warn whenever a local variable shadows another local variable.
  1147.  
  1148. @item -Wid-clash-@var{len}
  1149. Warn whenever two distinct identifiers match in the first @var{len}
  1150. characters.  This may help you prepare a program that will compile
  1151. with certain obsolete, brain-damaged compilers.
  1152.  
  1153. @item -Wpointer-arith
  1154. Warn about anything that depends on the ``size of'' a function type or
  1155. of @code{void}.  GNU C assigns these types a size of 1, for
  1156. convenience in calculations with @code{void *} pointers and pointers
  1157. to functions.
  1158.  
  1159. @item -Wcast-qual
  1160. Warn whenever a pointer is cast so as to remove a type qualifier from
  1161. the target type.  For example, warn if a @code{const char *} is cast
  1162. to an ordinary @code{char *}.
  1163.  
  1164. @item -Wcast-align
  1165. Warn whenever a pointer is cast such that the required alignment of the
  1166. target is increased.  For example, warn if a @code{char *} is cast to
  1167. an @code{int *} on machines where integers can only be accessed at
  1168. two- or four-byte boundaries.
  1169.  
  1170. @item -Wwrite-strings
  1171. Give string constants the type @code{const char[@var{length}]} so that
  1172. copying the address of one into a non-@code{const} @code{char *}
  1173. pointer will get a warning.  These warnings will help you find at
  1174. compile time code that can try to write into a string constant, but
  1175. only if you have been very careful about using @code{const} in
  1176. declarations and prototypes.  Otherwise, it will just be a nuisance;
  1177. this is why we did not make @samp{-Wall} request these warnings.
  1178.  
  1179. @item -Wconversion
  1180. Warn if a prototype causes a type conversion that is different from what
  1181. would happen to the same argument in the absence of a prototype.  This
  1182. includes conversions of fixed point to floating and vice versa, and
  1183. conversions changing the width or signedness of a fixed point argument
  1184. except when the same as the default promotion.
  1185.  
  1186. Also, warn if a negative integer constant expression is implicitly
  1187. converted to an unsigned type.  For example, warn about the assignment
  1188. @code{x = -1} if @code{x} is unsigned.  But do not warn about explicit
  1189. casts like @code{(unsigned) -1}.
  1190.  
  1191. @item -Waggregate-return
  1192. Warn if any functions that return structures or unions are defined or
  1193. called.  (In languages where you can return an array, this also elicits
  1194. a warning.)
  1195.  
  1196. @item -Wstrict-prototypes
  1197. Warn if a function is declared or defined without specifying the
  1198. argument types.  (An old-style function definition is permitted without
  1199. a warning if preceded by a declaration which specifies the argument
  1200. types.)
  1201.  
  1202. @item -Wmissing-prototypes
  1203. Warn if a global function is defined without a previous prototype
  1204. declaration.  This warning is issued even if the definition itself
  1205. provides a prototype.  The aim is to detect global functions that fail
  1206. to be declared in header files.
  1207.  
  1208. @item -Wredundant-decls
  1209. Warn if anything is declared more than once in the same scope, even in
  1210. cases where multiple declaration is valid and changes nothing.
  1211.  
  1212. @item -Wnested-externs
  1213. Warn if an @code{extern} declaration is encountered within an function.
  1214.  
  1215. @item -Winline
  1216. Warn if a function can not be inlined, and either it was declared as inline,
  1217. or else the @samp{-finline-functions} option was given.
  1218.  
  1219. @item -Woverloaded-virtual
  1220. @cindex overloaded virtual fn, warning
  1221. @cindex warning for overloaded virtual fn
  1222. Warn when a derived class function declaration may be an error in
  1223. defining a virtual function (C++ only).  In a derived class, the
  1224. definitions of virtual functions must match the type signature of a
  1225. virtual function declared in the base class.  With this option, the
  1226. compiler warns when you define a function with the same name as a
  1227. virtual function, but with a type signature that does not match any
  1228. declarations from the base class.
  1229.  
  1230. @item -Werror
  1231. Make all warnings into errors.
  1232. @end table
  1233.  
  1234. @node Debugging Options
  1235. @section Options for Debugging Your Program or GNU CC
  1236. @cindex options, debugging
  1237. @cindex debugging information options
  1238.  
  1239. GNU CC has various special options that are used for debugging
  1240. either your program or GCC:
  1241.  
  1242. @table @code
  1243. @item -g
  1244. Produce debugging information in the operating system's native format
  1245. (stabs, COFF, XCOFF, or DWARF).  GDB can work with this debugging
  1246. information.
  1247.  
  1248. On most systems that use stabs format, @samp{-g} enables use of extra
  1249. debugging information that only GDB can use; this extra information
  1250. makes debugging work better in GDB but will probably make other debuggers
  1251. crash or
  1252. refuse to read the program.  If you want to control for certain whether
  1253. to generate the extra information, use @samp{-gstabs+}, @samp{-gstabs},
  1254. @samp{-gxcoff+}, @samp{-gxcoff}, @samp{-gdwarf+}, or @samp{-gdwarf}
  1255. (see below).
  1256.  
  1257. Unlike most other C compilers, GNU CC allows you to use @samp{-g} with
  1258. @samp{-O}.  The shortcuts taken by optimized code may occasionally
  1259. produce surprising results: some variables you declared may not exist
  1260. at all; flow of control may briefly move where you did not expect it;
  1261. some statements may not be executed because they compute constant
  1262. results or their values were already at hand; some statements may
  1263. execute in different places because they were moved out of loops.
  1264.  
  1265. Nevertheless it proves possible to debug optimized output.  This makes
  1266. it reasonable to use the optimizer for programs that might have bugs.
  1267.  
  1268. The following options are useful when GNU CC is generated with the
  1269. capability for more than one debugging format.
  1270.  
  1271. @item -ggdb
  1272. Produce debugging information in the native format (if that is supported),
  1273. including GDB extensions if at all possible.
  1274.  
  1275. @item -gstabs
  1276. Produce debugging information in stabs format (if that is supported),
  1277. without GDB extensions.  This is the format used by DBX on most BSD
  1278. systems.
  1279.  
  1280. @item -gstabs+
  1281. Produce debugging information in stabs format (if that is supported),
  1282. using GNU extensions understood only by the GNU debugger (GDB).  The
  1283. use of these extensions is likely to make other debuggers crash or
  1284. refuse to read the program.
  1285.  
  1286. @item -gcoff
  1287. Produce debugging information in COFF format (if that is supported).
  1288. This is the format used by SDB on most System V systems prior to
  1289. System V Release 4.
  1290.  
  1291. @item -gxcoff
  1292. Produce debugging information in XCOFF format (if that is supported).
  1293. This is the format used by the DBX debugger on IBM RS/6000 systems.
  1294.  
  1295. @item -gxcoff+
  1296. Produce debugging information in XCOFF format (if that is supported),
  1297. using GNU extensions understood only by the GNU debugger (GDB).  The
  1298. use of these extensions is likely to make other debuggers crash or
  1299. refuse to read the program.
  1300.  
  1301. @item -gdwarf
  1302. Produce debugging information in DWARF format (if that is supported).
  1303. This is the format used by SDB on most System V Release 4 systems.
  1304.  
  1305. @item -gdwarf+
  1306. Produce debugging information in DWARF format (if that is supported),
  1307. using GNU extensions understood only by the GNU debugger (GDB).  The
  1308. use of these extensions is likely to make other debuggers crash or
  1309. refuse to read the program.
  1310.  
  1311. @item -g@var{level}
  1312. @itemx -ggdb@var{level}
  1313. @itemx -gstabs@var{level}
  1314. @itemx -gcoff@var{level}
  1315. @itemx -gxcoff@var{level}
  1316. @itemx -gdwarf@var{level}
  1317. Request debugging information and also use @var{level} to specify how
  1318. much information.  The default level is 2.
  1319.  
  1320. Level 1 produces minimal information, enough for making backtraces in
  1321. parts of the program that you don't plan to debug.  This includes
  1322. descriptions of functions and external variables, but no information
  1323. about local variables and no line numbers.
  1324.  
  1325. Level 3 includes extra information, such as all the macro definitions
  1326. present in the program.  Some debuggers support macro expansion when
  1327. you use @samp{-g3}.
  1328.  
  1329. @cindex @code{prof}
  1330. @item -p
  1331. Generate extra code to write profile information suitable for the
  1332. analysis program @code{prof}.  You must use this option when compiling
  1333. the source files you want data about, and you must also use it when
  1334. linking.
  1335.  
  1336. @cindex @code{gprof}
  1337. @item -pg
  1338. Generate extra code to write profile information suitable for the
  1339. analysis program @code{gprof}.  You must use this option when compiling
  1340. the source files you want data about, and you must also use it when
  1341. linking.
  1342.  
  1343. @cindex @code{tcov}
  1344. @item -a
  1345. Generate extra code to write profile information for basic blocks,
  1346. which will record the number of times each basic block is executed.
  1347. This data could be analyzed by a program like @code{tcov}.  Note,
  1348. however, that the format of the data is not what @code{tcov} expects.
  1349. Eventually GNU @code{gprof} should be extended to process this data.
  1350.  
  1351. @item -d@var{letters}
  1352. Says to make debugging dumps during compilation at times specified by
  1353. @var{letters}.  This is used for debugging the compiler.  The file names
  1354. for most of the dumps are made by appending a word to the source file
  1355. name (e.g.  @file{foo.c.rtl} or @file{foo.c.jump}).  Here are the
  1356. possible letters for use in @var{letters}, and their meanings:
  1357.  
  1358. @table @samp
  1359. @item M
  1360. Dump all macro definitions, at the end of preprocessing, and write no
  1361. output.
  1362. @item N
  1363. Dump all macro names, at the end of preprocessing.
  1364. @item D
  1365. Dump all macro definitions, at the end of preprocessing, in addition to
  1366. normal output.
  1367. @item y
  1368. Dump debugging information during parsing, to standard error.
  1369. @item r
  1370. Dump after RTL generation, to @file{@var{file}.rtl}.
  1371. @item x
  1372. Just generate RTL for a function instead of compiling it.  Usually used
  1373. with @samp{r}.
  1374. @item j
  1375. Dump after first jump optimization, to @file{@var{file}.jump}.
  1376. @item s
  1377. Dump after CSE (including the jump optimization that sometimes
  1378. follows CSE), to @file{@var{file}.cse}.
  1379. @item L
  1380. Dump after loop optimization, to @file{@var{file}.loop}.
  1381. @item t
  1382. Dump after the second CSE pass (including the jump optimization that
  1383. sometimes follows CSE), to @file{@var{file}.cse2}.
  1384. @item f
  1385. Dump after flow analysis, to @file{@var{file}.flow}.
  1386. @c the following produces an overfull hbox, and i'm not sure what to do
  1387. @c about it.. --mew
  1388. @item c
  1389. Dump after instruction combination, to@*
  1390. @file{@var{file}.combine}.
  1391. @item S
  1392. Dump after the first instruction scheduling pass, to
  1393. @file{@var{file}.sched}.
  1394. @item l
  1395. Dump after local register allocation, to@*
  1396. @file{@var{file}.lreg}.
  1397. @item g
  1398. Dump after global register allocation, to@*
  1399. @file{@var{file}.greg}.
  1400. @item R
  1401. Dump after the second instruction scheduling pass, to
  1402. @file{@var{file}.sched2}.
  1403. @item J
  1404. Dump after last jump optimization, to @file{@var{file}.jump2}.
  1405. @item d
  1406. Dump after delayed branch scheduling, to @file{@var{file}.dbr}.
  1407. @item k
  1408. Dump after conversion from registers to stack, to @file{@var{file}.stack}.
  1409. @item a
  1410. Produce all the dumps listed above.
  1411. @item m
  1412. Print statistics on memory usage, at the end of the run, to
  1413. standard error.
  1414. @item p
  1415. Annotate the assembler output with a comment indicating which
  1416. pattern and alternative was used.
  1417. @end table
  1418.  
  1419. @item -fpretend-float
  1420. When running a cross-compiler, pretend that the target machine uses the
  1421. same floating point format as the host machine.  This causes incorrect
  1422. output of the actual floating constants, but the actual instruction
  1423. sequence will probably be the same as GNU CC would make when running on
  1424. the target machine.
  1425.  
  1426. @item -save-temps
  1427. Store the usual ``temporary'' intermediate files permanently; place them
  1428. in the current directory and name them based on the source file.  Thus,
  1429. compiling @file{foo.c} with @samp{-c -save-temps} would produce files
  1430. @file{foo.i} and @file{foo.s}, as well as @file{foo.o}.
  1431.  
  1432. @item -print-libgcc-file-name
  1433. Print the full absolute name of the library file @file{libgcc.a} that
  1434. would be used when linking---and don't do anything else.  With this
  1435. option, GNU CC does not compile or link anything; it just prints the
  1436. file name.
  1437.  
  1438. This is useful when you use @samp{-nostdlib} but you do want to link
  1439. with @file{libgcc.a}.  You can do
  1440.  
  1441. @example
  1442. gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
  1443. @end example
  1444. @end table
  1445.  
  1446. @node Optimize Options
  1447. @section Options That Control Optimization
  1448. @cindex optimize options
  1449. @cindex options, optimization
  1450.  
  1451. These options control various sorts of optimizations:
  1452.  
  1453. @table @code
  1454. @item -O
  1455. @itemx -O1
  1456. Optimize.  Optimizing compilation takes somewhat more time, and a lot
  1457. more memory for a large function.
  1458.  
  1459. Without @samp{-O}, the compiler's goal is to reduce the cost of
  1460. compilation and to make debugging produce the expected results.
  1461. Statements are independent: if you stop the program with a breakpoint
  1462. between statements, you can then assign a new value to any variable or
  1463. change the program counter to any other statement in the function and
  1464. get exactly the results you would expect from the source code.
  1465.  
  1466. Without @samp{-O}, only variables declared @code{register} are
  1467. allocated in registers.  The resulting compiled code is a little worse
  1468. than produced by PCC without @samp{-O}.
  1469.  
  1470. With @samp{-O}, the compiler tries to reduce code size and execution
  1471. time.
  1472.  
  1473. When @samp{-O} is specified, the two options @samp{-fthread-jumps} and
  1474. @samp{-fdelayed-branch} are turned on.  On some machines other flags may
  1475. also be turned on.
  1476.  
  1477. @item -O2
  1478. Optimize even more.  Nearly all supported optimizations that do not
  1479. involve a space-speed tradeoff are performed.  As compared to @samp{-O},
  1480. this option increases both compilation time and the performance of the
  1481. generated code.
  1482.  
  1483. @samp{-O2} turns on all @samp{-f@var{flag}} options that enable more
  1484. optimization, except for @samp{-funroll-loops},
  1485. @samp{-funroll-all-loops} and @samp{-fomit-frame-pointer}.
  1486.  
  1487. @item -O0
  1488. Do not optimize.
  1489.  
  1490. If you use multiple @samp{-O} options, with or without level numbers,
  1491. the last such option is the one that is effective.
  1492. @end table
  1493.  
  1494. Options of the form @samp{-f@var{flag}} specify machine-independent
  1495. flags.  Most flags have both positive and negative forms; the negative
  1496. form of @samp{-ffoo} would be @samp{-fno-foo}.  In the table below,
  1497. only one of the forms is listed---the one which is not the default.
  1498. You can figure out the other form by either removing @samp{no-} or
  1499. adding it.
  1500.  
  1501. @table @code
  1502. @item -ffloat-store
  1503. Do not store floating point variables in registers, and inhibit other
  1504. options that might change whether a floating point value is taken from a
  1505. register or memory.
  1506.  
  1507. This option prevents undesirable excess precision on machines such as
  1508. the 68000 where the floating registers (of the 68881) keep more
  1509. precision than a @code{double} is supposed to have.  For most programs,
  1510. the excess precision does only good, but a few programs rely on the
  1511. precise definition of IEEE floating point.  Use @samp{-ffloat-store} for
  1512. such programs.
  1513.  
  1514. @item -fno-default-inline
  1515. Do not make member functions inline by default merely because they are
  1516. defined inside the class scope (C++ only).  Otherwise, when you specify
  1517. @w{@samp{-O}}, member functions defined inside class scope are compiled
  1518. inline by default; i.e., you don't need to add @samp{inline} in front of
  1519. the member function name.
  1520.  
  1521. @item -fno-defer-pop
  1522. Always pop the arguments to each function call as soon as that function
  1523. returns.  For machines which must pop arguments after a function call,
  1524. the compiler normally lets arguments accumulate on the stack for several
  1525. function calls and pops them all at once.
  1526.  
  1527. @item -fforce-mem
  1528. Force memory operands to be copied into registers before doing
  1529. arithmetic on them.  This may produce better code by making all
  1530. memory references potential common subexpressions.  When they are
  1531. not common subexpressions, instruction combination should
  1532. eliminate the separate register-load.  I am interested in hearing
  1533. about the difference this makes.
  1534.  
  1535. @item -fforce-addr
  1536. Force memory address constants to be copied into registers before
  1537. doing arithmetic on them.  This may produce better code just as
  1538. @samp{-fforce-mem} may.  I am interested in hearing about the
  1539. difference this makes.
  1540.  
  1541. @item -fomit-frame-pointer
  1542. Don't keep the frame pointer in a register for functions that
  1543. don't need one.  This avoids the instructions to save, set up and
  1544. restore frame pointers; it also makes an extra register available
  1545. in many functions.  @strong{It also makes debugging impossible on
  1546. some machines.}
  1547.  
  1548. @ifset INTERNALS
  1549. On some machines, such as the Vax, this flag has no effect, because
  1550. the standard calling sequence automatically handles the frame pointer
  1551. and nothing is saved by pretending it doesn't exist.  The
  1552. machine-description macro @code{FRAME_POINTER_REQUIRED} controls
  1553. whether a target machine supports this flag.  @xref{Registers}.@refill
  1554. @end ifset
  1555. @ifclear INTERNALS
  1556. On some machines, such as the Vax, this flag has no effect, because
  1557. the standard calling sequence automatically handles the frame pointer
  1558. and nothing is saved by pretending it doesn't exist.  The
  1559. machine-description macro @code{FRAME_POINTER_REQUIRED} controls
  1560. whether a target machine supports this flag.  @xref{Registers,,Register
  1561. Usage, gcc.info, Using and Porting GCC}.@refill
  1562. @end ifclear
  1563.  
  1564. @item -fno-inline
  1565. Don't pay attention to the @code{inline} keyword.  Normally this option
  1566. is used to keep the compiler from expanding any functions inline.
  1567. Note that if you are not optimizing, no functions can be expanded inline.
  1568.  
  1569. @item -finline-functions
  1570. Integrate all simple functions into their callers.  The compiler
  1571. heuristically decides which functions are simple enough to be worth
  1572. integrating in this way.
  1573.  
  1574. If all calls to a given function are integrated, and the function is
  1575. declared @code{static}, then the function is normally not output as
  1576. assembler code in its own right.
  1577.  
  1578. @item -fkeep-inline-functions
  1579. Even if all calls to a given function are integrated, and the function
  1580. is declared @code{static}, nevertheless output a separate run-time
  1581. callable version of the function.
  1582.  
  1583. @item -fno-function-cse
  1584. Do not put function addresses in registers; make each instruction that
  1585. calls a constant function contain the function's address explicitly.
  1586.  
  1587. This option results in less efficient code, but some strange hacks
  1588. that alter the assembler output may be confused by the optimizations
  1589. performed when this option is not used.
  1590.  
  1591. @item -ffast-math
  1592. This option allows GCC to violate some ANSI or IEEE rules and/or
  1593. specifications in the interest of optimizing code for speed.  For
  1594. example, it allows the compiler to assume arguments to the @code{sqrt}
  1595. function are non-negative numbers.
  1596.  
  1597. This option should never be turned on by any @samp{-O} option since 
  1598. it can result in incorrect output for programs which depend on 
  1599. an exact implementation of IEEE or ANSI rules/specifications for
  1600. math functions.
  1601. @end table
  1602.  
  1603. @c following causes underfulls.. they don't look great, but we deal.
  1604. @c --mew 26jan93
  1605. The following options control specific optimizations.  The @samp{-O2}
  1606. option turns on all of these optimizations except @samp{-funroll-loops}
  1607. and @samp{-funroll-all-loops}.  On most machines, the @samp{-O} option
  1608. turns on the @samp{-fthread-jumps} and @samp{-fdelayed-branch} options,
  1609. but specific machines may handle it differently.
  1610.  
  1611. You can use the following flags in the rare cases when ``fine-tuning''
  1612. of optimizations to be performed is desired.
  1613.  
  1614. @table @code
  1615. @item -fstrength-reduce
  1616. Perform the optimizations of loop strength reduction and
  1617. elimination of iteration variables.
  1618.  
  1619. @item -fthread-jumps
  1620. Perform optimizations where we check to see if a jump branches to a
  1621. location where another comparison subsumed by the first is found.  If
  1622. so, the first branch is redirected to either the destination of the
  1623. second branch or a point immediately following it, depending on whether
  1624. the condition is known to be true or false.
  1625.  
  1626. @item -fcse-follow-jumps
  1627. In common subexpression elimination, scan through jump instructions
  1628. when the target of the jump is not reached by any other path.  For
  1629. example, when CSE encounters an @code{if} statement with an
  1630. @code{else} clause, CSE will follow the jump when the condition
  1631. tested is false.
  1632.  
  1633. @item -fcse-skip-blocks
  1634. This is similar to @samp{-fcse-follow-jumps}, but causes CSE to
  1635. follow jumps which conditionally skip over blocks.  When CSE
  1636. encounters a simple @code{if} statement with no else clause,
  1637. @samp{-fcse-skip-blocks} causes CSE to follow the jump around the
  1638. body of the @code{if}.
  1639.  
  1640. @item -frerun-cse-after-loop
  1641. Re-run common subexpression elimination after loop optimizations has been
  1642. performed.  
  1643.  
  1644. @item -fexpensive-optimizations
  1645. Perform a number of minor optimizations that are relatively expensive.
  1646.  
  1647. @item -fdelayed-branch
  1648. If supported for the target machine, attempt to reorder instructions
  1649. to exploit instruction slots available after delayed branch
  1650. instructions.
  1651.  
  1652. @item -fschedule-insns
  1653. If supported for the target machine, attempt to reorder instructions to
  1654. eliminate execution stalls due to required data being unavailable.  This
  1655. helps machines that have slow floating point or memory load instructions
  1656. by allowing other instructions to be issued until the result of the load
  1657. or floating point instruction is required.
  1658.  
  1659. @item -fschedule-insns2
  1660. Similar to @samp{-fschedule-insns}, but requests an additional pass of
  1661. instruction scheduling after register allocation has been done.  This is
  1662. especially useful on machines with a relatively small number of
  1663. registers and where memory load instructions take more than one cycle.
  1664.  
  1665. @item -fcaller-saves
  1666. Enable values to be allocated in registers that will be clobbered by
  1667. function calls, by emitting extra instructions to save and restore the
  1668. registers around such calls.  Such allocation is done only when it
  1669. seems to result in better code than would otherwise be produced.
  1670.  
  1671. This option is enabled by default on certain machines, usually those
  1672. which have no call-preserved registers to use instead.
  1673.  
  1674. @item -funroll-loops
  1675. Perform the optimization of loop unrolling.  This is only done for loops
  1676. whose number of iterations can be determined at compile time or run time.
  1677. @samp{-funroll-loop} implies @samp{-fstrength-reduce} and
  1678. @samp{-frerun-cse-after-loop}.
  1679.  
  1680. @item -funroll-all-loops
  1681. Perform the optimization of loop unrolling.  This is done for all loops
  1682. and usually makes programs run more slowly.  @samp{-funroll-all-loops}
  1683. implies @samp{-fstrength-reduce} and @samp{-frerun-cse-after-loop}.
  1684.  
  1685. @item -fno-peephole
  1686. Disable any machine-specific peephole optimizations.
  1687. @end table
  1688.  
  1689. @node Preprocessor Options
  1690. @section Options Controlling the Preprocessor
  1691. @cindex preprocessor options
  1692. @cindex options, preprocessor
  1693.  
  1694. These options control the C preprocessor, which is run on each C source
  1695. file before actual compilation.
  1696.  
  1697. If you use the @samp{-E} option, nothing is done except preprocessing.
  1698. Some of these options make sense only together with @samp{-E} because
  1699. they cause the preprocessor output to be unsuitable for actual
  1700. compilation.
  1701.  
  1702. @table @code
  1703. @item -include @var{file}
  1704. Process @var{file} as input before processing the regular input file.
  1705. In effect, the contents of @var{file} are compiled first.  Any @samp{-D}
  1706. and @samp{-U} options on the command line are always processed before
  1707. @samp{-include @var{file}}, regardless of the order in which they are
  1708. written.  All the @samp{-include} and @samp{-imacros} options are
  1709. processed in the order in which they are written.
  1710.  
  1711. @item -imacros @var{file}
  1712. Process @var{file} as input, discarding the resulting output, before
  1713. processing the regular input file.  Because the output generated from
  1714. @var{file} is discarded, the only effect of @samp{-imacros @var{file}}
  1715. is to make the macros defined in @var{file} available for use in the
  1716. main input.
  1717.  
  1718. Any @samp{-D} and @samp{-U} options on the command line are always
  1719. processed before @samp{-imacros @var{file}}, regardless of the order in
  1720. which they are written.  All the @samp{-include} and @samp{-imacros}
  1721. options are processed in the order in which they are written.
  1722.  
  1723. @item -idirafter @var{dir}
  1724. @cindex second include path
  1725. Add the directory @var{dir} to the second include path.  The directories
  1726. on the second include path are searched when a header file is not found
  1727. in any of the directories in the main include path (the one that
  1728. @samp{-I} adds to).
  1729.  
  1730. @item -iprefix @var{prefix}
  1731. Specify @var{prefix} as the prefix for subsequent @samp{-iwithprefix}
  1732. options.
  1733.  
  1734. @item -iwithprefix @var{dir}
  1735. Add a directory to the second include path.  The directory's name is
  1736. made by concatenating @var{prefix} and @var{dir}, where @var{prefix}
  1737. was specified previously with @samp{-iprefix}.
  1738.  
  1739. @item -nostdinc
  1740. Do not search the standard system directories for header files.  Only
  1741. the directories you have specified with @samp{-I} options (and the
  1742. current directory, if appropriate) are searched.  @xref{Directory
  1743. Options}, for information on @samp{-I}.
  1744.  
  1745. By using both @samp{-nostdinc} and @samp{-I-}, you can limit the include-file
  1746. search path to only those directories you specify explicitly.
  1747.  
  1748. @item -undef
  1749. Do not predefine any nonstandard macros.  (Including architecture flags).
  1750.  
  1751. @item -E
  1752. Run only the C preprocessor.  Preprocess all the C source files
  1753. specified and output the results to standard output or to the
  1754. specified output file.
  1755.  
  1756. @item -C
  1757. Tell the preprocessor not to discard comments.  Used with the
  1758. @samp{-E} option.
  1759.  
  1760. @item -P
  1761. Tell the preprocessor not to generate @samp{#line} commands.
  1762. Used with the @samp{-E} option.
  1763.  
  1764. @cindex make
  1765. @cindex dependencies, make
  1766. @item -M
  1767. Tell the preprocessor to output a rule suitable for @code{make}
  1768. describing the dependencies of each object file.  For each source file,
  1769. the preprocessor outputs one @code{make}-rule whose target is the object
  1770. file name for that source file and whose dependencies are all the
  1771. @code{#include} header files it uses.  This rule may be a single line or
  1772. may be continued with @samp{\}-newline if it is long.  The list of rules
  1773. is printed on standard output instead of the preprocessed C program.
  1774.  
  1775. @samp{-M} implies @samp{-E}.
  1776.  
  1777. Another way to specify output of a @code{make} rule is by setting
  1778. the environment variable @code{DEPENDENCIES_OUTPUT} (@pxref{Environment
  1779. Variables}).
  1780.  
  1781. @item -MM
  1782. Like @samp{-M} but the output mentions only the user header files
  1783. included with @samp{#include "@var{file}"}.  System header files
  1784. included with @samp{#include <@var{file}>} are omitted.
  1785.  
  1786. @item -MD
  1787. Like @samp{-M} but the dependency information is written to files with
  1788. names made by replacing @samp{.o} with @samp{.d} at the end of the
  1789. output file names.  This is in addition to compiling the input files as
  1790. specified---@samp{-MD} does not inhibit ordinary compilation the way
  1791. @samp{-M} does.
  1792.  
  1793. The Mach utility @samp{md} can be used to merge the @samp{.d} files
  1794. into a single dependency file suitable for using with the @samp{make}
  1795. command.
  1796.  
  1797. @item -MMD
  1798. Like @samp{-MD} except mention only user header files, not system
  1799. header files.
  1800.  
  1801. @item -H
  1802. Print the name of each header file used, in addition to other normal
  1803. activities.
  1804.  
  1805. @item -A@var{question}(@var{answer})
  1806. Assert the answer @var{answer} for @var{question}, in case it is tested
  1807. with a preprocessor conditional such as @samp{#if
  1808. #@var{question}(@var{answer})}.  @samp{-A-} disables the standard
  1809. assertions that normally describe the target machine.
  1810.  
  1811. @item -D@var{macro}
  1812. Define macro @var{macro} with the string @samp{1} as its definition.
  1813.  
  1814. @item -D@var{macro}=@var{defn}
  1815. Define macro @var{macro} as @var{defn}.  All instances of @samp{-D} on
  1816. the command line are processed before any @samp{-U} options.
  1817.  
  1818. @item -U@var{macro}
  1819. Undefine macro @var{macro}.  @samp{-U} options are evaluated after all
  1820. @samp{-D} options, but before any @samp{-include} and @samp{-imacros}
  1821. options.
  1822.  
  1823. @item -dM
  1824. Tell the preprocessor to output only a list of the macro definitions
  1825. that are in effect at the end of preprocessing.  Used with the @samp{-E}
  1826. option.
  1827.  
  1828. @item -dD
  1829. Tell the preprocessing to pass all macro definitions into the output, in
  1830. their proper sequence in the rest of the output.
  1831.  
  1832. @item -dN
  1833. Like @samp{-dD} except that the macro arguments and contents are omitted.
  1834. Only @samp{#define @var{name}} is included in the output.
  1835.  
  1836. @item -trigraphs
  1837. Support ANSI C trigraphs.  You don't want to know about this
  1838. brain-damage.  The @samp{-ansi} option also has this effect.
  1839. @end table
  1840.  
  1841. @node Assembler Options
  1842. @section Passing Options to the Assembler
  1843.  
  1844. @table @code
  1845. @item -Wa,@var{option}
  1846. Pass @var{option} as an option to the assembler.  If @var{option}
  1847. contains commas, it is split into multiple options at the commas.
  1848. @end table
  1849.  
  1850. @node Link Options
  1851. @section Options for Linking
  1852. @cindex link options
  1853. @cindex options, linking
  1854.  
  1855. These options come into play when the compiler links object files into
  1856. an executable output file.  They are meaningless if the compiler is
  1857. not doing a link step.
  1858.  
  1859. @table @code
  1860. @cindex file names
  1861. @item @var{object-file-name}
  1862. A file name that does not end in a special recognized suffix is
  1863. considered to name an object file or library.  (Object files are
  1864. distinguished from libraries by the linker according to the file
  1865. contents.)  If linking is done, these object files are used as input
  1866. to the linker.
  1867.  
  1868. @item -c
  1869. @itemx -S
  1870. @itemx -E
  1871. If any of these options is used, then the linker is not run, and
  1872. object file names should not be used as arguments.  @xref{Overall
  1873. Options}.
  1874.  
  1875. @cindex Libraries
  1876. @item -l@var{library}
  1877. Search the library named @var{library} when linking.
  1878.  
  1879. It makes a difference where in the command you write this option; the
  1880. linker searches processes libraries and object files in the order they
  1881. are specified.  Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
  1882. after file @file{foo.o} but before @file{bar.o}.  If @file{bar.o} refers
  1883. to functions in @samp{z}, those functions may not be loaded.
  1884.  
  1885. The linker searches a standard list of directories for the library,
  1886. which is actually a file named @file{lib@var{library}.a}.  The linker
  1887. then uses this file as if it had been specified precisely by name.
  1888.  
  1889. The directories searched include several standard system directories
  1890. plus any that you specify with @samp{-L}.
  1891.  
  1892. Normally the files found this way are library files---archive files
  1893. whose members are object files.  The linker handles an archive file by
  1894. scanning through it for members which define symbols that have so far
  1895. been referenced but not defined.  But if the file that is found is an
  1896. ordinary object file, it is linked in the usual fashion.  The only
  1897. difference between using an @samp{-l} option and specifying a file name
  1898. is that @samp{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
  1899. and searches several directories.
  1900.  
  1901. @item -lobjc
  1902. You need this special case of the @samp{-l} option in order to
  1903. link an Objective C program.
  1904.  
  1905. @item -nostartfiles
  1906. Do not use the standard system startup files when linking.
  1907. The standard libraries are used normally.
  1908.  
  1909. @item -nostdlib
  1910. Don't use the standard system libraries and startup files when linking.
  1911. Only the files you specify will be passed to the linker.
  1912.  
  1913. @item -static
  1914. On systems that support dynamic linking, this prevents linking with the shared
  1915. libraries.  On other systems, this
  1916. option has no effect.
  1917.  
  1918. @item -shared
  1919. Produce a shared object which can then be linked with other objects to
  1920. form an executable.  Only a few systems support this option.
  1921.  
  1922. @item -symbolic
  1923. Bind references to global symbols when building a shared object.  Warn
  1924. about any unresolved references (unless overridden by the link editor
  1925. option @samp{-Xlinker -z -Xlinker defs}).  Only a few systems support
  1926. this option.
  1927.  
  1928. @item -Xlinker @var{option}
  1929. Pass @var{option} as an option to the linker.  You can use this to
  1930. supply system-specific linker options which GNU CC does not know how to
  1931. recognize.
  1932.  
  1933. If you want to pass an option that takes an argument, you must use
  1934. @samp{-Xlinker} twice, once for the option and once for the argument.
  1935. For example, to pass @samp{-assert definitions}, you must write
  1936. @samp{-Xlinker -assert -Xlinker definitions}.  It does not work to write
  1937. @samp{-Xlinker "-assert definitions"}, because this passes the entire
  1938. string as a single argument, which is not what the linker expects.
  1939.  
  1940. @item -Wl,@var{option}
  1941. Pass @var{option} as an option to the linker.  If @var{option} contains
  1942. commas, it is split into multiple options at the commas.
  1943.  
  1944. @item -u @var{symbol}
  1945. Pretend the symbol @var{symbol} is undefined, to force linking of
  1946. library modules to define it.  You can use @samp{-u} multiple times with
  1947. different symbols to force loading of additional library modules.
  1948. @end table
  1949.  
  1950. @node Directory Options
  1951. @section Options for Directory Search
  1952. @cindex directory options
  1953. @cindex options, directory search
  1954. @cindex search path
  1955.  
  1956. These options specify directories to search for header files, for
  1957. libraries and for parts of the compiler:
  1958.  
  1959. @table @code
  1960. @item -I@var{dir}
  1961. Append directory @var{dir} to the list of directories searched for
  1962. include files.
  1963.  
  1964. @item -I-
  1965. Any directories you specify with @samp{-I} options before the @samp{-I-}
  1966. option are searched only for the case of @samp{#include "@var{file}"};
  1967. they are not searched for @samp{#include <@var{file}>}.
  1968.  
  1969. If additional directories are specified with @samp{-I} options after
  1970. the @samp{-I-}, these directories are searched for all @samp{#include}
  1971. directives.  (Ordinarily @emph{all} @samp{-I} directories are used
  1972. this way.)
  1973.  
  1974. In addition, the @samp{-I-} option inhibits the use of the current
  1975. directory (where the current input file came from) as the first search
  1976. directory for @samp{#include "@var{file}"}.  There is no way to
  1977. override this effect of @samp{-I-}.  With @samp{-I.} you can specify
  1978. searching the directory which was current when the compiler was
  1979. invoked.  That is not exactly the same as what the preprocessor does
  1980. by default, but it is often satisfactory.
  1981.  
  1982. @samp{-I-} does not inhibit the use of the standard system directories
  1983. for header files.  Thus, @samp{-I-} and @samp{-nostdinc} are
  1984. independent.
  1985.  
  1986. @item -L@var{dir}
  1987. Add directory @var{dir} to the list of directories to be searched
  1988. for @samp{-l}.
  1989.  
  1990. @item -B@var{prefix}
  1991. This option specifies where to find the executables, libraries and
  1992. data files of the compiler itself.
  1993.  
  1994. The compiler driver program runs one or more of the subprograms
  1995. @file{cpp}, @file{cc1}, @file{as} and @file{ld}.  It tries
  1996. @var{prefix} as a prefix for each program it tries to run, both with and
  1997. without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}).
  1998.  
  1999. For each subprogram to be run, the compiler driver first tries the
  2000. @samp{-B} prefix, if any.  If that name is not found, or if @samp{-B}
  2001. was not specified, the driver tries two standard prefixes, which are
  2002. @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc-lib/}.  If neither of
  2003. those results in a file name that is found, the unmodified program
  2004. name is searched for using the directories specified in your
  2005. @samp{PATH} environment variable.
  2006.  
  2007. @samp{-B} prefixes that effectively specify directory names also apply
  2008. to libraries in the linker, because the compiler translates these
  2009. options into @samp{-L} options for the linker.
  2010.  
  2011. The run-time support file @file{libgcc.a} can also be searched for using
  2012. the @samp{-B} prefix, if needed.  If it is not found there, the two
  2013. standard prefixes above are tried, and that is all.  The file is left
  2014. out of the link if it is not found by those means.
  2015.  
  2016. Another way to specify a prefix much like the @samp{-B} prefix is to use
  2017. the environment variable @code{GCC_EXEC_PREFIX}.  @xref{Environment
  2018. Variables}.
  2019. @end table
  2020.  
  2021. @node Target Options
  2022. @section Specifying Target Machine and Compiler Version
  2023. @cindex target options
  2024. @cindex cross compiling
  2025. @cindex specifying machine version
  2026. @cindex specifying compiler version and target machine
  2027. @cindex compiler version, specifying
  2028. @cindex target machine, specifying
  2029.  
  2030. By default, GNU CC compiles code for the same type of machine that you
  2031. are using.  However, it can also be installed as a cross-compiler, to
  2032. compile for some other type of machine.  In fact, several different
  2033. configurations of GNU CC, for different target machines, can be
  2034. installed side by side.  Then you specify which one to use with the
  2035. @samp{-b} option.
  2036.  
  2037. In addition, older and newer versions of GNU CC can be installed side
  2038. by side.  One of them (probably the newest) will be the default, but
  2039. you may sometimes wish to use another.
  2040.  
  2041. @table @code
  2042. @item -b @var{machine}
  2043. The argument @var{machine} specifies the target machine for compilation.
  2044. This is useful when you have installed GNU CC as a cross-compiler.
  2045.  
  2046. The value to use for @var{machine} is the same as was specified as the
  2047. machine type when configuring GNU CC as a cross-compiler.  For
  2048. example, if a cross-compiler was configured with @samp{configure
  2049. i386v}, meaning to compile for an 80386 running System V, then you
  2050. would specify @samp{-b i386v} to run that cross compiler.
  2051.  
  2052. When you do not specify @samp{-b}, it normally means to compile for
  2053. the same type of machine that you are using.
  2054.  
  2055. @item -V @var{version}
  2056. The argument @var{version} specifies which version of GNU CC to run.
  2057. This is useful when multiple versions are installed.  For example,
  2058. @var{version} might be @samp{2.0}, meaning to run GNU CC version 2.0.
  2059.  
  2060. The default version, when you do not specify @samp{-V}, is controlled
  2061. by the way GNU CC is installed.  Normally, it will be a version that
  2062. is recommended for general use.
  2063. @end table
  2064.  
  2065. The @samp{-b} and @samp{-V} options actually work by controlling part of
  2066. the file name used for the executable files and libraries used for
  2067. compilation.  A given version of GNU CC, for a given target machine, is
  2068. normally kept in the directory @file{/usr/local/lib/gcc-lib/@var{machine}/@var{version}}.@refill
  2069.  
  2070. It follows that sites can customize the effect of @samp{-b} or @samp{-V}
  2071. either by changing the names of these directories or adding
  2072. alternate names (or symbolic links).  Thus, if
  2073. @file{/usr/local/lib/gcc-lib/80386} is a link to
  2074. @file{/usr/local/lib/gcc-lib/i386v}, then @samp{-b 80386} becomes an alias
  2075. for @samp{-b i386v}.@refill
  2076.  
  2077. In one respect, the @samp{-b} or @samp{-V} do not completely change
  2078. to a different compiler: the top-level driver program @code{gcc}
  2079. that you originally invoked continues to run and invoke the other
  2080. executables (preprocessor, compiler per se, assembler and linker)
  2081. that do the real work.  However, since no real work is done in the
  2082. driver program, it usually does not matter that the driver program
  2083. in use is not the one for the specified target and version.
  2084.  
  2085. The only way that the driver program depends on the target machine is
  2086. in the parsing and handling of special machine-specific options.
  2087. However, this is controlled by a file which is found, along with the
  2088. other executables, in the directory for the specified version and
  2089. target machine.  As a result, a single installed driver program adapts
  2090. to any specified target machine and compiler version.
  2091.  
  2092. The driver program executable does control one significant thing,
  2093. however: the default version and target machine.  Therefore, you can
  2094. install different instances of the driver program, compiled for
  2095. different targets or versions, under different names.
  2096.  
  2097. For example, if the driver for version 2.0 is installed as @code{ogcc}
  2098. and that for version 2.1 is installed as @code{gcc}, then the command
  2099. @code{gcc} will use version 2.1 by default, while @code{ogcc} will use
  2100. 2.0 by default.  However, you can choose either version with either
  2101. command with the @samp{-V} option.
  2102.  
  2103. @c this makes an underfull hbox; any ideas?  --mew 27jan93
  2104. @c Now fixed --bob 5feb93
  2105. @c Old text, page 46, was:
  2106. @node Submodel Options
  2107. @section Hardware Models and Configurations
  2108. @cindex submodel options
  2109. @cindex specifying hardware config
  2110. @cindex hardware models and configurations, specifying
  2111. @cindex machine dependent options
  2112. @c the section title listing causes an overful hbox.  any ideas?  --mew 
  2113.  
  2114. Earlier we discussed the standard option @samp{-b} which chooses among
  2115. different installed compilers for completely different target
  2116. machines, such as Vax vs. 68000 vs. 80386.
  2117.  
  2118. In addition, each of these target machine types can have its own
  2119. special options, starting with @samp{-m}, to choose among various
  2120. hardware models or configurations---for example, 68010 vs 68020,
  2121. floating coprocessor or none.  A single installed version of the
  2122. compiler can compile for any model or configuration, according to the
  2123. options specified.
  2124.  
  2125. Some configurations of the compiler also support additional special
  2126. options, usually for compatibility with other compilers on the same
  2127. platform.
  2128.  
  2129. @ifset INTERNALS
  2130. These options are defined by the macro @code{TARGET_SWITCHES} in the
  2131. machine description.  The default for the options is also defined by
  2132. that macro, which enables you to change the defaults.
  2133. @end ifset
  2134.  
  2135. @menu
  2136. * M680x0 Options::
  2137. * VAX Options::
  2138. * SPARC Options::
  2139. * Convex Options::
  2140. * AMD29K Options::
  2141. * M88K Options::
  2142. * RS/6000 Options::
  2143. * RT Options::
  2144. * MIPS Options::
  2145. * i386 Options::
  2146. * HPPA Options::
  2147. * Intel 960 Options::
  2148. * DEC Alpha Options::
  2149. * System V Options::
  2150. @end menu
  2151.  
  2152. @node M680x0 Options
  2153. @subsection M680x0 Options
  2154. @cindex M680x0 options
  2155.  
  2156. These are the @samp{-m} options defined for the 68000 series.  The default
  2157. values for these options depends on which style of 68000 was selected when
  2158. the compiler was configured; the defaults for the most common choices are
  2159. given below.
  2160.  
  2161. @table @code
  2162. @item -m68000
  2163. @itemx -mc68000
  2164. Generate output for a 68000.  This is the default
  2165. when the compiler is configured for 68000-based systems.
  2166.  
  2167. @item -m68020
  2168. @itemx -mc68020
  2169. Generate output for a 68020.  This is the default
  2170. when the compiler is configured for 68020-based systems.
  2171.  
  2172. @item -m68881
  2173. Generate output containing 68881 instructions for floating point.
  2174. This is the default for most 68020 systems unless @samp{-nfp} was
  2175. specified when the compiler was configured.
  2176.  
  2177. @item -m68030
  2178. Generate output for a 68030.  This is the default
  2179. when the compiler is configured for 68030-based systems.
  2180.  
  2181. @item -m68040
  2182. Generate output for a 68040.  This is the default
  2183. when the compiler is configured for 68040-based systems.
  2184.  
  2185. @item -m68020-40
  2186. Generate output for a 68040, without using any of the new instructions.
  2187. This results in code which can run relatively efficiently on either a
  2188. 68020/68881 or a 68030 or a 68040.
  2189.  
  2190. @item -mfpa
  2191. Generate output containing Sun FPA instructions for floating point.
  2192.  
  2193. @item -msoft-float
  2194. Generate output containing library calls for floating point.
  2195. @strong{Warning:} the requisite libraries are not part of GNU CC.
  2196. Normally the facilities of the machine's usual C compiler are used, but
  2197. this can't be done directly in cross-compilation.  You must make your
  2198. own arrangements to provide suitable library functions for
  2199. cross-compilation.
  2200.  
  2201. @item -mshort
  2202. Consider type @code{int} to be 16 bits wide, like @code{short int}.
  2203.  
  2204. @item -mnobitfield
  2205. Do not use the bit-field instructions.  The @samp{-m68000} option
  2206. implies @w{@samp{-mnobitfield}}.
  2207. @c is the above still correct?  --mew
  2208.  
  2209. @item -mbitfield
  2210. Do use the bit-field instructions.  The @samp{-m68020} option implies
  2211. @samp{-mbitfield}.  This is the default if you use the unmodified
  2212. sources configured for a 68020.
  2213. @c is the above still correct?  --mew
  2214.  
  2215. @item -mrtd
  2216. Use a different function-calling convention, in which functions
  2217. that take a fixed number of arguments return with the @code{rtd}
  2218. instruction, which pops their arguments while returning.  This
  2219. saves one instruction in the caller since there is no need to pop
  2220. the arguments there.
  2221.  
  2222. This calling convention is incompatible with the one normally
  2223. used on Unix, so you cannot use it if you need to call libraries
  2224. compiled with the Unix compiler.
  2225.  
  2226. Also, you must provide function prototypes for all functions that
  2227. take variable numbers of arguments (including @code{printf});
  2228. otherwise incorrect code will be generated for calls to those
  2229. functions.
  2230.  
  2231. In addition, seriously incorrect code will result if you call a
  2232. function with too many arguments.  (Normally, extra arguments are
  2233. harmlessly ignored.)
  2234.  
  2235. The @code{rtd} instruction is supported by the 68010 and 68020
  2236. processors, but not by the 68000.
  2237. @end table
  2238.  
  2239. @node VAX Options
  2240. @subsection VAX Options
  2241. @cindex VAX options
  2242.  
  2243. These @samp{-m} options are defined for the Vax:
  2244.  
  2245. @table @code
  2246. @item -munix
  2247. Do not output certain jump instructions (@code{aobleq} and so on)
  2248. that the Unix assembler for the Vax cannot handle across long
  2249. ranges.
  2250.  
  2251. @item -mgnu
  2252. Do output those jump instructions, on the assumption that you
  2253. will assemble with the GNU assembler.
  2254.  
  2255. @item -mg
  2256. Output code for g-format floating point numbers instead of d-format.
  2257. @end table
  2258.  
  2259. @node SPARC Options
  2260. @subsection SPARC Options
  2261. @cindex SPARC options
  2262.  
  2263. These @samp{-m} switches are supported on the SPARC:
  2264.  
  2265. @table @code
  2266. @item -mfpu
  2267. @itemx -mhard-float
  2268. Generate output containing floating point instructions.  This is the
  2269. default.
  2270.  
  2271. @item -mno-fpu
  2272. @itemx -msoft-float
  2273. Generate output containing library calls for floating point.
  2274. @strong{Warning:} there is no GNU floating-point library for SPARC.
  2275. Normally the facilities of the machine's usual C compiler are used, but
  2276. this cannot be done directly in cross-compilation.  You must make your
  2277. own arrangements to provide suitable library functions for
  2278. cross-compilation.
  2279.  
  2280. @samp{-msoft-float} changes the calling convention in the output file;
  2281. therefore, it is only useful if you compile @emph{all} of a program with
  2282. this option.
  2283.  
  2284. @ignore
  2285. @c Jim Wilson says this is obsolete and about to vanish
  2286. @item -mforce-align
  2287. Make sure all objects of type @code{double} are 8-byte aligned in memory
  2288. and use double-word instructions to reference them.
  2289. @end ignore
  2290.  
  2291. @item -mno-epilogue
  2292. @itemx -mepilogue
  2293. With @samp{-mepilogue} (the default), the compiler always emits code for
  2294. function exit at the end of each function.  Any function exit in
  2295. the middle of the function (such as a return statement in C) will
  2296. generate a jump to the exit code at the end of the function.
  2297.  
  2298. With @samp{-mno-epilogue}, the compiler tries to emit exit code inline
  2299. at every function exit.
  2300.  
  2301. @item -mv8
  2302. @itemx -msparclite
  2303. These two options select variations on the SPARC architecture.
  2304.  
  2305. By default (unless specifically configured for the Fujitsu SPARClite),
  2306. GCC generates code for the v7 variant of the SPARC architecture.
  2307.  
  2308. @samp{-mv8} will give you SPARC v8 code.  The only difference from v7
  2309. code is that the compiler emits the integer multiply and integer
  2310. divide instructions which exist in SPARC v8 but not in SPARC v7.
  2311.  
  2312. @samp{-msparclite} will give you SPARClite code.  This adds the integer
  2313. multiply, integer divide step and scan (@code{ffs}) instructions which
  2314. exist in SPARClite but not in SPARC v7.
  2315. @end table
  2316.  
  2317. @node Convex Options
  2318. @subsection Convex Options
  2319. @cindex Convex options
  2320.  
  2321. These @samp{-m} options are defined for Convex:
  2322.  
  2323. @table @code
  2324. @item -mc1
  2325. Generate output for C1.  The code will run on any Convex machine.
  2326. The preprocessor symbol @code{__convex__c1__} is defined.
  2327.  
  2328. @item -mc2
  2329. Generate output for C2.  Uses instructions not available on C1.
  2330. Scheduling and other optimizations are chosen for max performance on C2.
  2331. The preprocessor symbol @code{__convex_c2__} is defined.
  2332.  
  2333. @item -mc32
  2334. Generate output for C32xx.  Uses instructions not available on C1.
  2335. Scheduling and other optimizations are chosen for max performance on C32.
  2336. The preprocessor symbol @code{__convex_c32__} is defined.
  2337.  
  2338. @item -mc34
  2339. Generate output for C34xx.  Uses instructions not available on C1.
  2340. Scheduling and other optimizations are chosen for max performance on C34.
  2341. The preprocessor symbol @code{__convex_c34__} is defined.
  2342.  
  2343. @item -mc38
  2344. Generate output for C38xx.  Uses instructions not available on C1.
  2345. Scheduling and other optimizations are chosen for max performance on C38.
  2346. The preprocessor symbol @code{__convex_c38__} is defined.
  2347.  
  2348. @item -margcount
  2349. Generate code which puts an argument count in the word preceding each
  2350. argument list.  This is compatible with regular CC, and a few programs
  2351. may need the argument count word.  GDB and other source-level debuggers
  2352. do not need it; this info is in the symbol table.
  2353.  
  2354. @item -mnoargcount
  2355. Omit the argument count word.  This is the default.
  2356.  
  2357. @item -mvolatile-cache
  2358. Allow volatile references to be cached.  This is the default.
  2359.  
  2360. @item -mvolatile-nocache
  2361. Volatile references bypass the data cache, going all the way to memory.
  2362. This is only needed for multi-processor code that does not use standard
  2363. synchronization instructions.  Making non-volatile references to volatile
  2364. locations will not necessarily work.
  2365.  
  2366. @item -mlong32
  2367. Type long is 32 bits, the same as type int.  This is the default.
  2368.  
  2369. @item -mlong64
  2370. Type long is 64 bits, the same as type long long.  This option is useless,
  2371. because no library support exists for it.
  2372. @end table
  2373.  
  2374. @node AMD29K Options
  2375. @subsection AMD29K Options
  2376. @cindex AMD29K options
  2377.  
  2378. These @samp{-m} options are defined for the AMD Am29000:
  2379.  
  2380. @table @code
  2381. @item -mdw
  2382. Generate code that assumes the @code{DW} bit is set, i.e., that byte and
  2383. halfword operations are directly supported by the hardware.  This is the
  2384. default.
  2385.  
  2386. @item -mnodw
  2387. Generate code that assumes the @code{DW} bit is not set.
  2388.  
  2389. @item -mbw
  2390. Generate code that assumes the system supports byte and halfword write
  2391. operations.  This is the default.
  2392.  
  2393. @item -mnbw
  2394. Generate code that assumes the systems does not support byte and
  2395. halfword write operations.  @samp{-mnbw} implies @samp{-mnodw}.
  2396.  
  2397. @item -msmall
  2398. Use a small memory model that assumes that all function addresses are
  2399. either within a single 256 KB segment or at an absolute address of less
  2400. than 256K.  This allows the @code{call} instruction to be used instead
  2401. of a @code{const}, @code{consth}, @code{calli} sequence.
  2402.  
  2403. @item -mlarge
  2404. Do not assume that the @code{call} instruction can be used; this is the
  2405. default.
  2406.  
  2407. @item -m29050
  2408. Generate code for the Am29050.
  2409.  
  2410. @item -m29000
  2411. Generate code for the Am29000.  This is the default.
  2412.  
  2413. @item -mkernel-registers
  2414. Generate references to registers @code{gr64-gr95} instead of to
  2415. registers @code{gr96-gr127}.  This option can be used when compiling
  2416. kernel code that wants a set of global registers disjoint from that used
  2417. by user-mode code.
  2418.  
  2419. Note that when this option is used, register names in @samp{-f} flags
  2420. must use the normal, user-mode, names.
  2421.  
  2422. @item -muser-registers
  2423. Use the normal set of global registers, @code{gr96-gr127}.  This is the
  2424. default.
  2425.  
  2426. @item -mstack-check
  2427. Insert a call to @code{__msp_check} after each stack adjustment.  This
  2428. is often used for kernel code.
  2429. @end table
  2430.  
  2431. @node M88K Options
  2432. @subsection M88K Options
  2433. @cindex M88k options
  2434.  
  2435. These @samp{-m} options are defined for Motorola 88K architectures:
  2436.  
  2437. @table @code
  2438. @item -m88000
  2439. @kindex -m88000
  2440. Generate code that works well on both the m88100 and the
  2441. m88110.
  2442.  
  2443. @item -m88100
  2444. @kindex -m88100
  2445. Generate code that works best for the m88100, but that also
  2446. runs on the m88110.
  2447.  
  2448. @item -m88110
  2449. @kindex -m88110
  2450. Generate code that works best for the m88110, and may not run
  2451. on the m88100.
  2452.  
  2453. @item -midentify-revision
  2454. @kindex -midentify-revision
  2455. @kindex ident
  2456. @cindex identifying source, compiler (88k)
  2457. Include an @code{ident} directive in the assembler output recording the
  2458. source file name, compiler name and version, timestamp, and compilation
  2459. flags used.
  2460.  
  2461. @item -mno-underscores
  2462. @kindex -mno-underscores
  2463. @cindex underscores, avoiding (88k)
  2464. In assembler output, emit symbol names without adding an underscore
  2465. character at the beginning of each name.  The default is to use an
  2466. underscore as prefix on each name.
  2467.  
  2468. @item -mocs-debug-info
  2469. @itemx -mno-ocs-debug-info
  2470. @kindex -mocs-debug-info
  2471. @kindex -mno-ocs-debug-info
  2472. @cindex OCS (88k)
  2473. @cindex debugging, 88k OCS
  2474. Include (or omit) additional debugging information (about registers used
  2475. in each stack frame) as specified in the 88open Object Compatibility
  2476. Standard, ``OCS''.  This extra information allows debugging of code that
  2477. has had the frame pointer eliminated.  The default for DG/UX, SVr4, and
  2478. Delta 88 SVr3.2 is to include this information; other 88k configurations
  2479. omit this information by default.
  2480.  
  2481. @item -mocs-frame-position
  2482. @kindex -mocs-frame-position
  2483. @cindex register positions in frame (88k)
  2484. When emitting COFF debugging information for automatic variables and
  2485. parameters stored on the stack, use the offset from the canonical frame
  2486. address, which is the stack pointer (register 31) on entry to the
  2487. function.  The DG/UX, SVr4, Delta88 SVr3.2, and BCS configurations use
  2488. @samp{-mocs-frame-position}; other 88k configurations have the default
  2489. @samp{-mno-ocs-frame-position}.
  2490.  
  2491. @item -mno-ocs-frame-position
  2492. @kindex -mno-ocs-frame-position
  2493. @cindex register positions in frame (88k)
  2494. When emitting COFF debugging information for automatic variables and
  2495. parameters stored on the stack, use the offset from the frame pointer
  2496. register (register 30).  When this option is in effect, the frame
  2497. pointer is not eliminated when debugging information is selected by the
  2498. -g switch.
  2499.  
  2500. @item -moptimize-arg-area
  2501. @itemx -mno-optimize-arg-area
  2502. @kindex -moptimize-arg-area
  2503. @kindex -mno-optimize-arg-area
  2504. @cindex arguments in frame (88k)
  2505. Control how to store function arguments in stack frames.
  2506. @samp{-moptimize-arg-area} saves space, but conflicts with the 88open
  2507. specifications.  However, @samp{-mno-optimize-arg-area} conforms to the
  2508. 88open standards.  By default GNU CC does not optimize the argument
  2509. area.
  2510.  
  2511. @item -mshort-data-@var{num}
  2512. @kindex -mshort-data-@var{num}
  2513. @cindex smaller data references (88k)
  2514. @cindex r0-relative references (88k)
  2515. Generate smaller data references by making them relative to @code{r0},
  2516. which allows loading a value using a single instruction (rather than the
  2517. usual two).  You control which data references are affected by
  2518. specifying @var{num} with this option.  For example, if you specify
  2519. @samp{-mshort-data-512}, then the data references affected are those
  2520. involving displacements of less than 512 bytes.
  2521. @samp{-mshort-data-@var{num}} is not effective for @var{num} greater
  2522. than 64K.
  2523.  
  2524. @item -mserialize-volatile
  2525. @kindex -mserialize-volatile
  2526. @itemx -mno-serialize-volatile
  2527. @kindex -mno-serialize-volatile
  2528. @cindex sequential consistency on 88k
  2529. Do, or do not, generate code to guarantee sequential consistency of
  2530. volatile memory references.
  2531.  
  2532. GNU CC always guarantees consistency by default, for the preferred
  2533. processor submodel.  How this is done depends on the submodel.
  2534.  
  2535. The m88100 processor does not reorder memory references and so always
  2536. provides sequential consistency.  If you use @samp{-m88100}, GNU CC does
  2537. not generate any special instructions for sequential consistency.
  2538.  
  2539. The order of memory references made by the m88110 processor does not
  2540. always match the order of the instructions requesting those references.
  2541. In particular, a load instruction may execute before a preceding store
  2542. instruction.  Such reordering violates sequential consistency of
  2543. volatile memory references, when there are multiple processors.  When
  2544. you use @samp{-m88000} or @samp{-m88110}, GNU CC generates special
  2545. instructions when appropriate, to force execution in the proper order.
  2546.  
  2547. The extra code generated to guarantee consistency may affect the
  2548. performance of your application.  If you know that you can safely forgo
  2549. this guarantee, you may use the option @samp{-mno-serialize-volatile}.
  2550.  
  2551. If you use the @samp{-m88100} option but require sequential consistency
  2552. when running on the m88110 processor, you should use
  2553. @samp{-mserialize-volatile}.
  2554.  
  2555. @item -msvr4
  2556. @itemx -msvr3
  2557. @kindex -msvr4
  2558. @kindex -msvr3
  2559. @cindex assembler syntax, 88k
  2560. @cindex SVr4
  2561. Turn on (@samp{-msvr4}) or off (@samp{-msvr3}) compiler extensions
  2562. related to System V release 4 (SVr4).  This controls the following:
  2563.  
  2564. @enumerate
  2565. @item 
  2566. Which variant of the assembler syntax to emit (which you can select
  2567. independently using @samp{-mversion-03.00}).  
  2568. @item
  2569. @samp{-msvr4} makes the C preprocessor recognize @samp{#pragma weak}
  2570. that is used on System V release 4.
  2571. @item
  2572. @samp{-msvr4} makes GNU CC issue additional declaration directives used in
  2573. SVr4.  
  2574. @end enumerate
  2575.  
  2576. @samp{-msvr3} is the default for all m88K configurations except
  2577. the SVr4 configuration.
  2578.  
  2579. @item -mversion-03.00
  2580. @kindex -mversion-03.00
  2581. In the DG/UX configuration, there are two flavors of SVr4.  This option
  2582. modifies @samp{-msvr4} to select whether the hybrid-COFF or real-ELF
  2583. flavor is used.  All other configurations ignore this option.
  2584. @c ??? which asm syntax better for GAS?  option there too?
  2585.  
  2586. @item -mno-check-zero-division
  2587. @itemx -mcheck-zero-division
  2588. @kindex -mno-check-zero-division
  2589. @kindex -mcheck-zero-division
  2590. @cindex zero division on 88k
  2591. Early models of the 88K architecture had problems with division by zero;
  2592. in particular, many of them didn't trap.  Use these options to avoid
  2593. including (or to include explicitly) additional code to detect division
  2594. by zero and signal an exception.  All GNU CC configurations for the 88K use
  2595. @samp{-mcheck-zero-division} by default.
  2596.  
  2597. @item -muse-div-instruction
  2598. @kindex -muse-div-instruction
  2599. @cindex divide instruction, 88k
  2600. Do not emit code to check both the divisor and dividend when doing
  2601. signed integer division to see if either is negative, and adjust the
  2602. signs so the divide is done using non-negative numbers.  Instead, rely
  2603. on the operating system to calculate the correct value when the
  2604. @code{div} instruction traps.  This results in different behavior when
  2605. the most negative number is divided by -1, but is useful when most or
  2606. all signed integer divisions are done with positive numbers.
  2607.  
  2608. @item -mtrap-large-shift
  2609. @itemx -mhandle-large-shift
  2610. @kindex -mtrap-large-shift
  2611. @kindex -mhandle-large-shift
  2612. @cindex bit shift overflow (88k)
  2613. @cindex large bit shifts (88k)
  2614. Include code to detect bit-shifts of more than 31 bits; respectively,
  2615. trap such shifts or emit code to handle them properly.  By default GNU CC
  2616. makes no special provision for large bit shifts.
  2617.  
  2618. @item -mwarn-passed-structs
  2619. @kindex -mwarn-passed-structs
  2620. @cindex structure passing (88k)
  2621. Warn when a function passes a struct as an argument or result.
  2622. Structure-passing conventions have changed during the evolution of the C
  2623. language, and are often the source of portability problems.  By default,
  2624. GNU CC issues no such warning.
  2625. @end table
  2626.  
  2627. @node RS/6000 Options
  2628. @subsection IBM RS/6000 Options
  2629. @cindex RS/6000 Options
  2630. @cindex IBM RS/6000 Options
  2631.  
  2632. Only one pair of @samp{-m} options is defined for the IBM RS/6000:
  2633.  
  2634. @table @code
  2635. @item -mfp-in-toc
  2636. @itemx -mno-fp-in-toc
  2637. Control whether or not floating-point constants go in the Table of
  2638. Contents (TOC), a table of all global variable and function addresses.  By
  2639. default GNU CC puts floating-point constants there; if the TOC overflows,
  2640. @samp{-mno-fp-in-toc} will reduce the size of the TOC, which may avoid
  2641. the overflow.
  2642. @end table
  2643.  
  2644. @node RT Options
  2645. @subsection IBM RT Options
  2646. @cindex RT options
  2647. @cindex IBM RT options
  2648.  
  2649. These @samp{-m} options are defined for the IBM RT PC:
  2650.  
  2651. @table @code
  2652. @item -min-line-mul
  2653. Use an in-line code sequence for integer multiplies.  This is the
  2654. default.
  2655.  
  2656. @item -mcall-lib-mul
  2657. Call @code{lmul$$} for integer multiples.
  2658.  
  2659. @item -mfull-fp-blocks
  2660. Generate full-size floating point data blocks, including the minimum
  2661. amount of scratch space recommended by IBM.  This is the default.
  2662.  
  2663. @item -mminimum-fp-blocks
  2664. Do not include extra scratch space in floating point data blocks.  This
  2665. results in smaller code, but slower execution, since scratch space must
  2666. be allocated dynamically.
  2667.  
  2668. @cindex @file{varargs.h} and RT PC
  2669. @cindex @file{stdarg.h} and RT PC
  2670. @item -mfp-arg-in-fpregs
  2671. Use a calling sequence incompatible with the IBM calling convention in
  2672. which floating point arguments are passed in floating point registers.
  2673. Note that @code{varargs.h} and @code{stdargs.h} will not work with
  2674. floating point operands if this option is specified.
  2675.  
  2676. @item -mfp-arg-in-gregs
  2677. Use the normal calling convention for floating point arguments.  This is
  2678. the default.
  2679.  
  2680. @item -mhc-struct-return
  2681. Return structures of more than one word in memory, rather than in a
  2682. register.  This provides compatibility with the MetaWare HighC (hc)
  2683. compiler.  Use @samp{-fpcc-struct-return} for compatibility with the
  2684. Portable C Compiler (pcc).
  2685.  
  2686. @item -mnohc-struct-return
  2687. Return some structures of more than one word in registers, when
  2688. convenient.  This is the default.  For compatibility with the
  2689. IBM-supplied compilers, use either @samp{-fpcc-struct-return} or
  2690. @samp{-mhc-struct-return}.
  2691. @end table
  2692.  
  2693. @node MIPS Options
  2694. @subsection MIPS Options
  2695. @cindex MIPS options
  2696.  
  2697. These @samp{-m} options are defined for the MIPS family of computers:
  2698.  
  2699. @table @code
  2700. @item -mcpu=@var{cpu type}
  2701. Assume the defaults for the machine type @var{cpu type} when
  2702. scheduling instructions.  The default @var{cpu type} is
  2703. @samp{default}, which picks the longest cycles times for any of the
  2704. machines, in order that the code run at reasonable rates on all MIPS
  2705. cpu's.  Other choices for @var{cpu type} are @samp{r2000},
  2706. @samp{r3000}, @samp{r4000}, and @samp{r6000}.  While picking a
  2707. specific @var{cpu type} will schedule things appropriately for that
  2708. particular chip, the compiler will not generate any code that does not
  2709. meet level 1 of the MIPS ISA (instruction set architecture) without
  2710. the @samp{-mips2} or @samp{-mips3} switches being used.
  2711.  
  2712. @item -mips2
  2713. Issue instructions from level 2 of the MIPS ISA (branch likely, square
  2714. root instructions).  The @samp{-mcpu=r4000} or @samp{-mcpu=r6000}
  2715. switch must be used in conjunction with @samp{-mips2}.
  2716.  
  2717. @item -mips3
  2718. Issue instructions from level 3 of the MIPS ISA (64 bit instructions).
  2719. You must use the @samp{-mcpu=r4000} switch along with @samp{-mips3}.
  2720.  
  2721. @item -mint64
  2722. @item -mlong64
  2723. @item -mlonglong128
  2724. These options don't work at present.
  2725.  
  2726. @item -mmips-as
  2727. Generate code for the MIPS assembler, and invoke @file{mips-tfile} to
  2728. add normal debug information.  This is the default for all
  2729. platforms except for the OSF/1 reference platform, using the OSF/rose
  2730. object format.  If the either of the @samp{-gstabs} or @samp{-gstabs+}
  2731. switches are used, the @file{mips-tfile} program will encapsulate the
  2732. stabs within MIPS ECOFF.
  2733.  
  2734. @item -mgas
  2735. Generate code for the GNU assembler.  This is the default on the OSF/1
  2736. reference platform, using the OSF/rose object format.
  2737.  
  2738. @item -mrnames
  2739. @itemx -mno-rnames
  2740. The @samp{-mrnames} switch says to output code using the MIPS software
  2741. names for the registers, instead of the hardware names (ie, @var{a0}
  2742. instead of @var{$4}).  The GNU assembler does not support the
  2743. @samp{-mrnames} switch, and the MIPS assembler will be instructed to
  2744. run the MIPS C preprocessor over the source file.  The
  2745. @samp{-mno-rnames} switch is default.
  2746.  
  2747. @item -mgpopt
  2748. @itemx -mno-gpopt
  2749. The @samp{-mgpopt} switch says to write all of the data declarations
  2750. before the instructions in the text section, this allows the MIPS
  2751. assembler to generate one word memory references instead of using two
  2752. words for short global or static data items.  This is on by default if
  2753. optimization is selected.
  2754.  
  2755. @item -mstats
  2756. @itemx -mno-stats
  2757. For each non-inline function processed, the @samp{-mstats} switch
  2758. causes the compiler to emit one line to the standard error file to
  2759. print statistics about the program (number of registers saved, stack
  2760. size, etc.).
  2761.  
  2762. @item -mmemcpy
  2763. @itemx -mno-memcpy
  2764. The @samp{-mmemcpy} switch makes all block moves call the appropriate
  2765. string function (@samp{memcpy} or @samp{bcopy}) instead of possibly
  2766. generating inline code.
  2767.  
  2768. @item -mmips-tfile
  2769. @itemx -mno-mips-tfile
  2770. The @samp{-mno-mips-tfile} switch causes the compiler not
  2771. postprocess the object file with the @file{mips-tfile} program,
  2772. after the MIPS assembler has generated it to add debug support.  If
  2773. @file{mips-tfile} is not run, then no local variables will be
  2774. available to the debugger.  In addition, @file{stage2} and
  2775. @file{stage3} objects will have the temporary file names passed to the
  2776. assembler embedded in the object file, which means the objects will
  2777. not compare the same.  The @samp{-mno-mips-tfile} switch should only
  2778. be used when there are bugs in the @file{mips-tfile} program that
  2779. prevents compilation.
  2780.  
  2781. @item -msoft-float
  2782. Generate output containing library calls for floating point.
  2783. @strong{Warning:} the requisite libraries are not part of GNU CC.
  2784. Normally the facilities of the machine's usual C compiler are used, but
  2785. this can't be done directly in cross-compilation.  You must make your
  2786. own arrangements to provide suitable library functions for
  2787. cross-compilation.
  2788.  
  2789. @item -mhard-float
  2790. Generate output containing floating point instructions.  This is the
  2791. default if you use the unmodified sources.
  2792.  
  2793. @item -mfp64
  2794. Assume that the @var{FR} bit in the status word is on, and that there
  2795. are 32 64-bit floating point registers, instead of 32 32-bit floating
  2796. point registers.  You must also specify the @samp{-mcpu=r4000} and
  2797. @samp{-mips3} switches.
  2798.  
  2799. @item -mfp32
  2800. Assume that there are 32 32-bit floating point registers.  This is the
  2801. default.
  2802.  
  2803. @item -mabicalls
  2804. @itemx -mno-abicalls
  2805. Emit (or do not emit) the @samp{.abicalls}, @samp{.cpload}, and
  2806. @samp{.cprestore} pseudo operations that some System V.4 ports use for
  2807. position independent code.
  2808.  
  2809. @item -mlong-calls
  2810. @itemx -mlong-calls
  2811. Do all calls with the @samp{JALR} instruction, which requires
  2812. loading up a function's address into a register before the call.
  2813. You need to use this switch, if you call outside of the current
  2814. 512 megabyte segment to functions that are not through pointers.
  2815.  
  2816. @item -mhalf-pic
  2817. @itemx -mno-half-pic
  2818. Put pointers to extern references into the data section and load them
  2819. up, rather than put the references in the text section.
  2820.  
  2821. @item -G @var{num}
  2822. @cindex smaller data references (MIPS)
  2823. @cindex gp-relative references (MIPS)
  2824. Put global and static items less than or equal to @var{num} bytes into
  2825. the small data or bss sections instead of the normal data or bss
  2826. section.  This allows the assembler to emit one word memory reference
  2827. instructions based on the global pointer (@var{gp} or @var{$28}),
  2828. instead of the normal two words used.  By default, @var{num} is 8 when
  2829. the MIPS assembler is used, and 0 when the GNU assembler is used.  The
  2830. @samp{-G @var{num}} switch is also passed to the assembler and linker.
  2831. All modules should be compiled with the same @samp{-G @var{num}}
  2832. value.
  2833.  
  2834. @item -nocpp
  2835. Tell the MIPS assembler to not run it's preprocessor over user
  2836. assembler files (with a @samp{.s} suffix) when assembling them.
  2837. @end table
  2838.  
  2839. @ifset INTERNALS
  2840. These options are defined by the macro
  2841. @code{TARGET_SWITCHES} in the machine description.  The default for the
  2842. options is also defined by that macro, which enables you to change the
  2843. defaults.
  2844. @end ifset
  2845.  
  2846. @node i386 Options
  2847. @subsection Intel 386 Options
  2848. @cindex i386 Options
  2849. @cindex Intel 386 Options
  2850.  
  2851. These @samp{-m} options are defined for the i386 family of computers:
  2852.  
  2853. @table @code
  2854. @item -m486
  2855. @itemx -mno-486
  2856. Control whether or not code is optimized for a 486 instead of an
  2857. 386.  Code generated for an 486 will run on a 386 and vice versa.
  2858.  
  2859. @item -msoft-float
  2860. Generate output containing library calls for floating point.
  2861. @strong{Warning:} the requisite libraries are not part of GNU CC.
  2862. Normally the facilities of the machine's usual C compiler are used, but
  2863. this can't be done directly in cross-compilation.  You must make your
  2864. own arrangements to provide suitable library functions for
  2865. cross-compilation.
  2866.  
  2867. On machines where a function returns floating point results in the 80387
  2868. register stack, some floating point opcodes may be emitted even if
  2869. @samp{-msoft-float} is used.
  2870.  
  2871. @item -mno-fp-ret-in-387
  2872. Do not use the FPU registers for return values of functions.
  2873.  
  2874. The usual calling convention has functions return values of types
  2875. @code{float} and @code{double} in an FPU register, even if there
  2876. is no FPU.  The idea is that the operating system should emulate
  2877. an FPU.
  2878.  
  2879. The option @samp{-mno-fp-ret-in-387} causes such values to be returned
  2880. in ordinary CPU registers instead.
  2881. @c FIXME!! What about these options listed in @node Option Summary ??
  2882. @c -msvr3-shlib -mieee-fp
  2883. @end table
  2884.  
  2885. @node HPPA Options
  2886. @subsection HPPA Options
  2887. @cindex HPPA Options
  2888.  
  2889. These @samp{-m} options are defined for the HPPA family of computers:
  2890.  
  2891. @table @code
  2892. @item -mpa-risc-1-0
  2893. Generate code for a PA 1.0 processor.
  2894.  
  2895. @item -mpa-risc-1-1
  2896. Generate code for a PA 1.1 processor.
  2897.  
  2898. @item -mkernel
  2899. Generate code which is suitable for use in kernels.  Specifically, avoid
  2900. @code{add} instructions in which one of the arguments is the DP register;
  2901. generate @code{addil} instructions instead.  This avoids a rather serious
  2902. bug in the HP-UX linker.
  2903.  
  2904. @item -mshared-libs
  2905. Generate code that can be linked against HP-UX shared libraries.  This option
  2906. is not fully function yet, and is not on by default for any PA target.  Using
  2907. this option can cause incorrect code to be generated by the compiler.
  2908.  
  2909. @item -mno-shared-libs
  2910. Don't generate code that will be linked against shared libraries.  This is
  2911. the default for all PA targets.
  2912.  
  2913. @item -mlong-calls
  2914. Generate code which allows calls to functions greater than 256K away from
  2915. the caller when the caller and callee are in the same source file.  Do
  2916. not turn this option on unless code refuses to link with "branch out of
  2917. range errors" from the linker.
  2918.  
  2919. @item -mdisable-fpregs
  2920. Prevent floating point registers from being used in any manner.  This is
  2921. necessary for compiling kernels which perform lazy context switching of
  2922. floating point registers.  If you use this option and attempt to perform
  2923. floating point operations, the compiler will abort.
  2924.  
  2925. @item -mdisable-indexing
  2926. Prevent the compiler from using indexing address modes.  This avoids some
  2927. rather obscure problems when compiling MIG generated code under MACH.
  2928.  
  2929. @item -mtrailing-colon
  2930. Add a colon to the end of label definitions (for ELF assemblers).
  2931. @end table
  2932.  
  2933. @node Intel 960 Options
  2934. @subsection Intel 960 Options
  2935.  
  2936. These @samp{-m} options are defined for the Intel 960 implementations:
  2937.  
  2938. @table @code
  2939. @item -m@var{cpu type}
  2940. Assume the defaults for the machine type @var{cpu type} for some of
  2941. the other options, including instruction scheduling, floating point
  2942. support, and addressing modes.  The choices for @var{cpu type} are
  2943. @samp{ka}, @samp{kb}, @samp{mc}, @samp{ca}, @samp{cf},
  2944. @samp{sa}, and @samp{sb}.
  2945. The default is
  2946. @samp{kb}.
  2947.  
  2948. @item -mnumerics
  2949. @itemx -msoft-float
  2950. The @samp{-mnumerics} option indicates that the processor does support
  2951. floating-point instructions.  The @samp{-msoft-float} option indicates
  2952. that floating-point support should not be assumed.
  2953.  
  2954. @item -mleaf-procedures
  2955. @itemx -mno-leaf-procedures
  2956. Do (or do not) attempt to alter leaf procedures to be callable with the
  2957. @code{bal} instruction as well as @code{call}.  This will result in more
  2958. efficient code for explicit calls when the @code{bal} instruction can be
  2959. substituted by the assembler or linker, but less efficient code in other
  2960. cases, such as calls via function pointers, or using a linker that doesn't
  2961. support this optimization.
  2962.  
  2963. @item -mtail-call
  2964. @itemx -mno-tail-call
  2965. Do (or do not) make additional attempts (beyond those of the
  2966. machine-independent portions of the compiler) to optimize tail-recursive
  2967. calls into branches.  You may not want to do this because the detection of
  2968. cases where this is not valid is not totally complete.  The default is
  2969. @samp{-mno-tail-call}.
  2970.  
  2971. @item -mcomplex-addr
  2972. @itemx -mno-complex-addr
  2973. Assume (or do not assume) that the use of a complex addressing mode is a
  2974. win on this implementation of the i960.  Complex addressing modes may not
  2975. be worthwhile on the K-series, but they definitely are on the C-series.
  2976. The default is currently @samp{-mcomplex-addr} for all processors except
  2977. the CB and CC.
  2978.  
  2979. @item -mcode-align
  2980. @itemx -mno-code-align
  2981. Align code to 8-byte boundaries for faster fetching (or don't bother).
  2982. Currently turned on by default for C-series implementations only.
  2983.  
  2984. @ignore
  2985. @item -mclean-linkage
  2986. @itemx -mno-clean-linkage
  2987. These options are not fully implemented.
  2988. @end ignore
  2989.  
  2990. @item -mic-compat
  2991. @itemx -mic2.0-compat
  2992. @itemx -mic3.0-compat
  2993. Enable compatibility with iC960 v2.0 or v3.0.
  2994.  
  2995. @item -masm-compat
  2996. @itemx -mintel-asm
  2997. Enable compatibility with the iC960 assembler.
  2998.  
  2999. @item -mstrict-align
  3000. @itemx -mno-strict-align
  3001. Do not permit (do permit) unaligned accesses.
  3002.  
  3003. @item -mold-align
  3004. Enable structure-alignment compatibility with Intel's gcc release version
  3005. 1.3 (based on gcc 1.37).  Currently this is buggy in that @samp{#pragma
  3006. align 1} is always assumed as well, and cannot be turned off.
  3007. @end table
  3008.  
  3009. @node DEC Alpha Options
  3010. @subsection DEC Alpha Options
  3011.  
  3012. These @samp{-m} options are defined for the DEC Alpha implementations:
  3013.  
  3014. @table @code
  3015. @item -mno-soft-float
  3016. @itemx -msoft-float
  3017. Use (do not use) the hardware floating-point instructions for
  3018. floating-point operations.  When @code{-msoft-float} is specified,
  3019. functions in @file{libgcc1.c} will be used to perform floating-point
  3020. operations.  Unless they are replaced by routines that emulate the
  3021. floating-point operations, or compiled in such a way as to call such
  3022. emulations routines, these routines will issue floating-point
  3023. operations.   If you are compiling for an Alpha without floating-point
  3024. operations, you must ensure that the library is built so as not to call
  3025. them.
  3026.  
  3027. Note that Alpha implementations without floating-point operations are
  3028. required to have floating-point registers.
  3029.  
  3030. @item -mfp-reg
  3031. @itemx -mno-fp-regs
  3032. Generate code that uses (does not use) the floating-point register set.
  3033. @code{-mno-fp-regs} implies @code{-msoft-float}.  If the floating-point
  3034. register set is not used, floating point operands are passed in integer
  3035. registers as if they were integers and floating-point results are passed
  3036. in $0 instead of $f0.  This is a non-standard calling sequence, so any
  3037. function with a floating-point argument or return value called by code
  3038. compiled with @code{-mno-fp-regs} must also be compiled with that
  3039. option.
  3040.  
  3041. A typical use of this option is building a kernel that does not use,
  3042. and hence need not save and restore, any floating-point registers.
  3043. @end table
  3044.  
  3045. @node System V Options
  3046. @subsection Options for System V
  3047.  
  3048. These additional options are available on System V Release 4 for
  3049. compatibility with other compilers on those systems:
  3050.  
  3051. @table @code
  3052. @ignore
  3053. This should say *what the option does* and only then say
  3054. "For compatibility only..."
  3055. @item -G
  3056. On SVr4 systems, @code{gcc} accepts the option @samp{-G} (and passes
  3057. it to the system linker), for compatibility with other compilers.
  3058. However, we suggest you use @samp{-symbolic} or @samp{-shared} as
  3059. appropriate, instead of supplying linker options on the @code{gcc}
  3060. command line.
  3061. @end ignore
  3062.  
  3063. @item -Qy
  3064. Identify the versions of each tool used by the compiler, in a
  3065. @code{.ident} assembler directive in the output.
  3066.  
  3067. @item -Qn
  3068. Refrain from adding @code{.ident} directives to the output file (this is
  3069. the default).
  3070.  
  3071. @item -YP,@var{dirs}
  3072. Search the directories @var{dirs}, and no others, for libraries
  3073. specified with @samp{-l}.
  3074.  
  3075. @item -Ym,@var{dir}
  3076. Look in the directory @var{dir} to find the M4 preprocessor.
  3077. The assembler uses this option.
  3078. @c This is supposed to go with a -Yd for predefined M4 macro files, but 
  3079. @c the generic assembler that comes with Solaris takes just -Ym.
  3080. @end table
  3081.  
  3082. @node Code Gen Options
  3083. @section Options for Code Generation Conventions
  3084. @cindex code generation conventions
  3085. @cindex options, code generation 
  3086. @cindex run-time options
  3087.  
  3088. These machine-independent options control the interface conventions
  3089. used in code generation.
  3090.  
  3091. Most of them have both positive and negative forms; the negative form
  3092. of @samp{-ffoo} would be @samp{-fno-foo}.  In the table below, only
  3093. one of the forms is listed---the one which is not the default.  You
  3094. can figure out the other form by either removing @samp{no-} or adding
  3095. it.
  3096.  
  3097. @table @code
  3098. @item -fpcc-struct-return
  3099. Return ``short'' @code{struct} and @code{union} values in memory like
  3100. longer ones, rather than in registers.  This convention is less
  3101. efficient, but it has the advantage of allowing intercallability between
  3102. GNU CC-compiled files and files compiled with other compilers.
  3103.  
  3104. The precise convention for returning structures in memory depends
  3105. on the target configuration macros.
  3106.  
  3107. Short structures and unions are those whose size and alignment match
  3108. that of some integer type.
  3109.  
  3110. @item -freg-struct-return
  3111. Use the convention that @code{struct} and @code{union} values are
  3112. returned in registers when possible.  This is more efficient for small
  3113. structures than @samp{-fpcc-struct-return}.
  3114.  
  3115. If you specify neither the option @samp{-fpcc-struct-return} nor the
  3116. option @samp{-freg-struct-return}, GNU CC defaults to whichever
  3117. convention is standard for the target.  If there is no standard
  3118. convention, GNU CC defaults to @samp{-fpcc-struct-return}, except on
  3119. targets where GNU CC is the principal compile.  In those cases, we can
  3120. choose the standard, and we chose the more efficient register return
  3121. alternative.
  3122.  
  3123. @item -fshort-enums
  3124. Allocate to an @code{enum} type only as many bytes as it needs for the
  3125. declared range of possible values.  Specifically, the @code{enum} type
  3126. will be equivalent to the smallest integer type which has enough room.
  3127.  
  3128. @item -fshort-double
  3129. Use the same size for @code{double} as for @code{float}.
  3130.  
  3131. @item -fshared-data
  3132. Requests that the data and non-@code{const} variables of this
  3133. compilation be shared data rather than private data.  The distinction
  3134. makes sense only on certain operating systems, where shared data is
  3135. shared between processes running the same program, while private data
  3136. exists in one copy per process.
  3137.  
  3138. @item -fno-common
  3139. Allocate even uninitialized global variables in the bss section of the
  3140. object file, rather than generating them as common blocks.  This has the
  3141. effect that if the same variable is declared (without @code{extern}) in
  3142. two different compilations, you will get an error when you link them.
  3143. The only reason this might be useful is if you wish to verify that the
  3144. program will work on other systems which always work this way.
  3145.  
  3146. @item -fno-ident
  3147. Ignore the @samp{#ident} directive.
  3148.  
  3149. @item -fno-gnu-linker
  3150. Do not output global initializations (such as C++ constructors and
  3151. destructors) in the form used by the GNU linker (on systems where the GNU
  3152. linker is the standard method of handling them).  Use this option when
  3153. you want to use a non-GNU linker, which also requires using the
  3154. @code{collect2} program to make sure the system linker includes
  3155. constructors and destructors.  (@code{collect2} is included in the GNU CC
  3156. distribution.)  For systems which @emph{must} use @code{collect2}, the
  3157. compiler driver @code{gcc} is configured to do this automatically.
  3158.  
  3159. @item -finhibit-size-directive
  3160. Don't output a @code{.size} assembler directive, or anything else that
  3161. would cause trouble if the function is split in the middle, and the 
  3162. two halves are placed at locations far apart in memory.  This option is
  3163. used when compiling @file{crtstuff.c}; you should not need to use it
  3164. for anything else.
  3165.  
  3166. @item -fverbose-asm
  3167. Put extra commentary information in the generated assembly code to
  3168. make it more readable.  This option is generally only of use to those
  3169. who actually need to read the generated assembly code (perhaps while
  3170. debugging the compiler itself).
  3171.  
  3172. @item -fvolatile
  3173. Consider all memory references through pointers to be volatile.
  3174.  
  3175. @item -fvolatile-global
  3176. Consider all memory references to extern and global data items to
  3177. be volatile.
  3178.  
  3179. @item -fpic
  3180. @cindex global offset table
  3181. @cindex PIC
  3182. If supported for the target machine, generate position-independent code
  3183. (PIC) suitable for use in a shared library.  All addresses will be
  3184. accessed through a global offset table (GOT).  If the GOT size for the
  3185. linked executable exceeds a machine-specific maximum size, you will get
  3186. an error message from the linker indicating that @samp{-fpic} does not
  3187. work; recompile with @samp{-fPIC} instead.  (These maximums are 16k on
  3188. the m88k, 8k on the Sparc, and 32k on the m68k and RS/6000.  The 386 has
  3189. no such limit.)
  3190.  
  3191. Position-independent code requires special support, and therefore works
  3192. only on certain machines.  For the 386, GNU CC supports PIC for System V
  3193. but not for the Sun 386i.  Code generated for the IBM RS/6000 is always
  3194. position-independent.
  3195.  
  3196. The GNU assembler does not fully support PIC.  Currently, you must use
  3197. some other assembler in order for PIC to work.  We would welcome
  3198. volunteers to upgrade GAS to handle this; the first part of the job is
  3199. to figure out what the assembler must do differently.
  3200.  
  3201. @item -fPIC
  3202. If supported for the target machine, emit position-independent code,
  3203. suitable for dynamic linking and avoiding any limit on the size of the
  3204. global offset table.  This option makes a difference on the m68k, m88k
  3205. and the Sparc.
  3206.  
  3207. Position-independent code requires special support, and therefore works
  3208. only on certain machines.
  3209.  
  3210. @item -ffixed-@var{reg}
  3211. Treat the register named @var{reg} as a fixed register; generated code
  3212. should never refer to it (except perhaps as a stack pointer, frame
  3213. pointer or in some other fixed role).
  3214.  
  3215. @var{reg} must be the name of a register.  The register names accepted
  3216. are machine-specific and are defined in the @code{REGISTER_NAMES}
  3217. macro in the machine description macro file.
  3218.  
  3219. This flag does not have a negative form, because it specifies a
  3220. three-way choice.
  3221.  
  3222. @item -fcall-used-@var{reg}
  3223. Treat the register named @var{reg} as an allocatable register that is
  3224. clobbered by function calls.  It may be allocated for temporaries or
  3225. variables that do not live across a call.  Functions compiled this way
  3226. will not save and restore the register @var{reg}.
  3227.  
  3228. Use of this flag for a register that has a fixed pervasive role in the
  3229. machine's execution model, such as the stack pointer or frame pointer,
  3230. will produce disastrous results.
  3231.  
  3232. This flag does not have a negative form, because it specifies a
  3233. three-way choice.
  3234.  
  3235. @item -fcall-saved-@var{reg}
  3236. Treat the register named @var{reg} as an allocatable register saved by
  3237. functions.  It may be allocated even for temporaries or variables that
  3238. live across a call.  Functions compiled this way will save and restore
  3239. the register @var{reg} if they use it.
  3240.  
  3241. Use of this flag for a register that has a fixed pervasive role in the
  3242. machine's execution model, such as the stack pointer or frame pointer,
  3243. will produce disastrous results.
  3244.  
  3245. A different sort of disaster will result from the use of this flag for
  3246. a register in which function values may be returned.
  3247.  
  3248. This flag does not have a negative form, because it specifies a
  3249. three-way choice.
  3250.  
  3251. @item +e0
  3252. @itemx +e1
  3253. Control whether virtual function definitions in classes are used to
  3254. generate code, or only to define interfaces for their callers.  (C++
  3255. only).
  3256.  
  3257. These options are provided for compatibility with @code{cfront} 1.x
  3258. usage; the recommended alternative GNU C++ usage is in flux.  @xref{C++
  3259. Interface,,Declarations and Definitions in One Header}.
  3260.  
  3261. With @samp{+e0}, virtual function definitions in classes are declared
  3262. @code{extern}; the declaration is used only as an interface
  3263. specification, not to generate code for the virtual functions (in this
  3264. compilation).
  3265.  
  3266. With @samp{+e1}, G++ actually generates the code implementing virtual
  3267. functions defined in the code, and makes them publicly visible.
  3268. @end table
  3269.  
  3270. @node Environment Variables
  3271. @section Environment Variables Affecting GNU CC
  3272. @cindex environment variables
  3273.  
  3274. This section describes several environment variables that affect how GNU
  3275. CC operates.  They work by specifying directories or prefixes to use
  3276. when searching for various kinds of files.
  3277.  
  3278. @ifclear INTERNALS
  3279. Note that you can also specify places to search using options such as
  3280. @samp{-B}, @samp{-I} and @samp{-L} (@pxref{Directory Options}).  These
  3281. take precedence over places specified using environment variables, which
  3282. in turn take precedence over those specified by the configuration of GNU
  3283. CC. 
  3284. @end ifclear
  3285. @ifset INTERNALS
  3286. Note that you can also specify places to search using options such as
  3287. @samp{-B}, @samp{-I} and @samp{-L} (@pxref{Directory Options}).  These
  3288. take precedence over places specified using environment variables, which
  3289. in turn take precedence over those specified by the configuration of GNU
  3290. CC.  @xref{Driver}.
  3291. @end ifset
  3292.  
  3293. @table @code
  3294. @item TMPDIR
  3295. @findex TMPDIR
  3296. If @code{TMPDIR} is set, it specifies the directory to use for temporary
  3297. files.  GNU CC uses temporary files to hold the output of one stage of
  3298. compilation which is to be used as input to the next stage: for example,
  3299. the output of the preprocessor, which is the input to the compiler
  3300. proper.
  3301.  
  3302. @item GCC_EXEC_PREFIX
  3303. @findex GCC_EXEC_PREFIX
  3304. If @code{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
  3305. names of the subprograms executed by the compiler.  No slash is added
  3306. when this prefix is combined with the name of a subprogram, but you can
  3307. specify a prefix that ends with a slash if you wish.
  3308.  
  3309. If GNU CC cannot find the subprogram using the specified prefix, it
  3310. tries looking in the usual places for the subprogram.
  3311.  
  3312. Other prefixes specified with @samp{-B} take precedence over this prefix.
  3313.  
  3314. This prefix is also used for finding files such as @file{crt0.o} that are
  3315. used for linking.
  3316.  
  3317. In addition, the prefix is used in an unusual way in finding the
  3318. directories to search for header files.  For each of the standard
  3319. directories whose name normally begins with @samp{/usr/local/lib/gcc-lib}
  3320. (more precisely, with the value of @code{GCC_INCLUDE_DIR}), GNU CC tries
  3321. replacing that beginning with the specified prefix to produce an
  3322. alternate directory name.  Thus, with @samp{-Bfoo/}, GNU CC will search
  3323. @file{foo/bar} where it would normally search @file{/usr/local/lib/bar}.
  3324. These alternate directories are searched first; the standard directories
  3325. come next.
  3326.  
  3327. @item COMPILER_PATH
  3328. @findex COMPILER_PATH
  3329. The value of @code{COMPILER_PATH} is a colon-separated list of
  3330. directories, much like @code{PATH}.  GNU CC tries the directories thus
  3331. specified when searching for subprograms, if it can't find the
  3332. subprograms using @code{GCC_EXEC_PREFIX}.
  3333.  
  3334. @item LIBRARY_PATH
  3335. @findex LIBRARY_PATH
  3336. The value of @code{LIBRARY_PATH} is a colon-separated list of
  3337. directories, much like @code{PATH}.  GNU CC tries the directories thus
  3338. specified when searching for special linker files, if it can't find them
  3339. using @code{GCC_EXEC_PREFIX}.  Linking using GNU CC also uses these
  3340. directories when searching for ordinary libraries for the @samp{-l}
  3341. option (but directories specified with @samp{-L} come first).
  3342.  
  3343. @item C_INCLUDE_PATH
  3344. @itemx CPLUS_INCLUDE_PATH
  3345. @itemx OBJC_INCLUDE_PATH
  3346. @findex C_INCLUDE_PATH
  3347. @findex CPLUS_INCLUDE_PATH
  3348. @findex OBJC_INCLUDE_PATH
  3349. @c @itemx OBJCPLUS_INCLUDE_PATH
  3350. These environment variables pertain to particular languages.  Each
  3351. variable's value is a colon-separated list of directories, much like
  3352. @code{PATH}.  When GNU CC searches for header files, it tries the
  3353. directories listed in the variable for the language you are using, after
  3354. the directories specified with @samp{-I} but before the standard header
  3355. file directories.
  3356.  
  3357. @item DEPENDENCIES_OUTPUT
  3358. @findex DEPENDENCIES_OUTPUT
  3359. @cindex dependencies for make as output 
  3360. If this variable is set, its value specifies how to output dependencies
  3361. for Make based on the header files processed by the compiler.  This
  3362. output looks much like the output from the @samp{-M} option
  3363. (@pxref{Preprocessor Options}), but it goes to a separate file, and is
  3364. in addition to the usual results of compilation.
  3365.  
  3366. The value of @code{DEPENDENCIES_OUTPUT} can be just a file name, in
  3367. which case the Make rules are written to that file, guessing the target
  3368. name from the source file name.  Or the value can have the form
  3369. @samp{@var{file} @var{target}}, in which case the rules are written to
  3370. file @var{file} using @var{target} as the target name.
  3371. @end table
  3372.  
  3373. @node Running Protoize
  3374. @section Running Protoize
  3375.  
  3376. The program @code{protoize} is an optional part of GNU C.  You can use
  3377. it to add prototypes to a program, thus converting the program to ANSI
  3378. C in one respect.  The companion program @code{unprotoize} does the
  3379. reverse: it removes argument types from any prototypes that are found.
  3380.  
  3381. When you run these programs, you must specify a set of source files as
  3382. command line arguments.  The conversion programs start out by compiling
  3383. these files to see what functions they define.  The information gathered
  3384. about a file @var{foo} is saved in a file named @file{@var{foo}.X}.
  3385.  
  3386. After scanning comes actual conversion.  The specified files are all
  3387. eligible to be converted; any files they include (whether sources or
  3388. just headers) are eligible as well.
  3389.  
  3390. But not all the eligible files are converted.  By default,
  3391. @code{protoize} and @code{unprotoize} convert only source and header
  3392. files in the current directory.  You can specify additional directories
  3393. whose files should be converted with the @samp{-d @var{directory}}
  3394. option.  You can also specify particular files to exclude with the
  3395. @samp{-x @var{file}} option.  A file is converted if it is eligible, its
  3396. directory name matches one of the specified directory names, and its
  3397. name within the directory has not been excluded.
  3398.  
  3399. Basic conversion with @code{protoize} consists of rewriting most
  3400. function definitions and function declarations to specify the types of
  3401. the arguments.  The only ones not rewritten are those for varargs
  3402. functions.
  3403.  
  3404. @code{protoize} optionally inserts prototype declarations at the
  3405. beginning of the source file, to make them available for any calls that
  3406. precede the function's definition.  Or it can insert prototype
  3407. declarations with block scope in the blocks where undeclared functions
  3408. are called.
  3409.  
  3410. Basic conversion with @code{unprotoize} consists of rewriting most
  3411. function declarations to remove any argument types, and rewriting
  3412. function definitions to the old-style pre-ANSI form.
  3413.  
  3414. Both conversion programs print a warning for any function declaration or
  3415. definition that they can't convert.  You can suppress these warnings
  3416. with @samp{-q}.
  3417.  
  3418. The output from @code{protoize} or @code{unprotoize} replaces the
  3419. original source file.  The original file is renamed to a name ending
  3420. with @samp{.save}.  If the @samp{.save} file already exists, then 
  3421. the source file is simply discarded.
  3422.  
  3423. @code{protoize} and @code{unprotoize} both depend on GNU CC itself to
  3424. scan the program and collect information about the functions it uses.
  3425. So neither of these programs will work until GNU CC is installed.
  3426.  
  3427. Here is a table of the options you can use with @code{protoize} and
  3428. @code{unprotoize}.  Each option works with both programs unless
  3429. otherwise stated.
  3430.  
  3431. @table @code
  3432. @item -B @var{directory}
  3433. Look for the file @file{SYSCALLS.c.X} in @var{directory}, instead of the
  3434. usual directory (normally @file{/usr/local/lib}).  This file contains
  3435. prototype information about standard system functions.  This option
  3436. applies only to @code{protoize}.
  3437.  
  3438. @item -c @var{compilation-options}
  3439. Use  @var{compilation-options} as the options when running @code{gcc} to
  3440. produce the @samp{.X} files.  The special option @samp{-aux-info} is
  3441. always passed in addition, to tell @code{gcc} to write a @samp{.X} file.
  3442.  
  3443. Note that the compilation options must be given as a single argument to
  3444. @code{protoize} or @code{unprotoize}.  If you want to specify several
  3445. @code{gcc} options, you must quote the entire set of compilation options
  3446. to make them a single word in the shell.
  3447.  
  3448. There are certain @code{gcc} arguments that you cannot use, because they
  3449. would produce the wrong kind of output.  These include @samp{-g},
  3450. @samp{-O}, @samp{-c}, @samp{-S}, and @samp{-o} If you include these in
  3451. the @var{compilation-options}, they are ignored.
  3452.  
  3453. @item -C
  3454. Rename files to end in @samp{.C} instead of @samp{.c}.
  3455. This is convenient if you are converting a C program to C++.
  3456. This option applies only to @code{protoize}.
  3457.  
  3458. @item -g
  3459. Add explicit global declarations.  This means inserting explicit
  3460. declarations at the beginning of each source file for each function
  3461. that is called in the file and was not declared.  These declarations
  3462. precede the first function definition that contains a call to an
  3463. undeclared function.  This option applies only to @code{protoize}.
  3464.  
  3465. @item -i @var{string}
  3466. Indent old-style parameter declarations with the string @var{string}.
  3467. This option applies only to @code{protoize}.
  3468.  
  3469. @code{unprotoize} converts prototyped function definitions to old-style
  3470. function definitions, where the arguments are declared between the
  3471. argument list and the initial @samp{@{}.  By default, @code{unprotoize}
  3472. uses five spaces as the indentation.  If you want to indent with just
  3473. one space instead, use @samp{-i " "}.
  3474.  
  3475. @item -k
  3476. Keep the @samp{.X} files.  Normally, they are deleted after conversion
  3477. is finished.
  3478.  
  3479. @item -l
  3480. Add explicit local declarations.  @code{protoize} with @samp{-l} inserts
  3481. a prototype declaration for each function in each block which calls the
  3482. function without any declaration.  This option applies only to
  3483. @code{protoize}.
  3484.  
  3485. @item -n
  3486. Make no real changes.  This mode just prints information about the conversions
  3487. that would have been done without @samp{-n}.
  3488.  
  3489. @item -N
  3490. Make no @samp{.save} files.  The original files are simply deleted.
  3491. Use this option with caution.
  3492.  
  3493. @item -p @var{program}
  3494. Use the program @var{program} as the compiler.  Normally, the name
  3495. @file{gcc} is used.
  3496.  
  3497. @item -q
  3498. Work quietly.  Most warnings are suppressed.
  3499.  
  3500. @item -v
  3501. Print the version number, just like @samp{-v} for @code{gcc}.
  3502. @end table
  3503.  
  3504. If you need special compiler options to compile one of your program's
  3505. source files, then you should generate that file's @samp{.X} file
  3506. specially, by running @code{gcc} on that source file with the
  3507. appropriate options and the option @samp{-aux-info}.  Then run
  3508. @code{protoize} on the entire set of files.  @code{protoize} will use
  3509. the existing @samp{.X} file because it is newer than the source file.
  3510. For example:
  3511.  
  3512. @example
  3513. gcc -Dfoo=bar file1.c -aux-info
  3514. protoize *.c
  3515. @end example
  3516.  
  3517. @noindent
  3518. You need to include the special files along with the rest in the
  3519. @code{protoize} command, even though their @samp{.X} files already
  3520. exist, because otherwise they won't get converted.
  3521.  
  3522. @xref{Protoize Caveats}, for more information on how to use
  3523. @code{protoize} successfully.
  3524.  
  3525.