home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / f / fortran / GCCmain / !gcc / docs / gccuser < prev   
Encoding:
GNU Info File  |  1995-08-17  |  523.0 KB  |  12,660 lines

  1. This is Info file use, produced by Makeinfo-1.63 from the input file
  2. gcc.texi.
  3.  
  4.    This file documents the use of the GNU compiler.
  5.  
  6.    Published by the Free Software Foundation 59 Temple Place - Suite 330
  7. Boston, MA 02111-1307 USA
  8.  
  9.    Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995 Free Software
  10. Foundation, Inc.
  11.  
  12.    Permission is granted to make and distribute verbatim copies of this
  13. manual provided the copyright notice and this permission notice are
  14. preserved on all copies.
  15.  
  16.    Permission is granted to copy and distribute modified versions of
  17. this manual under the conditions for verbatim copying, provided also
  18. that the sections entitled "GNU General Public License," "Funding for
  19. Free Software," and "Protect Your Freedom--Fight `Look And Feel'" are
  20. included exactly as in the original, and provided that the entire
  21. resulting derived work is distributed under the terms of a permission
  22. notice identical to this one.
  23.  
  24.    Permission is granted to copy and distribute translations of this
  25. manual into another language, under the above conditions for modified
  26. versions, except that the sections entitled "GNU General Public
  27. License," "Funding for Free Software," and "Protect Your Freedom--Fight
  28. `Look And Feel'", and this permission notice, may be included in
  29. translations approved by the Free Software Foundation instead of in the
  30. original English.
  31.  
  32. 
  33. File: use,  Node: Top,  Next: Copying,  Up: (DIR)
  34.  
  35. Introduction
  36. ************
  37.  
  38.    This manual documents how to run and install the GNU compiler, as
  39. well as its new features and incompatibilities, and how to report bugs.
  40. It corresponds to GNU CC version 2.7.
  41.  
  42. * Menu:
  43.  
  44. * Copying::         GNU General Public License says
  45.                      how you can copy and share GNU CC.
  46. * Contributors::    People who have contributed to GNU CC.
  47. * Funding::         How to help assure funding for free software.
  48. * Look and Feel::   Protect your freedom--fight "look and feel".
  49.  
  50. * G++ and GCC::     You can compile C or C++ programs.
  51. * Invoking GCC::    Command options supported by `gcc'.
  52. * Installation::    How to configure, compile and install GNU CC.
  53. * C Extensions::    GNU extensions to the C language family.
  54. * C++ Extensions::  GNU extensions to the C++ language.
  55. * Trouble::         If you have trouble installing GNU CC.
  56. * Bugs::            How, why and where to report bugs.
  57. * Service::         How to find suppliers of support for GNU CC.
  58. * VMS::             Using GNU CC on VMS.
  59.  
  60. * Index::        Index of concepts and symbol names.
  61.  
  62. 
  63. File: use,  Node: Copying,  Next: Contributors,  Prev: Top,  Up: Top
  64.  
  65. GNU GENERAL PUBLIC LICENSE
  66. **************************
  67.  
  68.                          Version 2, June 1991
  69.  
  70.      Copyright (C) 1989, 1991 Free Software Foundation, Inc.
  71.      675 Mass Ave, Cambridge, MA 02139, USA
  72.      
  73.      Everyone is permitted to copy and distribute verbatim copies
  74.      of this license document, but changing it is not allowed.
  75.  
  76. Preamble
  77. ========
  78.  
  79.    The licenses for most software are designed to take away your
  80. freedom to share and change it.  By contrast, the GNU General Public
  81. License is intended to guarantee your freedom to share and change free
  82. software--to make sure the software is free for all its users.  This
  83. General Public License applies to most of the Free Software
  84. Foundation's software and to any other program whose authors commit to
  85. using it.  (Some other Free Software Foundation software is covered by
  86. the GNU Library General Public License instead.)  You can apply it to
  87. your programs, too.
  88.  
  89.    When we speak of free software, we are referring to freedom, not
  90. price.  Our General Public Licenses are designed to make sure that you
  91. have the freedom to distribute copies of free software (and charge for
  92. this service if you wish), that you receive source code or can get it
  93. if you want it, that you can change the software or use pieces of it in
  94. new free programs; and that you know you can do these things.
  95.  
  96.    To protect your rights, we need to make restrictions that forbid
  97. anyone to deny you these rights or to ask you to surrender the rights.
  98. These restrictions translate to certain responsibilities for you if you
  99. distribute copies of the software, or if you modify it.
  100.  
  101.    For example, if you distribute copies of such a program, whether
  102. gratis or for a fee, you must give the recipients all the rights that
  103. you have.  You must make sure that they, too, receive or can get the
  104. source code.  And you must show them these terms so they know their
  105. rights.
  106.  
  107.    We protect your rights with two steps: (1) copyright the software,
  108. and (2) offer you this license which gives you legal permission to copy,
  109. distribute and/or modify the software.
  110.  
  111.    Also, for each author's protection and ours, we want to make certain
  112. that everyone understands that there is no warranty for this free
  113. software.  If the software is modified by someone else and passed on, we
  114. want its recipients to know that what they have is not the original, so
  115. that any problems introduced by others will not reflect on the original
  116. authors' reputations.
  117.  
  118.    Finally, any free program is threatened constantly by software
  119. patents.  We wish to avoid the danger that redistributors of a free
  120. program will individually obtain patent licenses, in effect making the
  121. program proprietary.  To prevent this, we have made it clear that any
  122. patent must be licensed for everyone's free use or not licensed at all.
  123.  
  124.    The precise terms and conditions for copying, distribution and
  125. modification follow.
  126.  
  127.     TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
  128.  
  129.   0. This License applies to any program or other work which contains a
  130.      notice placed by the copyright holder saying it may be distributed
  131.      under the terms of this General Public License.  The "Program",
  132.      below, refers to any such program or work, and a "work based on
  133.      the Program" means either the Program or any derivative work under
  134.      copyright law: that is to say, a work containing the Program or a
  135.      portion of it, either verbatim or with modifications and/or
  136.      translated into another language.  (Hereinafter, translation is
  137.      included without limitation in the term "modification".)  Each
  138.      licensee is addressed as "you".
  139.  
  140.      Activities other than copying, distribution and modification are
  141.      not covered by this License; they are outside its scope.  The act
  142.      of running the Program is not restricted, and the output from the
  143.      Program is covered only if its contents constitute a work based on
  144.      the Program (independent of having been made by running the
  145.      Program).  Whether that is true depends on what the Program does.
  146.  
  147.   1. You may copy and distribute verbatim copies of the Program's
  148.      source code as you receive it, in any medium, provided that you
  149.      conspicuously and appropriately publish on each copy an appropriate
  150.      copyright notice and disclaimer of warranty; keep intact all the
  151.      notices that refer to this License and to the absence of any
  152.      warranty; and give any other recipients of the Program a copy of
  153.      this License along with the Program.
  154.  
  155.      You may charge a fee for the physical act of transferring a copy,
  156.      and you may at your option offer warranty protection in exchange
  157.      for a fee.
  158.  
  159.   2. You may modify your copy or copies of the Program or any portion
  160.      of it, thus forming a work based on the Program, and copy and
  161.      distribute such modifications or work under the terms of Section 1
  162.      above, provided that you also meet all of these conditions:
  163.  
  164.        a. You must cause the modified files to carry prominent notices
  165.           stating that you changed the files and the date of any change.
  166.  
  167.        b. You must cause any work that you distribute or publish, that
  168.           in whole or in part contains or is derived from the Program
  169.           or any part thereof, to be licensed as a whole at no charge
  170.           to all third parties under the terms of this License.
  171.  
  172.        c. If the modified program normally reads commands interactively
  173.           when run, you must cause it, when started running for such
  174.           interactive use in the most ordinary way, to print or display
  175.           an announcement including an appropriate copyright notice and
  176.           a notice that there is no warranty (or else, saying that you
  177.           provide a warranty) and that users may redistribute the
  178.           program under these conditions, and telling the user how to
  179.           view a copy of this License.  (Exception: if the Program
  180.           itself is interactive but does not normally print such an
  181.           announcement, your work based on the Program is not required
  182.           to print an announcement.)
  183.  
  184.      These requirements apply to the modified work as a whole.  If
  185.      identifiable sections of that work are not derived from the
  186.      Program, and can be reasonably considered independent and separate
  187.      works in themselves, then this License, and its terms, do not
  188.      apply to those sections when you distribute them as separate
  189.      works.  But when you distribute the same sections as part of a
  190.      whole which is a work based on the Program, the distribution of
  191.      the whole must be on the terms of this License, whose permissions
  192.      for other licensees extend to the entire whole, and thus to each
  193.      and every part regardless of who wrote it.
  194.  
  195.      Thus, it is not the intent of this section to claim rights or
  196.      contest your rights to work written entirely by you; rather, the
  197.      intent is to exercise the right to control the distribution of
  198.      derivative or collective works based on the Program.
  199.  
  200.      In addition, mere aggregation of another work not based on the
  201.      Program with the Program (or with a work based on the Program) on
  202.      a volume of a storage or distribution medium does not bring the
  203.      other work under the scope of this License.
  204.  
  205.   3. You may copy and distribute the Program (or a work based on it,
  206.      under Section 2) in object code or executable form under the terms
  207.      of Sections 1 and 2 above provided that you also do one of the
  208.      following:
  209.  
  210.        a. Accompany it with the complete corresponding machine-readable
  211.           source code, which must be distributed under the terms of
  212.           Sections 1 and 2 above on a medium customarily used for
  213.           software interchange; or,
  214.  
  215.        b. Accompany it with a written offer, valid for at least three
  216.           years, to give any third party, for a charge no more than your
  217.           cost of physically performing source distribution, a complete
  218.           machine-readable copy of the corresponding source code, to be
  219.           distributed under the terms of Sections 1 and 2 above on a
  220.           medium customarily used for software interchange; or,
  221.  
  222.        c. Accompany it with the information you received as to the offer
  223.           to distribute corresponding source code.  (This alternative is
  224.           allowed only for noncommercial distribution and only if you
  225.           received the program in object code or executable form with
  226.           such an offer, in accord with Subsection b above.)
  227.  
  228.      The source code for a work means the preferred form of the work for
  229.      making modifications to it.  For an executable work, complete
  230.      source code means all the source code for all modules it contains,
  231.      plus any associated interface definition files, plus the scripts
  232.      used to control compilation and installation of the executable.
  233.      However, as a special exception, the source code distributed need
  234.      not include anything that is normally distributed (in either
  235.      source or binary form) with the major components (compiler,
  236.      kernel, and so on) of the operating system on which the executable
  237.      runs, unless that component itself accompanies the executable.
  238.  
  239.      If distribution of executable or object code is made by offering
  240.      access to copy from a designated place, then offering equivalent
  241.      access to copy the source code from the same place counts as
  242.      distribution of the source code, even though third parties are not
  243.      compelled to copy the source along with the object code.
  244.  
  245.   4. You may not copy, modify, sublicense, or distribute the Program
  246.      except as expressly provided under this License.  Any attempt
  247.      otherwise to copy, modify, sublicense or distribute the Program is
  248.      void, and will automatically terminate your rights under this
  249.      License.  However, parties who have received copies, or rights,
  250.      from you under this License will not have their licenses
  251.      terminated so long as such parties remain in full compliance.
  252.  
  253.   5. You are not required to accept this License, since you have not
  254.      signed it.  However, nothing else grants you permission to modify
  255.      or distribute the Program or its derivative works.  These actions
  256.      are prohibited by law if you do not accept this License.
  257.      Therefore, by modifying or distributing the Program (or any work
  258.      based on the Program), you indicate your acceptance of this
  259.      License to do so, and all its terms and conditions for copying,
  260.      distributing or modifying the Program or works based on it.
  261.  
  262.   6. Each time you redistribute the Program (or any work based on the
  263.      Program), the recipient automatically receives a license from the
  264.      original licensor to copy, distribute or modify the Program
  265.      subject to these terms and conditions.  You may not impose any
  266.      further restrictions on the recipients' exercise of the rights
  267.      granted herein.  You are not responsible for enforcing compliance
  268.      by third parties to this License.
  269.  
  270.   7. If, as a consequence of a court judgment or allegation of patent
  271.      infringement or for any other reason (not limited to patent
  272.      issues), conditions are imposed on you (whether by court order,
  273.      agreement or otherwise) that contradict the conditions of this
  274.      License, they do not excuse you from the conditions of this
  275.      License.  If you cannot distribute so as to satisfy simultaneously
  276.      your obligations under this License and any other pertinent
  277.      obligations, then as a consequence you may not distribute the
  278.      Program at all.  For example, if a patent license would not permit
  279.      royalty-free redistribution of the Program by all those who
  280.      receive copies directly or indirectly through you, then the only
  281.      way you could satisfy both it and this License would be to refrain
  282.      entirely from distribution of the Program.
  283.  
  284.      If any portion of this section is held invalid or unenforceable
  285.      under any particular circumstance, the balance of the section is
  286.      intended to apply and the section as a whole is intended to apply
  287.      in other circumstances.
  288.  
  289.      It is not the purpose of this section to induce you to infringe any
  290.      patents or other property right claims or to contest validity of
  291.      any such claims; this section has the sole purpose of protecting
  292.      the integrity of the free software distribution system, which is
  293.      implemented by public license practices.  Many people have made
  294.      generous contributions to the wide range of software distributed
  295.      through that system in reliance on consistent application of that
  296.      system; it is up to the author/donor to decide if he or she is
  297.      willing to distribute software through any other system and a
  298.      licensee cannot impose that choice.
  299.  
  300.      This section is intended to make thoroughly clear what is believed
  301.      to be a consequence of the rest of this License.
  302.  
  303.   8. If the distribution and/or use of the Program is restricted in
  304.      certain countries either by patents or by copyrighted interfaces,
  305.      the original copyright holder who places the Program under this
  306.      License may add an explicit geographical distribution limitation
  307.      excluding those countries, so that distribution is permitted only
  308.      in or among countries not thus excluded.  In such case, this
  309.      License incorporates the limitation as if written in the body of
  310.      this License.
  311.  
  312.   9. The Free Software Foundation may publish revised and/or new
  313.      versions of the General Public License from time to time.  Such
  314.      new versions will be similar in spirit to the present version, but
  315.      may differ in detail to address new problems or concerns.
  316.  
  317.      Each version is given a distinguishing version number.  If the
  318.      Program specifies a version number of this License which applies
  319.      to it and "any later version", you have the option of following
  320.      the terms and conditions either of that version or of any later
  321.      version published by the Free Software Foundation.  If the Program
  322.      does not specify a version number of this License, you may choose
  323.      any version ever published by the Free Software Foundation.
  324.  
  325.  10. If you wish to incorporate parts of the Program into other free
  326.      programs whose distribution conditions are different, write to the
  327.      author to ask for permission.  For software which is copyrighted
  328.      by the Free Software Foundation, write to the Free Software
  329.      Foundation; we sometimes make exceptions for this.  Our decision
  330.      will be guided by the two goals of preserving the free status of
  331.      all derivatives of our free software and of promoting the sharing
  332.      and reuse of software generally.
  333.  
  334.                                 NO WARRANTY
  335.  
  336.  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO
  337.      WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE
  338.      LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
  339.      HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT
  340.      WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT
  341.      NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  342.      FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS TO THE
  343.      QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
  344.      PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY
  345.      SERVICING, REPAIR OR CORRECTION.
  346.  
  347.  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
  348.      WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY
  349.      MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE
  350.      LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL,
  351.      INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
  352.      INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
  353.      DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU
  354.      OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY
  355.      OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN
  356.      ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
  357.  
  358.                       END OF TERMS AND CONDITIONS
  359.  
  360. How to Apply These Terms to Your New Programs
  361. =============================================
  362.  
  363.    If you develop a new program, and you want it to be of the greatest
  364. possible use to the public, the best way to achieve this is to make it
  365. free software which everyone can redistribute and change under these
  366. terms.
  367.  
  368.    To do so, attach the following notices to the program.  It is safest
  369. to attach them to the start of each source file to most effectively
  370. convey the exclusion of warranty; and each file should have at least
  371. the "copyright" line and a pointer to where the full notice is found.
  372.  
  373.      ONE LINE TO GIVE THE PROGRAM'S NAME AND A BRIEF IDEA OF WHAT IT DOES.
  374.      Copyright (C) 19YY  NAME OF AUTHOR
  375.      
  376.      This program is free software; you can redistribute it and/or modify
  377.      it under the terms of the GNU General Public License as published by
  378.      the Free Software Foundation; either version 2 of the License, or
  379.      (at your option) any later version.
  380.      
  381.      This program is distributed in the hope that it will be useful,
  382.      but WITHOUT ANY WARRANTY; without even the implied warranty of
  383.      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  384.      GNU General Public License for more details.
  385.      
  386.      You should have received a copy of the GNU General Public License
  387.      along with this program; if not, write to the Free Software
  388.      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  389.  
  390.    Also add information on how to contact you by electronic and paper
  391. mail.
  392.  
  393.    If the program is interactive, make it output a short notice like
  394. this when it starts in an interactive mode:
  395.  
  396.      Gnomovision version 69, Copyright (C) 19YY NAME OF AUTHOR
  397.      Gnomovision comes with ABSOLUTELY NO WARRANTY; for details
  398.      type `show w'.
  399.      This is free software, and you are welcome to redistribute it
  400.      under certain conditions; type `show c' for details.
  401.  
  402.    The hypothetical commands `show w' and `show c' should show the
  403. appropriate parts of the General Public License.  Of course, the
  404. commands you use may be called something other than `show w' and `show
  405. c'; they could even be mouse-clicks or menu items--whatever suits your
  406. program.
  407.  
  408.    You should also get your employer (if you work as a programmer) or
  409. your school, if any, to sign a "copyright disclaimer" for the program,
  410. if necessary.  Here is a sample; alter the names:
  411.  
  412.      Yoyodyne, Inc., hereby disclaims all copyright interest in the program
  413.      `Gnomovision' (which makes passes at compilers) written by James Hacker.
  414.      
  415.      SIGNATURE OF TY COON, 1 April 1989
  416.      Ty Coon, President of Vice
  417.  
  418.    This General Public License does not permit incorporating your
  419. program into proprietary programs.  If your program is a subroutine
  420. library, you may consider it more useful to permit linking proprietary
  421. applications with the library.  If this is what you want to do, use the
  422. GNU Library General Public License instead of this License.
  423.  
  424. 
  425. File: use,  Node: Contributors,  Next: Funding,  Prev: Copying,  Up: Top
  426.  
  427. Contributors to GNU CC
  428. **********************
  429.  
  430.    In addition to Richard Stallman, several people have written parts
  431. of GNU CC.
  432.  
  433.    * The idea of using RTL and some of the optimization ideas came from
  434.      the program PO written at the University of Arizona by Jack
  435.      Davidson and Christopher Fraser.  See "Register Allocation and
  436.      Exhaustive Peephole Optimization", Software Practice and
  437.      Experience 14 (9), Sept. 1984, 857-866.
  438.  
  439.    * Paul Rubin wrote most of the preprocessor.
  440.  
  441.    * Leonard Tower wrote parts of the parser, RTL generator, and RTL
  442.      definitions, and of the Vax machine description.
  443.  
  444.    * Ted Lemon wrote parts of the RTL reader and printer.
  445.  
  446.    * Jim Wilson implemented loop strength reduction and some other loop
  447.      optimizations.
  448.  
  449.    * Nobuyuki Hikichi of Software Research Associates, Tokyo,
  450.      contributed the support for the Sony NEWS machine.
  451.  
  452.    * Charles LaBrec contributed the support for the Integrated Solutions
  453.      68020 system.
  454.  
  455.    * Michael Tiemann of Cygnus Support wrote the front end for C++, as
  456.      well as the support for inline functions and instruction
  457.      scheduling.  Also the descriptions of the National Semiconductor
  458.      32000 series cpu, the SPARC cpu and part of the Motorola 88000 cpu.
  459.  
  460.    * Gerald Baumgartner added the signature extension to the C++
  461.      front-end.
  462.  
  463.    * Jan Stein of the Chalmers Computer Society provided support for
  464.      Genix, as well as part of the 32000 machine description.
  465.  
  466.    * Randy Smith finished the Sun FPA support.
  467.  
  468.    * Robert Brown implemented the support for Encore 32000 systems.
  469.  
  470.    * David Kashtan of SRI adapted GNU CC to VMS.
  471.  
  472.    * Alex Crain provided changes for the 3b1.
  473.  
  474.    * Greg Satz and Chris Hanson assisted in making GNU CC work on HP-UX
  475.      for the 9000 series 300.
  476.  
  477.    * William Schelter did most of the work on the Intel 80386 support.
  478.  
  479.    * Christopher Smith did the port for Convex machines.
  480.  
  481.    * Paul Petersen wrote the machine description for the Alliant FX/8.
  482.  
  483.    * Dario Dariol contributed the four varieties of sample programs
  484.      that print a copy of their source.
  485.  
  486.    * Alain Lichnewsky ported GNU CC to the Mips cpu.
  487.  
  488.    * Devon Bowen, Dale Wiles and Kevin Zachmann ported GNU CC to the
  489.      Tahoe.
  490.  
  491.    * Jonathan Stone wrote the machine description for the Pyramid
  492.      computer.
  493.  
  494.    * Gary Miller ported GNU CC to Charles River Data Systems machines.
  495.  
  496.    * Richard Kenner of the New York University Ultracomputer Research
  497.      Laboratory wrote the machine descriptions for the AMD 29000, the
  498.      DEC Alpha, the IBM RT PC, and the IBM RS/6000 as well as the
  499.      support for instruction attributes.  He also made changes to
  500.      better support RISC processors including changes to common
  501.      subexpression elimination, strength reduction, function calling
  502.      sequence handling, and condition code support, in addition to
  503.      generalizing the code for frame pointer elimination.
  504.  
  505.    * Richard Kenner and Michael Tiemann jointly developed reorg.c, the
  506.      delay slot scheduler.
  507.  
  508.    * Mike Meissner and Tom Wood of Data General finished the port to the
  509.      Motorola 88000.
  510.  
  511.    * Masanobu Yuhara of Fujitsu Laboratories implemented the machine
  512.      description for the Tron architecture (specifically, the Gmicro).
  513.  
  514.    * NeXT, Inc. donated the front end that supports the Objective C
  515.      language.
  516.  
  517.    * James van Artsdalen wrote the code that makes efficient use of the
  518.      Intel 80387 register stack.
  519.  
  520.    * Mike Meissner at the Open Software Foundation finished the port to
  521.      the MIPS cpu, including adding ECOFF debug support, and worked on
  522.      the Intel port for the Intel 80386 cpu.
  523.  
  524.    * Ron Guilmette implemented the `protoize' and `unprotoize' tools,
  525.      the support for Dwarf symbolic debugging information, and much of
  526.      the support for System V Release 4.  He has also worked heavily on
  527.      the Intel 386 and 860 support.
  528.  
  529.    * Torbjorn Granlund of the Swedish Institute of Computer Science
  530.      implemented multiply-by-constant optimization and better long long
  531.      support, and improved leaf function register allocation.
  532.  
  533.    * Mike Stump implemented the support for Elxsi 64 bit CPU.
  534.  
  535.    * John Wehle added the machine description for the Western Electric
  536.      32000 processor used in several 3b series machines (no relation to
  537.      the National Semiconductor 32000 processor).
  538.  
  539.    * Holger Teutsch provided the support for the Clipper cpu.
  540.  
  541.    * Kresten Krab Thorup wrote the run time support for the Objective C
  542.      language.
  543.  
  544.    * Stephen Moshier contributed the floating point emulator that
  545.      assists in cross-compilation and permits support for floating
  546.      point numbers wider than 64 bits.
  547.  
  548.    * David Edelsohn contributed the changes to RS/6000 port to make it
  549.      support the PowerPC and POWER2 architectures.
  550.  
  551.    * Steve Chamberlain wrote the support for the Hitachi SH processor.
  552.  
  553.    * Peter Schauer wrote the code to allow debugging to work on the
  554.      Alpha.
  555.  
  556.    * Oliver M. Kellogg of Deutsche Aerospace contributed the port to the
  557.      MIL-STD-1750A.
  558.  
  559. 
  560. File: use,  Node: Funding,  Next: Look and Feel,  Prev: Contributors,  Up: Top
  561.  
  562. Funding Free Software
  563. *********************
  564.  
  565.    If you want to have more free software a few years from now, it makes
  566. sense for you to help encourage people to contribute funds for its
  567. development.  The most effective approach known is to encourage
  568. commercial redistributors to donate.
  569.  
  570.    Users of free software systems can boost the pace of development by
  571. encouraging for-a-fee distributors to donate part of their selling price
  572. to free software developers--the Free Software Foundation, and others.
  573.  
  574.    The way to convince distributors to do this is to demand it and
  575. expect it from them.  So when you compare distributors, judge them
  576. partly by how much they give to free software development.  Show
  577. distributors they must compete to be the one who gives the most.
  578.  
  579.    To make this approach work, you must insist on numbers that you can
  580. compare, such as, "We will donate ten dollars to the Frobnitz project
  581. for each disk sold."  Don't be satisfied with a vague promise, such as
  582. "A portion of the profits are donated," since it doesn't give a basis
  583. for comparison.
  584.  
  585.    Even a precise fraction "of the profits from this disk" is not very
  586. meaningful, since creative accounting and unrelated business decisions
  587. can greatly alter what fraction of the sales price counts as profit.
  588. If the price you pay is $50, ten percent of the profit is probably less
  589. than a dollar; it might be a few cents, or nothing at all.
  590.  
  591.    Some redistributors do development work themselves.  This is useful
  592. too; but to keep everyone honest, you need to inquire how much they do,
  593. and what kind.  Some kinds of development make much more long-term
  594. difference than others.  For example, maintaining a separate version of
  595. a program contributes very little; maintaining the standard version of a
  596. program for the whole community contributes much.  Easy new ports
  597. contribute little, since someone else would surely do them; difficult
  598. ports such as adding a new CPU to the GNU C compiler contribute more;
  599. major new features or packages contribute the most.
  600.  
  601.    By establishing the idea that supporting further development is "the
  602. proper thing to do" when distributing free software for a fee, we can
  603. assure a steady flow of resources into making more free software.
  604.  
  605.      Copyright (C) 1994 Free Software Foundation, Inc.
  606.      Verbatim copying and redistribution of this section is permitted
  607.      without royalty; alteration is not permitted.
  608.  
  609. 
  610. File: use,  Node: Look and Feel,  Next: G++ and GCC,  Prev: Funding,  Up: Top
  611.  
  612. Protect Your Freedom--Fight "Look And Feel"
  613. *******************************************
  614.  
  615.      This section is a political message from the League for Programming
  616.      Freedom to the users of GNU CC.  We have included it here because
  617.      the issue of interface copyright is important to the GNU project.
  618.  
  619.    Apple and Lotus have tried to create a new form of legal monopoly: a
  620. copyright on a user interface.
  621.  
  622.    An interface is a kind of language--a set of conventions for
  623. communication between two entities, human or machine.  Until a few years
  624. ago, the law seemed clear: interfaces were outside the domain of
  625. copyright, so programmers could program freely and implement whatever
  626. interface the users demanded.  Imitating de-facto standard interfaces,
  627. sometimes with improvements, was standard practice in the computer
  628. field.  These improvements, if accepted by the users, caught on and
  629. became the norm; in this way, much progress took place.
  630.  
  631.    Computer users, and most software developers, were happy with this
  632. state of affairs.  However, large companies such as Apple and Lotus
  633. would prefer a different system--one in which they can own interfaces
  634. and thereby rid themselves of all serious competitors.  They hope that
  635. interface copyright will give them, in effect, monopolies on major
  636. classes of software.
  637.  
  638.    Other large companies such as IBM and Digital also favor interface
  639. monopolies, for the same reason: if languages become property, they
  640. expect to own many de-facto standard languages.  But Apple and Lotus are
  641. the ones who have actually sued.  Lotus has won lawsuits against two
  642. small companies, which were thus put out of business.  Then they sued
  643. Borland; this case is now before the court of appeals.  Apple's lawsuit
  644. against HP and Microsoft is also being decided by an appeals court.
  645. Widespread rumors that Apple had lost the case are untrue; as of July
  646. 1994, the final outcome is unknown.
  647.  
  648.    If the monopolists get their way, they will hobble the software
  649. field:
  650.  
  651.    * Gratuitous incompatibilities will burden users.  Imagine if each
  652.      car manufacturer had to design a different way to start, stop, and
  653.      steer a car.
  654.  
  655.    * Users will be "locked in" to whichever interface they learn; then
  656.      they will be prisoners of one supplier, who will charge a
  657.      monopolistic price.
  658.  
  659.    * Large companies have an unfair advantage wherever lawsuits become
  660.      commonplace.  Since they can afford to sue, they can intimidate
  661.      smaller developers with threats even when they don't really have a
  662.      case.
  663.  
  664.    * Interface improvements will come slower, since incremental
  665.      evolution through creative partial imitation will no longer occur.
  666.  
  667.    If interface monopolies are accepted, other large companies are
  668. waiting to grab theirs:
  669.  
  670.    * Adobe is expected to claim a monopoly on the interfaces of various
  671.      popular application programs, if Borland's appeal against Lotus
  672.      fails.
  673.  
  674.    * Open Computing magazine reported a Microsoft vice president as
  675.      threatening to sue people who copy the interface of Windows.
  676.  
  677.    Users invest a great deal of time and money in learning to use
  678. computer interfaces.  Far more, in fact, than software developers
  679. invest in developing *and even implementing* the interfaces.  Whoever
  680. can own an interface, has made its users into captives, and
  681. misappropriated their investment.
  682.  
  683.    To protect our freedom from monopolies like these, a group of
  684. programmers and users have formed a grass-roots political organization,
  685. the League for Programming Freedom.
  686.  
  687.    The purpose of the League is to oppose monopolistic practices such as
  688. interface copyright and software patents.  The League calls for a return
  689. to the legal policies of the recent past, in which programmers could
  690. program freely.  The League is not concerned with free software as an
  691. issue, and is not affiliated with the Free Software Foundation.
  692.  
  693.    The League's activities include publicizing the issue, as is being
  694. done here, and filing friend-of-the-court briefs on behalf of
  695. defendants sued by monopolists.  Recently the League filed a
  696. friend-of-the-court brief for Borland in its appeal against Lotus.
  697.  
  698.    The League's membership rolls include John McCarthy, inventor of
  699. Lisp, Marvin Minsky, founder of the MIT Artificial Intelligence lab,
  700. Guy L.  Steele, Jr., author of well-known books on Lisp and C, as well
  701. as Richard Stallman, the developer of GNU CC.  Please join and add your
  702. name to the list.  Membership dues in the League are $42 per year for
  703. programmers, managers and professionals; $10.50 for students; $21 for
  704. others.
  705.  
  706.    Activist members are especially important, but members who have no
  707. time to give are also important.  Surveys at major ACM conferences have
  708. indicated a vast majority of attendees agree with the League.  If just
  709. ten percent of the programmers who agree with the League join the
  710. League, we will probably triumph.
  711.  
  712.    To join, or for more information, phone (617) 243-4091 or write to:
  713.  
  714.      League for Programming Freedom
  715.      1 Kendall Square #143
  716.      P.O. Box 9171
  717.      Cambridge, MA 02139
  718.  
  719.    You can also send electronic mail to `lpf@uunet.uu.net'.
  720.  
  721.    In addition to joining the League, here are some suggestions from the
  722. League for other things you can do to protect your freedom to write
  723. programs:
  724.  
  725.    * Tell your friends and colleagues about this issue and how it
  726.      threatens to ruin the computer industry.
  727.  
  728.    * Mention that you are a League member in your `.signature', and
  729.      mention the League's email address for inquiries.
  730.  
  731.    * Ask the companies you consider working for or working with to make
  732.      statements against software monopolies, and give preference to
  733.      those that do.
  734.  
  735.    * When employers ask you to sign contracts giving them copyright or
  736.      patent rights, insist on clauses saying they can use these rights
  737.      only defensively.  Don't rely on "company policy," since that can
  738.      change at any time; don't rely on an individual executive's
  739.      private word, since that person may be replaced.  Get a commitment
  740.      just as binding as the commitment they get from you.
  741.  
  742.    * Write to Congress to explain the importance of this issue.
  743.  
  744.           House Subcommittee on Intellectual Property
  745.           2137 Rayburn Bldg
  746.           Washington, DC 20515
  747.           
  748.           Senate Subcommittee on Patents, Trademarks and Copyrights
  749.           United States Senate
  750.           Washington, DC 20510
  751.  
  752.      (These committees have received lots of mail already; let's give
  753.      them even more.)
  754.  
  755.    Democracy means nothing if you don't use it.  Stand up and be
  756. counted!
  757.  
  758. 
  759. File: use,  Node: G++ and GCC,  Next: Invoking GCC,  Prev: Look and Feel,  Up: Top
  760.  
  761. Compile C, C++, or Objective C
  762. ******************************
  763.  
  764.    The C, C++, and Objective C versions of the compiler are integrated;
  765. the GNU C compiler can compile programs written in C, C++, or Objective
  766. C.
  767.  
  768.    "GCC" is a common shorthand term for the GNU C compiler.  This is
  769. both the most general name for the compiler, and the name used when the
  770. emphasis is on compiling C programs.
  771.  
  772.    When referring to C++ compilation, it is usual to call the compiler
  773. "G++".  Since there is only one compiler, it is also accurate to call
  774. it "GCC" no matter what the language context; however, the term "G++"
  775. is more useful when the emphasis is on compiling C++ programs.
  776.  
  777.    We use the name "GNU CC" to refer to the compilation system as a
  778. whole, and more specifically to the language-independent part of the
  779. compiler.  For example, we refer to the optimization options as
  780. affecting the behavior of "GNU CC" or sometimes just "the compiler".
  781.  
  782.    Front ends for other languages, such as Ada 9X, Fortran, Modula-3,
  783. and Pascal, are under development.  These front-ends, like that for
  784. C++, are built in subdirectories of GNU CC and link to it.  The result
  785. is an integrated compiler that can compile programs written in C, C++,
  786. Objective C, or any of the languages for which you have installed front
  787. ends.
  788.  
  789.    In this manual, we only discuss the options for the C, Objective-C,
  790. and C++ compilers and those of the GNU CC core.  Consult the
  791. documentation of the other front ends for the options to use when
  792. compiling programs written in other languages.
  793.  
  794.    G++ is a *compiler*, not merely a preprocessor.  G++ builds object
  795. code directly from your C++ program source.  There is no intermediate C
  796. version of the program.  (By contrast, for example, some other
  797. implementations use a program that generates a C program from your C++
  798. source.)  Avoiding an intermediate C representation of the program means
  799. that you get better object code, and better debugging information.  The
  800. GNU debugger, GDB, works with this information in the object code to
  801. give you comprehensive C++ source-level editing capabilities (*note C
  802. and C++: (gdb.info)C.).
  803.  
  804. 
  805. File: use,  Node: Invoking GCC,  Next: Installation,  Prev: G++ and GCC,  Up: Top
  806.  
  807. GNU CC Command Options
  808. **********************
  809.  
  810.    When you invoke GNU CC, it normally does preprocessing, compilation,
  811. assembly and linking.  The "overall options" allow you to stop this
  812. process at an intermediate stage.  For example, the `-c' option says
  813. not to run the linker.  Then the output consists of object files output
  814. by the assembler.
  815.  
  816.    Other options are passed on to one stage of processing.  Some options
  817. control the preprocessor and others the compiler itself.  Yet other
  818. options control the assembler and linker; most of these are not
  819. documented here, since you rarely need to use any of them.
  820.  
  821.    Most of the command line options that you can use with GNU CC are
  822. useful for C programs; when an option is only useful with another
  823. language (usually C++), the explanation says so explicitly.  If the
  824. description for a particular option does not mention a source language,
  825. you can use that option with all supported languages.
  826.  
  827.    *Note Compiling C++ Programs: Invoking G++, for a summary of special
  828. options for compiling C++ programs.
  829.  
  830.    The `gcc' program accepts options and file names as operands.  Many
  831. options have multiletter names; therefore multiple single-letter options
  832. may *not* be grouped: `-dr' is very different from `-d -r'.
  833.  
  834.    You can mix options and other arguments.  For the most part, the
  835. order you use doesn't matter.  Order does matter when you use several
  836. options of the same kind; for example, if you specify `-L' more than
  837. once, the directories are searched in the order specified.
  838.  
  839.    Many options have long names starting with `-f' or with `-W'--for
  840. example, `-fforce-mem', `-fstrength-reduce', `-Wformat' and so on.
  841. Most of these have both positive and negative forms; the negative form
  842. of `-ffoo' would be `-fno-foo'.  This manual documents only one of
  843. these two forms, whichever one is not the default.
  844.  
  845. * Menu:
  846.  
  847. * Option Summary::    Brief list of all options, without explanations.
  848. * Overall Options::     Controlling the kind of output:
  849.                         an executable, object files, assembler files,
  850.                         or preprocessed source.
  851. * Invoking G++::    Compiling C++ programs.
  852. * C Dialect Options::   Controlling the variant of C language compiled.
  853. * C++ Dialect Options:: Variations on C++.
  854. * Warning Options::     How picky should the compiler be?
  855. * Debugging Options::   Symbol tables, measurements, and debugging dumps.
  856. * Optimize Options::    How much optimization?
  857. * Preprocessor Options:: Controlling header files and macro definitions.
  858.                          Also, getting dependency information for Make.
  859. * Assembler Options::   Passing options to the assembler.
  860. * Link Options::        Specifying libraries and so on.
  861. * Directory Options::   Where to find header files and libraries.
  862.                         Where to find the compiler executable files.
  863. * Target Options::      Running a cross-compiler, or an old version of GNU CC.
  864. * Submodel Options::    Specifying minor hardware or convention variations,
  865.                         such as 68010 vs 68020.
  866. * Code Gen Options::    Specifying conventions for function calls, data layout
  867.                         and register usage.
  868. * Environment Variables:: Env vars that affect GNU CC.
  869. * Running Protoize::    Automatically adding or removing function prototypes.
  870.  
  871. 
  872. File: use,  Node: Option Summary,  Next: Overall Options,  Up: Invoking GCC
  873.  
  874. Option Summary
  875. ==============
  876.  
  877.    Here is a summary of all the options, grouped by type.  Explanations
  878. are in the following sections.
  879.  
  880. *Overall Options*
  881.      *Note Options Controlling the Kind of Output: Overall Options.
  882.           -c  -S  -E  -o FILE  -pipe  -v  -x LANGUAGE
  883.  
  884. *C Language Options*
  885.      *Note Options Controlling C Dialect: C Dialect Options.
  886.           -ansi  -fallow-single-precision -fcond-mismatch  -fno-asm
  887.           -fno-builtin  -fsigned-bitfields  -fsigned-char
  888.           -funsigned-bitfields  -funsigned-char  -fwritable-strings
  889.           -traditional  -traditional-cpp  -trigraphs
  890.  
  891. *C++ Language Options*
  892.      *Note Options Controlling C++ Dialect: C++ Dialect Options.
  893.           -fall-virtual  -fdollars-in-identifiers  -felide-constructors
  894.           -fenum-int-equiv -fexternal-templates  -fhandle-signatures
  895.           -fmemoize-lookups  -fno-default-inline -fno-gnu-keywords
  896.           -fnonnull-objects  -foperator-names  -fstrict-prototype
  897.           -fthis-is-variable -nostdinc++ -traditional  +eN
  898.  
  899. *Warning Options*
  900.      *Note Options to Request or Suppress Warnings: Warning Options.
  901.           -fsyntax-only  -pedantic  -pedantic-errors
  902.           -w  -W  -Wall  -Waggregate-return  -Wbad-function-cast
  903.           -Wcast-align -Wcast-qual  -Wchar-subscript  -Wcomment
  904.           -Wconversion -Wenum-clash  -Werror  -Wformat
  905.           -Wid-clash-LEN  -Wimplicit  -Wimport  -Winline
  906.           -Wlarger-than-LEN  -Wmissing-declarations
  907.           -Wmissing-prototypes  -Wnested-externs
  908.           -Wno-import  -Woverloaded-virtual -Wparentheses
  909.           -Wpointer-arith  -Wredundant-decls -Wreorder -Wreturn-type -Wshadow
  910.           -Wstrict-prototypes  -Wswitch  -Wsynth  -Wtemplate-debugging
  911.           -Wtraditional  -Wtrigraphs -Wuninitialized  -Wunused
  912.           -Wwrite-strings
  913.  
  914. *Debugging Options*
  915.      *Note Options for Debugging Your Program or GCC: Debugging Options.
  916.           -a  -dLETTERS  -fpretend-float
  917.           -g  -gLEVEL -gcoff  -gdwarf  -gdwarf+
  918.           -ggdb  -gstabs  -gstabs+  -gxcoff  -gxcoff+
  919.           -p  -pg  -print-file-name=LIBRARY  -print-libgcc-file-name
  920.           -print-prog-name=PROGRAM  -print-search-dirs  -save-temps
  921.  
  922. *Optimization Options*
  923.      *Note Options that Control Optimization: Optimize Options.
  924.           -fcaller-saves  -fcse-follow-jumps  -fcse-skip-blocks
  925.           -fdelayed-branch   -fexpensive-optimizations
  926.           -ffast-math  -ffloat-store  -fforce-addr  -fforce-mem
  927.           -finline-functions  -fkeep-inline-functions
  928.           -fno-default-inline  -fno-defer-pop  -fno-function-cse
  929.           -fno-inline  -fno-peephole  -fomit-frame-pointer
  930.           -frerun-cse-after-loop  -fschedule-insns
  931.           -fschedule-insns2  -fstrength-reduce  -fthread-jumps
  932.           -funroll-all-loops  -funroll-loops
  933.           -O  -O0  -O1  -O2  -O3
  934.  
  935. *Preprocessor Options*
  936.      *Note Options Controlling the Preprocessor: Preprocessor Options.
  937.           -AQUESTION(ANSWER)  -C  -dD  -dM  -dN
  938.           -DMACRO[=DEFN]  -E  -H
  939.           -idirafter DIR
  940.           -include FILE  -imacros FILE
  941.           -iprefix FILE  -iwithprefix DIR
  942.           -iwithprefixbefore DIR  -isystem DIR
  943.           -M  -MD  -MM  -MMD  -MG  -nostdinc  -P  -trigraphs
  944.           -undef  -UMACRO  -Wp,OPTION
  945.  
  946. *Assembler Option*
  947.      *Note Passing Options to the Assembler: Assembler Options.
  948.           -Wa,OPTION
  949.  
  950. *Linker Options*
  951.      *Note Options for Linking: Link Options.
  952.           OBJECT-FILE-NAME  -lLIBRARY
  953.           -nostartfiles  -nodefaultlibs  -nostdlib
  954.           -s  -static  -shared  -symbolic
  955.           -Wl,OPTION  -Xlinker OPTION
  956.           -u SYMBOL
  957.  
  958. *Directory Options*
  959.      *Note Options for Directory Search: Directory Options.
  960.           -BPREFIX  -IDIR  -I-  -LDIR
  961.  
  962. *Target Options*
  963.      *Note Target Options::.
  964.           -b MACHINE  -V VERSION
  965.  
  966. *Machine Dependent Options*
  967.      *Note Hardware Models and Configurations: Submodel Options.
  968.           *M680x0 Options*
  969.           -m68000  -m68020  -m68020-40  -m68030  -m68040  -m68881
  970.           -mbitfield  -mc68000  -mc68020  -mfpa  -mnobitfield
  971.           -mrtd  -mshort  -msoft-float
  972.           
  973.           *VAX Options*
  974.           -mg  -mgnu  -munix
  975.           
  976.           *SPARC Options*
  977.           -mapp-regs  -mcypress  -mepilogue  -mflat  -mfpu  -mhard-float
  978.           -mhard-quad-float  -mno-app-regs  -mno-flat  -mno-fpu
  979.           -mno-epilogue  -mno-unaligned-doubles
  980.           -msoft-float  -msoft-quad-float
  981.           -msparclite  -msupersparc  -munaligned-doubles  -mv8
  982.           
  983.           SPARC V9 compilers support the following options
  984.           in addition to the above:
  985.           
  986.           -mmedlow  -mmedany
  987.           -mint32  -mint64  -mlong32  -mlong64
  988.           -mno-stack-bias  -mstack-bias
  989.           
  990.           *Convex Options*
  991.           -mc1  -mc2  -mc32  -mc34  -mc38
  992.           -margcount  -mnoargcount
  993.           -mlong32  -mlong64
  994.           -mvolatile-cache  -mvolatile-nocache
  995.           
  996.           *AMD29K Options*
  997.           -m29000  -m29050  -mbw  -mnbw  -mdw  -mndw
  998.           -mlarge  -mnormal  -msmall
  999.           -mkernel-registers  -mno-reuse-arg-regs
  1000.           -mno-stack-check  -mno-storem-bug
  1001.           -mreuse-arg-regs  -msoft-float  -mstack-check
  1002.           -mstorem-bug  -muser-registers
  1003.           
  1004.           *ARM Options*
  1005.           -mapcs -m2 -m3 -m6 -mbsd -mxopen -mno-symrename
  1006.           
  1007.           *M88K Options*
  1008.           -m88000  -m88100  -m88110  -mbig-pic
  1009.           -mcheck-zero-division  -mhandle-large-shift
  1010.           -midentify-revision  -mno-check-zero-division
  1011.           -mno-ocs-debug-info  -mno-ocs-frame-position
  1012.           -mno-optimize-arg-area  -mno-serialize-volatile
  1013.           -mno-underscores  -mocs-debug-info
  1014.           -mocs-frame-position  -moptimize-arg-area
  1015.           -mserialize-volatile  -mshort-data-NUM  -msvr3
  1016.           -msvr4  -mtrap-large-shift  -muse-div-instruction
  1017.           -mversion-03.00  -mwarn-passed-structs
  1018.           
  1019.           *RS/6000 and PowerPC Options*
  1020.           -mcpu=CPU  TYPE
  1021.           -mpower  -mno-power  -mpower2  -mno-power2
  1022.           -mpowerpc  -mno-powerpc
  1023.           -mpowerpc-gpopt  -mno-powerpc-gpopt
  1024.           -mpowerpc-gfxopt  -mno-powerpc-gfxopt
  1025.           -mnew-mnemonics  -mno-new-mnemonics
  1026.           -mfull-toc   -mminimal-toc  -mno-fop-in-toc  -mno-sum-in-toc
  1027.           -msoft-float  -mhard-float -mmultiple -mno-multiple
  1028.           -mstring -mno-string -mbit-align -mno-bit-align
  1029.           -mstrict-align -mno-strict-align -mrelocatable -mno-relocatable
  1030.           -mtoc -mno-toc -mtraceback -mno-traceback
  1031.           -mlittle -mlittle-endian -mbig -mbig-endian
  1032.           
  1033.           *RT Options*
  1034.           -mcall-lib-mul  -mfp-arg-in-fpregs  -mfp-arg-in-gregs
  1035.           -mfull-fp-blocks  -mhc-struct-return  -min-line-mul
  1036.           -mminimum-fp-blocks  -mnohc-struct-return
  1037.           
  1038.           *MIPS Options*
  1039.           -mabicalls  -mcpu=CPU  TYPE  -membedded-data
  1040.           -membedded-pic  -mfp32  -mfp64  -mgas  -mgp32  -mgp64
  1041.           -mgpopt  -mhalf-pic  -mhard-float  -mint64 -mips1
  1042.           -mips2 -mips3  -mlong64  -mlong-calls  -mmemcpy
  1043.           -mmips-as  -mmips-tfile  -mno-abicalls
  1044.           -mno-embedded-data  -mno-embedded-pic
  1045.           -mno-gpopt  -mno-long-calls
  1046.           -mno-memcpy  -mno-mips-tfile  -mno-rnames  -mno-stats
  1047.           -mrnames -msoft-float
  1048.           -m4650 -msingle-float -mmad
  1049.           -mstats  -EL  -EB  -G NUM  -nocpp
  1050.           
  1051.           *i386 Options*
  1052.           -m486  -m386 -mieee-fp  -mno-fancy-math-387
  1053.           -mno-fp-ret-in-387  -msoft-float  -msvr3-shlib
  1054.           -mno-wide-multiply -mrtd -malign-double
  1055.           -mreg-alloc=LIST -mregparm=NUM
  1056.           -malign-jumps=NUM -malign-loops=NUM
  1057.           -malign-functions=NUM
  1058.           
  1059.           *HPPA Options*
  1060.           -mdisable-fpregs  -mdisable-indexing  -mfast-indirect-calls
  1061.           -mgas  -mjump-in-delay -mlong-millicode-calls -mno-disable-fpregs
  1062.           -mno-disable-indexing -mno-fast-indirect-calls -mno-gas
  1063.           -mno-jump-in-delay -mno-millicode-long-calls
  1064.           -mno-portable-runtime -mno-soft-float -msoft-float
  1065.           -mpa-risc-1-0  -mpa-risc-1-1  -mportable-runtime -mschedule=LIST
  1066.           
  1067.           *Intel 960 Options*
  1068.           -mCPU TYPE  -masm-compat  -mclean-linkage
  1069.           -mcode-align  -mcomplex-addr  -mleaf-procedures
  1070.           -mic-compat  -mic2.0-compat  -mic3.0-compat
  1071.           -mintel-asm  -mno-clean-linkage  -mno-code-align
  1072.           -mno-complex-addr  -mno-leaf-procedures
  1073.           -mno-old-align  -mno-strict-align  -mno-tail-call
  1074.           -mnumerics  -mold-align  -msoft-float  -mstrict-align
  1075.           -mtail-call
  1076.           
  1077.           *DEC Alpha Options*
  1078.           -mfp-regs  -mno-fp-regs  -mno-soft-float
  1079.           -msoft-float
  1080.           
  1081.           *Clipper Options*
  1082.           -mc300 -mc400
  1083.           
  1084.           *H8/300 Options*
  1085.           -mrelax  -mh
  1086.           
  1087.           *System V Options*
  1088.           -Qy  -Qn  -YP,PATHS  -Ym,DIR
  1089.  
  1090. *Code Generation Options*
  1091.      *Note Options for Code Generation Conventions: Code Gen Options.
  1092.           -fcall-saved-REG  -fcall-used-REG
  1093.           -ffixed-REG  -finhibit-size-directive
  1094.           -fno-common  -fno-ident  -fno-gnu-linker
  1095.           -fpcc-struct-return  -fpic  -fPIC
  1096.           -freg-struct-return  -fshared-data  -fshort-enums
  1097.           -fshort-double  -fvolatile  -fvolatile-global
  1098.           -fverbose-asm -fpack-struct +e0  +e1
  1099.  
  1100. * Menu:
  1101.  
  1102. * Overall Options::     Controlling the kind of output:
  1103.                         an executable, object files, assembler files,
  1104.                         or preprocessed source.
  1105. * C Dialect Options::   Controlling the variant of C language compiled.
  1106. * C++ Dialect Options:: Variations on C++.
  1107. * Warning Options::     How picky should the compiler be?
  1108. * Debugging Options::   Symbol tables, measurements, and debugging dumps.
  1109. * Optimize Options::    How much optimization?
  1110. * Preprocessor Options:: Controlling header files and macro definitions.
  1111.                          Also, getting dependency information for Make.
  1112. * Assembler Options::   Passing options to the assembler.
  1113. * Link Options::        Specifying libraries and so on.
  1114. * Directory Options::   Where to find header files and libraries.
  1115.                         Where to find the compiler executable files.
  1116. * Target Options::      Running a cross-compiler, or an old version of GNU CC.
  1117.  
  1118. 
  1119. File: use,  Node: Overall Options,  Next: Invoking G++,  Prev: Option Summary,  Up: Invoking GCC
  1120.  
  1121. Options Controlling the Kind of Output
  1122. ======================================
  1123.  
  1124.    Compilation can involve up to four stages: preprocessing, compilation
  1125. proper, assembly and linking, always in that order.  The first three
  1126. stages apply to an individual source file, and end by producing an
  1127. object file; linking combines all the object files (those newly
  1128. compiled, and those specified as input) into an executable file.
  1129.  
  1130.    For any given input file, the file name suffix determines what kind
  1131. of compilation is done:
  1132.  
  1133. `FILE.c'
  1134.      C source code which must be preprocessed.
  1135.  
  1136. `FILE.i'
  1137.      C source code which should not be preprocessed.
  1138.  
  1139. `FILE.ii'
  1140.      C++ source code which should not be preprocessed.
  1141.  
  1142. `FILE.m'
  1143.      Objective-C source code.  Note that you must link with the library
  1144.      `libobjc.a' to make an Objective-C program work.
  1145.  
  1146. `FILE.h'
  1147.      C header file (not to be compiled or linked).
  1148.  
  1149. `FILE.cc'
  1150. `FILE.cxx'
  1151. `FILE.cpp'
  1152. `FILE.C'
  1153.      C++ source code which must be preprocessed.  Note that in `.cxx',
  1154.      the last two letters must both be literally `x'.  Likewise, `.C'
  1155.      refers to a literal capital C.
  1156.  
  1157. `FILE.s'
  1158.      Assembler code.
  1159.  
  1160. `FILE.S'
  1161.      Assembler code which must be preprocessed.
  1162.  
  1163. `OTHER'
  1164.      An object file to be fed straight into linking.  Any file name
  1165.      with no recognized suffix is treated this way.
  1166.  
  1167.    You can specify the input language explicitly with the `-x' option:
  1168.  
  1169. `-x LANGUAGE'
  1170.      Specify explicitly the LANGUAGE for the following input files
  1171.      (rather than letting the compiler choose a default based on the
  1172.      file name suffix).  This option applies to all following input
  1173.      files until the next `-x' option.  Possible values for LANGUAGE
  1174.      are:
  1175.           c  objective-c  c++
  1176.           c-header  cpp-output  c++-cpp-output
  1177.           assembler  assembler-with-cpp
  1178.  
  1179. `-x none'
  1180.      Turn off any specification of a language, so that subsequent files
  1181.      are handled according to their file name suffixes (as they are if
  1182.      `-x' has not been used at all).
  1183.  
  1184.    If you only want some of the stages of compilation, you can use `-x'
  1185. (or filename suffixes) to tell `gcc' where to start, and one of the
  1186. options `-c', `-S', or `-E' to say where `gcc' is to stop.  Note that
  1187. some combinations (for example, `-x cpp-output -E' instruct `gcc' to do
  1188. nothing at all.
  1189.  
  1190. `-c'
  1191.      Compile or assemble the source files, but do not link.  The linking
  1192.      stage simply is not done.  The ultimate output is in the form of an
  1193.      object file for each source file.
  1194.  
  1195.      By default, the object file name for a source file is made by
  1196.      replacing the suffix `.c', `.i', `.s', etc., with `.o'.
  1197.  
  1198.      Unrecognized input files, not requiring compilation or assembly,
  1199.      are ignored.
  1200.  
  1201. `-S'
  1202.      Stop after the stage of compilation proper; do not assemble.  The
  1203.      output is in the form of an assembler code file for each
  1204.      non-assembler input file specified.
  1205.  
  1206.      By default, the assembler file name for a source file is made by
  1207.      replacing the suffix `.c', `.i', etc., with `.s'.
  1208.  
  1209.      Input files that don't require compilation are ignored.
  1210.  
  1211. `-E'
  1212.      Stop after the preprocessing stage; do not run the compiler
  1213.      proper.  The output is in the form of preprocessed source code,
  1214.      which is sent to the standard output.
  1215.  
  1216.      Input files which don't require preprocessing are ignored.
  1217.  
  1218. `-o FILE'
  1219.      Place output in file FILE.  This applies regardless to whatever
  1220.      sort of output is being produced, whether it be an executable file,
  1221.      an object file, an assembler file or preprocessed C code.
  1222.  
  1223.      Since only one output file can be specified, it does not make
  1224.      sense to use `-o' when compiling more than one input file, unless
  1225.      you are producing an executable file as output.
  1226.  
  1227.      If `-o' is not specified, the default is to put an executable file
  1228.      in `a.out', the object file for `SOURCE.SUFFIX' in `SOURCE.o', its
  1229.      assembler file in `SOURCE.s', and all preprocessed C source on
  1230.      standard output.
  1231.  
  1232. `-v'
  1233.      Print (on standard error output) the commands executed to run the
  1234.      stages of compilation.  Also print the version number of the
  1235.      compiler driver program and of the preprocessor and the compiler
  1236.      proper.
  1237.  
  1238. `-pipe'
  1239.      Use pipes rather than temporary files for communication between the
  1240.      various stages of compilation.  This fails to work on some systems
  1241.      where the assembler is unable to read from a pipe; but the GNU
  1242.      assembler has no trouble.
  1243.  
  1244. 
  1245. File: use,  Node: Invoking G++,  Next: C Dialect Options,  Prev: Overall Options,  Up: Invoking GCC
  1246.  
  1247. Compiling C++ Programs
  1248. ======================
  1249.  
  1250.    C++ source files conventionally use one of the suffixes `.C', `.cc',
  1251. `cpp', or `.cxx'; preprocessed C++ files use the suffix `.ii'.  GNU CC
  1252. recognizes files with these names and compiles them as C++ programs
  1253. even if you call the compiler the same way as for compiling C programs
  1254. (usually with the name `gcc').
  1255.  
  1256.    However, C++ programs often require class libraries as well as a
  1257. compiler that understands the C++ language--and under some
  1258. circumstances, you might want to compile programs from standard input,
  1259. or otherwise without a suffix that flags them as C++ programs.  `g++'
  1260. is a program that calls GNU CC with the default language set to C++,
  1261. and automatically specifies linking against the GNU class library
  1262. libg++.  (1) On many systems, the script `g++' is also installed with
  1263. the name `c++'.
  1264.  
  1265.    When you compile C++ programs, you may specify many of the same
  1266. command-line options that you use for compiling programs in any
  1267. language; or command-line options meaningful for C and related
  1268. languages; or options that are meaningful only for C++ programs.  *Note
  1269. Options Controlling C Dialect: C Dialect Options, for explanations of
  1270. options for languages related to C.  *Note Options Controlling C++
  1271. Dialect: C++ Dialect Options, for explanations of options that are
  1272. meaningful only for C++ programs.
  1273.  
  1274.    ---------- Footnotes ----------
  1275.  
  1276.    (1)  Prior to release 2 of the compiler, there was a separate `g++'
  1277. compiler.  That version was based on GNU CC, but not integrated with
  1278. it.  Versions of `g++' with a `1.XX' version number--for example, `g++'
  1279. version 1.37 or 1.42--are much less reliable than the versions
  1280. integrated with GCC 2.  Moreover, combining G++ `1.XX' with a version 2
  1281. GCC will simply not work.
  1282.  
  1283. 
  1284. File: use,  Node: C Dialect Options,  Next: C++ Dialect Options,  Prev: Invoking G++,  Up: Invoking GCC
  1285.  
  1286. Options Controlling C Dialect
  1287. =============================
  1288.  
  1289.    The following options control the dialect of C (or languages derived
  1290. from C, such as C++ and Objective C) that the compiler accepts:
  1291.  
  1292. `-ansi'
  1293.      Support all ANSI standard C programs.
  1294.  
  1295.      This turns off certain features of GNU C that are incompatible
  1296.      with ANSI C, such as the `asm', `inline' and `typeof' keywords, and
  1297.      predefined macros such as `unix' and `vax' that identify the type
  1298.      of system you are using.  It also enables the undesirable and
  1299.      rarely used ANSI trigraph feature, and disallows `$' as part of
  1300.      identifiers.
  1301.  
  1302.      The alternate keywords `__asm__', `__extension__', `__inline__'
  1303.      and `__typeof__' continue to work despite `-ansi'.  You would not
  1304.      want to use them in an ANSI C program, of course, but it is useful
  1305.      to put them in header files that might be included in compilations
  1306.      done with `-ansi'.  Alternate predefined macros such as `__unix__'
  1307.      and `__vax__' are also available, with or without `-ansi'.
  1308.  
  1309.      The `-ansi' option does not cause non-ANSI programs to be rejected
  1310.      gratuitously.  For that, `-pedantic' is required in addition to
  1311.      `-ansi'.  *Note Warning Options::.
  1312.  
  1313.      The macro `__STRICT_ANSI__' is predefined when the `-ansi' option
  1314.      is used.  Some header files may notice this macro and refrain from
  1315.      declaring certain functions or defining certain macros that the
  1316.      ANSI standard doesn't call for; this is to avoid interfering with
  1317.      any programs that might use these names for other things.
  1318.  
  1319.      The functions `alloca', `abort', `exit', and `_exit' are not
  1320.      builtin functions when `-ansi' is used.
  1321.  
  1322. `-fno-asm'
  1323.      Do not recognize `asm', `inline' or `typeof' as a keyword, so that
  1324.      code can use these words as identifiers.  You can use the keywords
  1325.      `__asm__', `__inline__' and `__typeof__' instead.  `-ansi' implies
  1326.      `-fno-asm'.
  1327.  
  1328.      In C++, this switch only affects the `typeof' keyword, since `asm'
  1329.      and `inline' are standard keywords.  You may want to use the
  1330.      `-fno-gnu-keywords' flag instead, as it also disables the other,
  1331.      C++-specific, extension keywords such as `headof'.
  1332.  
  1333. `-fno-builtin'
  1334.      Don't recognize builtin functions that do not begin with two
  1335.      leading underscores.  Currently, the functions affected include
  1336.      `abort', `abs', `alloca', `cos', `exit', `fabs', `ffs', `labs',
  1337.      `memcmp', `memcpy', `sin', `sqrt', `strcmp', `strcpy', and
  1338.      `strlen'.
  1339.  
  1340.      GCC normally generates special code to handle certain builtin
  1341.      functions more efficiently; for instance, calls to `alloca' may
  1342.      become single instructions that adjust the stack directly, and
  1343.      calls to `memcpy' may become inline copy loops.  The resulting
  1344.      code is often both smaller and faster, but since the function
  1345.      calls no longer appear as such, you cannot set a breakpoint on
  1346.      those calls, nor can you change the behavior of the functions by
  1347.      linking with a different library.
  1348.  
  1349.      The `-ansi' option prevents `alloca' and `ffs' from being builtin
  1350.      functions, since these functions do not have an ANSI standard
  1351.      meaning.
  1352.  
  1353. `-trigraphs'
  1354.      Support ANSI C trigraphs.  You don't want to know about this
  1355.      brain-damage.  The `-ansi' option implies `-trigraphs'.
  1356.  
  1357. `-traditional'
  1358.      Attempt to support some aspects of traditional C compilers.
  1359.      Specifically:
  1360.  
  1361.         * All `extern' declarations take effect globally even if they
  1362.           are written inside of a function definition.  This includes
  1363.           implicit declarations of functions.
  1364.  
  1365.         * The newer keywords `typeof', `inline', `signed', `const' and
  1366.           `volatile' are not recognized.  (You can still use the
  1367.           alternative keywords such as `__typeof__', `__inline__', and
  1368.           so on.)
  1369.  
  1370.         * Comparisons between pointers and integers are always allowed.
  1371.  
  1372.         * Integer types `unsigned short' and `unsigned char' promote to
  1373.           `unsigned int'.
  1374.  
  1375.         * Out-of-range floating point literals are not an error.
  1376.  
  1377.         * Certain constructs which ANSI regards as a single invalid
  1378.           preprocessing number, such as `0xe-0xd', are treated as
  1379.           expressions instead.
  1380.  
  1381.         * String "constants" are not necessarily constant; they are
  1382.           stored in writable space, and identical looking constants are
  1383.           allocated separately.  (This is the same as the effect of
  1384.           `-fwritable-strings'.)
  1385.  
  1386.         * All automatic variables not declared `register' are preserved
  1387.           by `longjmp'.  Ordinarily, GNU C follows ANSI C: automatic
  1388.           variables not declared `volatile' may be clobbered.
  1389.  
  1390.         * The character escape sequences `\x' and `\a' evaluate as the
  1391.           literal characters `x' and `a' respectively.  Without
  1392.           `-traditional', `\x' is a prefix for the hexadecimal
  1393.           representation of a character, and `\a' produces a bell.
  1394.  
  1395.         * In C++ programs, assignment to `this' is permitted with
  1396.           `-traditional'.  (The option `-fthis-is-variable' also has
  1397.           this effect.)
  1398.  
  1399.      You may wish to use `-fno-builtin' as well as `-traditional' if
  1400.      your program uses names that are normally GNU C builtin functions
  1401.      for other purposes of its own.
  1402.  
  1403.      You cannot use `-traditional' if you include any header files that
  1404.      rely on ANSI C features.  Some vendors are starting to ship
  1405.      systems with ANSI C header files and you cannot use `-traditional'
  1406.      on such systems to compile files that include any system headers.
  1407.  
  1408. `'
  1409.      In the preprocessor, comments convert to nothing at all, rather
  1410.      than to a space.  This allows traditional token concatenation.
  1411.  
  1412. `'
  1413.      In preprocessing directive, the `#' symbol must appear as the first
  1414.      character of a line.
  1415.  
  1416. `'
  1417.      In the preprocessor, macro arguments are recognized within string
  1418.      constants in a macro definition (and their values are stringified,
  1419.      though without additional quote marks, when they appear in such a
  1420.      context).  The preprocessor always considers a string constant to
  1421.      end at a newline.
  1422.  
  1423. `'
  1424.      The predefined macro `__STDC__' is not defined when you use
  1425.      `-traditional', but `__GNUC__' is (since the GNU extensions which
  1426.      `__GNUC__' indicates are not affected by `-traditional').  If you
  1427.      need to write header files that work differently depending on
  1428.      whether `-traditional' is in use, by testing both of these
  1429.      predefined macros you can distinguish four situations: GNU C,
  1430.      traditional GNU C, other ANSI C compilers, and other old C
  1431.      compilers.  The predefined macro `__STDC_VERSION__' is also not
  1432.      defined when you use `-traditional'.  *Note Standard Predefined
  1433.      Macros: (cpp.info)Standard Predefined, for more discussion of
  1434.      these and other predefined macros.
  1435.  
  1436. `'
  1437.      The preprocessor considers a string constant to end at a newline
  1438.      (unless the newline is escaped with `\').  (Without `-traditional',
  1439.      string constants can contain the newline character as typed.)
  1440.  
  1441. `-traditional-cpp'
  1442.      Attempt to support some aspects of traditional C preprocessors.
  1443.      This includes the last five items in the table immediately above,
  1444.      but none of the other effects of `-traditional'.
  1445.  
  1446. `-fcond-mismatch'
  1447.      Allow conditional expressions with mismatched types in the second
  1448.      and third arguments.  The value of such an expression is void.
  1449.  
  1450. `-funsigned-char'
  1451.      Let the type `char' be unsigned, like `unsigned char'.
  1452.  
  1453.      Each kind of machine has a default for what `char' should be.  It
  1454.      is either like `unsigned char' by default or like `signed char' by
  1455.      default.
  1456.  
  1457.      Ideally, a portable program should always use `signed char' or
  1458.      `unsigned char' when it depends on the signedness of an object.
  1459.      But many programs have been written to use plain `char' and expect
  1460.      it to be signed, or expect it to be unsigned, depending on the
  1461.      machines they were written for.  This option, and its inverse, let
  1462.      you make such a program work with the opposite default.
  1463.  
  1464.      The type `char' is always a distinct type from each of `signed
  1465.      char' or `unsigned char', even though its behavior is always just
  1466.      like one of those two.
  1467.  
  1468. `-fsigned-char'
  1469.      Let the type `char' be signed, like `signed char'.
  1470.  
  1471.      Note that this is equivalent to `-fno-unsigned-char', which is the
  1472.      negative form of `-funsigned-char'.  Likewise, the option
  1473.      `-fno-signed-char' is equivalent to `-funsigned-char'.
  1474.  
  1475. `-fsigned-bitfields'
  1476. `-funsigned-bitfields'
  1477. `-fno-signed-bitfields'
  1478. `-fno-unsigned-bitfields'
  1479.      These options control whether a bitfield is signed or unsigned,
  1480.      when the declaration does not use either `signed' or `unsigned'.
  1481.      By default, such a bitfield is signed, because this is consistent:
  1482.      the basic integer types such as `int' are signed types.
  1483.  
  1484.      However, when `-traditional' is used, bitfields are all unsigned
  1485.      no matter what.
  1486.  
  1487. `-fwritable-strings'
  1488.      Store string constants in the writable data segment and don't
  1489.      uniquize them.  This is for compatibility with old programs which
  1490.      assume they can write into string constants.  The option
  1491.      `-traditional' also has this effect.
  1492.  
  1493.      Writing into string constants is a very bad idea; "constants"
  1494.      should be constant.
  1495.  
  1496. `-fallow-single-precision'
  1497.      Do not promote single precision math operations to double
  1498.      precision, even when compiling with `-traditional'.
  1499.  
  1500.      Traditional K&R C promotes all floating point operations to double
  1501.      precision, regardless of the sizes of the operands.   On the
  1502.      architecture for which you are compiling, single precision may be
  1503.      faster than double precision.   If you must use `-traditional',
  1504.      but want to use single precision operations when the operands are
  1505.      single precision, use this option.   This option has no effect
  1506.      when compiling with ANSI or GNU C conventions (the default).
  1507.  
  1508. 
  1509. File: use,  Node: C++ Dialect Options,  Next: Warning Options,  Prev: C Dialect Options,  Up: Invoking GCC
  1510.  
  1511. Options Controlling C++ Dialect
  1512. ===============================
  1513.  
  1514.    This section describes the command-line options that are only
  1515. meaningful for C++ programs; but you can also use most of the GNU
  1516. compiler options regardless of what language your program is in.  For
  1517. example, you might compile a file `firstClass.C' like this:
  1518.  
  1519.      g++ -g -felide-constructors -O -c firstClass.C
  1520.  
  1521. In this example, only `-felide-constructors' is an option meant only
  1522. for C++ programs; you can use the other options with any language
  1523. supported by GNU CC.
  1524.  
  1525.    Here is a list of options that are *only* for compiling C++ programs:
  1526.  
  1527. `-fno-access-control'
  1528.      Turn off all access checking.  This switch is mainly useful for
  1529.      working around bugs in the access control code.
  1530.  
  1531. `-fall-virtual'
  1532.      Treat all possible member functions as virtual, implicitly.  All
  1533.      member functions (except for constructor functions and `new' or
  1534.      `delete' member operators) are treated as virtual functions of the
  1535.      class where they appear.
  1536.  
  1537.      This does not mean that all calls to these member functions will
  1538.      be made through the internal table of virtual functions.  Under
  1539.      some circumstances, the compiler can determine that a call to a
  1540.      given virtual function can be made directly; in these cases the
  1541.      calls are direct in any case.
  1542.  
  1543. `-fcheck-new'
  1544.      Check that the pointer returned by `operator new' is non-null
  1545.      before attempting to modify the storage allocated.  The current
  1546.      Working Paper requires that `operator new' never return a null
  1547.      pointer, so this check is normally unnecessary.
  1548.  
  1549. `-fconserve-space'
  1550.      Put uninitialized or runtime-initialized global variables into the
  1551.      common segment, as C does.  This saves space in the executable at
  1552.      the cost of not diagnosing duplicate definitions.  If you compile
  1553.      with this flag and your program mysteriously crashes after
  1554.      `main()' has completed, you may have an object that is being
  1555.      destroyed twice because two definitions were merged.
  1556.  
  1557. `-fdollars-in-identifiers'
  1558.      Accept `$' in identifiers.  You can also explicitly prohibit use of
  1559.      `$' with the option `-fno-dollars-in-identifiers'.  (GNU C++
  1560.      allows `$' by default on some target systems but not others.)
  1561.      Traditional C allowed the character `$' to form part of
  1562.      identifiers.  However, ANSI C and C++ forbid `$' in identifiers.
  1563.  
  1564. `-fenum-int-equiv'
  1565.      Anachronistically permit implicit conversion of `int' to
  1566.      enumeration types.  Current C++ allows conversion of `enum' to
  1567.      `int', but not the other way around.
  1568.  
  1569. `-fexternal-templates'
  1570.      Cause template instantiations to obey `#pragma interface' and
  1571.      `implementation'; template instances are emitted or not according
  1572.      to the location of the template definition.  *Note Template
  1573.      Instantiation::, for more information.
  1574.  
  1575. `-falt-external-templates'
  1576.      Similar to -fexternal-templates, but template instances are
  1577.      emitted or not according to the place where they are first
  1578.      instantiated.  *Note Template Instantiation::, for more
  1579.      information.
  1580.  
  1581. `-fno-gnu-keywords'
  1582.      Do not recognize `classof', `headof', `signature', `sigof' or
  1583.      `typeof' as a keyword, so that code can use these words as
  1584.      identifiers.  You can use the keywords `__classof__',
  1585.      `__headof__', `__signature__', `__sigof__', and `__typeof__'
  1586.      instead.  `-ansi' implies `-fno-gnu-keywords'.
  1587.  
  1588. `-fno-implicit-templates'
  1589.      Never emit code for templates which are instantiated implicitly
  1590.      (i.e. by use); only emit code for explicit instantiations.  *Note
  1591.      Template Instantiation::, for more information.
  1592.  
  1593. `-fhandle-signatures'
  1594.      Recognize the `signature' and `sigof' keywords for specifying
  1595.      abstract types.  The default (`-fno-handle-signatures') is not to
  1596.      recognize them.  *Note Type Abstraction using Signatures: C++
  1597.      Signatures.
  1598.  
  1599. `-fhuge-objects'
  1600.      Support virtual function calls for objects that exceed the size
  1601.      representable by a `short int'.  Users should not use this flag by
  1602.      default; if you need to use it, the compiler will tell you so.  If
  1603.      you compile any of your code with this flag, you must compile
  1604.      *all* of your code with this flag (including libg++, if you use
  1605.      it).
  1606.  
  1607.      This flag is not useful when compiling with -fvtable-thunks.
  1608.  
  1609. `-fno-implement-inlines'
  1610.      To save space, do not emit out-of-line copies of inline functions
  1611.      controlled by `#pragma implementation'.  This will cause linker
  1612.      errors if these functions are not inlined everywhere they are
  1613.      called.
  1614.  
  1615. `-fmemoize-lookups'
  1616. `-fsave-memoized'
  1617.      Use heuristics to compile faster.  These heuristics are not
  1618.      enabled by default, since they are only effective for certain
  1619.      input files.  Other input files compile more slowly.
  1620.  
  1621.      The first time the compiler must build a call to a member function
  1622.      (or reference to a data member), it must (1) determine whether the
  1623.      class implements member functions of that name; (2) resolve which
  1624.      member function to call (which involves figuring out what sorts of
  1625.      type conversions need to be made); and (3) check the visibility of
  1626.      the member function to the caller.  All of this adds up to slower
  1627.      compilation.  Normally, the second time a call is made to that
  1628.      member function (or reference to that data member), it must go
  1629.      through the same lengthy process again.  This means that code like
  1630.      this:
  1631.  
  1632.           cout << "This " << p << " has " << n << " legs.\n";
  1633.  
  1634.      makes six passes through all three steps.  By using a software
  1635.      cache, a "hit" significantly reduces this cost.  Unfortunately,
  1636.      using the cache introduces another layer of mechanisms which must
  1637.      be implemented, and so incurs its own overhead.
  1638.      `-fmemoize-lookups' enables the software cache.
  1639.  
  1640.      Because access privileges (visibility) to members and member
  1641.      functions may differ from one function context to the next, G++
  1642.      may need to flush the cache.  With the `-fmemoize-lookups' flag,
  1643.      the cache is flushed after every function that is compiled.  The
  1644.      `-fsave-memoized' flag enables the same software cache, but when
  1645.      the compiler determines that the context of the last function
  1646.      compiled would yield the same access privileges of the next
  1647.      function to compile, it preserves the cache.  This is most helpful
  1648.      when defining many member functions for the same class: with the
  1649.      exception of member functions which are friends of other classes,
  1650.      each member function has exactly the same access privileges as
  1651.      every other, and the cache need not be flushed.
  1652.  
  1653.      The code that implements these flags has rotted; you should
  1654.      probably avoid using them.
  1655.  
  1656. `-fstrict-prototype'
  1657.      Within an `extern "C"' linkage specification, treat a function
  1658.      declaration with no arguments, such as `int foo ();', as declaring
  1659.      the function to take no arguments.  Normally, such a declaration
  1660.      means that the function `foo' can take any combination of
  1661.      arguments, as in C.  `-pedantic' implies `-fstrict-prototype'
  1662.      unless overridden with `-fno-strict-prototype'.
  1663.  
  1664.      This flag no longer affects declarations with C++ linkage.
  1665.  
  1666. `-fno-nonnull-objects'
  1667.      Don't assume that a reference is initialized to refer to a valid
  1668.      object.  Although the current C++ Working Paper prohibits null
  1669.      references, some old code may rely on them, and you can use
  1670.      `-fno-nonnull-objects' to turn on checking.
  1671.  
  1672.      At the moment, the compiler only does this checking for
  1673.      conversions to virtual base classes.
  1674.  
  1675. `-foperator-names'
  1676.      Recognize the operator name keywords `and', `bitand', `bitor',
  1677.      `compl', `not', `or' and `xor' as synonyms for the symbols they
  1678.      refer to.  `-ansi' implies `-foperator-names'.
  1679.  
  1680. `-fthis-is-variable'
  1681.      Permit assignment to `this'.  The incorporation of user-defined
  1682.      free store management into C++ has made assignment to `this' an
  1683.      anachronism.  Therefore, by default it is invalid to assign to
  1684.      `this' within a class member function; that is, GNU C++ treats
  1685.      `this' in a member function of class `X' as a non-lvalue of type
  1686.      `X *'.  However, for backwards compatibility, you can make it
  1687.      valid with `-fthis-is-variable'.
  1688.  
  1689. `-fvtable-thunks'
  1690.      Use `thunks' to implement the virtual function dispatch table
  1691.      (`vtable').  The traditional (cfront-style) approach to
  1692.      implementing vtables was to store a pointer to the function and two
  1693.      offsets for adjusting the `this' pointer at the call site.  Newer
  1694.      implementations store a single pointer to a `thunk' function which
  1695.      does any necessary adjustment and then calls the target function.
  1696.  
  1697.      This option also enables a heuristic for controlling emission of
  1698.      vtables; if a class has any non-inline virtual functions, the
  1699.      vtable will be emitted in the translation unit containing the
  1700.      first one of those.
  1701.  
  1702. `-nostdinc++'
  1703.      Do not search for header files in the standard directories
  1704.      specific to C++, but do still search the other standard
  1705.      directories.  (This option is used when building libg++.)
  1706.  
  1707. `-traditional'
  1708.      For C++ programs (in addition to the effects that apply to both C
  1709.      and C++), this has the same effect as `-fthis-is-variable'.  *Note
  1710.      Options Controlling C Dialect: C Dialect Options.
  1711.  
  1712.    In addition, these optimization, warning, and code generation options
  1713. have meanings only for C++ programs:
  1714.  
  1715. `-fno-default-inline'
  1716.      Do not assume `inline' for functions defined inside a class scope.
  1717.      *Note Options That Control Optimization: Optimize Options.
  1718.  
  1719. `-Wenum-clash'
  1720. `-Woverloaded-virtual'
  1721. `-Wtemplate-debugging'
  1722.      Warnings that apply only to C++ programs.  *Note Options to
  1723.      Request or Suppress Warnings: Warning Options.
  1724.  
  1725. `+eN'
  1726.      Control how virtual function definitions are used, in a fashion
  1727.      compatible with `cfront' 1.x.  *Note Options for Code Generation
  1728.      Conventions: Code Gen Options.
  1729.  
  1730. 
  1731. File: use,  Node: Warning Options,  Next: Debugging Options,  Prev: C++ Dialect Options,  Up: Invoking GCC
  1732.  
  1733. Options to Request or Suppress Warnings
  1734. =======================================
  1735.  
  1736.    Warnings are diagnostic messages that report constructions which are
  1737. not inherently erroneous but which are risky or suggest there may have
  1738. been an error.
  1739.  
  1740.    You can request many specific warnings with options beginning `-W',
  1741. for example `-Wimplicit' to request warnings on implicit declarations.
  1742. Each of these specific warning options also has a negative form
  1743. beginning `-Wno-' to turn off warnings; for example, `-Wno-implicit'.
  1744. This manual lists only one of the two forms, whichever is not the
  1745. default.
  1746.  
  1747.    These options control the amount and kinds of warnings produced by
  1748. GNU CC:
  1749.  
  1750. `-fsyntax-only'
  1751.      Check the code for syntax errors, but don't do anything beyond
  1752.      that.
  1753.  
  1754. `-pedantic'
  1755.      Issue all the warnings demanded by strict ANSI standard C; reject
  1756.      all programs that use forbidden extensions.
  1757.  
  1758.      Valid ANSI standard C programs should compile properly with or
  1759.      without this option (though a rare few will require `-ansi').
  1760.      However, without this option, certain GNU extensions and
  1761.      traditional C features are supported as well.  With this option,
  1762.      they are rejected.
  1763.  
  1764.      `-pedantic' does not cause warning messages for use of the
  1765.      alternate keywords whose names begin and end with `__'.  Pedantic
  1766.      warnings are also disabled in the expression that follows
  1767.      `__extension__'.  However, only system header files should use
  1768.      these escape routes; application programs should avoid them.
  1769.      *Note Alternate Keywords::.
  1770.  
  1771.      This option is not intended to be useful; it exists only to satisfy
  1772.      pedants who would otherwise claim that GNU CC fails to support the
  1773.      ANSI standard.
  1774.  
  1775.      Some users try to use `-pedantic' to check programs for strict ANSI
  1776.      C conformance.  They soon find that it does not do quite what they
  1777.      want: it finds some non-ANSI practices, but not all--only those
  1778.      for which ANSI C *requires* a diagnostic.
  1779.  
  1780.      A feature to report any failure to conform to ANSI C might be
  1781.      useful in some instances, but would require considerable
  1782.      additional work and would be quite different from `-pedantic'.  We
  1783.      recommend, rather, that users take advantage of the extensions of
  1784.      GNU C and disregard the limitations of other compilers.  Aside
  1785.      from certain supercomputers and obsolete small machines, there is
  1786.      less and less reason ever to use any other C compiler other than
  1787.      for bootstrapping GNU CC.
  1788.  
  1789. `-pedantic-errors'
  1790.      Like `-pedantic', except that errors are produced rather than
  1791.      warnings.
  1792.  
  1793. `-w'
  1794.      Inhibit all warning messages.
  1795.  
  1796. `-Wno-import'
  1797.      Inhibit warning messages about the use of `#import'.
  1798.  
  1799. `-Wchar-subscripts'
  1800.      Warn if an array subscript has type `char'.  This is a common cause
  1801.      of error, as programmers often forget that this type is signed on
  1802.      some machines.
  1803.  
  1804. `-Wcomment'
  1805.      Warn whenever a comment-start sequence `/*' appears in a comment.
  1806.  
  1807. `-Wformat'
  1808.      Check calls to `printf' and `scanf', etc., to make sure that the
  1809.      arguments supplied have types appropriate to the format string
  1810.      specified.
  1811.  
  1812. `-Wimplicit'
  1813.      Warn whenever a function or parameter is implicitly declared.
  1814.  
  1815. `-Wparentheses'
  1816.      Warn if parentheses are omitted in certain contexts, such as when
  1817.      there is an assignment in a context where a truth value is
  1818.      expected, or when operators are nested whose precedence people
  1819.      often get confused about.
  1820.  
  1821. `-Wreturn-type'
  1822.      Warn whenever a function is defined with a return-type that
  1823.      defaults to `int'.  Also warn about any `return' statement with no
  1824.      return-value in a function whose return-type is not `void'.
  1825.  
  1826. `-Wswitch'
  1827.      Warn whenever a `switch' statement has an index of enumeral type
  1828.      and lacks a `case' for one or more of the named codes of that
  1829.      enumeration.  (The presence of a `default' label prevents this
  1830.      warning.)  `case' labels outside the enumeration range also
  1831.      provoke warnings when this option is used.
  1832.  
  1833. `-Wtrigraphs'
  1834.      Warn if any trigraphs are encountered (assuming they are enabled).
  1835.  
  1836. `-Wunused'
  1837.      Warn whenever a variable is unused aside from its declaration,
  1838.      whenever a function is declared static but never defined, whenever
  1839.      a label is declared but not used, and whenever a statement
  1840.      computes a result that is explicitly not used.
  1841.  
  1842.      To suppress this warning for an expression, simply cast it to
  1843.      void.  For unused variables and parameters, use the `unused'
  1844.      attribute (*note Variable Attributes::.).
  1845.  
  1846. `-Wuninitialized'
  1847.      An automatic variable is used without first being initialized.
  1848.  
  1849.      These warnings are possible only in optimizing compilation,
  1850.      because they require data flow information that is computed only
  1851.      when optimizing.  If you don't specify `-O', you simply won't get
  1852.      these warnings.
  1853.  
  1854.      These warnings occur only for variables that are candidates for
  1855.      register allocation.  Therefore, they do not occur for a variable
  1856.      that is declared `volatile', or whose address is taken, or whose
  1857.      size is other than 1, 2, 4 or 8 bytes.  Also, they do not occur for
  1858.      structures, unions or arrays, even when they are in registers.
  1859.  
  1860.      Note that there may be no warning about a variable that is used
  1861.      only to compute a value that itself is never used, because such
  1862.      computations may be deleted by data flow analysis before the
  1863.      warnings are printed.
  1864.  
  1865.      These warnings are made optional because GNU CC is not smart
  1866.      enough to see all the reasons why the code might be correct
  1867.      despite appearing to have an error.  Here is one example of how
  1868.      this can happen:
  1869.  
  1870.           {
  1871.             int x;
  1872.             switch (y)
  1873.               {
  1874.               case 1: x = 1;
  1875.                 break;
  1876.               case 2: x = 4;
  1877.                 break;
  1878.               case 3: x = 5;
  1879.               }
  1880.             foo (x);
  1881.           }
  1882.  
  1883.      If the value of `y' is always 1, 2 or 3, then `x' is always
  1884.      initialized, but GNU CC doesn't know this.  Here is another common
  1885.      case:
  1886.  
  1887.           {
  1888.             int save_y;
  1889.             if (change_y) save_y = y, y = new_y;
  1890.             ...
  1891.             if (change_y) y = save_y;
  1892.           }
  1893.  
  1894.      This has no bug because `save_y' is used only if it is set.
  1895.  
  1896.      Some spurious warnings can be avoided if you declare all the
  1897.      functions you use that never return as `noreturn'.  *Note Function
  1898.      Attributes::.
  1899.  
  1900. `-Wenum-clash'
  1901.      Warn about conversion between different enumeration types.  (C++
  1902.      only).
  1903.  
  1904. `-Wreorder (C++ only)'
  1905.      Warn when the order of member initializers given in the code does
  1906.      not match the order in which they must be executed.  For instance:
  1907.  
  1908.           struct A {
  1909.             int i;
  1910.             int j;
  1911.             A(): j (0), i (1) { }
  1912.           };
  1913.  
  1914.      Here the compiler will warn that the member initializers for `i'
  1915.      and `j' will be rearranged to match the declaration order of the
  1916.      members.
  1917.  
  1918. `-Wtemplate-debugging'
  1919.      When using templates in a C++ program, warn if debugging is not yet
  1920.      fully available (C++ only).
  1921.  
  1922. `-Wall'
  1923.      All of the above `-W' options combined.  These are all the options
  1924.      which pertain to usage that we recommend avoiding and that we
  1925.      believe is easy to avoid, even in conjunction with macros.
  1926.  
  1927.    The remaining `-W...' options are not implied by `-Wall' because
  1928. they warn about constructions that we consider reasonable to use, on
  1929. occasion, in clean programs.
  1930.  
  1931. `-W'
  1932.      Print extra warning messages for these events:
  1933.  
  1934.         * A nonvolatile automatic variable might be changed by a call to
  1935.           `longjmp'.  These warnings as well are possible only in
  1936.           optimizing compilation.
  1937.  
  1938.           The compiler sees only the calls to `setjmp'.  It cannot know
  1939.           where `longjmp' will be called; in fact, a signal handler
  1940.           could call it at any point in the code.  As a result, you may
  1941.           get a warning even when there is in fact no problem because
  1942.           `longjmp' cannot in fact be called at the place which would
  1943.           cause a problem.
  1944.  
  1945.         * A function can return either with or without a value.
  1946.           (Falling off the end of the function body is considered
  1947.           returning without a value.)  For example, this function would
  1948.           evoke such a warning:
  1949.  
  1950.                foo (a)
  1951.                {
  1952.                  if (a > 0)
  1953.                    return a;
  1954.                }
  1955.  
  1956.         * An expression-statement contains no side effects.
  1957.  
  1958.         * An unsigned value is compared against zero with `<' or `<='.
  1959.  
  1960.         * A comparison like `x<=y<=z' appears; this is equivalent to
  1961.           `(x<=y ? 1 : 0) <= z', which is a different interpretation
  1962.           from that of ordinary mathematical notation.
  1963.  
  1964.         * Storage-class specifiers like `static' are not the first
  1965.           things in a declaration.  According to the C Standard, this
  1966.           usage is obsolescent.
  1967.  
  1968.         * If `-Wall' or `-Wunused' is also specified, warn about unused
  1969.           arguments.
  1970.  
  1971.         * An aggregate has a partly bracketed initializer.  For
  1972.           example, the following code would evoke such a warning,
  1973.           because braces are missing around the initializer for `x.h':
  1974.  
  1975.                struct s { int f, g; };
  1976.                struct t { struct s h; int i; };
  1977.                struct t x = { 1, 2, 3 };
  1978.  
  1979. `-Wtraditional'
  1980.      Warn about certain constructs that behave differently in
  1981.      traditional and ANSI C.
  1982.  
  1983.         * Macro arguments occurring within string constants in the
  1984.           macro body.  These would substitute the argument in
  1985.           traditional C, but are part of the constant in ANSI C.
  1986.  
  1987.         * A function declared external in one block and then used after
  1988.           the end of the block.
  1989.  
  1990.         * A `switch' statement has an operand of type `long'.
  1991.  
  1992. `-Wshadow'
  1993.      Warn whenever a local variable shadows another local variable.
  1994.  
  1995. `-Wid-clash-LEN'
  1996.      Warn whenever two distinct identifiers match in the first LEN
  1997.      characters.  This may help you prepare a program that will compile
  1998.      with certain obsolete, brain-damaged compilers.
  1999.  
  2000. `-Wlarger-than-LEN'
  2001.      Warn whenever an object of larger than LEN bytes is defined.
  2002.  
  2003. `-Wpointer-arith'
  2004.      Warn about anything that depends on the "size of" a function type
  2005.      or of `void'.  GNU C assigns these types a size of 1, for
  2006.      convenience in calculations with `void *' pointers and pointers to
  2007.      functions.
  2008.  
  2009. `-Wbad-function-cast'
  2010.      Warn whenever a function call is cast to a non-matching type.  For
  2011.      example, warn if `int malloc()' is cast to `anything *'.
  2012.  
  2013. `-Wcast-qual'
  2014.      Warn whenever a pointer is cast so as to remove a type qualifier
  2015.      from the target type.  For example, warn if a `const char *' is
  2016.      cast to an ordinary `char *'.
  2017.  
  2018. `-Wcast-align'
  2019.      Warn whenever a pointer is cast such that the required alignment
  2020.      of the target is increased.  For example, warn if a `char *' is
  2021.      cast to an `int *' on machines where integers can only be accessed
  2022.      at two- or four-byte boundaries.
  2023.  
  2024. `-Wwrite-strings'
  2025.      Give string constants the type `const char[LENGTH]' so that
  2026.      copying the address of one into a non-`const' `char *' pointer
  2027.      will get a warning.  These warnings will help you find at compile
  2028.      time code that can try to write into a string constant, but only
  2029.      if you have been very careful about using `const' in declarations
  2030.      and prototypes.  Otherwise, it will just be a nuisance; this is
  2031.      why we did not make `-Wall' request these warnings.
  2032.  
  2033. `-Wconversion'
  2034.      Warn if a prototype causes a type conversion that is different
  2035.      from what would happen to the same argument in the absence of a
  2036.      prototype.  This includes conversions of fixed point to floating
  2037.      and vice versa, and conversions changing the width or signedness
  2038.      of a fixed point argument except when the same as the default
  2039.      promotion.
  2040.  
  2041.      Also, warn if a negative integer constant expression is implicitly
  2042.      converted to an unsigned type.  For example, warn about the
  2043.      assignment `x = -1' if `x' is unsigned.  But do not warn about
  2044.      explicit casts like `(unsigned) -1'.
  2045.  
  2046. `-Waggregate-return'
  2047.      Warn if any functions that return structures or unions are defined
  2048.      or called.  (In languages where you can return an array, this also
  2049.      elicits a warning.)
  2050.  
  2051. `-Wstrict-prototypes'
  2052.      Warn if a function is declared or defined without specifying the
  2053.      argument types.  (An old-style function definition is permitted
  2054.      without a warning if preceded by a declaration which specifies the
  2055.      argument types.)
  2056.  
  2057. `-Wmissing-prototypes'
  2058.      Warn if a global function is defined without a previous prototype
  2059.      declaration.  This warning is issued even if the definition itself
  2060.      provides a prototype.  The aim is to detect global functions that
  2061.      fail to be declared in header files.
  2062.  
  2063. `-Wmissing-declarations'
  2064.      Warn if a global function is defined without a previous
  2065.      declaration.  Do so even if the definition itself provides a
  2066.      prototype.  Use this option to detect global functions that are
  2067.      not declared in header files.
  2068.  
  2069. `-Wredundant-decls'
  2070.      Warn if anything is declared more than once in the same scope,
  2071.      even in cases where multiple declaration is valid and changes
  2072.      nothing.
  2073.  
  2074. `-Wnested-externs'
  2075.      Warn if an `extern' declaration is encountered within an function.
  2076.  
  2077. `-Winline'
  2078.      Warn if a function can not be inlined, and either it was declared
  2079.      as inline, or else the `-finline-functions' option was given.
  2080.  
  2081. `-Woverloaded-virtual'
  2082.      Warn when a derived class function declaration may be an error in
  2083.      defining a virtual function (C++ only).  In a derived class, the
  2084.      definitions of virtual functions must match the type signature of a
  2085.      virtual function declared in the base class.  With this option, the
  2086.      compiler warns when you define a function with the same name as a
  2087.      virtual function, but with a type signature that does not match any
  2088.      declarations from the base class.
  2089.  
  2090. `-Wsynth (C++ only)'
  2091.      Warn when g++'s synthesis behavior does not match that of cfront.
  2092.      For instance:
  2093.  
  2094.           struct A {
  2095.             operator int ();
  2096.             A& operator = (int);
  2097.           };
  2098.           
  2099.           main ()
  2100.           {
  2101.             A a,b;
  2102.             a = b;
  2103.           }
  2104.  
  2105.      In this example, g++ will synthesize a default `A& operator =
  2106.      (const A&);', while cfront will use the user-defined `operator ='.
  2107.  
  2108. `-Werror'
  2109.      Make all warnings into errors.
  2110.  
  2111. 
  2112. File: use,  Node: Debugging Options,  Next: Optimize Options,  Prev: Warning Options,  Up: Invoking GCC
  2113.  
  2114. Options for Debugging Your Program or GNU CC
  2115. ============================================
  2116.  
  2117.    GNU CC has various special options that are used for debugging
  2118. either your program or GCC:
  2119.  
  2120. `-g'
  2121.      Produce debugging information in the operating system's native
  2122.      format (stabs, COFF, XCOFF, or DWARF).  GDB can work with this
  2123.      debugging information.
  2124.  
  2125.      On most systems that use stabs format, `-g' enables use of extra
  2126.      debugging information that only GDB can use; this extra information
  2127.      makes debugging work better in GDB but will probably make other
  2128.      debuggers crash or refuse to read the program.  If you want to
  2129.      control for certain whether to generate the extra information, use
  2130.      `-gstabs+', `-gstabs', `-gxcoff+', `-gxcoff', `-gdwarf+', or
  2131.      `-gdwarf' (see below).
  2132.  
  2133.      Unlike most other C compilers, GNU CC allows you to use `-g' with
  2134.      `-O'.  The shortcuts taken by optimized code may occasionally
  2135.      produce surprising results: some variables you declared may not
  2136.      exist at all; flow of control may briefly move where you did not
  2137.      expect it; some statements may not be executed because they
  2138.      compute constant results or their values were already at hand;
  2139.      some statements may execute in different places because they were
  2140.      moved out of loops.
  2141.  
  2142.      Nevertheless it proves possible to debug optimized output.  This
  2143.      makes it reasonable to use the optimizer for programs that might
  2144.      have bugs.
  2145.  
  2146.      The following options are useful when GNU CC is generated with the
  2147.      capability for more than one debugging format.
  2148.  
  2149. `-ggdb'
  2150.      Produce debugging information in the native format (if that is
  2151.      supported), including GDB extensions if at all possible.
  2152.  
  2153. `-gstabs'
  2154.      Produce debugging information in stabs format (if that is
  2155.      supported), without GDB extensions.  This is the format used by
  2156.      DBX on most BSD systems.  On MIPS, Alpha and System V Release 4
  2157.      systems this option produces stabs debugging output which is not
  2158.      understood by DBX or SDB.  On System V Release 4 systems this
  2159.      option requires the GNU assembler.
  2160.  
  2161. `-gstabs+'
  2162.      Produce debugging information in stabs format (if that is
  2163.      supported), using GNU extensions understood only by the GNU
  2164.      debugger (GDB).  The use of these extensions is likely to make
  2165.      other debuggers crash or refuse to read the program.
  2166.  
  2167. `-gcoff'
  2168.      Produce debugging information in COFF format (if that is
  2169.      supported).  This is the format used by SDB on most System V
  2170.      systems prior to System V Release 4.
  2171.  
  2172. `-gxcoff'
  2173.      Produce debugging information in XCOFF format (if that is
  2174.      supported).  This is the format used by the DBX debugger on IBM
  2175.      RS/6000 systems.
  2176.  
  2177. `-gxcoff+'
  2178.      Produce debugging information in XCOFF format (if that is
  2179.      supported), using GNU extensions understood only by the GNU
  2180.      debugger (GDB).  The use of these extensions is likely to make
  2181.      other debuggers crash or refuse to read the program, and may cause
  2182.      assemblers other than the GNU assembler (GAS) to fail with an
  2183.      error.
  2184.  
  2185. `-gdwarf'
  2186.      Produce debugging information in DWARF format (if that is
  2187.      supported).  This is the format used by SDB on most System V
  2188.      Release 4 systems.
  2189.  
  2190. `-gdwarf+'
  2191.      Produce debugging information in DWARF format (if that is
  2192.      supported), using GNU extensions understood only by the GNU
  2193.      debugger (GDB).  The use of these extensions is likely to make
  2194.      other debuggers crash or refuse to read the program.
  2195.  
  2196. `-gLEVEL'
  2197. `-ggdbLEVEL'
  2198. `-gstabsLEVEL'
  2199. `-gcoffLEVEL'
  2200. `-gxcoffLEVEL'
  2201. `-gdwarfLEVEL'
  2202.      Request debugging information and also use LEVEL to specify how
  2203.      much information.  The default level is 2.
  2204.  
  2205.      Level 1 produces minimal information, enough for making backtraces
  2206.      in parts of the program that you don't plan to debug.  This
  2207.      includes descriptions of functions and external variables, but no
  2208.      information about local variables and no line numbers.
  2209.  
  2210.      Level 3 includes extra information, such as all the macro
  2211.      definitions present in the program.  Some debuggers support macro
  2212.      expansion when you use `-g3'.
  2213.  
  2214. `-p'
  2215.      Generate extra code to write profile information suitable for the
  2216.      analysis program `prof'.  You must use this option when compiling
  2217.      the source files you want data about, and you must also use it when
  2218.      linking.
  2219.  
  2220. `-pg'
  2221.      Generate extra code to write profile information suitable for the
  2222.      analysis program `gprof'.  You must use this option when compiling
  2223.      the source files you want data about, and you must also use it when
  2224.      linking.
  2225.  
  2226. `-a'
  2227.      Generate extra code to write profile information for basic blocks,
  2228.      which will record the number of times each basic block is
  2229.      executed, the basic block start address, and the function name
  2230.      containing the basic block.  If `-g' is used, the line number and
  2231.      filename of the start of the basic block will also be recorded.
  2232.      If not overridden by the machine description, the default action is
  2233.      to append to the text file `bb.out'.
  2234.  
  2235.      This data could be analyzed by a program like `tcov'.  Note,
  2236.      however, that the format of the data is not what `tcov' expects.
  2237.      Eventually GNU `gprof' should be extended to process this data.
  2238.  
  2239. `-dLETTERS'
  2240.      Says to make debugging dumps during compilation at times specified
  2241.      by LETTERS.  This is used for debugging the compiler.  The file
  2242.      names for most of the dumps are made by appending a word to the
  2243.      source file name (e.g.  `foo.c.rtl' or `foo.c.jump').  Here are the
  2244.      possible letters for use in LETTERS, and their meanings:
  2245.  
  2246.     `M'
  2247.           Dump all macro definitions, at the end of preprocessing, and
  2248.           write no output.
  2249.  
  2250.     `N'
  2251.           Dump all macro names, at the end of preprocessing.
  2252.  
  2253.     `D'
  2254.           Dump all macro definitions, at the end of preprocessing, in
  2255.           addition to normal output.
  2256.  
  2257.     `y'
  2258.           Dump debugging information during parsing, to standard error.
  2259.  
  2260.     `r'
  2261.           Dump after RTL generation, to `FILE.rtl'.
  2262.  
  2263.     `x'
  2264.           Just generate RTL for a function instead of compiling it.
  2265.           Usually used with `r'.
  2266.  
  2267.     `j'
  2268.           Dump after first jump optimization, to `FILE.jump'.
  2269.  
  2270.     `s'
  2271.           Dump after CSE (including the jump optimization that sometimes
  2272.           follows CSE), to `FILE.cse'.
  2273.  
  2274.     `L'
  2275.           Dump after loop optimization, to `FILE.loop'.
  2276.  
  2277.     `t'
  2278.           Dump after the second CSE pass (including the jump
  2279.           optimization that sometimes follows CSE), to `FILE.cse2'.
  2280.  
  2281.     `f'
  2282.           Dump after flow analysis, to `FILE.flow'.
  2283.  
  2284.     `c'
  2285.           Dump after instruction combination, to the file
  2286.           `FILE.combine'.
  2287.  
  2288.     `S'
  2289.           Dump after the first instruction scheduling pass, to
  2290.           `FILE.sched'.
  2291.  
  2292.     `l'
  2293.           Dump after local register allocation, to `FILE.lreg'.
  2294.  
  2295.     `g'
  2296.           Dump after global register allocation, to `FILE.greg'.
  2297.  
  2298.     `R'
  2299.           Dump after the second instruction scheduling pass, to
  2300.           `FILE.sched2'.
  2301.  
  2302.     `J'
  2303.           Dump after last jump optimization, to `FILE.jump2'.
  2304.  
  2305.     `d'
  2306.           Dump after delayed branch scheduling, to `FILE.dbr'.
  2307.  
  2308.     `k'
  2309.           Dump after conversion from registers to stack, to
  2310.           `FILE.stack'.
  2311.  
  2312.     `a'
  2313.           Produce all the dumps listed above.
  2314.  
  2315.     `m'
  2316.           Print statistics on memory usage, at the end of the run, to
  2317.           standard error.
  2318.  
  2319.     `p'
  2320.           Annotate the assembler output with a comment indicating which
  2321.           pattern and alternative was used.
  2322.  
  2323. `-fpretend-float'
  2324.      When running a cross-compiler, pretend that the target machine
  2325.      uses the same floating point format as the host machine.  This
  2326.      causes incorrect output of the actual floating constants, but the
  2327.      actual instruction sequence will probably be the same as GNU CC
  2328.      would make when running on the target machine.
  2329.  
  2330. `-save-temps'
  2331.      Store the usual "temporary" intermediate files permanently; place
  2332.      them in the current directory and name them based on the source
  2333.      file.  Thus, compiling `foo.c' with `-c -save-temps' would produce
  2334.      files `foo.i' and `foo.s', as well as `foo.o'.
  2335.  
  2336. `-print-file-name=LIBRARY'
  2337.      Print the full absolute name of the library file LIBRARY that
  2338.      would be used when linking--and don't do anything else.  With this
  2339.      option, GNU CC does not compile or link anything; it just prints
  2340.      the file name.
  2341.  
  2342. `-print-prog-name=PROGRAM'
  2343.      Like `-print-file-name', but searches for a program such as `cpp'.
  2344.  
  2345. `-print-libgcc-file-name'
  2346.      Same as `-print-file-name=libgcc.a'.
  2347.  
  2348.      This is useful when you use `-nostdlib' or `-nodefaultlibs' but
  2349.      you do want to link with `libgcc.a'.  You can do
  2350.  
  2351.           gcc -nostdlib FILES... `gcc -print-libgcc-file-name`
  2352.  
  2353. `-print-search-dirs'
  2354.      Print the name of the configured installation directory and a list
  2355.      of program and library directories gcc will search--and don't do
  2356.      anything else.
  2357.  
  2358.      This is useful when gcc prints the error message `installation
  2359.      problem, cannot exec cpp: No such file or directory'.  To resolve
  2360.      this you either need to put `cpp' and the other compiler
  2361.      components where gcc expects to find them, or you can set the
  2362.      environment variable `GCC_EXEC_PREFIX' to the directory where you
  2363.      installed them.  Don't forget the trailing '/'.  *Note Environment
  2364.      Variables::.
  2365.  
  2366. 
  2367. File: use,  Node: Optimize Options,  Next: Preprocessor Options,  Prev: Debugging Options,  Up: Invoking GCC
  2368.  
  2369. Options That Control Optimization
  2370. =================================
  2371.  
  2372.    These options control various sorts of optimizations:
  2373.  
  2374. `-O'
  2375. `-O1'
  2376.      Optimize.  Optimizing compilation takes somewhat more time, and a
  2377.      lot more memory for a large function.
  2378.  
  2379.      Without `-O', the compiler's goal is to reduce the cost of
  2380.      compilation and to make debugging produce the expected results.
  2381.      Statements are independent: if you stop the program with a
  2382.      breakpoint between statements, you can then assign a new value to
  2383.      any variable or change the program counter to any other statement
  2384.      in the function and get exactly the results you would expect from
  2385.      the source code.
  2386.  
  2387.      Without `-O', the compiler only allocates variables declared
  2388.      `register' in registers.  The resulting compiled code is a little
  2389.      worse than produced by PCC without `-O'.
  2390.  
  2391.      With `-O', the compiler tries to reduce code size and execution
  2392.      time.
  2393.  
  2394.      When you specify `-O', the compiler turns on `-fthread-jumps' and
  2395.      `-fdefer-pop' on all machines.  The compiler turns on
  2396.      `-fdelayed-branch' on machines that have delay slots, and
  2397.      `-fomit-frame-pointer' on machines that can support debugging even
  2398.      without a frame pointer.  On some machines the compiler also turns
  2399.      on other flags.
  2400.  
  2401. `-O2'
  2402.      Optimize even more.  GNU CC performs nearly all supported
  2403.      optimizations that do not involve a space-speed tradeoff.  The
  2404.      compiler does not perform loop unrolling or function inlining when
  2405.      you specify `-O2'.  As compared to `-O', this option increases
  2406.      both compilation time and the performance of the generated code.
  2407.  
  2408.      `-O2' turns on all optional optimizations except for loop unrolling
  2409.      and function inlining.  It also turns on frame pointer elimination
  2410.      on machines where doing so does not interfere with debugging.
  2411.  
  2412. `-O3'
  2413.      Optimize yet more.  `-O3' turns on all optimizations specified by
  2414.      `-O2' and also turns on the `inline-functions' option.
  2415.  
  2416. `-O0'
  2417.      Do not optimize.
  2418.  
  2419.      If you use multiple `-O' options, with or without level numbers,
  2420.      the last such option is the one that is effective.
  2421.  
  2422.    Options of the form `-fFLAG' specify machine-independent flags.
  2423. Most flags have both positive and negative forms; the negative form of
  2424. `-ffoo' would be `-fno-foo'.  In the table below, only one of the forms
  2425. is listed--the one which is not the default.  You can figure out the
  2426. other form by either removing `no-' or adding it.
  2427.  
  2428. `-ffloat-store'
  2429.      Do not store floating point variables in registers, and inhibit
  2430.      other options that might change whether a floating point value is
  2431.      taken from a register or memory.
  2432.  
  2433.      This option prevents undesirable excess precision on machines such
  2434.      as the 68000 where the floating registers (of the 68881) keep more
  2435.      precision than a `double' is supposed to have.  For most programs,
  2436.      the excess precision does only good, but a few programs rely on the
  2437.      precise definition of IEEE floating point.  Use `-ffloat-store' for
  2438.      such programs.
  2439.  
  2440. `-fno-default-inline'
  2441.      Do not make member functions inline by default merely because they
  2442.      are defined inside the class scope (C++ only).  Otherwise, when
  2443.      you specify `-O', member functions defined inside class scope are
  2444.      compiled inline by default; i.e., you don't need to add `inline'
  2445.      in front of the member function name.
  2446.  
  2447. `-fno-defer-pop'
  2448.      Always pop the arguments to each function call as soon as that
  2449.      function returns.  For machines which must pop arguments after a
  2450.      function call, the compiler normally lets arguments accumulate on
  2451.      the stack for several function calls and pops them all at once.
  2452.  
  2453. `-fforce-mem'
  2454.      Force memory operands to be copied into registers before doing
  2455.      arithmetic on them.  This may produce better code by making all
  2456.      memory references potential common subexpressions.  When they are
  2457.      not common subexpressions, instruction combination should
  2458.      eliminate the separate register-load.  I am interested in hearing
  2459.      about the difference this makes.
  2460.  
  2461. `-fforce-addr'
  2462.      Force memory address constants to be copied into registers before
  2463.      doing arithmetic on them.  This may produce better code just as
  2464.      `-fforce-mem' may.  I am interested in hearing about the
  2465.      difference this makes.
  2466.  
  2467. `-fomit-frame-pointer'
  2468.      Don't keep the frame pointer in a register for functions that
  2469.      don't need one.  This avoids the instructions to save, set up and
  2470.      restore frame pointers; it also makes an extra register available
  2471.      in many functions.  *It also makes debugging impossible on some
  2472.      machines.*
  2473.  
  2474.      On some machines, such as the Vax, this flag has no effect, because
  2475.      the standard calling sequence automatically handles the frame
  2476.      pointer and nothing is saved by pretending it doesn't exist.  The
  2477.      machine-description macro `FRAME_POINTER_REQUIRED' controls
  2478.      whether a target machine supports this flag.  *Note Register
  2479.      Usage: (gcc.info)Registers.
  2480.  
  2481. `-fno-inline'
  2482.      Don't pay attention to the `inline' keyword.  Normally this option
  2483.      is used to keep the compiler from expanding any functions inline.
  2484.      Note that if you are not optimizing, no functions can be expanded
  2485.      inline.
  2486.  
  2487. `-finline-functions'
  2488.      Integrate all simple functions into their callers.  The compiler
  2489.      heuristically decides which functions are simple enough to be worth
  2490.      integrating in this way.
  2491.  
  2492.      If all calls to a given function are integrated, and the function
  2493.      is declared `static', then the function is normally not output as
  2494.      assembler code in its own right.
  2495.  
  2496. `-fkeep-inline-functions'
  2497.      Even if all calls to a given function are integrated, and the
  2498.      function is declared `static', nevertheless output a separate
  2499.      run-time callable version of the function.
  2500.  
  2501. `-fno-function-cse'
  2502.      Do not put function addresses in registers; make each instruction
  2503.      that calls a constant function contain the function's address
  2504.      explicitly.
  2505.  
  2506.      This option results in less efficient code, but some strange hacks
  2507.      that alter the assembler output may be confused by the
  2508.      optimizations performed when this option is not used.
  2509.  
  2510. `-ffast-math'
  2511.      This option allows GCC to violate some ANSI or IEEE rules and/or
  2512.      specifications in the interest of optimizing code for speed.  For
  2513.      example, it allows the compiler to assume arguments to the `sqrt'
  2514.      function are non-negative numbers and that no floating-point values
  2515.      are NaNs.
  2516.  
  2517.      This option should never be turned on by any `-O' option since it
  2518.      can result in incorrect output for programs which depend on an
  2519.      exact implementation of IEEE or ANSI rules/specifications for math
  2520.      functions.
  2521.  
  2522.    The following options control specific optimizations.  The `-O2'
  2523. option turns on all of these optimizations except `-funroll-loops' and
  2524. `-funroll-all-loops'.  On most machines, the `-O' option turns on the
  2525. `-fthread-jumps' and `-fdelayed-branch' options, but specific machines
  2526. may handle it differently.
  2527.  
  2528.    You can use the following flags in the rare cases when "fine-tuning"
  2529. of optimizations to be performed is desired.
  2530.  
  2531. `-fstrength-reduce'
  2532.      Perform the optimizations of loop strength reduction and
  2533.      elimination of iteration variables.
  2534.  
  2535. `-fthread-jumps'
  2536.      Perform optimizations where we check to see if a jump branches to a
  2537.      location where another comparison subsumed by the first is found.
  2538.      If so, the first branch is redirected to either the destination of
  2539.      the second branch or a point immediately following it, depending
  2540.      on whether the condition is known to be true or false.
  2541.  
  2542. `-fcse-follow-jumps'
  2543.      In common subexpression elimination, scan through jump instructions
  2544.      when the target of the jump is not reached by any other path.  For
  2545.      example, when CSE encounters an `if' statement with an `else'
  2546.      clause, CSE will follow the jump when the condition tested is
  2547.      false.
  2548.  
  2549. `-fcse-skip-blocks'
  2550.      This is similar to `-fcse-follow-jumps', but causes CSE to follow
  2551.      jumps which conditionally skip over blocks.  When CSE encounters a
  2552.      simple `if' statement with no else clause, `-fcse-skip-blocks'
  2553.      causes CSE to follow the jump around the body of the `if'.
  2554.  
  2555. `-frerun-cse-after-loop'
  2556.      Re-run common subexpression elimination after loop optimizations
  2557.      has been performed.
  2558.  
  2559. `-fexpensive-optimizations'
  2560.      Perform a number of minor optimizations that are relatively
  2561.      expensive.
  2562.  
  2563. `-fdelayed-branch'
  2564.      If supported for the target machine, attempt to reorder
  2565.      instructions to exploit instruction slots available after delayed
  2566.      branch instructions.
  2567.  
  2568. `-fschedule-insns'
  2569.      If supported for the target machine, attempt to reorder
  2570.      instructions to eliminate execution stalls due to required data
  2571.      being unavailable.  This helps machines that have slow floating
  2572.      point or memory load instructions by allowing other instructions
  2573.      to be issued until the result of the load or floating point
  2574.      instruction is required.
  2575.  
  2576. `-fschedule-insns2'
  2577.      Similar to `-fschedule-insns', but requests an additional pass of
  2578.      instruction scheduling after register allocation has been done.
  2579.      This is especially useful on machines with a relatively small
  2580.      number of registers and where memory load instructions take more
  2581.      than one cycle.
  2582.  
  2583. `-fcaller-saves'
  2584.      Enable values to be allocated in registers that will be clobbered
  2585.      by function calls, by emitting extra instructions to save and
  2586.      restore the registers around such calls.  Such allocation is done
  2587.      only when it seems to result in better code than would otherwise
  2588.      be produced.
  2589.  
  2590.      This option is enabled by default on certain machines, usually
  2591.      those which have no call-preserved registers to use instead.
  2592.  
  2593. `-funroll-loops'
  2594.      Perform the optimization of loop unrolling.  This is only done for
  2595.      loops whose number of iterations can be determined at compile time
  2596.      or run time.  `-funroll-loop' implies both `-fstrength-reduce' and
  2597.      `-frerun-cse-after-loop'.
  2598.  
  2599. `-funroll-all-loops'
  2600.      Perform the optimization of loop unrolling.  This is done for all
  2601.      loops and usually makes programs run more slowly.
  2602.      `-funroll-all-loops' implies `-fstrength-reduce' as well as
  2603.      `-frerun-cse-after-loop'.
  2604.  
  2605. `-fno-peephole'
  2606.      Disable any machine-specific peephole optimizations.
  2607.  
  2608. 
  2609. File: use,  Node: Preprocessor Options,  Next: Assembler Options,  Prev: Optimize Options,  Up: Invoking GCC
  2610.  
  2611. Options Controlling the Preprocessor
  2612. ====================================
  2613.  
  2614.    These options control the C preprocessor, which is run on each C
  2615. source file before actual compilation.
  2616.  
  2617.    If you use the `-E' option, nothing is done except preprocessing.
  2618. Some of these options make sense only together with `-E' because they
  2619. cause the preprocessor output to be unsuitable for actual compilation.
  2620.  
  2621. `-include FILE'
  2622.      Process FILE as input before processing the regular input file.
  2623.      In effect, the contents of FILE are compiled first.  Any `-D' and
  2624.      `-U' options on the command line are always processed before
  2625.      `-include FILE', regardless of the order in which they are
  2626.      written.  All the `-include' and `-imacros' options are processed
  2627.      in the order in which they are written.
  2628.  
  2629. `-imacros FILE'
  2630.      Process FILE as input, discarding the resulting output, before
  2631.      processing the regular input file.  Because the output generated
  2632.      from FILE is discarded, the only effect of `-imacros FILE' is to
  2633.      make the macros defined in FILE available for use in the main
  2634.      input.
  2635.  
  2636.      Any `-D' and `-U' options on the command line are always processed
  2637.      before `-imacros FILE', regardless of the order in which they are
  2638.      written.  All the `-include' and `-imacros' options are processed
  2639.      in the order in which they are written.
  2640.  
  2641. `-idirafter DIR'
  2642.      Add the directory DIR to the second include path.  The directories
  2643.      on the second include path are searched when a header file is not
  2644.      found in any of the directories in the main include path (the one
  2645.      that `-I' adds to).
  2646.  
  2647. `-iprefix PREFIX'
  2648.      Specify PREFIX as the prefix for subsequent `-iwithprefix' options.
  2649.  
  2650. `-iwithprefix DIR'
  2651.      Add a directory to the second include path.  The directory's name
  2652.      is made by concatenating PREFIX and DIR, where PREFIX was
  2653.      specified previously with `-iprefix'.  If you have not specified a
  2654.      prefix yet, the directory containing the installed passes of the
  2655.      compiler is used as the default.
  2656.  
  2657. `-iwithprefixbefore DIR'
  2658.      Add a directory to the main include path.  The directory's name is
  2659.      made by concatenating PREFIX and DIR, as in the case of
  2660.      `-iwithprefix'.
  2661.  
  2662. `-isystem DIR'
  2663.      Add a directory to the beginning of the second include path,
  2664.      marking it as a system directory, so that it gets the same special
  2665.      treatment as is applied to the standard system directories.
  2666.  
  2667. `-nostdinc'
  2668.      Do not search the standard system directories for header files.
  2669.      Only the directories you have specified with `-I' options (and the
  2670.      current directory, if appropriate) are searched.  *Note Directory
  2671.      Options::, for information on `-I'.
  2672.  
  2673.      By using both `-nostdinc' and `-I-', you can limit the include-file
  2674.      search path to only those directories you specify explicitly.
  2675.  
  2676. `-undef'
  2677.      Do not predefine any nonstandard macros.  (Including architecture
  2678.      flags).
  2679.  
  2680. `-E'
  2681.      Run only the C preprocessor.  Preprocess all the C source files
  2682.      specified and output the results to standard output or to the
  2683.      specified output file.
  2684.  
  2685. `-C'
  2686.      Tell the preprocessor not to discard comments.  Used with the `-E'
  2687.      option.
  2688.  
  2689. `-P'
  2690.      Tell the preprocessor not to generate `#line' directives.  Used
  2691.      with the `-E' option.
  2692.  
  2693. `-M'
  2694.      Tell the preprocessor to output a rule suitable for `make'
  2695.      describing the dependencies of each object file.  For each source
  2696.      file, the preprocessor outputs one `make'-rule whose target is the
  2697.      object file name for that source file and whose dependencies are
  2698.      all the `#include' header files it uses.  This rule may be a
  2699.      single line or may be continued with `\'-newline if it is long.
  2700.      The list of rules is printed on standard output instead of the
  2701.      preprocessed C program.
  2702.  
  2703.      `-M' implies `-E'.
  2704.  
  2705.      Another way to specify output of a `make' rule is by setting the
  2706.      environment variable `DEPENDENCIES_OUTPUT' (*note Environment
  2707.      Variables::.).
  2708.  
  2709. `-MM'
  2710.      Like `-M' but the output mentions only the user header files
  2711.      included with `#include "FILE"'.  System header files included
  2712.      with `#include <FILE>' are omitted.
  2713.  
  2714. `-MD'
  2715.      Like `-M' but the dependency information is written to a file made
  2716.      by replacing ".c" with ".d" at the end of the input file names.
  2717.      This is in addition to compiling the file as specified--`-MD' does
  2718.      not inhibit ordinary compilation the way `-M' does.
  2719.  
  2720.      In Mach, you can use the utility `md' to merge multiple dependency
  2721.      files into a single dependency file suitable for using with the
  2722.      `make' command.
  2723.  
  2724. `-MMD'
  2725.      Like `-MD' except mention only user header files, not system
  2726.      header files.
  2727.  
  2728. `-MG'
  2729.      Treat missing header files as generated files and assume they live
  2730.      in the same directory as the source file.  If you specify `-MG',
  2731.      you must also specify either `-M' or `-MM'.  `-MG' is not
  2732.      supported with `-MD' or `-MMD'.
  2733.  
  2734. `-H'
  2735.      Print the name of each header file used, in addition to other
  2736.      normal activities.
  2737.  
  2738. `-AQUESTION(ANSWER)'
  2739.      Assert the answer ANSWER for QUESTION, in case it is tested with a
  2740.      preprocessing conditional such as `#if #QUESTION(ANSWER)'.  `-A-'
  2741.      disables the standard assertions that normally describe the target
  2742.      machine.
  2743.  
  2744. `-DMACRO'
  2745.      Define macro MACRO with the string `1' as its definition.
  2746.  
  2747. `-DMACRO=DEFN'
  2748.      Define macro MACRO as DEFN.  All instances of `-D' on the command
  2749.      line are processed before any `-U' options.
  2750.  
  2751. `-UMACRO'
  2752.      Undefine macro MACRO.  `-U' options are evaluated after all `-D'
  2753.      options, but before any `-include' and `-imacros' options.
  2754.  
  2755. `-dM'
  2756.      Tell the preprocessor to output only a list of the macro
  2757.      definitions that are in effect at the end of preprocessing.  Used
  2758.      with the `-E' option.
  2759.  
  2760. `-dD'
  2761.      Tell the preprocessing to pass all macro definitions into the
  2762.      output, in their proper sequence in the rest of the output.
  2763.  
  2764. `-dN'
  2765.      Like `-dD' except that the macro arguments and contents are
  2766.      omitted.  Only `#define NAME' is included in the output.
  2767.  
  2768. `-trigraphs'
  2769.      Support ANSI C trigraphs.  The `-ansi' option also has this effect.
  2770.  
  2771. `-Wp,OPTION'
  2772.      Pass OPTION as an option to the preprocessor.  If OPTION contains
  2773.      commas, it is split into multiple options at the commas.
  2774.  
  2775. 
  2776. File: use,  Node: Assembler Options,  Next: Link Options,  Prev: Preprocessor Options,  Up: Invoking GCC
  2777.  
  2778. Passing Options to the Assembler
  2779. ================================
  2780.  
  2781.    You can pass options to the assembler.
  2782.  
  2783. `-Wa,OPTION'
  2784.      Pass OPTION as an option to the assembler.  If OPTION contains
  2785.      commas, it is split into multiple options at the commas.
  2786.  
  2787. 
  2788. File: use,  Node: Link Options,  Next: Directory Options,  Prev: Assembler Options,  Up: Invoking GCC
  2789.  
  2790. Options for Linking
  2791. ===================
  2792.  
  2793.    These options come into play when the compiler links object files
  2794. into an executable output file.  They are meaningless if the compiler is
  2795. not doing a link step.
  2796.  
  2797. `OBJECT-FILE-NAME'
  2798.      A file name that does not end in a special recognized suffix is
  2799.      considered to name an object file or library.  (Object files are
  2800.      distinguished from libraries by the linker according to the file
  2801.      contents.)  If linking is done, these object files are used as
  2802.      input to the linker.
  2803.  
  2804. `-c'
  2805. `-S'
  2806. `-E'
  2807.      If any of these options is used, then the linker is not run, and
  2808.      object file names should not be used as arguments.  *Note Overall
  2809.      Options::.
  2810.  
  2811. `-lLIBRARY'
  2812.      Search the library named LIBRARY when linking.
  2813.  
  2814.      It makes a difference where in the command you write this option;
  2815.      the linker searches processes libraries and object files in the
  2816.      order they are specified.  Thus, `foo.o -lz bar.o' searches
  2817.      library `z' after file `foo.o' but before `bar.o'.  If `bar.o'
  2818.      refers to functions in `z', those functions may not be loaded.
  2819.  
  2820.      The linker searches a standard list of directories for the library,
  2821.      which is actually a file named `libLIBRARY.a'.  The linker then
  2822.      uses this file as if it had been specified precisely by name.
  2823.  
  2824.      The directories searched include several standard system
  2825.      directories plus any that you specify with `-L'.
  2826.  
  2827.      Normally the files found this way are library files--archive files
  2828.      whose members are object files.  The linker handles an archive
  2829.      file by scanning through it for members which define symbols that
  2830.      have so far been referenced but not defined.  But if the file that
  2831.      is found is an ordinary object file, it is linked in the usual
  2832.      fashion.  The only difference between using an `-l' option and
  2833.      specifying a file name is that `-l' surrounds LIBRARY with `lib'
  2834.      and `.a' and searches several directories.
  2835.  
  2836. `-lobjc'
  2837.      You need this special case of the `-l' option in order to link an
  2838.      Objective C program.
  2839.  
  2840. `-nostartfiles'
  2841.      Do not use the standard system startup files when linking.  The
  2842.      standard system libraries are used normally, unless `-nostdlib' or
  2843.      `-nodefaultlibs' is used.
  2844.  
  2845. `-nodefaultlibs'
  2846.      Do not use the standard system libraries when linking.  Only the
  2847.      libraries you specify will be passed to the linker.  The standard
  2848.      startup files are used normally, unless `-nostartfiles' is used.
  2849.  
  2850. `-nostdlib'
  2851.      Do not use the standard system startup files or libraries when
  2852.      linking.  No startup files and only the libraries you specify will
  2853.      be passed to the linker.
  2854.  
  2855.      One of the standard libraries bypassed by `-nostdlib' and
  2856.      `-nodefaultlibs' is `libgcc.a', a library of internal subroutines
  2857.      that GNU CC uses to overcome shortcomings of particular machines,
  2858.      or special needs for some languages.  (*Note Interfacing to GNU CC
  2859.      Output: (gcc.info)Interface, for more discussion of `libgcc.a'.)
  2860.      In most cases, you need `libgcc.a' even when you want to avoid
  2861.      other standard libraries.  In other words, when you specify
  2862.      `-nostdlib' or `-nodefaultlibs' you should usually specify `-lgcc'
  2863.      as well.  This ensures that you have no unresolved references to
  2864.      internal GNU CC library subroutines.  (For example, `__main', used
  2865.      to ensure C++ constructors will be called; *note `collect2':
  2866.      Collect2..)
  2867.  
  2868. `-s'
  2869.      Remove all symbol table and relocation information from the
  2870.      executable.
  2871.  
  2872. `-static'
  2873.      On systems that support dynamic linking, this prevents linking
  2874.      with the shared libraries.  On other systems, this option has no
  2875.      effect.
  2876.  
  2877. `-shared'
  2878.      Produce a shared object which can then be linked with other
  2879.      objects to form an executable.  Only a few systems support this
  2880.      option.
  2881.  
  2882. `-symbolic'
  2883.      Bind references to global symbols when building a shared object.
  2884.      Warn about any unresolved references (unless overridden by the
  2885.      link editor option `-Xlinker -z -Xlinker defs').  Only a few
  2886.      systems support this option.
  2887.  
  2888. `-Xlinker OPTION'
  2889.      Pass OPTION as an option to the linker.  You can use this to
  2890.      supply system-specific linker options which GNU CC does not know
  2891.      how to recognize.
  2892.  
  2893.      If you want to pass an option that takes an argument, you must use
  2894.      `-Xlinker' twice, once for the option and once for the argument.
  2895.      For example, to pass `-assert definitions', you must write
  2896.      `-Xlinker -assert -Xlinker definitions'.  It does not work to write
  2897.      `-Xlinker "-assert definitions"', because this passes the entire
  2898.      string as a single argument, which is not what the linker expects.
  2899.  
  2900. `-Wl,OPTION'
  2901.      Pass OPTION as an option to the linker.  If OPTION contains
  2902.      commas, it is split into multiple options at the commas.
  2903.  
  2904. `-u SYMBOL'
  2905.      Pretend the symbol SYMBOL is undefined, to force linking of
  2906.      library modules to define it.  You can use `-u' multiple times with
  2907.      different symbols to force loading of additional library modules.
  2908.  
  2909. 
  2910. File: use,  Node: Directory Options,  Next: Target Options,  Prev: Link Options,  Up: Invoking GCC
  2911.  
  2912. Options for Directory Search
  2913. ============================
  2914.  
  2915.    These options specify directories to search for header files, for
  2916. libraries and for parts of the compiler:
  2917.  
  2918. `-IDIR'
  2919.      Add the directory DIRECTORY to the head of the list of directories
  2920.      to be searched for header files.  This can be used to override a
  2921.      system header file, substituting your own version, since these
  2922.      directories are searched before the system header file
  2923.      directories.  If you use more than one `-I' option, the
  2924.      directories are scanned in left-to-right order; the standard
  2925.      system directories come after.
  2926.  
  2927. `-I-'
  2928.      Any directories you specify with `-I' options before the `-I-'
  2929.      option are searched only for the case of `#include "FILE"'; they
  2930.      are not searched for `#include <FILE>'.
  2931.  
  2932.      If additional directories are specified with `-I' options after
  2933.      the `-I-', these directories are searched for all `#include'
  2934.      directives.  (Ordinarily *all* `-I' directories are used this way.)
  2935.  
  2936.      In addition, the `-I-' option inhibits the use of the current
  2937.      directory (where the current input file came from) as the first
  2938.      search directory for `#include "FILE"'.  There is no way to
  2939.      override this effect of `-I-'.  With `-I.' you can specify
  2940.      searching the directory which was current when the compiler was
  2941.      invoked.  That is not exactly the same as what the preprocessor
  2942.      does by default, but it is often satisfactory.
  2943.  
  2944.      `-I-' does not inhibit the use of the standard system directories
  2945.      for header files.  Thus, `-I-' and `-nostdinc' are independent.
  2946.  
  2947. `-LDIR'
  2948.      Add directory DIR to the list of directories to be searched for
  2949.      `-l'.
  2950.  
  2951. `-BPREFIX'
  2952.      This option specifies where to find the executables, libraries,
  2953.      include files, and data files of the compiler itself.
  2954.  
  2955.      The compiler driver program runs one or more of the subprograms
  2956.      `cpp', `cc1', `as' and `ld'.  It tries PREFIX as a prefix for each
  2957.      program it tries to run, both with and without `MACHINE/VERSION/'
  2958.      (*note Target Options::.).
  2959.  
  2960.      For each subprogram to be run, the compiler driver first tries the
  2961.      `-B' prefix, if any.  If that name is not found, or if `-B' was
  2962.      not specified, the driver tries two standard prefixes, which are
  2963.      `/usr/lib/gcc/' and `/usr/local/lib/gcc-lib/'.  If neither of
  2964.      those results in a file name that is found, the unmodified program
  2965.      name is searched for using the directories specified in your
  2966.      `PATH' environment variable.
  2967.  
  2968.      `-B' prefixes that effectively specify directory names also apply
  2969.      to libraries in the linker, because the compiler translates these
  2970.      options into `-L' options for the linker.  They also apply to
  2971.      includes files in the preprocessor, because the compiler
  2972.      translates these options into `-isystem' options for the
  2973.      preprocessor.  In this case, the compiler appends `include' to the
  2974.      prefix.
  2975.  
  2976.      The run-time support file `libgcc.a' can also be searched for using
  2977.      the `-B' prefix, if needed.  If it is not found there, the two
  2978.      standard prefixes above are tried, and that is all.  The file is
  2979.      left out of the link if it is not found by those means.
  2980.  
  2981.      Another way to specify a prefix much like the `-B' prefix is to use
  2982.      the environment variable `GCC_EXEC_PREFIX'.  *Note Environment
  2983.      Variables::.
  2984.  
  2985. 
  2986. File: use,  Node: Target Options,  Next: Submodel Options,  Prev: Directory Options,  Up: Invoking GCC
  2987.  
  2988. Specifying Target Machine and Compiler Version
  2989. ==============================================
  2990.  
  2991.    By default, GNU CC compiles code for the same type of machine that
  2992. you are using.  However, it can also be installed as a cross-compiler,
  2993. to compile for some other type of machine.  In fact, several different
  2994. configurations of GNU CC, for different target machines, can be
  2995. installed side by side.  Then you specify which one to use with the
  2996. `-b' option.
  2997.  
  2998.    In addition, older and newer versions of GNU CC can be installed side
  2999. by side.  One of them (probably the newest) will be the default, but
  3000. you may sometimes wish to use another.
  3001.  
  3002. `-b MACHINE'
  3003.      The argument MACHINE specifies the target machine for compilation.
  3004.      This is useful when you have installed GNU CC as a cross-compiler.
  3005.  
  3006.      The value to use for MACHINE is the same as was specified as the
  3007.      machine type when configuring GNU CC as a cross-compiler.  For
  3008.      example, if a cross-compiler was configured with `configure
  3009.      i386v', meaning to compile for an 80386 running System V, then you
  3010.      would specify `-b i386v' to run that cross compiler.
  3011.  
  3012.      When you do not specify `-b', it normally means to compile for the
  3013.      same type of machine that you are using.
  3014.  
  3015. `-V VERSION'
  3016.      The argument VERSION specifies which version of GNU CC to run.
  3017.      This is useful when multiple versions are installed.  For example,
  3018.      VERSION might be `2.0', meaning to run GNU CC version 2.0.
  3019.  
  3020.      The default version, when you do not specify `-V', is the last
  3021.      version of GNU CC that you installed.
  3022.  
  3023.    The `-b' and `-V' options actually work by controlling part of the
  3024. file name used for the executable files and libraries used for
  3025. compilation.  A given version of GNU CC, for a given target machine, is
  3026. normally kept in the directory `/usr/local/lib/gcc-lib/MACHINE/VERSION'.
  3027.  
  3028.    Thus, sites can customize the effect of `-b' or `-V' either by
  3029. changing the names of these directories or adding alternate names (or
  3030. symbolic links).  If in directory `/usr/local/lib/gcc-lib/' the file
  3031. `80386' is a link to the file `i386v', then `-b 80386' becomes an alias
  3032. for `-b i386v'.
  3033.  
  3034.    In one respect, the `-b' or `-V' do not completely change to a
  3035. different compiler: the top-level driver program `gcc' that you
  3036. originally invoked continues to run and invoke the other executables
  3037. (preprocessor, compiler per se, assembler and linker) that do the real
  3038. work.  However, since no real work is done in the driver program, it
  3039. usually does not matter that the driver program in use is not the one
  3040. for the specified target and version.
  3041.  
  3042.    The only way that the driver program depends on the target machine is
  3043. in the parsing and handling of special machine-specific options.
  3044. However, this is controlled by a file which is found, along with the
  3045. other executables, in the directory for the specified version and
  3046. target machine.  As a result, a single installed driver program adapts
  3047. to any specified target machine and compiler version.
  3048.  
  3049.    The driver program executable does control one significant thing,
  3050. however: the default version and target machine.  Therefore, you can
  3051. install different instances of the driver program, compiled for
  3052. different targets or versions, under different names.
  3053.  
  3054.    For example, if the driver for version 2.0 is installed as `ogcc'
  3055. and that for version 2.1 is installed as `gcc', then the command `gcc'
  3056. will use version 2.1 by default, while `ogcc' will use 2.0 by default.
  3057. However, you can choose either version with either command with the
  3058. `-V' option.
  3059.  
  3060. 
  3061. File: use,  Node: Submodel Options,  Next: Code Gen Options,  Prev: Target Options,  Up: Invoking GCC
  3062.  
  3063. Hardware Models and Configurations
  3064. ==================================
  3065.  
  3066.    Earlier we discussed the standard option `-b' which chooses among
  3067. different installed compilers for completely different target machines,
  3068. such as Vax vs. 68000 vs. 80386.
  3069.  
  3070.    In addition, each of these target machine types can have its own
  3071. special options, starting with `-m', to choose among various hardware
  3072. models or configurations--for example, 68010 vs 68020, floating
  3073. coprocessor or none.  A single installed version of the compiler can
  3074. compile for any model or configuration, according to the options
  3075. specified.
  3076.  
  3077.    Some configurations of the compiler also support additional special
  3078. options, usually for compatibility with other compilers on the same
  3079. platform.
  3080.  
  3081. * Menu:
  3082.  
  3083. * M680x0 Options::
  3084. * VAX Options::
  3085. * SPARC Options::
  3086. * Convex Options::
  3087. * AMD29K Options::
  3088. * ARM Options::
  3089. * M88K Options::
  3090. * RS/6000 and PowerPC Options::
  3091. * RT Options::
  3092. * MIPS Options::
  3093. * i386 Options::
  3094. * HPPA Options::
  3095. * Intel 960 Options::
  3096. * DEC Alpha Options::
  3097. * Clipper Options::
  3098. * H8/300 Options::
  3099. * System V Options::
  3100.  
  3101. 
  3102. File: use,  Node: M680x0 Options,  Next: VAX Options,  Up: Submodel Options
  3103.  
  3104. M680x0 Options
  3105. --------------
  3106.  
  3107.    These are the `-m' options defined for the 68000 series.  The default
  3108. values for these options depends on which style of 68000 was selected
  3109. when the compiler was configured; the defaults for the most common
  3110. choices are given below.
  3111.  
  3112. `-m68000'
  3113. `-mc68000'
  3114.      Generate output for a 68000.  This is the default when the
  3115.      compiler is configured for 68000-based systems.
  3116.  
  3117. `-m68020'
  3118. `-mc68020'
  3119.      Generate output for a 68020.  This is the default when the
  3120.      compiler is configured for 68020-based systems.
  3121.  
  3122. `-m68881'
  3123.      Generate output containing 68881 instructions for floating point.
  3124.      This is the default for most 68020 systems unless `-nfp' was
  3125.      specified when the compiler was configured.
  3126.  
  3127. `-m68030'
  3128.      Generate output for a 68030.  This is the default when the
  3129.      compiler is configured for 68030-based systems.
  3130.  
  3131. `-m68040'
  3132.      Generate output for a 68040.  This is the default when the
  3133.      compiler is configured for 68040-based systems.
  3134.  
  3135.      This option inhibits the use of 68881/68882 instructions that have
  3136.      to be emulated by software on the 68040.  If your 68040 does not
  3137.      have code to emulate those instructions, use `-m68040'.
  3138.  
  3139. `-m68020-40'
  3140.      Generate output for a 68040, without using any of the new
  3141.      instructions.  This results in code which can run relatively
  3142.      efficiently on either a 68020/68881 or a 68030 or a 68040.  The
  3143.      generated code does use the 68881 instructions that are emulated
  3144.      on the 68040.
  3145.  
  3146. `-mfpa'
  3147.      Generate output containing Sun FPA instructions for floating point.
  3148.  
  3149. `-msoft-float'
  3150.      Generate output containing library calls for floating point.
  3151.      *Warning:* the requisite libraries are not available for all m68k
  3152.      targets.  Normally the facilities of the machine's usual C
  3153.      compiler are used, but this can't be done directly in
  3154.      cross-compilation.  You must make your own arrangements to provide
  3155.      suitable library functions for cross-compilation.  The embedded
  3156.      targets `m68k-*-aout' and `m68k-*-coff' do provide software
  3157.      floating point support.
  3158.  
  3159. `-mshort'
  3160.      Consider type `int' to be 16 bits wide, like `short int'.
  3161.  
  3162. `-mnobitfield'
  3163.      Do not use the bit-field instructions.  The `-m68000' option
  3164.      implies `-mnobitfield'.
  3165.  
  3166. `-mbitfield'
  3167.      Do use the bit-field instructions.  The `-m68020' option implies
  3168.      `-mbitfield'.  This is the default if you use a configuration
  3169.      designed for a 68020.
  3170.  
  3171. `-mrtd'
  3172.      Use a different function-calling convention, in which functions
  3173.      that take a fixed number of arguments return with the `rtd'
  3174.      instruction, which pops their arguments while returning.  This
  3175.      saves one instruction in the caller since there is no need to pop
  3176.      the arguments there.
  3177.  
  3178.      This calling convention is incompatible with the one normally used
  3179.      on Unix, so you cannot use it if you need to call libraries
  3180.      compiled with the Unix compiler.
  3181.  
  3182.      Also, you must provide function prototypes for all functions that
  3183.      take variable numbers of arguments (including `printf'); otherwise
  3184.      incorrect code will be generated for calls to those functions.
  3185.  
  3186.      In addition, seriously incorrect code will result if you call a
  3187.      function with too many arguments.  (Normally, extra arguments are
  3188.      harmlessly ignored.)
  3189.  
  3190.      The `rtd' instruction is supported by the 68010 and 68020
  3191.      processors, but not by the 68000.
  3192.  
  3193. 
  3194. File: use,  Node: VAX Options,  Next: SPARC Options,  Prev: M680x0 Options,  Up: Submodel Options
  3195.  
  3196. VAX Options
  3197. -----------
  3198.  
  3199.    These `-m' options are defined for the Vax:
  3200.  
  3201. `-munix'
  3202.      Do not output certain jump instructions (`aobleq' and so on) that
  3203.      the Unix assembler for the Vax cannot handle across long ranges.
  3204.  
  3205. `-mgnu'
  3206.      Do output those jump instructions, on the assumption that you will
  3207.      assemble with the GNU assembler.
  3208.  
  3209. `-mg'
  3210.      Output code for g-format floating point numbers instead of
  3211.      d-format.
  3212.  
  3213. 
  3214. File: use,  Node: SPARC Options,  Next: Convex Options,  Prev: VAX Options,  Up: Submodel Options
  3215.  
  3216. SPARC Options
  3217. -------------
  3218.  
  3219.    These `-m' switches are supported on the SPARC:
  3220.  
  3221. `-mno-app-regs'
  3222. `-mapp-regs'
  3223.      Specify `-mapp-regs' to generate output using the global registers
  3224.      2 through 4, which the SPARC SVR4 ABI reserves for applications.
  3225.      This is the default.
  3226.  
  3227.      To be fully SVR4 ABI compliant at the cost of some performance
  3228.      loss, specify `-mno-app-regs'.  You should compile libraries and
  3229.      system software with this option.
  3230.  
  3231. `-mfpu'
  3232. `-mhard-float'
  3233.      Generate output containing floating point instructions.  This is
  3234.      the default.
  3235.  
  3236. `-mno-fpu'
  3237. `-msoft-float'
  3238.      Generate output containing library calls for floating point.
  3239.      *Warning:* the requisite libraries are not available for all SPARC
  3240.      targets.  Normally the facilities of the machine's usual C
  3241.      compiler are used, but this cannot be done directly in
  3242.      cross-compilation.  You must make your own arrangements to provide
  3243.      suitable library functions for cross-compilation.  The embedded
  3244.      targets `sparc-*-aout' and `sparclite-*-*' do provide software
  3245.      floating point support.
  3246.  
  3247.      `-msoft-float' changes the calling convention in the output file;
  3248.      therefore, it is only useful if you compile *all* of a program with
  3249.      this option.  In particular, you need to compile `libgcc.a', the
  3250.      library that comes with GNU CC, with `-msoft-float' in order for
  3251.      this to work.
  3252.  
  3253. `-mhard-quad-float'
  3254.      Generate output containing quad-word (long double) floating point
  3255.      instructions.
  3256.  
  3257. `-msoft-quad-float'
  3258.      Generate output containing library calls for quad-word (long
  3259.      double) floating point instructions.  The functions called are
  3260.      those specified in the SPARC ABI.  This is the default.
  3261.  
  3262.      As of this writing, there are no sparc implementations that have
  3263.      hardware support for the quad-word floating point instructions.
  3264.      They all invoke a trap handler for one of these instructions, and
  3265.      then the trap handler emulates the effect of the instruction.
  3266.      Because of the trap handler overhead, this is much slower than
  3267.      calling the ABI library routines.  Thus the `-msoft-quad-float'
  3268.      option is the default.
  3269.  
  3270. `-mno-epilogue'
  3271. `-mepilogue'
  3272.      With `-mepilogue' (the default), the compiler always emits code for
  3273.      function exit at the end of each function.  Any function exit in
  3274.      the middle of the function (such as a return statement in C) will
  3275.      generate a jump to the exit code at the end of the function.
  3276.  
  3277.      With `-mno-epilogue', the compiler tries to emit exit code inline
  3278.      at every function exit.
  3279.  
  3280. `-mno-flat'
  3281. `-mflat'
  3282.      With `-mflat', the compiler does not generate save/restore
  3283.      instructions and will use a "flat" or single register window
  3284.      calling convention.  This model uses %i7 as the frame pointer and
  3285.      is compatible with the normal register window model.  Code from
  3286.      either may be intermixed although debugger support is still
  3287.      incomplete.  The local registers and the input registers (0-5) are
  3288.      still treated as "call saved" registers and will be saved on the
  3289.      stack as necessary.
  3290.  
  3291.      With `-mno-flat' (the default), the compiler emits save/restore
  3292.      instructions (except for leaf functions) and is the normal mode of
  3293.      operation.
  3294.  
  3295. `-mno-unaligned-doubles'
  3296. `-munaligned-doubles'
  3297.      Assume that doubles have 8 byte alignment.  This is the default.
  3298.  
  3299.      With `-munaligned-doubles', GNU CC assumes that doubles have 8 byte
  3300.      alignment only if they are contained in another type, or if they
  3301.      have an absolute address.  Otherwise, it assumes they have 4 byte
  3302.      alignment.  Specifying this option avoids some rare compatibility
  3303.      problems with code generated by other compilers.  It is not the
  3304.      default because it results in a performance loss, especially for
  3305.      floating point code.
  3306.  
  3307. `-mv8'
  3308. `-msparclite'
  3309.      These two options select variations on the SPARC architecture.
  3310.  
  3311.      By default (unless specifically configured for the Fujitsu
  3312.      SPARClite), GCC generates code for the v7 variant of the SPARC
  3313.      architecture.
  3314.  
  3315.      `-mv8' will give you SPARC v8 code.  The only difference from v7
  3316.      code is that the compiler emits the integer multiply and integer
  3317.      divide instructions which exist in SPARC v8 but not in SPARC v7.
  3318.  
  3319.      `-msparclite' will give you SPARClite code.  This adds the integer
  3320.      multiply, integer divide step and scan (`ffs') instructions which
  3321.      exist in SPARClite but not in SPARC v7.
  3322.  
  3323. `-mcypress'
  3324. `-msupersparc'
  3325.      These two options select the processor for which the code is
  3326.      optimised.
  3327.  
  3328.      With `-mcypress' (the default), the compiler optimizes code for the
  3329.      Cypress CY7C602 chip, as used in the SparcStation/SparcServer 3xx
  3330.      series.  This is also appropriate for the older SparcStation 1, 2,
  3331.      IPX etc.
  3332.  
  3333.      With `-msupersparc' the compiler optimizes code for the SuperSparc
  3334.      cpu, as used in the SparcStation 10, 1000 and 2000 series. This
  3335.      flag also enables use of the full SPARC v8 instruction set.
  3336.  
  3337.    In a future version of GCC, these options will very likely be
  3338. renamed to `-mcpu=cypress' and `-mcpu=supersparc'.
  3339.  
  3340.    These `-m' switches are supported in addition to the above on SPARC
  3341. V9 processors:
  3342.  
  3343. `-mmedlow'
  3344.      Generate code for the Medium/Low code model: assume a 32 bit
  3345.      address space.  Programs are statically linked, PIC is not
  3346.      supported.  Pointers are still 64 bits.
  3347.  
  3348.      It is very likely that a future version of GCC will rename this
  3349.      option.
  3350.  
  3351. `-mmedany'
  3352.      Generate code for the Medium/Anywhere code model: assume a 32 bit
  3353.      text segment starting at offset 0, and a 32 bit data segment
  3354.      starting anywhere (determined at link time).  Programs are
  3355.      statically linked, PIC is not supported.  Pointers are still 64
  3356.      bits.
  3357.  
  3358.      It is very likely that a future version of GCC will rename this
  3359.      option.
  3360.  
  3361. `-mint64'
  3362.      Types long and int are 64 bits.
  3363.  
  3364. `-mlong32'
  3365.      Types long and int are 32 bits.
  3366.  
  3367. `-mlong64'
  3368. `-mint32'
  3369.      Type long is 64 bits, and type int is 32 bits.
  3370.  
  3371. `-mstack-bias'
  3372. `-mno-stack-bias'
  3373.      With `-mstack-bias', GNU CC assumes that the stack pointer, and
  3374.      frame pointer if present, are offset by -2047 which must be added
  3375.      back when making stack frame references.  Otherwise, assume no
  3376.      such offset is present.
  3377.  
  3378. 
  3379. File: use,  Node: Convex Options,  Next: AMD29K Options,  Prev: SPARC Options,  Up: Submodel Options
  3380.  
  3381. Convex Options
  3382. --------------
  3383.  
  3384.    These `-m' options are defined for Convex:
  3385.  
  3386. `-mc1'
  3387.      Generate output for C1.  The code will run on any Convex machine.
  3388.      The preprocessor symbol `__convex__c1__' is defined.
  3389.  
  3390. `-mc2'
  3391.      Generate output for C2.  Uses instructions not available on C1.
  3392.      Scheduling and other optimizations are chosen for max performance
  3393.      on C2.  The preprocessor symbol `__convex_c2__' is defined.
  3394.  
  3395. `-mc32'
  3396.      Generate output for C32xx.  Uses instructions not available on C1.
  3397.      Scheduling and other optimizations are chosen for max performance
  3398.      on C32.  The preprocessor symbol `__convex_c32__' is defined.
  3399.  
  3400. `-mc34'
  3401.      Generate output for C34xx.  Uses instructions not available on C1.
  3402.      Scheduling and other optimizations are chosen for max performance
  3403.      on C34.  The preprocessor symbol `__convex_c34__' is defined.
  3404.  
  3405. `-mc38'
  3406.      Generate output for C38xx.  Uses instructions not available on C1.
  3407.      Scheduling and other optimizations are chosen for max performance
  3408.      on C38.  The preprocessor symbol `__convex_c38__' is defined.
  3409.  
  3410. `-margcount'
  3411.      Generate code which puts an argument count in the word preceding
  3412.      each argument list.  This is compatible with regular CC, and a few
  3413.      programs may need the argument count word.  GDB and other
  3414.      source-level debuggers do not need it; this info is in the symbol
  3415.      table.
  3416.  
  3417. `-mnoargcount'
  3418.      Omit the argument count word.  This is the default.
  3419.  
  3420. `-mvolatile-cache'
  3421.      Allow volatile references to be cached.  This is the default.
  3422.  
  3423. `-mvolatile-nocache'
  3424.      Volatile references bypass the data cache, going all the way to
  3425.      memory.  This is only needed for multi-processor code that does
  3426.      not use standard synchronization instructions.  Making
  3427.      non-volatile references to volatile locations will not necessarily
  3428.      work.
  3429.  
  3430. `-mlong32'
  3431.      Type long is 32 bits, the same as type int.  This is the default.
  3432.  
  3433. `-mlong64'
  3434.      Type long is 64 bits, the same as type long long.  This option is
  3435.      useless, because no library support exists for it.
  3436.  
  3437. 
  3438. File: use,  Node: AMD29K Options,  Next: ARM Options,  Prev: Convex Options,  Up: Submodel Options
  3439.  
  3440. AMD29K Options
  3441. --------------
  3442.  
  3443.    These `-m' options are defined for the AMD Am29000:
  3444.  
  3445. `-mdw'
  3446.      Generate code that assumes the `DW' bit is set, i.e., that byte and
  3447.      halfword operations are directly supported by the hardware.  This
  3448.      is the default.
  3449.  
  3450. `-mndw'
  3451.      Generate code that assumes the `DW' bit is not set.
  3452.  
  3453. `-mbw'
  3454.      Generate code that assumes the system supports byte and halfword
  3455.      write operations.  This is the default.
  3456.  
  3457. `-mnbw'
  3458.      Generate code that assumes the systems does not support byte and
  3459.      halfword write operations.  `-mnbw' implies `-mndw'.
  3460.  
  3461. `-msmall'
  3462.      Use a small memory model that assumes that all function addresses
  3463.      are either within a single 256 KB segment or at an absolute
  3464.      address of less than 256k.  This allows the `call' instruction to
  3465.      be used instead of a `const', `consth', `calli' sequence.
  3466.  
  3467. `-mnormal'
  3468.      Use the normal memory model: Generate `call' instructions only when
  3469.      calling functions in the same file and `calli' instructions
  3470.      otherwise.  This works if each file occupies less than 256 KB but
  3471.      allows the entire executable to be larger than 256 KB.  This is
  3472.      the default.
  3473.  
  3474. `-mlarge'
  3475.      Always use `calli' instructions.  Specify this option if you expect
  3476.      a single file to compile into more than 256 KB of code.
  3477.  
  3478. `-m29050'
  3479.      Generate code for the Am29050.
  3480.  
  3481. `-m29000'
  3482.      Generate code for the Am29000.  This is the default.
  3483.  
  3484. `-mkernel-registers'
  3485.      Generate references to registers `gr64-gr95' instead of to
  3486.      registers `gr96-gr127'.  This option can be used when compiling
  3487.      kernel code that wants a set of global registers disjoint from
  3488.      that used by user-mode code.
  3489.  
  3490.      Note that when this option is used, register names in `-f' flags
  3491.      must use the normal, user-mode, names.
  3492.  
  3493. `-muser-registers'
  3494.      Use the normal set of global registers, `gr96-gr127'.  This is the
  3495.      default.
  3496.  
  3497. `-mstack-check'
  3498. `-mno-stack-check'
  3499.      Insert (or do not insert) a call to `__msp_check' after each stack
  3500.      adjustment.  This is often used for kernel code.
  3501.  
  3502. `-mstorem-bug'
  3503. `-mno-storem-bug'
  3504.      `-mstorem-bug' handles 29k processors which cannot handle the
  3505.      separation of a mtsrim insn and a storem instruction (most 29000
  3506.      chips to date, but not the 29050).
  3507.  
  3508. `-mno-reuse-arg-regs'
  3509. `-mreuse-arg-regs'
  3510.      `-mno-reuse-arg-regs' tells the compiler to only use incoming
  3511.      argument registers for copying out arguments.  This helps detect
  3512.      calling a function with fewer arguments than it was declared with.
  3513.  
  3514. `-msoft-float'
  3515.      Generate output containing library calls for floating point.
  3516.      *Warning:* the requisite libraries are not part of GNU CC.
  3517.      Normally the facilities of the machine's usual C compiler are
  3518.      used, but this can't be done directly in cross-compilation.  You
  3519.      must make your own arrangements to provide suitable library
  3520.      functions for cross-compilation.
  3521.  
  3522. 
  3523. File: use,  Node: ARM Options,  Next: M88K Options,  Prev: AMD29K Options,  Up: Submodel Options
  3524.  
  3525. ARM Options
  3526. -----------
  3527.  
  3528.    These `-m' options are defined for Advanced RISC Machines (ARM)
  3529. architectures:
  3530.  
  3531. `-m2'
  3532. `-m3'
  3533.      These options are identical.  Generate code for the ARM2 and ARM3
  3534.      processors.  This option is the default.  You should also use this
  3535.      option to generate code for ARM6 processors that are running with a
  3536.      26-bit program counter.
  3537.  
  3538. `-m6'
  3539.      Generate code for the ARM6 processor when running with a 32-bit
  3540.      program counter.
  3541.  
  3542. `-mapcs'
  3543.      Generate a stack frame that is compliant with the ARM Procedure
  3544.      Call Standard for all functions, even if this is not strictly
  3545.      necessary for correct execution of the code.
  3546.  
  3547. `-mbsd'
  3548.      This option only applies to RISC iX.  Emulate the native BSD-mode
  3549.      compiler.  This is the default if `-ansi' is not specified.
  3550.  
  3551. `-mxopen'
  3552.      This option only applies to RISC iX.  Emulate the native
  3553.      X/Open-mode compiler.
  3554.  
  3555. `-mno-symrename'
  3556.      This option only applies to RISC iX.  Do not run the assembler
  3557.      post-processor, `symrename', after code has been assembled.
  3558.      Normally it is necessary to modify some of the standard symbols in
  3559.      preparation for linking with the RISC iX C library; this option
  3560.      suppresses this pass.  The post-processor is never run when the
  3561.      compiler is built for cross-compilation.
  3562.  
  3563. 
  3564. File: use,  Node: M88K Options,  Next: RS/6000 and PowerPC Options,  Prev: ARM Options,  Up: Submodel Options
  3565.  
  3566. M88K Options
  3567. ------------
  3568.  
  3569.    These `-m' options are defined for Motorola 88k architectures:
  3570.  
  3571. `-m88000'
  3572.      Generate code that works well on both the m88100 and the m88110.
  3573.  
  3574. `-m88100'
  3575.      Generate code that works best for the m88100, but that also runs
  3576.      on the m88110.
  3577.  
  3578. `-m88110'
  3579.      Generate code that works best for the m88110, and may not run on
  3580.      the m88100.
  3581.  
  3582. `-mbig-pic'
  3583.      Obsolete option to be removed from the next revision.  Use `-fPIC'.
  3584.  
  3585. `-midentify-revision'
  3586.      Include an `ident' directive in the assembler output recording the
  3587.      source file name, compiler name and version, timestamp, and
  3588.      compilation flags used.
  3589.  
  3590. `-mno-underscores'
  3591.      In assembler output, emit symbol names without adding an underscore
  3592.      character at the beginning of each name.  The default is to use an
  3593.      underscore as prefix on each name.
  3594.  
  3595. `-mocs-debug-info'
  3596. `-mno-ocs-debug-info'
  3597.      Include (or omit) additional debugging information (about
  3598.      registers used in each stack frame) as specified in the 88open
  3599.      Object Compatibility Standard, "OCS".  This extra information
  3600.      allows debugging of code that has had the frame pointer
  3601.      eliminated.  The default for DG/UX, SVr4, and Delta 88 SVr3.2 is
  3602.      to include this information; other 88k configurations omit this
  3603.      information by default.
  3604.  
  3605. `-mocs-frame-position'
  3606.      When emitting COFF debugging information for automatic variables
  3607.      and parameters stored on the stack, use the offset from the
  3608.      canonical frame address, which is the stack pointer (register 31)
  3609.      on entry to the function.  The DG/UX, SVr4, Delta88 SVr3.2, and
  3610.      BCS configurations use `-mocs-frame-position'; other 88k
  3611.      configurations have the default `-mno-ocs-frame-position'.
  3612.  
  3613. `-mno-ocs-frame-position'
  3614.      When emitting COFF debugging information for automatic variables
  3615.      and parameters stored on the stack, use the offset from the frame
  3616.      pointer register (register 30).  When this option is in effect,
  3617.      the frame pointer is not eliminated when debugging information is
  3618.      selected by the -g switch.
  3619.  
  3620. `-moptimize-arg-area'
  3621. `-mno-optimize-arg-area'
  3622.      Control how function arguments are stored in stack frames.
  3623.      `-moptimize-arg-area' saves space by optimizing them, but this
  3624.      conflicts with the 88open specifications.  The opposite
  3625.      alternative, `-mno-optimize-arg-area', agrees with 88open
  3626.      standards.  By default GNU CC does not optimize the argument area.
  3627.  
  3628. `-mshort-data-NUM'
  3629.      Generate smaller data references by making them relative to `r0',
  3630.      which allows loading a value using a single instruction (rather
  3631.      than the usual two).  You control which data references are
  3632.      affected by specifying NUM with this option.  For example, if you
  3633.      specify `-mshort-data-512', then the data references affected are
  3634.      those involving displacements of less than 512 bytes.
  3635.      `-mshort-data-NUM' is not effective for NUM greater than 64k.
  3636.  
  3637. `-mserialize-volatile'
  3638. `-mno-serialize-volatile'
  3639.      Do, or don't, generate code to guarantee sequential consistency of
  3640.      volatile memory references.  By default, consistency is guaranteed.
  3641.  
  3642.      The order of memory references made by the MC88110 processor does
  3643.      not always match the order of the instructions requesting those
  3644.      references.  In particular, a load instruction may execute before
  3645.      a preceding store instruction.  Such reordering violates
  3646.      sequential consistency of volatile memory references, when there
  3647.      are multiple processors.   When consistency must be guaranteed,
  3648.      GNU C generates special instructions, as needed, to force
  3649.      execution in the proper order.
  3650.  
  3651.      The MC88100 processor does not reorder memory references and so
  3652.      always provides sequential consistency.  However, by default, GNU
  3653.      C generates the special instructions to guarantee consistency even
  3654.      when you use `-m88100', so that the code may be run on an MC88110
  3655.      processor.  If you intend to run your code only on the MC88100
  3656.      processor, you may use `-mno-serialize-volatile'.
  3657.  
  3658.      The extra code generated to guarantee consistency may affect the
  3659.      performance of your application.  If you know that you can safely
  3660.      forgo this guarantee, you may use `-mno-serialize-volatile'.
  3661.  
  3662. `-msvr4'
  3663. `-msvr3'
  3664.      Turn on (`-msvr4') or off (`-msvr3') compiler extensions related
  3665.      to System V release 4 (SVr4).  This controls the following:
  3666.  
  3667.        1. Which variant of the assembler syntax to emit.
  3668.  
  3669.        2. `-msvr4' makes the C preprocessor recognize `#pragma weak'
  3670.           that is used on System V release 4.
  3671.  
  3672.        3. `-msvr4' makes GNU CC issue additional declaration directives
  3673.           used in SVr4.
  3674.  
  3675.      `-msvr4' is the default for the m88k-motorola-sysv4 and
  3676.      m88k-dg-dgux m88k configurations. `-msvr3' is the default for all
  3677.      other m88k configurations.
  3678.  
  3679. `-mversion-03.00'
  3680.      This option is obsolete, and is ignored.
  3681.  
  3682. `-mno-check-zero-division'
  3683. `-mcheck-zero-division'
  3684.      Do, or don't, generate code to guarantee that integer division by
  3685.      zero will be detected.  By default, detection is guaranteed.
  3686.  
  3687.      Some models of the MC88100 processor fail to trap upon integer
  3688.      division by zero under certain conditions.  By default, when
  3689.      compiling code that might be run on such a processor, GNU C
  3690.      generates code that explicitly checks for zero-valued divisors and
  3691.      traps with exception number 503 when one is detected.  Use of
  3692.      mno-check-zero-division suppresses such checking for code
  3693.      generated to run on an MC88100 processor.
  3694.  
  3695.      GNU C assumes that the MC88110 processor correctly detects all
  3696.      instances of integer division by zero.  When `-m88110' is
  3697.      specified, both `-mcheck-zero-division' and
  3698.      `-mno-check-zero-division' are ignored, and no explicit checks for
  3699.      zero-valued divisors are generated.
  3700.  
  3701. `-muse-div-instruction'
  3702.      Use the div instruction for signed integer division on the MC88100
  3703.      processor.  By default, the div instruction is not used.
  3704.  
  3705.      On the MC88100 processor the signed integer division instruction
  3706.      div) traps to the operating system on a negative operand.  The
  3707.      operating system transparently completes the operation, but at a
  3708.      large cost in execution time.  By default, when compiling code
  3709.      that might be run on an MC88100 processor, GNU C emulates signed
  3710.      integer division using the unsigned integer division instruction
  3711.      divu), thereby avoiding the large penalty of a trap to the
  3712.      operating system.  Such emulation has its own, smaller, execution
  3713.      cost in both time and space.  To the extent that your code's
  3714.      important signed integer division operations are performed on two
  3715.      nonnegative operands, it may be desirable to use the div
  3716.      instruction directly.
  3717.  
  3718.      On the MC88110 processor the div instruction (also known as the
  3719.      divs instruction) processes negative operands without trapping to
  3720.      the operating system.  When `-m88110' is specified,
  3721.      `-muse-div-instruction' is ignored, and the div instruction is used
  3722.      for signed integer division.
  3723.  
  3724.      Note that the result of dividing INT_MIN by -1 is undefined.  In
  3725.      particular, the behavior of such a division with and without
  3726.      `-muse-div-instruction'  may differ.
  3727.  
  3728. `-mtrap-large-shift'
  3729. `-mhandle-large-shift'
  3730.      Include code to detect bit-shifts of more than 31 bits;
  3731.      respectively, trap such shifts or emit code to handle them
  3732.      properly.  By default GNU CC makes no special provision for large
  3733.      bit shifts.
  3734.  
  3735. `-mwarn-passed-structs'
  3736.      Warn when a function passes a struct as an argument or result.
  3737.      Structure-passing conventions have changed during the evolution of
  3738.      the C language, and are often the source of portability problems.
  3739.      By default, GNU CC issues no such warning.
  3740.  
  3741. 
  3742. File: use,  Node: RS/6000 and PowerPC Options,  Next: RT Options,  Prev: M88K Options,  Up: Submodel Options
  3743.  
  3744. IBM RS/6000 and PowerPC Options
  3745. -------------------------------
  3746.  
  3747.    These `-m' options are defined for the IBM RS/6000 and PowerPC:
  3748. `-mpower'
  3749. `-mno-power'
  3750. `-mpower2'
  3751. `-mno-power2'
  3752. `-mpowerpc'
  3753. `-mno-powerpc'
  3754. `-mpowerpc-gpopt'
  3755. `-mno-powerpc-gpopt'
  3756. `-mpowerpc-gfxopt'
  3757. `-mno-powerpc-gfxopt'
  3758.      GNU CC supports two related instruction set architectures for the
  3759.      RS/6000 and PowerPC.  The "POWER" instruction set are those
  3760.      instructions supported by the `rios' chip set used in the original
  3761.      RS/6000 systems and the "PowerPC" instruction set is the
  3762.      architecture of the Motorola MPC6xx microprocessors.  The PowerPC
  3763.      architecture defines 64-bit instructions, but they are not
  3764.      supported by any current processors.
  3765.  
  3766.      Neither architecture is a subset of the other.  However there is a
  3767.      large common subset of instructions supported by both.  An MQ
  3768.      register is included in processors supporting the POWER
  3769.      architecture.
  3770.  
  3771.      You use these options to specify which instructions are available
  3772.      on the processor you are using.  The default value of these
  3773.      options is determined when configuring GNU CC.  Specifying the
  3774.      `-mcpu=CPU_TYPE' overrides the specification of these options.  We
  3775.      recommend you use that option rather than these.
  3776.  
  3777.      The `-mpower' option allows GNU CC to generate instructions that
  3778.      are found only in the POWER architecture and to use the MQ
  3779.      register.  Specifying `-mpower2' implies `-power' and also allows
  3780.      GNU CC to generate instructions that are present in the POWER2
  3781.      architecture but not the original POWER architecture.
  3782.  
  3783.      The `-mpowerpc' option allows GNU CC to generate instructions that
  3784.      are found only in the 32-bit subset of the PowerPC architecture.
  3785.      Specifying `-mpowerpc-gpopt' implies `-mpowerpc' and also allows
  3786.      GNU CC to use the optional PowerPC architecture instructions in the
  3787.      General Purpose group, including floating-point square root.
  3788.      Specifying `-mpowerpc-gfxopt' implies `-mpowerpc' and also allows
  3789.      GNU CC to use the optional PowerPC architecture instructions in
  3790.      the Graphics group, including floating-point select.
  3791.  
  3792.      If you specify both `-mno-power' and `-mno-powerpc', GNU CC will
  3793.      use only the instructions in the common subset of both
  3794.      architectures plus some special AIX common-mode calls, and will
  3795.      not use the MQ register.  Specifying both `-mpower' and `-mpowerpc'
  3796.      permits GNU CC to use any instruction from either architecture and
  3797.      to allow use of the MQ register; specify this for the Motorola
  3798.      MPC601.
  3799.  
  3800. `-mnew-mnemonics'
  3801. `-mold-mnemonics'
  3802.      Select which mnemonics to use in the generated assembler code.
  3803.      `-mnew-mnemonics' requests output that uses the assembler mnemonics
  3804.      defined for the PowerPC architecture, while `-mold-mnemonics'
  3805.      requests the assembler mnemonics defined for the POWER
  3806.      architecture.  Instructions defined in only one architecture have
  3807.      only one mnemonic; GNU CC uses that mnemonic irrespective of which
  3808.      of thse options is specified.
  3809.  
  3810.      PowerPC assemblers support both the old and new mnemonics, as will
  3811.      later POWER assemblers.  Current POWER assemblers only support the
  3812.      old mnemonics.  Specify `-mnew-mnemonics' if you have an assembler
  3813.      that supports them, otherwise specify `-mold-mnemonics'.
  3814.  
  3815.      The default value of these options depends on how GNU CC was
  3816.      configured.  Specifying `-mcpu=CPU_TYPE' sometimes overrides the
  3817.      value of these option.  Unless you are building a cross-compiler,
  3818.      you should normally not specify either `-mnew-mnemonics' or
  3819.      `-mold-mnemonics', but should instead accept the default.
  3820.  
  3821. `-mcpu=CPU_TYPE'
  3822.      Set architecture type, register usage, choice of mnemonics, and
  3823.      instruction scheduling parameters for machine type CPU_TYPE.  By
  3824.      default, CPU_TYPE is the target system defined when GNU CC was
  3825.      configured.  Supported values for CPU_TYPE are `rios1', `rios2',
  3826.      `rsc', `601', `603', `604', `power', `powerpc', `403', and
  3827.      `common'.  `-mcpu=power' and `-mcpu=powerpc' specify generic POWER
  3828.      and pure PowerPC (i.e., not MPC601) architecture machine types,
  3829.      with an appropriate, generic processor model assumed for
  3830.      scheduling purposes.
  3831.  
  3832.      Specifying `-mcpu=rios1', `-mcpu=rios2', `-mcpu=rsc', or
  3833.      `-mcpu=power' enables the `-mpower' option and disables the
  3834.      `-mpowerpc' option; `-mcpu=601' enables both the `-mpower' and
  3835.      `-mpowerpc' options; `-mcpu=603', `-mcpu=604', `-mcpu=403', and
  3836.      `-mcpu=powerpc' enable the `-mpowerpc' option and disable the
  3837.      `-mpower' option; `-mcpu=common' disables both the `-mpower' and
  3838.      `-mpowerpc' options.
  3839.  
  3840.      To generate code that will operate on all members of the RS/6000
  3841.      and PowerPC families, specify `-mcpu=common'.  In that case, GNU CC
  3842.      will use only the instructions in the common subset of both
  3843.      architectures plus some special AIX common-mode calls, and will
  3844.      not use the MQ register.  GNU CC assumes a generic processor model
  3845.      for scheduling purposes.
  3846.  
  3847.      Specifying `-mcpu=rios1', `-mcpu=rios2', `-mcpu=rsc', or
  3848.      `-mcpu=power' also disables the `new-mnemonics' option.
  3849.      Specifying `-mcpu=601', `-mcpu=603', `-mcpu=604', `403', or
  3850.      `-mcpu=powerpc' also enables the `new-mnemonics' option.
  3851.  
  3852. `-mfull-toc'
  3853. `-mno-fp-in-toc'
  3854. `-mno-sum-in-toc'
  3855. `-mminimal-toc'
  3856.      Modify generation of the TOC (Table Of Contents), which is created
  3857.      for every executable file.  The `-mfull-toc' option is selected by
  3858.      default.  In that case, GNU CC will allocate at least one TOC
  3859.      entry for each unique non-automatic variable reference in your
  3860.      program.  GNU CC will also place floating-point constants in the
  3861.      TOC.  However, only 16,384 entries are available in the TOC.
  3862.  
  3863.      If you receive a linker error message that saying you have
  3864.      overflowed the available TOC space, you can reduce the amount of
  3865.      TOC space used with the `-mno-fp-in-toc' and `-mno-sum-in-toc'
  3866.      options.  `-mno-fp-in-toc' prevents GNU CC from putting
  3867.      floating-point constants in the TOC and `-mno-sum-in-toc' forces
  3868.      GNU CC to generate code to calculate the sum of an address and a
  3869.      constant at run-time instead of putting that sum into the TOC.
  3870.      You may specify one or both of these options.  Each causes GNU CC
  3871.      to produce very slightly slower and larger code at the expense of
  3872.      conserving TOC space.
  3873.  
  3874.      If you still run out of space in the TOC even when you specify
  3875.      both of these options, specify `-mminimal-toc' instead.  This
  3876.      option causes GNU CC to make only one TOC entry for every file.
  3877.      When you specify this option, GNU CC will produce code that is
  3878.      slower and larger but which uses extremely little TOC space.  You
  3879.      may wish to use this option only on files that contain less
  3880.      frequently executed code.
  3881.  
  3882. `-msoft-float'
  3883. `-mhard-float'
  3884.      Generate code that does not use (uses) the floating-point register
  3885.      set.  Software floating point emulation is provided if you use the
  3886.      `-msoft-float' option, and pass the option to GNU CC when linking.
  3887.  
  3888. `-mmultiple'
  3889. `-mno-multiple'
  3890.      Generate code that uses (does not use) the load multiple word
  3891.      instructions and the store multiple word instructions.  These
  3892.      instructions are generated by default on POWER systems, and not
  3893.      generated on PowerPC systems.  Do not use `-mmultiple' on little
  3894.      endian PowerPC systems, since those instructions do not work when
  3895.      the processor is in little endian mode.
  3896.  
  3897. `-mstring'
  3898. `-mno-string'
  3899.      Generate code that uses (does not use) the load string
  3900.      instructions and the store string word instructions to save
  3901.      multiple registers and do small block moves.  These instructions
  3902.      are generated by default on POWER systems, anod not generated on
  3903.      PowerPC systems.  Do not use `-mstring' on little endian PowerPC
  3904.      systems, since those instructions do not work when the processor
  3905.      is in little endian mode.
  3906.  
  3907. `-mno-bit-align'
  3908. `-mbit-align'
  3909.      On System V.4 and embedded PowerPC systems do not (do) force
  3910.      structures and unions that contain bit fields to be aligned to the
  3911.      base type of the bit field.
  3912.  
  3913.      For example, by default a structure containing nothing but 8
  3914.      `unsigned' bitfields of length 1 would be aligned to a 4 byte
  3915.      boundary and have a size of 4 bytes.  By using `-mno-bit-align',
  3916.      the structure would be aligned to a 1 byte boundary and be one
  3917.      byte in size.
  3918.  
  3919. `-mno-strict-align'
  3920. `-mstrict-align'
  3921.      On System V.4 and embedded PowerPC systems do not (do) assume that
  3922.      unaligned memory references will be handled by the system.
  3923.  
  3924. `-mrelocatable'
  3925. `-mno-relocatable'
  3926.      On embedded PowerPC systems generate code that allows (does not
  3927.      allow) the program to be relocated to a different address at
  3928.      runtime.
  3929.  
  3930. `-mno-toc'
  3931. `-mtoc'
  3932.      On System V.4 and embedded PowerPC systems do not (do) assume that
  3933.      register 2 contains a pointer to a global area pointing to the
  3934.      addresses used in the program.
  3935.  
  3936. `-mno-traceback'
  3937. `-mtraceback'
  3938.      On embedded PowerPC systems do not (do) generate a traceback tag
  3939.      before the start of the function.  This tag can be used by the
  3940.      debugger to identify where the start of a function is.
  3941.  
  3942. `-mlittle'
  3943. `-mlittle-endian'
  3944.      On System V.4 and embedded PowerPC systems compile code for the
  3945.      processor in little endian mode.  The `-mlittle-endian' option is
  3946.      the same as `-mlittle'.
  3947.  
  3948. `-mbig'
  3949. `-mbig-endian'
  3950.      On System V.4 and embedded PowerPC systems compile code for the
  3951.      processor in big endian mode.  The `-mbig-endian' option is the
  3952.      same as `-mbig'.
  3953.  
  3954. 
  3955. File: use,  Node: RT Options,  Next: MIPS Options,  Prev: RS/6000 and PowerPC Options,  Up: Submodel Options
  3956.  
  3957. IBM RT Options
  3958. --------------
  3959.  
  3960.    These `-m' options are defined for the IBM RT PC:
  3961.  
  3962. `-min-line-mul'
  3963.      Use an in-line code sequence for integer multiplies.  This is the
  3964.      default.
  3965.  
  3966. `-mcall-lib-mul'
  3967.      Call `lmul$$' for integer multiples.
  3968.  
  3969. `-mfull-fp-blocks'
  3970.      Generate full-size floating point data blocks, including the
  3971.      minimum amount of scratch space recommended by IBM.  This is the
  3972.      default.
  3973.  
  3974. `-mminimum-fp-blocks'
  3975.      Do not include extra scratch space in floating point data blocks.
  3976.      This results in smaller code, but slower execution, since scratch
  3977.      space must be allocated dynamically.
  3978.  
  3979. `-mfp-arg-in-fpregs'
  3980.      Use a calling sequence incompatible with the IBM calling
  3981.      convention in which floating point arguments are passed in
  3982.      floating point registers.  Note that `varargs.h' and `stdargs.h'
  3983.      will not work with floating point operands if this option is
  3984.      specified.
  3985.  
  3986. `-mfp-arg-in-gregs'
  3987.      Use the normal calling convention for floating point arguments.
  3988.      This is the default.
  3989.  
  3990. `-mhc-struct-return'
  3991.      Return structures of more than one word in memory, rather than in a
  3992.      register.  This provides compatibility with the MetaWare HighC (hc)
  3993.      compiler.  Use the option `-fpcc-struct-return' for compatibility
  3994.      with the Portable C Compiler (pcc).
  3995.  
  3996. `-mnohc-struct-return'
  3997.      Return some structures of more than one word in registers, when
  3998.      convenient.  This is the default.  For compatibility with the
  3999.      IBM-supplied compilers, use the option `-fpcc-struct-return' or the
  4000.      option `-mhc-struct-return'.
  4001.  
  4002. 
  4003. File: use,  Node: MIPS Options,  Next: i386 Options,  Prev: RT Options,  Up: Submodel Options
  4004.  
  4005. MIPS Options
  4006. ------------
  4007.  
  4008.    These `-m' options are defined for the MIPS family of computers:
  4009.  
  4010. `-mcpu=CPU TYPE'
  4011.      Assume the defaults for the machine type CPU TYPE when scheduling
  4012.      instructions.  The choices for CPU TYPE are `r2000', `r3000',
  4013.      `r4000', `r4400', `r4600', and `r6000'.  While picking a specific
  4014.      CPU TYPE will schedule things appropriately for that particular
  4015.      chip, the compiler will not generate any code that does not meet
  4016.      level 1 of the MIPS ISA (instruction set architecture) without the
  4017.      `-mips2' or `-mips3' switches being used.
  4018.  
  4019. `-mips1'
  4020.      Issue instructions from level 1 of the MIPS ISA.  This is the
  4021.      default.  `r3000' is the default CPU TYPE at this ISA level.
  4022.  
  4023. `-mips2'
  4024.      Issue instructions from level 2 of the MIPS ISA (branch likely,
  4025.      square root instructions).  `r6000' is the default CPU TYPE at this
  4026.      ISA level.
  4027.  
  4028. `-mips3'
  4029.      Issue instructions from level 3 of the MIPS ISA (64 bit
  4030.      instructions).  `r4000' is the default CPU TYPE at this ISA level.
  4031.      This option does not change the sizes of any of the C data types.
  4032.  
  4033. `-mfp32'
  4034.      Assume that 32 32-bit floating point registers are available.
  4035.      This is the default.
  4036.  
  4037. `-mfp64'
  4038.      Assume that 32 64-bit floating point registers are available.
  4039.      This is the default when the `-mips3' option is used.
  4040.  
  4041. `-mgp32'
  4042.      Assume that 32 32-bit general purpose registers are available.
  4043.      This is the default.
  4044.  
  4045. `-mgp64'
  4046.      Assume that 32 64-bit general purpose registers are available.
  4047.      This is the default when the `-mips3' option is used.
  4048.  
  4049. `-mint64'
  4050.      Types long, int, and pointer are 64 bits.  This works only if
  4051.      `-mips3' is also specified.
  4052.  
  4053. `-mlong64'
  4054.      Types long and pointer are 64 bits, and type int is 32 bits.  This
  4055.      works only if `-mips3' is also specified.
  4056.  
  4057. `-mmips-as'
  4058.      Generate code for the MIPS assembler, and invoke `mips-tfile' to
  4059.      add normal debug information.  This is the default for all
  4060.      platforms except for the OSF/1 reference platform, using the
  4061.      OSF/rose object format.  If the either of the `-gstabs' or
  4062.      `-gstabs+' switches are used, the `mips-tfile' program will
  4063.      encapsulate the stabs within MIPS ECOFF.
  4064.  
  4065. `-mgas'
  4066.      Generate code for the GNU assembler.  This is the default on the
  4067.      OSF/1 reference platform, using the OSF/rose object format.
  4068.  
  4069. `-mrnames'
  4070. `-mno-rnames'
  4071.      The `-mrnames' switch says to output code using the MIPS software
  4072.      names for the registers, instead of the hardware names (ie, A0
  4073.      instead of $4).  The only known assembler that supports this option
  4074.      is the Algorithmics assembler.
  4075.  
  4076. `-mgpopt'
  4077. `-mno-gpopt'
  4078.      The `-mgpopt' switch says to write all of the data declarations
  4079.      before the instructions in the text section, this allows the MIPS
  4080.      assembler to generate one word memory references instead of using
  4081.      two words for short global or static data items.  This is on by
  4082.      default if optimization is selected.
  4083.  
  4084. `-mstats'
  4085. `-mno-stats'
  4086.      For each non-inline function processed, the `-mstats' switch
  4087.      causes the compiler to emit one line to the standard error file to
  4088.      print statistics about the program (number of registers saved,
  4089.      stack size, etc.).
  4090.  
  4091. `-mmemcpy'
  4092. `-mno-memcpy'
  4093.      The `-mmemcpy' switch makes all block moves call the appropriate
  4094.      string function (`memcpy' or `bcopy') instead of possibly
  4095.      generating inline code.
  4096.  
  4097. `-mmips-tfile'
  4098. `-mno-mips-tfile'
  4099.      The `-mno-mips-tfile' switch causes the compiler not postprocess
  4100.      the object file with the `mips-tfile' program, after the MIPS
  4101.      assembler has generated it to add debug support.  If `mips-tfile'
  4102.      is not run, then no local variables will be available to the
  4103.      debugger.  In addition, `stage2' and `stage3' objects will have
  4104.      the temporary file names passed to the assembler embedded in the
  4105.      object file, which means the objects will not compare the same.
  4106.      The `-mno-mips-tfile' switch should only be used when there are
  4107.      bugs in the `mips-tfile' program that prevents compilation.
  4108.  
  4109. `-msoft-float'
  4110.      Generate output containing library calls for floating point.
  4111.      *Warning:* the requisite libraries are not part of GNU CC.
  4112.      Normally the facilities of the machine's usual C compiler are
  4113.      used, but this can't be done directly in cross-compilation.  You
  4114.      must make your own arrangements to provide suitable library
  4115.      functions for cross-compilation.
  4116.  
  4117. `-mhard-float'
  4118.      Generate output containing floating point instructions.  This is
  4119.      the default if you use the unmodified sources.
  4120.  
  4121. `-mabicalls'
  4122. `-mno-abicalls'
  4123.      Emit (or do not emit) the pseudo operations `.abicalls',
  4124.      `.cpload', and `.cprestore' that some System V.4 ports use for
  4125.      position independent code.
  4126.  
  4127. `-mlong-calls'
  4128. `-mno-long-calls'
  4129.      Do all calls with the `JALR' instruction, which requires loading
  4130.      up a function's address into a register before the call.  You need
  4131.      to use this switch, if you call outside of the current 512
  4132.      megabyte segment to functions that are not through pointers.
  4133.  
  4134. `-mhalf-pic'
  4135. `-mno-half-pic'
  4136.      Put pointers to extern references into the data section and load
  4137.      them up, rather than put the references in the text section.
  4138.  
  4139. `-membedded-pic'
  4140. `-mno-embedded-pic'
  4141.      Generate PIC code suitable for some embedded systems.  All calls
  4142.      are made using PC relative address, and all data is addressed
  4143.      using the $gp register.  This requires GNU as and GNU ld which do
  4144.      most of the work.
  4145.  
  4146. `-membedded-data'
  4147. `-mno-embedded-data'
  4148.      Allocate variables to the read-only data section first if
  4149.      possible, then next in the small data section if possible,
  4150.      otherwise in data.  This gives slightly slower code than the
  4151.      default, but reduces the amount of RAM required when executing,
  4152.      and thus may be preferred for some embedded systems.
  4153.  
  4154. `-msingle-float'
  4155. `-mdouble-float'
  4156.      The `-msingle-float' switch tells gcc to assume that the floating
  4157.      point coprocessor only supports single precision operations, as on
  4158.      the `r4650' chip.  The `-mdouble-float' switch permits gcc to use
  4159.      double precision operations.  This is the default.
  4160.  
  4161. `-mmad'
  4162. `-mno-mad'
  4163.      Permit use of the `mad', `madu' and `mul' instructions, as on the
  4164.      `r4650' chip.
  4165.  
  4166. `-m4650'
  4167.      Turns on `-msingle-float', `-mmad', and, at least for now,
  4168.      `-mcpu=r4650'.
  4169.  
  4170. `-EL'
  4171.      Compile code for the processor in little endian mode.  The
  4172.      requisite libraries are assumed to exist.
  4173.  
  4174. `-EB'
  4175.      Compile code for the processor in big endian mode.  The requisite
  4176.      libraries are assumed to exist.
  4177.  
  4178. `-G NUM'
  4179.      Put global and static items less than or equal to NUM bytes into
  4180.      the small data or bss sections instead of the normal data or bss
  4181.      section.  This allows the assembler to emit one word memory
  4182.      reference instructions based on the global pointer (GP or $28),
  4183.      instead of the normal two words used.  By default, NUM is 8 when
  4184.      the MIPS assembler is used, and 0 when the GNU assembler is used.
  4185.      The `-G NUM' switch is also passed to the assembler and linker.
  4186.      All modules should be compiled with the same `-G NUM' value.
  4187.  
  4188. `-nocpp'
  4189.      Tell the MIPS assembler to not run it's preprocessor over user
  4190.      assembler files (with a `.s' suffix) when assembling them.
  4191.  
  4192. 
  4193. File: use,  Node: i386 Options,  Next: HPPA Options,  Prev: MIPS Options,  Up: Submodel Options
  4194.  
  4195. Intel 386 Options
  4196. -----------------
  4197.  
  4198.    These `-m' options are defined for the i386 family of computers:
  4199.  
  4200. `-m486'
  4201. `-m386'
  4202.      Control whether or not code is optimized for a 486 instead of an
  4203.      386.  Code generated for an 486 will run on a 386 and vice versa.
  4204.  
  4205. `-mieee-fp'
  4206. `-mno-ieee-fp'
  4207.      Control whether or not the compiler uses IEEE floating point
  4208.      comparisons.  These handle correctly the case where the result of a
  4209.      comparison is unordered.
  4210.  
  4211. `-msoft-float'
  4212.      Generate output containing library calls for floating point.
  4213.      *Warning:* the requisite libraries are not part of GNU CC.
  4214.      Normally the facilities of the machine's usual C compiler are
  4215.      used, but this can't be done directly in cross-compilation.  You
  4216.      must make your own arrangements to provide suitable library
  4217.      functions for cross-compilation.
  4218.  
  4219.      On machines where a function returns floating point results in the
  4220.      80387 register stack, some floating point opcodes may be emitted
  4221.      even if `-msoft-float' is used.
  4222.  
  4223. `-mno-fp-ret-in-387'
  4224.      Do not use the FPU registers for return values of functions.
  4225.  
  4226.      The usual calling convention has functions return values of types
  4227.      `float' and `double' in an FPU register, even if there is no FPU.
  4228.      The idea is that the operating system should emulate an FPU.
  4229.  
  4230.      The option `-mno-fp-ret-in-387' causes such values to be returned
  4231.      in ordinary CPU registers instead.
  4232.  
  4233. `-mno-fancy-math-387'
  4234.      Some 387 emulators do not support the `sin', `cos' and `sqrt'
  4235.      instructions for the 387.  Specify this option to avoid generating
  4236.      those instructions. This option is the default on FreeBSD.  As of
  4237.      revision 2.6.1, these instructions are not generated unless you
  4238.      also use the `-ffast-math' switch.
  4239.  
  4240. `-malign-double'
  4241. `-mno-align-double'
  4242.      Control whether GNU CC aligns `double', `long double', and `long
  4243.      long' variables on a two word boundary or a one word boundary.
  4244.      Aligning `double' variables on a two word boundary will produce
  4245.      code that runs somewhat faster on a `Pentium' at the expense of
  4246.      more memory.
  4247.  
  4248.      *Warning:* if you use the `-malign-double' switch, structures
  4249.      containing the above types will be aligned differently than the
  4250.      published application binary interface specifications for the 386.
  4251.  
  4252. `-msvr3-shlib'
  4253. `-mno-svr3-shlib'
  4254.      Control whether GNU CC places uninitialized locals into `bss' or
  4255.      `data'.  `-msvr3-shlib' places these locals into `bss'.  These
  4256.      options are meaningful only on System V Release 3.
  4257.  
  4258. `-mno-wide-multiply'
  4259. `-mwide-multiply'
  4260.      Control whether GNU CC uses the `mul' and `imul' that produce 64
  4261.      bit results in `eax:edx' from 32 bit operands to do `long long'
  4262.      multiplies and 32-bit division by constants.
  4263.  
  4264. `-mrtd'
  4265.      Use a different function-calling convention, in which functions
  4266.      that take a fixed number of arguments return with the `ret' NUM
  4267.      instruction, which pops their arguments while returning.  This
  4268.      saves one instruction in the caller since there is no need to pop
  4269.      the arguments there.
  4270.  
  4271.      You can specify that an individual function is called with this
  4272.      calling sequence with the function attribute `stdcall'.  You can
  4273.      also override the `-mrtd' option by using the function attribute
  4274.      `cdecl'. *Note Function Attributes::
  4275.  
  4276.      *Warning:* this calling convention is incompatible with the one
  4277.      normally used on Unix, so you cannot use it if you need to call
  4278.      libraries compiled with the Unix compiler.
  4279.  
  4280.      Also, you must provide function prototypes for all functions that
  4281.      take variable numbers of arguments (including `printf'); otherwise
  4282.      incorrect code will be generated for calls to those functions.
  4283.  
  4284.      In addition, seriously incorrect code will result if you call a
  4285.      function with too many arguments.  (Normally, extra arguments are
  4286.      harmlessly ignored.)
  4287.  
  4288. `-mreg-alloc=REGS'
  4289.      Control the default allocation order of integer registers.  The
  4290.      string REGS is a series of letters specifying a register.  The
  4291.      supported letters are: `a' allocate EAX; `b' allocate EBX; `c'
  4292.      allocate ECX; `d' allocate EDX; `S' allocate ESI; `D' allocate
  4293.      EDI; `B' allocate EBP.
  4294.  
  4295. `-mregparm=NUM'
  4296.      Control how many registers are used to pass integer arguments.  By
  4297.      default, no registers are used to pass arguments, and at most 3
  4298.      registers can be used.  You can control this behavior for a
  4299.      specific function by using the function attribute `regparm'.
  4300.      *Note Function Attributes::
  4301.  
  4302.      *Warning:* if you use this switch, and NUM is nonzero, then you
  4303.      must build all modules with the same value, including any
  4304.      libraries.  This includes the system libraries and startup modules.
  4305.  
  4306. `-malign-loops=NUM'
  4307.      Align loops to a 2 raised to a NUM byte boundary.  If
  4308.      `-malign-loops' is not specified, the default is 2.
  4309.  
  4310. `-malign-jumps=NUM'
  4311.      Align instructions that are only jumped to to a 2 raised to a NUM
  4312.      byte boundary.  If `-malign-jumps' is not specified, the default is
  4313.      2 if optimizing for a 386, and 4 if optimizing for a 486.
  4314.  
  4315. `-malign-functions=NUM'
  4316.      Align the start of functions to a 2 raised to NUM byte boundary.
  4317.      If `-malign-jumps' is not specified, the default is 2 if optimizing
  4318.      for a 386, and 4 if optimizing for a 486.
  4319.  
  4320. 
  4321. File: use,  Node: HPPA Options,  Next: Intel 960 Options,  Prev: i386 Options,  Up: Submodel Options
  4322.  
  4323. HPPA Options
  4324. ------------
  4325.  
  4326.    These `-m' options are defined for the HPPA family of computers:
  4327.  
  4328. `-mpa-risc-1-0'
  4329.      Generate code for a PA 1.0 processor.
  4330.  
  4331. `-mpa-risc-1-1'
  4332.      Generate code for a PA 1.1 processor.
  4333.  
  4334. `-mjump-in-delay'
  4335.      Fill delay slots of function calls with unconditional jump
  4336.      instructions by modifying the return pointer for the function call
  4337.      to be the target of the conditional jump.
  4338.  
  4339. `-mmillicode-long-calls'
  4340.      Generate code which assumes millicode routines can not be reached
  4341.      by the standard millicode call sequence, linker-generated
  4342.      long-calls, or linker-modified millicode calls.  In practice this
  4343.      should only be needed for dynamicly linked executables with
  4344.      extremely large SHLIB_INFO sections.
  4345.  
  4346. `-mdisable-fpregs'
  4347.      Prevent floating point registers from being used in any manner.
  4348.      This is necessary for compiling kernels which perform lazy context
  4349.      switching of floating point registers.  If you use this option and
  4350.      attempt to perform floating point operations, the compiler will
  4351.      abort.
  4352.  
  4353. `-mdisable-indexing'
  4354.      Prevent the compiler from using indexing address modes.  This
  4355.      avoids some rather obscure problems when compiling MIG generated
  4356.      code under MACH.
  4357.  
  4358. `-mfast-indirect-calls'
  4359.      Generate code which performs faster indirect calls.  Such code is
  4360.      suitable for kernels and for static linking.  The fast indirect
  4361.      call code will fail miserably if it's part of a dynamically linked
  4362.      executable and in the presense of nested functions.
  4363.  
  4364. `-mportable-runtime'
  4365.      Use the portable calling conventions proposed by HP for ELF
  4366.      systems.
  4367.  
  4368. `-mgas'
  4369.      Enable the use of assembler directives only GAS understands.
  4370.  
  4371. `-mschedule=CPU TYPE'
  4372.      Schedule code according to the constraints for the machine type
  4373.      CPU TYPE.  The choices for CPU TYPE are `700' for 7N0 machines,
  4374.      `7100' for 7N5 machines, and `7100' for 7N2 machines.  `700' is
  4375.      the default for CPU TYPE.
  4376.  
  4377.      Note the `7100LC' scheduling information is incomplete and using
  4378.      `7100LC' often leads to bad schedules.  For now it's probably best
  4379.      to use `7100' instead of `7100LC' for the 7N2 machines.
  4380.  
  4381. `-msoft-float'
  4382.      Generate output containing library calls for floating point.
  4383.      *Warning:* the requisite libraries are not available for all HPPA
  4384.      targets.  Normally the facilities of the machine's usual C
  4385.      compiler are used, but this cannot be done directly in
  4386.      cross-compilation.  You must make your own arrangements to provide
  4387.      suitable library functions for cross-compilation.  The embedded
  4388.      target `hppa1.1-*-pro' does provide software floating point
  4389.      support.
  4390.  
  4391.      `-msoft-float' changes the calling convention in the output file;
  4392.      therefore, it is only useful if you compile *all* of a program with
  4393.      this option.  In particular, you need to compile `libgcc.a', the
  4394.      library that comes with GNU CC, with `-msoft-float' in order for
  4395.      this to work.
  4396.  
  4397. 
  4398. File: use,  Node: Intel 960 Options,  Next: DEC Alpha Options,  Prev: HPPA Options,  Up: Submodel Options
  4399.  
  4400. Intel 960 Options
  4401. -----------------
  4402.  
  4403.    These `-m' options are defined for the Intel 960 implementations:
  4404.  
  4405. `-mCPU TYPE'
  4406.      Assume the defaults for the machine type CPU TYPE for some of the
  4407.      other options, including instruction scheduling, floating point
  4408.      support, and addressing modes.  The choices for CPU TYPE are `ka',
  4409.      `kb', `mc', `ca', `cf', `sa', and `sb'.  The default is `kb'.
  4410.  
  4411. `-mnumerics'
  4412. `-msoft-float'
  4413.      The `-mnumerics' option indicates that the processor does support
  4414.      floating-point instructions.  The `-msoft-float' option indicates
  4415.      that floating-point support should not be assumed.
  4416.  
  4417. `-mleaf-procedures'
  4418. `-mno-leaf-procedures'
  4419.      Do (or do not) attempt to alter leaf procedures to be callable
  4420.      with the `bal' instruction as well as `call'.  This will result in
  4421.      more efficient code for explicit calls when the `bal' instruction
  4422.      can be substituted by the assembler or linker, but less efficient
  4423.      code in other cases, such as calls via function pointers, or using
  4424.      a linker that doesn't support this optimization.
  4425.  
  4426. `-mtail-call'
  4427. `-mno-tail-call'
  4428.      Do (or do not) make additional attempts (beyond those of the
  4429.      machine-independent portions of the compiler) to optimize
  4430.      tail-recursive calls into branches.  You may not want to do this
  4431.      because the detection of cases where this is not valid is not
  4432.      totally complete.  The default is `-mno-tail-call'.
  4433.  
  4434. `-mcomplex-addr'
  4435. `-mno-complex-addr'
  4436.      Assume (or do not assume) that the use of a complex addressing
  4437.      mode is a win on this implementation of the i960.  Complex
  4438.      addressing modes may not be worthwhile on the K-series, but they
  4439.      definitely are on the C-series.  The default is currently
  4440.      `-mcomplex-addr' for all processors except the CB and CC.
  4441.  
  4442. `-mcode-align'
  4443. `-mno-code-align'
  4444.      Align code to 8-byte boundaries for faster fetching (or don't
  4445.      bother).  Currently turned on by default for C-series
  4446.      implementations only.
  4447.  
  4448. `-mic-compat'
  4449. `-mic2.0-compat'
  4450. `-mic3.0-compat'
  4451.      Enable compatibility with iC960 v2.0 or v3.0.
  4452.  
  4453. `-masm-compat'
  4454. `-mintel-asm'
  4455.      Enable compatibility with the iC960 assembler.
  4456.  
  4457. `-mstrict-align'
  4458. `-mno-strict-align'
  4459.      Do not permit (do permit) unaligned accesses.
  4460.  
  4461. `-mold-align'
  4462.      Enable structure-alignment compatibility with Intel's gcc release
  4463.      version 1.3 (based on gcc 1.37).  Currently this is buggy in that
  4464.      `#pragma align 1' is always assumed as well, and cannot be turned
  4465.      off.
  4466.  
  4467. 
  4468. File: use,  Node: DEC Alpha Options,  Next: Clipper Options,  Prev: Intel 960 Options,  Up: Submodel Options
  4469.  
  4470. DEC Alpha Options
  4471. -----------------
  4472.  
  4473.    These `-m' options are defined for the DEC Alpha implementations:
  4474.  
  4475. `-mno-soft-float'
  4476. `-msoft-float'
  4477.      Use (do not use) the hardware floating-point instructions for
  4478.      floating-point operations.  When `-msoft-float' is specified,
  4479.      functions in `libgcc1.c' will be used to perform floating-point
  4480.      operations.  Unless they are replaced by routines that emulate the
  4481.      floating-point operations, or compiled in such a way as to call
  4482.      such emulations routines, these routines will issue floating-point
  4483.      operations.   If you are compiling for an Alpha without
  4484.      floating-point operations, you must ensure that the library is
  4485.      built so as not to call them.
  4486.  
  4487.      Note that Alpha implementations without floating-point operations
  4488.      are required to have floating-point registers.
  4489.  
  4490. `-mfp-reg'
  4491. `-mno-fp-regs'
  4492.      Generate code that uses (does not use) the floating-point register
  4493.      set.  `-mno-fp-regs' implies `-msoft-float'.  If the floating-point
  4494.      register set is not used, floating point operands are passed in
  4495.      integer registers as if they were integers and floating-point
  4496.      results are passed in $0 instead of $f0.  This is a non-standard
  4497.      calling sequence, so any function with a floating-point argument
  4498.      or return value called by code compiled with `-mno-fp-regs' must
  4499.      also be compiled with that option.
  4500.  
  4501.      A typical use of this option is building a kernel that does not
  4502.      use, and hence need not save and restore, any floating-point
  4503.      registers.
  4504.  
  4505. 
  4506. File: use,  Node: Clipper Options,  Next: H8/300 Options,  Prev: DEC Alpha Options,  Up: Submodel Options
  4507.  
  4508. Clipper Options
  4509. ---------------
  4510.  
  4511.    These `-m' options are defined for the Clipper implementations:
  4512.  
  4513. `-mc300'
  4514.      Produce code for a C300 Clipper processor. This is the default.
  4515.  
  4516. `-mc400'
  4517.      Produce code for a C400 Clipper processor i.e. use floating point
  4518.      registers f8..f15.
  4519.  
  4520. 
  4521. File: use,  Node: H8/300 Options,  Next: System V Options,  Prev: Clipper Options,  Up: Submodel Options
  4522.  
  4523. H8/300 Options
  4524. --------------
  4525.  
  4526.    These `-m' options are defined for the H8/300 implementations:
  4527.  
  4528. `-mrelax'
  4529.      Shorten some address references at link time, when possible; uses
  4530.      the linker option `-relax'.  *Note `ld' and the H8/300:
  4531.      (ld.info)H8/300, for a fuller description.
  4532.  
  4533. `-mh'
  4534.      Generate code for the H8/300H.
  4535.  
  4536. 
  4537. File: use,  Node: System V Options,  Prev: H8/300 Options,  Up: Submodel Options
  4538.  
  4539. Options for System V
  4540. --------------------
  4541.  
  4542.    These additional options are available on System V Release 4 for
  4543. compatibility with other compilers on those systems:
  4544.  
  4545. `-Qy'
  4546.      Identify the versions of each tool used by the compiler, in a
  4547.      `.ident' assembler directive in the output.
  4548.  
  4549. `-Qn'
  4550.      Refrain from adding `.ident' directives to the output file (this is
  4551.      the default).
  4552.  
  4553. `-YP,DIRS'
  4554.      Search the directories DIRS, and no others, for libraries
  4555.      specified with `-l'.
  4556.  
  4557. `-Ym,DIR'
  4558.      Look in the directory DIR to find the M4 preprocessor.  The
  4559.      assembler uses this option.
  4560.  
  4561. 
  4562. File: use,  Node: Code Gen Options,  Next: Environment Variables,  Prev: Submodel Options,  Up: Invoking GCC
  4563.  
  4564. Options for Code Generation Conventions
  4565. =======================================
  4566.  
  4567.    These machine-independent options control the interface conventions
  4568. used in code generation.
  4569.  
  4570.    Most of them have both positive and negative forms; the negative form
  4571. of `-ffoo' would be `-fno-foo'.  In the table below, only one of the
  4572. forms is listed--the one which is not the default.  You can figure out
  4573. the other form by either removing `no-' or adding it.
  4574.  
  4575. `-fpcc-struct-return'
  4576.      Return "short" `struct' and `union' values in memory like longer
  4577.      ones, rather than in registers.  This convention is less
  4578.      efficient, but it has the advantage of allowing intercallability
  4579.      between GNU CC-compiled files and files compiled with other
  4580.      compilers.
  4581.  
  4582.      The precise convention for returning structures in memory depends
  4583.      on the target configuration macros.
  4584.  
  4585.      Short structures and unions are those whose size and alignment
  4586.      match that of some integer type.
  4587.  
  4588. `-freg-struct-return'
  4589.      Use the convention that `struct' and `union' values are returned
  4590.      in registers when possible.  This is more efficient for small
  4591.      structures than `-fpcc-struct-return'.
  4592.  
  4593.      If you specify neither `-fpcc-struct-return' nor its contrary
  4594.      `-freg-struct-return', GNU CC defaults to whichever convention is
  4595.      standard for the target.  If there is no standard convention, GNU
  4596.      CC defaults to `-fpcc-struct-return', except on targets where GNU
  4597.      CC is the principal compiler.  In those cases, we can choose the
  4598.      standard, and we chose the more efficient register return
  4599.      alternative.
  4600.  
  4601. `-fshort-enums'
  4602.      Allocate to an `enum' type only as many bytes as it needs for the
  4603.      declared range of possible values.  Specifically, the `enum' type
  4604.      will be equivalent to the smallest integer type which has enough
  4605.      room.
  4606.  
  4607. `-fshort-double'
  4608.      Use the same size for `double' as for `float'.
  4609.  
  4610. `-fshared-data'
  4611.      Requests that the data and non-`const' variables of this
  4612.      compilation be shared data rather than private data.  The
  4613.      distinction makes sense only on certain operating systems, where
  4614.      shared data is shared between processes running the same program,
  4615.      while private data exists in one copy per process.
  4616.  
  4617. `-fno-common'
  4618.      Allocate even uninitialized global variables in the bss section of
  4619.      the object file, rather than generating them as common blocks.
  4620.      This has the effect that if the same variable is declared (without
  4621.      `extern') in two different compilations, you will get an error
  4622.      when you link them.  The only reason this might be useful is if
  4623.      you wish to verify that the program will work on other systems
  4624.      which always work this way.
  4625.  
  4626. `-fno-ident'
  4627.      Ignore the `#ident' directive.
  4628.  
  4629. `-fno-gnu-linker'
  4630.      Do not output global initializations (such as C++ constructors and
  4631.      destructors) in the form used by the GNU linker (on systems where
  4632.      the GNU linker is the standard method of handling them).  Use this
  4633.      option when you want to use a non-GNU linker, which also requires
  4634.      using the `collect2' program to make sure the system linker
  4635.      includes constructors and destructors.  (`collect2' is included in
  4636.      the GNU CC distribution.)  For systems which *must* use
  4637.      `collect2', the compiler driver `gcc' is configured to do this
  4638.      automatically.
  4639.  
  4640. `-finhibit-size-directive'
  4641.      Don't output a `.size' assembler directive, or anything else that
  4642.      would cause trouble if the function is split in the middle, and the
  4643.      two halves are placed at locations far apart in memory.  This
  4644.      option is used when compiling `crtstuff.c'; you should not need to
  4645.      use it for anything else.
  4646.  
  4647. `-fverbose-asm'
  4648.      Put extra commentary information in the generated assembly code to
  4649.      make it more readable.  This option is generally only of use to
  4650.      those who actually need to read the generated assembly code
  4651.      (perhaps while debugging the compiler itself).
  4652.  
  4653. `-fvolatile'
  4654.      Consider all memory references through pointers to be volatile.
  4655.  
  4656. `-fvolatile-global'
  4657.      Consider all memory references to extern and global data items to
  4658.      be volatile.
  4659.  
  4660. `-fpic'
  4661.      Generate position-independent code (PIC) suitable for use in a
  4662.      shared library, if supported for the target machine.  Such code
  4663.      accesses all constant addresses through a global offset table
  4664.      (GOT).  If the GOT size for the linked executable exceeds a
  4665.      machine-specific maximum size, you get an error message from the
  4666.      linker indicating that `-fpic' does not work; in that case,
  4667.      recompile with `-fPIC' instead.  (These maximums are 16k on the
  4668.      m88k, 8k on the Sparc, and 32k on the m68k and RS/6000.  The 386
  4669.      has no such limit.)
  4670.  
  4671.      Position-independent code requires special support, and therefore
  4672.      works only on certain machines.  For the 386, GNU CC supports PIC
  4673.      for System V but not for the Sun 386i.  Code generated for the IBM
  4674.      RS/6000 is always position-independent.
  4675.  
  4676.      The GNU assembler does not fully support PIC.  Currently, you must
  4677.      use some other assembler in order for PIC to work.  We would
  4678.      welcome volunteers to upgrade GAS to handle this; the first part
  4679.      of the job is to figure out what the assembler must do differently.
  4680.  
  4681. `-fPIC'
  4682.      If supported for the target machine, emit position-independent
  4683.      code, suitable for dynamic linking and avoiding any limit on the
  4684.      size of the global offset table.  This option makes a difference
  4685.      on the m68k, m88k and the Sparc.
  4686.  
  4687.      Position-independent code requires special support, and therefore
  4688.      works only on certain machines.
  4689.  
  4690. `-ffixed-REG'
  4691.      Treat the register named REG as a fixed register; generated code
  4692.      should never refer to it (except perhaps as a stack pointer, frame
  4693.      pointer or in some other fixed role).
  4694.  
  4695.      REG must be the name of a register.  The register names accepted
  4696.      are machine-specific and are defined in the `REGISTER_NAMES' macro
  4697.      in the machine description macro file.
  4698.  
  4699.      This flag does not have a negative form, because it specifies a
  4700.      three-way choice.
  4701.  
  4702. `-fcall-used-REG'
  4703.      Treat the register named REG as an allocatable register that is
  4704.      clobbered by function calls.  It may be allocated for temporaries
  4705.      or variables that do not live across a call.  Functions compiled
  4706.      this way will not save and restore the register REG.
  4707.  
  4708.      Use of this flag for a register that has a fixed pervasive role in
  4709.      the machine's execution model, such as the stack pointer or frame
  4710.      pointer, will produce disastrous results.
  4711.  
  4712.      This flag does not have a negative form, because it specifies a
  4713.      three-way choice.
  4714.  
  4715. `-fcall-saved-REG'
  4716.      Treat the register named REG as an allocatable register saved by
  4717.      functions.  It may be allocated even for temporaries or variables
  4718.      that live across a call.  Functions compiled this way will save
  4719.      and restore the register REG if they use it.
  4720.  
  4721.      Use of this flag for a register that has a fixed pervasive role in
  4722.      the machine's execution model, such as the stack pointer or frame
  4723.      pointer, will produce disastrous results.
  4724.  
  4725.      A different sort of disaster will result from the use of this flag
  4726.      for a register in which function values may be returned.
  4727.  
  4728.      This flag does not have a negative form, because it specifies a
  4729.      three-way choice.
  4730.  
  4731. `-fpack-struct'
  4732.      Pack all structure members together without holes.  Usually you
  4733.      would not want to use this option, since it makes the code
  4734.      suboptimal, and the offsets of structure members won't agree with
  4735.      system libraries.
  4736.  
  4737. `+e0'
  4738. `+e1'
  4739.      Control whether virtual function definitions in classes are used to
  4740.      generate code, or only to define interfaces for their callers.
  4741.      (C++ only).
  4742.  
  4743.      These options are provided for compatibility with `cfront' 1.x
  4744.      usage; the recommended alternative GNU C++ usage is in flux.
  4745.      *Note Declarations and Definitions in One Header: C++ Interface.
  4746.  
  4747.      With `+e0', virtual function definitions in classes are declared
  4748.      `extern'; the declaration is used only as an interface
  4749.      specification, not to generate code for the virtual functions (in
  4750.      this compilation).
  4751.  
  4752.      With `+e1', G++ actually generates the code implementing virtual
  4753.      functions defined in the code, and makes them publicly visible.
  4754.  
  4755. 
  4756. File: use,  Node: Environment Variables,  Next: Running Protoize,  Prev: Code Gen Options,  Up: Invoking GCC
  4757.  
  4758. Environment Variables Affecting GNU CC
  4759. ======================================
  4760.  
  4761.    This section describes several environment variables that affect how
  4762. GNU CC operates.  They work by specifying directories or prefixes to use
  4763. when searching for various kinds of files.
  4764.  
  4765.    Note that you can also specify places to search using options such as
  4766. `-B', `-I' and `-L' (*note Directory Options::.).  These take
  4767. precedence over places specified using environment variables, which in
  4768. turn take precedence over those specified by the configuration of GNU
  4769. CC.
  4770.  
  4771. `TMPDIR'
  4772.      If `TMPDIR' is set, it specifies the directory to use for temporary
  4773.      files.  GNU CC uses temporary files to hold the output of one
  4774.      stage of compilation which is to be used as input to the next
  4775.      stage: for example, the output of the preprocessor, which is the
  4776.      input to the compiler proper.
  4777.  
  4778. `GCC_EXEC_PREFIX'
  4779.      If `GCC_EXEC_PREFIX' is set, it specifies a prefix to use in the
  4780.      names of the subprograms executed by the compiler.  No slash is
  4781.      added when this prefix is combined with the name of a subprogram,
  4782.      but you can specify a prefix that ends with a slash if you wish.
  4783.  
  4784.      If GNU CC cannot find the subprogram using the specified prefix, it
  4785.      tries looking in the usual places for the subprogram.
  4786.  
  4787.      The default value of `GCC_EXEC_PREFIX' is `PREFIX/lib/gcc-lib/'
  4788.      where PREFIX is the value of `prefix' when you ran the `configure'
  4789.      script.
  4790.  
  4791.      Other prefixes specified with `-B' take precedence over this
  4792.      prefix.
  4793.  
  4794.      This prefix is also used for finding files such as `crt0.o' that
  4795.      are used for linking.
  4796.  
  4797.      In addition, the prefix is used in an unusual way in finding the
  4798.      directories to search for header files.  For each of the standard
  4799.      directories whose name normally begins with
  4800.      `/usr/local/lib/gcc-lib' (more precisely, with the value of
  4801.      `GCC_INCLUDE_DIR'), GNU CC tries replacing that beginning with the
  4802.      specified prefix to produce an alternate directory name.  Thus,
  4803.      with `-Bfoo/', GNU CC will search `foo/bar' where it would
  4804.      normally search `/usr/local/lib/bar'.  These alternate directories
  4805.      are searched first; the standard directories come next.
  4806.  
  4807. `COMPILER_PATH'
  4808.      The value of `COMPILER_PATH' is a colon-separated list of
  4809.      directories, much like `PATH'.  GNU CC tries the directories thus
  4810.      specified when searching for subprograms, if it can't find the
  4811.      subprograms using `GCC_EXEC_PREFIX'.
  4812.  
  4813. `LIBRARY_PATH'
  4814.      The value of `LIBRARY_PATH' is a colon-separated list of
  4815.      directories, much like `PATH'.  When configured as a native
  4816.      compiler, GNU CC tries the directories thus specified when
  4817.      searching for special linker files, if it can't find them using
  4818.      `GCC_EXEC_PREFIX'.  Linking using GNU CC also uses these
  4819.      directories when searching for ordinary libraries for the `-l'
  4820.      option (but directories specified with `-L' come first).
  4821.  
  4822. `C_INCLUDE_PATH'
  4823. `CPLUS_INCLUDE_PATH'
  4824. `OBJC_INCLUDE_PATH'
  4825.      These environment variables pertain to particular languages.  Each
  4826.      variable's value is a colon-separated list of directories, much
  4827.      like `PATH'.  When GNU CC searches for header files, it tries the
  4828.      directories listed in the variable for the language you are using,
  4829.      after the directories specified with `-I' but before the standard
  4830.      header file directories.
  4831.  
  4832. `DEPENDENCIES_OUTPUT'
  4833.      If this variable is set, its value specifies how to output
  4834.      dependencies for Make based on the header files processed by the
  4835.      compiler.  This output looks much like the output from the `-M'
  4836.      option (*note Preprocessor Options::.), but it goes to a separate
  4837.      file, and is in addition to the usual results of compilation.
  4838.  
  4839.      The value of `DEPENDENCIES_OUTPUT' can be just a file name, in
  4840.      which case the Make rules are written to that file, guessing the
  4841.      target name from the source file name.  Or the value can have the
  4842.      form `FILE TARGET', in which case the rules are written to file
  4843.      FILE using TARGET as the target name.
  4844.  
  4845. 
  4846. File: use,  Node: Running Protoize,  Prev: Environment Variables,  Up: Invoking GCC
  4847.  
  4848. Running Protoize
  4849. ================
  4850.  
  4851.    The program `protoize' is an optional part of GNU C.  You can use it
  4852. to add prototypes to a program, thus converting the program to ANSI C
  4853. in one respect.  The companion program `unprotoize' does the reverse:
  4854. it removes argument types from any prototypes that are found.
  4855.  
  4856.    When you run these programs, you must specify a set of source files
  4857. as command line arguments.  The conversion programs start out by
  4858. compiling these files to see what functions they define.  The
  4859. information gathered about a file FOO is saved in a file named `FOO.X'.
  4860.  
  4861.    After scanning comes actual conversion.  The specified files are all
  4862. eligible to be converted; any files they include (whether sources or
  4863. just headers) are eligible as well.
  4864.  
  4865.    But not all the eligible files are converted.  By default,
  4866. `protoize' and `unprotoize' convert only source and header files in the
  4867. current directory.  You can specify additional directories whose files
  4868. should be converted with the `-d DIRECTORY' option.  You can also
  4869. specify particular files to exclude with the `-x FILE' option.  A file
  4870. is converted if it is eligible, its directory name matches one of the
  4871. specified directory names, and its name within the directory has not
  4872. been excluded.
  4873.  
  4874.    Basic conversion with `protoize' consists of rewriting most function
  4875. definitions and function declarations to specify the types of the
  4876. arguments.  The only ones not rewritten are those for varargs functions.
  4877.  
  4878.    `protoize' optionally inserts prototype declarations at the
  4879. beginning of the source file, to make them available for any calls that
  4880. precede the function's definition.  Or it can insert prototype
  4881. declarations with block scope in the blocks where undeclared functions
  4882. are called.
  4883.  
  4884.    Basic conversion with `unprotoize' consists of rewriting most
  4885. function declarations to remove any argument types, and rewriting
  4886. function definitions to the old-style pre-ANSI form.
  4887.  
  4888.    Both conversion programs print a warning for any function
  4889. declaration or definition that they can't convert.  You can suppress
  4890. these warnings with `-q'.
  4891.  
  4892.    The output from `protoize' or `unprotoize' replaces the original
  4893. source file.  The original file is renamed to a name ending with
  4894. `.save'.  If the `.save' file already exists, then the source file is
  4895. simply discarded.
  4896.  
  4897.    `protoize' and `unprotoize' both depend on GNU CC itself to scan the
  4898. program and collect information about the functions it uses.  So
  4899. neither of these programs will work until GNU CC is installed.
  4900.  
  4901.    Here is a table of the options you can use with `protoize' and
  4902. `unprotoize'.  Each option works with both programs unless otherwise
  4903. stated.
  4904.  
  4905. `-B DIRECTORY'
  4906.      Look for the file `SYSCALLS.c.X' in DIRECTORY, instead of the
  4907.      usual directory (normally `/usr/local/lib').  This file contains
  4908.      prototype information about standard system functions.  This option
  4909.      applies only to `protoize'.
  4910.  
  4911. `-c COMPILATION-OPTIONS'
  4912.      Use  COMPILATION-OPTIONS as the options when running `gcc' to
  4913.      produce the `.X' files.  The special option `-aux-info' is always
  4914.      passed in addition, to tell `gcc' to write a `.X' file.
  4915.  
  4916.      Note that the compilation options must be given as a single
  4917.      argument to `protoize' or `unprotoize'.  If you want to specify
  4918.      several `gcc' options, you must quote the entire set of
  4919.      compilation options to make them a single word in the shell.
  4920.  
  4921.      There are certain `gcc' arguments that you cannot use, because they
  4922.      would produce the wrong kind of output.  These include `-g', `-O',
  4923.      `-c', `-S', and `-o' If you include these in the
  4924.      COMPILATION-OPTIONS, they are ignored.
  4925.  
  4926. `-C'
  4927.      Rename files to end in `.C' instead of `.c'.  This is convenient
  4928.      if you are converting a C program to C++.  This option applies
  4929.      only to `protoize'.
  4930.  
  4931. `-g'
  4932.      Add explicit global declarations.  This means inserting explicit
  4933.      declarations at the beginning of each source file for each function
  4934.      that is called in the file and was not declared.  These
  4935.      declarations precede the first function definition that contains a
  4936.      call to an undeclared function.  This option applies only to
  4937.      `protoize'.
  4938.  
  4939. `-i STRING'
  4940.      Indent old-style parameter declarations with the string STRING.
  4941.      This option applies only to `protoize'.
  4942.  
  4943.      `unprotoize' converts prototyped function definitions to old-style
  4944.      function definitions, where the arguments are declared between the
  4945.      argument list and the initial `{'.  By default, `unprotoize' uses
  4946.      five spaces as the indentation.  If you want to indent with just
  4947.      one space instead, use `-i " "'.
  4948.  
  4949. `-k'
  4950.      Keep the `.X' files.  Normally, they are deleted after conversion
  4951.      is finished.
  4952.  
  4953. `-l'
  4954.      Add explicit local declarations.  `protoize' with `-l' inserts a
  4955.      prototype declaration for each function in each block which calls
  4956.      the function without any declaration.  This option applies only to
  4957.      `protoize'.
  4958.  
  4959. `-n'
  4960.      Make no real changes.  This mode just prints information about the
  4961.      conversions that would have been done without `-n'.
  4962.  
  4963. `-N'
  4964.      Make no `.save' files.  The original files are simply deleted.
  4965.      Use this option with caution.
  4966.  
  4967. `-p PROGRAM'
  4968.      Use the program PROGRAM as the compiler.  Normally, the name `gcc'
  4969.      is used.
  4970.  
  4971. `-q'
  4972.      Work quietly.  Most warnings are suppressed.
  4973.  
  4974. `-v'
  4975.      Print the version number, just like `-v' for `gcc'.
  4976.  
  4977.    If you need special compiler options to compile one of your program's
  4978. source files, then you should generate that file's `.X' file specially,
  4979. by running `gcc' on that source file with the appropriate options and
  4980. the option `-aux-info'.  Then run `protoize' on the entire set of
  4981. files.  `protoize' will use the existing `.X' file because it is newer
  4982. than the source file.  For example:
  4983.  
  4984.      gcc -Dfoo=bar file1.c -aux-info
  4985.      protoize *.c
  4986.  
  4987. You need to include the special files along with the rest in the
  4988. `protoize' command, even though their `.X' files already exist, because
  4989. otherwise they won't get converted.
  4990.  
  4991.    *Note Protoize Caveats::, for more information on how to use
  4992. `protoize' successfully.
  4993.  
  4994. 
  4995. File: use,  Node: Installation,  Next: C Extensions,  Prev: Invoking GCC,  Up: Top
  4996.  
  4997. Installing GNU CC
  4998. *****************
  4999.  
  5000. * Menu:
  5001.  
  5002. * Configurations::    Configurations Supported by GNU CC.
  5003. * Other Dir::     Compiling in a separate directory (not where the source is).
  5004. * Cross-Compiler::   Building and installing a cross-compiler.
  5005. * Sun Install::   See below for installation on the Sun.
  5006. * VMS Install::   See below for installation on VMS.
  5007. * Collect2::      How `collect2' works; how it finds `ld'.
  5008. * Header Dirs::   Understanding the standard header file directories.
  5009.  
  5010.    Here is the procedure for installing GNU CC on a Unix system.  See
  5011. *Note VMS Install::, for VMS systems.  In this section we assume you
  5012. compile in the same directory that contains the source files; see *Note
  5013. Other Dir::, to find out how to compile in a separate directory on Unix
  5014. systems.
  5015.  
  5016.    You cannot install GNU C by itself on MSDOS; it will not compile
  5017. under any MSDOS compiler except itself.  You need to get the complete
  5018. compilation package DJGPP, which includes binaries as well as sources,
  5019. and includes all the necessary compilation tools and libraries.
  5020.  
  5021.   1. If you have built GNU CC previously in the same directory for a
  5022.      different target machine, do `make distclean' to delete all files
  5023.      that might be invalid.  One of the files this deletes is
  5024.      `Makefile'; if `make distclean' complains that `Makefile' does not
  5025.      exist, it probably means that the directory is already suitably
  5026.      clean.
  5027.  
  5028.   2. On a System V release 4 system, make sure `/usr/bin' precedes
  5029.      `/usr/ucb' in `PATH'.  The `cc' command in `/usr/ucb' uses
  5030.      libraries which have bugs.
  5031.  
  5032.   3. Specify the host, build and target machine configurations.  You do
  5033.      this by running the file `configure'.
  5034.  
  5035.      The "build" machine is the system which you are using, the "host"
  5036.      machine is the system where you want to run the resulting compiler
  5037.      (normally the build machine), and the "target" machine is the
  5038.      system for which you want the compiler to generate code.
  5039.  
  5040.      If you are building a compiler to produce code for the machine it
  5041.      runs on (a native compiler), you normally do not need to specify
  5042.      any operands to `configure'; it will try to guess the type of
  5043.      machine you are on and use that as the build, host and target
  5044.      machines.  So you don't need to specify a configuration when
  5045.      building a native compiler unless `configure' cannot figure out
  5046.      what your configuration is or guesses wrong.
  5047.  
  5048.      In those cases, specify the build machine's "configuration name"
  5049.      with the `--build' option; the host and target will default to be
  5050.      the same as the build machine.  (If you are building a
  5051.      cross-compiler, see *Note Cross-Compiler::.)
  5052.  
  5053.      Here is an example:
  5054.  
  5055.      from an MSDOS console window or from the program manager dialog
  5056.      box.  Configure.bat assumes that you have already installed and in
  5057.      your path a Unix-like sed program which is used to modify
  5058.      Makefile.in to create a working Makefile.
  5059.           ./configure --build=sparc-sun-sunos4.1
  5060.  
  5061.      A configuration name may be canonical or it may be more or less
  5062.      abbreviated.
  5063.  
  5064.      A canonical configuration name has three parts, separated by
  5065.      dashes.  It looks like this: `CPU-COMPANY-SYSTEM'.  (The three
  5066.      parts may themselves contain dashes; `configure' can figure out
  5067.      which dashes serve which purpose.)  For example,
  5068.      `m68k-sun-sunos4.1' specifies a Sun 3.
  5069.  
  5070.      You can also replace parts of the configuration by nicknames or
  5071.      aliases.  For example, `sun3' stands for `m68k-sun', so
  5072.      `sun3-sunos4.1' is another way to specify a Sun 3.  You can also
  5073.      use simply `sun3-sunos', since the version of SunOS is assumed by
  5074.      default to be version 4.  `sun3-bsd' also works, since `configure'
  5075.      knows that the only BSD variant on a Sun 3 is SunOS.
  5076.  
  5077.      You can specify a version number after any of the system types,
  5078.      and some of the CPU types.  In most cases, the version is
  5079.      irrelevant, and will be ignored.  So you might as well specify the
  5080.      version if you know it.
  5081.  
  5082.      See *Note Configurations::, for a list of supported configuration
  5083.      names and notes on many of the configurations.  You should check
  5084.      the notes in that section before proceeding any further with the
  5085.      installation of GNU CC.
  5086.  
  5087.      There are four additional options you can specify independently to
  5088.      describe variant hardware and software configurations.  These are
  5089.      `--with-gnu-as', `--with-gnu-ld', `--with-stabs' and `--nfp'.
  5090.  
  5091.     `--with-gnu-as'
  5092.           If you will use GNU CC with the GNU assembler (GAS), you
  5093.           should declare this by using the `--with-gnu-as' option when
  5094.           you run `configure'.
  5095.  
  5096.           Using this option does not install GAS.  It only modifies the
  5097.           output of GNU CC to work with GAS.  Building and installing
  5098.           GAS is up to you.
  5099.  
  5100.           Conversely, if you *do not* wish to use GAS and do not specify
  5101.           `--with-gnu-as' when building GNU CC, it is up to you to make
  5102.           sure that GAS is not installed.  GNU CC searches for a
  5103.           program named `as' in various directories; if the program it
  5104.           finds is GAS, then it runs GAS.  If you are not sure where
  5105.           GNU CC finds the assembler it is using, try specifying `-v'
  5106.           when you run it.
  5107.  
  5108.           The systems where it makes a difference whether you use GAS
  5109.           are
  5110.           `hppa1.0-ANY-ANY', `hppa1.1-ANY-ANY', `i386-ANY-sysv',
  5111.           `i386-ANY-isc',
  5112.           `i860-ANY-bsd', `m68k-bull-sysv', `m68k-hp-hpux',
  5113.           `m68k-sony-bsd',
  5114.           `m68k-altos-sysv', `m68000-hp-hpux', `m68000-att-sysv',
  5115.           `ANY-lynx-lynxos', and `mips-ANY').  On any other system,
  5116.           `--with-gnu-as' has no effect.
  5117.  
  5118.           On the systems listed above (except for the HP-PA, for ISC on
  5119.           the 386, and for `mips-sgi-irix5.*'), if you use GAS, you
  5120.           should also use the GNU linker (and specify `--with-gnu-ld').
  5121.  
  5122.     `--with-gnu-ld'
  5123.           Specify the option `--with-gnu-ld' if you plan to use the GNU
  5124.           linker with GNU CC.
  5125.  
  5126.           This option does not cause the GNU linker to be installed; it
  5127.           just modifies the behavior of GNU CC to work with the GNU
  5128.           linker.  Specifically, it inhibits the installation of
  5129.           `collect2', a program which otherwise serves as a front-end
  5130.           for the system's linker on most configurations.
  5131.  
  5132.     `--with-stabs'
  5133.           On MIPS based systems and on Alphas, you must specify whether
  5134.           you want GNU CC to create the normal ECOFF debugging format,
  5135.           or to use BSD-style stabs passed through the ECOFF symbol
  5136.           table.  The normal ECOFF debug format cannot fully handle
  5137.           languages other than C.  BSD stabs format can handle other
  5138.           languages, but it only works with the GNU debugger GDB.
  5139.  
  5140.           Normally, GNU CC uses the ECOFF debugging format by default;
  5141.           if you prefer BSD stabs, specify `--with-stabs' when you
  5142.           configure GNU CC.
  5143.  
  5144.           No matter which default you choose when you configure GNU CC,
  5145.           the user can use the `-gcoff' and `-gstabs+' options to
  5146.           specify explicitly the debug format for a particular
  5147.           compilation.
  5148.  
  5149.           `--with-stabs' is meaningful on the ISC system on the 386,
  5150.           also, if `--with-gas' is used.  It selects use of stabs
  5151.           debugging information embedded in COFF output.  This kind of
  5152.           debugging information supports C++ well; ordinary COFF
  5153.           debugging information does not.
  5154.  
  5155.           `--with-stabs' is also meaningful on 386 systems running
  5156.           SVR4.  It selects use of stabs debugging information embedded
  5157.           in ELF output.  The C++ compiler currently (2.6.0) does not
  5158.           support the DWARF debugging information normally used on 386
  5159.           SVR4 platforms; stabs provide a workable alternative.  This
  5160.           requires gas and gdb, as the normal SVR4 tools can not
  5161.           generate or interpret stabs.
  5162.  
  5163.     `--nfp'
  5164.           On certain systems, you must specify whether the machine has
  5165.           a floating point unit.  These systems include
  5166.           `m68k-sun-sunosN' and `m68k-isi-bsd'.  On any other system,
  5167.           `--nfp' currently has no effect, though perhaps there are
  5168.           other systems where it could usefully make a difference.
  5169.  
  5170.      The `configure' script searches subdirectories of the source
  5171.      directory for other compilers that are to be integrated into GNU
  5172.      CC.  The GNU compiler for C++, called G++ is in a subdirectory
  5173.      named `cp'.  `configure' inserts rules into `Makefile' to build
  5174.      all of those compilers.
  5175.  
  5176.      Here we spell out what files will be set up by `configure'.
  5177.      Normally you need not be concerned with these files.
  5178.  
  5179.         * A symbolic link named `config.h' is made to the top-level
  5180.           config file for the machine you plan to run the compiler on
  5181.           (*note The Configuration File: (gcc.info)Config.).  This file
  5182.           is responsible for defining information about the host
  5183.           machine.  It includes `tm.h'.
  5184.  
  5185.           The top-level config file is located in the subdirectory
  5186.           `config'.  Its name is always `xm-SOMETHING.h'; usually
  5187.           `xm-MACHINE.h', but there are some exceptions.
  5188.  
  5189.           If your system does not support symbolic links, you might
  5190.           want to set up `config.h' to contain a `#include' command
  5191.           which refers to the appropriate file.
  5192.  
  5193.         * A symbolic link named `tconfig.h' is made to the top-level
  5194.           config file for your target machine.  This is used for
  5195.           compiling certain programs to run on that machine.
  5196.  
  5197.         * A symbolic link named `tm.h' is made to the
  5198.           machine-description macro file for your target machine.  It
  5199.           should be in the subdirectory `config' and its name is often
  5200.           `MACHINE.h'.
  5201.  
  5202.         * A symbolic link named `md' will be made to the machine
  5203.           description pattern file.  It should be in the `config'
  5204.           subdirectory and its name should be `MACHINE.md'; but MACHINE
  5205.           is often not the same as the name used in the `tm.h' file
  5206.           because the `md' files are more general.
  5207.  
  5208.         * A symbolic link named `aux-output.c' will be made to the
  5209.           output subroutine file for your machine.  It should be in the
  5210.           `config' subdirectory and its name should be `MACHINE.c'.
  5211.  
  5212.         * The command file `configure' also constructs the file
  5213.           `Makefile' by adding some text to the template file
  5214.           `Makefile.in'.  The additional text comes from files in the
  5215.           `config' directory, named `t-TARGET' and `x-HOST'.  If these
  5216.           files do not exist, it means nothing needs to be added for a
  5217.           given target or host.
  5218.  
  5219.   4. The standard directory for installing GNU CC is `/usr/local/lib'.
  5220.      If you want to install its files somewhere else, specify
  5221.      `--prefix=DIR' when you run `configure'.  Here DIR is a directory
  5222.      name to use instead of `/usr/local' for all purposes with one
  5223.      exception: the directory `/usr/local/include' is searched for
  5224.      header files no matter where you install the compiler.  To override
  5225.      this name, use the `--local-prefix' option below.
  5226.  
  5227.   5. Specify `--local-prefix=DIR' if you want the compiler to search
  5228.      directory `DIR/include' for locally installed header files
  5229.      *instead* of `/usr/local/include'.
  5230.  
  5231.      You should specify `--local-prefix' *only* if your site has a
  5232.      different convention (not `/usr/local') for where to put
  5233.      site-specific files.
  5234.  
  5235.      *Do not* specify `/usr' as the `--local-prefix'!  The directory
  5236.      you use for `--local-prefix' *must not* contain any of the
  5237.      system's standard header files.  If it did contain them, certain
  5238.      programs would be miscompiled (including GNU Emacs, on certain
  5239.      targets), because this would override and nullify the header file
  5240.      corrections made by the `fixincludes' script.
  5241.  
  5242.   6. Make sure the Bison parser generator is installed.  (This is
  5243.      unnecessary if the Bison output files `c-parse.c' and `cexp.c' are
  5244.      more recent than `c-parse.y' and `cexp.y' and you do not plan to
  5245.      change the `.y' files.)
  5246.  
  5247.      Bison versions older than Sept 8, 1988 will produce incorrect
  5248.      output for `c-parse.c'.
  5249.  
  5250.   7. If you have chosen a configuration for GNU CC which requires other
  5251.      GNU tools (such as GAS or the GNU linker) instead of the standard
  5252.      system tools, install the required tools in the build directory
  5253.      under the names `as', `ld' or whatever is appropriate.  This will
  5254.      enable the compiler to find the proper tools for compilation of
  5255.      the program `enquire'.
  5256.  
  5257.      Alternatively, you can do subsequent compilation using a value of
  5258.      the `PATH' environment variable such that the necessary GNU tools
  5259.      come before the standard system tools.
  5260.  
  5261.   8. Build the compiler.  Just type `make LANGUAGES=c' in the compiler
  5262.      directory.
  5263.  
  5264.      `LANGUAGES=c' specifies that only the C compiler should be
  5265.      compiled.  The makefile normally builds compilers for all the
  5266.      supported languages; currently, C, C++ and Objective C.  However,
  5267.      C is the only language that is sure to work when you build with
  5268.      other non-GNU C compilers.  In addition, building anything but C
  5269.      at this stage is a waste of time.
  5270.  
  5271.      In general, you can specify the languages to build by typing the
  5272.      argument `LANGUAGES="LIST"', where LIST is one or more words from
  5273.      the list `c', `c++', and `objective-c'.  If you have any
  5274.      additional GNU compilers as subdirectories of the GNU CC source
  5275.      directory, you may also specify their names in this list.
  5276.  
  5277.      Ignore any warnings you may see about "statement not reached" in
  5278.      `insn-emit.c'; they are normal.  Also, warnings about "unknown
  5279.      escape sequence" are normal in `genopinit.c' and perhaps some
  5280.      other files.  Likewise, you should ignore warnings about "constant
  5281.      is so large that it is unsigned" in `insn-emit.c' and
  5282.      `insn-recog.c'.  Any other compilation errors may represent bugs in
  5283.      the port to your machine or operating system, and should be
  5284.      investigated and reported (*note Bugs::.).
  5285.  
  5286.      Some commercial compilers fail to compile GNU CC because they have
  5287.      bugs or limitations.  For example, the Microsoft compiler is said
  5288.      to run out of macro space.  Some Ultrix compilers run out of
  5289.      expression space; then you need to break up the statement where
  5290.      the problem happens.
  5291.  
  5292.   9. If you are building a cross-compiler, stop here.  *Note
  5293.      Cross-Compiler::.
  5294.  
  5295.  10. Move the first-stage object files and executables into a
  5296.      subdirectory with this command:
  5297.  
  5298.           make stage1
  5299.  
  5300.      The files are moved into a subdirectory named `stage1'.  Once
  5301.      installation is complete, you may wish to delete these files with
  5302.      `rm -r stage1'.
  5303.  
  5304.  11. If you have chosen a configuration for GNU CC which requires other
  5305.      GNU tools (such as GAS or the GNU linker) instead of the standard
  5306.      system tools, install the required tools in the `stage1'
  5307.      subdirectory under the names `as', `ld' or whatever is
  5308.      appropriate.  This will enable the stage 1 compiler to find the
  5309.      proper tools in the following stage.
  5310.  
  5311.      Alternatively, you can do subsequent compilation using a value of
  5312.      the `PATH' environment variable such that the necessary GNU tools
  5313.      come before the standard system tools.
  5314.  
  5315.  12. Recompile the compiler with itself, with this command:
  5316.  
  5317.           make CC="stage1/xgcc -Bstage1/" CFLAGS="-g -O"
  5318.  
  5319.      This is called making the stage 2 compiler.
  5320.  
  5321.      The command shown above builds compilers for all the supported
  5322.      languages.  If you don't want them all, you can specify the
  5323.      languages to build by typing the argument `LANGUAGES="LIST"'.  LIST
  5324.      should contain one or more words from the list `c', `c++',
  5325.      `objective-c', and `proto'.  Separate the words with spaces.
  5326.      `proto' stands for the programs `protoize' and `unprotoize'; they
  5327.      are not a separate language, but you use `LANGUAGES' to enable or
  5328.      disable their installation.
  5329.  
  5330.      If you are going to build the stage 3 compiler, then you might
  5331.      want to build only the C language in stage 2.
  5332.  
  5333.      Once you have built the stage 2 compiler, if you are short of disk
  5334.      space, you can delete the subdirectory `stage1'.
  5335.  
  5336.      On a 68000 or 68020 system lacking floating point hardware, unless
  5337.      you have selected a `tm.h' file that expects by default that there
  5338.      is no such hardware, do this instead:
  5339.  
  5340.           make CC="stage1/xgcc -Bstage1/" CFLAGS="-g -O -msoft-float"
  5341.  
  5342.  13. If you wish to test the compiler by compiling it with itself one
  5343.      more time, install any other necessary GNU tools (such as GAS or
  5344.      the GNU linker) in the `stage2' subdirectory as you did in the
  5345.      `stage1' subdirectory, then do this:
  5346.  
  5347.           make stage2
  5348.           make CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O2"
  5349.  
  5350.      This is called making the stage 3 compiler.  Aside from the `-B'
  5351.      option, the compiler options should be the same as when you made
  5352.      the stage 2 compiler.  But the `LANGUAGES' option need not be the
  5353.      same.  The command shown above builds compilers for all the
  5354.      supported languages; if you don't want them all, you can specify
  5355.      the languages to build by typing the argument `LANGUAGES="LIST"',
  5356.      as described above.
  5357.  
  5358.      If you do not have to install any additional GNU tools, you may
  5359.      use the command
  5360.  
  5361.           make bootstrap LANGUAGES=LANGUAGE-LIST BOOT_CFLAGS=OPTION-LIST
  5362.  
  5363.      instead of making `stage1', `stage2', and performing the two
  5364.      compiler builds.
  5365.  
  5366.  14. Then compare the latest object files with the stage 2 object
  5367.      files--they ought to be identical, aside from time stamps (if any).
  5368.  
  5369.      On some systems, meaningful comparison of object files is
  5370.      impossible; they always appear "different."  This is currently
  5371.      true on Solaris and probably on all systems that use ELF object
  5372.      file format.  On some versions of Irix on SGI machines and OSF/1
  5373.      on Alpha systems, you will not be able to compare the files
  5374.      without specifying `-save-temps'; see the description of
  5375.      individual systems above to see if you get comparison failures.
  5376.      You may have similar problems on other systems.
  5377.  
  5378.      Use this command to compare the files:
  5379.  
  5380.           make compare
  5381.  
  5382.      This will mention any object files that differ between stage 2 and
  5383.      stage 3.  Any difference, no matter how innocuous, indicates that
  5384.      the stage 2 compiler has compiled GNU CC incorrectly, and is
  5385.      therefore a potentially serious bug which you should investigate
  5386.      and report (*note Bugs::.).
  5387.  
  5388.      If your system does not put time stamps in the object files, then
  5389.      this is a faster way to compare them (using the Bourne shell):
  5390.  
  5391.           for file in *.o; do
  5392.           cmp $file stage2/$file
  5393.           done
  5394.  
  5395.      If you have built the compiler with the `-mno-mips-tfile' option on
  5396.      MIPS machines, you will not be able to compare the files.
  5397.  
  5398.  15. Build the Objective C library (if you have built the Objective C
  5399.      compiler).  Here is the command to do this:
  5400.  
  5401.           make objc-runtime CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O"
  5402.  
  5403.  16. Install the compiler driver, the compiler's passes and run-time
  5404.      support with `make install'.  Use the same value for `CC',
  5405.      `CFLAGS' and `LANGUAGES' that you used when compiling the files
  5406.      that are being installed.  One reason this is necessary is that
  5407.      some versions of Make have bugs and recompile files gratuitously
  5408.      when you do this step.  If you use the same variable values, those
  5409.      files will be recompiled properly.
  5410.  
  5411.      For example, if you have built the stage 2 compiler, you can use
  5412.      the following command:
  5413.  
  5414.           make install CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O" LANGUAGES="LIST"
  5415.  
  5416.      This copies the files `cc1', `cpp' and `libgcc.a' to files `cc1',
  5417.      `cpp' and `libgcc.a' in the directory
  5418.      `/usr/local/lib/gcc-lib/TARGET/VERSION', which is where the
  5419.      compiler driver program looks for them.  Here TARGET is the target
  5420.      machine type specified when you ran `configure', and VERSION is
  5421.      the version number of GNU CC.  This naming scheme permits various
  5422.      versions and/or cross-compilers to coexist.
  5423.  
  5424.      This also copies the driver program `xgcc' into
  5425.      `/usr/local/bin/gcc', so that it appears in typical execution
  5426.      search paths.
  5427.  
  5428.      On some systems, this command causes recompilation of some files.
  5429.      This is usually due to bugs in `make'.  You should either ignore
  5430.      this problem, or use GNU Make.
  5431.  
  5432.      *Warning: there is a bug in `alloca' in the Sun library.  To avoid
  5433.      this bug, be sure to install the executables of GNU CC that were
  5434.      compiled by GNU CC.  (That is, the executables from stage 2 or 3,
  5435.      not stage 1.)  They use `alloca' as a built-in function and never
  5436.      the one in the library.*
  5437.  
  5438.      (It is usually better to install GNU CC executables from stage 2
  5439.      or 3, since they usually run faster than the ones compiled with
  5440.      some other compiler.)
  5441.  
  5442.  17. Install the Objective C library (if you are installing the
  5443.      Objective C compiler).  Here is the command to do this:
  5444.  
  5445.           make install-libobjc CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O"
  5446.  
  5447.  18. If you're going to use C++, it's likely that you need to also
  5448.      install the libg++ distribution.  It should be available from the
  5449.      same place where you got the GNU C distribution.  Just as GNU C
  5450.      does not distribute a C runtime library, it also does not include
  5451.      a C++ run-time library.  All I/O functionality, special class
  5452.      libraries, etc., are available in the libg++ distribution.
  5453.  
  5454. 
  5455. File: use,  Node: Configurations,  Next: Other Dir,  Up: Installation
  5456.  
  5457. Configurations Supported by GNU CC
  5458. ==================================
  5459.  
  5460.    Here are the possible CPU types:
  5461.  
  5462.      1750a, a29k, alpha, arm, cN, clipper, dsp16xx, elxsi, h8300,
  5463.      hppa1.0, hppa1.1, i370, i386, i486, i586, i860, i960, m68000, m68k,
  5464.      m88k, mips, mipsel, mips64, mips64el, ns32k, powerpc, powerpcle,
  5465.      pyramid, romp, rs6000, sh, sparc, sparclite, sparc64, vax, we32k.
  5466.  
  5467.    Here are the recognized company names.  As you can see, customary
  5468. abbreviations are used rather than the longer official names.
  5469.  
  5470.      acorn, alliant, altos, apollo, att, bull, cbm, convergent, convex,
  5471.      crds, dec, dg, dolphin, elxsi, encore, harris, hitachi, hp, ibm,
  5472.      intergraph, isi, mips, motorola, ncr, next, ns, omron, plexus,
  5473.      sequent, sgi, sony, sun, tti, unicom, wrs.
  5474.  
  5475.    The company name is meaningful only to disambiguate when the rest of
  5476. the information supplied is insufficient.  You can omit it, writing
  5477. just `CPU-SYSTEM', if it is not needed.  For example, `vax-ultrix4.2'
  5478. is equivalent to `vax-dec-ultrix4.2'.
  5479.  
  5480.    Here is a list of system types:
  5481.  
  5482.      386bsd, aix, acis, amigados, aos, aout, bosx, bsd, clix, coff,
  5483.      ctix, cxux, dgux, dynix, ebmon, ecoff, elf, esix, freebsd, hms,
  5484.      genix, gnu, gnu/linux, hiux, hpux, iris, irix, isc, luna, lynxos,
  5485.      mach, minix, msdos, mvs, netbsd, newsos, nindy, ns, osf, osfrose,
  5486.      ptx, riscix, riscos, rtu, sco, sim, solaris, sunos, sym, sysv,
  5487.      udi, ultrix, unicos, uniplus, unos, vms, vsta, vxworks, winnt,
  5488.      xenix.
  5489.  
  5490. You can omit the system type; then `configure' guesses the operating
  5491. system from the CPU and company.
  5492.  
  5493.    You can add a version number to the system type; this may or may not
  5494. make a difference.  For example, you can write `bsd4.3' or `bsd4.4' to
  5495. distinguish versions of BSD.  In practice, the version number is most
  5496. needed for `sysv3' and `sysv4', which are often treated differently.
  5497.  
  5498.    If you specify an impossible combination such as `i860-dg-vms', then
  5499. you may get an error message from `configure', or it may ignore part of
  5500. the information and do the best it can with the rest.  `configure'
  5501. always prints the canonical name for the alternative that it used.  GNU
  5502. CC does not support all possible alternatives.
  5503.  
  5504.    Often a particular model of machine has a name.  Many machine names
  5505. are recognized as aliases for CPU/company combinations.  Thus, the
  5506. machine name `sun3', mentioned above, is an alias for `m68k-sun'.
  5507. Sometimes we accept a company name as a machine name, when the name is
  5508. popularly used for a particular machine.  Here is a table of the known
  5509. machine names:
  5510.  
  5511.      3300, 3b1, 3bN, 7300, altos3068, altos, apollo68, att-7300,
  5512.      balance, convex-cN, crds, decstation-3100, decstation, delta,
  5513.      encore, fx2800, gmicro, hp7NN, hp8NN, hp9k2NN, hp9k3NN, hp9k7NN,
  5514.      hp9k8NN, iris4d, iris, isi68, m3230, magnum, merlin, miniframe,
  5515.      mmax, news-3600, news800, news, next, pbd, pc532, pmax, powerpc,
  5516.      powerpcle, ps2, risc-news, rtpc, sun2, sun386i, sun386, sun3,
  5517.      sun4, symmetry, tower-32, tower.
  5518.  
  5519. Remember that a machine name specifies both the cpu type and the company
  5520. name.  If you want to install your own homemade configuration files,
  5521. you can use `local' as the company name to access them.  If you use
  5522. configuration `CPU-local', the configuration name without the cpu prefix
  5523. is used to form the configuration file names.
  5524.  
  5525.    Thus, if you specify `m68k-local', configuration uses files
  5526. `m68k.md', `local.h', `m68k.c', `xm-local.h', `t-local', and `x-local',
  5527. all in the directory `config/m68k'.
  5528.  
  5529.    Here is a list of configurations that have special treatment or
  5530. special things you must know:
  5531.  
  5532. `1750a-*-*'
  5533.      MIL-STD-1750A processors.
  5534.  
  5535.      Starting with GCC 2.6.1, the MIL-STD-1750A cross configuration no
  5536.      longer supports the Tektronix Assembler, but instead produces
  5537.      output for `as1750', an assembler/linker available under the GNU
  5538.      Public License for the 1750A. Contact *okellogg@salyko.cube.net*
  5539.      for more details on obtaining `as1750'.  A similarly licensed
  5540.      simulator for the 1750A is available from same address.
  5541.  
  5542.      You should ignore a fatal error during the building of libgcc
  5543.      (libgcc is not yet implemented for the 1750A.)
  5544.  
  5545.      The `as1750' assembler requires the file `ms1750.inc', which is
  5546.      found in the directory `config/1750a'.
  5547.  
  5548.      GNU CC produced the same sections as the Fairchild F9450 C
  5549.      Compiler, namely:
  5550.  
  5551.     `NREL'
  5552.           The program code section.
  5553.  
  5554.     `SREL'
  5555.           The read/write (RAM) data section.
  5556.  
  5557.     `KREL'
  5558.           The read-only (ROM) constants section.
  5559.  
  5560.     `IREL'
  5561.           Initialization section (code to copy KREL to SREL).
  5562.  
  5563.      The smallest addressable unit is 16 bits (BITS_PER_UNIT is 16).
  5564.      This means that type `char' is represented with a 16-bit word per
  5565.      character.  The 1750A's "Load/Store Upper/Lower Byte" instructions
  5566.      are not used by GNU CC.
  5567.  
  5568.      There is a problem with long argument lists to functions.  The
  5569.      compiler aborts if the sum of space needed by all arguments
  5570.      exceeds 14 words.  This is because the arguments are passed in
  5571.      registers (R0..R13) not on the stack, and there is a problem with
  5572.      passing further arguments (i.e.  beyond those in R0..R13) via the
  5573.      stack.
  5574.  
  5575.      If efficiency is less important than using long argument lists, you
  5576.      can change the definition of the `FUNCTION_ARG' macro in
  5577.      `config/1750/1750a.h' to always return zero.  If you do that, GNU
  5578.      CC will pass all parameters on the stack.
  5579.  
  5580. `alpha-*-osf1'
  5581.      Systems using processors that implement the DEC Alpha architecture
  5582.      and are running the OSF/1 operating system, for example the DEC
  5583.      Alpha AXP systems.  (VMS on the Alpha is not currently supported
  5584.      by GNU CC.)
  5585.  
  5586.      GNU CC writes a `.verstamp' directive to the assembler output file
  5587.      unless it is built as a cross-compiler.  It gets the version to
  5588.      use from the system header file `/usr/include/stamp.h'.  If you
  5589.      install a new version of OSF/1, you should rebuild GCC to pick up
  5590.      the new version stamp.
  5591.  
  5592.      Note that since the Alpha is a 64-bit architecture,
  5593.      cross-compilers from 32-bit machines will not generate code as
  5594.      efficient as that generated when the compiler is running on a
  5595.      64-bit machine because many optimizations that depend on being
  5596.      able to represent a word on the target in an integral value on the
  5597.      host cannot be performed.  Building cross-compilers on the Alpha
  5598.      for 32-bit machines has only been tested in a few cases and may
  5599.      not work properly.
  5600.  
  5601.      `make compare' may fail on old versions of OSF/1 unless you add
  5602.      `-save-temps' to `CFLAGS'.  On these systems, the name of the
  5603.      assembler input file is stored in the object file, and that makes
  5604.      comparison fail if it differs between the `stage1' and `stage2'
  5605.      compilations.  The option `-save-temps' forces a fixed name to be
  5606.      used for the assembler input file, instead of a randomly chosen
  5607.      name in `/tmp'.  Do not add `-save-temps' unless the comparisons
  5608.      fail without that option.  If you add `-save-temps', you will have
  5609.      to manually delete the `.i' and `.s' files after each series of
  5610.      compilations.
  5611.  
  5612.      GNU CC now supports both the native (ECOFF) debugging format used
  5613.      by DBX and GDB and an encapsulated STABS format for use only with
  5614.      GDB.  See the discussion of the `--with-stabs' option of
  5615.      `configure' above for more information on these formats and how to
  5616.      select them.
  5617.  
  5618.      There is a bug in DEC's assembler that produces incorrect line
  5619.      numbers for ECOFF format when the `.align' directive is used.  To
  5620.      work around this problem, GNU CC will not emit such alignment
  5621.      directives while writing ECOFF format debugging information even
  5622.      if optimization is being performed.  Unfortunately, this has the
  5623.      very undesirable side-effect that code addresses when `-O' is
  5624.      specified are different depending on whether or not `-g' is also
  5625.      specified.
  5626.  
  5627.      To avoid this behavior, specify `-gstabs+' and use GDB instead of
  5628.      DBX.  DEC is now aware of this problem with the assembler and
  5629.      hopes to provide a fix shortly.
  5630.  
  5631. `arm'
  5632.      Advanced RISC Machines ARM-family processors.  These are often
  5633.      used in embedded applications.  There are no standard Unix
  5634.      configurations.  This configuration corresponds to the basic
  5635.      instruction sequences and will produce a.out format object modules.
  5636.  
  5637.      You may need to make a variant of the file `arm.h' for your
  5638.      particular configuration.
  5639.  
  5640. `arm-*-riscix'
  5641.      The ARM2 or ARM3 processor running RISC iX, Acorn's port of BSD
  5642.      Unix.  If you are running a version of RISC iX prior to 1.2 then
  5643.      you must specify the version number during configuration.  Note
  5644.      that the assembler shipped with RISC iX does not support stabs
  5645.      debugging information; a new version of the assembler, with stabs
  5646.      support included, is now available from Acorn.
  5647.  
  5648. `a29k'
  5649.      AMD Am29k-family processors.  These are normally used in embedded
  5650.      applications.  There are no standard Unix configurations.  This
  5651.      configuration corresponds to AMD's standard calling sequence and
  5652.      binary interface and is compatible with other 29k tools.
  5653.  
  5654.      You may need to make a variant of the file `a29k.h' for your
  5655.      particular configuration.
  5656.  
  5657. `a29k-*-bsd'
  5658.      AMD Am29050 used in a system running a variant of BSD Unix.
  5659.  
  5660. `decstation-*'
  5661.      DECstations can support three different personalities: Ultrix, DEC
  5662.      OSF/1, and OSF/rose.  To configure GCC for these platforms use the
  5663.      following configurations:
  5664.  
  5665.     `decstation-ultrix'
  5666.           Ultrix configuration.
  5667.  
  5668.     `decstation-osf1'
  5669.           Dec's version of OSF/1.
  5670.  
  5671.     `decstation-osfrose'
  5672.           Open Software Foundation reference port of OSF/1 which uses
  5673.           the OSF/rose object file format instead of ECOFF.  Normally,
  5674.           you would not select this configuration.
  5675.  
  5676.      The MIPS C compiler needs to be told to increase its table size
  5677.      for switch statements with the `-Wf,-XNg1500' option in order to
  5678.      compile `cp/parse.c'.  If you use the `-O2' optimization option,
  5679.      you also need to use `-Olimit 3000'.  Both of these options are
  5680.      automatically generated in the `Makefile' that the shell script
  5681.      `configure' builds.  If you override the `CC' make variable and
  5682.      use the MIPS compilers, you may need to add `-Wf,-XNg1500 -Olimit
  5683.      3000'.
  5684.  
  5685. `elxsi-elxsi-bsd'
  5686.      The Elxsi's C compiler has known limitations that prevent it from
  5687.      compiling GNU C.  Please contact `mrs@cygnus.com' for more details.
  5688.  
  5689. `dsp16xx'
  5690.      A port to the AT&T DSP1610 family of processors.
  5691.  
  5692. `h8300-*-*'
  5693.      The calling convention and structure layout has changed in release
  5694.      2.6.  All code must be recompiled.  The calling convention now
  5695.      passes the first three arguments in function calls in registers.
  5696.      Structures are no longer a multiple of 2 bytes.
  5697.  
  5698. `hppa*-*-*'
  5699.      There are two variants of this CPU, called 1.0 and 1.1, which have
  5700.      different machine descriptions.  You must use the right one for
  5701.      your machine.  All 7NN machines and 8N7 machines use 1.1, while
  5702.      all other 8NN machines use 1.0.
  5703.  
  5704.      The easiest way to handle this problem is to use `configure hpNNN'
  5705.      or `configure hpNNN-hpux', where NNN is the model number of the
  5706.      machine.  Then `configure' will figure out if the machine is a 1.0
  5707.      or 1.1.  Use `uname -a' to find out the model number of your
  5708.      machine.
  5709.  
  5710.      `-g' does not work on HP-UX, since that system uses a peculiar
  5711.      debugging format which GNU CC does not know about.  However, `-g'
  5712.      will work if you also use GAS and GDB in conjunction with GCC.  We
  5713.      highly recommend using GAS for all HP-PA configurations.
  5714.  
  5715.      You should be using GAS-2.3 (or later) along with GDB-4.12 (or
  5716.      later).  These can be retrieved from all the traditional GNU ftp
  5717.      archive sites.
  5718.  
  5719.      Build GAS and install the resulting binary as:
  5720.  
  5721.           /usr/local/lib/gcc-lib/CONFIGURATION/GCCVERSION/as
  5722.  
  5723.      where CONFIGURATION is the configuration name (perhaps
  5724.      `hpNNN-hpux') and GCCVERSION is the GNU CC version number.  Do
  5725.      this *before* starting the build process, otherwise you will get
  5726.      errors from the HPUX assembler while building `libgcc2.a'.  The
  5727.      command
  5728.  
  5729.           make install-dir
  5730.  
  5731.      will create the necessary directory hierarchy so you can install
  5732.      GAS before building GCC.
  5733.  
  5734.      To enable debugging, configure GNU CC with the `--with-gnu-as'
  5735.      option before building.
  5736.  
  5737.      It has been reported that GNU CC produces invalid assembly code for
  5738.      1.1 machines running HP-UX 8.02 when using the HP assembler.
  5739.      Typically the errors look like this:
  5740.           as: bug.s @line#15 [err#1060]
  5741.             Argument 0 or 2 in FARG upper
  5742.                    - lookahead = ARGW1=FR,RTNVAL=GR
  5743.           as: foo.s @line#28 [err#1060]
  5744.             Argument 0 or 2 in FARG upper
  5745.                    - lookahead = ARGW1=FR
  5746.  
  5747.      You can check the version of HP-UX you are running by executing
  5748.      the command `uname -r'.   If you are indeed running HP-UX 8.02 on
  5749.      a PA and using the HP assembler then configure GCC with
  5750.      "hpNNN-hpux8.02".
  5751.  
  5752. `i370-*-*'
  5753.      This port is very preliminary and has many known bugs.  We hope to
  5754.      have a higher-quality port for this machine soon.
  5755.  
  5756. `i386-*-linuxoldld'
  5757.      Use this configuration to generate a.out binaries on Linux if you
  5758.      do not have gas/binutils version 2.5.2 or later installed. This is
  5759.      an obsolete configuration.
  5760.  
  5761. `i386-*-linuxaout'
  5762.      Use this configuration to generate a.out binaries on Linux. This
  5763.      is an obsolete configuration.  You must use gas/binutils version
  5764.      2.5.2 or later.
  5765.  
  5766. `i386-*-linux'
  5767.      Use this configuration to generate ELF binaries on Linux.  You must
  5768.      use gas/binutils version 2.5.2 or later.
  5769.  
  5770. `i386-*-sco'
  5771.      Compilation with RCC is recommended.  Also, it may be a good idea
  5772.      to link with GNU malloc instead of the malloc that comes with the
  5773.      system.
  5774.  
  5775. `i386-*-sco3.2v4'
  5776.      Use this configuration for SCO release 3.2 version 4.
  5777.  
  5778. `i386-*-isc'
  5779.      It may be a good idea to link with GNU malloc instead of the
  5780.      malloc that comes with the system.
  5781.  
  5782.      In ISC version 4.1, `sed' core dumps when building `deduced.h'.
  5783.      Use the version of `sed' from version 4.0.
  5784.  
  5785. `i386-*-esix'
  5786.      It may be good idea to link with GNU malloc instead of the malloc
  5787.      that comes with the system.
  5788.  
  5789. `i386-ibm-aix'
  5790.      You need to use GAS version 2.1 or later, and and LD from GNU
  5791.      binutils version 2.2 or later.
  5792.  
  5793. `i386-sequent-bsd'
  5794.      Go to the Berkeley universe before compiling.  In addition, you
  5795.      probably need to create a file named `string.h' containing just
  5796.      one line: `#include <strings.h>'.
  5797.  
  5798. `i386-sequent-ptx1*'
  5799.      Sequent DYNIX/ptx 1.x.
  5800.  
  5801. `i386-sequent-ptx2*'
  5802.      Sequent DYNIX/ptx 2.x.
  5803.  
  5804. `i386-sun-sunos4'
  5805.      You may find that you need another version of GNU CC to begin
  5806.      bootstrapping with, since the current version when built with the
  5807.      system's own compiler seems to get an infinite loop compiling part
  5808.      of `libgcc2.c'.  GNU CC version 2 compiled with GNU CC (any
  5809.      version) seems not to have this problem.
  5810.  
  5811.      See *Note Sun Install::, for information on installing GNU CC on
  5812.      Sun systems.
  5813.  
  5814. `i[345]86-*-winnt3.5'
  5815.      This version requires a GAS that has not let been released.  Until
  5816.      it is, you can get a prebuilt binary version via anonymous ftp from
  5817.      `cs.washington.edu:pub/gnat' or `cs.nyu.edu:pub/gnat'. You must
  5818.      also use the Microsoft header files from the Windows NT 3.5 SDK.
  5819.      Find these on the CDROM in the `/mstools/h' directory dated
  5820.      9/4/94.  You must use a fixed version of Microsoft linker made
  5821.      especially for NT 3.5, which is also is available on the NT 3.5
  5822.      SDK CDROM.  If you do not have this linker, can you also use the
  5823.      linker from Visual C/C++ 1.0 or 2.0.
  5824.  
  5825.      Installing GNU CC for NT builds a wrapper linker, called `ld.exe',
  5826.      which mimics the behaviour of Unix `ld' in the specification of
  5827.      libraries (`-L' and `-l').  `ld.exe' looks for both Unix and
  5828.      Microsoft named libraries.  For example, if you specify `-lfoo',
  5829.      `ld.exe' will look first for `libfoo.a' and then for `foo.lib'.
  5830.  
  5831.      You may install GNU CC for Windows NT in one of two ways,
  5832.      depending on whether or not you have a Unix-like shell and various
  5833.      Unix-like utilities.
  5834.  
  5835.        1. If you do not have a Unix-like shell and few Unix-like
  5836.           utilities, you will use a DOS style batch script called
  5837.           `configure.bat'.  Invoke it as `configure winnt' from an
  5838.           MSDOS console window or from the program manager dialog box.
  5839.           `configure.bat' assumes you have already installed and have
  5840.           in your path a Unix-like `sed' program which is used to
  5841.           create a working `Makefile' from `Makefile.in'.
  5842.  
  5843.           `Makefile' uses the Microsoft Nmake program maintenance
  5844.           utility and the Visual C/C++ V8.00 compiler to build GNU CC.
  5845.           You need only have the utilities `sed' and `touch' to use
  5846.           this installation method, which only automatically builds the
  5847.           compiler itself.  You must then examine what `fixinc.winnt'
  5848.           does, edit the header files by hand and build `libgcc.a'
  5849.           manually.
  5850.  
  5851.        2. The second type of installation assumes you are running a
  5852.           Unix-like shell, have a complete suite of Unix-like utilities
  5853.           in your path, and have a previous version of GNU CC already
  5854.           installed, either through building it via the above
  5855.           installation method or acquiring a pre-built binary.  In this
  5856.           case, use the `configure' script in the normal fashion.
  5857.  
  5858. `i860-intel-osf1'
  5859.      This is the Paragon.  If you have version 1.0 of the operating
  5860.      system, see *Note Installation Problems::, for special things you
  5861.      need to do to compensate for peculiarities in the system.
  5862.  
  5863. `*-lynx-lynxos'
  5864.      LynxOS 2.2 and earlier comes with GNU CC 1.x already installed as
  5865.      `/bin/gcc'.  You should compile with this instead of `/bin/cc'.
  5866.      You can tell GNU CC to use the GNU assembler and linker, by
  5867.      specifying `--with-gnu-as --with-gnu-ld' when configuring.  These
  5868.      will produce COFF format object files and executables;  otherwise
  5869.      GNU CC will use the installed tools, which produce a.out format
  5870.      executables.
  5871.  
  5872. `m68000-hp-bsd'
  5873.      HP 9000 series 200 running BSD.  Note that the C compiler that
  5874.      comes with this system cannot compile GNU CC; contact
  5875.      `law@cs.utah.edu' to get binaries of GNU CC for bootstrapping.
  5876.  
  5877. `m68k-altos'
  5878.      Altos 3068.  You must use the GNU assembler, linker and debugger.
  5879.      Also, you must fix a kernel bug.  Details in the file
  5880.      `README.ALTOS'.
  5881.  
  5882. `m68k-att-sysv'
  5883.      AT&T 3b1, a.k.a. 7300 PC.  Special procedures are needed to
  5884.      compile GNU CC with this machine's standard C compiler, due to
  5885.      bugs in that compiler.  You can bootstrap it more easily with
  5886.      previous versions of GNU CC if you have them.
  5887.  
  5888.      Installing GNU CC on the 3b1 is difficult if you do not already
  5889.      have GNU CC running, due to bugs in the installed C compiler.
  5890.      However, the following procedure might work.  We are unable to
  5891.      test it.
  5892.  
  5893.        1. Comment out the `#include "config.h"' line on line 37 of
  5894.           `cccp.c' and do `make cpp'.  This makes a preliminary version
  5895.           of GNU cpp.
  5896.  
  5897.        2. Save the old `/lib/cpp' and copy the preliminary GNU cpp to
  5898.           that file name.
  5899.  
  5900.        3. Undo your change in `cccp.c', or reinstall the original
  5901.           version, and do `make cpp' again.
  5902.  
  5903.        4. Copy this final version of GNU cpp into `/lib/cpp'.
  5904.  
  5905.        5. Replace every occurrence of `obstack_free' in the file
  5906.           `tree.c' with `_obstack_free'.
  5907.  
  5908.        6. Run `make' to get the first-stage GNU CC.
  5909.  
  5910.        7. Reinstall the original version of `/lib/cpp'.
  5911.  
  5912.        8. Now you can compile GNU CC with itself and install it in the
  5913.           normal fashion.
  5914.  
  5915. `m68k-bull-sysv'
  5916.      Bull DPX/2 series 200 and 300 with BOS-2.00.45 up to BOS-2.01. GNU
  5917.      CC works either with native assembler or GNU assembler. You can use
  5918.      GNU assembler with native coff generation by providing
  5919.      `--with-gnu-as' to the configure script or use GNU assembler with
  5920.      dbx-in-coff encapsulation by providing `--with-gnu-as --stabs'.
  5921.      For any problem with native assembler or for availability of the
  5922.      DPX/2 port of GAS, contact `F.Pierresteguy@frcl.bull.fr'.
  5923.  
  5924. `m68k-crds-unox'
  5925.      Use `configure unos' for building on Unos.
  5926.  
  5927.      The Unos assembler is named `casm' instead of `as'.  For some
  5928.      strange reason linking `/bin/as' to `/bin/casm' changes the
  5929.      behavior, and does not work.  So, when installing GNU CC, you
  5930.      should install the following script as `as' in the subdirectory
  5931.      where the passes of GCC are installed:
  5932.  
  5933.           #!/bin/sh
  5934.           casm $*
  5935.  
  5936.      The default Unos library is named `libunos.a' instead of `libc.a'.
  5937.      To allow GNU CC to function, either change all references to
  5938.      `-lc' in `gcc.c' to `-lunos' or link `/lib/libc.a' to
  5939.      `/lib/libunos.a'.
  5940.  
  5941.      When compiling GNU CC with the standard compiler, to overcome bugs
  5942.      in the support of `alloca', do not use `-O' when making stage 2.
  5943.      Then use the stage 2 compiler with `-O' to make the stage 3
  5944.      compiler.  This compiler will have the same characteristics as the
  5945.      usual stage 2 compiler on other systems.  Use it to make a stage 4
  5946.      compiler and compare that with stage 3 to verify proper
  5947.      compilation.
  5948.  
  5949.      (Perhaps simply defining `ALLOCA' in `x-crds' as described in the
  5950.      comments there will make the above paragraph superfluous.  Please
  5951.      inform us of whether this works.)
  5952.  
  5953.      Unos uses memory segmentation instead of demand paging, so you
  5954.      will need a lot of memory.  5 Mb is barely enough if no other
  5955.      tasks are running.  If linking `cc1' fails, try putting the object
  5956.      files into a library and linking from that library.
  5957.  
  5958. `m68k-hp-hpux'
  5959.      HP 9000 series 300 or 400 running HP-UX.  HP-UX version 8.0 has a
  5960.      bug in the assembler that prevents compilation of GNU CC.  To fix
  5961.      it, get patch PHCO_4484 from HP.
  5962.  
  5963.      In addition, if you wish to use gas `--with-gnu-as' you must use
  5964.      gas version 2.1 or later, and you must use the GNU linker version
  5965.      2.1 or later.  Earlier versions of gas relied upon a program which
  5966.      converted the gas output into the native HP/UX format, but that
  5967.      program has not been kept up to date.  gdb does not understand
  5968.      that native HP/UX format, so you must use gas if you wish to use
  5969.      gdb.
  5970.  
  5971. `m68k-sun'
  5972.      Sun 3.  We do not provide a configuration file to use the Sun FPA
  5973.      by default, because programs that establish signal handlers for
  5974.      floating point traps inherently cannot work with the FPA.
  5975.  
  5976.      See *Note Sun Install::, for information on installing GNU CC on
  5977.      Sun systems.
  5978.  
  5979. `m88k-*-svr3'
  5980.      Motorola m88k running the AT&T/Unisoft/Motorola V.3 reference port.
  5981.      These systems tend to use the Green Hills C, revision 1.8.5, as the
  5982.      standard C compiler.  There are apparently bugs in this compiler
  5983.      that result in object files differences between stage 2 and stage
  5984.      3.  If this happens, make the stage 4 compiler and compare it to
  5985.      the stage 3 compiler.  If the stage 3 and stage 4 object files are
  5986.      identical, this suggests you encountered a problem with the
  5987.      standard C compiler; the stage 3 and 4 compilers may be usable.
  5988.  
  5989.      It is best, however, to use an older version of GNU CC for
  5990.      bootstrapping if you have one.
  5991.  
  5992. `m88k-*-dgux'
  5993.      Motorola m88k running DG/UX.  To build 88open BCS native or cross
  5994.      compilers on DG/UX, specify the configuration name as
  5995.      `m88k-*-dguxbcs' and build in the 88open BCS software development
  5996.      environment.  To build ELF native or cross compilers on DG/UX,
  5997.      specify `m88k-*-dgux' and build in the DG/UX ELF development
  5998.      environment.  You set the software development environment by
  5999.      issuing `sde-target' command and specifying either `m88kbcs' or
  6000.      `m88kdguxelf' as the operand.
  6001.  
  6002.      If you do not specify a configuration name, `configure' guesses the
  6003.      configuration based on the current software development
  6004.      environment.
  6005.  
  6006. `m88k-tektronix-sysv3'
  6007.      Tektronix XD88 running UTekV 3.2e.  Do not turn on optimization
  6008.      while building stage1 if you bootstrap with the buggy Green Hills
  6009.      compiler.  Also, The bundled LAI System V NFS is buggy so if you
  6010.      build in an NFS mounted directory, start from a fresh reboot, or
  6011.      avoid NFS all together.  Otherwise you may have trouble getting
  6012.      clean comparisons between stages.
  6013.  
  6014. `mips-mips-bsd'
  6015.      MIPS machines running the MIPS operating system in BSD mode.  It's
  6016.      possible that some old versions of the system lack the functions
  6017.      `memcpy', `memcmp', and `memset'.  If your system lacks these, you
  6018.      must remove or undo the definition of `TARGET_MEM_FUNCTIONS' in
  6019.      `mips-bsd.h'.
  6020.  
  6021.      The MIPS C compiler needs to be told to increase its table size
  6022.      for switch statements with the `-Wf,-XNg1500' option in order to
  6023.      compile `cp/parse.c'.  If you use the `-O2' optimization option,
  6024.      you also need to use `-Olimit 3000'.  Both of these options are
  6025.      automatically generated in the `Makefile' that the shell script
  6026.      `configure' builds.  If you override the `CC' make variable and
  6027.      use the MIPS compilers, you may need to add `-Wf,-XNg1500 -Olimit
  6028.      3000'.
  6029.  
  6030. `mips-mips-riscos*'
  6031.      The MIPS C compiler needs to be told to increase its table size
  6032.      for switch statements with the `-Wf,-XNg1500' option in order to
  6033.      compile `cp/parse.c'.  If you use the `-O2' optimization option,
  6034.      you also need to use `-Olimit 3000'.  Both of these options are
  6035.      automatically generated in the `Makefile' that the shell script
  6036.      `configure' builds.  If you override the `CC' make variable and
  6037.      use the MIPS compilers, you may need to add `-Wf,-XNg1500 -Olimit
  6038.      3000'.
  6039.  
  6040.      MIPS computers running RISC-OS can support four different
  6041.      personalities: default, BSD 4.3, System V.3, and System V.4 (older
  6042.      versions of RISC-OS don't support V.4).  To configure GCC for
  6043.      these platforms use the following configurations:
  6044.  
  6045.     `mips-mips-riscos`rev''
  6046.           Default configuration for RISC-OS, revision `rev'.
  6047.  
  6048.     `mips-mips-riscos`rev'bsd'
  6049.           BSD 4.3 configuration for RISC-OS, revision `rev'.
  6050.  
  6051.     `mips-mips-riscos`rev'sysv4'
  6052.           System V.4 configuration for RISC-OS, revision `rev'.
  6053.  
  6054.     `mips-mips-riscos`rev'sysv'
  6055.           System V.3 configuration for RISC-OS, revision `rev'.
  6056.  
  6057.      The revision `rev' mentioned above is the revision of RISC-OS to
  6058.      use.  You must reconfigure GCC when going from a RISC-OS revision
  6059.      4 to RISC-OS revision 5.  This has the effect of avoiding a linker
  6060.      bug (see *Note Installation Problems::, for more details).
  6061.  
  6062. `mips-sgi-*'
  6063.      In order to compile GCC on an SGI running IRIX 4, the "c.hdr.lib"
  6064.      option must be installed from the CD-ROM supplied from Silicon
  6065.      Graphics.  This is found on the 2nd CD in release 4.0.1.
  6066.  
  6067.      In order to compile GCC on an SGI running IRIX 5, the
  6068.      "compiler_dev.hdr" subsystem must be installed from the IDO CD-ROM
  6069.      supplied by Silicon Graphics.
  6070.  
  6071.      `make compare' may fail on version 5 of IRIX unless you add
  6072.      `-save-temps' to `CFLAGS'.  On these systems, the name of the
  6073.      assembler input file is stored in the object file, and that makes
  6074.      comparison fail if it differs between the `stage1' and `stage2'
  6075.      compilations.  The option `-save-temps' forces a fixed name to be
  6076.      used for the assembler input file, instead of a randomly chosen
  6077.      name in `/tmp'.  Do not add `-save-temps' unless the comparisons
  6078.      fail without that option.  If you do you `-save-temps', you will
  6079.      have to manually delete the `.i' and `.s' files after each series
  6080.      of compilations.
  6081.  
  6082.      The MIPS C compiler needs to be told to increase its table size
  6083.      for switch statements with the `-Wf,-XNg1500' option in order to
  6084.      compile `cp/parse.c'.  If you use the `-O2' optimization option,
  6085.      you also need to use `-Olimit 3000'.  Both of these options are
  6086.      automatically generated in the `Makefile' that the shell script
  6087.      `configure' builds.  If you override the `CC' make variable and
  6088.      use the MIPS compilers, you may need to add `-Wf,-XNg1500 -Olimit
  6089.      3000'.
  6090.  
  6091.      On Irix version 4.0.5F, and perhaps on some other versions as well,
  6092.      there is an assembler bug that reorders instructions incorrectly.
  6093.      To work around it, specify the target configuration
  6094.      `mips-sgi-irix4loser'.  This configuration inhibits assembler
  6095.      optimization.
  6096.  
  6097.      In a compiler configured with target `mips-sgi-irix4', you can turn
  6098.      off assembler optimization by using the `-noasmopt' option.  This
  6099.      compiler option passes the option `-O0' to the assembler, to
  6100.      inhibit reordering.
  6101.  
  6102.      The `-noasmopt' option can be useful for testing whether a problem
  6103.      is due to erroneous assembler reordering.  Even if a problem does
  6104.      not go away with `-noasmopt', it may still be due to assembler
  6105.      reordering--perhaps GNU CC itself was miscompiled as a result.
  6106.  
  6107.      To enable debugging under Irix 5, you must use GNU as 2.5 or later,
  6108.      and use the `--with-gnu-as' configure option when configuring gcc.
  6109.      GNU as is distributed as part of the binutils package.
  6110.  
  6111. `mips-sony-sysv'
  6112.      Sony MIPS NEWS.  This works in NEWSOS 5.0.1, but not in 5.0.2
  6113.      (which uses ELF instead of COFF).  Support for 5.0.2 will probably
  6114.      be provided soon by volunteers.  In particular, the linker does
  6115.      not like the code generated by GCC when shared libraries are
  6116.      linked in.
  6117.  
  6118. `ns32k-encore'
  6119.      Encore ns32000 system.  Encore systems are supported only under
  6120.      BSD.
  6121.  
  6122. `ns32k-*-genix'
  6123.      National Semiconductor ns32000 system.  Genix has bugs in `alloca'
  6124.      and `malloc'; you must get the compiled versions of these from GNU
  6125.      Emacs.
  6126.  
  6127. `ns32k-sequent'
  6128.      Go to the Berkeley universe before compiling.  In addition, you
  6129.      probably need to create a file named `string.h' containing just
  6130.      one line: `#include <strings.h>'.
  6131.  
  6132. `ns32k-utek'
  6133.      UTEK ns32000 system ("merlin").  The C compiler that comes with
  6134.      this system cannot compile GNU CC; contact `tektronix!reed!mason'
  6135.      to get binaries of GNU CC for bootstrapping.
  6136.  
  6137. `romp-*-aos'
  6138. `romp-*-mach'
  6139.      The only operating systems supported for the IBM RT PC are AOS and
  6140.      MACH.  GNU CC does not support AIX running on the RT.  We
  6141.      recommend you compile GNU CC with an earlier version of itself; if
  6142.      you compile GNU CC with `hc', the Metaware compiler, it will work,
  6143.      but you will get mismatches between the stage 2 and stage 3
  6144.      compilers in various files.  These errors are minor differences in
  6145.      some floating-point constants and can be safely ignored; the stage
  6146.      3 compiler is correct.
  6147.  
  6148. `rs6000-*-aix'
  6149.      If you are running AIX version 3.2.5 and have XLC version 1.3.0.0,
  6150.      you must obtain XLC 1.3.0.1 by requesting PTF 421749 from IBM.
  6151.      Likewise, XLC-1.3.0.19 cannot correctly compile GNU CC; you must
  6152.      obtain XLC-1.3.0.24 by requesting PTF 432238 from IBM.  If you are
  6153.      using an older version of AIX you may have an old version of the
  6154.      IBM assembler, which cannot correctly handle debugging directives.
  6155.      See the file `README.RS6000' for more details on both of these
  6156.      problems.
  6157.  
  6158.      The PowerPC and POWER2 architectures are now supported, but have
  6159.      not been very extensively tested due to lack of appropriate
  6160.      systems.  Only AIX is supported on the PowerPC.  GNU CC does not
  6161.      yet support the 64-bit PowerPC instructions.
  6162.  
  6163.      Objective C does not work on this architecture.
  6164.  
  6165.      AIX on the RS/6000 provides support (NLS) for environments outside
  6166.      of the United States.  Compilers and assemblers use NLS to support
  6167.      locale-specific representations of various objects including
  6168.      floating-point numbers ("." vs "," for separating decimal
  6169.      fractions).  There have been problems reported where the library
  6170.      linked with GNU CC does not produce the same floating-point
  6171.      formats that the assembler accepts.  If you have this problem, set
  6172.      the LANG environment variable to "C" or "En_US".
  6173.  
  6174. `powerpc-*-elf'
  6175. `powerpc-*-sysv4'
  6176.      PowerPC system in big endian mode, running System V.4.  This
  6177.      system is currently under development.
  6178.  
  6179. `powerpc-*-eabi'
  6180.      Embedded PowerPC system in big endian mode.  This system is
  6181.      currently under development.
  6182.  
  6183. `powerpcle-*-elf'
  6184. `powerpcle-*-eabi'
  6185.      PowerPC system in little endian mode, running System V.4.  This
  6186.      system is currently under development.
  6187.  
  6188. `powerpcle-*-sysv4'
  6189.      Embedded PowerPC system in little endian mode.  This system is
  6190.      currently under development.
  6191.  
  6192. `vax-dec-ultrix'
  6193.      Don't try compiling with Vax C (`vcc').  It produces incorrect code
  6194.      in some cases (for example, when `alloca' is used).
  6195.  
  6196.      Meanwhile, compiling `cp/parse.c' with pcc does not work because of
  6197.      an internal table size limitation in that compiler.  To avoid this
  6198.      problem, compile just the GNU C compiler first, and use it to
  6199.      recompile building all the languages that you want to run.
  6200.  
  6201. `sparc-sun-*'
  6202.      See *Note Sun Install::, for information on installing GNU CC on
  6203.      Sun systems.
  6204.  
  6205. `vax-dec-vms'
  6206.      See *Note VMS Install::, for details on how to install GNU CC on
  6207.      VMS.
  6208.  
  6209. `we32k-*-*'
  6210.      These computers are also known as the 3b2, 3b5, 3b20 and other
  6211.      similar names.  (However, the 3b1 is actually a 68000; see *Note
  6212.      Configurations::.)
  6213.  
  6214.      Don't use `-g' when compiling with the system's compiler.  The
  6215.      system's linker seems to be unable to handle such a large program
  6216.      with debugging information.
  6217.  
  6218.      The system's compiler runs out of capacity when compiling `stmt.c'
  6219.      in GNU CC.  You can work around this by building `cpp' in GNU CC
  6220.      first, then use that instead of the system's preprocessor with the
  6221.      system's C compiler to compile `stmt.c'.  Here is how:
  6222.  
  6223.           mv /lib/cpp /lib/cpp.att
  6224.           cp cpp /lib/cpp.gnu
  6225.           echo '/lib/cpp.gnu -traditional ${1+"$@"}' > /lib/cpp
  6226.           chmod +x /lib/cpp
  6227.  
  6228.      The system's compiler produces bad code for some of the GNU CC
  6229.      optimization files.  So you must build the stage 2 compiler without
  6230.      optimization.  Then build a stage 3 compiler with optimization.
  6231.      That executable should work.  Here are the necessary commands:
  6232.  
  6233.           make LANGUAGES=c CC=stage1/xgcc CFLAGS="-Bstage1/ -g"
  6234.           make stage2
  6235.           make CC=stage2/xgcc CFLAGS="-Bstage2/ -g -O"
  6236.  
  6237.      You may need to raise the ULIMIT setting to build a C++ compiler,
  6238.      as the file `cc1plus' is larger than one megabyte.
  6239.  
  6240. 
  6241. File: use,  Node: Other Dir,  Next: Cross-Compiler,  Prev: Configurations,  Up: Installation
  6242.  
  6243. Compilation in a Separate Directory
  6244. ===================================
  6245.  
  6246.    If you wish to build the object files and executables in a directory
  6247. other than the one containing the source files, here is what you must
  6248. do differently:
  6249.  
  6250.   1. Make sure you have a version of Make that supports the `VPATH'
  6251.      feature.  (GNU Make supports it, as do Make versions on most BSD
  6252.      systems.)
  6253.  
  6254.   2. If you have ever run `configure' in the source directory, you must
  6255.      undo the configuration.  Do this by running:
  6256.  
  6257.           make distclean
  6258.  
  6259.   3. Go to the directory in which you want to build the compiler before
  6260.      running `configure':
  6261.  
  6262.           mkdir gcc-sun3
  6263.           cd gcc-sun3
  6264.  
  6265.      On systems that do not support symbolic links, this directory must
  6266.      be on the same file system as the source code directory.
  6267.  
  6268.   4. Specify where to find `configure' when you run it:
  6269.  
  6270.           ../gcc/configure ...
  6271.  
  6272.      This also tells `configure' where to find the compiler sources;
  6273.      `configure' takes the directory from the file name that was used to
  6274.      invoke it.  But if you want to be sure, you can specify the source
  6275.      directory with the `--srcdir' option, like this:
  6276.  
  6277.           ../gcc/configure --srcdir=../gcc OTHER OPTIONS
  6278.  
  6279.      The directory you specify with `--srcdir' need not be the same as
  6280.      the one that `configure' is found in.
  6281.  
  6282.    Now, you can run `make' in that directory.  You need not repeat the
  6283. configuration steps shown above, when ordinary source files change.  You
  6284. must, however, run `configure' again when the configuration files
  6285. change, if your system does not support symbolic links.
  6286.  
  6287. 
  6288. File: use,  Node: Cross-Compiler,  Next: Sun Install,  Prev: Other Dir,  Up: Installation
  6289.  
  6290. Building and Installing a Cross-Compiler
  6291. ========================================
  6292.  
  6293.    GNU CC can function as a cross-compiler for many machines, but not
  6294. all.
  6295.  
  6296.    * Cross-compilers for the Mips as target using the Mips assembler
  6297.      currently do not work, because the auxiliary programs
  6298.      `mips-tdump.c' and `mips-tfile.c' can't be compiled on anything
  6299.      but a Mips.  It does work to cross compile for a Mips if you use
  6300.      the GNU assembler and linker.
  6301.  
  6302.    * Cross-compilers between machines with different floating point
  6303.      formats have not all been made to work.  GNU CC now has a floating
  6304.      point emulator with which these can work, but each target machine
  6305.      description needs to be updated to take advantage of it.
  6306.  
  6307.    * Cross-compilation between machines of different word sizes is
  6308.      somewhat problematic and sometimes does not work.
  6309.  
  6310.    Since GNU CC generates assembler code, you probably need a
  6311. cross-assembler that GNU CC can run, in order to produce object files.
  6312. If you want to link on other than the target machine, you need a
  6313. cross-linker as well.  You also need header files and libraries suitable
  6314. for the target machine that you can install on the host machine.
  6315.  
  6316. * Menu:
  6317.  
  6318. * Steps of Cross::      Using a cross-compiler involves several steps
  6319.                           that may be carried out on different machines.
  6320. * Configure Cross::     Configuring a cross-compiler.
  6321. * Tools and Libraries:: Where to put the linker and assembler, and the C library.
  6322. * Cross Headers::       Finding and installing header files
  6323.                           for a cross-compiler.
  6324. * Cross Runtime::       Supplying arithmetic runtime routines (`libgcc1.a').
  6325. * Build Cross::         Actually compiling the cross-compiler.
  6326.  
  6327. 
  6328. File: use,  Node: Steps of Cross,  Next: Configure Cross,  Up: Cross-Compiler
  6329.  
  6330. Steps of Cross-Compilation
  6331. --------------------------
  6332.  
  6333.    To compile and run a program using a cross-compiler involves several
  6334. steps:
  6335.  
  6336.    * Run the cross-compiler on the host machine to produce assembler
  6337.      files for the target machine.  This requires header files for the
  6338.      target machine.
  6339.  
  6340.    * Assemble the files produced by the cross-compiler.  You can do this
  6341.      either with an assembler on the target machine, or with a
  6342.      cross-assembler on the host machine.
  6343.  
  6344.    * Link those files to make an executable.  You can do this either
  6345.      with a linker on the target machine, or with a cross-linker on the
  6346.      host machine.  Whichever machine you use, you need libraries and
  6347.      certain startup files (typically `crt....o') for the target
  6348.      machine.
  6349.  
  6350.    It is most convenient to do all of these steps on the same host
  6351. machine, since then you can do it all with a single invocation of GNU
  6352. CC.  This requires a suitable cross-assembler and cross-linker.  For
  6353. some targets, the GNU assembler and linker are available.
  6354.  
  6355. 
  6356. File: use,  Node: Configure Cross,  Next: Tools and Libraries,  Prev: Steps of Cross,  Up: Cross-Compiler
  6357.  
  6358. Configuring a Cross-Compiler
  6359. ----------------------------
  6360.  
  6361.    To build GNU CC as a cross-compiler, you start out by running
  6362. `configure'.  Use the `--target=TARGET' to specify the target type.  If
  6363. `configure' was unable to correctly identify the system you are running
  6364. on, also specify the `--build=BUILD' option.  For example, here is how
  6365. to configure for a cross-compiler that produces code for an HP 68030
  6366. system running BSD on a system that `configure' can correctly identify:
  6367.  
  6368.      ./configure --target=m68k-hp-bsd4.3
  6369.  
  6370. 
  6371. File: use,  Node: Tools and Libraries,  Next: Cross Headers,  Prev: Configure Cross,  Up: Cross-Compiler
  6372.  
  6373. Tools and Libraries for a Cross-Compiler
  6374. ----------------------------------------
  6375.  
  6376.    If you have a cross-assembler and cross-linker available, you should
  6377. install them now.  Put them in the directory `/usr/local/TARGET/bin'.
  6378. Here is a table of the tools you should put in this directory:
  6379.  
  6380. `as'
  6381.      This should be the cross-assembler.
  6382.  
  6383. `ld'
  6384.      This should be the cross-linker.
  6385.  
  6386. `ar'
  6387.      This should be the cross-archiver: a program which can manipulate
  6388.      archive files (linker libraries) in the target machine's format.
  6389.  
  6390. `ranlib'
  6391.      This should be a program to construct a symbol table in an archive
  6392.      file.
  6393.  
  6394.    The installation of GNU CC will find these programs in that
  6395. directory, and copy or link them to the proper place to for the
  6396. cross-compiler to find them when run later.
  6397.  
  6398.    The easiest way to provide these files is to build the Binutils
  6399. package and GAS.  Configure them with the same `--host' and `--target'
  6400. options that you use for configuring GNU CC, then build and install
  6401. them.  They install their executables automatically into the proper
  6402. directory.  Alas, they do not support all the targets that GNU CC
  6403. supports.
  6404.  
  6405.    If you want to install libraries to use with the cross-compiler,
  6406. such as a standard C library, put them in the directory
  6407. `/usr/local/TARGET/lib'; installation of GNU CC copies all all the
  6408. files in that subdirectory into the proper place for GNU CC to find
  6409. them and link with them.  Here's an example of copying some libraries
  6410. from a target machine:
  6411.  
  6412.      ftp TARGET-MACHINE
  6413.      lcd /usr/local/TARGET/lib
  6414.      cd /lib
  6415.      get libc.a
  6416.      cd /usr/lib
  6417.      get libg.a
  6418.      get libm.a
  6419.      quit
  6420.  
  6421. The precise set of libraries you'll need, and their locations on the
  6422. target machine, vary depending on its operating system.
  6423.  
  6424.    Many targets require "start files" such as `crt0.o' and `crtn.o'
  6425. which are linked into each executable; these too should be placed in
  6426. `/usr/local/TARGET/lib'.  There may be several alternatives for
  6427. `crt0.o', for use with profiling or other compilation options.  Check
  6428. your target's definition of `STARTFILE_SPEC' to find out what start
  6429. files it uses.  Here's an example of copying these files from a target
  6430. machine:
  6431.  
  6432.      ftp TARGET-MACHINE
  6433.      lcd /usr/local/TARGET/lib
  6434.      prompt
  6435.      cd /lib
  6436.      mget *crt*.o
  6437.      cd /usr/lib
  6438.      mget *crt*.o
  6439.      quit
  6440.  
  6441. 
  6442. File: use,  Node: Cross Runtime,  Next: Build Cross,  Prev: Cross Headers,  Up: Cross-Compiler
  6443.  
  6444. `libgcc.a' and Cross-Compilers
  6445. ------------------------------
  6446.  
  6447.    Code compiled by GNU CC uses certain runtime support functions
  6448. implicitly.  Some of these functions can be compiled successfully with
  6449. GNU CC itself, but a few cannot be.  These problem functions are in the
  6450. source file `libgcc1.c'; the library made from them is called
  6451. `libgcc1.a'.
  6452.  
  6453.    When you build a native compiler, these functions are compiled with
  6454. some other compiler-the one that you use for bootstrapping GNU CC.
  6455. Presumably it knows how to open code these operations, or else knows how
  6456. to call the run-time emulation facilities that the machine comes with.
  6457. But this approach doesn't work for building a cross-compiler.  The
  6458. compiler that you use for building knows about the host system, not the
  6459. target system.
  6460.  
  6461.    So, when you build a cross-compiler you have to supply a suitable
  6462. library `libgcc1.a' that does the job it is expected to do.
  6463.  
  6464.    To compile `libgcc1.c' with the cross-compiler itself does not work.
  6465. The functions in this file are supposed to implement arithmetic
  6466. operations that GNU CC does not know how to open code for your target
  6467. machine.  If these functions are compiled with GNU CC itself, they will
  6468. compile into infinite recursion.
  6469.  
  6470.    On any given target, most of these functions are not needed.  If GNU
  6471. CC can open code an arithmetic operation, it will not call these
  6472. functions to perform the operation.  It is possible that on your target
  6473. machine, none of these functions is needed.  If so, you can supply an
  6474. empty library as `libgcc1.a'.
  6475.  
  6476.    Many targets need library support only for multiplication and
  6477. division.  If you are linking with a library that contains functions for
  6478. multiplication and division, you can tell GNU CC to call them directly
  6479. by defining the macros `MULSI3_LIBCALL', and the like.  These macros
  6480. need to be defined in the target description macro file.  For some
  6481. targets, they are defined already.  This may be sufficient to avoid the
  6482. need for libgcc1.a; if so, you can supply an empty library.
  6483.  
  6484.    Some targets do not have floating point instructions; they need other
  6485. functions in `libgcc1.a', which do floating arithmetic.  Recent
  6486. versions of GNU CC have a file which emulates floating point.  With a
  6487. certain amount of work, you should be able to construct a floating
  6488. point emulator that can be used as `libgcc1.a'.  Perhaps future
  6489. versions will contain code to do this automatically and conveniently.
  6490. That depends on whether someone wants to implement it.
  6491.  
  6492.    Some embedded targets come with all the necessary `libgcc1.a'
  6493. routines written in C or assembler.  These targets build `libgcc1.a'
  6494. automatically and you do not need to do anything special for them.
  6495. Other embedded targets do not need any `libgcc1.a' routines since all
  6496. the necessary operations are supported by the hardware.
  6497.  
  6498.    If your target system has another C compiler, you can configure GNU
  6499. CC as a native compiler on that machine, build just `libgcc1.a' with
  6500. `make libgcc1.a' on that machine, and use the resulting file with the
  6501. cross-compiler.  To do this, execute the following on the target
  6502. machine:
  6503.  
  6504.      cd TARGET-BUILD-DIR
  6505.      ./configure --host=sparc --target=sun3
  6506.      make libgcc1.a
  6507.  
  6508. And then this on the host machine:
  6509.  
  6510.      ftp TARGET-MACHINE
  6511.      binary
  6512.      cd TARGET-BUILD-DIR
  6513.      get libgcc1.a
  6514.      quit
  6515.  
  6516.    Another way to provide the functions you need in `libgcc1.a' is to
  6517. define the appropriate `perform_...' macros for those functions.  If
  6518. these definitions do not use the C arithmetic operators that they are
  6519. meant to implement, you should be able to compile them with the
  6520. cross-compiler you are building.  (If these definitions already exist
  6521. for your target file, then you are all set.)
  6522.  
  6523.    To build `libgcc1.a' using the perform macros, use
  6524. `LIBGCC1=libgcc1.a OLDCC=./xgcc' when building the compiler.
  6525. Otherwise, you should place your replacement library under the name
  6526. `libgcc1.a' in the directory in which you will build the
  6527. cross-compiler, before you run `make'.
  6528.  
  6529. 
  6530. File: use,  Node: Cross Headers,  Next: Cross Runtime,  Prev: Tools and Libraries,  Up: Cross-Compiler
  6531.  
  6532. Cross-Compilers and Header Files
  6533. --------------------------------
  6534.  
  6535.    If you are cross-compiling a standalone program or a program for an
  6536. embedded system, then you may not need any header files except the few
  6537. that are part of GNU CC (and those of your program).  However, if you
  6538. intend to link your program with a standard C library such as `libc.a',
  6539. then you probably need to compile with the header files that go with
  6540. the library you use.
  6541.  
  6542.    The GNU C compiler does not come with these files, because (1) they
  6543. are system-specific, and (2) they belong in a C library, not in a
  6544. compiler.
  6545.  
  6546.    If the GNU C library supports your target machine, then you can get
  6547. the header files from there (assuming you actually use the GNU library
  6548. when you link your program).
  6549.  
  6550.    If your target machine comes with a C compiler, it probably comes
  6551. with suitable header files also.  If you make these files accessible
  6552. from the host machine, the cross-compiler can use them also.
  6553.  
  6554.    Otherwise, you're on your own in finding header files to use when
  6555. cross-compiling.
  6556.  
  6557.    When you have found suitable header files, put them in
  6558. `/usr/local/TARGET/include', before building the cross compiler.  Then
  6559. installation will run fixincludes properly and install the corrected
  6560. versions of the header files where the compiler will use them.
  6561.  
  6562.    Provide the header files before you build the cross-compiler, because
  6563. the build stage actually runs the cross-compiler to produce parts of
  6564. `libgcc.a'.  (These are the parts that *can* be compiled with GNU CC.)
  6565. Some of them need suitable header files.
  6566.  
  6567.    Here's an example showing how to copy the header files from a target
  6568. machine.  On the target machine, do this:
  6569.  
  6570.      (cd /usr/include; tar cf - .) > tarfile
  6571.  
  6572.    Then, on the host machine, do this:
  6573.  
  6574.      ftp TARGET-MACHINE
  6575.      lcd /usr/local/TARGET/include
  6576.      get tarfile
  6577.      quit
  6578.      tar xf tarfile
  6579.  
  6580. 
  6581. File: use,  Node: Build Cross,  Prev: Cross Runtime,  Up: Cross-Compiler
  6582.  
  6583. Actually Building the Cross-Compiler
  6584. ------------------------------------
  6585.  
  6586.    Now you can proceed just as for compiling a single-machine compiler
  6587. through the step of building stage 1.  If you have not provided some
  6588. sort of `libgcc1.a', then compilation will give up at the point where
  6589. it needs that file, printing a suitable error message.  If you do
  6590. provide `libgcc1.a', then building the compiler will automatically
  6591. compile and link a test program called `libgcc1-test'; if you get
  6592. errors in the linking, it means that not all of the necessary routines
  6593. in `libgcc1.a' are available.
  6594.  
  6595.    You must provide the header file `float.h'.  One way to do this is
  6596. to compile `enquire' and run it on your target machine.  The job of
  6597. `enquire' is to run on the target machine and figure out by experiment
  6598. the nature of its floating point representation.  `enquire' records its
  6599. findings in the header file `float.h'.  If you can't produce this file
  6600. by running `enquire' on the target machine, then you will need to come
  6601. up with a suitable `float.h' in some other way (or else, avoid using it
  6602. in your programs).
  6603.  
  6604.    Do not try to build stage 2 for a cross-compiler.  It doesn't work to
  6605. rebuild GNU CC as a cross-compiler using the cross-compiler, because
  6606. that would produce a program that runs on the target machine, not on the
  6607. host.  For example, if you compile a 386-to-68030 cross-compiler with
  6608. itself, the result will not be right either for the 386 (because it was
  6609. compiled into 68030 code) or for the 68030 (because it was configured
  6610. for a 386 as the host).  If you want to compile GNU CC into 68030 code,
  6611. whether you compile it on a 68030 or with a cross-compiler on a 386, you
  6612. must specify a 68030 as the host when you configure it.
  6613.  
  6614.    To install the cross-compiler, use `make install', as usual.
  6615.  
  6616. 
  6617. File: use,  Node: Sun Install,  Next: VMS Install,  Prev: Cross-Compiler,  Up: Installation
  6618.  
  6619. Installing GNU CC on the Sun
  6620. ============================
  6621.  
  6622.    On Solaris (version 2.1), do not use the linker or other tools in
  6623. `/usr/ucb' to build GNU CC.  Use `/usr/ccs/bin'.
  6624.  
  6625.    Make sure the environment variable `FLOAT_OPTION' is not set when
  6626. you compile `libgcc.a'.  If this option were set to `f68881' when
  6627. `libgcc.a' is compiled, the resulting code would demand to be linked
  6628. with a special startup file and would not link properly without special
  6629. pains.
  6630.  
  6631.    There is a bug in `alloca' in certain versions of the Sun library.
  6632. To avoid this bug, install the binaries of GNU CC that were compiled by
  6633. GNU CC.  They use `alloca' as a built-in function and never the one in
  6634. the library.
  6635.  
  6636.    Some versions of the Sun compiler crash when compiling GNU CC.  The
  6637. problem is a segmentation fault in cpp.  This problem seems to be due to
  6638. the bulk of data in the environment variables.  You may be able to avoid
  6639. it by using the following command to compile GNU CC with Sun CC:
  6640.  
  6641.      make CC="TERMCAP=x OBJS=x LIBFUNCS=x STAGESTUFF=x cc"
  6642.  
  6643. 
  6644. File: use,  Node: VMS Install,  Next: Collect2,  Prev: Sun Install,  Up: Installation
  6645.  
  6646. Installing GNU CC on VMS
  6647. ========================
  6648.  
  6649.    The VMS version of GNU CC is distributed in a backup saveset
  6650. containing both source code and precompiled binaries.
  6651.  
  6652.    To install the `gcc' command so you can use the compiler easily, in
  6653. the same manner as you use the VMS C compiler, you must install the VMS
  6654. CLD file for GNU CC as follows:
  6655.  
  6656.   1. Define the VMS logical names `GNU_CC' and `GNU_CC_INCLUDE' to
  6657.      point to the directories where the GNU CC executables
  6658.      (`gcc-cpp.exe', `gcc-cc1.exe', etc.) and the C include files are
  6659.      kept respectively.  This should be done with the commands:
  6660.  
  6661.           $ assign /system /translation=concealed -
  6662.             disk:[gcc.] gnu_cc
  6663.           $ assign /system /translation=concealed -
  6664.             disk:[gcc.include.] gnu_cc_include
  6665.  
  6666.      with the appropriate disk and directory names.  These commands can
  6667.      be placed in your system startup file so they will be executed
  6668.      whenever the machine is rebooted.  You may, if you choose, do this
  6669.      via the `GCC_INSTALL.COM' script in the `[GCC]' directory.
  6670.  
  6671.   2. Install the `GCC' command with the command line:
  6672.  
  6673.           $ set command /table=sys$common:[syslib]dcltables -
  6674.             /output=sys$common:[syslib]dcltables gnu_cc:[000000]gcc
  6675.           $ install replace sys$common:[syslib]dcltables
  6676.  
  6677.   3. To install the help file, do the following:
  6678.  
  6679.           $ library/help sys$library:helplib.hlb gcc.hlp
  6680.  
  6681.      Now you can invoke the compiler with a command like `gcc /verbose
  6682.      file.c', which is equivalent to the command `gcc -v -c file.c' in
  6683.      Unix.
  6684.  
  6685.    If you wish to use GNU C++ you must first install GNU CC, and then
  6686. perform the following steps:
  6687.  
  6688.   1. Define the VMS logical name `GNU_GXX_INCLUDE' to point to the
  6689.      directory where the preprocessor will search for the C++ header
  6690.      files.  This can be done with the command:
  6691.  
  6692.           $ assign /system /translation=concealed -
  6693.             disk:[gcc.gxx_include.] gnu_gxx_include
  6694.  
  6695.      with the appropriate disk and directory name.  If you are going to
  6696.      be using libg++, this is where the libg++ install procedure will
  6697.      install the libg++ header files.
  6698.  
  6699.   2. Obtain the file `gcc-cc1plus.exe', and place this in the same
  6700.      directory that `gcc-cc1.exe' is kept.
  6701.  
  6702.      The GNU C++ compiler can be invoked with a command like `gcc /plus
  6703.      /verbose file.cc', which is equivalent to the command `g++ -v -c
  6704.      file.cc' in Unix.
  6705.  
  6706.    We try to put corresponding binaries and sources on the VMS
  6707. distribution tape.  But sometimes the binaries will be from an older
  6708. version than the sources, because we don't always have time to update
  6709. them.  (Use the `/version' option to determine the version number of
  6710. the binaries and compare it with the source file `version.c' to tell
  6711. whether this is so.)  In this case, you should use the binaries you get
  6712. to recompile the sources.  If you must recompile, here is how:
  6713.  
  6714.   1. Execute the command procedure `vmsconfig.com' to set up the files
  6715.      `tm.h', `config.h', `aux-output.c', and `md.', and to create files
  6716.      `tconfig.h' and `hconfig.h'.  This procedure also creates several
  6717.      linker option files used by `make-cc1.com' and a data file used by
  6718.      `make-l2.com'.
  6719.  
  6720.           $ @vmsconfig.com
  6721.  
  6722.   2. Setup the logical names and command tables as defined above.  In
  6723.      addition, define the VMS logical name `GNU_BISON' to point at the
  6724.      to the directories where the Bison executable is kept.  This
  6725.      should be done with the command:
  6726.  
  6727.           $ assign /system /translation=concealed -
  6728.             disk:[bison.] gnu_bison
  6729.  
  6730.      You may, if you choose, use the `INSTALL_BISON.COM' script in the
  6731.      `[BISON]' directory.
  6732.  
  6733.   3. Install the `BISON' command with the command line:
  6734.  
  6735.           $ set command /table=sys$common:[syslib]dcltables -
  6736.             /output=sys$common:[syslib]dcltables -
  6737.             gnu_bison:[000000]bison
  6738.           $ install replace sys$common:[syslib]dcltables
  6739.  
  6740.   4. Type `@make-gcc' to recompile everything (alternatively, submit
  6741.      the file `make-gcc.com' to a batch queue).  If you wish to build
  6742.      the GNU C++ compiler as well as the GNU CC compiler, you must
  6743.      first edit `make-gcc.com' and follow the instructions that appear
  6744.      in the comments.
  6745.  
  6746.   5. In order to use GCC, you need a library of functions which GCC
  6747.      compiled code will call to perform certain tasks, and these
  6748.      functions are defined in the file `libgcc2.c'.  To compile this
  6749.      you should use the command procedure `make-l2.com', which will
  6750.      generate the library `libgcc2.olb'.  `libgcc2.olb' should be built
  6751.      using the compiler built from the same distribution that
  6752.      `libgcc2.c' came from, and `make-gcc.com' will automatically do
  6753.      all of this for you.
  6754.  
  6755.      To install the library, use the following commands:
  6756.  
  6757.           $ library gnu_cc:[000000]gcclib/delete=(new,eprintf)
  6758.           $ library gnu_cc:[000000]gcclib/delete=L_*
  6759.           $ library libgcc2/extract=*/output=libgcc2.obj
  6760.           $ library gnu_cc:[000000]gcclib libgcc2.obj
  6761.  
  6762.      The first command simply removes old modules that will be replaced
  6763.      with modules from `libgcc2' under different module names.  The
  6764.      modules `new' and `eprintf' may not actually be present in your
  6765.      `gcclib.olb'--if the VMS librarian complains about those modules
  6766.      not being present, simply ignore the message and continue on with
  6767.      the next command.  The second command removes the modules that
  6768.      came from the previous version of the library `libgcc2.c'.
  6769.  
  6770.      Whenever you update the compiler on your system, you should also
  6771.      update the library with the above procedure.
  6772.  
  6773.   6. You may wish to build GCC in such a way that no files are written
  6774.      to the directory where the source files reside.  An example would
  6775.      be the when the source files are on a read-only disk.  In these
  6776.      cases, execute the following DCL commands (substituting your
  6777.      actual path names):
  6778.  
  6779.           $ assign dua0:[gcc.build_dir.]/translation=concealed, -
  6780.                    dua1:[gcc.source_dir.]/translation=concealed  gcc_build
  6781.           $ set default gcc_build:[000000]
  6782.  
  6783.      where the directory `dua1:[gcc.source_dir]' contains the source
  6784.      code, and the directory `dua0:[gcc.build_dir]' is meant to contain
  6785.      all of the generated object files and executables.  Once you have
  6786.      done this, you can proceed building GCC as described above.  (Keep
  6787.      in mind that `gcc_build' is a rooted logical name, and thus the
  6788.      device names in each element of the search list must be an actual
  6789.      physical device name rather than another rooted logical name).
  6790.  
  6791.   7. *If you are building GNU CC with a previous version of GNU CC, you
  6792.      also should check to see that you have the newest version of the
  6793.      assembler*.  In particular, GNU CC version 2 treats global constant
  6794.      variables slightly differently from GNU CC version 1, and GAS
  6795.      version 1.38.1 does not have the patches required to work with GCC
  6796.      version 2.  If you use GAS 1.38.1, then `extern const' variables
  6797.      will not have the read-only bit set, and the linker will generate
  6798.      warning messages about mismatched psect attributes for these
  6799.      variables.  These warning messages are merely a nuisance, and can
  6800.      safely be ignored.
  6801.  
  6802.      If you are compiling with a version of GNU CC older than 1.33,
  6803.      specify `/DEFINE=("inline=")' as an option in all the
  6804.      compilations.  This requires editing all the `gcc' commands in
  6805.      `make-cc1.com'.  (The older versions had problems supporting
  6806.      `inline'.)  Once you have a working 1.33 or newer GNU CC, you can
  6807.      change this file back.
  6808.  
  6809.   8. If you want to build GNU CC with the VAX C compiler, you will need
  6810.      to make minor changes in `make-cccp.com' and `make-cc1.com' to
  6811.      choose alternate definitions of `CC', `CFLAGS', and `LIBS'.  See
  6812.      comments in those files.  However, you must also have a working
  6813.      version of the GNU assembler (GNU as, aka GAS) as it is used as
  6814.      the back-end for GNU CC to produce binary object modules and is
  6815.      not included in the GNU CC sources.  GAS is also needed to compile
  6816.      `libgcc2' in order to build `gcclib' (see above); `make-l2.com'
  6817.      expects to be able to find it operational in
  6818.      `gnu_cc:[000000]gnu-as.exe'.
  6819.  
  6820.      To use GNU CC on VMS, you need the VMS driver programs `gcc.exe',
  6821.      `gcc.com', and `gcc.cld'.  They are distributed with the VMS
  6822.      binaries (`gcc-vms') rather than the GNU CC sources.  GAS is also
  6823.      included in `gcc-vms', as is Bison.
  6824.  
  6825.      Once you have successfully built GNU CC with VAX C, you should use
  6826.      the resulting compiler to rebuild itself.  Before doing this, be
  6827.      sure to restore the `CC', `CFLAGS', and `LIBS' definitions in
  6828.      `make-cccp.com' and `make-cc1.com'.  The second generation
  6829.      compiler will be able to take advantage of many optimizations that
  6830.      must be suppressed when building with other compilers.
  6831.  
  6832.    Under previous versions of GNU CC, the generated code would
  6833. occasionally give strange results when linked with the sharable
  6834. `VAXCRTL' library.  Now this should work.
  6835.  
  6836.    Even with this version, however, GNU CC itself should not be linked
  6837. with the sharable `VAXCRTL'.  The version of `qsort' in `VAXCRTL' has a
  6838. bug (known to be present in VMS versions V4.6 through V5.5) which
  6839. causes the compiler to fail.
  6840.  
  6841.    The executables are generated by `make-cc1.com' and `make-cccp.com'
  6842. use the object library version of `VAXCRTL' in order to make use of the
  6843. `qsort' routine in `gcclib.olb'.  If you wish to link the compiler
  6844. executables with the shareable image version of `VAXCRTL', you should
  6845. edit the file `tm.h' (created by `vmsconfig.com') to define the macro
  6846. `QSORT_WORKAROUND'.
  6847.  
  6848.    `QSORT_WORKAROUND' is always defined when GNU CC is compiled with
  6849. VAX C, to avoid a problem in case `gcclib.olb' is not yet available.
  6850.  
  6851. 
  6852. File: use,  Node: Collect2,  Next: Header Dirs,  Prev: VMS Install,  Up: Installation
  6853.  
  6854. `collect2'
  6855. ==========
  6856.  
  6857.    Many target systems do not have support in the assembler and linker
  6858. for "constructors"--initialization functions to be called before the
  6859. official "start" of `main'.  On such systems, GNU CC uses a utility
  6860. called `collect2' to arrange to call these functions at start time.
  6861.  
  6862.    The program `collect2' works by linking the program once and looking
  6863. through the linker output file for symbols with particular names
  6864. indicating they are constructor functions.  If it finds any, it creates
  6865. a new temporary `.c' file containing a table of them, compiles it, and
  6866. links the program a second time including that file.
  6867.  
  6868.    The actual calls to the constructors are carried out by a subroutine
  6869. called `__main', which is called (automatically) at the beginning of
  6870. the body of `main' (provided `main' was compiled with GNU CC).  Calling
  6871. `__main' is necessary, even when compiling C code, to allow linking C
  6872. and C++ object code together.  (If you use `-nostdlib', you get an
  6873. unresolved reference to `__main', since it's defined in the standard
  6874. GCC library.  Include `-lgcc' at the end of your compiler command line
  6875. to resolve this reference.)
  6876.  
  6877.    The program `collect2' is installed as `ld' in the directory where
  6878. the passes of the compiler are installed.  When `collect2' needs to
  6879. find the *real* `ld', it tries the following file names:
  6880.  
  6881.    * `real-ld' in the directories listed in the compiler's search
  6882.      directories.
  6883.  
  6884.    * `real-ld' in the directories listed in the environment variable
  6885.      `PATH'.
  6886.  
  6887.    * The file specified in the `REAL_LD_FILE_NAME' configuration macro,
  6888.      if specified.
  6889.  
  6890.    * `ld' in the compiler's search directories, except that `collect2'
  6891.      will not execute itself recursively.
  6892.  
  6893.    * `ld' in `PATH'.
  6894.  
  6895.    "The compiler's search directories" means all the directories where
  6896. `gcc' searches for passes of the compiler.  This includes directories
  6897. that you specify with `-B'.
  6898.  
  6899.    Cross-compilers search a little differently:
  6900.  
  6901.    * `real-ld' in the compiler's search directories.
  6902.  
  6903.    * `TARGET-real-ld' in `PATH'.
  6904.  
  6905.    * The file specified in the `REAL_LD_FILE_NAME' configuration macro,
  6906.      if specified.
  6907.  
  6908.    * `ld' in the compiler's search directories.
  6909.  
  6910.    * `TARGET-ld' in `PATH'.
  6911.  
  6912.    `collect2' explicitly avoids running `ld' using the file name under
  6913. which `collect2' itself was invoked.  In fact, it remembers up a list
  6914. of such names--in case one copy of `collect2' finds another copy (or
  6915. version) of `collect2' installed as `ld' in a second place in the
  6916. search path.
  6917.  
  6918.    `collect2' searches for the utilities `nm' and `strip' using the
  6919. same algorithm as above for `ld'.
  6920.  
  6921. 
  6922. File: use,  Node: Header Dirs,  Prev: Collect2,  Up: Installation
  6923.  
  6924. Standard Header File Directories
  6925. ================================
  6926.  
  6927.    `GCC_INCLUDE_DIR' means the same thing for native and cross.  It is
  6928. where GNU CC stores its private include files, and also where GNU CC
  6929. stores the fixed include files.  A cross compiled GNU CC runs
  6930. `fixincludes' on the header files in `$(tooldir)/include'.  (If the
  6931. cross compilation header files need to be fixed, they must be installed
  6932. before GNU CC is built.  If the cross compilation header files are
  6933. already suitable for ANSI C and GNU CC, nothing special need be done).
  6934.  
  6935.    `GPLUS_INCLUDE_DIR' means the same thing for native and cross.  It
  6936. is where `g++' looks first for header files.  `libg++' installs only
  6937. target independent header files in that directory.
  6938.  
  6939.    `LOCAL_INCLUDE_DIR' is used only for a native compiler.  It is
  6940. normally `/usr/local/include'.  GNU CC searches this directory so that
  6941. users can install header files in `/usr/local/include'.
  6942.  
  6943.    `CROSS_INCLUDE_DIR' is used only for a cross compiler.  GNU CC
  6944. doesn't install anything there.
  6945.  
  6946.    `TOOL_INCLUDE_DIR' is used for both native and cross compilers.  It
  6947. is the place for other packages to install header files that GNU CC will
  6948. use.  For a cross-compiler, this is the equivalent of `/usr/include'.
  6949. When you build a cross-compiler, `fixincludes' processes any header
  6950. files in this directory.
  6951.  
  6952. 
  6953. File: use,  Node: C Extensions,  Next: C++ Extensions,  Prev: Installation,  Up: Top
  6954.  
  6955. Extensions to the C Language Family
  6956. ***********************************
  6957.  
  6958.    GNU C provides several language features not found in ANSI standard
  6959. C.  (The `-pedantic' option directs GNU CC to print a warning message if
  6960. any of these features is used.)  To test for the availability of these
  6961. features in conditional compilation, check for a predefined macro
  6962. `__GNUC__', which is always defined under GNU CC.
  6963.  
  6964.    These extensions are available in C and Objective C.  Most of them
  6965. are also available in C++.  *Note Extensions to the C++ Language: C++
  6966. Extensions, for extensions that apply *only* to C++.
  6967.  
  6968. * Menu:
  6969.  
  6970. * Statement Exprs::     Putting statements and declarations inside expressions.
  6971. * Local Labels::        Labels local to a statement-expression.
  6972. * Labels as Values::    Getting pointers to labels, and computed gotos.
  6973. * Nested Functions::    As in Algol and Pascal, lexical scoping of functions.
  6974. * Constructing Calls::    Dispatching a call to another function.
  6975. * Naming Types::        Giving a name to the type of some expression.
  6976. * Typeof::              `typeof': referring to the type of an expression.
  6977. * Lvalues::             Using `?:', `,' and casts in lvalues.
  6978. * Conditionals::        Omitting the middle operand of a `?:' expression.
  6979. * Long Long::        Double-word integers--`long long int'.
  6980. * Complex::             Data types for complex numbers.
  6981. * Zero Length::         Zero-length arrays.
  6982. * Variable Length::     Arrays whose length is computed at run time.
  6983. * Macro Varargs::    Macros with variable number of arguments.
  6984. * Subscripting::        Any array can be subscripted, even if not an lvalue.
  6985. * Pointer Arith::       Arithmetic on `void'-pointers and function pointers.
  6986. * Initializers::        Non-constant initializers.
  6987. * Constructors::        Constructor expressions give structures, unions
  6988.                          or arrays as values.
  6989. * Labeled Elements::    Labeling elements of initializers.
  6990. * Cast to Union::       Casting to union type from any member of the union.
  6991. * Case Ranges::        `case 1 ... 9' and such.
  6992. * Function Attributes:: Declaring that functions have no side effects,
  6993.                          or that they can never return.
  6994. * Function Prototypes:: Prototype declarations and old-style definitions.
  6995. * Dollar Signs::        Dollar sign is allowed in identifiers.
  6996. * Character Escapes::   `\e' stands for the character ESC.
  6997. * Variable Attributes::    Specifying attributes of variables.
  6998. * Type Attributes::    Specifying attributes of types.
  6999. * Alignment::           Inquiring about the alignment of a type or variable.
  7000. * Inline::              Defining inline functions (as fast as macros).
  7001. * Extended Asm::        Assembler instructions with C expressions as operands.
  7002.                          (With them you can define "built-in" functions.)
  7003. * Constraints::         Constraints for asm operands
  7004. * Asm Labels::          Specifying the assembler name to use for a C symbol.
  7005. * Explicit Reg Vars::   Defining variables residing in specified registers.
  7006. * Alternate Keywords::  `__const__', `__asm__', etc., for header files.
  7007. * Incomplete Enums::    `enum foo;', with details to follow.
  7008. * Function Names::    Printable strings which are the name of the current
  7009.              function.
  7010.  
  7011. 
  7012. File: use,  Node: Statement Exprs,  Next: Local Labels,  Up: C Extensions
  7013.  
  7014. Statements and Declarations in Expressions
  7015. ==========================================
  7016.  
  7017.    A compound statement enclosed in parentheses may appear as an
  7018. expression in GNU C.  This allows you to use loops, switches, and local
  7019. variables within an expression.
  7020.  
  7021.    Recall that a compound statement is a sequence of statements
  7022. surrounded by braces; in this construct, parentheses go around the
  7023. braces.  For example:
  7024.  
  7025.      ({ int y = foo (); int z;
  7026.         if (y > 0) z = y;
  7027.         else z = - y;
  7028.         z; })
  7029.  
  7030. is a valid (though slightly more complex than necessary) expression for
  7031. the absolute value of `foo ()'.
  7032.  
  7033.    The last thing in the compound statement should be an expression
  7034. followed by a semicolon; the value of this subexpression serves as the
  7035. value of the entire construct.  (If you use some other kind of statement
  7036. last within the braces, the construct has type `void', and thus
  7037. effectively no value.)
  7038.  
  7039.    This feature is especially useful in making macro definitions "safe"
  7040. (so that they evaluate each operand exactly once).  For example, the
  7041. "maximum" function is commonly defined as a macro in standard C as
  7042. follows:
  7043.  
  7044.      #define max(a,b) ((a) > (b) ? (a) : (b))
  7045.  
  7046. But this definition computes either A or B twice, with bad results if
  7047. the operand has side effects.  In GNU C, if you know the type of the
  7048. operands (here let's assume `int'), you can define the macro safely as
  7049. follows:
  7050.  
  7051.      #define maxint(a,b) \
  7052.        ({int _a = (a), _b = (b); _a > _b ? _a : _b; })
  7053.  
  7054.    Embedded statements are not allowed in constant expressions, such as
  7055. the value of an enumeration constant, the width of a bit field, or the
  7056. initial value of a static variable.
  7057.  
  7058.    If you don't know the type of the operand, you can still do this,
  7059. but you must use `typeof' (*note Typeof::.) or type naming (*note
  7060. Naming Types::.).
  7061.  
  7062. 
  7063. File: use,  Node: Local Labels,  Next: Labels as Values,  Prev: Statement Exprs,  Up: C Extensions
  7064.  
  7065. Locally Declared Labels
  7066. =======================
  7067.  
  7068.    Each statement expression is a scope in which "local labels" can be
  7069. declared.  A local label is simply an identifier; you can jump to it
  7070. with an ordinary `goto' statement, but only from within the statement
  7071. expression it belongs to.
  7072.  
  7073.    A local label declaration looks like this:
  7074.  
  7075.      __label__ LABEL;
  7076.  
  7077. or
  7078.  
  7079.      __label__ LABEL1, LABEL2, ...;
  7080.  
  7081.    Local label declarations must come at the beginning of the statement
  7082. expression, right after the `({', before any ordinary declarations.
  7083.  
  7084.    The label declaration defines the label *name*, but does not define
  7085. the label itself.  You must do this in the usual way, with `LABEL:',
  7086. within the statements of the statement expression.
  7087.  
  7088.    The local label feature is useful because statement expressions are
  7089. often used in macros.  If the macro contains nested loops, a `goto' can
  7090. be useful for breaking out of them.  However, an ordinary label whose
  7091. scope is the whole function cannot be used: if the macro can be
  7092. expanded several times in one function, the label will be multiply
  7093. defined in that function.  A local label avoids this problem.  For
  7094. example:
  7095.  
  7096.      #define SEARCH(array, target)                     \
  7097.      ({                                               \
  7098.        __label__ found;                                \
  7099.        typeof (target) _SEARCH_target = (target);      \
  7100.        typeof (*(array)) *_SEARCH_array = (array);     \
  7101.        int i, j;                                       \
  7102.        int value;                                      \
  7103.        for (i = 0; i < max; i++)                       \
  7104.          for (j = 0; j < max; j++)                     \
  7105.            if (_SEARCH_array[i][j] == _SEARCH_target)  \
  7106.              { value = i; goto found; }              \
  7107.        value = -1;                                     \
  7108.       found:                                           \
  7109.        value;                                          \
  7110.      })
  7111.  
  7112. 
  7113. File: use,  Node: Labels as Values,  Next: Nested Functions,  Prev: Local Labels,  Up: C Extensions
  7114.  
  7115. Labels as Values
  7116. ================
  7117.  
  7118.    You can get the address of a label defined in the current function
  7119. (or a containing function) with the unary operator `&&'.  The value has
  7120. type `void *'.  This value is a constant and can be used wherever a
  7121. constant of that type is valid.  For example:
  7122.  
  7123.      void *ptr;
  7124.      ...
  7125.      ptr = &&foo;
  7126.  
  7127.    To use these values, you need to be able to jump to one.  This is
  7128. done with the computed goto statement(1), `goto *EXP;'.  For example,
  7129.  
  7130.      goto *ptr;
  7131.  
  7132. Any expression of type `void *' is allowed.
  7133.  
  7134.    One way of using these constants is in initializing a static array
  7135. that will serve as a jump table:
  7136.  
  7137.      static void *array[] = { &&foo, &&bar, &&hack };
  7138.  
  7139.    Then you can select a label with indexing, like this:
  7140.  
  7141.      goto *array[i];
  7142.  
  7143. Note that this does not check whether the subscript is in bounds--array
  7144. indexing in C never does that.
  7145.  
  7146.    Such an array of label values serves a purpose much like that of the
  7147. `switch' statement.  The `switch' statement is cleaner, so use that
  7148. rather than an array unless the problem does not fit a `switch'
  7149. statement very well.
  7150.  
  7151.    Another use of label values is in an interpreter for threaded code.
  7152. The labels within the interpreter function can be stored in the
  7153. threaded code for super-fast dispatching.
  7154.  
  7155.    You can use this mechanism to jump to code in a different function.
  7156. If you do that, totally unpredictable things will happen.  The best way
  7157. to avoid this is to store the label address only in automatic variables
  7158. and never pass it as an argument.
  7159.  
  7160.    ---------- Footnotes ----------
  7161.  
  7162.    (1)  The analogous feature in Fortran is called an assigned goto,
  7163. but that name seems inappropriate in C, where one can do more than
  7164. simply store label addresses in label variables.
  7165.  
  7166. 
  7167. File: use,  Node: Nested Functions,  Next: Constructing Calls,  Prev: Labels as Values,  Up: C Extensions
  7168.  
  7169. Nested Functions
  7170. ================
  7171.  
  7172.    A "nested function" is a function defined inside another function.
  7173. (Nested functions are not supported for GNU C++.)  The nested function's
  7174. name is local to the block where it is defined.  For example, here we
  7175. define a nested function named `square', and call it twice:
  7176.  
  7177.      foo (double a, double b)
  7178.      {
  7179.        double square (double z) { return z * z; }
  7180.      
  7181.        return square (a) + square (b);
  7182.      }
  7183.  
  7184.    The nested function can access all the variables of the containing
  7185. function that are visible at the point of its definition.  This is
  7186. called "lexical scoping".  For example, here we show a nested function
  7187. which uses an inherited variable named `offset':
  7188.  
  7189.      bar (int *array, int offset, int size)
  7190.      {
  7191.        int access (int *array, int index)
  7192.          { return array[index + offset]; }
  7193.        int i;
  7194.        ...
  7195.        for (i = 0; i < size; i++)
  7196.          ... access (array, i) ...
  7197.      }
  7198.  
  7199.    Nested function definitions are permitted within functions in the
  7200. places where variable definitions are allowed; that is, in any block,
  7201. before the first statement in the block.
  7202.  
  7203.    It is possible to call the nested function from outside the scope of
  7204. its name by storing its address or passing the address to another
  7205. function:
  7206.  
  7207.      hack (int *array, int size)
  7208.      {
  7209.        void store (int index, int value)
  7210.          { array[index] = value; }
  7211.      
  7212.        intermediate (store, size);
  7213.      }
  7214.  
  7215.    Here, the function `intermediate' receives the address of `store' as
  7216. an argument.  If `intermediate' calls `store', the arguments given to
  7217. `store' are used to store into `array'.  But this technique works only
  7218. so long as the containing function (`hack', in this example) does not
  7219. exit.
  7220.  
  7221.    If you try to call the nested function through its address after the
  7222. containing function has exited, all hell will break loose.  If you try
  7223. to call it after a containing scope level has exited, and if it refers
  7224. to some of the variables that are no longer in scope, you may be lucky,
  7225. but it's not wise to take the risk.  If, however, the nested function
  7226. does not refer to anything that has gone out of scope, you should be
  7227. safe.
  7228.  
  7229.    GNU CC implements taking the address of a nested function using a
  7230. technique called "trampolines".  A paper describing them is available
  7231. from `maya.idiap.ch' in directory `pub/tmb', file `usenix88-lexic.ps.Z'.
  7232.  
  7233.    A nested function can jump to a label inherited from a containing
  7234. function, provided the label was explicitly declared in the containing
  7235. function (*note Local Labels::.).  Such a jump returns instantly to the
  7236. containing function, exiting the nested function which did the `goto'
  7237. and any intermediate functions as well.  Here is an example:
  7238.  
  7239.      bar (int *array, int offset, int size)
  7240.      {
  7241.        __label__ failure;
  7242.        int access (int *array, int index)
  7243.          {
  7244.            if (index > size)
  7245.              goto failure;
  7246.            return array[index + offset];
  7247.          }
  7248.        int i;
  7249.        ...
  7250.        for (i = 0; i < size; i++)
  7251.          ... access (array, i) ...
  7252.        ...
  7253.        return 0;
  7254.      
  7255.       /* Control comes here from `access'
  7256.          if it detects an error.  */
  7257.       failure:
  7258.        return -1;
  7259.      }
  7260.  
  7261.    A nested function always has internal linkage.  Declaring one with
  7262. `extern' is erroneous.  If you need to declare the nested function
  7263. before its definition, use `auto' (which is otherwise meaningless for
  7264. function declarations).
  7265.  
  7266.      bar (int *array, int offset, int size)
  7267.      {
  7268.        __label__ failure;
  7269.        auto int access (int *, int);
  7270.        ...
  7271.        int access (int *array, int index)
  7272.          {
  7273.            if (index > size)
  7274.              goto failure;
  7275.            return array[index + offset];
  7276.          }
  7277.        ...
  7278.      }
  7279.  
  7280. 
  7281. File: use,  Node: Constructing Calls,  Next: Naming Types,  Prev: Nested Functions,  Up: C Extensions
  7282.  
  7283. Constructing Function Calls
  7284. ===========================
  7285.  
  7286.    Using the built-in functions described below, you can record the
  7287. arguments a function received, and call another function with the same
  7288. arguments, without knowing the number or types of the arguments.
  7289.  
  7290.    You can also record the return value of that function call, and
  7291. later return that value, without knowing what data type the function
  7292. tried to return (as long as your caller expects that data type).
  7293.  
  7294. `__builtin_apply_args ()'
  7295.      This built-in function returns a pointer of type `void *' to data
  7296.      describing how to perform a call with the same arguments as were
  7297.      passed to the current function.
  7298.  
  7299.      The function saves the arg pointer register, structure value
  7300.      address, and all registers that might be used to pass arguments to
  7301.      a function into a block of memory allocated on the stack.  Then it
  7302.      returns the address of that block.
  7303.  
  7304. `__builtin_apply (FUNCTION, ARGUMENTS, SIZE)'
  7305.      This built-in function invokes FUNCTION (type `void (*)()') with a
  7306.      copy of the parameters described by ARGUMENTS (type `void *') and
  7307.      SIZE (type `int').
  7308.  
  7309.      The value of ARGUMENTS should be the value returned by
  7310.      `__builtin_apply_args'.  The argument SIZE specifies the size of
  7311.      the stack argument data, in bytes.
  7312.  
  7313.      This function returns a pointer of type `void *' to data describing
  7314.      how to return whatever value was returned by FUNCTION.  The data
  7315.      is saved in a block of memory allocated on the stack.
  7316.  
  7317.      It is not always simple to compute the proper value for SIZE.  The
  7318.      value is used by `__builtin_apply' to compute the amount of data
  7319.      that should be pushed on the stack and copied from the incoming
  7320.      argument area.
  7321.  
  7322. `__builtin_return (RESULT)'
  7323.      This built-in function returns the value described by RESULT from
  7324.      the containing function.  You should specify, for RESULT, a value
  7325.      returned by `__builtin_apply'.
  7326.  
  7327. 
  7328. File: use,  Node: Naming Types,  Next: Typeof,  Prev: Constructing Calls,  Up: C Extensions
  7329.  
  7330. Naming an Expression's Type
  7331. ===========================
  7332.  
  7333.    You can give a name to the type of an expression using a `typedef'
  7334. declaration with an initializer.  Here is how to define NAME as a type
  7335. name for the type of EXP:
  7336.  
  7337.      typedef NAME = EXP;
  7338.  
  7339.    This is useful in conjunction with the statements-within-expressions
  7340. feature.  Here is how the two together can be used to define a safe
  7341. "maximum" macro that operates on any arithmetic type:
  7342.  
  7343.      #define max(a,b) \
  7344.        ({typedef _ta = (a), _tb = (b);  \
  7345.          _ta _a = (a); _tb _b = (b);     \
  7346.          _a > _b ? _a : _b; })
  7347.  
  7348.    The reason for using names that start with underscores for the local
  7349. variables is to avoid conflicts with variable names that occur within
  7350. the expressions that are substituted for `a' and `b'.  Eventually we
  7351. hope to design a new form of declaration syntax that allows you to
  7352. declare variables whose scopes start only after their initializers;
  7353. this will be a more reliable way to prevent such conflicts.
  7354.  
  7355. 
  7356. File: use,  Node: Typeof,  Next: Lvalues,  Prev: Naming Types,  Up: C Extensions
  7357.  
  7358. Referring to a Type with `typeof'
  7359. =================================
  7360.  
  7361.    Another way to refer to the type of an expression is with `typeof'.
  7362. The syntax of using of this keyword looks like `sizeof', but the
  7363. construct acts semantically like a type name defined with `typedef'.
  7364.  
  7365.    There are two ways of writing the argument to `typeof': with an
  7366. expression or with a type.  Here is an example with an expression:
  7367.  
  7368.      typeof (x[0](1))
  7369.  
  7370. This assumes that `x' is an array of functions; the type described is
  7371. that of the values of the functions.
  7372.  
  7373.    Here is an example with a typename as the argument:
  7374.  
  7375.      typeof (int *)
  7376.  
  7377. Here the type described is that of pointers to `int'.
  7378.  
  7379.    If you are writing a header file that must work when included in
  7380. ANSI C programs, write `__typeof__' instead of `typeof'.  *Note
  7381. Alternate Keywords::.
  7382.  
  7383.    A `typeof'-construct can be used anywhere a typedef name could be
  7384. used.  For example, you can use it in a declaration, in a cast, or
  7385. inside of `sizeof' or `typeof'.
  7386.  
  7387.    * This declares `y' with the type of what `x' points to.
  7388.  
  7389.           typeof (*x) y;
  7390.  
  7391.    * This declares `y' as an array of such values.
  7392.  
  7393.           typeof (*x) y[4];
  7394.  
  7395.    * This declares `y' as an array of pointers to characters:
  7396.  
  7397.           typeof (typeof (char *)[4]) y;
  7398.  
  7399.      It is equivalent to the following traditional C declaration:
  7400.  
  7401.           char *y[4];
  7402.  
  7403.      To see the meaning of the declaration using `typeof', and why it
  7404.      might be a useful way to write, let's rewrite it with these macros:
  7405.  
  7406.           #define pointer(T)  typeof(T *)
  7407.           #define array(T, N) typeof(T [N])
  7408.  
  7409.      Now the declaration can be rewritten this way:
  7410.  
  7411.           array (pointer (char), 4) y;
  7412.  
  7413.      Thus, `array (pointer (char), 4)' is the type of arrays of 4
  7414.      pointers to `char'.
  7415.  
  7416. 
  7417. File: use,  Node: Lvalues,  Next: Conditionals,  Prev: Typeof,  Up: C Extensions
  7418.  
  7419. Generalized Lvalues
  7420. ===================
  7421.  
  7422.    Compound expressions, conditional expressions and casts are allowed
  7423. as lvalues provided their operands are lvalues.  This means that you
  7424. can take their addresses or store values into them.
  7425.  
  7426.    Standard C++ allows compound expressions and conditional expressions
  7427. as lvalues, and permits casts to reference type, so use of this
  7428. extension is deprecated for C++ code.
  7429.  
  7430.    For example, a compound expression can be assigned, provided the last
  7431. expression in the sequence is an lvalue.  These two expressions are
  7432. equivalent:
  7433.  
  7434.      (a, b) += 5
  7435.      a, (b += 5)
  7436.  
  7437.    Similarly, the address of the compound expression can be taken.
  7438. These two expressions are equivalent:
  7439.  
  7440.      &(a, b)
  7441.      a, &b
  7442.  
  7443.    A conditional expression is a valid lvalue if its type is not void
  7444. and the true and false branches are both valid lvalues.  For example,
  7445. these two expressions are equivalent:
  7446.  
  7447.      (a ? b : c) = 5
  7448.      (a ? b = 5 : (c = 5))
  7449.  
  7450.    A cast is a valid lvalue if its operand is an lvalue.  A simple
  7451. assignment whose left-hand side is a cast works by converting the
  7452. right-hand side first to the specified type, then to the type of the
  7453. inner left-hand side expression.  After this is stored, the value is
  7454. converted back to the specified type to become the value of the
  7455. assignment.  Thus, if `a' has type `char *', the following two
  7456. expressions are equivalent:
  7457.  
  7458.      (int)a = 5
  7459.      (int)(a = (char *)(int)5)
  7460.  
  7461.    An assignment-with-arithmetic operation such as `+=' applied to a
  7462. cast performs the arithmetic using the type resulting from the cast,
  7463. and then continues as in the previous case.  Therefore, these two
  7464. expressions are equivalent:
  7465.  
  7466.      (int)a += 5
  7467.      (int)(a = (char *)(int) ((int)a + 5))
  7468.  
  7469.    You cannot take the address of an lvalue cast, because the use of its
  7470. address would not work out coherently.  Suppose that `&(int)f' were
  7471. permitted, where `f' has type `float'.  Then the following statement
  7472. would try to store an integer bit-pattern where a floating point number
  7473. belongs:
  7474.  
  7475.      *&(int)f = 1;
  7476.  
  7477.    This is quite different from what `(int)f = 1' would do--that would
  7478. convert 1 to floating point and store it.  Rather than cause this
  7479. inconsistency, we think it is better to prohibit use of `&' on a cast.
  7480.  
  7481.    If you really do want an `int *' pointer with the address of `f',
  7482. you can simply write `(int *)&f'.
  7483.  
  7484. 
  7485. File: use,  Node: Conditionals,  Next: Long Long,  Prev: Lvalues,  Up: C Extensions
  7486.  
  7487. Conditionals with Omitted Operands
  7488. ==================================
  7489.  
  7490.    The middle operand in a conditional expression may be omitted.  Then
  7491. if the first operand is nonzero, its value is the value of the
  7492. conditional expression.
  7493.  
  7494.    Therefore, the expression
  7495.  
  7496.      x ? : y
  7497.  
  7498. has the value of `x' if that is nonzero; otherwise, the value of `y'.
  7499.  
  7500.    This example is perfectly equivalent to
  7501.  
  7502.      x ? x : y
  7503.  
  7504. In this simple case, the ability to omit the middle operand is not
  7505. especially useful.  When it becomes useful is when the first operand
  7506. does, or may (if it is a macro argument), contain a side effect.  Then
  7507. repeating the operand in the middle would perform the side effect
  7508. twice.  Omitting the middle operand uses the value already computed
  7509. without the undesirable effects of recomputing it.
  7510.  
  7511. 
  7512. File: use,  Node: Long Long,  Next: Complex,  Prev: Conditionals,  Up: C Extensions
  7513.  
  7514. Double-Word Integers
  7515. ====================
  7516.  
  7517.    GNU C supports data types for integers that are twice as long as
  7518. `long int'.  Simply write `long long int' for a signed integer, or
  7519. `unsigned long long int' for an unsigned integer.  To make an integer
  7520. constant of type `long long int', add the suffix `LL' to the integer.
  7521. To make an integer constant of type `unsigned long long int', add the
  7522. suffix `ULL' to the integer.
  7523.  
  7524.    You can use these types in arithmetic like any other integer types.
  7525. Addition, subtraction, and bitwise boolean operations on these types
  7526. are open-coded on all types of machines.  Multiplication is open-coded
  7527. if the machine supports fullword-to-doubleword a widening multiply
  7528. instruction.  Division and shifts are open-coded only on machines that
  7529. provide special support.  The operations that are not open-coded use
  7530. special library routines that come with GNU CC.
  7531.  
  7532.    There may be pitfalls when you use `long long' types for function
  7533. arguments, unless you declare function prototypes.  If a function
  7534. expects type `int' for its argument, and you pass a value of type `long
  7535. long int', confusion will result because the caller and the subroutine
  7536. will disagree about the number of bytes for the argument.  Likewise, if
  7537. the function expects `long long int' and you pass `int'.  The best way
  7538. to avoid such problems is to use prototypes.
  7539.  
  7540. 
  7541. File: use,  Node: Complex,  Next: Zero Length,  Prev: Long Long,  Up: C Extensions
  7542.  
  7543. Complex Numbers
  7544. ===============
  7545.  
  7546.    GNU C supports complex data types.  You can declare both complex
  7547. integer types and complex floating types, using the keyword
  7548. `__complex__'.
  7549.  
  7550.    For example, `__complex__ double x;' declares `x' as a variable
  7551. whose real part and imaginary part are both of type `double'.
  7552. `__complex__ short int y;' declares `y' to have real and imaginary
  7553. parts of type `short int'; this is not likely to be useful, but it
  7554. shows that the set of complex types is complete.
  7555.  
  7556.    To write a constant with a complex data type, use the suffix `i' or
  7557. `j' (either one; they are equivalent).  For example, `2.5fi' has type
  7558. `__complex__ float' and `3i' has type `__complex__ int'.  Such a
  7559. constant always has a pure imaginary value, but you can form any
  7560. complex value you like by adding one to a real constant.
  7561.  
  7562.    To extract the real part of a complex-valued expression EXP, write
  7563. `__real__ EXP'.  Likewise, use `__imag__' to extract the imaginary part.
  7564.  
  7565.    The operator `~' performs complex conjugation when used on a value
  7566. with a complex type.
  7567.  
  7568.    GNU CC can allocate complex automatic variables in a noncontiguous
  7569. fashion; it's even possible for the real part to be in a register while
  7570. the imaginary part is on the stack (or vice-versa).  None of the
  7571. supported debugging info formats has a way to represent noncontiguous
  7572. allocation like this, so GNU CC describes a noncontiguous complex
  7573. variable as if it were two separate variables of noncomplex type.  If
  7574. the variable's actual name is `foo', the two fictitious variables are
  7575. named `foo$real' and `foo$imag'.  You can examine and set these two
  7576. fictitious variables with your debugger.
  7577.  
  7578.    A future version of GDB will know how to recognize such pairs and
  7579. treat them as a single variable with a complex type.
  7580.  
  7581. 
  7582. File: use,  Node: Zero Length,  Next: Variable Length,  Prev: Complex,  Up: C Extensions
  7583.  
  7584. Arrays of Length Zero
  7585. =====================
  7586.  
  7587.    Zero-length arrays are allowed in GNU C.  They are very useful as
  7588. the last element of a structure which is really a header for a
  7589. variable-length object:
  7590.  
  7591.      struct line {
  7592.        int length;
  7593.        char contents[0];
  7594.      };
  7595.      
  7596.      {
  7597.        struct line *thisline = (struct line *)
  7598.          malloc (sizeof (struct line) + this_length);
  7599.        thisline->length = this_length;
  7600.      }
  7601.  
  7602.    In standard C, you would have to give `contents' a length of 1, which
  7603. means either you waste space or complicate the argument to `malloc'.
  7604.  
  7605. 
  7606. File: use,  Node: Variable Length,  Next: Macro Varargs,  Prev: Zero Length,  Up: C Extensions
  7607.  
  7608. Arrays of Variable Length
  7609. =========================
  7610.  
  7611.    Variable-length automatic arrays are allowed in GNU C.  These arrays
  7612. are declared like any other automatic arrays, but with a length that is
  7613. not a constant expression.  The storage is allocated at the point of
  7614. declaration and deallocated when the brace-level is exited.  For
  7615. example:
  7616.  
  7617.      FILE *
  7618.      concat_fopen (char *s1, char *s2, char *mode)
  7619.      {
  7620.        char str[strlen (s1) + strlen (s2) + 1];
  7621.        strcpy (str, s1);
  7622.        strcat (str, s2);
  7623.        return fopen (str, mode);
  7624.      }
  7625.  
  7626.    Jumping or breaking out of the scope of the array name deallocates
  7627. the storage.  Jumping into the scope is not allowed; you get an error
  7628. message for it.
  7629.  
  7630.    You can use the function `alloca' to get an effect much like
  7631. variable-length arrays.  The function `alloca' is available in many
  7632. other C implementations (but not in all).  On the other hand,
  7633. variable-length arrays are more elegant.
  7634.  
  7635.    There are other differences between these two methods.  Space
  7636. allocated with `alloca' exists until the containing *function* returns.
  7637. The space for a variable-length array is deallocated as soon as the
  7638. array name's scope ends.  (If you use both variable-length arrays and
  7639. `alloca' in the same function, deallocation of a variable-length array
  7640. will also deallocate anything more recently allocated with `alloca'.)
  7641.  
  7642.    You can also use variable-length arrays as arguments to functions:
  7643.  
  7644.      struct entry
  7645.      tester (int len, char data[len][len])
  7646.      {
  7647.        ...
  7648.      }
  7649.  
  7650.    The length of an array is computed once when the storage is allocated
  7651. and is remembered for the scope of the array in case you access it with
  7652. `sizeof'.
  7653.  
  7654.    If you want to pass the array first and the length afterward, you can
  7655. use a forward declaration in the parameter list--another GNU extension.
  7656.  
  7657.      struct entry
  7658.      tester (int len; char data[len][len], int len)
  7659.      {
  7660.        ...
  7661.      }
  7662.  
  7663.    The `int len' before the semicolon is a "parameter forward
  7664. declaration", and it serves the purpose of making the name `len' known
  7665. when the declaration of `data' is parsed.
  7666.  
  7667.    You can write any number of such parameter forward declarations in
  7668. the parameter list.  They can be separated by commas or semicolons, but
  7669. the last one must end with a semicolon, which is followed by the "real"
  7670. parameter declarations.  Each forward declaration must match a "real"
  7671. declaration in parameter name and data type.
  7672.  
  7673. 
  7674. File: use,  Node: Macro Varargs,  Next: Subscripting,  Prev: Variable Length,  Up: C Extensions
  7675.  
  7676. Macros with Variable Numbers of Arguments
  7677. =========================================
  7678.  
  7679.    In GNU C, a macro can accept a variable number of arguments, much as
  7680. a function can.  The syntax for defining the macro looks much like that
  7681. used for a function.  Here is an example:
  7682.  
  7683.      #define eprintf(format, args...)  \
  7684.       fprintf (stderr, format , ## args)
  7685.  
  7686.    Here `args' is a "rest argument": it takes in zero or more
  7687. arguments, as many as the call contains.  All of them plus the commas
  7688. between them form the value of `args', which is substituted into the
  7689. macro body where `args' is used.  Thus, we have this expansion:
  7690.  
  7691.      eprintf ("%s:%d: ", input_file_name, line_number)
  7692.      ==>
  7693.      fprintf (stderr, "%s:%d: " , input_file_name, line_number)
  7694.  
  7695. Note that the comma after the string constant comes from the definition
  7696. of `eprintf', whereas the last comma comes from the value of `args'.
  7697.  
  7698.    The reason for using `##' is to handle the case when `args' matches
  7699. no arguments at all.  In this case, `args' has an empty value.  In this
  7700. case, the second comma in the definition becomes an embarrassment: if
  7701. it got through to the expansion of the macro, we would get something
  7702. like this:
  7703.  
  7704.      fprintf (stderr, "success!\n" , )
  7705.  
  7706. which is invalid C syntax.  `##' gets rid of the comma, so we get the
  7707. following instead:
  7708.  
  7709.      fprintf (stderr, "success!\n")
  7710.  
  7711.    This is a special feature of the GNU C preprocessor: `##' before a
  7712. rest argument that is empty discards the preceding sequence of
  7713. non-whitespace characters from the macro definition.  (If another macro
  7714. argument precedes, none of it is discarded.)
  7715.  
  7716.    It might be better to discard the last preprocessor token instead of
  7717. the last preceding sequence of non-whitespace characters; in fact, we
  7718. may someday change this feature to do so.  We advise you to write the
  7719. macro definition so that the preceding sequence of non-whitespace
  7720. characters is just a single token, so that the meaning will not change
  7721. if we change the definition of this feature.
  7722.  
  7723. 
  7724. File: use,  Node: Subscripting,  Next: Pointer Arith,  Prev: Macro Varargs,  Up: C Extensions
  7725.  
  7726. Non-Lvalue Arrays May Have Subscripts
  7727. =====================================
  7728.  
  7729.    Subscripting is allowed on arrays that are not lvalues, even though
  7730. the unary `&' operator is not.  For example, this is valid in GNU C
  7731. though not valid in other C dialects:
  7732.  
  7733.      struct foo {int a[4];};
  7734.      
  7735.      struct foo f();
  7736.      
  7737.      bar (int index)
  7738.      {
  7739.        return f().a[index];
  7740.      }
  7741.  
  7742. 
  7743. File: use,  Node: Pointer Arith,  Next: Initializers,  Prev: Subscripting,  Up: C Extensions
  7744.  
  7745. Arithmetic on `void'- and Function-Pointers
  7746. ===========================================
  7747.  
  7748.    In GNU C, addition and subtraction operations are supported on
  7749. pointers to `void' and on pointers to functions.  This is done by
  7750. treating the size of a `void' or of a function as 1.
  7751.  
  7752.    A consequence of this is that `sizeof' is also allowed on `void' and
  7753. on function types, and returns 1.
  7754.  
  7755.    The option `-Wpointer-arith' requests a warning if these extensions
  7756. are used.
  7757.  
  7758. 
  7759. File: use,  Node: Initializers,  Next: Constructors,  Prev: Pointer Arith,  Up: C Extensions
  7760.  
  7761. Non-Constant Initializers
  7762. =========================
  7763.  
  7764.    As in standard C++, the elements of an aggregate initializer for an
  7765. automatic variable are not required to be constant expressions in GNU C.
  7766. Here is an example of an initializer with run-time varying elements:
  7767.  
  7768.      foo (float f, float g)
  7769.      {
  7770.        float beat_freqs[2] = { f-g, f+g };
  7771.        ...
  7772.      }
  7773.  
  7774. 
  7775. File: use,  Node: Constructors,  Next: Labeled Elements,  Prev: Initializers,  Up: C Extensions
  7776.  
  7777. Constructor Expressions
  7778. =======================
  7779.  
  7780.    GNU C supports constructor expressions.  A constructor looks like a
  7781. cast containing an initializer.  Its value is an object of the type
  7782. specified in the cast, containing the elements specified in the
  7783. initializer.
  7784.  
  7785.    Usually, the specified type is a structure.  Assume that `struct
  7786. foo' and `structure' are declared as shown:
  7787.  
  7788.      struct foo {int a; char b[2];} structure;
  7789.  
  7790. Here is an example of constructing a `struct foo' with a constructor:
  7791.  
  7792.      structure = ((struct foo) {x + y, 'a', 0});
  7793.  
  7794. This is equivalent to writing the following:
  7795.  
  7796.      {
  7797.        struct foo temp = {x + y, 'a', 0};
  7798.        structure = temp;
  7799.      }
  7800.  
  7801.    You can also construct an array.  If all the elements of the
  7802. constructor are (made up of) simple constant expressions, suitable for
  7803. use in initializers, then the constructor is an lvalue and can be
  7804. coerced to a pointer to its first element, as shown here:
  7805.  
  7806.      char **foo = (char *[]) { "x", "y", "z" };
  7807.  
  7808.    Array constructors whose elements are not simple constants are not
  7809. very useful, because the constructor is not an lvalue.  There are only
  7810. two valid ways to use it: to subscript it, or initialize an array
  7811. variable with it.  The former is probably slower than a `switch'
  7812. statement, while the latter does the same thing an ordinary C
  7813. initializer would do.  Here is an example of subscripting an array
  7814. constructor:
  7815.  
  7816.      output = ((int[]) { 2, x, 28 }) [input];
  7817.  
  7818.    Constructor expressions for scalar types and union types are is also
  7819. allowed, but then the constructor expression is equivalent to a cast.
  7820.  
  7821. 
  7822. File: use,  Node: Labeled Elements,  Next: Cast to Union,  Prev: Constructors,  Up: C Extensions
  7823.  
  7824. Labeled Elements in Initializers
  7825. ================================
  7826.  
  7827.    Standard C requires the elements of an initializer to appear in a
  7828. fixed order, the same as the order of the elements in the array or
  7829. structure being initialized.
  7830.  
  7831.    In GNU C you can give the elements in any order, specifying the array
  7832. indices or structure field names they apply to.  This extension is not
  7833. implemented in GNU C++.
  7834.  
  7835.    To specify an array index, write `[INDEX]' or `[INDEX] =' before the
  7836. element value.  For example,
  7837.  
  7838.      int a[6] = { [4] 29, [2] = 15 };
  7839.  
  7840. is equivalent to
  7841.  
  7842.      int a[6] = { 0, 0, 15, 0, 29, 0 };
  7843.  
  7844. The index values must be constant expressions, even if the array being
  7845. initialized is automatic.
  7846.  
  7847.    To initialize a range of elements to the same value, write `[FIRST
  7848. ... LAST] = VALUE'.  For example,
  7849.  
  7850.      int widths[] = { [0 ... 9] = 1, [10 ... 99] = 2, [100] = 3 };
  7851.  
  7852. Note that the length of the array is the highest value specified plus
  7853. one.
  7854.  
  7855.    In a structure initializer, specify the name of a field to initialize
  7856. with `FIELDNAME:' before the element value.  For example, given the
  7857. following structure,
  7858.  
  7859.      struct point { int x, y; };
  7860.  
  7861. the following initialization
  7862.  
  7863.      struct point p = { y: yvalue, x: xvalue };
  7864.  
  7865. is equivalent to
  7866.  
  7867.      struct point p = { xvalue, yvalue };
  7868.  
  7869.    Another syntax which has the same meaning is `.FIELDNAME ='., as
  7870. shown here:
  7871.  
  7872.      struct point p = { .y = yvalue, .x = xvalue };
  7873.  
  7874.    You can also use an element label (with either the colon syntax or
  7875. the period-equal syntax) when initializing a union, to specify which
  7876. element of the union should be used.  For example,
  7877.  
  7878.      union foo { int i; double d; };
  7879.      
  7880.      union foo f = { d: 4 };
  7881.  
  7882. will convert 4 to a `double' to store it in the union using the second
  7883. element.  By contrast, casting 4 to type `union foo' would store it
  7884. into the union as the integer `i', since it is an integer.  (*Note Cast
  7885. to Union::.)
  7886.  
  7887.    You can combine this technique of naming elements with ordinary C
  7888. initialization of successive elements.  Each initializer element that
  7889. does not have a label applies to the next consecutive element of the
  7890. array or structure.  For example,
  7891.  
  7892.      int a[6] = { [1] = v1, v2, [4] = v4 };
  7893.  
  7894. is equivalent to
  7895.  
  7896.      int a[6] = { 0, v1, v2, 0, v4, 0 };
  7897.  
  7898.    Labeling the elements of an array initializer is especially useful
  7899. when the indices are characters or belong to an `enum' type.  For
  7900. example:
  7901.  
  7902.      int whitespace[256]
  7903.        = { [' '] = 1, ['\t'] = 1, ['\h'] = 1,
  7904.            ['\f'] = 1, ['\n'] = 1, ['\r'] = 1 };
  7905.  
  7906. 
  7907. File: use,  Node: Case Ranges,  Next: Function Attributes,  Prev: Cast to Union,  Up: C Extensions
  7908.  
  7909. Case Ranges
  7910. ===========
  7911.  
  7912.    You can specify a range of consecutive values in a single `case'
  7913. label, like this:
  7914.  
  7915.      case LOW ... HIGH:
  7916.  
  7917. This has the same effect as the proper number of individual `case'
  7918. labels, one for each integer value from LOW to HIGH, inclusive.
  7919.  
  7920.    This feature is especially useful for ranges of ASCII character
  7921. codes:
  7922.  
  7923.      case 'A' ... 'Z':
  7924.  
  7925.    *Be careful:* Write spaces around the `...', for otherwise it may be
  7926. parsed wrong when you use it with integer values.  For example, write
  7927. this:
  7928.  
  7929.      case 1 ... 5:
  7930.  
  7931. rather than this:
  7932.  
  7933.      case 1...5:
  7934.  
  7935. 
  7936. File: use,  Node: Cast to Union,  Next: Case Ranges,  Prev: Labeled Elements,  Up: C Extensions
  7937.  
  7938. Cast to a Union Type
  7939. ====================
  7940.  
  7941.    A cast to union type is similar to other casts, except that the type
  7942. specified is a union type.  You can specify the type either with `union
  7943. TAG' or with a typedef name.  A cast to union is actually a constructor
  7944. though, not a cast, and hence does not yield an lvalue like normal
  7945. casts.  (*Note Constructors::.)
  7946.  
  7947.    The types that may be cast to the union type are those of the members
  7948. of the union.  Thus, given the following union and variables:
  7949.  
  7950.      union foo { int i; double d; };
  7951.      int x;
  7952.      double y;
  7953.  
  7954. both `x' and `y' can be cast to type `union' foo.
  7955.  
  7956.    Using the cast as the right-hand side of an assignment to a variable
  7957. of union type is equivalent to storing in a member of the union:
  7958.  
  7959.      union foo u;
  7960.      ...
  7961.      u = (union foo) x  ==  u.i = x
  7962.      u = (union foo) y  ==  u.d = y
  7963.  
  7964.    You can also use the union cast as a function argument:
  7965.  
  7966.      void hack (union foo);
  7967.      ...
  7968.      hack ((union foo) x);
  7969.  
  7970. 
  7971. File: use,  Node: Function Attributes,  Next: Function Prototypes,  Prev: Case Ranges,  Up: C Extensions
  7972.  
  7973. Declaring Attributes of Functions
  7974. =================================
  7975.  
  7976.    In GNU C, you declare certain things about functions called in your
  7977. program which help the compiler optimize function calls and check your
  7978. code more carefully.
  7979.  
  7980.    The keyword `__attribute__' allows you to specify special attributes
  7981. when making a declaration.  This keyword is followed by an attribute
  7982. specification inside double parentheses.  Eight attributes, `noreturn',
  7983. `const', `format', `section', `constructor', `destructor', `unused' and
  7984. `weak' are currently defined for functions.  Other attributes, including
  7985. `section' are supported for variables declarations (*note Variable
  7986. Attributes::.) and for types (*note Type Attributes::.).
  7987.  
  7988.    You may also specify attributes with `__' preceding and following
  7989. each keyword.  This allows you to use them in header files without
  7990. being concerned about a possible macro of the same name.  For example,
  7991. you may use `__noreturn__' instead of `noreturn'.
  7992.  
  7993. `noreturn'
  7994.      A few standard library functions, such as `abort' and `exit',
  7995.      cannot return.  GNU CC knows this automatically.  Some programs
  7996.      define their own functions that never return.  You can declare them
  7997.      `noreturn' to tell the compiler this fact.  For example,
  7998.  
  7999.           void fatal () __attribute__ ((noreturn));
  8000.           
  8001.           void
  8002.           fatal (...)
  8003.           {
  8004.             ... /* Print error message. */ ...
  8005.             exit (1);
  8006.           }
  8007.  
  8008.      The `noreturn' keyword tells the compiler to assume that `fatal'
  8009.      cannot return.  It can then optimize without regard to what would
  8010.      happen if `fatal' ever did return.  This makes slightly better
  8011.      code.  More importantly, it helps avoid spurious warnings of
  8012.      uninitialized variables.
  8013.  
  8014.      Do not assume that registers saved by the calling function are
  8015.      restored before calling the `noreturn' function.
  8016.  
  8017.      It does not make sense for a `noreturn' function to have a return
  8018.      type other than `void'.
  8019.  
  8020.      The attribute `noreturn' is not implemented in GNU C versions
  8021.      earlier than 2.5.  An alternative way to declare that a function
  8022.      does not return, which works in the current version and in some
  8023.      older versions, is as follows:
  8024.  
  8025.           typedef void voidfn ();
  8026.           
  8027.           volatile voidfn fatal;
  8028.  
  8029. `const'
  8030.      Many functions do not examine any values except their arguments,
  8031.      and have no effects except the return value.  Such a function can
  8032.      be subject to common subexpression elimination and loop
  8033.      optimization just as an arithmetic operator would be.  These
  8034.      functions should be declared with the attribute `const'.  For
  8035.      example,
  8036.  
  8037.           int square (int) __attribute__ ((const));
  8038.  
  8039.      says that the hypothetical function `square' is safe to call fewer
  8040.      times than the program says.
  8041.  
  8042.      The attribute `const' is not implemented in GNU C versions earlier
  8043.      than 2.5.  An alternative way to declare that a function has no
  8044.      side effects, which works in the current version and in some older
  8045.      versions, is as follows:
  8046.  
  8047.           typedef int intfn ();
  8048.           
  8049.           extern const intfn square;
  8050.  
  8051.      This approach does not work in GNU C++ from 2.6.0 on, since the
  8052.      language specifies that the `const' must be attached to the return
  8053.      value.
  8054.  
  8055.      Note that a function that has pointer arguments and examines the
  8056.      data pointed to must *not* be declared `const'.  Likewise, a
  8057.      function that calls a non-`const' function usually must not be
  8058.      `const'.  It does not make sense for a `const' function to return
  8059.      `void'.
  8060.  
  8061. `format (ARCHETYPE, STRING-INDEX, FIRST-TO-CHECK)'
  8062.      The `format' attribute specifies that a function takes `printf' or
  8063.      `scanf' style arguments which should be type-checked against a
  8064.      format string.  For example, the declaration:
  8065.  
  8066.           extern int
  8067.           my_printf (void *my_object, const char *my_format, ...)
  8068.                 __attribute__ ((format (printf, 2, 3)));
  8069.  
  8070.      causes the compiler to check the arguments in calls to `my_printf'
  8071.      for consistency with the `printf' style format string argument
  8072.      `my_format'.
  8073.  
  8074.      The parameter ARCHETYPE determines how the format string is
  8075.      interpreted, and should be either `printf' or `scanf'.  The
  8076.      parameter STRING-INDEX specifies which argument is the format
  8077.      string argument (starting from 1), while FIRST-TO-CHECK is the
  8078.      number of the first argument to check against the format string.
  8079.      For functions where the arguments are not available to be checked
  8080.      (such as `vprintf'), specify the third parameter as zero.  In this
  8081.      case the compiler only checks the format string for consistency.
  8082.  
  8083.      In the example above, the format string (`my_format') is the second
  8084.      argument of the function `my_print', and the arguments to check
  8085.      start with the third argument, so the correct parameters for the
  8086.      format attribute are 2 and 3.
  8087.  
  8088.      The `format' attribute allows you to identify your own functions
  8089.      which take format strings as arguments, so that GNU CC can check
  8090.      the calls to these functions for errors.  The compiler always
  8091.      checks formats for the ANSI library functions `printf', `fprintf',
  8092.      `sprintf', `scanf', `fscanf', `sscanf', `vprintf', `vfprintf' and
  8093.      `vsprintf' whenever such warnings are requested (using
  8094.      `-Wformat'), so there is no need to modify the header file
  8095.      `stdio.h'.
  8096.  
  8097. `section ("section-name")'
  8098.      Normally, the compiler places the code it generates in the `text'
  8099.      section.  Sometimes, however, you need additional sections, or you
  8100.      need certain particular functions to appear in special sections.
  8101.      The `section' attribute specifies that a function lives in a
  8102.      particular section.  For example, the declaration:
  8103.  
  8104.           extern void foobar (void) __attribute__ ((section ("bar")));
  8105.  
  8106.      puts the function `foobar' in the `bar' section.
  8107.  
  8108.      Some file formats do not support arbitrary sections so the
  8109.      `section' attribute is not available on all platforms.  If you
  8110.      need to map the entire contents of a module to a particular
  8111.      section, consider using the facilities of the linker instead.
  8112.  
  8113. `constructor'
  8114. `destructor'
  8115.      The `constructor' attribute causes the function to be called
  8116.      automatically before execution enters `main ()'.  Similarly, the
  8117.      `destructor' attribute causes the function to be called
  8118.      automatically after `main ()' has completed or `exit ()' has been
  8119.      called.  Functions with these attributes are useful for
  8120.      initializing data that will be used implicitly during the
  8121.      execution of the program.
  8122.  
  8123.      These attributes are not currently implemented for Objective C.
  8124.  
  8125. `unused'
  8126.      This attribute, attached to a function, means that the function is
  8127.      meant to be possibly unused.  GNU CC will not produce a warning
  8128.      for this function.
  8129.  
  8130. `weak'
  8131.      The `weak' attribute causes the declaration to be emitted as a weak
  8132.      symbol rather than a global.  This is primarily useful in defining
  8133.      library functions which can be overridden in user code, though it
  8134.      can also be used with non-function declarations.  Weak symbols are
  8135.      supported for ELF targets, and also for a.out targets when using
  8136.      the GNU assembler and linker.
  8137.  
  8138. `alias ("target")'
  8139.      The `alias' attribute causes the declaration to be emitted as an
  8140.      alias for another symbol, which must be specified.  For instance,
  8141.  
  8142.           void __f () { /* do something */; }
  8143.           void f () __attribute__ ((weak, alias ("__f")));
  8144.  
  8145.      declares `f' to be a weak alias for `__f'.  In C++, the mangled
  8146.      name for the target must be used.
  8147.  
  8148. `regparm (NUMBER)'
  8149.      On the Intel 386, the `regparm' attribute causes the compiler to
  8150.      pass up to NUMBER integer arguments in registers EAX, EDX, and ECX
  8151.      instead of on the stack.  Functions that take a variable number of
  8152.      arguments will continue to be passed all of their arguments on the
  8153.      stack.
  8154.  
  8155. `stdcall'
  8156.      On the Intel 386, the `stdcall' attribute causes the compiler to
  8157.      assume that the called function will pop off the stack space used
  8158.      to pass arguments, unless it takes a variable number of arguments.
  8159.  
  8160. `cdecl'
  8161.      On the Intel 386, the `cdecl' attribute causes the compiler to
  8162.      assume that the called function will pop off the stack space used
  8163.      to pass arguments, unless it takes a variable number of arguments.
  8164.      This is useful to override the effects of the `-mrtd' switch.
  8165.  
  8166.    You can specify multiple attributes in a declaration by separating
  8167. them by commas within the double parentheses or by immediately
  8168. following an attribute declaration with another attribute declaration.
  8169.  
  8170.    Some people object to the `__attribute__' feature, suggesting that
  8171. ANSI C's `#pragma' should be used instead.  There are two reasons for
  8172. not doing this.
  8173.  
  8174.   1. It is impossible to generate `#pragma' commands from a macro.
  8175.  
  8176.   2. There is no telling what the same `#pragma' might mean in another
  8177.      compiler.
  8178.  
  8179.    These two reasons apply to almost any application that might be
  8180. proposed for `#pragma'.  It is basically a mistake to use `#pragma' for
  8181. *anything*.
  8182.  
  8183. 
  8184. File: use,  Node: Function Prototypes,  Next: Dollar Signs,  Prev: Function Attributes,  Up: C Extensions
  8185.  
  8186. Prototypes and Old-Style Function Definitions
  8187. =============================================
  8188.  
  8189.    GNU C extends ANSI C to allow a function prototype to override a
  8190. later old-style non-prototype definition.  Consider the following
  8191. example:
  8192.  
  8193.      /* Use prototypes unless the compiler is old-fashioned.  */
  8194.      #if __STDC__
  8195.      #define P(x) x
  8196.      #else
  8197.      #define P(x) ()
  8198.      #endif
  8199.      
  8200.      /* Prototype function declaration.  */
  8201.      int isroot P((uid_t));
  8202.      
  8203.      /* Old-style function definition.  */
  8204.      int
  8205.      isroot (x)   /* ??? lossage here ??? */
  8206.           uid_t x;
  8207.      {
  8208.        return x == 0;
  8209.      }
  8210.  
  8211.    Suppose the type `uid_t' happens to be `short'.  ANSI C does not
  8212. allow this example, because subword arguments in old-style
  8213. non-prototype definitions are promoted.  Therefore in this example the
  8214. function definition's argument is really an `int', which does not match
  8215. the prototype argument type of `short'.
  8216.  
  8217.    This restriction of ANSI C makes it hard to write code that is
  8218. portable to traditional C compilers, because the programmer does not
  8219. know whether the `uid_t' type is `short', `int', or `long'.  Therefore,
  8220. in cases like these GNU C allows a prototype to override a later
  8221. old-style definition.  More precisely, in GNU C, a function prototype
  8222. argument type overrides the argument type specified by a later
  8223. old-style definition if the former type is the same as the latter type
  8224. before promotion.  Thus in GNU C the above example is equivalent to the
  8225. following:
  8226.  
  8227.      int isroot (uid_t);
  8228.      
  8229.      int
  8230.      isroot (uid_t x)
  8231.      {
  8232.        return x == 0;
  8233.      }
  8234.  
  8235.    GNU C++ does not support old-style function definitions, so this
  8236. extension is irrelevant.
  8237.  
  8238. 
  8239. File: use,  Node: Dollar Signs,  Next: Character Escapes,  Prev: Function Prototypes,  Up: C Extensions
  8240.  
  8241. Dollar Signs in Identifier Names
  8242. ================================
  8243.  
  8244.    In GNU C, you may use dollar signs in identifier names.  This is
  8245. because many traditional C implementations allow such identifiers.
  8246.  
  8247.    On some machines, dollar signs are allowed in identifiers if you
  8248. specify `-traditional'.  On a few systems they are allowed by default,
  8249. even if you do not use `-traditional'.  But they are never allowed if
  8250. you specify `-ansi'.
  8251.  
  8252.    There are certain ANSI C programs (obscure, to be sure) that would
  8253. compile incorrectly if dollar signs were permitted in identifiers.  For
  8254. example:
  8255.  
  8256.      #define foo(a) #a
  8257.      #define lose(b) foo (b)
  8258.      #define test$
  8259.      lose (test)
  8260.  
  8261. 
  8262. File: use,  Node: Character Escapes,  Next: Variable Attributes,  Prev: Dollar Signs,  Up: C Extensions
  8263.  
  8264. The Character ESC in Constants
  8265. ==============================
  8266.  
  8267.    You can use the sequence `\e' in a string or character constant to
  8268. stand for the ASCII character ESC.
  8269.  
  8270. 
  8271. File: use,  Node: Alignment,  Next: Inline,  Prev: Type Attributes,  Up: C Extensions
  8272.  
  8273. Inquiring on Alignment of Types or Variables
  8274. ============================================
  8275.  
  8276.    The keyword `__alignof__' allows you to inquire about how an object
  8277. is aligned, or the minimum alignment usually required by a type.  Its
  8278. syntax is just like `sizeof'.
  8279.  
  8280.    For example, if the target machine requires a `double' value to be
  8281. aligned on an 8-byte boundary, then `__alignof__ (double)' is 8.  This
  8282. is true on many RISC machines.  On more traditional machine designs,
  8283. `__alignof__ (double)' is 4 or even 2.
  8284.  
  8285.    Some machines never actually require alignment; they allow reference
  8286. to any data type even at an odd addresses.  For these machines,
  8287. `__alignof__' reports the *recommended* alignment of a type.
  8288.  
  8289.    When the operand of `__alignof__' is an lvalue rather than a type,
  8290. the value is the largest alignment that the lvalue is known to have.
  8291. It may have this alignment as a result of its data type, or because it
  8292. is part of a structure and inherits alignment from that structure.  For
  8293. example, after this declaration:
  8294.  
  8295.      struct foo { int x; char y; } foo1;
  8296.  
  8297. the value of `__alignof__ (foo1.y)' is probably 2 or 4, the same as
  8298. `__alignof__ (int)', even though the data type of `foo1.y' does not
  8299. itself demand any alignment.
  8300.  
  8301.    A related feature which lets you specify the alignment of an object
  8302. is `__attribute__ ((aligned (ALIGNMENT)))'; see the following section.
  8303.  
  8304. 
  8305. File: use,  Node: Variable Attributes,  Next: Type Attributes,  Prev: Character Escapes,  Up: C Extensions
  8306.  
  8307. Specifying Attributes of Variables
  8308. ==================================
  8309.  
  8310.    The keyword `__attribute__' allows you to specify special attributes
  8311. of variables or structure fields.  This keyword is followed by an
  8312. attribute specification inside double parentheses.  Eight attributes
  8313. are currently defined for variables: `aligned', `mode', `nocommon',
  8314. `packed', `section', `transparent_union', `unused', and `weak'.  Other
  8315. attributes are available for functions (*note Function Attributes::.)
  8316. and for types (*note Type Attributes::.).
  8317.  
  8318.    You may also specify attributes with `__' preceding and following
  8319. each keyword.  This allows you to use them in header files without
  8320. being concerned about a possible macro of the same name.  For example,
  8321. you may use `__aligned__' instead of `aligned'.
  8322.  
  8323. `aligned (ALIGNMENT)'
  8324.      This attribute specifies a minimum alignment for the variable or
  8325.      structure field, measured in bytes.  For example, the declaration:
  8326.  
  8327.           int x __attribute__ ((aligned (16))) = 0;
  8328.  
  8329.      causes the compiler to allocate the global variable `x' on a
  8330.      16-byte boundary.  On a 68040, this could be used in conjunction
  8331.      with an `asm' expression to access the `move16' instruction which
  8332.      requires 16-byte aligned operands.
  8333.  
  8334.      You can also specify the alignment of structure fields.  For
  8335.      example, to create a double-word aligned `int' pair, you could
  8336.      write:
  8337.  
  8338.           struct foo { int x[2] __attribute__ ((aligned (8))); };
  8339.  
  8340.      This is an alternative to creating a union with a `double' member
  8341.      that forces the union to be double-word aligned.
  8342.  
  8343.      It is not possible to specify the alignment of functions; the
  8344.      alignment of functions is determined by the machine's requirements
  8345.      and cannot be changed.  You cannot specify alignment for a typedef
  8346.      name because such a name is just an alias, not a distinct type.
  8347.  
  8348.      As in the preceding examples, you can explicitly specify the
  8349.      alignment (in bytes) that you wish the compiler to use for a given
  8350.      variable or structure field.  Alternatively, you can leave out the
  8351.      alignment factor and just ask the compiler to align a variable or
  8352.      field to the maximum useful alignment for the target machine you
  8353.      are compiling for.  For example, you could write:
  8354.  
  8355.           short array[3] __attribute__ ((aligned));
  8356.  
  8357.      Whenever you leave out the alignment factor in an `aligned'
  8358.      attribute specification, the compiler automatically sets the
  8359.      alignment for the declared variable or field to the largest
  8360.      alignment which is ever used for any data type on the target
  8361.      machine you are compiling for.  Doing this can often make copy
  8362.      operations more efficient, because the compiler can use whatever
  8363.      instructions copy the biggest chunks of memory when performing
  8364.      copies to or from the variables or fields that you have aligned
  8365.      this way.
  8366.  
  8367.      The `aligned' attribute can only increase the alignment; but you
  8368.      can decrease it by specifying `packed' as well.  See below.
  8369.  
  8370.      Note that the effectiveness of `aligned' attributes may be limited
  8371.      by inherent limitations in your linker.  On many systems, the
  8372.      linker is only able to arrange for variables to be aligned up to a
  8373.      certain maximum alignment.  (For some linkers, the maximum
  8374.      supported alignment may be very very small.)  If your linker is
  8375.      only able to align variables up to a maximum of 8 byte alignment,
  8376.      then specifying `aligned(16)' in an `__attribute__' will still
  8377.      only provide you with 8 byte alignment.  See your linker
  8378.      documentation for further information.
  8379.  
  8380. `mode (MODE)'
  8381.      This attribute specifies the data type for the
  8382.      declaration--whichever type corresponds to the mode MODE.  This in
  8383.      effect lets you request an integer or floating point type
  8384.      according to its width.
  8385.  
  8386.      You may also specify a mode of `byte' or `__byte__' to indicate
  8387.      the mode corresponding to a one-byte integer, `word' or `__word__'
  8388.      for the mode of a one-word integer, and `pointer' or `__pointer__'
  8389.      for the mode used to represent pointers.
  8390.  
  8391. `nocommon'
  8392.      This attribute specifies requests GNU CC not to place a variable
  8393.      "common" but instead to allocate space for it directly.  If you
  8394.      specify the `-fno-common' flag, GNU CC will do this for all
  8395.      variables.
  8396.  
  8397.      Specifying the `nocommon' attribute for a variable provides an
  8398.      initialization of zeros.  A variable may only be initialized in one
  8399.      source file.
  8400.  
  8401. `packed'
  8402.      The `packed' attribute specifies that a variable or structure field
  8403.      should have the smallest possible alignment--one byte for a
  8404.      variable, and one bit for a field, unless you specify a larger
  8405.      value with the `aligned' attribute.
  8406.  
  8407.      Here is a structure in which the field `x' is packed, so that it
  8408.      immediately follows `a':
  8409.  
  8410.           struct foo
  8411.           {
  8412.             char a;
  8413.             int x[2] __attribute__ ((packed));
  8414.           };
  8415.  
  8416. `section ("section-name")'
  8417.      Normally, the compiler places the objects it generates in sections
  8418.      like `data' and `bss'.  Sometimes, however, you need additional
  8419.      sections, or you need certain particular variables to appear in
  8420.      special sections, for example to map to special hardware.  The
  8421.      `section' attribute specifies that a variable (or function) lives
  8422.      in a particular section.  For example, this small program uses
  8423.      several specific section names:
  8424.  
  8425.           struct duart a __attribute__ ((section ("DUART_A"))) = { 0 };
  8426.           struct duart b __attribute__ ((section ("DUART_B"))) = { 0 };
  8427.           char stack[10000] __attribute__ ((section ("STACK"))) = { 0 };
  8428.           int init_data_copy __attribute__ ((section ("INITDATACOPY"))) = 0;
  8429.           
  8430.           main()
  8431.           {
  8432.             /* Initialize stack pointer */
  8433.             init_sp (stack + sizeof (stack));
  8434.           
  8435.             /* Initialize initialized data */
  8436.             memcpy (&init_data_copy, &data, &edata - &data);
  8437.           
  8438.             /* Turn on the serial ports */
  8439.             init_duart (&a);
  8440.             init_duart (&b);
  8441.           }
  8442.  
  8443.      Use the `section' attribute with an *initialized* definition of a
  8444.      *global* variable, as shown in the example.  GNU CC issues a
  8445.      warning and otherwise ignores the `section' attribute in
  8446.      uninitialized variable declarations.
  8447.  
  8448.      You may only use the `section' attribute with a fully initialized
  8449.      global definition because of the way linkers work.  The linker
  8450.      requires each object be defined once, with the exception that
  8451.      uninitialized variables tentatively go in the `common' (or `bss')
  8452.      section and can be multiply "defined".  You can force a variable
  8453.      to be initialized with the `-fno-common' flag or the `nocommon'
  8454.      attribute.
  8455.  
  8456.      Some file formats do not support arbitrary sections so the
  8457.      `section' attribute is not available on all platforms.  If you
  8458.      need to map the entire contents of a module to a particular
  8459.      section, consider using the facilities of the linker instead.
  8460.  
  8461. `transparent_union'
  8462.      This attribute, attached to a function argument variable which is a
  8463.      union, means to pass the argument in the same way that the first
  8464.      union member would be passed.  You can also use this attribute on a
  8465.      `typedef' for a union data type; then it applies to all function
  8466.      arguments with that type.
  8467.  
  8468. `unused'
  8469.      This attribute, attached to a variable, means that the variable is
  8470.      meant to be possibly unused.  GNU CC will not produce a warning
  8471.      for this variable.
  8472.  
  8473. `weak'
  8474.      The `weak' attribute is described in *Note Function Attributes::.
  8475.  
  8476.    To specify multiple attributes, separate them by commas within the
  8477. double parentheses: for example, `__attribute__ ((aligned (16),
  8478. packed))'.
  8479.  
  8480. 
  8481. File: use,  Node: Type Attributes,  Next: Alignment,  Prev: Variable Attributes,  Up: C Extensions
  8482.  
  8483. Specifying Attributes of Types
  8484. ==============================
  8485.  
  8486.    The keyword `__attribute__' allows you to specify special attributes
  8487. of `struct' and `union' types when you define such types.  This keyword
  8488. is followed by an attribute specification inside double parentheses.
  8489. Three attributes are currently defined for types: `aligned', `packed',
  8490. and `transparent_union'.  Other attributes are defined for functions
  8491. (*note Function Attributes::.) and for variables (*note Variable
  8492. Attributes::.).
  8493.  
  8494.    You may also specify any one of these attributes with `__' preceding
  8495. and following its keyword.  This allows you to use these attributes in
  8496. header files without being concerned about a possible macro of the same
  8497. name.  For example, you may use `__aligned__' instead of `aligned'.
  8498.  
  8499.    You may specify the `aligned' and `transparent_union' attributes
  8500. either in a `typedef' declaration or just past the closing curly brace
  8501. of a complete enum, struct or union type *definition* and the `packed'
  8502. attribute only past the closing brace of a definition.
  8503.  
  8504. `aligned (ALIGNMENT)'
  8505.      This attribute specifies a minimum alignment (in bytes) for
  8506.      variables of the specified type.  For example, the declarations:
  8507.  
  8508.           struct S { short f[3]; } __attribute__ ((aligned (8));
  8509.           typedef int more_aligned_int __attribute__ ((aligned (8));
  8510.  
  8511.      force the compiler to insure (as fas as it can) that each variable
  8512.      whose type is `struct S' or `more_aligned_int' will be allocated
  8513.      and aligned *at least* on a 8-byte boundary.  On a Sparc, having
  8514.      all variables of type `struct S' aligned to 8-byte boundaries
  8515.      allows the compiler to use the `ldd' and `std' (doubleword load and
  8516.      store) instructions when copying one variable of type `struct S' to
  8517.      another, thus improving run-time efficiency.
  8518.  
  8519.      Note that the alignment of any given `struct' or `union' type is
  8520.      required by the ANSI C standard to be at least a perfect multiple
  8521.      of the lowest common multiple of the alignments of all of the
  8522.      members of the `struct' or `union' in question.  This means that
  8523.      you *can* effectively adjust the alignment of a `struct' or `union'
  8524.      type by attaching an `aligned' attribute to any one of the members
  8525.      of such a type, but the notation illustrated in the example above
  8526.      is a more obvious, intuitive, and readable way to request the
  8527.      compiler to adjust the alignment of an entire `struct' or `union'
  8528.      type.
  8529.  
  8530.      As in the preceding example, you can explicitly specify the
  8531.      alignment (in bytes) that you wish the compiler to use for a given
  8532.      `struct' or `union' type.  Alternatively, you can leave out the
  8533.      alignment factor and just ask the compiler to align a type to the
  8534.      maximum useful alignment for the target machine you are compiling
  8535.      for.  For example, you could write:
  8536.  
  8537.           struct S { short f[3]; } __attribute__ ((aligned));
  8538.  
  8539.      Whenever you leave out the alignment factor in an `aligned'
  8540.      attribute specification, the compiler automatically sets the
  8541.      alignment for the type to the largest alignment which is ever used
  8542.      for any data type on the target machine you are compiling for.
  8543.      Doing this can often make copy operations more efficient, because
  8544.      the compiler can use whatever instructions copy the biggest chunks
  8545.      of memory when performing copies to or from the variables which
  8546.      have types that you have aligned this way.
  8547.  
  8548.      In the example above, if the size of each `short' is 2 bytes, then
  8549.      the size of the entire `struct S' type is 6 bytes.  The smallest
  8550.      power of two which is greater than or equal to that is 8, so the
  8551.      compiler sets the alignment for the entire `struct S' type to 8
  8552.      bytes.
  8553.  
  8554.      Note that although you can ask the compiler to select a
  8555.      time-efficient alignment for a given type and then declare only
  8556.      individual stand-alone objects of that type, the compiler's
  8557.      ability to select a time-efficient alignment is primarily useful
  8558.      only when you plan to create arrays of variables having the
  8559.      relevant (efficiently aligned) type.  If you declare or use arrays
  8560.      of variables of an efficiently-aligned type, then it is likely
  8561.      that your program will also be doing pointer arithmetic (or
  8562.      subscripting, which amounts to the same thing) on pointers to the
  8563.      relevant type, and the code that the compiler generates for these
  8564.      pointer arithmetic operations will often be more efficient for
  8565.      efficiently-aligned types than for other types.
  8566.  
  8567.      The `aligned' attribute can only increase the alignment; but you
  8568.      can decrease it by specifying `packed' as well.  See below.
  8569.  
  8570.      Note that the effectiveness of `aligned' attributes may be limited
  8571.      by inherent limitations in your linker.  On many systems, the
  8572.      linker is only able to arrange for variables to be aligned up to a
  8573.      certain maximum alignment.  (For some linkers, the maximum
  8574.      supported alignment may be very very small.)  If your linker is
  8575.      only able to align variables up to a maximum of 8 byte alignment,
  8576.      then specifying `aligned(16)' in an `__attribute__' will still
  8577.      only provide you with 8 byte alignment.  See your linker
  8578.      documentation for further information.
  8579.  
  8580. `packed'
  8581.      This attribute, attached to an `enum', `struct', or `union' type
  8582.      definition, specified that the minimum required memory be used to
  8583.      represent the type.
  8584.  
  8585.      Specifying this attribute for `struct' and `union' types is
  8586.      equivalent to specifying the `packed' attribute on each of the
  8587.      structure or union members.  Specifying the `-fshort-enums' flag
  8588.      on the line is equivalent to specifying the `packed' attribute on
  8589.      all `enum' definitions.
  8590.  
  8591.      You may only specify this attribute after a closing curly brace on
  8592.      an `enum' definition, not in a `typedef' declaration.
  8593.  
  8594. `transparent_union'
  8595.      This attribute, attached to a `union' type definition, indicates
  8596.      that any variable having that union type should, if passed to a
  8597.      function, be passed in the same way that the first union member
  8598.      would be passed.  For example:
  8599.  
  8600.           union foo
  8601.           {
  8602.             char a;
  8603.             int x[2];
  8604.           } __attribute__ ((transparent_union));
  8605.  
  8606.    To specify multiple attributes, separate them by commas within the
  8607. double parentheses: for example, `__attribute__ ((aligned (16),
  8608. packed))'.
  8609.  
  8610. 
  8611. File: use,  Node: Inline,  Next: Extended Asm,  Prev: Alignment,  Up: C Extensions
  8612.  
  8613. An Inline Function is As Fast As a Macro
  8614. ========================================
  8615.  
  8616.    By declaring a function `inline', you can direct GNU CC to integrate
  8617. that function's code into the code for its callers.  This makes
  8618. execution faster by eliminating the function-call overhead; in
  8619. addition, if any of the actual argument values are constant, their known
  8620. values may permit simplifications at compile time so that not all of the
  8621. inline function's code needs to be included.  The effect on code size is
  8622. less predictable; object code may be larger or smaller with function
  8623. inlining, depending on the particular case.  Inlining of functions is an
  8624. optimization and it really "works" only in optimizing compilation.  If
  8625. you don't use `-O', no function is really inline.
  8626.  
  8627.    To declare a function inline, use the `inline' keyword in its
  8628. declaration, like this:
  8629.  
  8630.      inline int
  8631.      inc (int *a)
  8632.      {
  8633.        (*a)++;
  8634.      }
  8635.  
  8636.    (If you are writing a header file to be included in ANSI C programs,
  8637. write `__inline__' instead of `inline'.  *Note Alternate Keywords::.)
  8638.  
  8639.    You can also make all "simple enough" functions inline with the
  8640. option `-finline-functions'.  Note that certain usages in a function
  8641. definition can make it unsuitable for inline substitution.
  8642.  
  8643.    Note that in C and Objective C, unlike C++, the `inline' keyword
  8644. does not affect the linkage of the function.
  8645.  
  8646.    GNU CC automatically inlines member functions defined within the
  8647. class body of C++ programs even if they are not explicitly declared
  8648. `inline'.  (You can override this with `-fno-default-inline'; *note
  8649. Options Controlling C++ Dialect: C++ Dialect Options..)
  8650.  
  8651.    When a function is both inline and `static', if all calls to the
  8652. function are integrated into the caller, and the function's address is
  8653. never used, then the function's own assembler code is never referenced.
  8654. In this case, GNU CC does not actually output assembler code for the
  8655. function, unless you specify the option `-fkeep-inline-functions'.
  8656. Some calls cannot be integrated for various reasons (in particular,
  8657. calls that precede the function's definition cannot be integrated, and
  8658. neither can recursive calls within the definition).  If there is a
  8659. nonintegrated call, then the function is compiled to assembler code as
  8660. usual.  The function must also be compiled as usual if the program
  8661. refers to its address, because that can't be inlined.
  8662.  
  8663.    When an inline function is not `static', then the compiler must
  8664. assume that there may be calls from other source files; since a global
  8665. symbol can be defined only once in any program, the function must not
  8666. be defined in the other source files, so the calls therein cannot be
  8667. integrated.  Therefore, a non-`static' inline function is always
  8668. compiled on its own in the usual fashion.
  8669.  
  8670.    If you specify both `inline' and `extern' in the function
  8671. definition, then the definition is used only for inlining.  In no case
  8672. is the function compiled on its own, not even if you refer to its
  8673. address explicitly.  Such an address becomes an external reference, as
  8674. if you had only declared the function, and had not defined it.
  8675.  
  8676.    This combination of `inline' and `extern' has almost the effect of a
  8677. macro.  The way to use it is to put a function definition in a header
  8678. file with these keywords, and put another copy of the definition
  8679. (lacking `inline' and `extern') in a library file.  The definition in
  8680. the header file will cause most calls to the function to be inlined.
  8681. If any uses of the function remain, they will refer to the single copy
  8682. in the library.
  8683.  
  8684.    GNU C does not inline any functions when not optimizing.  It is not
  8685. clear whether it is better to inline or not, in this case, but we found
  8686. that a correct implementation when not optimizing was difficult.  So we
  8687. did the easy thing, and turned it off.
  8688.  
  8689. 
  8690. File: use,  Node: Extended Asm,  Next: Constraints,  Prev: Inline,  Up: C Extensions
  8691.  
  8692. Assembler Instructions with C Expression Operands
  8693. =================================================
  8694.  
  8695.    In an assembler instruction using `asm', you can now specify the
  8696. operands of the instruction using C expressions.  This means no more
  8697. guessing which registers or memory locations will contain the data you
  8698. want to use.
  8699.  
  8700.    You must specify an assembler instruction template much like what
  8701. appears in a machine description, plus an operand constraint string for
  8702. each operand.
  8703.  
  8704.    For example, here is how to use the 68881's `fsinx' instruction:
  8705.  
  8706.      asm ("fsinx %1,%0" : "=f" (result) : "f" (angle));
  8707.  
  8708. Here `angle' is the C expression for the input operand while `result'
  8709. is that of the output operand.  Each has `"f"' as its operand
  8710. constraint, saying that a floating point register is required.  The `='
  8711. in `=f' indicates that the operand is an output; all output operands'
  8712. constraints must use `='.  The constraints use the same language used
  8713. in the machine description (*note Constraints::.).
  8714.  
  8715.    Each operand is described by an operand-constraint string followed
  8716. by the C expression in parentheses.  A colon separates the assembler
  8717. template from the first output operand, and another separates the last
  8718. output operand from the first input, if any.  Commas separate output
  8719. operands and separate inputs.  The total number of operands is limited
  8720. to ten or to the maximum number of operands in any instruction pattern
  8721. in the machine description, whichever is greater.
  8722.  
  8723.    If there are no output operands, and there are input operands, then
  8724. there must be two consecutive colons surrounding the place where the
  8725. output operands would go.
  8726.  
  8727.    Output operand expressions must be lvalues; the compiler can check
  8728. this.  The input operands need not be lvalues.  The compiler cannot
  8729. check whether the operands have data types that are reasonable for the
  8730. instruction being executed.  It does not parse the assembler
  8731. instruction template and does not know what it means, or whether it is
  8732. valid assembler input.  The extended `asm' feature is most often used
  8733. for machine instructions that the compiler itself does not know exist.
  8734. If the output expression cannot be directly addressed (for example, it
  8735. is a bit field), your constraint must allow a register.  In that case,
  8736. GNU CC will use the register as the output of the `asm', and then store
  8737. that register into the output.
  8738.  
  8739.    The output operands must be write-only; GNU CC will assume that the
  8740. values in these operands before the instruction are dead and need not be
  8741. generated.  Extended asm does not support input-output or read-write
  8742. operands.  For this reason, the constraint character `+', which
  8743. indicates such an operand, may not be used.
  8744.  
  8745.    When the assembler instruction has a read-write operand, or an
  8746. operand in which only some of the bits are to be changed, you must
  8747. logically split its function into two separate operands, one input
  8748. operand and one write-only output operand.  The connection between them
  8749. is expressed by constraints which say they need to be in the same
  8750. location when the instruction executes.  You can use the same C
  8751. expression for both operands, or different expressions.  For example,
  8752. here we write the (fictitious) `combine' instruction with `bar' as its
  8753. read-only source operand and `foo' as its read-write destination:
  8754.  
  8755.      asm ("combine %2,%0" : "=r" (foo) : "0" (foo), "g" (bar));
  8756.  
  8757. The constraint `"0"' for operand 1 says that it must occupy the same
  8758. location as operand 0.  A digit in constraint is allowed only in an
  8759. input operand, and it must refer to an output operand.
  8760.  
  8761.    Only a digit in the constraint can guarantee that one operand will
  8762. be in the same place as another.  The mere fact that `foo' is the value
  8763. of both operands is not enough to guarantee that they will be in the
  8764. same place in the generated assembler code.  The following would not
  8765. work:
  8766.  
  8767.      asm ("combine %2,%0" : "=r" (foo) : "r" (foo), "g" (bar));
  8768.  
  8769.    Various optimizations or reloading could cause operands 0 and 1 to
  8770. be in different registers; GNU CC knows no reason not to do so.  For
  8771. example, the compiler might find a copy of the value of `foo' in one
  8772. register and use it for operand 1, but generate the output operand 0 in
  8773. a different register (copying it afterward to `foo''s own address).  Of
  8774. course, since the register for operand 1 is not even mentioned in the
  8775. assembler code, the result will not work, but GNU CC can't tell that.
  8776.  
  8777.    Some instructions clobber specific hard registers.  To describe
  8778. this, write a third colon after the input operands, followed by the
  8779. names of the clobbered hard registers (given as strings).  Here is a
  8780. realistic example for the Vax:
  8781.  
  8782.      asm volatile ("movc3 %0,%1,%2"
  8783.                    : /* no outputs */
  8784.                    : "g" (from), "g" (to), "g" (count)
  8785.                    : "r0", "r1", "r2", "r3", "r4", "r5");
  8786.  
  8787.    If you refer to a particular hardware register from the assembler
  8788. code, then you will probably have to list the register after the third
  8789. colon to tell the compiler that the register's value is modified.  In
  8790. many assemblers, the register names begin with `%'; to produce one `%'
  8791. in the assembler code, you must write `%%' in the input.
  8792.  
  8793.    If your assembler instruction can alter the condition code register,
  8794. add `cc' to the list of clobbered registers.  GNU CC on some machines
  8795. represents the condition codes as a specific hardware register; `cc'
  8796. serves to name this register.  On other machines, the condition code is
  8797. handled differently, and specifying `cc' has no effect.  But it is
  8798. valid no matter what the machine.
  8799.  
  8800.    If your assembler instruction modifies memory in an unpredictable
  8801. fashion, add `memory' to the list of clobbered registers.  This will
  8802. cause GNU CC to not keep memory values cached in registers across the
  8803. assembler instruction.
  8804.  
  8805.    You can put multiple assembler instructions together in a single
  8806. `asm' template, separated either with newlines (written as `\n') or with
  8807. semicolons if the assembler allows such semicolons.  The GNU assembler
  8808. allows semicolons and all Unix assemblers seem to do so.  The input
  8809. operands are guaranteed not to use any of the clobbered registers, and
  8810. neither will the output operands' addresses, so you can read and write
  8811. the clobbered registers as many times as you like.  Here is an example
  8812. of multiple instructions in a template; it assumes that the subroutine
  8813. `_foo' accepts arguments in registers 9 and 10:
  8814.  
  8815.      asm ("movl %0,r9;movl %1,r10;call _foo"
  8816.           : /* no outputs */
  8817.           : "g" (from), "g" (to)
  8818.           : "r9", "r10");
  8819.  
  8820.    Unless an output operand has the `&' constraint modifier, GNU CC may
  8821. allocate it in the same register as an unrelated input operand, on the
  8822. assumption that the inputs are consumed before the outputs are produced.
  8823. This assumption may be false if the assembler code actually consists of
  8824. more than one instruction.  In such a case, use `&' for each output
  8825. operand that may not overlap an input.  *Note Modifiers::.
  8826.  
  8827.    If you want to test the condition code produced by an assembler
  8828. instruction, you must include a branch and a label in the `asm'
  8829. construct, as follows:
  8830.  
  8831.      asm ("clr %0;frob %1;beq 0f;mov #1,%0;0:"
  8832.           : "g" (result)
  8833.           : "g" (input));
  8834.  
  8835. This assumes your assembler supports local labels, as the GNU assembler
  8836. and most Unix assemblers do.
  8837.  
  8838.    Speaking of labels, jumps from one `asm' to another are not
  8839. supported.  The compiler's optimizers do not know about these jumps,
  8840. and therefore they cannot take account of them when deciding how to
  8841. optimize.
  8842.  
  8843.    Usually the most convenient way to use these `asm' instructions is to
  8844. encapsulate them in macros that look like functions.  For example,
  8845.  
  8846.      #define sin(x)       \
  8847.      ({ double __value, __arg = (x);   \
  8848.         asm ("fsinx %1,%0": "=f" (__value): "f" (__arg));  \
  8849.         __value; })
  8850.  
  8851. Here the variable `__arg' is used to make sure that the instruction
  8852. operates on a proper `double' value, and to accept only those arguments
  8853. `x' which can convert automatically to a `double'.
  8854.  
  8855.    Another way to make sure the instruction operates on the correct
  8856. data type is to use a cast in the `asm'.  This is different from using a
  8857. variable `__arg' in that it converts more different types.  For
  8858. example, if the desired type were `int', casting the argument to `int'
  8859. would accept a pointer with no complaint, while assigning the argument
  8860. to an `int' variable named `__arg' would warn about using a pointer
  8861. unless the caller explicitly casts it.
  8862.  
  8863.    If an `asm' has output operands, GNU CC assumes for optimization
  8864. purposes that the instruction has no side effects except to change the
  8865. output operands.  This does not mean that instructions with a side
  8866. effect cannot be used, but you must be careful, because the compiler
  8867. may eliminate them if the output operands aren't used, or move them out
  8868. of loops, or replace two with one if they constitute a common
  8869. subexpression.  Also, if your instruction does have a side effect on a
  8870. variable that otherwise appears not to change, the old value of the
  8871. variable may be reused later if it happens to be found in a register.
  8872.  
  8873.    You can prevent an `asm' instruction from being deleted, moved
  8874. significantly, or combined, by writing the keyword `volatile' after the
  8875. `asm'.  For example:
  8876.  
  8877.      #define set_priority(x)  \
  8878.      asm volatile ("set_priority %0": /* no outputs */ : "g" (x))
  8879.  
  8880. An instruction without output operands will not be deleted or moved
  8881. significantly, regardless, unless it is unreachable.
  8882.  
  8883.    Note that even a volatile `asm' instruction can be moved in ways
  8884. that appear insignificant to the compiler, such as across jump
  8885. instructions.  You can't expect a sequence of volatile `asm'
  8886. instructions to remain perfectly consecutive.  If you want consecutive
  8887. output, use a single `asm'.
  8888.  
  8889.    It is a natural idea to look for a way to give access to the
  8890. condition code left by the assembler instruction.  However, when we
  8891. attempted to implement this, we found no way to make it work reliably.
  8892. The problem is that output operands might need reloading, which would
  8893. result in additional following "store" instructions.  On most machines,
  8894. these instructions would alter the condition code before there was time
  8895. to test it.  This problem doesn't arise for ordinary "test" and
  8896. "compare" instructions because they don't have any output operands.
  8897.  
  8898.    If you are writing a header file that should be includable in ANSI C
  8899. programs, write `__asm__' instead of `asm'.  *Note Alternate Keywords::.
  8900.  
  8901. 
  8902. File: use,  Node: Constraints,  Next: Asm Labels,  Prev: Extended Asm,  Up: C Extensions
  8903.  
  8904. Constraints for `asm' Operands
  8905. ==============================
  8906.  
  8907.    Here are specific details on what constraint letters you can use with
  8908. `asm' operands.  Constraints can say whether an operand may be in a
  8909. register, and which kinds of register; whether the operand can be a
  8910. memory reference, and which kinds of address; whether the operand may
  8911. be an immediate constant, and which possible values it may have.
  8912. Constraints can also require two operands to match.
  8913.  
  8914. * Menu:
  8915.  
  8916. * Simple Constraints::  Basic use of constraints.
  8917. * Multi-Alternative::   When an insn has two alternative constraint-patterns.
  8918. * Modifiers::           More precise control over effects of constraints.
  8919. * Machine Constraints:: Special constraints for some particular machines.
  8920.  
  8921. 
  8922. File: use,  Node: Simple Constraints,  Next: Multi-Alternative,  Up: Constraints
  8923.  
  8924. Simple Constraints
  8925. ------------------
  8926.  
  8927.    The simplest kind of constraint is a string full of letters, each of
  8928. which describes one kind of operand that is permitted.  Here are the
  8929. letters that are allowed:
  8930.  
  8931. `m'
  8932.      A memory operand is allowed, with any kind of address that the
  8933.      machine supports in general.
  8934.  
  8935. `o'
  8936.      A memory operand is allowed, but only if the address is
  8937.      "offsettable".  This means that adding a small integer (actually,
  8938.      the width in bytes of the operand, as determined by its machine
  8939.      mode) may be added to the address and the result is also a valid
  8940.      memory address.
  8941.  
  8942.      For example, an address which is constant is offsettable; so is an
  8943.      address that is the sum of a register and a constant (as long as a
  8944.      slightly larger constant is also within the range of
  8945.      address-offsets supported by the machine); but an autoincrement or
  8946.      autodecrement address is not offsettable.  More complicated
  8947.      indirect/indexed addresses may or may not be offsettable depending
  8948.      on the other addressing modes that the machine supports.
  8949.  
  8950.      Note that in an output operand which can be matched by another
  8951.      operand, the constraint letter `o' is valid only when accompanied
  8952.      by both `<' (if the target machine has predecrement addressing)
  8953.      and `>' (if the target machine has preincrement addressing).
  8954.  
  8955. `V'
  8956.      A memory operand that is not offsettable.  In other words,
  8957.      anything that would fit the `m' constraint but not the `o'
  8958.      constraint.
  8959.  
  8960. `<'
  8961.      A memory operand with autodecrement addressing (either
  8962.      predecrement or postdecrement) is allowed.
  8963.  
  8964. `>'
  8965.      A memory operand with autoincrement addressing (either
  8966.      preincrement or postincrement) is allowed.
  8967.  
  8968. `r'
  8969.      A register operand is allowed provided that it is in a general
  8970.      register.
  8971.  
  8972. `d', `a', `f', ...
  8973.      Other letters can be defined in machine-dependent fashion to stand
  8974.      for particular classes of registers.  `d', `a' and `f' are defined
  8975.      on the 68000/68020 to stand for data, address and floating point
  8976.      registers.
  8977.  
  8978. `i'
  8979.      An immediate integer operand (one with constant value) is allowed.
  8980.      This includes symbolic constants whose values will be known only at
  8981.      assembly time.
  8982.  
  8983. `n'
  8984.      An immediate integer operand with a known numeric value is allowed.
  8985.      Many systems cannot support assembly-time constants for operands
  8986.      less than a word wide.  Constraints for these operands should use
  8987.      `n' rather than `i'.
  8988.  
  8989. `I', `J', `K', ... `P'
  8990.      Other letters in the range `I' through `P' may be defined in a
  8991.      machine-dependent fashion to permit immediate integer operands with
  8992.      explicit integer values in specified ranges.  For example, on the
  8993.      68000, `I' is defined to stand for the range of values 1 to 8.
  8994.      This is the range permitted as a shift count in the shift
  8995.      instructions.
  8996.  
  8997. `E'
  8998.      An immediate floating operand (expression code `const_double') is
  8999.      allowed, but only if the target floating point format is the same
  9000.      as that of the host machine (on which the compiler is running).
  9001.  
  9002. `F'
  9003.      An immediate floating operand (expression code `const_double') is
  9004.      allowed.
  9005.  
  9006. `G', `H'
  9007.      `G' and `H' may be defined in a machine-dependent fashion to
  9008.      permit immediate floating operands in particular ranges of values.
  9009.  
  9010. `s'
  9011.      An immediate integer operand whose value is not an explicit
  9012.      integer is allowed.
  9013.  
  9014.      This might appear strange; if an insn allows a constant operand
  9015.      with a value not known at compile time, it certainly must allow
  9016.      any known value.  So why use `s' instead of `i'?  Sometimes it
  9017.      allows better code to be generated.
  9018.  
  9019.      For example, on the 68000 in a fullword instruction it is possible
  9020.      to use an immediate operand; but if the immediate value is between
  9021.      -128 and 127, better code results from loading the value into a
  9022.      register and using the register.  This is because the load into
  9023.      the register can be done with a `moveq' instruction.  We arrange
  9024.      for this to happen by defining the letter `K' to mean "any integer
  9025.      outside the range -128 to 127", and then specifying `Ks' in the
  9026.      operand constraints.
  9027.  
  9028. `g'
  9029.      Any register, memory or immediate integer operand is allowed,
  9030.      except for registers that are not general registers.
  9031.  
  9032. `X'
  9033.      Any operand whatsoever is allowed.
  9034.  
  9035. `0', `1', `2', ... `9'
  9036.      An operand that matches the specified operand number is allowed.
  9037.      If a digit is used together with letters within the same
  9038.      alternative, the digit should come last.
  9039.  
  9040.      This is called a "matching constraint" and what it really means is
  9041.      that the assembler has only a single operand that fills two roles
  9042.      which `asm' distinguishes.  For example, an add instruction uses
  9043.      two input operands and an output operand, but on most CISC
  9044.      machines an add instruction really has only two operands, one of
  9045.      them an input-output operand:
  9046.  
  9047.           addl #35,r12
  9048.  
  9049.      Matching constraints are used in these circumstances.  More
  9050.      precisely, the two operands that match must include one input-only
  9051.      operand and one output-only operand.  Moreover, the digit must be a
  9052.      smaller number than the number of the operand that uses it in the
  9053.      constraint.
  9054.  
  9055. `p'
  9056.      An operand that is a valid memory address is allowed.  This is for
  9057.      "load address" and "push address" instructions.
  9058.  
  9059.      `p' in the constraint must be accompanied by `address_operand' as
  9060.      the predicate in the `match_operand'.  This predicate interprets
  9061.      the mode specified in the `match_operand' as the mode of the memory
  9062.      reference for which the address would be valid.
  9063.  
  9064. `Q', `R', `S', ... `U'
  9065.      Letters in the range `Q' through `U' may be defined in a
  9066.      machine-dependent fashion to stand for arbitrary operand types.
  9067.  
  9068. 
  9069. File: use,  Node: Multi-Alternative,  Next: Modifiers,  Prev: Simple Constraints,  Up: Constraints
  9070.  
  9071. Multiple Alternative Constraints
  9072. --------------------------------
  9073.  
  9074.    Sometimes a single instruction has multiple alternative sets of
  9075. possible operands.  For example, on the 68000, a logical-or instruction
  9076. can combine register or an immediate value into memory, or it can
  9077. combine any kind of operand into a register; but it cannot combine one
  9078. memory location into another.
  9079.  
  9080.    These constraints are represented as multiple alternatives.  An
  9081. alternative can be described by a series of letters for each operand.
  9082. The overall constraint for an operand is made from the letters for this
  9083. operand from the first alternative, a comma, the letters for this
  9084. operand from the second alternative, a comma, and so on until the last
  9085. alternative.
  9086.  
  9087.    If all the operands fit any one alternative, the instruction is
  9088. valid.  Otherwise, for each alternative, the compiler counts how many
  9089. instructions must be added to copy the operands so that that
  9090. alternative applies.  The alternative requiring the least copying is
  9091. chosen.  If two alternatives need the same amount of copying, the one
  9092. that comes first is chosen.  These choices can be altered with the `?'
  9093. and `!' characters:
  9094.  
  9095. `?'
  9096.      Disparage slightly the alternative that the `?' appears in, as a
  9097.      choice when no alternative applies exactly.  The compiler regards
  9098.      this alternative as one unit more costly for each `?' that appears
  9099.      in it.
  9100.  
  9101. `!'
  9102.      Disparage severely the alternative that the `!' appears in.  This
  9103.      alternative can still be used if it fits without reloading, but if
  9104.      reloading is needed, some other alternative will be used.
  9105.  
  9106. 
  9107. File: use,  Node: Modifiers,  Next: Machine Constraints,  Prev: Multi-Alternative,  Up: Constraints
  9108.  
  9109. Constraint Modifier Characters
  9110. ------------------------------
  9111.  
  9112.    Here are constraint modifier characters.
  9113.  
  9114. `='
  9115.      Means that this operand is write-only for this instruction: the
  9116.      previous value is discarded and replaced by output data.
  9117.  
  9118. `+'
  9119.      Means that this operand is both read and written by the
  9120.      instruction.
  9121.  
  9122.      When the compiler fixes up the operands to satisfy the constraints,
  9123.      it needs to know which operands are inputs to the instruction and
  9124.      which are outputs from it.  `=' identifies an output; `+'
  9125.      identifies an operand that is both input and output; all other
  9126.      operands are assumed to be input only.
  9127.  
  9128. `&'
  9129.      Means (in a particular alternative) that this operand is written
  9130.      before the instruction is finished using the input operands.
  9131.      Therefore, this operand may not lie in a register that is used as
  9132.      an input operand or as part of any memory address.
  9133.  
  9134.      `&' applies only to the alternative in which it is written.  In
  9135.      constraints with multiple alternatives, sometimes one alternative
  9136.      requires `&' while others do not.  See, for example, the `movdf'
  9137.      insn of the 68000.
  9138.  
  9139.      `&' does not obviate the need to write `='.
  9140.  
  9141. `%'
  9142.      Declares the instruction to be commutative for this operand and the
  9143.      following operand.  This means that the compiler may interchange
  9144.      the two operands if that is the cheapest way to make all operands
  9145.      fit the constraints.
  9146.  
  9147. `#'
  9148.      Says that all following characters, up to the next comma, are to be
  9149.      ignored as a constraint.  They are significant only for choosing
  9150.      register preferences.
  9151.  
  9152. 
  9153. File: use,  Node: Machine Constraints,  Prev: Modifiers,  Up: Constraints
  9154.  
  9155. Constraints for Particular Machines
  9156. -----------------------------------
  9157.  
  9158.    Whenever possible, you should use the general-purpose constraint
  9159. letters in `asm' arguments, since they will convey meaning more readily
  9160. to people reading your code.  Failing that, use the constraint letters
  9161. that usually have very similar meanings across architectures.  The most
  9162. commonly used constraints are `m' and `r' (for memory and
  9163. general-purpose registers respectively; *note Simple Constraints::.),
  9164. and `I', usually the letter indicating the most common
  9165. immediate-constant format.
  9166.  
  9167.    For each machine architecture, the `config/MACHINE.h' file defines
  9168. additional constraints.  These constraints are used by the compiler
  9169. itself for instruction generation, as well as for `asm' statements;
  9170. therefore, some of the constraints are not particularly interesting for
  9171. `asm'.  The constraints are defined through these macros:
  9172.  
  9173. `REG_CLASS_FROM_LETTER'
  9174.      Register class constraints (usually lower case).
  9175.  
  9176. `CONST_OK_FOR_LETTER_P'
  9177.      Immediate constant constraints, for non-floating point constants of
  9178.      word size or smaller precision (usually upper case).
  9179.  
  9180. `CONST_DOUBLE_OK_FOR_LETTER_P'
  9181.      Immediate constant constraints, for all floating point constants
  9182.      and for constants of greater than word size precision (usually
  9183.      upper case).
  9184.  
  9185. `EXTRA_CONSTRAINT'
  9186.      Special cases of registers or memory.  This macro is not required,
  9187.      and is only defined for some machines.
  9188.  
  9189.    Inspecting these macro definitions in the compiler source for your
  9190. machine is the best way to be certain you have the right constraints.
  9191. However, here is a summary of the machine-dependent constraints
  9192. available on some particular machines.
  9193.  
  9194. *ARM family--`arm.h'*
  9195.     `f'
  9196.           Floating-point register
  9197.  
  9198.     `F'
  9199.           One of the floating-point constants 0.0, 0.5, 1.0, 2.0, 3.0,
  9200.           4.0, 5.0 or 10.0
  9201.  
  9202.     `G'
  9203.           Floating-point constant that would satisfy the constraint `F'
  9204.           if it were negated
  9205.  
  9206.     `I'
  9207.           Integer that is valid as an immediate operand in a data
  9208.           processing instruction.  That is, an integer in the range 0
  9209.           to 255 rotated by a multiple of 2
  9210.  
  9211.     `J'
  9212.           Integer in the range -4095 to 4095
  9213.  
  9214.     `K'
  9215.           Integer that satisfies constraint `I' when inverted (ones
  9216.           complement)
  9217.  
  9218.     `L'
  9219.           Integer that satisfies constraint `I' when negated (twos
  9220.           complement)
  9221.  
  9222.     `M'
  9223.           Integer in the range 0 to 32
  9224.  
  9225.     `Q'
  9226.           A memory reference where the exact address is in a single
  9227.           register (``m'' is preferable for `asm' statements)
  9228.  
  9229.     `R'
  9230.           An item in the constant pool
  9231.  
  9232.     `S'
  9233.           A symbol in the text segment of the current file
  9234.  
  9235. *AMD 29000 family--`a29k.h'*
  9236.     `l'
  9237.           Local register 0
  9238.  
  9239.     `b'
  9240.           Byte Pointer (`BP') register
  9241.  
  9242.     `q'
  9243.           `Q' register
  9244.  
  9245.     `h'
  9246.           Special purpose register
  9247.  
  9248.     `A'
  9249.           First accumulator register
  9250.  
  9251.     `a'
  9252.           Other accumulator register
  9253.  
  9254.     `f'
  9255.           Floating point register
  9256.  
  9257.     `I'
  9258.           Constant greater than 0, less than 0x100
  9259.  
  9260.     `J'
  9261.           Constant greater than 0, less than 0x10000
  9262.  
  9263.     `K'
  9264.           Constant whose high 24 bits are on (1)
  9265.  
  9266.     `L'
  9267.           16 bit constant whose high 8 bits are on (1)
  9268.  
  9269.     `M'
  9270.           32 bit constant whose high 16 bits are on (1)
  9271.  
  9272.     `N'
  9273.           32 bit negative constant that fits in 8 bits
  9274.  
  9275.     `O'
  9276.           The constant 0x80000000 or, on the 29050, any 32 bit constant
  9277.           whose low 16 bits are 0.
  9278.  
  9279.     `P'
  9280.           16 bit negative constant that fits in 8 bits
  9281.  
  9282.     `G'
  9283.     `H'
  9284.           A floating point constant (in `asm' statements, use the
  9285.           machine independent `E' or `F' instead)
  9286.  
  9287. *IBM RS6000--`rs6000.h'*
  9288.     `b'
  9289.           Address base register
  9290.  
  9291.     `f'
  9292.           Floating point register
  9293.  
  9294.     `h'
  9295.           `MQ', `CTR', or `LINK' register
  9296.  
  9297.     `q'
  9298.           `MQ' register
  9299.  
  9300.     `c'
  9301.           `CTR' register
  9302.  
  9303.     `l'
  9304.           `LINK' register
  9305.  
  9306.     `x'
  9307.           `CR' register (condition register) number 0
  9308.  
  9309.     `y'
  9310.           `CR' register (condition register)
  9311.  
  9312.     `I'
  9313.           Signed 16 bit constant
  9314.  
  9315.     `J'
  9316.           Constant whose low 16 bits are 0
  9317.  
  9318.     `K'
  9319.           Constant whose high 16 bits are 0
  9320.  
  9321.     `L'
  9322.           Constant suitable as a mask operand
  9323.  
  9324.     `M'
  9325.           Constant larger than 31
  9326.  
  9327.     `N'
  9328.           Exact power of 2
  9329.  
  9330.     `O'
  9331.           Zero
  9332.  
  9333.     `P'
  9334.           Constant whose negation is a signed 16 bit constant
  9335.  
  9336.     `G'
  9337.           Floating point constant that can be loaded into a register
  9338.           with one instruction per word
  9339.  
  9340.     `Q'
  9341.           Memory operand that is an offset from a register (`m' is
  9342.           preferable for `asm' statements)
  9343.  
  9344. *Intel 386--`i386.h'*
  9345.     `q'
  9346.           `a', `b', `c', or `d' register
  9347.  
  9348.     `A'
  9349.           `a', or `d' register (for 64-bit ints)
  9350.  
  9351.     `f'
  9352.           Floating point register
  9353.  
  9354.     `t'
  9355.           First (top of stack) floating point register
  9356.  
  9357.     `u'
  9358.           Second floating point register
  9359.  
  9360.     `a'
  9361.           `a' register
  9362.  
  9363.     `b'
  9364.           `b' register
  9365.  
  9366.     `c'
  9367.           `c' register
  9368.  
  9369.     `d'
  9370.           `d' register
  9371.  
  9372.     `D'
  9373.           `di' register
  9374.  
  9375.     `S'
  9376.           `si' register
  9377.  
  9378.     `I'
  9379.           Constant in range 0 to 31 (for 32 bit shifts)
  9380.  
  9381.     `J'
  9382.           Constant in range 0 to 63 (for 64 bit shifts)
  9383.  
  9384.     `K'
  9385.           `0xff'
  9386.  
  9387.     `L'
  9388.           `0xffff'
  9389.  
  9390.     `M'
  9391.           0, 1, 2, or 3 (shifts for `lea' instruction)
  9392.  
  9393.     `G'
  9394.           Standard 80387 floating point constant
  9395.  
  9396. *Intel 960--`i960.h'*
  9397.     `f'
  9398.           Floating point register (`fp0' to `fp3')
  9399.  
  9400.     `l'
  9401.           Local register (`r0' to `r15')
  9402.  
  9403.     `b'
  9404.           Global register (`g0' to `g15')
  9405.  
  9406.     `d'
  9407.           Any local or global register
  9408.  
  9409.     `I'
  9410.           Integers from 0 to 31
  9411.  
  9412.     `J'
  9413.           0
  9414.  
  9415.     `K'
  9416.           Integers from -31 to 0
  9417.  
  9418.     `G'
  9419.           Floating point 0
  9420.  
  9421.     `H'
  9422.           Floating point 1
  9423.  
  9424. *MIPS--`mips.h'*
  9425.     `d'
  9426.           General-purpose integer register
  9427.  
  9428.     `f'
  9429.           Floating-point register (if available)
  9430.  
  9431.     `h'
  9432.           `Hi' register
  9433.  
  9434.     `l'
  9435.           `Lo' register
  9436.  
  9437.     `x'
  9438.           `Hi' or `Lo' register
  9439.  
  9440.     `y'
  9441.           General-purpose integer register
  9442.  
  9443.     `z'
  9444.           Floating-point status register
  9445.  
  9446.     `I'
  9447.           Signed 16 bit constant (for arithmetic instructions)
  9448.  
  9449.     `J'
  9450.           Zero
  9451.  
  9452.     `K'
  9453.           Zero-extended 16-bit constant (for logic instructions)
  9454.  
  9455.     `L'
  9456.           Constant with low 16 bits zero (can be loaded with `lui')
  9457.  
  9458.     `M'
  9459.           32 bit constant which requires two instructions to load (a
  9460.           constant which is not `I', `K', or `L')
  9461.  
  9462.     `N'
  9463.           Negative 16 bit constant
  9464.  
  9465.     `O'
  9466.           Exact power of two
  9467.  
  9468.     `P'
  9469.           Positive 16 bit constant
  9470.  
  9471.     `G'
  9472.           Floating point zero
  9473.  
  9474.     `Q'
  9475.           Memory reference that can be loaded with more than one
  9476.           instruction (`m' is preferable for `asm' statements)
  9477.  
  9478.     `R'
  9479.           Memory reference that can be loaded with one instruction (`m'
  9480.           is preferable for `asm' statements)
  9481.  
  9482.     `S'
  9483.           Memory reference in external OSF/rose PIC format (`m' is
  9484.           preferable for `asm' statements)
  9485.  
  9486. *Motorola 680x0--`m68k.h'*
  9487.     `a'
  9488.           Address register
  9489.  
  9490.     `d'
  9491.           Data register
  9492.  
  9493.     `f'
  9494.           68881 floating-point register, if available
  9495.  
  9496.     `x'
  9497.           Sun FPA (floating-point) register, if available
  9498.  
  9499.     `y'
  9500.           First 16 Sun FPA registers, if available
  9501.  
  9502.     `I'
  9503.           Integer in the range 1 to 8
  9504.  
  9505.     `J'
  9506.           16 bit signed number
  9507.  
  9508.     `K'
  9509.           Signed number whose magnitude is greater than 0x80
  9510.  
  9511.     `L'
  9512.           Integer in the range -8 to -1
  9513.  
  9514.     `G'
  9515.           Floating point constant that is not a 68881 constant
  9516.  
  9517.     `H'
  9518.           Floating point constant that can be used by Sun FPA
  9519.  
  9520. *SPARC--`sparc.h'*
  9521.     `f'
  9522.           Floating-point register
  9523.  
  9524.     `I'
  9525.           Signed 13 bit constant
  9526.  
  9527.     `J'
  9528.           Zero
  9529.  
  9530.     `K'
  9531.           32 bit constant with the low 12 bits clear (a constant that
  9532.           can be loaded with the `sethi' instruction)
  9533.  
  9534.     `G'
  9535.           Floating-point zero
  9536.  
  9537.     `H'
  9538.           Signed 13 bit constant, sign-extended to 32 or 64 bits
  9539.  
  9540.     `Q'
  9541.           Memory reference that can be loaded with one instruction
  9542.           (`m' is more appropriate for `asm' statements)
  9543.  
  9544.     `S'
  9545.           Constant, or memory address
  9546.  
  9547.     `T'
  9548.           Memory address aligned to an 8-byte boundary
  9549.  
  9550.     `U'
  9551.           Even register
  9552.  
  9553. 
  9554. File: use,  Node: Asm Labels,  Next: Explicit Reg Vars,  Prev: Constraints,  Up: C Extensions
  9555.  
  9556. Controlling Names Used in Assembler Code
  9557. ========================================
  9558.  
  9559.    You can specify the name to be used in the assembler code for a C
  9560. function or variable by writing the `asm' (or `__asm__') keyword after
  9561. the declarator as follows:
  9562.  
  9563.      int foo asm ("myfoo") = 2;
  9564.  
  9565. This specifies that the name to be used for the variable `foo' in the
  9566. assembler code should be `myfoo' rather than the usual `_foo'.
  9567.  
  9568.    On systems where an underscore is normally prepended to the name of
  9569. a C function or variable, this feature allows you to define names for
  9570. the linker that do not start with an underscore.
  9571.  
  9572.    You cannot use `asm' in this way in a function *definition*; but you
  9573. can get the same effect by writing a declaration for the function
  9574. before its definition and putting `asm' there, like this:
  9575.  
  9576.      extern func () asm ("FUNC");
  9577.      
  9578.      func (x, y)
  9579.           int x, y;
  9580.      ...
  9581.  
  9582.    It is up to you to make sure that the assembler names you choose do
  9583. not conflict with any other assembler symbols.  Also, you must not use a
  9584. register name; that would produce completely invalid assembler code.
  9585. GNU CC does not as yet have the ability to store static variables in
  9586. registers.  Perhaps that will be added.
  9587.  
  9588. 
  9589. File: use,  Node: Explicit Reg Vars,  Next: Alternate Keywords,  Prev: Asm Labels,  Up: C Extensions
  9590.  
  9591. Variables in Specified Registers
  9592. ================================
  9593.  
  9594.    GNU C allows you to put a few global variables into specified
  9595. hardware registers.  You can also specify the register in which an
  9596. ordinary register variable should be allocated.
  9597.  
  9598.    * Global register variables reserve registers throughout the program.
  9599.      This may be useful in programs such as programming language
  9600.      interpreters which have a couple of global variables that are
  9601.      accessed very often.
  9602.  
  9603.    * Local register variables in specific registers do not reserve the
  9604.      registers.  The compiler's data flow analysis is capable of
  9605.      determining where the specified registers contain live values, and
  9606.      where they are available for other uses.
  9607.  
  9608.      These local variables are sometimes convenient for use with the
  9609.      extended `asm' feature (*note Extended Asm::.), if you want to
  9610.      write one output of the assembler instruction directly into a
  9611.      particular register.  (This will work provided the register you
  9612.      specify fits the constraints specified for that operand in the
  9613.      `asm'.)
  9614.  
  9615. * Menu:
  9616.  
  9617. * Global Reg Vars::
  9618. * Local Reg Vars::
  9619.  
  9620. 
  9621. File: use,  Node: Global Reg Vars,  Next: Local Reg Vars,  Up: Explicit Reg Vars
  9622.  
  9623. Defining Global Register Variables
  9624. ----------------------------------
  9625.  
  9626.    You can define a global register variable in GNU C like this:
  9627.  
  9628.      register int *foo asm ("a5");
  9629.  
  9630. Here `a5' is the name of the register which should be used.  Choose a
  9631. register which is normally saved and restored by function calls on your
  9632. machine, so that library routines will not clobber it.
  9633.  
  9634.    Naturally the register name is cpu-dependent, so you would need to
  9635. conditionalize your program according to cpu type.  The register `a5'
  9636. would be a good choice on a 68000 for a variable of pointer type.  On
  9637. machines with register windows, be sure to choose a "global" register
  9638. that is not affected magically by the function call mechanism.
  9639.  
  9640.    In addition, operating systems on one type of cpu may differ in how
  9641. they name the registers; then you would need additional conditionals.
  9642. For example, some 68000 operating systems call this register `%a5'.
  9643.  
  9644.    Eventually there may be a way of asking the compiler to choose a
  9645. register automatically, but first we need to figure out how it should
  9646. choose and how to enable you to guide the choice.  No solution is
  9647. evident.
  9648.  
  9649.    Defining a global register variable in a certain register reserves
  9650. that register entirely for this use, at least within the current
  9651. compilation.  The register will not be allocated for any other purpose
  9652. in the functions in the current compilation.  The register will not be
  9653. saved and restored by these functions.  Stores into this register are
  9654. never deleted even if they would appear to be dead, but references may
  9655. be deleted or moved or simplified.
  9656.  
  9657.    It is not safe to access the global register variables from signal
  9658. handlers, or from more than one thread of control, because the system
  9659. library routines may temporarily use the register for other things
  9660. (unless you recompile them specially for the task at hand).
  9661.  
  9662.    It is not safe for one function that uses a global register variable
  9663. to call another such function `foo' by way of a third function `lose'
  9664. that was compiled without knowledge of this variable (i.e. in a
  9665. different source file in which the variable wasn't declared).  This is
  9666. because `lose' might save the register and put some other value there.
  9667. For example, you can't expect a global register variable to be
  9668. available in the comparison-function that you pass to `qsort', since
  9669. `qsort' might have put something else in that register.  (If you are
  9670. prepared to recompile `qsort' with the same global register variable,
  9671. you can solve this problem.)
  9672.  
  9673.    If you want to recompile `qsort' or other source files which do not
  9674. actually use your global register variable, so that they will not use
  9675. that register for any other purpose, then it suffices to specify the
  9676. compiler option `-ffixed-REG'.  You need not actually add a global
  9677. register declaration to their source code.
  9678.  
  9679.    A function which can alter the value of a global register variable
  9680. cannot safely be called from a function compiled without this variable,
  9681. because it could clobber the value the caller expects to find there on
  9682. return.  Therefore, the function which is the entry point into the part
  9683. of the program that uses the global register variable must explicitly
  9684. save and restore the value which belongs to its caller.
  9685.  
  9686.    On most machines, `longjmp' will restore to each global register
  9687. variable the value it had at the time of the `setjmp'.  On some
  9688. machines, however, `longjmp' will not change the value of global
  9689. register variables.  To be portable, the function that called `setjmp'
  9690. should make other arrangements to save the values of the global register
  9691. variables, and to restore them in a `longjmp'.  This way, the same
  9692. thing will happen regardless of what `longjmp' does.
  9693.  
  9694.    All global register variable declarations must precede all function
  9695. definitions.  If such a declaration could appear after function
  9696. definitions, the declaration would be too late to prevent the register
  9697. from being used for other purposes in the preceding functions.
  9698.  
  9699.    Global register variables may not have initial values, because an
  9700. executable file has no means to supply initial contents for a register.
  9701.  
  9702.    On the Sparc, there are reports that g3 ... g7 are suitable
  9703. registers, but certain library functions, such as `getwd', as well as
  9704. the subroutines for division and remainder, modify g3 and g4.  g1 and
  9705. g2 are local temporaries.
  9706.  
  9707.    On the 68000, a2 ... a5 should be suitable, as should d2 ... d7.  Of
  9708. course, it will not do to use more than a few of those.
  9709.  
  9710. 
  9711. File: use,  Node: Local Reg Vars,  Prev: Global Reg Vars,  Up: Explicit Reg Vars
  9712.  
  9713. Specifying Registers for Local Variables
  9714. ----------------------------------------
  9715.  
  9716.    You can define a local register variable with a specified register
  9717. like this:
  9718.  
  9719.      register int *foo asm ("a5");
  9720.  
  9721. Here `a5' is the name of the register which should be used.  Note that
  9722. this is the same syntax used for defining global register variables,
  9723. but for a local variable it would appear within a function.
  9724.  
  9725.    Naturally the register name is cpu-dependent, but this is not a
  9726. problem, since specific registers are most often useful with explicit
  9727. assembler instructions (*note Extended Asm::.).  Both of these things
  9728. generally require that you conditionalize your program according to cpu
  9729. type.
  9730.  
  9731.    In addition, operating systems on one type of cpu may differ in how
  9732. they name the registers; then you would need additional conditionals.
  9733. For example, some 68000 operating systems call this register `%a5'.
  9734.  
  9735.    Eventually there may be a way of asking the compiler to choose a
  9736. register automatically, but first we need to figure out how it should
  9737. choose and how to enable you to guide the choice.  No solution is
  9738. evident.
  9739.  
  9740.    Defining such a register variable does not reserve the register; it
  9741. remains available for other uses in places where flow control determines
  9742. the variable's value is not live.  However, these registers are made
  9743. unavailable for use in the reload pass.  I would not be surprised if
  9744. excessive use of this feature leaves the compiler too few available
  9745. registers to compile certain functions.
  9746.  
  9747. 
  9748. File: use,  Node: Alternate Keywords,  Next: Incomplete Enums,  Prev: Explicit Reg Vars,  Up: C Extensions
  9749.  
  9750. Alternate Keywords
  9751. ==================
  9752.  
  9753.    The option `-traditional' disables certain keywords; `-ansi'
  9754. disables certain others.  This causes trouble when you want to use GNU C
  9755. extensions, or ANSI C features, in a general-purpose header file that
  9756. should be usable by all programs, including ANSI C programs and
  9757. traditional ones.  The keywords `asm', `typeof' and `inline' cannot be
  9758. used since they won't work in a program compiled with `-ansi', while
  9759. the keywords `const', `volatile', `signed', `typeof' and `inline' won't
  9760. work in a program compiled with `-traditional'.
  9761.  
  9762.    The way to solve these problems is to put `__' at the beginning and
  9763. end of each problematical keyword.  For example, use `__asm__' instead
  9764. of `asm', `__const__' instead of `const', and `__inline__' instead of
  9765. `inline'.
  9766.  
  9767.    Other C compilers won't accept these alternative keywords; if you
  9768. want to compile with another compiler, you can define the alternate
  9769. keywords as macros to replace them with the customary keywords.  It
  9770. looks like this:
  9771.  
  9772.      #ifndef __GNUC__
  9773.      #define __asm__ asm
  9774.      #endif
  9775.  
  9776.    `-pedantic' causes warnings for many GNU C extensions.  You can
  9777. prevent such warnings within one expression by writing `__extension__'
  9778. before the expression.  `__extension__' has no effect aside from this.
  9779.  
  9780. 
  9781. File: use,  Node: Incomplete Enums,  Next: Function Names,  Prev: Alternate Keywords,  Up: C Extensions
  9782.  
  9783. Incomplete `enum' Types
  9784. =======================
  9785.  
  9786.    You can define an `enum' tag without specifying its possible values.
  9787. This results in an incomplete type, much like what you get if you write
  9788. `struct foo' without describing the elements.  A later declaration
  9789. which does specify the possible values completes the type.
  9790.  
  9791.    You can't allocate variables or storage using the type while it is
  9792. incomplete.  However, you can work with pointers to that type.
  9793.  
  9794.    This extension may not be very useful, but it makes the handling of
  9795. `enum' more consistent with the way `struct' and `union' are handled.
  9796.  
  9797.    This extension is not supported by GNU C++.
  9798.  
  9799. 
  9800. File: use,  Node: Function Names,  Prev: Incomplete Enums,  Up: C Extensions
  9801.  
  9802. Function Names as Strings
  9803. =========================
  9804.  
  9805.    GNU CC predefines two string variables to be the name of the current
  9806. function.  The variable `__FUNCTION__' is the name of the function as
  9807. it appears in the source.  The variable `__PRETTY_FUNCTION__' is the
  9808. name of the function pretty printed in a language specific fashion.
  9809.  
  9810.    These names are always the same in a C function, but in a C++
  9811. function they may be different.  For example, this program:
  9812.  
  9813.      extern "C" {
  9814.      extern int printf (char *, ...);
  9815.      }
  9816.      
  9817.      class a {
  9818.       public:
  9819.        sub (int i)
  9820.          {
  9821.            printf ("__FUNCTION__ = %s\n", __FUNCTION__);
  9822.            printf ("__PRETTY_FUNCTION__ = %s\n", __PRETTY_FUNCTION__);
  9823.          }
  9824.      };
  9825.      
  9826.      int
  9827.      main (void)
  9828.      {
  9829.        a ax;
  9830.        ax.sub (0);
  9831.        return 0;
  9832.      }
  9833.  
  9834. gives this output:
  9835.  
  9836.      __FUNCTION__ = sub
  9837.      __PRETTY_FUNCTION__ = int  a::sub (int)
  9838.  
  9839. 
  9840. File: use,  Node: C++ Extensions,  Next: Trouble,  Prev: C Extensions,  Up: Top
  9841.  
  9842. Extensions to the C++ Language
  9843. ******************************
  9844.  
  9845.    The GNU compiler provides these extensions to the C++ language (and
  9846. you can also use most of the C language extensions in your C++
  9847. programs).  If you want to write code that checks whether these
  9848. features are available, you can test for the GNU compiler the same way
  9849. as for C programs: check for a predefined macro `__GNUC__'.  You can
  9850. also use `__GNUG__' to test specifically for GNU C++ (*note Standard
  9851. Predefined Macros: (cpp.info)Standard Predefined.).
  9852.  
  9853. * Menu:
  9854.  
  9855. * Naming Results::      Giving a name to C++ function return values.
  9856. * Min and Max::        C++ Minimum and maximum operators.
  9857. * Destructors and Goto:: Goto is safe to use in C++ even when destructors
  9858.                            are needed.
  9859. * C++ Interface::       You can use a single C++ header file for both
  9860.                          declarations and definitions.
  9861. * Template Instantiation:: Methods for ensuring that exactly one copy of
  9862.                          each needed template instantiation is emitted.
  9863. * C++ Signatures::    You can specify abstract types to get subtype
  9864.              polymorphism independent from inheritance.
  9865.  
  9866. 
  9867. File: use,  Node: Naming Results,  Next: Min and Max,  Up: C++ Extensions
  9868.  
  9869. Named Return Values in C++
  9870. ==========================
  9871.  
  9872.    GNU C++ extends the function-definition syntax to allow you to
  9873. specify a name for the result of a function outside the body of the
  9874. definition, in C++ programs:
  9875.  
  9876.      TYPE
  9877.      FUNCTIONNAME (ARGS) return RESULTNAME;
  9878.      {
  9879.        ...
  9880.        BODY
  9881.        ...
  9882.      }
  9883.  
  9884.    You can use this feature to avoid an extra constructor call when a
  9885. function result has a class type.  For example, consider a function
  9886. `m', declared as `X v = m ();', whose result is of class `X':
  9887.  
  9888.      X
  9889.      m ()
  9890.      {
  9891.        X b;
  9892.        b.a = 23;
  9893.        return b;
  9894.      }
  9895.  
  9896.    Although `m' appears to have no arguments, in fact it has one
  9897. implicit argument: the address of the return value.  At invocation, the
  9898. address of enough space to hold `v' is sent in as the implicit argument.
  9899. Then `b' is constructed and its `a' field is set to the value 23.
  9900. Finally, a copy constructor (a constructor of the form `X(X&)') is
  9901. applied to `b', with the (implicit) return value location as the
  9902. target, so that `v' is now bound to the return value.
  9903.  
  9904.    But this is wasteful.  The local `b' is declared just to hold
  9905. something that will be copied right out.  While a compiler that
  9906. combined an "elision" algorithm with interprocedural data flow analysis
  9907. could conceivably eliminate all of this, it is much more practical to
  9908. allow you to assist the compiler in generating efficient code by
  9909. manipulating the return value explicitly, thus avoiding the local
  9910. variable and copy constructor altogether.
  9911.  
  9912.    Using the extended GNU C++ function-definition syntax, you can avoid
  9913. the temporary allocation and copying by naming `r' as your return value
  9914. at the outset, and assigning to its `a' field directly:
  9915.  
  9916.      X
  9917.      m () return r;
  9918.      {
  9919.        r.a = 23;
  9920.      }
  9921.  
  9922. The declaration of `r' is a standard, proper declaration, whose effects
  9923. are executed *before* any of the body of `m'.
  9924.  
  9925.    Functions of this type impose no additional restrictions; in
  9926. particular, you can execute `return' statements, or return implicitly by
  9927. reaching the end of the function body ("falling off the edge").  Cases
  9928. like
  9929.  
  9930.      X
  9931.      m () return r (23);
  9932.      {
  9933.        return;
  9934.      }
  9935.  
  9936. (or even `X m () return r (23); { }') are unambiguous, since the return
  9937. value `r' has been initialized in either case.  The following code may
  9938. be hard to read, but also works predictably:
  9939.  
  9940.      X
  9941.      m () return r;
  9942.      {
  9943.        X b;
  9944.        return b;
  9945.      }
  9946.  
  9947.    The return value slot denoted by `r' is initialized at the outset,
  9948. but the statement `return b;' overrides this value.  The compiler deals
  9949. with this by destroying `r' (calling the destructor if there is one, or
  9950. doing nothing if there is not), and then reinitializing `r' with `b'.
  9951.  
  9952.    This extension is provided primarily to help people who use
  9953. overloaded operators, where there is a great need to control not just
  9954. the arguments, but the return values of functions.  For classes where
  9955. the copy constructor incurs a heavy performance penalty (especially in
  9956. the common case where there is a quick default constructor), this is a
  9957. major savings.  The disadvantage of this extension is that you do not
  9958. control when the default constructor for the return value is called: it
  9959. is always called at the beginning.
  9960.  
  9961. 
  9962. File: use,  Node: Min and Max,  Next: Destructors and Goto,  Prev: Naming Results,  Up: C++ Extensions
  9963.  
  9964. Minimum and Maximum Operators in C++
  9965. ====================================
  9966.  
  9967.    It is very convenient to have operators which return the "minimum"
  9968. or the "maximum" of two arguments.  In GNU C++ (but not in GNU C),
  9969.  
  9970. `A <? B'
  9971.      is the "minimum", returning the smaller of the numeric values A
  9972.      and B;
  9973.  
  9974. `A >? B'
  9975.      is the "maximum", returning the larger of the numeric values A and
  9976.      B.
  9977.  
  9978.    These operations are not primitive in ordinary C++, since you can
  9979. use a macro to return the minimum of two things in C++, as in the
  9980. following example.
  9981.  
  9982.      #define MIN(X,Y) ((X) < (Y) ? : (X) : (Y))
  9983.  
  9984. You might then use `int min = MIN (i, j);' to set MIN to the minimum
  9985. value of variables I and J.
  9986.  
  9987.    However, side effects in `X' or `Y' may cause unintended behavior.
  9988. For example, `MIN (i++, j++)' will fail, incrementing the smaller
  9989. counter twice.  A GNU C extension allows you to write safe macros that
  9990. avoid this kind of problem (*note Naming an Expression's Type: Naming
  9991. Types.).  However, writing `MIN' and `MAX' as macros also forces you to
  9992. use function-call notation notation for a fundamental arithmetic
  9993. operation.  Using GNU C++ extensions, you can write `int min = i <? j;'
  9994. instead.
  9995.  
  9996.    Since `<?' and `>?' are built into the compiler, they properly
  9997. handle expressions with side-effects;  `int min = i++ <? j++;' works
  9998. correctly.
  9999.  
  10000. 
  10001. File: use,  Node: Destructors and Goto,  Next: C++ Interface,  Prev: Min and Max,  Up: C++ Extensions
  10002.  
  10003. `goto' and Destructors in GNU C++
  10004. =================================
  10005.  
  10006.    In C++ programs, you can safely use the `goto' statement.  When you
  10007. use it to exit a block which contains aggregates requiring destructors,
  10008. the destructors will run before the `goto' transfers control.  (In ANSI
  10009. C++, `goto' is restricted to targets within the current block.)
  10010.  
  10011.    The compiler still forbids using `goto' to *enter* a scope that
  10012. requires constructors.
  10013.  
  10014. 
  10015. File: use,  Node: C++ Interface,  Next: Template Instantiation,  Prev: Destructors and Goto,  Up: C++ Extensions
  10016.  
  10017. Declarations and Definitions in One Header
  10018. ==========================================
  10019.  
  10020.    C++ object definitions can be quite complex.  In principle, your
  10021. source code will need two kinds of things for each object that you use
  10022. across more than one source file.  First, you need an "interface"
  10023. specification, describing its structure with type declarations and
  10024. function prototypes.  Second, you need the "implementation" itself.  It
  10025. can be tedious to maintain a separate interface description in a header
  10026. file, in parallel to the actual implementation.  It is also dangerous,
  10027. since separate interface and implementation definitions may not remain
  10028. parallel.
  10029.  
  10030.    With GNU C++, you can use a single header file for both purposes.
  10031.  
  10032.      *Warning:* The mechanism to specify this is in transition.  For the
  10033.      nonce, you must use one of two `#pragma' commands; in a future
  10034.      release of GNU C++, an alternative mechanism will make these
  10035.      `#pragma' commands unnecessary.
  10036.  
  10037.    The header file contains the full definitions, but is marked with
  10038. `#pragma interface' in the source code.  This allows the compiler to
  10039. use the header file only as an interface specification when ordinary
  10040. source files incorporate it with `#include'.  In the single source file
  10041. where the full implementation belongs, you can use either a naming
  10042. convention or `#pragma implementation' to indicate this alternate use
  10043. of the header file.
  10044.  
  10045. `#pragma interface'
  10046. `#pragma interface "SUBDIR/OBJECTS.h"'
  10047.      Use this directive in *header files* that define object classes,
  10048.      to save space in most of the object files that use those classes.
  10049.      Normally, local copies of certain information (backup copies of
  10050.      inline member functions, debugging information, and the internal
  10051.      tables that implement virtual functions) must be kept in each
  10052.      object file that includes class definitions.  You can use this
  10053.      pragma to avoid such duplication.  When a header file containing
  10054.      `#pragma interface' is included in a compilation, this auxiliary
  10055.      information will not be generated (unless the main input source
  10056.      file itself uses `#pragma implementation').  Instead, the object
  10057.      files will contain references to be resolved at link time.
  10058.  
  10059.      The second form of this directive is useful for the case where you
  10060.      have multiple headers with the same name in different directories.
  10061.      If you use this form, you must specify the same string to `#pragma
  10062.      implementation'.
  10063.  
  10064. `#pragma implementation'
  10065. `#pragma implementation "OBJECTS.h"'
  10066.      Use this pragma in a *main input file*, when you want full output
  10067.      from included header files to be generated (and made globally
  10068.      visible).  The included header file, in turn, should use `#pragma
  10069.      interface'.  Backup copies of inline member functions, debugging
  10070.      information, and the internal tables used to implement virtual
  10071.      functions are all generated in implementation files.
  10072.  
  10073.      If you use `#pragma implementation' with no argument, it applies to
  10074.      an include file with the same basename(1) as your source file.
  10075.      For example, in `allclass.cc', `#pragma implementation' by itself
  10076.      is equivalent to `#pragma implementation "allclass.h"'.
  10077.  
  10078.      In versions of GNU C++ prior to 2.6.0 `allclass.h' was treated as
  10079.      an implementation file whenever you would include it from
  10080.      `allclass.cc' even if you never specified `#pragma
  10081.      implementation'.  This was deemed to be more trouble than it was
  10082.      worth, however, and disabled.
  10083.  
  10084.      If you use an explicit `#pragma implementation', it must appear in
  10085.      your source file *before* you include the affected header files.
  10086.  
  10087.      Use the string argument if you want a single implementation file to
  10088.      include code from multiple header files.  (You must also use
  10089.      `#include' to include the header file; `#pragma implementation'
  10090.      only specifies how to use the file--it doesn't actually include
  10091.      it.)
  10092.  
  10093.      There is no way to split up the contents of a single header file
  10094.      into multiple implementation files.
  10095.  
  10096.    `#pragma implementation' and `#pragma interface' also have an effect
  10097. on function inlining.
  10098.  
  10099.    If you define a class in a header file marked with `#pragma
  10100. interface', the effect on a function defined in that class is similar to
  10101. an explicit `extern' declaration--the compiler emits no code at all to
  10102. define an independent version of the function.  Its definition is used
  10103. only for inlining with its callers.
  10104.  
  10105.    Conversely, when you include the same header file in a main source
  10106. file that declares it as `#pragma implementation', the compiler emits
  10107. code for the function itself; this defines a version of the function
  10108. that can be found via pointers (or by callers compiled without
  10109. inlining).  If all calls to the function can be inlined, you can avoid
  10110. emitting the function by compiling with `-fno-implement-inlines'.  If
  10111. any calls were not inlined, you will get linker errors.
  10112.  
  10113.    ---------- Footnotes ----------
  10114.  
  10115.    (1)  A file's "basename" was the name stripped of all leading path
  10116. information and of trailing suffixes, such as `.h' or `.C' or `.cc'.
  10117.  
  10118. 
  10119. File: use,  Node: Template Instantiation,  Next: C++ Signatures,  Prev: C++ Interface,  Up: C++ Extensions
  10120.  
  10121. Where's the Template?
  10122. =====================
  10123.  
  10124.    C++ templates are the first language feature to require more
  10125. intelligence from the environment than one usually finds on a UNIX
  10126. system.  Somehow the compiler and linker have to make sure that each
  10127. template instance occurs exactly once in the executable if it is needed,
  10128. and not at all otherwise.  There are two basic approaches to this
  10129. problem, which I will refer to as the Borland model and the Cfront
  10130. model.
  10131.  
  10132. Borland model
  10133.      Borland C++ solved the template instantiation problem by adding
  10134.      the code equivalent of common blocks to their linker; template
  10135.      instances are emitted in each translation unit that uses them, and
  10136.      they are collapsed together at run time.  The advantage of this
  10137.      model is that the linker only has to consider the object files
  10138.      themselves; there is no external complexity to worry about.  This
  10139.      disadvantage is that compilation time is increased because the
  10140.      template code is being compiled repeatedly.  Code written for this
  10141.      model tends to include definitions of all member templates in the
  10142.      header file, since they must be seen to be compiled.
  10143.  
  10144. Cfront model
  10145.      The AT&T C++ translator, Cfront, solved the template instantiation
  10146.      problem by creating the notion of a template repository, an
  10147.      automatically maintained place where template instances are
  10148.      stored.  As individual object files are built, notes are placed in
  10149.      the repository to record where templates and potential type
  10150.      arguments were seen so that the subsequent instantiation step
  10151.      knows where to find them.  At link time, any needed instances are
  10152.      generated and linked in.  The advantages of this model are more
  10153.      optimal compilation speed and the ability to use the system
  10154.      linker; to implement the Borland model a compiler vendor also
  10155.      needs to replace the linker.  The disadvantages are vastly
  10156.      increased complexity, and thus potential for error; theoretically,
  10157.      this should be just as transparent, but in practice it has been
  10158.      very difficult to build multiple programs in one directory and one
  10159.      program in multiple directories using Cfront.  Code written for
  10160.      this model tends to separate definitions of non-inline member
  10161.      templates into a separate file, which is magically found by the
  10162.      link preprocessor when a template needs to be instantiated.
  10163.  
  10164.    Currently, g++ implements neither automatic model.  The g++ team
  10165. hopes to have a repository working for 2.7.0.  In the mean time, you
  10166. have three options for dealing with template instantiations:
  10167.  
  10168.   1. Do nothing.  Pretend g++ does implement automatic instantiation
  10169.      management.  Code written for the Borland model will work fine, but
  10170.      each translation unit will contain instances of each of the
  10171.      templates it uses.  In a large program, this can lead to an
  10172.      unacceptable amount of code duplication.
  10173.  
  10174.   2. Add `#pragma interface' to all files containing template
  10175.      definitions.  For each of these files, add `#pragma implementation
  10176.      "FILENAME"' to the top of some `.C' file which `#include's it.
  10177.      Then compile everything with -fexternal-templates.  The templates
  10178.      will then only be expanded in the translation unit which
  10179.      implements them (i.e. has a `#pragma implementation' line for the
  10180.      file where they live); all other files will use external
  10181.      references.  If you're lucky, everything should work properly.  If
  10182.      you get undefined symbol errors, you need to make sure that each
  10183.      template instance which is used in the program is used in the file
  10184.      which implements that template.  If you don't have any use for a
  10185.      particular instance in that file, you can just instantiate it
  10186.      explicitly, using the syntax from the latest C++ working paper:
  10187.  
  10188.           template class A<int>;
  10189.           template ostream& operator << (ostream&, const A<int>&);
  10190.  
  10191.      This strategy will work with code written for either model.  If
  10192.      you are using code written for the Cfront model, the file
  10193.      containing a class template and the file containing its member
  10194.      templates should be implemented in the same translation unit.
  10195.  
  10196.      A slight variation on this approach is to use the flag
  10197.      -falt-external-templates instead; this flag causes template
  10198.      instances to be emitted in the translation unit that implements
  10199.      the header where they are first instantiated, rather than the one
  10200.      which implements the file where the templates are defined.  This
  10201.      header must be the same in all translation units, or things are
  10202.      likely to break.
  10203.  
  10204.      *Note Declarations and Definitions in One Header: C++ Interface,
  10205.      for more discussion of these pragmas.
  10206.  
  10207.   3. Explicitly instantiate all the template instances you use, and
  10208.      compile with -fno-implicit-templates.  This is probably your best
  10209.      bet; it may require more knowledge of exactly which templates you
  10210.      are using, but it's less mysterious than the previous approach,
  10211.      and it doesn't require any `#pragma's or other g++-specific code.
  10212.      You can scatter the instantiations throughout your program, you
  10213.      can create one big file to do all the instantiations, or you can
  10214.      create tiny files like
  10215.  
  10216.           #include "Foo.h"
  10217.           #include "Foo.cc"
  10218.           
  10219.           template class Foo<int>;
  10220.  
  10221.      for each instance you need, and create a template instantiation
  10222.      library from those.  I'm partial to the last, but your mileage may
  10223.      vary.  If you are using Cfront-model code, you can probably get
  10224.      away with not using -fno-implicit-templates when compiling files
  10225.      that don't `#include' the member template definitions.
  10226.  
  10227. 
  10228. File: use,  Node: C++ Signatures,  Prev: Template Instantiation,  Up: C++ Extensions
  10229.  
  10230. Type Abstraction using Signatures
  10231. =================================
  10232.  
  10233.    In GNU C++, you can use the keyword `signature' to define a
  10234. completely abstract class interface as a datatype.  You can connect this
  10235. abstraction with actual classes using signature pointers.  If you want
  10236. to use signatures, run the GNU compiler with the `-fhandle-signatures'
  10237. command-line option.  (With this option, the compiler reserves a second
  10238. keyword `sigof' as well, for a future extension.)
  10239.  
  10240.    Roughly, signatures are type abstractions or interfaces of classes.
  10241. Some other languages have similar facilities.  C++ signatures are
  10242. related to ML's signatures, Haskell's type classes, definition modules
  10243. in Modula-2, interface modules in Modula-3, abstract types in Emerald,
  10244. type modules in Trellis/Owl, categories in Scratchpad II, and types in
  10245. POOL-I.  For a more detailed discussion of signatures, see `Signatures:
  10246. A C++ Extension for Type Abstraction and Subtype Polymorphism' by
  10247. Gerald Baumgartner and Vincent F. Russo (Tech report CSD-TR-93-059,
  10248. Dept. of Computer Sciences, Purdue University, December 1994, to appear
  10249. in *Software Practice & Experience*).  You can get the tech report by
  10250. anonymous FTP from `ftp.cs.purdue.edu' in `pub/reports/TR93-059.PS.Z'.
  10251.  
  10252.    Syntactically, a signature declaration is a collection of member
  10253. function declarations and nested type declarations.  For example, this
  10254. signature declaration defines a new abstract type `S' with member
  10255. functions `int foo ()' and `int bar (int)':
  10256.  
  10257.      signature S
  10258.      {
  10259.        int foo ();
  10260.        int bar (int);
  10261.      };
  10262.  
  10263.    Since signature types do not include implementation definitions, you
  10264. cannot write an instance of a signature directly.  Instead, you can
  10265. define a pointer to any class that contains the required interfaces as a
  10266. "signature pointer".  Such a class "implements" the signature type.
  10267.  
  10268.    To use a class as an implementation of `S', you must ensure that the
  10269. class has public member functions `int foo ()' and `int bar (int)'.
  10270. The class can have other member functions as well, public or not; as
  10271. long as it offers what's declared in the signature, it is suitable as
  10272. an implementation of that signature type.
  10273.  
  10274.    For example, suppose that `C' is a class that meets the requirements
  10275. of signature `S' (`C' "conforms to" `S').  Then
  10276.  
  10277.      C obj;
  10278.      S * p = &obj;
  10279.  
  10280. defines a signature pointer `p' and initializes it to point to an
  10281. object of type `C'.  The member function call `int i = p->foo ();'
  10282. executes `obj.foo ()'.
  10283.  
  10284.    Abstract virtual classes provide somewhat similar facilities in
  10285. standard C++.  There are two main advantages to using signatures
  10286. instead:
  10287.  
  10288.   1. Subtyping becomes independent from inheritance.  A class or
  10289.      signature type `T' is a subtype of a signature type `S'
  10290.      independent of any inheritance hierarchy as long as all the member
  10291.      functions declared in `S' are also found in `T'.  So you can
  10292.      define a subtype hierarchy that is completely independent from any
  10293.      inheritance (implementation) hierarchy, instead of being forced to
  10294.      use types that mirror the class inheritance hierarchy.
  10295.  
  10296.   2. Signatures allow you to work with existing class hierarchies as
  10297.      implementations of a signature type.  If those class hierarchies
  10298.      are only available in compiled form, you're out of luck with
  10299.      abstract virtual classes, since an abstract virtual class cannot
  10300.      be retrofitted on top of existing class hierarchies.  So you would
  10301.      be required to write interface classes as subtypes of the abstract
  10302.      virtual class.
  10303.  
  10304.    There is one more detail about signatures.  A signature declaration
  10305. can contain member function *definitions* as well as member function
  10306. declarations.  A signature member function with a full definition is
  10307. called a *default implementation*; classes need not contain that
  10308. particular interface in order to conform.  For example, a class `C' can
  10309. conform to the signature
  10310.  
  10311.      signature T
  10312.      {
  10313.        int f (int);
  10314.        int f0 () { return f (0); };
  10315.      };
  10316.  
  10317. whether or not `C' implements the member function `int f0 ()'.  If you
  10318. define `C::f0', that definition takes precedence; otherwise, the
  10319. default implementation `S::f0' applies.
  10320.  
  10321. 
  10322. File: use,  Node: Trouble,  Next: Bugs,  Prev: C++ Extensions,  Up: Top
  10323.  
  10324. Known Causes of Trouble with GNU CC
  10325. ***********************************
  10326.  
  10327.    This section describes known problems that affect users of GNU CC.
  10328. Most of these are not GNU CC bugs per se--if they were, we would fix
  10329. them.  But the result for a user may be like the result of a bug.
  10330.  
  10331.    Some of these problems are due to bugs in other software, some are
  10332. missing features that are too much work to add, and some are places
  10333. where people's opinions differ as to what is best.
  10334.  
  10335. * Menu:
  10336.  
  10337. * Actual Bugs::              Bugs we will fix later.
  10338. * Installation Problems::     Problems that manifest when you install GNU CC.
  10339. * Cross-Compiler Problems::   Common problems of cross compiling with GNU CC.
  10340. * Interoperation::      Problems using GNU CC with other compilers,
  10341.                and with certain linkers, assemblers and debuggers.
  10342. * External Bugs::    Problems compiling certain programs.
  10343. * Incompatibilities::   GNU CC is incompatible with traditional C.
  10344. * Fixed Headers::       GNU C uses corrected versions of system header files.
  10345.                            This is necessary, but doesn't always work smoothly.
  10346. * Standard Libraries::  GNU C uses the system C library, which might not be
  10347.                            compliant with the ISO/ANSI C standard.
  10348. * Disappointments::     Regrettable things we can't change, but not quite bugs.
  10349. * C++ Misunderstandings::     Common misunderstandings with GNU C++.
  10350. * Protoize Caveats::    Things to watch out for when using `protoize'.
  10351. * Non-bugs::        Things we think are right, but some others disagree.
  10352. * Warnings and Errors:: Which problems in your code get warnings,
  10353.                          and which get errors.
  10354.  
  10355. 
  10356. File: use,  Node: Actual Bugs,  Next: Installation Problems,  Up: Trouble
  10357.  
  10358. Actual Bugs We Haven't Fixed Yet
  10359. ================================
  10360.  
  10361.    * The `fixincludes' script interacts badly with automounters; if the
  10362.      directory of system header files is automounted, it tends to be
  10363.      unmounted while `fixincludes' is running.  This would seem to be a
  10364.      bug in the automounter.  We don't know any good way to work around
  10365.      it.
  10366.  
  10367.    * The `fixproto' script will sometimes add prototypes for the
  10368.      `sigsetjmp' and `siglongjmp' functions that reference the
  10369.      `jmp_buf' type before that type is defined.  To work around this,
  10370.      edit the offending file and place the typedef in front of the
  10371.      prototypes.
  10372.  
  10373.    * There are several obscure case of mis-using struct, union, and
  10374.      enum tags that are not detected as errors by the compiler.
  10375.  
  10376.    * When `-pedantic-errors' is specified, GNU C will incorrectly give
  10377.      an error message when a function name is specified in an expression
  10378.      involving the comma operator.
  10379.  
  10380.    * Loop unrolling doesn't work properly for certain C++ programs.
  10381.      This is a bug in the C++ front end.  It sometimes emits incorrect
  10382.      debug info, and the loop unrolling code is unable to recover from
  10383.      this error.
  10384.  
  10385. 
  10386. File: use,  Node: Installation Problems,  Next: Cross-Compiler Problems,  Prev: Actual Bugs,  Up: Trouble
  10387.  
  10388. Installation Problems
  10389. =====================
  10390.  
  10391.    This is a list of problems (and some apparent problems which don't
  10392. really mean anything is wrong) that show up during installation of GNU
  10393. CC.
  10394.  
  10395.    * On certain systems, defining certain environment variables such as
  10396.      `CC' can interfere with the functioning of `make'.
  10397.  
  10398.    * If you encounter seemingly strange errors when trying to build the
  10399.      compiler in a directory other than the source directory, it could
  10400.      be because you have previously configured the compiler in the
  10401.      source directory.  Make sure you have done all the necessary
  10402.      preparations.  *Note Other Dir::.
  10403.  
  10404.    * If you build GNU CC on a BSD system using a directory stored in a
  10405.      System V file system, problems may occur in running `fixincludes'
  10406.      if the System V file system doesn't support symbolic links.  These
  10407.      problems result in a failure to fix the declaration of `size_t' in
  10408.      `sys/types.h'.  If you find that `size_t' is a signed type and
  10409.      that type mismatches occur, this could be the cause.
  10410.  
  10411.      The solution is not to use such a directory for building GNU CC.
  10412.  
  10413.    * In previous versions of GNU CC, the `gcc' driver program looked for
  10414.      `as' and `ld' in various places; for example, in files beginning
  10415.      with `/usr/local/lib/gcc-'.  GNU CC version 2 looks for them in
  10416.      the directory `/usr/local/lib/gcc-lib/TARGET/VERSION'.
  10417.  
  10418.      Thus, to use a version of `as' or `ld' that is not the system
  10419.      default, for example `gas' or GNU `ld', you must put them in that
  10420.      directory (or make links to them from that directory).
  10421.  
  10422.    * Some commands executed when making the compiler may fail (return a
  10423.      non-zero status) and be ignored by `make'.  These failures, which
  10424.      are often due to files that were not found, are expected, and can
  10425.      safely be ignored.
  10426.  
  10427.    * It is normal to have warnings in compiling certain files about
  10428.      unreachable code and about enumeration type clashes.  These files'
  10429.      names begin with `insn-'.  Also, `real.c' may get some warnings
  10430.      that you can ignore.
  10431.  
  10432.    * Sometimes `make' recompiles parts of the compiler when installing
  10433.      the compiler.  In one case, this was traced down to a bug in
  10434.      `make'.  Either ignore the problem or switch to GNU Make.
  10435.  
  10436.    * If you have installed a program known as purify, you may find that
  10437.      it causes errors while linking `enquire', which is part of building
  10438.      GNU CC.  The fix is to get rid of the file `real-ld' which purify
  10439.      installs--so that GNU CC won't try to use it.
  10440.  
  10441.    * On Linux SLS 1.01, there is a problem with `libc.a': it does not
  10442.      contain the obstack functions.  However, GNU CC assumes that the
  10443.      obstack functions are in `libc.a' when it is the GNU C library.
  10444.      To work around this problem, change the `__GNU_LIBRARY__'
  10445.      conditional around line 31 to `#if 1'.
  10446.  
  10447.    * On some 386 systems, building the compiler never finishes because
  10448.      `enquire' hangs due to a hardware problem in the motherboard--it
  10449.      reports floating point exceptions to the kernel incorrectly.  You
  10450.      can install GNU CC except for `float.h' by patching out the
  10451.      command to run `enquire'.  You may also be able to fix the problem
  10452.      for real by getting a replacement motherboard.  This problem was
  10453.      observed in Revision E of the Micronics motherboard, and is fixed
  10454.      in Revision F.  It has also been observed in the MYLEX MXA-33
  10455.      motherboard.
  10456.  
  10457.      If you encounter this problem, you may also want to consider
  10458.      removing the FPU from the socket during the compilation.
  10459.      Alternatively, if you are running SCO Unix, you can reboot and
  10460.      force the FPU to be ignored.  To do this, type `hd(40)unix auto
  10461.      ignorefpu'.
  10462.  
  10463.    * On some 386 systems, GNU CC crashes trying to compile `enquire.c'.
  10464.      This happens on machines that don't have a 387 FPU chip.  On 386
  10465.      machines, the system kernel is supposed to emulate the 387 when you
  10466.      don't have one.  The crash is due to a bug in the emulator.
  10467.  
  10468.      One of these systems is the Unix from Interactive Systems: 386/ix.
  10469.      On this system, an alternate emulator is provided, and it does
  10470.      work.  To use it, execute this command as super-user:
  10471.  
  10472.           ln /etc/emulator.rel1 /etc/emulator
  10473.  
  10474.      and then reboot the system.  (The default emulator file remains
  10475.      present under the name `emulator.dflt'.)
  10476.  
  10477.      Try using `/etc/emulator.att', if you have such a problem on the
  10478.      SCO system.
  10479.  
  10480.      Another system which has this problem is Esix.  We don't know
  10481.      whether it has an alternate emulator that works.
  10482.  
  10483.      On NetBSD 0.8, a similar problem manifests itself as these error
  10484.      messages:
  10485.  
  10486.           enquire.c: In function `fprop':
  10487.           enquire.c:2328: floating overflow
  10488.  
  10489.    * On SCO systems, when compiling GNU CC with the system's compiler,
  10490.      do not use `-O'.  Some versions of the system's compiler miscompile
  10491.      GNU CC with `-O'.
  10492.  
  10493.    * Sometimes on a Sun 4 you may observe a crash in the program
  10494.      `genflags' or `genoutput' while building GNU CC.  This is said to
  10495.      be due to a bug in `sh'.  You can probably get around it by running
  10496.      `genflags' or `genoutput' manually and then retrying the `make'.
  10497.  
  10498.    * On Solaris 2, executables of GNU CC version 2.0.2 are commonly
  10499.      available, but they have a bug that shows up when compiling current
  10500.      versions of GNU CC: undefined symbol errors occur during assembly
  10501.      if you use `-g'.
  10502.  
  10503.      The solution is to compile the current version of GNU CC without
  10504.      `-g'.  That makes a working compiler which you can use to recompile
  10505.      with `-g'.
  10506.  
  10507.    * Solaris 2 comes with a number of optional OS packages.  Some of
  10508.      these packages are needed to use GNU CC fully.  If you did not
  10509.      install all optional packages when installing Solaris, you will
  10510.      need to verify that the packages that GNU CC needs are installed.
  10511.  
  10512.      To check whether an optional package is installed, use the
  10513.      `pkginfo' command.  To add an optional package, use the `pkgadd'
  10514.      command.  For further details, see the Solaris documentation.
  10515.  
  10516.      For Solaris 2.0 and 2.1, GNU CC needs six packages: `SUNWarc',
  10517.      `SUNWbtool', `SUNWesu', `SUNWhea', `SUNWlibm', and `SUNWtoo'.
  10518.  
  10519.      For Solaris 2.2, GNU CC needs an additional seventh package:
  10520.      `SUNWsprot'.
  10521.  
  10522.    * On Solaris 2, trying to use the linker and other tools in
  10523.      `/usr/ucb' to install GNU CC has been observed to cause trouble.
  10524.      For example, the linker may hang indefinitely.  The fix is to
  10525.      remove `/usr/ucb' from your `PATH'.
  10526.  
  10527.    * If you use the 1.31 version of the MIPS assembler (such as was
  10528.      shipped with Ultrix 3.1), you will need to use the
  10529.      -fno-delayed-branch switch when optimizing floating point code.
  10530.      Otherwise, the assembler will complain when the GCC compiler fills
  10531.      a branch delay slot with a floating point instruction, such as
  10532.      `add.d'.
  10533.  
  10534.    * If on a MIPS system you get an error message saying "does not have
  10535.      gp sections for all it's [sic] sectons [sic]", don't worry about
  10536.      it.  This happens whenever you use GAS with the MIPS linker, but
  10537.      there is not really anything wrong, and it is okay to use the
  10538.      output file.  You can stop such warnings by installing the GNU
  10539.      linker.
  10540.  
  10541.      It would be nice to extend GAS to produce the gp tables, but they
  10542.      are optional, and there should not be a warning about their
  10543.      absence.
  10544.  
  10545.    * In Ultrix 4.0 on the MIPS machine, `stdio.h' does not work with GNU
  10546.      CC at all unless it has been fixed with `fixincludes'.  This causes
  10547.      problems in building GNU CC.  Once GNU CC is installed, the
  10548.      problems go away.
  10549.  
  10550.      To work around this problem, when making the stage 1 compiler,
  10551.      specify this option to Make:
  10552.  
  10553.           GCC_FOR_TARGET="./xgcc -B./ -I./include"
  10554.  
  10555.      When making stage 2 and stage 3, specify this option:
  10556.  
  10557.           CFLAGS="-g -I./include"
  10558.  
  10559.    * Users have reported some problems with version 2.0 of the MIPS
  10560.      compiler tools that were shipped with Ultrix 4.1.  Version 2.10
  10561.      which came with Ultrix 4.2 seems to work fine.
  10562.  
  10563.      Users have also reported some problems with version 2.20 of the
  10564.      MIPS compiler tools that were shipped with RISC/os 4.x.  The
  10565.      earlier version 2.11 seems to work fine.
  10566.  
  10567.    * Some versions of the MIPS linker will issue an assertion failure
  10568.      when linking code that uses `alloca' against shared libraries on
  10569.      RISC-OS 5.0, and DEC's OSF/1 systems.  This is a bug in the
  10570.      linker, that is supposed to be fixed in future revisions.  To
  10571.      protect against this, GNU CC passes `-non_shared' to the linker
  10572.      unless you pass an explicit `-shared' or `-call_shared' switch.
  10573.  
  10574.    * On System V release 3, you may get this error message while
  10575.      linking:
  10576.  
  10577.           ld fatal: failed to write symbol name SOMETHING
  10578.            in strings table for file WHATEVER
  10579.  
  10580.      This probably indicates that the disk is full or your ULIMIT won't
  10581.      allow the file to be as large as it needs to be.
  10582.  
  10583.      This problem can also result because the kernel parameter `MAXUMEM'
  10584.      is too small.  If so, you must regenerate the kernel and make the
  10585.      value much larger.  The default value is reported to be 1024; a
  10586.      value of 32768 is said to work.  Smaller values may also work.
  10587.  
  10588.    * On System V, if you get an error like this,
  10589.  
  10590.           /usr/local/lib/bison.simple: In function `yyparse':
  10591.           /usr/local/lib/bison.simple:625: virtual memory exhausted
  10592.  
  10593.      that too indicates a problem with disk space, ULIMIT, or `MAXUMEM'.
  10594.  
  10595.    * Current GNU CC versions probably do not work on version 2 of the
  10596.      NeXT operating system.
  10597.  
  10598.    * On NeXTStep 3.0, the Objective C compiler does not work, due,
  10599.      apparently, to a kernel bug that it happens to trigger.  This
  10600.      problem does not happen on 3.1.
  10601.  
  10602.    * On the Tower models 4N0 and 6N0, by default a process is not
  10603.      allowed to have more than one megabyte of memory.  GNU CC cannot
  10604.      compile itself (or many other programs) with `-O' in that much
  10605.      memory.
  10606.  
  10607.      To solve this problem, reconfigure the kernel adding the following
  10608.      line to the configuration file:
  10609.  
  10610.           MAXUMEM = 4096
  10611.  
  10612.    * On HP 9000 series 300 or 400 running HP-UX release 8.0, there is a
  10613.      bug in the assembler that must be fixed before GNU CC can be
  10614.      built.  This bug manifests itself during the first stage of
  10615.      compilation, while building `libgcc2.a':
  10616.  
  10617.           _floatdisf
  10618.           cc1: warning: `-g' option not supported on this version of GCC
  10619.           cc1: warning: `-g1' option not supported on this version of GCC
  10620.           ./xgcc: Internal compiler error: program as got fatal signal 11
  10621.  
  10622.      A patched version of the assembler is available by anonymous ftp
  10623.      from `altdorf.ai.mit.edu' as the file
  10624.      `archive/cph/hpux-8.0-assembler'.  If you have HP software support,
  10625.      the patch can also be obtained directly from HP, as described in
  10626.      the following note:
  10627.  
  10628.           This is the patched assembler, to patch SR#1653-010439, where
  10629.           the assembler aborts on floating point constants.
  10630.  
  10631.           The bug is not really in the assembler, but in the shared
  10632.           library version of the function "cvtnum(3c)".  The bug on
  10633.           "cvtnum(3c)" is SR#4701-078451.  Anyway, the attached
  10634.           assembler uses the archive library version of "cvtnum(3c)"
  10635.           and thus does not exhibit the bug.
  10636.  
  10637.      This patch is also known as PHCO_4484.
  10638.  
  10639.    * On HP-UX version 8.05, but not on 8.07 or more recent versions,
  10640.      the `fixproto' shell script triggers a bug in the system shell.
  10641.      If you encounter this problem, upgrade your operating system or
  10642.      use BASH (the GNU shell) to run `fixproto'.
  10643.  
  10644.    * Some versions of the Pyramid C compiler are reported to be unable
  10645.      to compile GNU CC.  You must use an older version of GNU CC for
  10646.      bootstrapping.  One indication of this problem is if you get a
  10647.      crash when GNU CC compiles the function `muldi3' in file
  10648.      `libgcc2.c'.
  10649.  
  10650.      You may be able to succeed by getting GNU CC version 1, installing
  10651.      it, and using it to compile GNU CC version 2.  The bug in the
  10652.      Pyramid C compiler does not seem to affect GNU CC version 1.
  10653.  
  10654.    * There may be similar problems on System V Release 3.1 on 386
  10655.      systems.
  10656.  
  10657.    * On the Intel Paragon (an i860 machine), if you are using operating
  10658.      system version 1.0, you will get warnings or errors about
  10659.      redefinition of `va_arg' when you build GNU CC.
  10660.  
  10661.      If this happens, then you need to link most programs with the
  10662.      library `iclib.a'.  You must also modify `stdio.h' as follows:
  10663.      before the lines
  10664.  
  10665.           #if     defined(__i860__) && !defined(_VA_LIST)
  10666.           #include <va_list.h>
  10667.  
  10668.      insert the line
  10669.  
  10670.           #if __PGC__
  10671.  
  10672.      and after the lines
  10673.  
  10674.           extern int  vprintf(const char *, va_list );
  10675.           extern int  vsprintf(char *, const char *, va_list );
  10676.           #endif
  10677.  
  10678.      insert the line
  10679.  
  10680.           #endif /* __PGC__ */
  10681.  
  10682.      These problems don't exist in operating system version 1.1.
  10683.  
  10684.    * On the Altos 3068, programs compiled with GNU CC won't work unless
  10685.      you fix a kernel bug.  This happens using system versions V.2.2
  10686.      1.0gT1 and V.2.2 1.0e and perhaps later versions as well.  See the
  10687.      file `README.ALTOS'.
  10688.  
  10689.    * You will get several sorts of compilation and linking errors on the
  10690.      we32k if you don't follow the special instructions.  *Note
  10691.      Configurations::.
  10692.  
  10693.    * A bug in the HP-UX 8.05 (and earlier) shell will cause the fixproto
  10694.      program to report an error of the form:
  10695.  
  10696.           ./fixproto: sh internal 1K buffer overflow
  10697.  
  10698.      To fix this, change the first line of the fixproto script to look
  10699.      like:
  10700.  
  10701.           #!/bin/ksh
  10702.  
  10703. 
  10704. File: use,  Node: Cross-Compiler Problems,  Next: Interoperation,  Prev: Installation Problems,  Up: Trouble
  10705.  
  10706. Cross-Compiler Problems
  10707. =======================
  10708.  
  10709.    You may run into problems with cross compilation on certain machines,
  10710. for several reasons.
  10711.  
  10712.    * Cross compilation can run into trouble for certain machines because
  10713.      some target machines' assemblers require floating point numbers to
  10714.      be written as *integer* constants in certain contexts.
  10715.  
  10716.      The compiler writes these integer constants by examining the
  10717.      floating point value as an integer and printing that integer,
  10718.      because this is simple to write and independent of the details of
  10719.      the floating point representation.  But this does not work if the
  10720.      compiler is running on a different machine with an incompatible
  10721.      floating point format, or even a different byte-ordering.
  10722.  
  10723.      In addition, correct constant folding of floating point values
  10724.      requires representing them in the target machine's format.  (The C
  10725.      standard does not quite require this, but in practice it is the
  10726.      only way to win.)
  10727.  
  10728.      It is now possible to overcome these problems by defining macros
  10729.      such as `REAL_VALUE_TYPE'.  But doing so is a substantial amount of
  10730.      work for each target machine.  *Note Cross Compilation and
  10731.      Floating Point Format: (gcc.info)Cross-compilation.
  10732.  
  10733.    * At present, the program `mips-tfile' which adds debug support to
  10734.      object files on MIPS systems does not work in a cross compile
  10735.      environment.
  10736.  
  10737. 
  10738. File: use,  Node: Interoperation,  Next: External Bugs,  Prev: Cross-Compiler Problems,  Up: Trouble
  10739.  
  10740. Interoperation
  10741. ==============
  10742.  
  10743.    This section lists various difficulties encountered in using GNU C or
  10744. GNU C++ together with other compilers or with the assemblers, linkers,
  10745. libraries and debuggers on certain systems.
  10746.  
  10747.    * Objective C does not work on the RS/6000.
  10748.  
  10749.    * GNU C++ does not do name mangling in the same way as other C++
  10750.      compilers.  This means that object files compiled with one compiler
  10751.      cannot be used with another.
  10752.  
  10753.      This effect is intentional, to protect you from more subtle
  10754.      problems.  Compilers differ as to many internal details of C++
  10755.      implementation, including: how class instances are laid out, how
  10756.      multiple inheritance is implemented, and how virtual function
  10757.      calls are handled.  If the name encoding were made the same, your
  10758.      programs would link against libraries provided from other
  10759.      compilers--but the programs would then crash when run.
  10760.      Incompatible libraries are then detected at link time, rather than
  10761.      at run time.
  10762.  
  10763.    * Older GDB versions sometimes fail to read the output of GNU CC
  10764.      version 2.  If you have trouble, get GDB version 4.4 or later.
  10765.  
  10766.    * DBX rejects some files produced by GNU CC, though it accepts
  10767.      similar constructs in output from PCC.  Until someone can supply a
  10768.      coherent description of what is valid DBX input and what is not,
  10769.      there is nothing I can do about these problems.  You are on your
  10770.      own.
  10771.  
  10772.    * The GNU assembler (GAS) does not support PIC.  To generate PIC
  10773.      code, you must use some other assembler, such as `/bin/as'.
  10774.  
  10775.    * On some BSD systems, including some versions of Ultrix, use of
  10776.      profiling causes static variable destructors (currently used only
  10777.      in C++) not to be run.
  10778.  
  10779.    * Use of `-I/usr/include' may cause trouble.
  10780.  
  10781.      Many systems come with header files that won't work with GNU CC
  10782.      unless corrected by `fixincludes'.  The corrected header files go
  10783.      in a new directory; GNU CC searches this directory before
  10784.      `/usr/include'.  If you use `-I/usr/include', this tells GNU CC to
  10785.      search `/usr/include' earlier on, before the corrected headers.
  10786.      The result is that you get the uncorrected header files.
  10787.  
  10788.      Instead, you should use these options (when compiling C programs):
  10789.  
  10790.           -I/usr/local/lib/gcc-lib/TARGET/VERSION/include -I/usr/include
  10791.  
  10792.      For C++ programs, GNU CC also uses a special directory that
  10793.      defines C++ interfaces to standard C subroutines.  This directory
  10794.      is meant to be searched *before* other standard include
  10795.      directories, so that it takes precedence.  If you are compiling
  10796.      C++ programs and specifying include directories explicitly, use
  10797.      this option first, then the two options above:
  10798.  
  10799.           -I/usr/local/lib/g++-include
  10800.  
  10801.    * On some SGI systems, when you use `-lgl_s' as an option, it gets
  10802.      translated magically to `-lgl_s -lX11_s -lc_s'.  Naturally, this
  10803.      does not happen when you use GNU CC.  You must specify all three
  10804.      options explicitly.
  10805.  
  10806.    * On a Sparc, GNU CC aligns all values of type `double' on an 8-byte
  10807.      boundary, and it expects every `double' to be so aligned.  The Sun
  10808.      compiler usually gives `double' values 8-byte alignment, with one
  10809.      exception: function arguments of type `double' may not be aligned.
  10810.  
  10811.      As a result, if a function compiled with Sun CC takes the address
  10812.      of an argument of type `double' and passes this pointer of type
  10813.      `double *' to a function compiled with GNU CC, dereferencing the
  10814.      pointer may cause a fatal signal.
  10815.  
  10816.      One way to solve this problem is to compile your entire program
  10817.      with GNU CC.  Another solution is to modify the function that is
  10818.      compiled with Sun CC to copy the argument into a local variable;
  10819.      local variables are always properly aligned.  A third solution is
  10820.      to modify the function that uses the pointer to dereference it via
  10821.      the following function `access_double' instead of directly with
  10822.      `*':
  10823.  
  10824.           inline double
  10825.           access_double (double *unaligned_ptr)
  10826.           {
  10827.             union d2i { double d; int i[2]; };
  10828.           
  10829.             union d2i *p = (union d2i *) unaligned_ptr;
  10830.             union d2i u;
  10831.           
  10832.             u.i[0] = p->i[0];
  10833.             u.i[1] = p->i[1];
  10834.           
  10835.             return u.d;
  10836.           }
  10837.  
  10838.      Storing into the pointer can be done likewise with the same union.
  10839.  
  10840.    * On Solaris, the `malloc' function in the `libmalloc.a' library may
  10841.      allocate memory that is only 4 byte aligned.  Since GNU CC on the
  10842.      Sparc assumes that doubles are 8 byte aligned, this may result in a
  10843.      fatal signal if doubles are stored in memory allocated by the
  10844.      `libmalloc.a' library.
  10845.  
  10846.      The solution is to not use the `libmalloc.a' library.  Use instead
  10847.      `malloc' and related functions from `libc.a'; they do not have
  10848.      this problem.
  10849.  
  10850.    * Sun forgot to include a static version of `libdl.a' with some
  10851.      versions of SunOS (mainly 4.1).  This results in undefined symbols
  10852.      when linking static binaries (that is, if you use `-static').  If
  10853.      you see undefined symbols `_dlclose', `_dlsym' or `_dlopen' when
  10854.      linking, compile and link against the file `mit/util/misc/dlsym.c'
  10855.      from the MIT version of X windows.
  10856.  
  10857.    * The 128-bit long double format that the Sparc port supports
  10858.      currently works by using the architecturally defined quad-word
  10859.      floating point instructions.  Since there is no hardware that
  10860.      supports these instructions they must be emulated by the operating
  10861.      system.  Long doubles do not work in Sun OS versions 4.0.3 and
  10862.      earlier, because the kernel eumulator uses an obsolete and
  10863.      incompatible format.  Long doubles do not work in Sun OS version
  10864.      4.1.1 due to a problem in a Sun library.  Long doubles do work on
  10865.      Sun OS versions 4.1.2 and higher, but GNU CC does not enable them
  10866.      by default.  Long doubles appear to work in Sun OS 5.x (Solaris
  10867.      2.x).
  10868.  
  10869.    * On HP-UX version 9.01 on the HP PA, the HP compiler `cc' does not
  10870.      compile GNU CC correctly.  We do not yet know why.  However, GNU CC
  10871.      compiled on earlier HP-UX versions works properly on HP-UX 9.01
  10872.      and can compile itself properly on 9.01.
  10873.  
  10874.    * On the HP PA machine, ADB sometimes fails to work on functions
  10875.      compiled with GNU CC.  Specifically, it fails to work on functions
  10876.      that use `alloca' or variable-size arrays.  This is because GNU CC
  10877.      doesn't generate HP-UX unwind descriptors for such functions.  It
  10878.      may even be impossible to generate them.
  10879.  
  10880.    * Debugging (`-g') is not supported on the HP PA machine, unless you
  10881.      use the preliminary GNU tools (*note Installation::.).
  10882.  
  10883.    * Taking the address of a label may generate errors from the HP-UX
  10884.      PA assembler.  GAS for the PA does not have this problem.
  10885.  
  10886.    * Using floating point parameters for indirect calls to static
  10887.      functions will not work when using the HP assembler.  There simply
  10888.      is no way for GCC to specify what registers hold arguments for
  10889.      static functions when using the HP assembler.  GAS for the PA does
  10890.      not have this problem.
  10891.  
  10892.    * In extremely rare cases involvving some very large functions you
  10893.      may receive errors from the HP linker complaining about an out of
  10894.      bounds unconditional branch offset.  This used to occur more often
  10895.      in previous versions of GNU CC, but is now exceptionally rare.  If
  10896.      you should run into it, you can work around by making your
  10897.      function smaller.
  10898.  
  10899.    * GNU CC compiled code sometimes emits warnings from the HP-UX
  10900.      assembler of the form:
  10901.  
  10902.           (warning) Use of GR3 when
  10903.             frame >= 8192 may cause conflict.
  10904.  
  10905.      These warnings are harmless and can be safely ignored.
  10906.  
  10907.    * The current version of the assembler (`/bin/as') for the RS/6000
  10908.      has certain problems that prevent the `-g' option in GCC from
  10909.      working.  Note that `Makefile.in' uses `-g' by default when
  10910.      compiling `libgcc2.c'.
  10911.  
  10912.      IBM has produced a fixed version of the assembler.  The upgraded
  10913.      assembler unfortunately was not included in any of the AIX 3.2
  10914.      update PTF releases (3.2.2, 3.2.3, or 3.2.3e).  Users of AIX 3.1
  10915.      should request PTF U403044 from IBM and users of AIX 3.2 should
  10916.      request PTF U416277.  See the file `README.RS6000' for more
  10917.      details on these updates.
  10918.  
  10919.      You can test for the presense of a fixed assembler by using the
  10920.      command
  10921.  
  10922.           as -u < /dev/null
  10923.  
  10924.      If the command exits normally, the assembler fix already is
  10925.      installed.  If the assembler complains that "-u" is an unknown
  10926.      flag, you need to order the fix.
  10927.  
  10928.    * On the IBM RS/6000, compiling code of the form
  10929.  
  10930.           extern int foo;
  10931.           
  10932.           ... foo ...
  10933.           
  10934.           static int foo;
  10935.  
  10936.      will cause the linker to report an undefined symbol `foo'.
  10937.      Although this behavior differs from most other systems, it is not a
  10938.      bug because redefining an `extern' variable as `static' is
  10939.      undefined in ANSI C.
  10940.  
  10941.    * AIX on the RS/6000 provides support (NLS) for environments outside
  10942.      of the United States.  Compilers and assemblers use NLS to support
  10943.      locale-specific representations of various objects including
  10944.      floating-point numbers ("." vs "," for separating decimal
  10945.      fractions).  There have been problems reported where the library
  10946.      linked with GCC does not produce the same floating-point formats
  10947.      that the assembler accepts.  If you have this problem, set the
  10948.      LANG environment variable to "C" or "En_US".
  10949.  
  10950.    * Even if you specify `-fdollars-in-identifiers', you cannot
  10951.      successfully use `$' in identifiers on the RS/6000 due to a
  10952.      restriction in the IBM assembler.  GAS supports these identifiers.
  10953.  
  10954.    * On the RS/6000, XLC version 1.3.0.0 will miscompile `jump.c'.  XLC
  10955.      version 1.3.0.1 or later fixes this problem.  You can obtain
  10956.      XLC-1.3.0.2 by requesting PTF 421749 from IBM.
  10957.  
  10958.    * There is an assembler bug in versions of DG/UX prior to 5.4.2.01
  10959.      that occurs when the `fldcr' instruction is used.  GNU CC uses
  10960.      `fldcr' on the 88100 to serialize volatile memory references.  Use
  10961.      the option `-mno-serialize-volatile' if your version of the
  10962.      assembler has this bug.
  10963.  
  10964.    * On VMS, GAS versions 1.38.1 and earlier may cause spurious warning
  10965.      messages from the linker.  These warning messages complain of
  10966.      mismatched psect attributes.  You can ignore them.  *Note VMS
  10967.      Install::.
  10968.  
  10969.    * On NewsOS version 3, if you include both of the files `stddef.h'
  10970.      and `sys/types.h', you get an error because there are two typedefs
  10971.      of `size_t'.  You should change `sys/types.h' by adding these
  10972.      lines around the definition of `size_t':
  10973.  
  10974.           #ifndef _SIZE_T
  10975.           #define _SIZE_T
  10976.           ACTUAL TYPEDEF HERE
  10977.           #endif
  10978.  
  10979.    * On the Alliant, the system's own convention for returning
  10980.      structures and unions is unusual, and is not compatible with GNU
  10981.      CC no matter what options are used.
  10982.  
  10983.    * On the IBM RT PC, the MetaWare HighC compiler (hc) uses a different
  10984.      convention for structure and union returning.  Use the option
  10985.      `-mhc-struct-return' to tell GNU CC to use a convention compatible
  10986.      with it.
  10987.  
  10988.    * On Ultrix, the Fortran compiler expects registers 2 through 5 to
  10989.      be saved by function calls.  However, the C compiler uses
  10990.      conventions compatible with BSD Unix: registers 2 through 5 may be
  10991.      clobbered by function calls.
  10992.  
  10993.      GNU CC uses the same convention as the Ultrix C compiler.  You can
  10994.      use these options to produce code compatible with the Fortran
  10995.      compiler:
  10996.  
  10997.           -fcall-saved-r2 -fcall-saved-r3 -fcall-saved-r4 -fcall-saved-r5
  10998.  
  10999.    * On the WE32k, you may find that programs compiled with GNU CC do
  11000.      not work with the standard shared C library.  You may need to link
  11001.      with the ordinary C compiler.  If you do so, you must specify the
  11002.      following options:
  11003.  
  11004.           -L/usr/local/lib/gcc-lib/we32k-att-sysv/2.7.0 -lgcc -lc_s
  11005.  
  11006.      The first specifies where to find the library `libgcc.a' specified
  11007.      with the `-lgcc' option.
  11008.  
  11009.      GNU CC does linking by invoking `ld', just as `cc' does, and there
  11010.      is no reason why it *should* matter which compilation program you
  11011.      use to invoke `ld'.  If someone tracks this problem down, it can
  11012.      probably be fixed easily.
  11013.  
  11014.    * On the Alpha, you may get assembler errors about invalid syntax as
  11015.      a result of floating point constants.  This is due to a bug in the
  11016.      C library functions `ecvt', `fcvt' and `gcvt'.  Given valid
  11017.      floating point numbers, they sometimes print `NaN'.
  11018.  
  11019.    * On Irix 4.0.5F (and perhaps in some other versions), an assembler
  11020.      bug sometimes reorders instructions incorrectly when optimization
  11021.      is turned on.  If you think this may be happening to you, try
  11022.      using the GNU assembler; GAS version 2.1 supports ECOFF on Irix.
  11023.  
  11024.      Or use the `-noasmopt' option when you compile GNU CC with itself,
  11025.      and then again when you compile your program.  (This is a temporary
  11026.      kludge to turn off assembler optimization on Irix.)  If this
  11027.      proves to be what you need, edit the assembler spec in the file
  11028.      `specs' so that it unconditionally passes `-O0' to the assembler,
  11029.      and never passes `-O2' or `-O3'.
  11030.  
  11031. 
  11032. File: use,  Node: External Bugs,  Next: Incompatibilities,  Prev: Interoperation,  Up: Trouble
  11033.  
  11034. Problems Compiling Certain Programs
  11035. ===================================
  11036.  
  11037.    Certain programs have problems compiling.
  11038.  
  11039.    * Parse errors may occur compiling X11 on a Decstation running
  11040.      Ultrix 4.2 because of problems in DEC's versions of the X11 header
  11041.      files `X11/Xlib.h' and `X11/Xutil.h'.  People recommend adding
  11042.      `-I/usr/include/mit' to use the MIT versions of the header files,
  11043.      using the `-traditional' switch to turn off ANSI C, or fixing the
  11044.      header files by adding this:
  11045.  
  11046.           #ifdef __STDC__
  11047.           #define NeedFunctionPrototypes 0
  11048.           #endif
  11049.  
  11050.    * If you have trouble compiling Perl on a SunOS 4 system, it may be
  11051.      because Perl specifies `-I/usr/ucbinclude'.  This accesses the
  11052.      unfixed header files.  Perl specifies the options
  11053.  
  11054.           -traditional -Dvolatile=__volatile__
  11055.           -I/usr/include/sun -I/usr/ucbinclude
  11056.           -fpcc-struct-return
  11057.  
  11058.      most of which are unnecessary with GCC 2.4.5 and newer versions.
  11059.      You can make a properly working Perl by setting `ccflags' to
  11060.      `-fwritable-strings' (implied by the `-traditional' in the
  11061.      original options) and `cppflags' to empty in `config.sh', then
  11062.      typing `./doSH; make depend; make'.
  11063.  
  11064.    * On various 386 Unix systems derived from System V, including SCO,
  11065.      ISC, and ESIX, you may get error messages about running out of
  11066.      virtual memory while compiling certain programs.
  11067.  
  11068.      You can prevent this problem by linking GNU CC with the GNU malloc
  11069.      (which thus replaces the malloc that comes with the system).  GNU
  11070.      malloc is available as a separate package, and also in the file
  11071.      `src/gmalloc.c' in the GNU Emacs 19 distribution.
  11072.  
  11073.      If you have installed GNU malloc as a separate library package,
  11074.      use this option when you relink GNU CC:
  11075.  
  11076.           MALLOC=/usr/local/lib/libgmalloc.a
  11077.  
  11078.      Alternatively, if you have compiled `gmalloc.c' from Emacs 19, copy
  11079.      the object file to `gmalloc.o' and use this option when you relink
  11080.      GNU CC:
  11081.  
  11082.           MALLOC=gmalloc.o
  11083.  
  11084. 
  11085. File: use,  Node: Incompatibilities,  Next: Fixed Headers,  Prev: External Bugs,  Up: Trouble
  11086.  
  11087. Incompatibilities of GNU CC
  11088. ===========================
  11089.  
  11090.    There are several noteworthy incompatibilities between GNU C and most
  11091. existing (non-ANSI) versions of C.  The `-traditional' option
  11092. eliminates many of these incompatibilities, *but not all*, by telling
  11093. GNU C to behave like the other C compilers.
  11094.  
  11095.    * GNU CC normally makes string constants read-only.  If several
  11096.      identical-looking string constants are used, GNU CC stores only one
  11097.      copy of the string.
  11098.  
  11099.      One consequence is that you cannot call `mktemp' with a string
  11100.      constant argument.  The function `mktemp' always alters the string
  11101.      its argument points to.
  11102.  
  11103.      Another consequence is that `sscanf' does not work on some systems
  11104.      when passed a string constant as its format control string or
  11105.      input.  This is because `sscanf' incorrectly tries to write into
  11106.      the string constant.  Likewise `fscanf' and `scanf'.
  11107.  
  11108.      The best solution to these problems is to change the program to use
  11109.      `char'-array variables with initialization strings for these
  11110.      purposes instead of string constants.  But if this is not possible,
  11111.      you can use the `-fwritable-strings' flag, which directs GNU CC to
  11112.      handle string constants the same way most C compilers do.
  11113.      `-traditional' also has this effect, among others.
  11114.  
  11115.    * `-2147483648' is positive.
  11116.  
  11117.      This is because 2147483648 cannot fit in the type `int', so
  11118.      (following the ANSI C rules) its data type is `unsigned long int'.
  11119.      Negating this value yields 2147483648 again.
  11120.  
  11121.    * GNU CC does not substitute macro arguments when they appear inside
  11122.      of string constants.  For example, the following macro in GNU CC
  11123.  
  11124.           #define foo(a) "a"
  11125.  
  11126.      will produce output `"a"' regardless of what the argument A is.
  11127.  
  11128.      The `-traditional' option directs GNU CC to handle such cases
  11129.      (among others) in the old-fashioned (non-ANSI) fashion.
  11130.  
  11131.    * When you use `setjmp' and `longjmp', the only automatic variables
  11132.      guaranteed to remain valid are those declared `volatile'.  This is
  11133.      a consequence of automatic register allocation.  Consider this
  11134.      function:
  11135.  
  11136.           jmp_buf j;
  11137.           
  11138.           foo ()
  11139.           {
  11140.             int a, b;
  11141.           
  11142.             a = fun1 ();
  11143.             if (setjmp (j))
  11144.               return a;
  11145.           
  11146.             a = fun2 ();
  11147.             /* `longjmp (j)' may occur in `fun3'. */
  11148.             return a + fun3 ();
  11149.           }
  11150.  
  11151.      Here `a' may or may not be restored to its first value when the
  11152.      `longjmp' occurs.  If `a' is allocated in a register, then its
  11153.      first value is restored; otherwise, it keeps the last value stored
  11154.      in it.
  11155.  
  11156.      If you use the `-W' option with the `-O' option, you will get a
  11157.      warning when GNU CC thinks such a problem might be possible.
  11158.  
  11159.      The `-traditional' option directs GNU C to put variables in the
  11160.      stack by default, rather than in registers, in functions that call
  11161.      `setjmp'.  This results in the behavior found in traditional C
  11162.      compilers.
  11163.  
  11164.    * Programs that use preprocessing directives in the middle of macro
  11165.      arguments do not work with GNU CC.  For example, a program like
  11166.      this will not work:
  11167.  
  11168.           foobar (
  11169.           #define luser
  11170.                   hack)
  11171.  
  11172.      ANSI C does not permit such a construct.  It would make sense to
  11173.      support it when `-traditional' is used, but it is too much work to
  11174.      implement.
  11175.  
  11176.    * Declarations of external variables and functions within a block
  11177.      apply only to the block containing the declaration.  In other
  11178.      words, they have the same scope as any other declaration in the
  11179.      same place.
  11180.  
  11181.      In some other C compilers, a `extern' declaration affects all the
  11182.      rest of the file even if it happens within a block.
  11183.  
  11184.      The `-traditional' option directs GNU C to treat all `extern'
  11185.      declarations as global, like traditional compilers.
  11186.  
  11187.    * In traditional C, you can combine `long', etc., with a typedef
  11188.      name, as shown here:
  11189.  
  11190.           typedef int foo;
  11191.           typedef long foo bar;
  11192.  
  11193.      In ANSI C, this is not allowed: `long' and other type modifiers
  11194.      require an explicit `int'.  Because this criterion is expressed by
  11195.      Bison grammar rules rather than C code, the `-traditional' flag
  11196.      cannot alter it.
  11197.  
  11198.    * PCC allows typedef names to be used as function parameters.  The
  11199.      difficulty described immediately above applies here too.
  11200.  
  11201.    * PCC allows whitespace in the middle of compound assignment
  11202.      operators such as `+='.  GNU CC, following the ANSI standard, does
  11203.      not allow this.  The difficulty described immediately above
  11204.      applies here too.
  11205.  
  11206.    * GNU CC complains about unterminated character constants inside of
  11207.      preprocessing conditionals that fail.  Some programs have English
  11208.      comments enclosed in conditionals that are guaranteed to fail; if
  11209.      these comments contain apostrophes, GNU CC will probably report an
  11210.      error.  For example, this code would produce an error:
  11211.  
  11212.           #if 0
  11213.           You can't expect this to work.
  11214.           #endif
  11215.  
  11216.      The best solution to such a problem is to put the text into an
  11217.      actual C comment delimited by `/*...*/'.  However, `-traditional'
  11218.      suppresses these error messages.
  11219.  
  11220.    * Many user programs contain the declaration `long time ();'.  In the
  11221.      past, the system header files on many systems did not actually
  11222.      declare `time', so it did not matter what type your program
  11223.      declared it to return.  But in systems with ANSI C headers, `time'
  11224.      is declared to return `time_t', and if that is not the same as
  11225.      `long', then `long time ();' is erroneous.
  11226.  
  11227.      The solution is to change your program to use `time_t' as the
  11228.      return type of `time'.
  11229.  
  11230.    * When compiling functions that return `float', PCC converts it to a
  11231.      double.  GNU CC actually returns a `float'.  If you are concerned
  11232.      with PCC compatibility, you should declare your functions to return
  11233.      `double'; you might as well say what you mean.
  11234.  
  11235.    * When compiling functions that return structures or unions, GNU CC
  11236.      output code normally uses a method different from that used on most
  11237.      versions of Unix.  As a result, code compiled with GNU CC cannot
  11238.      call a structure-returning function compiled with PCC, and vice
  11239.      versa.
  11240.  
  11241.      The method used by GNU CC is as follows: a structure or union
  11242.      which is 1, 2, 4 or 8 bytes long is returned like a scalar.  A
  11243.      structure or union with any other size is stored into an address
  11244.      supplied by the caller (usually in a special, fixed register, but
  11245.      on some machines it is passed on the stack).  The
  11246.      machine-description macros `STRUCT_VALUE' and
  11247.      `STRUCT_INCOMING_VALUE' tell GNU CC where to pass this address.
  11248.  
  11249.      By contrast, PCC on most target machines returns structures and
  11250.      unions of any size by copying the data into an area of static
  11251.      storage, and then returning the address of that storage as if it
  11252.      were a pointer value.  The caller must copy the data from that
  11253.      memory area to the place where the value is wanted.  GNU CC does
  11254.      not use this method because it is slower and nonreentrant.
  11255.  
  11256.      On some newer machines, PCC uses a reentrant convention for all
  11257.      structure and union returning.  GNU CC on most of these machines
  11258.      uses a compatible convention when returning structures and unions
  11259.      in memory, but still returns small structures and unions in
  11260.      registers.
  11261.  
  11262.      You can tell GNU CC to use a compatible convention for all
  11263.      structure and union returning with the option
  11264.      `-fpcc-struct-return'.
  11265.  
  11266.    * GNU C complains about program fragments such as `0x74ae-0x4000'
  11267.      which appear to be two hexadecimal constants separated by the minus
  11268.      operator.  Actually, this string is a single "preprocessing token".
  11269.      Each such token must correspond to one token in C.  Since this
  11270.      does not, GNU C prints an error message.  Although it may appear
  11271.      obvious that what is meant is an operator and two values, the ANSI
  11272.      C standard specifically requires that this be treated as erroneous.
  11273.  
  11274.      A "preprocessing token" is a "preprocessing number" if it begins
  11275.      with a digit and is followed by letters, underscores, digits,
  11276.      periods and `e+', `e-', `E+', or `E-' character sequences.
  11277.  
  11278.      To make the above program fragment valid, place whitespace in
  11279.      front of the minus sign.  This whitespace will end the
  11280.      preprocessing number.
  11281.  
  11282. 
  11283. File: use,  Node: Fixed Headers,  Next: Standard Libraries,  Prev: Incompatibilities,  Up: Trouble
  11284.  
  11285. Fixed Header Files
  11286. ==================
  11287.  
  11288.    GNU CC needs to install corrected versions of some system header
  11289. files.  This is because most target systems have some header files that
  11290. won't work with GNU CC unless they are changed.  Some have bugs, some
  11291. are incompatible with ANSI C, and some depend on special features of
  11292. other compilers.
  11293.  
  11294.    Installing GNU CC automatically creates and installs the fixed header
  11295. files, by running a program called `fixincludes' (or for certain
  11296. targets an alternative such as `fixinc.svr4').  Normally, you don't
  11297. need to pay attention to this.  But there are cases where it doesn't do
  11298. the right thing automatically.
  11299.  
  11300.    * If you update the system's header files, such as by installing a
  11301.      new system version, the fixed header files of GNU CC are not
  11302.      automatically updated.  The easiest way to update them is to
  11303.      reinstall GNU CC.  (If you want to be clever, look in the makefile
  11304.      and you can find a shortcut.)
  11305.  
  11306.    * On some systems, in particular SunOS 4, header file directories
  11307.      contain machine-specific symbolic links in certain places.  This
  11308.      makes it possible to share most of the header files among hosts
  11309.      running the same version of SunOS 4 on different machine models.
  11310.  
  11311.      The programs that fix the header files do not understand this
  11312.      special way of using symbolic links; therefore, the directory of
  11313.      fixed header files is good only for the machine model used to
  11314.      build it.
  11315.  
  11316.      In SunOS 4, only programs that look inside the kernel will notice
  11317.      the difference between machine models.  Therefore, for most
  11318.      purposes, you need not be concerned about this.
  11319.  
  11320.      It is possible to make separate sets of fixed header files for the
  11321.      different machine models, and arrange a structure of symbolic
  11322.      links so as to use the proper set, but you'll have to do this by
  11323.      hand.
  11324.  
  11325.    * On Lynxos, GNU CC by default does not fix the header files.  This
  11326.      is because bugs in the shell cause the `fixincludes' script to
  11327.      fail.
  11328.  
  11329.      This means you will encounter problems due to bugs in the system
  11330.      header files.  It may be no comfort that they aren't GNU CC's
  11331.      fault, but it does mean that there's nothing for us to do about
  11332.      them.
  11333.  
  11334. 
  11335. File: use,  Node: Standard Libraries,  Next: Disappointments,  Prev: Fixed Headers,  Up: Trouble
  11336.  
  11337. Standard Libraries
  11338. ==================
  11339.  
  11340.    GNU CC by itself attempts to be what the ISO/ANSI C standard calls a
  11341. "conforming freestanding implementation".  This means all ANSI C
  11342. language features are available, as well as the contents of `float.h',
  11343. `limits.h', `stdarg.h', and `stddef.h'.  The rest of the C library is
  11344. supplied by the vendor of the operating system.  If that C library
  11345. doesn't conform to the C standards, then your programs might get
  11346. warnings (especially when using `-Wall') that you don't expect.
  11347.  
  11348.    For example, the `sprintf' function on SunOS 4.1.3 returns `char *'
  11349. while the C standard says that `sprintf' returns an `int'.  The
  11350. `fixincludes' program could make the prototype for this function match
  11351. the Standard, but that would be wrong, since the function will still
  11352. return `char *'.
  11353.  
  11354.    If you need a Standard compliant library, then you need to find one,
  11355. as GNU CC does not provide one.  The GNU C library (called `glibc') has
  11356. been ported to a number of operating systems, and provides ANSI/ISO,
  11357. POSIX, BSD and SystemV compatibility.  You could also ask your operating
  11358. system vendor if newer libraries are available.
  11359.  
  11360. 
  11361. File: use,  Node: Disappointments,  Next: C++ Misunderstandings,  Prev: Standard Libraries,  Up: Trouble
  11362.  
  11363. Disappointments and Misunderstandings
  11364. =====================================
  11365.  
  11366.    These problems are perhaps regrettable, but we don't know any
  11367. practical way around them.
  11368.  
  11369.    * Certain local variables aren't recognized by debuggers when you
  11370.      compile with optimization.
  11371.  
  11372.      This occurs because sometimes GNU CC optimizes the variable out of
  11373.      existence.  There is no way to tell the debugger how to compute the
  11374.      value such a variable "would have had", and it is not clear that
  11375.      would be desirable anyway.  So GNU CC simply does not mention the
  11376.      eliminated variable when it writes debugging information.
  11377.  
  11378.      You have to expect a certain amount of disagreement between the
  11379.      executable and your source code, when you use optimization.
  11380.  
  11381.    * Users often think it is a bug when GNU CC reports an error for code
  11382.      like this:
  11383.  
  11384.           int foo (struct mumble *);
  11385.           
  11386.           struct mumble { ... };
  11387.           
  11388.           int foo (struct mumble *x)
  11389.           { ... }
  11390.  
  11391.      This code really is erroneous, because the scope of `struct
  11392.      mumble' in the prototype is limited to the argument list
  11393.      containing it.  It does not refer to the `struct mumble' defined
  11394.      with file scope immediately below--they are two unrelated types
  11395.      with similar names in different scopes.
  11396.  
  11397.      But in the definition of `foo', the file-scope type is used
  11398.      because that is available to be inherited.  Thus, the definition
  11399.      and the prototype do not match, and you get an error.
  11400.  
  11401.      This behavior may seem silly, but it's what the ANSI standard
  11402.      specifies.  It is easy enough for you to make your code work by
  11403.      moving the definition of `struct mumble' above the prototype.
  11404.      It's not worth being incompatible with ANSI C just to avoid an
  11405.      error for the example shown above.
  11406.  
  11407.    * Accesses to bitfields even in volatile objects works by accessing
  11408.      larger objects, such as a byte or a word.  You cannot rely on what
  11409.      size of object is accessed in order to read or write the bitfield;
  11410.      it may even vary for a given bitfield according to the precise
  11411.      usage.
  11412.  
  11413.      If you care about controlling the amount of memory that is
  11414.      accessed, use volatile but do not use bitfields.
  11415.  
  11416.    * GNU CC comes with shell scripts to fix certain known problems in
  11417.      system header files.  They install corrected copies of various
  11418.      header files in a special directory where only GNU CC will
  11419.      normally look for them.  The scripts adapt to various systems by
  11420.      searching all the system header files for the problem cases that
  11421.      we know about.
  11422.  
  11423.      If new system header files are installed, nothing automatically
  11424.      arranges to update the corrected header files.  You will have to
  11425.      reinstall GNU CC to fix the new header files.  More specifically,
  11426.      go to the build directory and delete the files `stmp-fixinc' and
  11427.      `stmp-headers', and the subdirectory `include'; then do `make
  11428.      install' again.
  11429.  
  11430.    * On 68000 systems, you can get paradoxical results if you test the
  11431.      precise values of floating point numbers.  For example, you can
  11432.      find that a floating point value which is not a NaN is not equal
  11433.      to itself.  This results from the fact that the the floating point
  11434.      registers hold a few more bits of precision than fit in a `double'
  11435.      in memory.  Compiled code moves values between memory and floating
  11436.      point registers at its convenience, and moving them into memory
  11437.      truncates them.
  11438.  
  11439.      You can partially avoid this problem by using the `-ffloat-store'
  11440.      option (*note Optimize Options::.).
  11441.  
  11442.    * On the MIPS, variable argument functions using `varargs.h' cannot
  11443.      have a floating point value for the first argument.  The reason
  11444.      for this is that in the absence of a prototype in scope, if the
  11445.      first argument is a floating point, it is passed in a floating
  11446.      point register, rather than an integer register.
  11447.  
  11448.      If the code is rewritten to use the ANSI standard `stdarg.h'
  11449.      method of variable arguments, and the prototype is in scope at the
  11450.      time of the call, everything will work fine.
  11451.  
  11452. 
  11453. File: use,  Node: C++ Misunderstandings,  Next: Protoize Caveats,  Prev: Disappointments,  Up: Trouble
  11454.  
  11455. Common Misunderstandings with GNU C++
  11456. =====================================
  11457.  
  11458.    C++ is a complex language and an evolving one, and its standard
  11459. definition (the ANSI C++ draft standard) is also evolving.  As a result,
  11460. your C++ compiler may occasionally surprise you, even when its behavior
  11461. is correct.  This section discusses some areas that frequently give
  11462. rise to questions of this sort.
  11463.  
  11464. * Menu:
  11465.  
  11466. * Static Definitions::  Static member declarations are not definitions
  11467. * Temporaries::         Temporaries may vanish before you expect
  11468.  
  11469. 
  11470. File: use,  Node: Static Definitions,  Next: Temporaries,  Up: C++ Misunderstandings
  11471.  
  11472. Declare *and* Define Static Members
  11473. -----------------------------------
  11474.  
  11475.    When a class has static data members, it is not enough to *declare*
  11476. the static member; you must also *define* it.  For example:
  11477.  
  11478.      class Foo
  11479.      {
  11480.        ...
  11481.        void method();
  11482.        static int bar;
  11483.      };
  11484.  
  11485.    This declaration only establishes that the class `Foo' has an `int'
  11486. named `Foo::bar', and a member function named `Foo::method'.  But you
  11487. still need to define *both* `method' and `bar' elsewhere.  According to
  11488. the draft ANSI standard, you must supply an initializer in one (and
  11489. only one) source file, such as:
  11490.  
  11491.      int Foo::bar = 0;
  11492.  
  11493.    Other C++ compilers may not correctly implement the standard
  11494. behavior.  As a result, when you switch to `g++' from one of these
  11495. compilers, you may discover that a program that appeared to work
  11496. correctly in fact does not conform to the standard: `g++' reports as
  11497. undefined symbols any static data members that lack definitions.
  11498.  
  11499. 
  11500. File: use,  Node: Temporaries,  Prev: Static Definitions,  Up: C++ Misunderstandings
  11501.  
  11502. Temporaries May Vanish Before You Expect
  11503. ----------------------------------------
  11504.  
  11505.    It is dangerous to use pointers or references to *portions* of a
  11506. temporary object.  The compiler may very well delete the object before
  11507. you expect it to, leaving a pointer to garbage.  The most common place
  11508. where this problem crops up is in classes like the libg++ `String'
  11509. class, that define a conversion function to type `char *' or `const
  11510. char *'.  However, any class that returns a pointer to some internal
  11511. structure is potentially subject to this problem.
  11512.  
  11513.    For example, a program may use a function `strfunc' that returns
  11514. `String' objects, and another function `charfunc' that operates on
  11515. pointers to `char':
  11516.  
  11517.      String strfunc ();
  11518.      void charfunc (const char *);
  11519.  
  11520. In this situation, it may seem natural to write
  11521. `charfunc (strfunc ());' based on the knowledge that class `String' has
  11522. an explicit conversion to `char' pointers.  However, what really
  11523. happens is akin to `charfunc (strfunc ().convert ());', where the
  11524. `convert' method is a function to do the same data conversion normally
  11525. performed by a cast.  Since the last use of the temporary `String'
  11526. object is the call to the conversion function, the compiler may delete
  11527. that object before actually calling `charfunc'.  The compiler has no
  11528. way of knowing that deleting the `String' object will invalidate the
  11529. pointer.  The pointer then points to garbage, so that by the time
  11530. `charfunc' is called, it gets an invalid argument.
  11531.  
  11532.    Code like this may run successfully under some other compilers,
  11533. especially those that delete temporaries relatively late.  However, the
  11534. GNU C++ behavior is also standard-conformant, so if your program depends
  11535. on late destruction of temporaries it is not portable.
  11536.  
  11537.    If you think this is surprising, you should be aware that the ANSI
  11538. C++ committee continues to debate the lifetime-of-temporaries problem.
  11539.  
  11540.    For now, at least, the safe way to write such code is to give the
  11541. temporary a name, which forces it to remain until the end of the scope
  11542. of the name.  For example:
  11543.  
  11544.      String& tmp = strfunc ();
  11545.      charfunc (tmp);
  11546.  
  11547. 
  11548. File: use,  Node: Protoize Caveats,  Next: Non-bugs,  Prev: C++ Misunderstandings,  Up: Trouble
  11549.  
  11550. Caveats of using `protoize'
  11551. ===========================
  11552.  
  11553.    The conversion programs `protoize' and `unprotoize' can sometimes
  11554. change a source file in a way that won't work unless you rearrange it.
  11555.  
  11556.    * `protoize' can insert references to a type name or type tag before
  11557.      the definition, or in a file where they are not defined.
  11558.  
  11559.      If this happens, compiler error messages should show you where the
  11560.      new references are, so fixing the file by hand is straightforward.
  11561.  
  11562.    * There are some C constructs which `protoize' cannot figure out.
  11563.      For example, it can't determine argument types for declaring a
  11564.      pointer-to-function variable; this you must do by hand.  `protoize'
  11565.      inserts a comment containing `???' each time it finds such a
  11566.      variable; so you can find all such variables by searching for this
  11567.      string.  ANSI C does not require declaring the argument types of
  11568.      pointer-to-function types.
  11569.  
  11570.    * Using `unprotoize' can easily introduce bugs.  If the program
  11571.      relied on prototypes to bring about conversion of arguments, these
  11572.      conversions will not take place in the program without prototypes.
  11573.      One case in which you can be sure `unprotoize' is safe is when you
  11574.      are removing prototypes that were made with `protoize'; if the
  11575.      program worked before without any prototypes, it will work again
  11576.      without them.
  11577.  
  11578.      You can find all the places where this problem might occur by
  11579.      compiling the program with the `-Wconversion' option.  It prints a
  11580.      warning whenever an argument is converted.
  11581.  
  11582.    * Both conversion programs can be confused if there are macro calls
  11583.      in and around the text to be converted.  In other words, the
  11584.      standard syntax for a declaration or definition must not result
  11585.      from expanding a macro.  This problem is inherent in the design of
  11586.      C and cannot be fixed.  If only a few functions have confusing
  11587.      macro calls, you can easily convert them manually.
  11588.  
  11589.    * `protoize' cannot get the argument types for a function whose
  11590.      definition was not actually compiled due to preprocessing
  11591.      conditionals.  When this happens, `protoize' changes nothing in
  11592.      regard to such a function.  `protoize' tries to detect such
  11593.      instances and warn about them.
  11594.  
  11595.      You can generally work around this problem by using `protoize' step
  11596.      by step, each time specifying a different set of `-D' options for
  11597.      compilation, until all of the functions have been converted.
  11598.      There is no automatic way to verify that you have got them all,
  11599.      however.
  11600.  
  11601.    * Confusion may result if there is an occasion to convert a function
  11602.      declaration or definition in a region of source code where there
  11603.      is more than one formal parameter list present.  Thus, attempts to
  11604.      convert code containing multiple (conditionally compiled) versions
  11605.      of a single function header (in the same vicinity) may not produce
  11606.      the desired (or expected) results.
  11607.  
  11608.      If you plan on converting source files which contain such code, it
  11609.      is recommended that you first make sure that each conditionally
  11610.      compiled region of source code which contains an alternative
  11611.      function header also contains at least one additional follower
  11612.      token (past the final right parenthesis of the function header).
  11613.      This should circumvent the problem.
  11614.  
  11615.    * `unprotoize' can become confused when trying to convert a function
  11616.      definition or declaration which contains a declaration for a
  11617.      pointer-to-function formal argument which has the same name as the
  11618.      function being defined or declared.  We recommand you avoid such
  11619.      choices of formal parameter names.
  11620.  
  11621.    * You might also want to correct some of the indentation by hand and
  11622.      break long lines.  (The conversion programs don't write lines
  11623.      longer than eighty characters in any case.)
  11624.  
  11625. 
  11626. File: use,  Node: Non-bugs,  Next: Warnings and Errors,  Prev: Protoize Caveats,  Up: Trouble
  11627.  
  11628. Certain Changes We Don't Want to Make
  11629. =====================================
  11630.  
  11631.    This section lists changes that people frequently request, but which
  11632. we do not make because we think GNU CC is better without them.
  11633.  
  11634.    * Checking the number and type of arguments to a function which has
  11635.      an old-fashioned definition and no prototype.
  11636.  
  11637.      Such a feature would work only occasionally--only for calls that
  11638.      appear in the same file as the called function, following the
  11639.      definition.  The only way to check all calls reliably is to add a
  11640.      prototype for the function.  But adding a prototype eliminates the
  11641.      motivation for this feature.  So the feature is not worthwhile.
  11642.  
  11643.    * Warning about using an expression whose type is signed as a shift
  11644.      count.
  11645.  
  11646.      Shift count operands are probably signed more often than unsigned.
  11647.      Warning about this would cause far more annoyance than good.
  11648.  
  11649.    * Warning about assigning a signed value to an unsigned variable.
  11650.  
  11651.      Such assignments must be very common; warning about them would
  11652.      cause more annoyance than good.
  11653.  
  11654.    * Warning about unreachable code.
  11655.  
  11656.      It's very common to have unreachable code in machine-generated
  11657.      programs.  For example, this happens normally in some files of GNU
  11658.      C itself.
  11659.  
  11660.    * Warning when a non-void function value is ignored.
  11661.  
  11662.      Coming as I do from a Lisp background, I balk at the idea that
  11663.      there is something dangerous about discarding a value.  There are
  11664.      functions that return values which some callers may find useful;
  11665.      it makes no sense to clutter the program with a cast to `void'
  11666.      whenever the value isn't useful.
  11667.  
  11668.    * Assuming (for optimization) that the address of an external symbol
  11669.      is never zero.
  11670.  
  11671.      This assumption is false on certain systems when `#pragma weak' is
  11672.      used.
  11673.  
  11674.    * Making `-fshort-enums' the default.
  11675.  
  11676.      This would cause storage layout to be incompatible with most other
  11677.      C compilers.  And it doesn't seem very important, given that you
  11678.      can get the same result in other ways.  The case where it matters
  11679.      most is when the enumeration-valued object is inside a structure,
  11680.      and in that case you can specify a field width explicitly.
  11681.  
  11682.    * Making bitfields unsigned by default on particular machines where
  11683.      "the ABI standard" says to do so.
  11684.  
  11685.      The ANSI C standard leaves it up to the implementation whether a
  11686.      bitfield declared plain `int' is signed or not.  This in effect
  11687.      creates two alternative dialects of C.
  11688.  
  11689.      The GNU C compiler supports both dialects; you can specify the
  11690.      signed dialect with `-fsigned-bitfields' and the unsigned dialect
  11691.      with `-funsigned-bitfields'.  However, this leaves open the
  11692.      question of which dialect to use by default.
  11693.  
  11694.      Currently, the preferred dialect makes plain bitfields signed,
  11695.      because this is simplest.  Since `int' is the same as `signed int'
  11696.      in every other context, it is cleanest for them to be the same in
  11697.      bitfields as well.
  11698.  
  11699.      Some computer manufacturers have published Application Binary
  11700.      Interface standards which specify that plain bitfields should be
  11701.      unsigned.  It is a mistake, however, to say anything about this
  11702.      issue in an ABI.  This is because the handling of plain bitfields
  11703.      distinguishes two dialects of C.  Both dialects are meaningful on
  11704.      every type of machine.  Whether a particular object file was
  11705.      compiled using signed bitfields or unsigned is of no concern to
  11706.      other object files, even if they access the same bitfields in the
  11707.      same data structures.
  11708.  
  11709.      A given program is written in one or the other of these two
  11710.      dialects.  The program stands a chance to work on most any machine
  11711.      if it is compiled with the proper dialect.  It is unlikely to work
  11712.      at all if compiled with the wrong dialect.
  11713.  
  11714.      Many users appreciate the GNU C compiler because it provides an
  11715.      environment that is uniform across machines.  These users would be
  11716.      inconvenienced if the compiler treated plain bitfields differently
  11717.      on certain machines.
  11718.  
  11719.      Occasionally users write programs intended only for a particular
  11720.      machine type.  On these occasions, the users would benefit if the
  11721.      GNU C compiler were to support by default the same dialect as the
  11722.      other compilers on that machine.  But such applications are rare.
  11723.      And users writing a program to run on more than one type of
  11724.      machine cannot possibly benefit from this kind of compatibility.
  11725.  
  11726.      This is why GNU CC does and will treat plain bitfields in the same
  11727.      fashion on all types of machines (by default).
  11728.  
  11729.      There are some arguments for making bitfields unsigned by default
  11730.      on all machines.  If, for example, this becomes a universal de
  11731.      facto standard, it would make sense for GNU CC to go along with
  11732.      it.  This is something to be considered in the future.
  11733.  
  11734.      (Of course, users strongly concerned about portability should
  11735.      indicate explicitly in each bitfield whether it is signed or not.
  11736.      In this way, they write programs which have the same meaning in
  11737.      both C dialects.)
  11738.  
  11739.    * Undefining `__STDC__' when `-ansi' is not used.
  11740.  
  11741.      Currently, GNU CC defines `__STDC__' as long as you don't use
  11742.      `-traditional'.  This provides good results in practice.
  11743.  
  11744.      Programmers normally use conditionals on `__STDC__' to ask whether
  11745.      it is safe to use certain features of ANSI C, such as function
  11746.      prototypes or ANSI token concatenation.  Since plain `gcc' supports
  11747.      all the features of ANSI C, the correct answer to these questions
  11748.      is "yes".
  11749.  
  11750.      Some users try to use `__STDC__' to check for the availability of
  11751.      certain library facilities.  This is actually incorrect usage in
  11752.      an ANSI C program, because the ANSI C standard says that a
  11753.      conforming freestanding implementation should define `__STDC__'
  11754.      even though it does not have the library facilities.  `gcc -ansi
  11755.      -pedantic' is a conforming freestanding implementation, and it is
  11756.      therefore required to define `__STDC__', even though it does not
  11757.      come with an ANSI C library.
  11758.  
  11759.      Sometimes people say that defining `__STDC__' in a compiler that
  11760.      does not completely conform to the ANSI C standard somehow
  11761.      violates the standard.  This is illogical.  The standard is a
  11762.      standard for compilers that claim to support ANSI C, such as `gcc
  11763.      -ansi'--not for other compilers such as plain `gcc'.  Whatever the
  11764.      ANSI C standard says is relevant to the design of plain `gcc'
  11765.      without `-ansi' only for pragmatic reasons, not as a requirement.
  11766.  
  11767.    * Undefining `__STDC__' in C++.
  11768.  
  11769.      Programs written to compile with C++-to-C translators get the
  11770.      value of `__STDC__' that goes with the C compiler that is
  11771.      subsequently used.  These programs must test `__STDC__' to
  11772.      determine what kind of C preprocessor that compiler uses: whether
  11773.      they should concatenate tokens in the ANSI C fashion or in the
  11774.      traditional fashion.
  11775.  
  11776.      These programs work properly with GNU C++ if `__STDC__' is defined.
  11777.      They would not work otherwise.
  11778.  
  11779.      In addition, many header files are written to provide prototypes
  11780.      in ANSI C but not in traditional C.  Many of these header files
  11781.      can work without change in C++ provided `__STDC__' is defined.  If
  11782.      `__STDC__' is not defined, they will all fail, and will all need
  11783.      to be changed to test explicitly for C++ as well.
  11784.  
  11785.    * Deleting "empty" loops.
  11786.  
  11787.      GNU CC does not delete "empty" loops because the most likely reason
  11788.      you would put one in a program is to have a delay.  Deleting them
  11789.      will not make real programs run any faster, so it would be
  11790.      pointless.
  11791.  
  11792.      It would be different if optimization of a nonempty loop could
  11793.      produce an empty one.  But this generally can't happen.
  11794.  
  11795.    * Making side effects happen in the same order as in some other
  11796.      compiler.
  11797.  
  11798.      It is never safe to depend on the order of evaluation of side
  11799.      effects.  For example, a function call like this may very well
  11800.      behave differently from one compiler to another:
  11801.  
  11802.           void func (int, int);
  11803.           
  11804.           int i = 2;
  11805.           func (i++, i++);
  11806.  
  11807.      There is no guarantee (in either the C or the C++ standard language
  11808.      definitions) that the increments will be evaluated in any
  11809.      particular order.  Either increment might happen first.  `func'
  11810.      might get the arguments `2, 3', or it might get `3, 2', or even
  11811.      `2, 2'.
  11812.  
  11813.    * Not allowing structures with volatile fields in registers.
  11814.  
  11815.      Strictly speaking, there is no prohibition in the ANSI C standard
  11816.      against allowing structures with volatile fields in registers, but
  11817.      it does not seem to make any sense and is probably not what you
  11818.      wanted to do.  So the compiler will give an error message in this
  11819.      case.
  11820.  
  11821. 
  11822. File: use,  Node: Warnings and Errors,  Prev: Non-bugs,  Up: Trouble
  11823.  
  11824. Warning Messages and Error Messages
  11825. ===================================
  11826.  
  11827.    The GNU compiler can produce two kinds of diagnostics: errors and
  11828. warnings.  Each kind has a different purpose:
  11829.  
  11830.      *Errors* report problems that make it impossible to compile your
  11831.      program.  GNU CC reports errors with the source file name and line
  11832.      number where the problem is apparent.
  11833.  
  11834.      *Warnings* report other unusual conditions in your code that *may*
  11835.      indicate a problem, although compilation can (and does) proceed.
  11836.      Warning messages also report the source file name and line number,
  11837.      but include the text `warning:' to distinguish them from error
  11838.      messages.
  11839.  
  11840.    Warnings may indicate danger points where you should check to make
  11841. sure that your program really does what you intend; or the use of
  11842. obsolete features; or the use of nonstandard features of GNU C or C++.
  11843. Many warnings are issued only if you ask for them, with one of the `-W'
  11844. options (for instance, `-Wall' requests a variety of useful warnings).
  11845.  
  11846.    GNU CC always tries to compile your program if possible; it never
  11847. gratuitously rejects a program whose meaning is clear merely because
  11848. (for instance) it fails to conform to a standard.  In some cases,
  11849. however, the C and C++ standards specify that certain extensions are
  11850. forbidden, and a diagnostic *must* be issued by a conforming compiler.
  11851. The `-pedantic' option tells GNU CC to issue warnings in such cases;
  11852. `-pedantic-errors' says to make them errors instead.  This does not
  11853. mean that *all* non-ANSI constructs get warnings or errors.
  11854.  
  11855.    *Note Options to Request or Suppress Warnings: Warning Options, for
  11856. more detail on these and related command-line options.
  11857.  
  11858. 
  11859. File: use,  Node: Bugs,  Next: Service,  Prev: Trouble,  Up: Top
  11860.  
  11861. Reporting Bugs
  11862. **************
  11863.  
  11864.    Your bug reports play an essential role in making GNU CC reliable.
  11865.  
  11866.    When you encounter a problem, the first thing to do is to see if it
  11867. is already known.  *Note Trouble::.  If it isn't known, then you should
  11868. report the problem.
  11869.  
  11870.    Reporting a bug may help you by bringing a solution to your problem,
  11871. or it may not.  (If it does not, look in the service directory; see
  11872. *Note Service::.)  In any case, the principal function of a bug report
  11873. is to help the entire community by making the next version of GNU CC
  11874. work better.  Bug reports are your contribution to the maintenance of
  11875. GNU CC.
  11876.  
  11877.    Since the maintainers are very overloaded, we cannot respond to every
  11878. bug report.  However, if the bug has not been fixed, we are likely to
  11879. send you a patch and ask you to tell us whether it works.
  11880.  
  11881.    In order for a bug report to serve its purpose, you must include the
  11882. information that makes for fixing the bug.
  11883.  
  11884. * Menu:
  11885.  
  11886. * Criteria:  Bug Criteria.   Have you really found a bug?
  11887. * Where: Bug Lists.         Where to send your bug report.
  11888. * Reporting: Bug Reporting.  How to report a bug effectively.
  11889. * Patches: Sending Patches.  How to send a patch for GNU CC.
  11890. * Known: Trouble.            Known problems.
  11891. * Help: Service.             Where to ask for help.
  11892.  
  11893. 
  11894. File: use,  Node: Bug Criteria,  Next: Bug Lists,  Up: Bugs
  11895.  
  11896. Have You Found a Bug?
  11897. =====================
  11898.  
  11899.    If you are not sure whether you have found a bug, here are some
  11900. guidelines:
  11901.  
  11902.    * If the compiler gets a fatal signal, for any input whatever, that
  11903.      is a compiler bug.  Reliable compilers never crash.
  11904.  
  11905.    * If the compiler produces invalid assembly code, for any input
  11906.      whatever (except an `asm' statement), that is a compiler bug,
  11907.      unless the compiler reports errors (not just warnings) which would
  11908.      ordinarily prevent the assembler from being run.
  11909.  
  11910.    * If the compiler produces valid assembly code that does not
  11911.      correctly execute the input source code, that is a compiler bug.
  11912.  
  11913.      However, you must double-check to make sure, because you may have
  11914.      run into an incompatibility between GNU C and traditional C (*note
  11915.      Incompatibilities::.).  These incompatibilities might be considered
  11916.      bugs, but they are inescapable consequences of valuable features.
  11917.  
  11918.      Or you may have a program whose behavior is undefined, which
  11919.      happened by chance to give the desired results with another C or
  11920.      C++ compiler.
  11921.  
  11922.      For example, in many nonoptimizing compilers, you can write `x;'
  11923.      at the end of a function instead of `return x;', with the same
  11924.      results.  But the value of the function is undefined if `return'
  11925.      is omitted; it is not a bug when GNU CC produces different results.
  11926.  
  11927.      Problems often result from expressions with two increment
  11928.      operators, as in `f (*p++, *p++)'.  Your previous compiler might
  11929.      have interpreted that expression the way you intended; GNU CC might
  11930.      interpret it another way.  Neither compiler is wrong.  The bug is
  11931.      in your code.
  11932.  
  11933.      After you have localized the error to a single source line, it
  11934.      should be easy to check for these things.  If your program is
  11935.      correct and well defined, you have found a compiler bug.
  11936.  
  11937.    * If the compiler produces an error message for valid input, that is
  11938.      a compiler bug.
  11939.  
  11940.    * If the compiler does not produce an error message for invalid
  11941.      input, that is a compiler bug.  However, you should note that your
  11942.      idea of "invalid input" might be my idea of "an extension" or
  11943.      "support for traditional practice".
  11944.  
  11945.    * If you are an experienced user of C or C++ compilers, your
  11946.      suggestions for improvement of GNU CC or GNU C++ are welcome in
  11947.      any case.
  11948.  
  11949. 
  11950. File: use,  Node: Bug Lists,  Next: Bug Reporting,  Prev: Bug Criteria,  Up: Bugs
  11951.  
  11952. Where to Report Bugs
  11953. ====================
  11954.  
  11955.    Send bug reports for GNU C to `bug-gcc@prep.ai.mit.edu'.
  11956.  
  11957.    Send bug reports for GNU C++ to `bug-g++@prep.ai.mit.edu'.  If your
  11958. bug involves the C++ class library libg++, send mail to
  11959. `bug-lib-g++@prep.ai.mit.edu'.  If you're not sure, you can send the
  11960. bug report to both lists.
  11961.  
  11962.    *Do not send bug reports to `help-gcc@prep.ai.mit.edu' or to the
  11963. newsgroup `gnu.gcc.help'.* Most users of GNU CC do not want to receive
  11964. bug reports.  Those that do, have asked to be on `bug-gcc' and/or
  11965. `bug-g++'.
  11966.  
  11967.    The mailing lists `bug-gcc' and `bug-g++' both have newsgroups which
  11968. serve as repeaters: `gnu.gcc.bug' and `gnu.g++.bug'.  Each mailing list
  11969. and its newsgroup carry exactly the same messages.
  11970.  
  11971.    Often people think of posting bug reports to the newsgroup instead of
  11972. mailing them.  This appears to work, but it has one problem which can be
  11973. crucial: a newsgroup posting does not contain a mail path back to the
  11974. sender.  Thus, if maintainers need more information, they may be unable
  11975. to reach you.  For this reason, you should always send bug reports by
  11976. mail to the proper mailing list.
  11977.  
  11978.    As a last resort, send bug reports on paper to:
  11979.  
  11980.      GNU Compiler Bugs
  11981.      Free Software Foundation
  11982.      675 Mass Ave
  11983.      Cambridge, MA 02139
  11984.  
  11985. 
  11986. File: use,  Node: Bug Reporting,  Next: Sending Patches,  Prev: Bug Lists,  Up: Bugs
  11987.  
  11988. How to Report Bugs
  11989. ==================
  11990.  
  11991.    The fundamental principle of reporting bugs usefully is this:
  11992. *report all the facts*.  If you are not sure whether to state a fact or
  11993. leave it out, state it!
  11994.  
  11995.    Often people omit facts because they think they know what causes the
  11996. problem and they conclude that some details don't matter.  Thus, you
  11997. might assume that the name of the variable you use in an example does
  11998. not matter.  Well, probably it doesn't, but one cannot be sure.
  11999. Perhaps the bug is a stray memory reference which happens to fetch from
  12000. the location where that name is stored in memory; perhaps, if the name
  12001. were different, the contents of that location would fool the compiler
  12002. into doing the right thing despite the bug.  Play it safe and give a
  12003. specific, complete example.  That is the easiest thing for you to do,
  12004. and the most helpful.
  12005.  
  12006.    Keep in mind that the purpose of a bug report is to enable someone to
  12007. fix the bug if it is not known.  It isn't very important what happens if
  12008. the bug is already known.  Therefore, always write your bug reports on
  12009. the assumption that the bug is not known.
  12010.  
  12011.    Sometimes people give a few sketchy facts and ask, "Does this ring a
  12012. bell?"  This cannot help us fix a bug, so it is basically useless.  We
  12013. respond by asking for enough details to enable us to investigate.  You
  12014. might as well expedite matters by sending them to begin with.
  12015.  
  12016.    Try to make your bug report self-contained.  If we have to ask you
  12017. for more information, it is best if you include all the previous
  12018. information in your response, as well as the information that was
  12019. missing.
  12020.  
  12021.    Please report each bug in a separate message.  This makes it easier
  12022. for us to track which bugs have been fixed and to forward your bugs
  12023. reports to the appropriate maintainer.
  12024.  
  12025.    Do not compress and encode any part of your bug report using programs
  12026. such as `uuencode'.  If you do so it will slow down the processing of
  12027. your bug.  If you must submit multiple large files, use `shar', which
  12028. allows us to read your message without having to run any decompression
  12029. programs.
  12030.  
  12031.    To enable someone to investigate the bug, you should include all
  12032. these things:
  12033.  
  12034.    * The version of GNU CC.  You can get this by running it with the
  12035.      `-v' option.
  12036.  
  12037.      Without this, we won't know whether there is any point in looking
  12038.      for the bug in the current version of GNU CC.
  12039.  
  12040.    * A complete input file that will reproduce the bug.  If the bug is
  12041.      in the C preprocessor, send a source file and any header files
  12042.      that it requires.  If the bug is in the compiler proper (`cc1'),
  12043.      run your source file through the C preprocessor by doing `gcc -E
  12044.      SOURCEFILE > OUTFILE', then include the contents of OUTFILE in the
  12045.      bug report.  (When you do this, use the same `-I', `-D' or `-U'
  12046.      options that you used in actual compilation.)
  12047.  
  12048.      A single statement is not enough of an example.  In order to
  12049.      compile it, it must be embedded in a complete file of compiler
  12050.      input; and the bug might depend on the details of how this is done.
  12051.  
  12052.      Without a real example one can compile, all anyone can do about
  12053.      your bug report is wish you luck.  It would be futile to try to
  12054.      guess how to provoke the bug.  For example, bugs in register
  12055.      allocation and reloading frequently depend on every little detail
  12056.      of the function they happen in.
  12057.  
  12058.      Even if the input file that fails comes from a GNU program, you
  12059.      should still send the complete test case.  Don't ask the GNU CC
  12060.      maintainers to do the extra work of obtaining the program in
  12061.      question--they are all overworked as it is.  Also, the problem may
  12062.      depend on what is in the header files on your system; it is
  12063.      unreliable for the GNU CC maintainers to try the problem with the
  12064.      header files available to them.  By sending CPP output, you can
  12065.      eliminate this source of uncertainty and save us a certain
  12066.      percentage of wild goose chases.
  12067.  
  12068.    * The command arguments you gave GNU CC or GNU C++ to compile that
  12069.      example and observe the bug.  For example, did you use `-O'?  To
  12070.      guarantee you won't omit something important, list all the options.
  12071.  
  12072.      If we were to try to guess the arguments, we would probably guess
  12073.      wrong and then we would not encounter the bug.
  12074.  
  12075.    * The type of machine you are using, and the operating system name
  12076.      and version number.
  12077.  
  12078.    * The operands you gave to the `configure' command when you installed
  12079.      the compiler.
  12080.  
  12081.    * A complete list of any modifications you have made to the compiler
  12082.      source.  (We don't promise to investigate the bug unless it
  12083.      happens in an unmodified compiler.  But if you've made
  12084.      modifications and don't tell us, then you are sending us on a wild
  12085.      goose chase.)
  12086.  
  12087.      Be precise about these changes.  A description in English is not
  12088.      enough--send a context diff for them.
  12089.  
  12090.      Adding files of your own (such as a machine description for a
  12091.      machine we don't support) is a modification of the compiler source.
  12092.  
  12093.    * Details of any other deviations from the standard procedure for
  12094.      installing GNU CC.
  12095.  
  12096.    * A description of what behavior you observe that you believe is
  12097.      incorrect.  For example, "The compiler gets a fatal signal," or,
  12098.      "The assembler instruction at line 208 in the output is incorrect."
  12099.  
  12100.      Of course, if the bug is that the compiler gets a fatal signal,
  12101.      then one can't miss it.  But if the bug is incorrect output, the
  12102.      maintainer might not notice unless it is glaringly wrong.  None of
  12103.      us has time to study all the assembler code from a 50-line C
  12104.      program just on the chance that one instruction might be wrong.
  12105.      We need *you* to do this part!
  12106.  
  12107.      Even if the problem you experience is a fatal signal, you should
  12108.      still say so explicitly.  Suppose something strange is going on,
  12109.      such as, your copy of the compiler is out of synch, or you have
  12110.      encountered a bug in the C library on your system.  (This has
  12111.      happened!)  Your copy might crash and the copy here would not.  If
  12112.      you said to expect a crash, then when the compiler here fails to
  12113.      crash, we would know that the bug was not happening.  If you don't
  12114.      say to expect a crash, then we would not know whether the bug was
  12115.      happening.  We would not be able to draw any conclusion from our
  12116.      observations.
  12117.  
  12118.      If the problem is a diagnostic when compiling GNU CC with some
  12119.      other compiler, say whether it is a warning or an error.
  12120.  
  12121.      Often the observed symptom is incorrect output when your program
  12122.      is run.  Sad to say, this is not enough information unless the
  12123.      program is short and simple.  None of us has time to study a large
  12124.      program to figure out how it would work if compiled correctly,
  12125.      much less which line of it was compiled wrong.  So you will have
  12126.      to do that.  Tell us which source line it is, and what incorrect
  12127.      result happens when that line is executed.  A person who
  12128.      understands the program can find this as easily as finding a bug
  12129.      in the program itself.
  12130.  
  12131.    * If you send examples of assembler code output from GNU CC or GNU
  12132.      C++, please use `-g' when you make them.  The debugging information
  12133.      includes source line numbers which are essential for correlating
  12134.      the output with the input.
  12135.  
  12136.    * If you wish to mention something in the GNU CC source, refer to it
  12137.      by context, not by line number.
  12138.  
  12139.      The line numbers in the development sources don't match those in
  12140.      your sources.  Your line numbers would convey no useful
  12141.      information to the maintainers.
  12142.  
  12143.    * Additional information from a debugger might enable someone to
  12144.      find a problem on a machine which he does not have available.
  12145.      However, you need to think when you collect this information if
  12146.      you want it to have any chance of being useful.
  12147.  
  12148.      For example, many people send just a backtrace, but that is never
  12149.      useful by itself.  A simple backtrace with arguments conveys little
  12150.      about GNU CC because the compiler is largely data-driven; the same
  12151.      functions are called over and over for different RTL insns, doing
  12152.      different things depending on the details of the insn.
  12153.  
  12154.      Most of the arguments listed in the backtrace are useless because
  12155.      they are pointers to RTL list structure.  The numeric values of the
  12156.      pointers, which the debugger prints in the backtrace, have no
  12157.      significance whatever; all that matters is the contents of the
  12158.      objects they point to (and most of the contents are other such
  12159.      pointers).
  12160.  
  12161.      In addition, most compiler passes consist of one or more loops that
  12162.      scan the RTL insn sequence.  The most vital piece of information
  12163.      about such a loop--which insn it has reached--is usually in a
  12164.      local variable, not in an argument.
  12165.  
  12166.      What you need to provide in addition to a backtrace are the values
  12167.      of the local variables for several stack frames up.  When a local
  12168.      variable or an argument is an RTX, first print its value and then
  12169.      use the GDB command `pr' to print the RTL expression that it points
  12170.      to.  (If GDB doesn't run on your machine, use your debugger to call
  12171.      the function `debug_rtx' with the RTX as an argument.)  In
  12172.      general, whenever a variable is a pointer, its value is no use
  12173.      without the data it points to.
  12174.  
  12175.    Here are some things that are not necessary:
  12176.  
  12177.    * A description of the envelope of the bug.
  12178.  
  12179.      Often people who encounter a bug spend a lot of time investigating
  12180.      which changes to the input file will make the bug go away and which
  12181.      changes will not affect it.
  12182.  
  12183.      This is often time consuming and not very useful, because the way
  12184.      we will find the bug is by running a single example under the
  12185.      debugger with breakpoints, not by pure deduction from a series of
  12186.      examples.  You might as well save your time for something else.
  12187.  
  12188.      Of course, if you can find a simpler example to report *instead* of
  12189.      the original one, that is a convenience.  Errors in the output
  12190.      will be easier to spot, running under the debugger will take less
  12191.      time, etc.  Most GNU CC bugs involve just one function, so the
  12192.      most straightforward way to simplify an example is to delete all
  12193.      the function definitions except the one where the bug occurs.
  12194.      Those earlier in the file may be replaced by external declarations
  12195.      if the crucial function depends on them.  (Exception: inline
  12196.      functions may affect compilation of functions defined later in the
  12197.      file.)
  12198.  
  12199.      However, simplification is not vital; if you don't want to do this,
  12200.      report the bug anyway and send the entire test case you used.
  12201.  
  12202.    * In particular, some people insert conditionals `#ifdef BUG' around
  12203.      a statement which, if removed, makes the bug not happen.  These
  12204.      are just clutter; we won't pay any attention to them anyway.
  12205.      Besides, you should send us cpp output, and that can't have
  12206.      conditionals.
  12207.  
  12208.    * A patch for the bug.
  12209.  
  12210.      A patch for the bug is useful if it is a good one.  But don't omit
  12211.      the necessary information, such as the test case, on the
  12212.      assumption that a patch is all we need.  We might see problems
  12213.      with your patch and decide to fix the problem another way, or we
  12214.      might not understand it at all.
  12215.  
  12216.      Sometimes with a program as complicated as GNU CC it is very hard
  12217.      to construct an example that will make the program follow a
  12218.      certain path through the code.  If you don't send the example, we
  12219.      won't be able to construct one, so we won't be able to verify that
  12220.      the bug is fixed.
  12221.  
  12222.      And if we can't understand what bug you are trying to fix, or why
  12223.      your patch should be an improvement, we won't install it.  A test
  12224.      case will help us to understand.
  12225.  
  12226.      *Note Sending Patches::, for guidelines on how to make it easy for
  12227.      us to understand and install your patches.
  12228.  
  12229.    * A guess about what the bug is or what it depends on.
  12230.  
  12231.      Such guesses are usually wrong.  Even I can't guess right about
  12232.      such things without first using the debugger to find the facts.
  12233.  
  12234.    * A core dump file.
  12235.  
  12236.      We have no way of examining a core dump for your type of machine
  12237.      unless we have an identical system--and if we do have one, we
  12238.      should be able to reproduce the crash ourselves.
  12239.  
  12240. 
  12241. File: use,  Node: Sending Patches,  Prev: Bug Reporting,  Up: Bugs
  12242.  
  12243. Sending Patches for GNU CC
  12244. ==========================
  12245.  
  12246.    If you would like to write bug fixes or improvements for the GNU C
  12247. compiler, that is very helpful.  Send suggested fixes to the bug report
  12248. mailing list, `bug-gcc@prep.ai.mit.edu'.
  12249.  
  12250.    Please follow these guidelines so we can study your patches
  12251. efficiently.  If you don't follow these guidelines, your information
  12252. might still be useful, but using it will take extra work.  Maintaining
  12253. GNU C is a lot of work in the best of circumstances, and we can't keep
  12254. up unless you do your best to help.
  12255.  
  12256.    * Send an explanation with your changes of what problem they fix or
  12257.      what improvement they bring about.  For a bug fix, just include a
  12258.      copy of the bug report, and explain why the change fixes the bug.
  12259.  
  12260.      (Referring to a bug report is not as good as including it, because
  12261.      then we will have to look it up, and we have probably already
  12262.      deleted it if we've already fixed the bug.)
  12263.  
  12264.    * Always include a proper bug report for the problem you think you
  12265.      have fixed.  We need to convince ourselves that the change is
  12266.      right before installing it.  Even if it is right, we might have
  12267.      trouble judging it if we don't have a way to reproduce the problem.
  12268.  
  12269.    * Include all the comments that are appropriate to help people
  12270.      reading the source in the future understand why this change was
  12271.      needed.
  12272.  
  12273.    * Don't mix together changes made for different reasons.  Send them
  12274.      *individually*.
  12275.  
  12276.      If you make two changes for separate reasons, then we might not
  12277.      want to install them both.  We might want to install just one.  If
  12278.      you send them all jumbled together in a single set of diffs, we
  12279.      have to do extra work to disentangle them--to figure out which
  12280.      parts of the change serve which purpose.  If we don't have time
  12281.      for this, we might have to ignore your changes entirely.
  12282.  
  12283.      If you send each change as soon as you have written it, with its
  12284.      own explanation, then the two changes never get tangled up, and we
  12285.      can consider each one properly without any extra work to
  12286.      disentangle them.
  12287.  
  12288.      Ideally, each change you send should be impossible to subdivide
  12289.      into parts that we might want to consider separately, because each
  12290.      of its parts gets its motivation from the other parts.
  12291.  
  12292.    * Send each change as soon as that change is finished.  Sometimes
  12293.      people think they are helping us by accumulating many changes to
  12294.      send them all together.  As explained above, this is absolutely
  12295.      the worst thing you could do.
  12296.  
  12297.      Since you should send each change separately, you might as well
  12298.      send it right away.  That gives us the option of installing it
  12299.      immediately if it is important.
  12300.  
  12301.    * Use `diff -c' to make your diffs.  Diffs without context are hard
  12302.      for us to install reliably.  More than that, they make it hard for
  12303.      us to study the diffs to decide whether we want to install them.
  12304.      Unidiff format is better than contextless diffs, but not as easy
  12305.      to read as `-c' format.
  12306.  
  12307.      If you have GNU diff, use `diff -cp', which shows the name of the
  12308.      function that each change occurs in.
  12309.  
  12310.    * Write the change log entries for your changes.  We get lots of
  12311.      changes, and we don't have time to do all the change log writing
  12312.      ourselves.
  12313.  
  12314.      Read the `ChangeLog' file to see what sorts of information to put
  12315.      in, and to learn the style that we use.  The purpose of the change
  12316.      log is to show people where to find what was changed.  So you need
  12317.      to be specific about what functions you changed; in large
  12318.      functions, it's often helpful to indicate where within the
  12319.      function the change was.
  12320.  
  12321.      On the other hand, once you have shown people where to find the
  12322.      change, you need not explain its purpose.  Thus, if you add a new
  12323.      function, all you need to say about it is that it is new.  If you
  12324.      feel that the purpose needs explaining, it probably does--but the
  12325.      explanation will be much more useful if you put it in comments in
  12326.      the code.
  12327.  
  12328.      If you would like your name to appear in the header line for who
  12329.      made the change, send us the header line.
  12330.  
  12331.    * When you write the fix, keep in mind that we can't install a
  12332.      change that would break other systems.
  12333.  
  12334.      People often suggest fixing a problem by changing
  12335.      machine-independent files such as `toplev.c' to do something
  12336.      special that a particular system needs.  Sometimes it is totally
  12337.      obvious that such changes would break GNU CC for almost all users.
  12338.      We can't possibly make a change like that.  At best it might tell
  12339.      us how to write another patch that would solve the problem
  12340.      acceptably.
  12341.  
  12342.      Sometimes people send fixes that *might* be an improvement in
  12343.      general--but it is hard to be sure of this.  It's hard to install
  12344.      such changes because we have to study them very carefully.  Of
  12345.      course, a good explanation of the reasoning by which you concluded
  12346.      the change was correct can help convince us.
  12347.  
  12348.      The safest changes are changes to the configuration files for a
  12349.      particular machine.  These are safe because they can't create new
  12350.      bugs on other machines.
  12351.  
  12352.      Please help us keep up with the workload by designing the patch in
  12353.      a form that is good to install.
  12354.  
  12355. 
  12356. File: use,  Node: Service,  Next: VMS,  Prev: Bugs,  Up: Top
  12357.  
  12358. How To Get Help with GNU CC
  12359. ***************************
  12360.  
  12361.    If you need help installing, using or changing GNU CC, there are two
  12362. ways to find it:
  12363.  
  12364.    * Send a message to a suitable network mailing list.  First try
  12365.      `bug-gcc@prep.ai.mit.edu', and if that brings no response, try
  12366.      `help-gcc@prep.ai.mit.edu'.
  12367.  
  12368.    * Look in the service directory for someone who might help you for a
  12369.      fee.  The service directory is found in the file named `SERVICE'
  12370.      in the GNU CC distribution.
  12371.  
  12372. 
  12373. File: use,  Node: VMS,  Next: Index,  Prev: Service,  Up: Top
  12374.  
  12375. Using GNU CC on VMS
  12376. *******************
  12377.  
  12378.    Here is how to use GNU CC on VMS.
  12379.  
  12380. * Menu:
  12381.  
  12382. * Include Files and VMS::  Where the preprocessor looks for the include files.
  12383. * Global Declarations::    How to do globaldef, globalref and globalvalue with
  12384.                            GNU CC.
  12385. * VMS Misc::           Misc information.
  12386.  
  12387. 
  12388. File: use,  Node: Include Files and VMS,  Next: Global Declarations,  Up: VMS
  12389.  
  12390. Include Files and VMS
  12391. =====================
  12392.  
  12393.    Due to the differences between the filesystems of Unix and VMS, GNU
  12394. CC attempts to translate file names in `#include' into names that VMS
  12395. will understand.  The basic strategy is to prepend a prefix to the
  12396. specification of the include file, convert the whole filename to a VMS
  12397. filename, and then try to open the file.  GNU CC tries various prefixes
  12398. one by one until one of them succeeds:
  12399.  
  12400.   1. The first prefix is the `GNU_CC_INCLUDE:' logical name: this is
  12401.      where GNU C header files are traditionally stored.  If you wish to
  12402.      store header files in non-standard locations, then you can assign
  12403.      the logical `GNU_CC_INCLUDE' to be a search list, where each
  12404.      element of the list is suitable for use with a rooted logical.
  12405.  
  12406.   2. The next prefix tried is `SYS$SYSROOT:[SYSLIB.]'.  This is where
  12407.      VAX-C header files are traditionally stored.
  12408.  
  12409.   3. If the include file specification by itself is a valid VMS
  12410.      filename, the preprocessor then uses this name with no prefix in
  12411.      an attempt to open the include file.
  12412.  
  12413.   4. If the file specification is not a valid VMS filename (i.e. does
  12414.      not contain a device or a directory specifier, and contains a `/'
  12415.      character), the preprocessor tries to convert it from Unix syntax
  12416.      to VMS syntax.
  12417.  
  12418.      Conversion works like this: the first directory name becomes a
  12419.      device, and the rest of the directories are converted into
  12420.      VMS-format directory names.  For example, the name `X11/foobar.h'
  12421.      is translated to `X11:[000000]foobar.h' or `X11:foobar.h',
  12422.      whichever one can be opened.  This strategy allows you to assign a
  12423.      logical name to point to the actual location of the header files.
  12424.  
  12425.   5. If none of these strategies succeeds, the `#include' fails.
  12426.  
  12427.    Include directives of the form:
  12428.  
  12429.      #include foobar
  12430.  
  12431. are a common source of incompatibility between VAX-C and GNU CC.  VAX-C
  12432. treats this much like a standard `#include <foobar.h>' directive.  That
  12433. is incompatible with the ANSI C behavior implemented by GNU CC: to
  12434. expand the name `foobar' as a macro.  Macro expansion should eventually
  12435. yield one of the two standard formats for `#include':
  12436.  
  12437.      #include "FILE"
  12438.      #include <FILE>
  12439.  
  12440.    If you have this problem, the best solution is to modify the source
  12441. to convert the `#include' directives to one of the two standard forms.
  12442. That will work with either compiler.  If you want a quick and dirty fix,
  12443. define the file names as macros with the proper expansion, like this:
  12444.  
  12445.      #define stdio <stdio.h>
  12446.  
  12447. This will work, as long as the name doesn't conflict with anything else
  12448. in the program.
  12449.  
  12450.    Another source of incompatibility is that VAX-C assumes that:
  12451.  
  12452.      #include "foobar"
  12453.  
  12454. is actually asking for the file `foobar.h'.  GNU CC does not make this
  12455. assumption, and instead takes what you ask for literally; it tries to
  12456. read the file `foobar'.  The best way to avoid this problem is to
  12457. always specify the desired file extension in your include directives.
  12458.  
  12459.    GNU CC for VMS is distributed with a set of include files that is
  12460. sufficient to compile most general purpose programs.  Even though the
  12461. GNU CC distribution does not contain header files to define constants
  12462. and structures for some VMS system-specific functions, there is no
  12463. reason why you cannot use GNU CC with any of these functions.  You first
  12464. may have to generate or create header files, either by using the public
  12465. domain utility `UNSDL' (which can be found on a DECUS tape), or by
  12466. extracting the relevant modules from one of the system macro libraries,
  12467. and using an editor to construct a C header file.
  12468.  
  12469.    A `#include' file name cannot contain a DECNET node name.  The
  12470. preprocessor reports an I/O error if you attempt to use a node name,
  12471. whether explicitly, or implicitly via a logical name.
  12472.  
  12473. 
  12474. File: use,  Node: Global Declarations,  Next: VMS Misc,  Prev: Include Files and VMS,  Up: VMS
  12475.  
  12476. Global Declarations and VMS
  12477. ===========================
  12478.  
  12479.    GNU CC does not provide the `globalref', `globaldef' and
  12480. `globalvalue' keywords of VAX-C.  You can get the same effect with an
  12481. obscure feature of GAS, the GNU assembler.  (This requires GAS version
  12482. 1.39 or later.)  The following macros allow you to use this feature in
  12483. a fairly natural way:
  12484.  
  12485.      #ifdef __GNUC__
  12486.      #define GLOBALREF(TYPE,NAME)                      \
  12487.        TYPE NAME                                       \
  12488.        asm ("_$$PsectAttributes_GLOBALSYMBOL$$" #NAME)
  12489.      #define GLOBALDEF(TYPE,NAME,VALUE)                \
  12490.        TYPE NAME                                       \
  12491.        asm ("_$$PsectAttributes_GLOBALSYMBOL$$" #NAME) \
  12492.          = VALUE
  12493.      #define GLOBALVALUEREF(TYPE,NAME)                 \
  12494.        const TYPE NAME[1]                              \
  12495.        asm ("_$$PsectAttributes_GLOBALVALUE$$" #NAME)
  12496.      #define GLOBALVALUEDEF(TYPE,NAME,VALUE)           \
  12497.        const TYPE NAME[1]                              \
  12498.        asm ("_$$PsectAttributes_GLOBALVALUE$$" #NAME)  \
  12499.          = {VALUE}
  12500.      #else
  12501.      #define GLOBALREF(TYPE,NAME) \
  12502.        globalref TYPE NAME
  12503.      #define GLOBALDEF(TYPE,NAME,VALUE) \
  12504.        globaldef TYPE NAME = VALUE
  12505.      #define GLOBALVALUEDEF(TYPE,NAME,VALUE) \
  12506.        globalvalue TYPE NAME = VALUE
  12507.      #define GLOBALVALUEREF(TYPE,NAME) \
  12508.        globalvalue TYPE NAME
  12509.      #endif
  12510.  
  12511. (The `_$$PsectAttributes_GLOBALSYMBOL' prefix at the start of the name
  12512. is removed by the assembler, after it has modified the attributes of
  12513. the symbol).  These macros are provided in the VMS binaries
  12514. distribution in a header file `GNU_HACKS.H'.  An example of the usage
  12515. is:
  12516.  
  12517.      GLOBALREF (int, ijk);
  12518.      GLOBALDEF (int, jkl, 0);
  12519.  
  12520.    The macros `GLOBALREF' and `GLOBALDEF' cannot be used
  12521. straightforwardly for arrays, since there is no way to insert the array
  12522. dimension into the declaration at the right place.  However, you can
  12523. declare an array with these macros if you first define a typedef for the
  12524. array type, like this:
  12525.  
  12526.      typedef int intvector[10];
  12527.      GLOBALREF (intvector, foo);
  12528.  
  12529.    Array and structure initializers will also break the macros; you can
  12530. define the initializer to be a macro of its own, or you can expand the
  12531. `GLOBALDEF' macro by hand.  You may find a case where you wish to use
  12532. the `GLOBALDEF' macro with a large array, but you are not interested in
  12533. explicitly initializing each element of the array.  In such cases you
  12534. can use an initializer like: `{0,}', which will initialize the entire
  12535. array to `0'.
  12536.  
  12537.    A shortcoming of this implementation is that a variable declared with
  12538. `GLOBALVALUEREF' or `GLOBALVALUEDEF' is always an array.  For example,
  12539. the declaration:
  12540.  
  12541.      GLOBALVALUEREF(int, ijk);
  12542.  
  12543. declares the variable `ijk' as an array of type `int [1]'.  This is
  12544. done because a globalvalue is actually a constant; its "value" is what
  12545. the linker would normally consider an address.  That is not how an
  12546. integer value works in C, but it is how an array works.  So treating
  12547. the symbol as an array name gives consistent results--with the
  12548. exception that the value seems to have the wrong type.  *Don't try to
  12549. access an element of the array.*  It doesn't have any elements.  The
  12550. array "address" may not be the address of actual storage.
  12551.  
  12552.    The fact that the symbol is an array may lead to warnings where the
  12553. variable is used.  Insert type casts to avoid the warnings.  Here is an
  12554. example; it takes advantage of the ANSI C feature allowing macros that
  12555. expand to use the same name as the macro itself.
  12556.  
  12557.      GLOBALVALUEREF (int, ss$_normal);
  12558.      GLOBALVALUEDEF (int, xyzzy,123);
  12559.      #ifdef __GNUC__
  12560.      #define ss$_normal ((int) ss$_normal)
  12561.      #define xyzzy ((int) xyzzy)
  12562.      #endif
  12563.  
  12564.    Don't use `globaldef' or `globalref' with a variable whose type is
  12565. an enumeration type; this is not implemented.  Instead, make the
  12566. variable an integer, and use a `globalvaluedef' for each of the
  12567. enumeration values.  An example of this would be:
  12568.  
  12569.      #ifdef __GNUC__
  12570.      GLOBALDEF (int, color, 0);
  12571.      GLOBALVALUEDEF (int, RED, 0);
  12572.      GLOBALVALUEDEF (int, BLUE, 1);
  12573.      GLOBALVALUEDEF (int, GREEN, 3);
  12574.      #else
  12575.      enum globaldef color {RED, BLUE, GREEN = 3};
  12576.      #endif
  12577.  
  12578. 
  12579. File: use,  Node: VMS Misc,  Prev: Global Declarations,  Up: VMS
  12580.  
  12581. Other VMS Issues
  12582. ================
  12583.  
  12584.    GNU CC automatically arranges for `main' to return 1 by default if
  12585. you fail to specify an explicit return value.  This will be interpreted
  12586. by VMS as a status code indicating a normal successful completion.
  12587. Version 1 of GNU CC did not provide this default.
  12588.  
  12589.    GNU CC on VMS works only with the GNU assembler, GAS.  You need
  12590. version 1.37 or later of GAS in order to produce value debugging
  12591. information for the VMS debugger.  Use the ordinary VMS linker with the
  12592. object files produced by GAS.
  12593.  
  12594.    Under previous versions of GNU CC, the generated code would
  12595. occasionally give strange results when linked to the sharable `VAXCRTL'
  12596. library.  Now this should work.
  12597.  
  12598.    A caveat for use of `const' global variables: the `const' modifier
  12599. must be specified in every external declaration of the variable in all
  12600. of the source files that use that variable.  Otherwise the linker will
  12601. issue warnings about conflicting attributes for the variable.  Your
  12602. program will still work despite the warnings, but the variable will be
  12603. placed in writable storage.
  12604.  
  12605.    Although the VMS linker does distinguish between upper and lower case
  12606. letters in global symbols, most VMS compilers convert all such symbols
  12607. into upper case and most run-time library routines also have upper case
  12608. names.  To be able to reliably call such routines, GNU CC (by means of
  12609. the assembler GAS) converts global symbols into upper case like other
  12610. VMS compilers.  However, since the usual practice in C is to distinguish
  12611. case, GNU CC (via GAS) tries to preserve usual C behavior by augmenting
  12612. each name that is not all lower case.  This means truncating the name
  12613. to at most 23 characters and then adding more characters at the end
  12614. which encode the case pattern of those 23.   Names which contain at
  12615. least one dollar sign are an exception; they are converted directly into
  12616. upper case without augmentation.
  12617.  
  12618.    Name augmentation yields bad results for programs that use
  12619. precompiled libraries (such as Xlib) which were generated by another
  12620. compiler.  You can use the compiler option `/NOCASE_HACK' to inhibit
  12621. augmentation; it makes external C functions and variables
  12622. case-independent as is usual on VMS.  Alternatively, you could write
  12623. all references to the functions and variables in such libraries using
  12624. lower case; this will work on VMS, but is not portable to other
  12625. systems.  The compiler option `/NAMES' also provides control over
  12626. global name handling.
  12627.  
  12628.    Function and variable names are handled somewhat differently with GNU
  12629. C++.  The GNU C++ compiler performs "name mangling" on function names,
  12630. which means that it adds information to the function name to describe
  12631. the data types of the arguments that the function takes.  One result of
  12632. this is that the name of a function can become very long.  Since the
  12633. VMS linker only recognizes the first 31 characters in a name, special
  12634. action is taken to ensure that each function and variable has a unique
  12635. name that can be represented in 31 characters.
  12636.  
  12637.    If the name (plus a name augmentation, if required) is less than 32
  12638. characters in length, then no special action is performed.  If the name
  12639. is longer than 31 characters, the assembler (GAS) will generate a hash
  12640. string based upon the function name, truncate the function name to 23
  12641. characters, and append the hash string to the truncated name.  If the
  12642. `/VERBOSE' compiler option is used, the assembler will print both the
  12643. full and truncated names of each symbol that is truncated.
  12644.  
  12645.    The `/NOCASE_HACK' compiler option should not be used when you are
  12646. compiling programs that use libg++.  libg++ has several instances of
  12647. objects (i.e.  `Filebuf' and `filebuf') which become indistinguishable
  12648. in a case-insensitive environment.  This leads to cases where you need
  12649. to inhibit augmentation selectively (if you were using libg++ and Xlib
  12650. in the same program, for example).  There is no special feature for
  12651. doing this, but you can get the result by defining a macro for each
  12652. mixed case symbol for which you wish to inhibit augmentation.  The
  12653. macro should expand into the lower case equivalent of itself.  For
  12654. example:
  12655.  
  12656.      #define StuDlyCapS studlycaps
  12657.  
  12658.    These macro definitions can be placed in a header file to minimize
  12659. the number of changes to your source code.
  12660.