home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 1 / RISC_DISC_1.iso / pd_share / code / gcc / !GCC / docs / UsingGCC < prev   
Encoding:
GNU Info File  |  1994-10-03  |  460.1 KB  |  11,164 lines

  1. This is Info file @.Distr.UsingGCC, produced by Makeinfo-1.55 from the
  2. input file gcc.texi.
  3.  
  4.    This file documents the use of the GNU compiler.
  5.  
  6.    Published by the Free Software Foundation 675 Massachusetts Avenue
  7. Cambridge, MA 02139 USA
  8.  
  9.    Copyright (C) 1988, 1989, 1992, 1993 Free Software Foundation, Inc.
  10.  
  11.    Permission is granted to make and distribute verbatim copies of this
  12. manual provided the copyright notice and this permission notice are
  13. preserved on all copies.
  14.  
  15.    Permission is granted to copy and distribute modified versions of
  16. this manual under the conditions for verbatim copying, provided also
  17. that the sections entitled "GNU General Public License" and "Protect
  18. Your Freedom--Fight `Look And Feel'" are included exactly as in the
  19. original, and provided that the entire resulting derived work is
  20. distributed under the terms of a permission notice identical to this
  21. one.
  22.  
  23.    Permission is granted to copy and distribute translations of this
  24. manual into another language, under the above conditions for modified
  25. versions, except that the sections entitled "GNU General Public
  26. License" and "Protect Your Freedom--Fight `Look And Feel'", and this
  27. permission notice, may be included in translations approved by the Free
  28. Software Foundation instead of in the original English.
  29.  
  30. 
  31. File: @.Distr.UsingGCC,  Node: Top,  Next: Copying,  Up: (DIR)
  32.  
  33. Introduction
  34. ************
  35.  
  36.    This manual documents how to run and install the GNU compiler, as
  37. well as its new features and incompatibilities, and how to report bugs.
  38. It corresponds to GNU CC version 2.4.
  39.  
  40. * Menu:
  41.  
  42. * Copying::         GNU General Public License says
  43.                      how you can copy and share GNU CC.
  44. * Contributors::    People who have contributed to GNU CC.
  45. * Boycott::        Protect your freedom--fight "look and feel".
  46.  
  47. * G++ and GCC::     You can compile C or C++ programs.
  48. * Invoking GCC::    Command options supported by `gcc'.
  49. * Installation::    How to configure, compile and install GNU CC.
  50. * C Extensions::    GNU extensions to the C language family.
  51. * C++ Extensions::  GNU extensions to the C++ language.
  52. * Trouble::         If you have trouble installing GNU CC.
  53. * Bugs::            How, why and where to report bugs.
  54. * Service::         How to find suppliers of support for GNU CC.
  55. * VMS::             Using GNU CC on VMS.
  56.  
  57. * Index::        Index of concepts and symbol names.
  58.  
  59. 
  60. File: @.Distr.UsingGCC,  Node: Copying,  Next: Contributors,  Prev: Top,  Up: Top
  61.  
  62. GNU GENERAL PUBLIC LICENSE
  63. **************************
  64.  
  65.                          Version 2, June 1991
  66.  
  67.      Copyright (C) 1989, 1991 Free Software Foundation, Inc.
  68.      675 Mass Ave, Cambridge, MA 02139, USA
  69.      
  70.      Everyone is permitted to copy and distribute verbatim copies
  71.      of this license document, but changing it is not allowed.
  72.  
  73. Preamble
  74. ========
  75.  
  76.    The licenses for most software are designed to take away your
  77. freedom to share and change it.  By contrast, the GNU General Public
  78. License is intended to guarantee your freedom to share and change free
  79. software--to make sure the software is free for all its users.  This
  80. General Public License applies to most of the Free Software
  81. Foundation's software and to any other program whose authors commit to
  82. using it.  (Some other Free Software Foundation software is covered by
  83. the GNU Library General Public License instead.)  You can apply it to
  84. your programs, too.
  85.  
  86.    When we speak of free software, we are referring to freedom, not
  87. price.  Our General Public Licenses are designed to make sure that you
  88. have the freedom to distribute copies of free software (and charge for
  89. this service if you wish), that you receive source code or can get it
  90. if you want it, that you can change the software or use pieces of it in
  91. new free programs; and that you know you can do these things.
  92.  
  93.    To protect your rights, we need to make restrictions that forbid
  94. anyone to deny you these rights or to ask you to surrender the rights.
  95. These restrictions translate to certain responsibilities for you if you
  96. distribute copies of the software, or if you modify it.
  97.  
  98.    For example, if you distribute copies of such a program, whether
  99. gratis or for a fee, you must give the recipients all the rights that
  100. you have.  You must make sure that they, too, receive or can get the
  101. source code.  And you must show them these terms so they know their
  102. rights.
  103.  
  104.    We protect your rights with two steps: (1) copyright the software,
  105. and (2) offer you this license which gives you legal permission to copy,
  106. distribute and/or modify the software.
  107.  
  108.    Also, for each author's protection and ours, we want to make certain
  109. that everyone understands that there is no warranty for this free
  110. software.  If the software is modified by someone else and passed on, we
  111. want its recipients to know that what they have is not the original, so
  112. that any problems introduced by others will not reflect on the original
  113. authors' reputations.
  114.  
  115.    Finally, any free program is threatened constantly by software
  116. patents.  We wish to avoid the danger that redistributors of a free
  117. program will individually obtain patent licenses, in effect making the
  118. program proprietary.  To prevent this, we have made it clear that any
  119. patent must be licensed for everyone's free use or not licensed at all.
  120.  
  121.    The precise terms and conditions for copying, distribution and
  122. modification follow.
  123.  
  124.     TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
  125.  
  126.   0. This License applies to any program or other work which contains a
  127.      notice placed by the copyright holder saying it may be distributed
  128.      under the terms of this General Public License.  The "Program",
  129.      below, refers to any such program or work, and a "work based on
  130.      the Program" means either the Program or any derivative work under
  131.      copyright law: that is to say, a work containing the Program or a
  132.      portion of it, either verbatim or with modifications and/or
  133.      translated into another language.  (Hereinafter, translation is
  134.      included without limitation in the term "modification".)  Each
  135.      licensee is addressed as "you".
  136.  
  137.      Activities other than copying, distribution and modification are
  138.      not covered by this License; they are outside its scope.  The act
  139.      of running the Program is not restricted, and the output from the
  140.      Program is covered only if its contents constitute a work based on
  141.      the Program (independent of having been made by running the
  142.      Program).  Whether that is true depends on what the Program does.
  143.  
  144.   1. You may copy and distribute verbatim copies of the Program's
  145.      source code as you receive it, in any medium, provided that you
  146.      conspicuously and appropriately publish on each copy an appropriate
  147.      copyright notice and disclaimer of warranty; keep intact all the
  148.      notices that refer to this License and to the absence of any
  149.      warranty; and give any other recipients of the Program a copy of
  150.      this License along with the Program.
  151.  
  152.      You may charge a fee for the physical act of transferring a copy,
  153.      and you may at your option offer warranty protection in exchange
  154.      for a fee.
  155.  
  156.   2. You may modify your copy or copies of the Program or any portion
  157.      of it, thus forming a work based on the Program, and copy and
  158.      distribute such modifications or work under the terms of Section 1
  159.      above, provided that you also meet all of these conditions:
  160.  
  161.        a. You must cause the modified files to carry prominent notices
  162.           stating that you changed the files and the date of any change.
  163.  
  164.        b. You must cause any work that you distribute or publish, that
  165.           in whole or in part contains or is derived from the Program
  166.           or any part thereof, to be licensed as a whole at no charge
  167.           to all third parties under the terms of this License.
  168.  
  169.        c. If the modified program normally reads commands interactively
  170.           when run, you must cause it, when started running for such
  171.           interactive use in the most ordinary way, to print or display
  172.           an announcement including an appropriate copyright notice and
  173.           a notice that there is no warranty (or else, saying that you
  174.           provide a warranty) and that users may redistribute the
  175.           program under these conditions, and telling the user how to
  176.           view a copy of this License.  (Exception: if the Program
  177.           itself is interactive but does not normally print such an
  178.           announcement, your work based on the Program is not required
  179.           to print an announcement.)
  180.  
  181.      These requirements apply to the modified work as a whole.  If
  182.      identifiable sections of that work are not derived from the
  183.      Program, and can be reasonably considered independent and separate
  184.      works in themselves, then this License, and its terms, do not
  185.      apply to those sections when you distribute them as separate
  186.      works.  But when you distribute the same sections as part of a
  187.      whole which is a work based on the Program, the distribution of
  188.      the whole must be on the terms of this License, whose permissions
  189.      for other licensees extend to the entire whole, and thus to each
  190.      and every part regardless of who wrote it.
  191.  
  192.      Thus, it is not the intent of this section to claim rights or
  193.      contest your rights to work written entirely by you; rather, the
  194.      intent is to exercise the right to control the distribution of
  195.      derivative or collective works based on the Program.
  196.  
  197.      In addition, mere aggregation of another work not based on the
  198.      Program with the Program (or with a work based on the Program) on
  199.      a volume of a storage or distribution medium does not bring the
  200.      other work under the scope of this License.
  201.  
  202.   3. You may copy and distribute the Program (or a work based on it,
  203.      under Section 2) in object code or executable form under the terms
  204.      of Sections 1 and 2 above provided that you also do one of the
  205.      following:
  206.  
  207.        a. Accompany it with the complete corresponding machine-readable
  208.           source code, which must be distributed under the terms of
  209.           Sections 1 and 2 above on a medium customarily used for
  210.           software interchange; or,
  211.  
  212.        b. Accompany it with a written offer, valid for at least three
  213.           years, to give any third party, for a charge no more than your
  214.           cost of physically performing source distribution, a complete
  215.           machine-readable copy of the corresponding source code, to be
  216.           distributed under the terms of Sections 1 and 2 above on a
  217.           medium customarily used for software interchange; or,
  218.  
  219.        c. Accompany it with the information you received as to the offer
  220.           to distribute corresponding source code.  (This alternative is
  221.           allowed only for noncommercial distribution and only if you
  222.           received the program in object code or executable form with
  223.           such an offer, in accord with Subsection b above.)
  224.  
  225.      The source code for a work means the preferred form of the work for
  226.      making modifications to it.  For an executable work, complete
  227.      source code means all the source code for all modules it contains,
  228.      plus any associated interface definition files, plus the scripts
  229.      used to control compilation and installation of the executable.
  230.      However, as a special exception, the source code distributed need
  231.      not include anything that is normally distributed (in either
  232.      source or binary form) with the major components (compiler,
  233.      kernel, and so on) of the operating system on which the executable
  234.      runs, unless that component itself accompanies the executable.
  235.  
  236.      If distribution of executable or object code is made by offering
  237.      access to copy from a designated place, then offering equivalent
  238.      access to copy the source code from the same place counts as
  239.      distribution of the source code, even though third parties are not
  240.      compelled to copy the source along with the object code.
  241.  
  242.   4. You may not copy, modify, sublicense, or distribute the Program
  243.      except as expressly provided under this License.  Any attempt
  244.      otherwise to copy, modify, sublicense or distribute the Program is
  245.      void, and will automatically terminate your rights under this
  246.      License.  However, parties who have received copies, or rights,
  247.      from you under this License will not have their licenses
  248.      terminated so long as such parties remain in full compliance.
  249.  
  250.   5. You are not required to accept this License, since you have not
  251.      signed it.  However, nothing else grants you permission to modify
  252.      or distribute the Program or its derivative works.  These actions
  253.      are prohibited by law if you do not accept this License.
  254.      Therefore, by modifying or distributing the Program (or any work
  255.      based on the Program), you indicate your acceptance of this
  256.      License to do so, and all its terms and conditions for copying,
  257.      distributing or modifying the Program or works based on it.
  258.  
  259.   6. Each time you redistribute the Program (or any work based on the
  260.      Program), the recipient automatically receives a license from the
  261.      original licensor to copy, distribute or modify the Program
  262.      subject to these terms and conditions.  You may not impose any
  263.      further restrictions on the recipients' exercise of the rights
  264.      granted herein.  You are not responsible for enforcing compliance
  265.      by third parties to this License.
  266.  
  267.   7. If, as a consequence of a court judgment or allegation of patent
  268.      infringement or for any other reason (not limited to patent
  269.      issues), conditions are imposed on you (whether by court order,
  270.      agreement or otherwise) that contradict the conditions of this
  271.      License, they do not excuse you from the conditions of this
  272.      License.  If you cannot distribute so as to satisfy simultaneously
  273.      your obligations under this License and any other pertinent
  274.      obligations, then as a consequence you may not distribute the
  275.      Program at all.  For example, if a patent license would not permit
  276.      royalty-free redistribution of the Program by all those who
  277.      receive copies directly or indirectly through you, then the only
  278.      way you could satisfy both it and this License would be to refrain
  279.      entirely from distribution of the Program.
  280.  
  281.      If any portion of this section is held invalid or unenforceable
  282.      under any particular circumstance, the balance of the section is
  283.      intended to apply and the section as a whole is intended to apply
  284.      in other circumstances.
  285.  
  286.      It is not the purpose of this section to induce you to infringe any
  287.      patents or other property right claims or to contest validity of
  288.      any such claims; this section has the sole purpose of protecting
  289.      the integrity of the free software distribution system, which is
  290.      implemented by public license practices.  Many people have made
  291.      generous contributions to the wide range of software distributed
  292.      through that system in reliance on consistent application of that
  293.      system; it is up to the author/donor to decide if he or she is
  294.      willing to distribute software through any other system and a
  295.      licensee cannot impose that choice.
  296.  
  297.      This section is intended to make thoroughly clear what is believed
  298.      to be a consequence of the rest of this License.
  299.  
  300.   8. If the distribution and/or use of the Program is restricted in
  301.      certain countries either by patents or by copyrighted interfaces,
  302.      the original copyright holder who places the Program under this
  303.      License may add an explicit geographical distribution limitation
  304.      excluding those countries, so that distribution is permitted only
  305.      in or among countries not thus excluded.  In such case, this
  306.      License incorporates the limitation as if written in the body of
  307.      this License.
  308.  
  309.   9. The Free Software Foundation may publish revised and/or new
  310.      versions of the General Public License from time to time.  Such
  311.      new versions will be similar in spirit to the present version, but
  312.      may differ in detail to address new problems or concerns.
  313.  
  314.      Each version is given a distinguishing version number.  If the
  315.      Program specifies a version number of this License which applies
  316.      to it and "any later version", you have the option of following
  317.      the terms and conditions either of that version or of any later
  318.      version published by the Free Software Foundation.  If the Program
  319.      does not specify a version number of this License, you may choose
  320.      any version ever published by the Free Software Foundation.
  321.  
  322.  10. If you wish to incorporate parts of the Program into other free
  323.      programs whose distribution conditions are different, write to the
  324.      author to ask for permission.  For software which is copyrighted
  325.      by the Free Software Foundation, write to the Free Software
  326.      Foundation; we sometimes make exceptions for this.  Our decision
  327.      will be guided by the two goals of preserving the free status of
  328.      all derivatives of our free software and of promoting the sharing
  329.      and reuse of software generally.
  330.  
  331.                                 NO WARRANTY
  332.  
  333.  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO
  334.      WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE
  335.      LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
  336.      HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT
  337.      WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT
  338.      NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  339.      FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS TO THE
  340.      QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
  341.      PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY
  342.      SERVICING, REPAIR OR CORRECTION.
  343.  
  344.  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
  345.      WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY
  346.      MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE
  347.      LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL,
  348.      INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
  349.      INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
  350.      DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU
  351.      OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY
  352.      OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN
  353.      ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
  354.  
  355.                       END OF TERMS AND CONDITIONS
  356.  
  357. How to Apply These Terms to Your New Programs
  358. =============================================
  359.  
  360.    If you develop a new program, and you want it to be of the greatest
  361. possible use to the public, the best way to achieve this is to make it
  362. free software which everyone can redistribute and change under these
  363. terms.
  364.  
  365.    To do so, attach the following notices to the program.  It is safest
  366. to attach them to the start of each source file to most effectively
  367. convey the exclusion of warranty; and each file should have at least
  368. the "copyright" line and a pointer to where the full notice is found.
  369.  
  370.      ONE LINE TO GIVE THE PROGRAM'S NAME AND A BRIEF IDEA OF WHAT IT DOES.
  371.      Copyright (C) 19YY  NAME OF AUTHOR
  372.      
  373.      This program is free software; you can redistribute it and/or modify
  374.      it under the terms of the GNU General Public License as published by
  375.      the Free Software Foundation; either version 2 of the License, or
  376.      (at your option) any later version.
  377.      
  378.      This program is distributed in the hope that it will be useful,
  379.      but WITHOUT ANY WARRANTY; without even the implied warranty of
  380.      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  381.      GNU General Public License for more details.
  382.      
  383.      You should have received a copy of the GNU General Public License
  384.      along with this program; if not, write to the Free Software
  385.      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  386.  
  387.    Also add information on how to contact you by electronic and paper
  388. mail.
  389.  
  390.    If the program is interactive, make it output a short notice like
  391. this when it starts in an interactive mode:
  392.  
  393.      Gnomovision version 69, Copyright (C) 19YY NAME OF AUTHOR
  394.      Gnomovision comes with ABSOLUTELY NO WARRANTY; for details
  395.      type `show w'.
  396.      This is free software, and you are welcome to redistribute it
  397.      under certain conditions; type `show c' for details.
  398.  
  399.    The hypothetical commands `show w' and `show c' should show the
  400. appropriate parts of the General Public License.  Of course, the
  401. commands you use may be called something other than `show w' and `show
  402. c'; they could even be mouse-clicks or menu items--whatever suits your
  403. program.
  404.  
  405.    You should also get your employer (if you work as a programmer) or
  406. your school, if any, to sign a "copyright disclaimer" for the program,
  407. if necessary.  Here is a sample; alter the names:
  408.  
  409.      Yoyodyne, Inc., hereby disclaims all copyright interest in the program
  410.      `Gnomovision' (which makes passes at compilers) written by James Hacker.
  411.      
  412.      SIGNATURE OF TY COON, 1 April 1989
  413.      Ty Coon, President of Vice
  414.  
  415.    This General Public License does not permit incorporating your
  416. program into proprietary programs.  If your program is a subroutine
  417. library, you may consider it more useful to permit linking proprietary
  418. applications with the library.  If this is what you want to do, use the
  419. GNU Library General Public License instead of this License.
  420.  
  421. 
  422. File: @.Distr.UsingGCC,  Node: Contributors,  Next: Boycott,  Prev: Copying,  Up: Top
  423.  
  424. Contributors to GNU CC
  425. **********************
  426.  
  427.    In addition to Richard Stallman, several people have written parts
  428. of GNU CC.
  429.  
  430.    * The idea of using RTL and some of the optimization ideas came from
  431.      the program PO written at the University of Arizona by Jack
  432.      Davidson and Christopher Fraser.  See "Register Allocation and
  433.      Exhaustive Peephole Optimization", Software Practice and
  434.      Experience 14 (9), Sept. 1984, 857-866.
  435.  
  436.    * Paul Rubin wrote most of the preprocessor.
  437.  
  438.    * Leonard Tower wrote parts of the parser, RTL generator, and RTL
  439.      definitions, and of the Vax machine description.
  440.  
  441.    * Ted Lemon wrote parts of the RTL reader and printer.
  442.  
  443.    * Jim Wilson implemented loop strength reduction and some other loop
  444.      optimizations.
  445.  
  446.    * Nobuyuki Hikichi of Software Research Associates, Tokyo,
  447.      contributed the support for the Sony NEWS machine.
  448.  
  449.    * Charles LaBrec contributed the support for the Integrated Solutions
  450.      68020 system.
  451.  
  452.    * Michael Tiemann of Cygnus Support wrote the front end for C++, as
  453.      well as the support for inline functions and instruction
  454.      scheduling.  Also the descriptions of the National Semiconductor
  455.      32000 series cpu, the SPARC cpu and part of the Motorola 88000 cpu.
  456.  
  457.    * Jan Stein of the Chalmers Computer Society provided support for
  458.      Genix, as well as part of the 32000 machine description.
  459.  
  460.    * Randy Smith finished the Sun FPA support.
  461.  
  462.    * Robert Brown implemented the support for Encore 32000 systems.
  463.  
  464.    * David Kashtan of SRI adapted GNU CC to the Vomit-Making System
  465.      (VMS).
  466.  
  467.    * Alex Crain provided changes for the 3b1.
  468.  
  469.    * Greg Satz and Chris Hanson assisted in making GNU CC work on HP-UX
  470.      for the 9000 series 300.
  471.  
  472.    * William Schelter did most of the work on the Intel 80386 support.
  473.  
  474.    * Christopher Smith did the port for Convex machines.
  475.  
  476.    * Paul Petersen wrote the machine description for the Alliant FX/8.
  477.  
  478.    * Alain Lichnewsky ported GNU CC to the Mips cpu.
  479.  
  480.    * Devon Bowen, Dale Wiles and Kevin Zachmann ported GNU CC to the
  481.      Tahoe.
  482.  
  483.    * Jonathan Stone wrote the machine description for the Pyramid
  484.      computer.
  485.  
  486.    * Gary Miller ported GNU CC to Charles River Data Systems machines.
  487.  
  488.    * Richard Kenner of the New York University Ultracomputer Research
  489.      Laboratory wrote the machine descriptions for the AMD 29000, the
  490.      DEC Alpha, the IBM RT PC, and the IBM RS/6000 as well as the
  491.      support for instruction attributes.  He also made changes to
  492.      better support RISC processors including changes to common
  493.      subexpression elimination, strength reduction, function calling
  494.      sequence handling, and condition code support, in addition to
  495.      generalizing the code for frame pointer elimination.
  496.  
  497.    * Richard Kenner and Michael Tiemann jointly developed reorg.c, the
  498.      delay slot scheduler.
  499.  
  500.    * Mike Meissner and Tom Wood of Data General finished the port to the
  501.      Motorola 88000.
  502.  
  503.    * Masanobu Yuhara of Fujitsu Laboratories implemented the machine
  504.      description for the Tron architecture (specifically, the Gmicro).
  505.  
  506.    * NeXT, Inc. donated the front end that supports the Objective C
  507.      language.
  508.  
  509.    * James van Artsdalen wrote the code that makes efficient use of the
  510.      Intel 80387 register stack.
  511.  
  512.    * Mike Meissner at the Open Software Foundation finished the port to
  513.      the MIPS cpu, including adding ECOFF debug support.
  514.  
  515.    * Ron Guilmette implemented the `protoize' and `unprotoize' tools,
  516.      the support for Dwarf symbolic debugging information, and much of
  517.      the support for System V Release 4.  He has also worked heavily on
  518.      the Intel 386 and 860 support.
  519.  
  520.    * Torbjorn Granlund of the Swedish Institute of Computer Science
  521.      implemented multiply-by-constant optimization and better long long
  522.      support, and improved leaf function register allocation.
  523.  
  524.    * Mike Stump implemented the support for Elxsi 64 bit CPU.
  525.  
  526.    * John Wehle added the machine description for the Western Electric
  527.      32000 processor used in several 3b series machines (no relation to
  528.      the National Semiconductor 32000 processor).
  529.  
  530.    * Holger Teutsch provided the support for the Clipper cpu.
  531.  
  532.    * Kresten Krab Thorup wrote the run time support for the Objective C
  533.      language.
  534.  
  535.    * Stephen Moshier contributed the floating point emulator that
  536.      assists in cross-compilation and permits support for floating
  537.      point numbers wider than 64 bits.
  538.  
  539.    * Steve Chamberlain wrote the support for the Hitachi SH processor.
  540.  
  541. 
  542. File: @.Distr.UsingGCC,  Node: Boycott,  Next: G++ and GCC,  Prev: Contributors,  Up: Top
  543.  
  544. Protect Your Freedom--Fight "Look And Feel"
  545. *******************************************
  546.  
  547.      This section is a political message from the League for Programming
  548.      Freedom to the users of GNU CC.  It is included here as an
  549.      expression of support for the League on the part of the Free
  550.      Software Foundation.
  551.  
  552.    Apple and Lotus are trying to create a new form of legal monopoly: a
  553. copyright on a class of user interfaces.  These monopolies would cause
  554. serious problems for users and developers of computer software and
  555. systems.  Xerox, too, has tried to make a monopoly for itself on window
  556. systems; their suit against Apple was thrown out on a technicality, but
  557. Xerox has not said anything to indicate it wouldn't try again.
  558.  
  559.    Until a few years ago, the law seemed clear: no one could restrict
  560. others from using a user interface; programmers were free to implement
  561. any interface they chose.  Imitating interfaces, sometimes with changes,
  562. was standard practice in the computer field.  The interfaces we know
  563. evolved gradually in this way; for example, the Macintosh user interface
  564. drew ideas from the Xerox interface, which in turn drew on work done at
  565. Stanford and SRI.  1-2-3 imitated VisiCalc, and dBase imitated a
  566. database program from JPL.
  567.  
  568.    Most computer companies, and nearly all computer users, were happy
  569. with this state of affairs.  The companies that are suing say it does
  570. not offer "enough incentive" to develop their products, but they must
  571. have considered it "enough" when they made their decision to do so.  It
  572. seems they are not satisfied with the opportunity to continue to compete
  573. in the marketplace--not even with a head start.
  574.  
  575.    If companies like Xerox, Lotus, and Apple are permitted to make law
  576. through the courts, the precedent will hobble the software industry:
  577.  
  578.    * Gratuitous incompatibilities will burden users.  Imagine if each
  579.      car manufacturer had to arrange the pedals in a different order.
  580.  
  581.    * Software will become and remain more expensive.  Users will be
  582.      "locked in" to proprietary interfaces, for which there is no real
  583.      competition.
  584.  
  585.    * Large companies have an unfair advantage wherever lawsuits become
  586.      commonplace.  Since they can easily afford to sue, they can
  587.      intimidate small companies with threats even when they don't
  588.      really have a case.
  589.  
  590.    * User interface improvements will come slower, since incremental
  591.      evolution through creative imitation will no longer be permitted.
  592.  
  593.    * Even Apple, etc., will find it harder to make improvements if they
  594.      can no longer adapt the good ideas that others introduce, for fear
  595.      of weakening their own legal positions.  Some users suggest that
  596.      this stagnation may already have started.
  597.  
  598.    * If you use GNU software, you might find it of some concern that
  599.      user interface copyright will make it hard for the Free Software
  600.      Foundation to develop programs compatible with the interfaces that
  601.      you already know.
  602.  
  603.    To protect our freedom from lawsuits like these, a group of
  604. programmers and users have formed a new grass-roots political
  605. organization, the League for Programming Freedom.
  606.  
  607.    The purpose of the League is to oppose new monopolistic practices
  608. such as user-interface copyright and software patents; it calls for a
  609. return to the legal policies of the recent past, in which these
  610. practices were not allowed.  The League is not concerned with free
  611. software as an issue, and not affiliated with the Free Software
  612. Foundation.
  613.  
  614.    The League's membership rolls include John McCarthy, inventor of
  615. Lisp, Marvin Minsky, founder of the Artificial Intelligence lab, Guy L.
  616. Steele, Jr., author of well-known books on Lisp and C, as well as
  617. Richard Stallman, the developer of GNU CC.  Please join and add your
  618. name to the list.  Membership dues in the League are $42 per year for
  619. programmers, managers and professionals; $10.50 for students; $21 for
  620. others.
  621.  
  622.    The League needs both activist members and members who only pay their
  623. dues.
  624.  
  625.    To join, or for more information, phone (617) 243-4091 or write to:
  626.  
  627.      League for Programming Freedom
  628.      1 Kendall Square #143
  629.      P.O. Box 9171
  630.      Cambridge, MA 02139
  631.  
  632.    You can also send electronic mail to `league@prep.ai.mit.edu'.
  633.  
  634.    Here are some suggestions from the League for things you can do to
  635. protect your freedom to write programs:
  636.  
  637.    * Don't buy from Xerox, Lotus or Apple.  Buy from their competitors
  638.      or from the defendants they are suing.
  639.  
  640.    * Don't develop software to work with the systems made by these
  641.      companies.
  642.  
  643.    * Port your existing software to competing systems, so that you
  644.      encourage users to switch.
  645.  
  646.    * Write letters to company presidents to let them know their conduct
  647.      is unacceptable.
  648.  
  649.    * Tell your friends and colleagues about this issue and how it
  650.      threatens to ruin the computer industry.
  651.  
  652.    * Above all, don't work for the look-and-feel plaintiffs, and don't
  653.      accept contracts from them.
  654.  
  655.    * Write to Congress to explain the importance of this issue.
  656.  
  657.           House Subcommittee on Intellectual Property
  658.           2137 Rayburn Bldg
  659.           Washington, DC 20515
  660.           
  661.           Senate Subcommittee on Patents, Trademarks and Copyrights
  662.           United States Senate
  663.           Washington, DC 20510
  664.  
  665.      (These committees have received lots of mail already; let's give
  666.      them even more.)
  667.  
  668.    Express your opinion!  You can make a difference.
  669.  
  670. 
  671. File: @.Distr.UsingGCC,  Node: G++ and GCC,  Next: Invoking GCC,  Prev: Boycott,  Up: Top
  672.  
  673. Compile C, C++, or Objective C
  674. ******************************
  675.  
  676.    The C, C++, and Objective C versions of the compiler are integrated;
  677. the GNU C compiler can compile programs written in C, C++, or Objective
  678. C.
  679.  
  680.    "GCC" is a common shorthand term for the GNU C compiler.  This is
  681. both the most general name for the compiler, and the name used when the
  682. emphasis is on compiling C programs.
  683.  
  684.    When referring to C++ compilation, it is usual to call the compiler
  685. "G++".  Since there is only one compiler, it is also accurate to call
  686. it "GCC" no matter what the language context; however, the term "G++"
  687. is more useful when the emphasis is on compiling C++ programs.
  688.  
  689.    G++ is a *compiler*, not merely a preprocessor.  G++ builds object
  690. code directly from your C++ program source.  There is no intermediate C
  691. version of the program.  (By contrast, for example, some other
  692. implementations use a program that generates a C program from your C++
  693. source.)  Avoiding an intermediate C representation of the program means
  694. that you get better object code, and better debugging information.  The
  695. GNU debugger, GDB, works with this information in the object code to
  696. give you comprehensive C++ source-level editing capabilities (*note C
  697. and C++: (gdb.info)C.).
  698.  
  699. 
  700. File: @.Distr.UsingGCC,  Node: Invoking GCC,  Next: Installation,  Prev: G++ and GCC,  Up: Top
  701.  
  702. GNU CC Command Options
  703. **********************
  704.  
  705.    When you invoke GNU CC, it normally does preprocessing, compilation,
  706. assembly and linking.  The "overall options" allow you to stop this
  707. process at an intermediate stage.  For example, the `-c' option says
  708. not to run the linker.  Then the output consists of object files output
  709. by the assembler.
  710.  
  711.    Other options are passed on to one stage of processing.  Some options
  712. control the preprocessor and others the compiler itself.  Yet other
  713. options control the assembler and linker; most of these are not
  714. documented here, since you rarely need to use any of them.
  715.  
  716.    Most of the command line options that you can use with GNU CC are
  717. useful for C programs; when an option is only useful with another
  718. language (usually C++), the explanation says so explicitly.  If the
  719. description for a particular option does not mention a source language,
  720. you can use that option with all supported languages.
  721.  
  722.    *Note Compiling C++ Programs: Invoking G++, for a summary of special
  723. options for compiling C++ programs.
  724.  
  725.    The `gcc' program accepts options and file names as operands.  Many
  726. options have multiletter names; therefore multiple single-letter options
  727. may *not* be grouped: `-dr' is very different from `-d -r'.
  728.  
  729.    You can mix options and other arguments.  For the most part, the
  730. order you use doesn't matter.  Order does matter when you use several
  731. options of the same kind; for example, if you specify `-L' more than
  732. once, the directories are searched in the order specified.
  733.  
  734.    Many options have long names starting with `-f' or with `-W'--for
  735. example, `-fforce-mem', `-fstrength-reduce', `-Wformat' and so on.
  736. Most of these have both positive and negative forms; the negative form
  737. of `-ffoo' would be `-fno-foo'.  This manual documents only one of
  738. these two forms, whichever one is not the default.
  739.  
  740. * Menu:
  741.  
  742. * Option Summary::    Brief list of all options, without explanations.
  743. * Overall Options::     Controlling the kind of output:
  744.                         an executable, object files, assembler files,
  745.                         or preprocessed source.
  746. * Invoking G++::    Compiling C++ programs.
  747. * C Dialect Options::   Controlling the variant of C language compiled.
  748. * C++ Dialect Options:: Variations on C++.
  749. * Warning Options::     How picky should the compiler be?
  750. * Debugging Options::   Symbol tables, measurements, and debugging dumps.
  751. * Optimize Options::    How much optimization?
  752. * Preprocessor Options:: Controlling header files and macro definitions.
  753.                          Also, getting dependency information for Make.
  754. * Assembler Options::   Passing options to the assembler.
  755. * Link Options::        Specifying libraries and so on.
  756. * Directory Options::   Where to find header files and libraries.
  757.                         Where to find the compiler executable files.
  758. * Target Options::      Running a cross-compiler, or an old version of GNU CC.
  759. * Submodel Options::    Specifying minor hardware or convention variations,
  760.                         such as 68010 vs 68020.
  761. * Code Gen Options::    Specifying conventions for function calls, data layout
  762.                         and register usage.
  763. * Environment Variables:: Env vars that affect GNU CC.
  764. * Running Protoize::    Automatically adding or removing function prototypes.
  765.  
  766. 
  767. File: @.Distr.UsingGCC,  Node: Option Summary,  Next: Overall Options,  Up: Invoking GCC
  768.  
  769. Option Summary
  770. ==============
  771.  
  772.    Here is a summary of all the options, grouped by type.  Explanations
  773. are in the following sections.
  774.  
  775. *Overall Options*
  776.      *Note Options Controlling the Kind of Output: Overall Options.
  777.           -c  -S  -E  -o FILE  -pipe  -v  -x LANGUAGE
  778.  
  779. *C Language Options*
  780.      *Note Options Controlling C Dialect: C Dialect Options.
  781.           -ansi  -fcond-mismatch  -fno-asm  -fno-builtin
  782.           -fsigned-bitfields  -fsigned-char
  783.           -funsigned-bitfields  -funsigned-char  -fwritable-strings
  784.           -traditional  -traditional-cpp  -trigraphs
  785.  
  786. *C++ Language Options*
  787.      *Note Options Controlling C++ Dialect: C++ Dialect Options.
  788.           -fall-virtual  -fdollars-in-identifiers
  789.           -felide-constructors  -fenum-int-equiv  -fmemoize-lookups
  790.           -fno-strict-prototype  -fnonnull-objects
  791.           -fthis-is-variable  -nostdinc++
  792.  
  793. *Warning Options*
  794.      *Note Options to Request or Suppress Warnings: Warning Options.
  795.           -fsyntax-only  -pedantic  -pedantic-errors
  796.           -w  -W  -Wall  -Waggregate-return  -Wcast-align
  797.           -Wcast-qual  -Wchar-subscript  -Wcomment  -Wconversion
  798.           -Wenum-clash  -Werror  -Wformat  -Wid-clash-LEN
  799.           -Wimplicit  -Wimport  -Winline  -Wmissing-prototypes
  800.           -Wnested-externs  -Woverloaded-virtual  -Wparentheses
  801.           -Wpointer-arith  -Wredundant-decls  -Wreturn-type
  802.           -Wshadow  -Wstrict-prototypes  -Wswitch
  803.           -Wtemplate-debugging  -Wtraditional  -Wtrigraphs
  804.           -Wuninitialized  -Wunused  -Wwrite-strings
  805.  
  806. *Debugging Options*
  807.      *Note Options for Debugging Your Program or GCC: Debugging Options.
  808.           -a  -dLETTERS  -fpretend-float
  809.           -g  -gLEVEL -ggdb  -gdwarf -gdwarf+
  810.           -gstabs  -gstabs+  -gcoff -gxcoff  -gxcoff+
  811.           -p  -pg  -save-temps  -print-libgcc-file-name
  812.  
  813. *Optimization Options*
  814.      *Note Options that Control Optimization: Optimize Options.
  815.           -fcaller-saves  -fcse-follow-jumps  -fcse-skip-blocks
  816.           -fdelayed-branch   -fexpensive-optimizations
  817.           -ffast-math  -ffloat-store  -fforce-addr  -fforce-mem
  818.           -finline-functions  -fkeep-inline-functions
  819.           -fno-default-inline  -fno-defer-pop  -fno-function-cse
  820.           -fno-inline  -fno-peephole  -fomit-frame-pointer
  821.           -frerun-cse-after-loop  -fschedule-insns
  822.           -fschedule-insns2  -fstrength-reduce  -fthread-jumps
  823.           -funroll-all-loops  -funroll-loops
  824.           -O  -O2
  825.  
  826. *Preprocessor Options*
  827.      *Note Options Controlling the Preprocessor: Preprocessor Options.
  828.           -AASSERTION  -C  -dD  -dM  -dN
  829.           -DMACRO[=DEFN]  -E  -H
  830.           -idirafter DIR
  831.           -include FILE  -imacros FILE
  832.           -iprefix FILE  -iwithprefix DIR
  833.           -M  -MD  -MM  -MMD  -nostdinc  -P  -trigraphs  -UMACRO
  834.  
  835. *Assembler Option*
  836.      *Note Passing Options to the Assembler: Assembler Options.
  837.           -Wa,OPTION
  838.  
  839. *Linker Options*
  840.      *Note Options for Linking: Link Options.
  841.           OBJECT-FILE-NAME
  842.           -lLIBRARY  -nostartfiles  -nostdlib
  843.           -static  -shared  -symbolic
  844.           -Wl,OPTION  -Xlinker OPTION
  845.           -u SYMBOL
  846.  
  847. *Directory Options*
  848.      *Note Options for Directory Search: Directory Options.
  849.           -BPREFIX  -IDIR  -I-  -LDIR
  850.  
  851. *Target Options*
  852.      *Note Target Options::.
  853.           -b MACHINE  -V VERSION
  854.  
  855. *Machine Dependent Options*
  856.      *Note Hardware Models and Configurations: Submodel Options.
  857.           *M680x0 Options*
  858.           -m68000  -m68020  -m68020-40  -m68030  -m68040  -m68881
  859.           -mbitfield  -mc68000  -mc68020  -mfpa  -mnobitfield
  860.           -mrtd  -mshort  -msoft-float
  861.           
  862.           *VAX Options*
  863.           -mg  -mgnu  -munix
  864.           
  865.           *SPARC Options*
  866.           -mepilogue  -mfpu  -mhard-float
  867.           -mno-fpu  -mno-epilogue  -msoft-float
  868.           -msparclite  -mv8
  869.           
  870.           *Convex Options*
  871.           -mc1  -mc2  -mc32  -mc34  -mc38
  872.           -margcount  -mnoargcount
  873.           -mlong32  -mlong64
  874.           -mbolatile-cache  -mvolatile-nocache
  875.           
  876.           *AMD29K Options*
  877.           -m29000  -m29050  -mbw  -mdw  -mkernel-registers
  878.           -mlarge  -mnbw  -mnodw  -msmall  -mstack-check
  879.           -muser-registers
  880.           
  881.           *M88K Options*
  882.           -m88000  -m88100  -m88110  -mbig-pic
  883.           -mcheck-zero-division  -mhandle-large-shift
  884.           -midentify-revision  -mno-check-zero-division
  885.           -mno-ocs-debug-info  -mno-ocs-frame-position
  886.           -mno-optimize-arg-area  -mno-serialize-volatile
  887.           -mno-underscores  -mocs-debug-info
  888.           -mocs-frame-position  -moptimize-arg-area
  889.           -mserialize-volatile  -mshort-data-NUM  -msvr3
  890.           -msvr4  -mtrap-large-shift  -muse-div-instruction
  891.           -mversion-03.00  -mwarn-passed-structs
  892.           
  893.           *RS/6000 Options*
  894.           -mfp-in-toc  -mno-fop-in-toc
  895.           
  896.           *RT Options*
  897.           -mcall-lib-mul  -mfp-arg-in-fpregs  -mfp-arg-in-gregs
  898.           -mfull-fp-blocks  -mhc-struct-return  -min-line-mul
  899.           -mminimum-fp-blocks  -mnohc-struct-return
  900.           
  901.           *MIPS Options*
  902.           -mcpu=CPU  TYPE  -mips2  -mips3  -mint64
  903.           -mlong64  -mlonglong128  -mmips-as  -mgas  -mrnames
  904.           -mno-rnames  -mgpopt  -mno-gpopt  -mstats  -mno-stats
  905.           -mmemcpy  -mno-memcpy  -mno-mips-tfile  -mmips-tfile
  906.           -msoft-float  -mhard-float  -mabicalls  -mno-abicalls
  907.           -mhalf-pic  -mno-half-pic -mlong-calls -mno-long-calls
  908.           -G  NUM  -nocpp
  909.           
  910.           *i386 Options*
  911.           -m486  -mno-486  -msoft-float  -msvr3-shlib  -mieee-fp
  912.           -mno-fp-ret-in-387
  913.           
  914.           *HPPA Options*
  915.           -mpa-risc-1-0
  916.           -mpa-risc-1-1
  917.           -mkernel
  918.           -mshared-libs
  919.           -mno-shared-libs
  920.           -mlong-calls
  921.           -mdisable-fpregs
  922.           -mdisable-indexing
  923.           -mtrailing-colon
  924.           
  925.           *Intel 960 Options*
  926.           -mCPU TYPE
  927.           -mnumerics  -msoft-float
  928.           -mcode-align  -mno-code-align
  929.           -mleaf-procedures  -mno-leaf-procedures
  930.           -mtail-call  -mno-tail-call
  931.           -mcomplex-addr  -mno-complex-addr
  932.           -mclean-linkage  -mno-clean-linkage
  933.           -mic-compat  -mic2.0-compat  -mic3.0-compat
  934.           -masm-compat  -mintel-asm
  935.           -mstrict-align  -mno-strict-align
  936.           -mold-align  -mno-old-align
  937.           
  938.           *DEC Alpha Options*
  939.           -mfp-regs  -mno-fp-regs  -mno-soft-float
  940.           -msoft-float
  941.           
  942.           *System V Options*
  943.           -G  -Qy  -Qn  -YP,PATHS  -Ym,DIR
  944.  
  945. *Code Generation Options*
  946.      *Note Options for Code Generation Conventions: Code Gen Options.
  947.           -fcall-saved-REG  -fcall-used-REG
  948.           -ffixed-REG  -finhibit-size-directive
  949.           -fno-common  -fno-ident
  950.           -fno-gnu-linker  -fpcc-struct-return  -fpic  -fPIC
  951.           -freg-struct-return  -fshared-data  -fshort-enums
  952.           -fshort-double  -fvolatile  -fvolatile-global
  953.           -fverbose-asm
  954.  
  955. * Menu:
  956.  
  957. * Overall Options::     Controlling the kind of output:
  958.                         an executable, object files, assembler files,
  959.                         or preprocessed source.
  960. * C Dialect Options::   Controlling the variant of C language compiled.
  961. * C++ Dialect Options:: Variations on C++.
  962. * Warning Options::     How picky should the compiler be?
  963. * Debugging Options::   Symbol tables, measurements, and debugging dumps.
  964. * Optimize Options::    How much optimization?
  965. * Preprocessor Options:: Controlling header files and macro definitions.
  966.                          Also, getting dependency information for Make.
  967. * Assembler Options::   Passing options to the assembler.
  968. * Link Options::        Specifying libraries and so on.
  969. * Directory Options::   Where to find header files and libraries.
  970.                         Where to find the compiler executable files.
  971. * Target Options::      Running a cross-compiler, or an old version of GNU CC.
  972.  
  973. 
  974. File: @.Distr.UsingGCC,  Node: Overall Options,  Next: Invoking G++,  Prev: Option Summary,  Up: Invoking GCC
  975.  
  976. Options Controlling the Kind of Output
  977. ======================================
  978.  
  979.    Compilation can involve up to four stages: preprocessing, compilation
  980. proper, assembly and linking, always in that order.  The first three
  981. stages apply to an individual source file, and end by producing an
  982. object file; linking combines all the object files (those newly
  983. compiled, and those specified as input) into an executable file.
  984.  
  985.    For any given input file, the file name suffix determines what kind
  986. of compilation is done:
  987.  
  988. `FILE.c'
  989.      C source code which must be preprocessed.
  990.  
  991. `FILE.i'
  992.      C source code which should not be preprocessed.
  993.  
  994. `FILE.ii'
  995.      C++ source code which should not be preprocessed.
  996.  
  997. `FILE.m'
  998.      Objective-C source code.  Note that you must link with the library
  999.      `libobjc.a' to make an Objective-C program work.
  1000.  
  1001. `FILE.h'
  1002.      C header file (not to be compiled or linked).
  1003.  
  1004. `FILE.cc'
  1005. `FILE.cxx'
  1006. `FILE.C'
  1007.      C++ source code which must be preprocessed.  Note that in `.cxx',
  1008.      the last two letters must both be literally `x'.  Likewise, `.C'
  1009.      refers to a literal capital C.
  1010.  
  1011. `FILE.s'
  1012.      Assembler code.
  1013.  
  1014. `FILE.S'
  1015.      Assembler code which must be preprocessed.
  1016.  
  1017. `OTHER'
  1018.      An object file to be fed straight into linking.  Any file name
  1019.      with no recognized suffix is treated this way.
  1020.  
  1021.    You can specify the input language explicitly with the `-x' option:
  1022.  
  1023. `-x LANGUAGE'
  1024.      Specify explicitly the LANGUAGE for the following input files
  1025.      (rather than letting the compiler choose a default based on the
  1026.      file name suffix).  This option applies to all following input
  1027.      files until the next `-x' option.  Possible values for LANGUAGE
  1028.      are:
  1029.           c  objective-c  c++
  1030.           c-header  cpp-output  c++-cpp-output
  1031.           assembler  assembler-with-cpp
  1032.  
  1033. `-x none'
  1034.      Turn off any specification of a language, so that subsequent files
  1035.      are handled according to their file name suffixes (as they are if
  1036.      `-x' has not been used at all).
  1037.  
  1038.    If you only want some of the stages of compilation, you can use `-x'
  1039. (or filename suffixes) to tell `gcc' where to start, and one of the
  1040. options `-c', `-S', or `-E' to say where `gcc' is to stop.  Note that
  1041. some combinations (for example, `-x cpp-output -E' instruct `gcc' to do
  1042. nothing at all.
  1043.  
  1044. `-c'
  1045.      Compile or assemble the source files, but do not link.  The linking
  1046.      stage simply is not done.  The ultimate output is in the form of an
  1047.      object file for each source file.
  1048.  
  1049.      By default, the object file name for a source file is made by
  1050.      replacing the suffix `.c', `.i', `.s', etc., with `.o'.
  1051.  
  1052.      Unrecognized input files, not requiring compilation or assembly,
  1053.      are ignored.
  1054.  
  1055. `-S'
  1056.      Stop after the stage of compilation proper; do not assemble.  The
  1057.      output is in the form of an assembler code file for each
  1058.      non-assembler input file specified.
  1059.  
  1060.      By default, the assembler file name for a source file is made by
  1061.      replacing the suffix `.c', `.i', etc., with `.s'.
  1062.  
  1063.      Input files that don't require compilation are ignored.
  1064.  
  1065. `-E'
  1066.      Stop after the preprocessing stage; do not run the compiler
  1067.      proper.  The output is in the form of preprocessed source code,
  1068.      which is sent to the standard output.
  1069.  
  1070.      Input files which don't require preprocessing are ignored.
  1071.  
  1072. `-o FILE'
  1073.      Place output in file FILE.  This applies regardless to whatever
  1074.      sort of output is being produced, whether it be an executable file,
  1075.      an object file, an assembler file or preprocessed C code.
  1076.  
  1077.      Since only one output file can be specified, it does not make
  1078.      sense to use `-o' when compiling more than one input file, unless
  1079.      you are producing an executable file as output.
  1080.  
  1081.      If `-o' is not specified, the default is to put an executable file
  1082.      in `a.out', the object file for `SOURCE.SUFFIX' in `SOURCE.o', its
  1083.      assembler file in `SOURCE.s', and all preprocessed C source on
  1084.      standard output.
  1085.  
  1086. `-v'
  1087.      Print (on standard error output) the commands executed to run the
  1088.      stages of compilation.  Also print the version number of the
  1089.      compiler driver program and of the preprocessor and the compiler
  1090.      proper.
  1091.  
  1092. `-pipe'
  1093.      Use pipes rather than temporary files for communication between the
  1094.      various stages of compilation.  This fails to work on some systems
  1095.      where the assembler is unable to read from a pipe; but the GNU
  1096.      assembler has no trouble.
  1097.  
  1098. 
  1099. File: @.Distr.UsingGCC,  Node: Invoking G++,  Next: C Dialect Options,  Prev: Overall Options,  Up: Invoking GCC
  1100.  
  1101. Compiling C++ Programs
  1102. ======================
  1103.  
  1104.    C++ source files conventionally use one of the suffixes `.C', `.cc',
  1105. or `.cxx'; preprocessed C++ files use the suffix `.ii'.  GNU CC
  1106. recognizes files with these names and compiles them as C++ programs
  1107. even if you call the compiler the same way as for compiling C programs
  1108. (usually with the name `gcc').
  1109.  
  1110.    However, C++ programs often require class libraries as well as a
  1111. compiler that understands the C++ language--and under some
  1112. circumstances, you might want to compile programs from standard input,
  1113. or otherwise without a suffix that flags them as C++ programs.  `g++'
  1114. is a shell script that calls GNU CC with the default language set to
  1115. C++, and automatically specifies linking against the GNU class library
  1116. libg++.  (1) On many systems, the script `g++' is also installed with
  1117. the name `c++'.
  1118.  
  1119.    When you compile C++ programs, you may specify many of the same
  1120. command-line options that you use for compiling programs in any
  1121. language; or command-line options meaningful for C and related
  1122. languages; or options that are meaningful only for C++ programs.  *Note
  1123. Options Controlling C Dialect: C Dialect Options, for explanations of
  1124. options for languages related to C.  *Note Options Controlling C++
  1125. Dialect: C++ Dialect Options, for explanations of options that are
  1126. meaningful only for C++ programs.
  1127.  
  1128.    ---------- Footnotes ----------
  1129.  
  1130.    (1)  Prior to release 2 of the compiler, there was a separate `g++'
  1131. compiler.  That version was based on GNU CC, but not integrated with
  1132. it.  Versions of `g++' with a `1.XX' version number--for example, `g++'
  1133. version 1.37 or 1.42--are much less reliable than the versions
  1134. integrated with GCC 2.  Moreover, combining G++ `1.XX' with a version 2
  1135. GCC will simply not work.
  1136.  
  1137. 
  1138. File: @.Distr.UsingGCC,  Node: C Dialect Options,  Next: C++ Dialect Options,  Prev: Invoking G++,  Up: Invoking GCC
  1139.  
  1140. Options Controlling C Dialect
  1141. =============================
  1142.  
  1143.    The following options control the dialect of C (or languages derived
  1144. from C, such as C++ and Objective C) that the compiler accepts:
  1145.  
  1146. `-ansi'
  1147.      Support all ANSI standard C programs.
  1148.  
  1149.      This turns off certain features of GNU C that are incompatible
  1150.      with ANSI C, such as the `asm', `inline' and `typeof' keywords, and
  1151.      predefined macros such as `unix' and `vax' that identify the type
  1152.      of system you are using.  It also enables the undesirable and
  1153.      rarely used ANSI trigraph feature, and disallows `$' as part of
  1154.      identifiers.
  1155.  
  1156.      The alternate keywords `__asm__', `__extension__', `__inline__'
  1157.      and `__typeof__' continue to work despite `-ansi'.  You would not
  1158.      want to use them in an ANSI C program, of course, but it useful to
  1159.      put them in header files that might be included in compilations
  1160.      done with `-ansi'.  Alternate predefined macros such as `__unix__'
  1161.      and `__vax__' are also available, with or without `-ansi'.
  1162.  
  1163.      The `-ansi' option does not cause non-ANSI programs to be rejected
  1164.      gratuitously.  For that, `-pedantic' is required in addition to
  1165.      `-ansi'.  *Note Warning Options::.
  1166.  
  1167.      The macro `__STRICT_ANSI__' is predefined when the `-ansi' option
  1168.      is used.  Some header files may notice this macro and refrain from
  1169.      declaring certain functions or defining certain macros that the
  1170.      ANSI standard doesn't call for; this is to avoid interfering with
  1171.      any programs that might use these names for other things.
  1172.  
  1173.      The functions `alloca', `abort', `exit', and `_exit' are not
  1174.      builtin functions when `-ansi' is used.
  1175.  
  1176. `-fno-asm'
  1177.      Do not recognize `asm', `inline' or `typeof' as a keyword.  These
  1178.      words may then be used as identifiers.  You can use the keywords
  1179.      `__asm__', `__inline__' and `__typeof__' instead.  `-ansi' implies
  1180.      `-fno-asm'.
  1181.  
  1182. `-fno-builtin'
  1183.      Don't recognize built-in functions that do not begin with two
  1184.      leading underscores.  Currently, the functions affected include
  1185.      `abort', `abs', `alloca', `cos', `exit', `fabs', `ffs', `labs',
  1186.      `memcmp', `memcpy', `sin', `sqrt', `strcmp', `strcpy', and
  1187.      `strlen'.
  1188.  
  1189.      The `-ansi' option prevents `alloca' and `ffs' from being builtin
  1190.      functions, since these functions do not have an ANSI standard
  1191.      meaning.
  1192.  
  1193. `-trigraphs'
  1194.      Support ANSI C trigraphs.  You don't want to know about this
  1195.      brain-damage.  The `-ansi' option implies `-trigraphs'.
  1196.  
  1197. `-traditional'
  1198.      Attempt to support some aspects of traditional C compilers.
  1199.      Specifically:
  1200.  
  1201.         * All `extern' declarations take effect globally even if they
  1202.           are written inside of a function definition.  This includes
  1203.           implicit declarations of functions.
  1204.  
  1205.         * The newer keywords `typeof', `inline', `signed', `const' and
  1206.           `volatile' are not recognized.  (You can still use the
  1207.           alternative keywords such as `__typeof__', `__inline__', and
  1208.           so on.)
  1209.  
  1210.         * Comparisons between pointers and integers are always allowed.
  1211.  
  1212.         * Integer types `unsigned short' and `unsigned char' promote to
  1213.           `unsigned int'.
  1214.  
  1215.         * Out-of-range floating point literals are not an error.
  1216.  
  1217.         * Certain constructs which ANSI regards as a single invalid
  1218.           preprocessing number, such as `0xe-0xd', are treated as
  1219.           expressions instead.
  1220.  
  1221.         * String "constants" are not necessarily constant; they are
  1222.           stored in writable space, and identical looking constants are
  1223.           allocated separately.  (This is the same as the effect of
  1224.           `-fwritable-strings'.)
  1225.  
  1226.         * All automatic variables not declared `register' are preserved
  1227.           by `longjmp'.  Ordinarily, GNU C follows ANSI C: automatic
  1228.           variables not declared `volatile' may be clobbered.
  1229.  
  1230.         * In the preprocessor, comments convert to nothing at all,
  1231.           rather than to a space.  This allows traditional token
  1232.           concatenation.
  1233.  
  1234.         * In the preprocessor, macro arguments are recognized within
  1235.           string constants in a macro definition (and their values are
  1236.           stringified, though without additional quote marks, when they
  1237.           appear in such a context).  The preprocessor always considers
  1238.           a string constant to end at a newline.
  1239.  
  1240.         * The predefined macro `__STDC__' is not defined when you use
  1241.           `-traditional', but `__GNUC__' is (since the GNU extensions
  1242.           which `__GNUC__' indicates are not affected by
  1243.           `-traditional').  If you need to write header files that work
  1244.           differently depending on whether `-traditional' is in use, by
  1245.           testing both of these predefined macros you can distinguish
  1246.           four situations: GNU C, traditional GNU C, other ANSI C
  1247.           compilers, and other old C compilers.  *Note Standard
  1248.           Predefined Macros: (cpp.info)Standard Predefined, for more
  1249.           discussion of these and other predefined macros.
  1250.  
  1251.         * The preprocessor considers a string constant to end at a
  1252.           newline (unless the newline is escaped with `\').  (Without
  1253.           `-traditional', string constants can contain the newline
  1254.           character as typed.)
  1255.  
  1256.         * The character escape sequences `\x' and `\a' evaluate as the
  1257.           literal characters `x' and `a' respectively.  Without
  1258.           `-traditional', `\x' is a prefix for the hexadecimal
  1259.           representation of a character, and `\a' produces a bell.
  1260.  
  1261.         * In C++ programs, assignment to `this' is permitted with
  1262.           `-traditional'.  (The option `-fthis-is-variable' also has
  1263.           this effect.)
  1264.  
  1265.      You may wish to use `-fno-builtin' as well as `-traditional' if
  1266.      your program uses names that are normally GNU C builtin functions
  1267.      for other purposes of its own.
  1268.  
  1269. `-traditional-cpp'
  1270.      Attempt to support some aspects of traditional C preprocessors.
  1271.      This includes the last three items in the table immediately above,
  1272.      but none of the other effects of `-traditional'.
  1273.  
  1274. `-fcond-mismatch'
  1275.      Allow conditional expressions with mismatched types in the second
  1276.      and third arguments.  The value of such an expression is void.
  1277.  
  1278. `-funsigned-char'
  1279.      Let the type `char' be unsigned, like `unsigned char'.
  1280.  
  1281.      Each kind of machine has a default for what `char' should be.  It
  1282.      is either like `unsigned char' by default or like `signed char' by
  1283.      default.
  1284.  
  1285.      Ideally, a portable program should always use `signed char' or
  1286.      `unsigned char' when it depends on the signedness of an object.
  1287.      But many programs have been written to use plain `char' and expect
  1288.      it to be signed, or expect it to be unsigned, depending on the
  1289.      machines they were written for.  This option, and its inverse, let
  1290.      you make such a program work with the opposite default.
  1291.  
  1292.      The type `char' is always a distinct type from each of `signed
  1293.      char' or `unsigned char', even though its behavior is always just
  1294.      like one of those two.
  1295.  
  1296. `-fsigned-char'
  1297.      Let the type `char' be signed, like `signed char'.
  1298.  
  1299.      Note that this is equivalent to `-fno-unsigned-char', which is the
  1300.      negative form of `-funsigned-char'.  Likewise, the option
  1301.      `-fno-signed-char' is equivalent to `-funsigned-char'.
  1302.  
  1303. `-fsigned-bitfields'
  1304. `-funsigned-bitfields'
  1305. `-fno-signed-bitfields'
  1306. `-fno-unsigned-bitfields'
  1307.      These options control whether a bitfield is signed or unsigned,
  1308.      when the declaration does not use either `signed' or `unsigned'.
  1309.      By default, such a bitfield is signed, because this is consistent:
  1310.      the basic integer types such as `int' are signed types.
  1311.  
  1312.      However, when `-traditional' is used, bitfields are all unsigned
  1313.      no matter what.
  1314.  
  1315. `-fwritable-strings'
  1316.      Store string constants in the writable data segment and don't
  1317.      uniquize them.  This is for compatibility with old programs which
  1318.      assume they can write into string constants.  The option
  1319.      `-traditional' also has this effect.
  1320.  
  1321.      Writing into string constants is a very bad idea; "constants"
  1322.      should be constant.
  1323.  
  1324. 
  1325. File: @.Distr.UsingGCC,  Node: C++ Dialect Options,  Next: Warning Options,  Prev: C Dialect Options,  Up: Invoking GCC
  1326.  
  1327. Options Controlling C++ Dialect
  1328. ===============================
  1329.  
  1330.    This section describes the command-line options that are only
  1331. meaningful for C++ programs; but you can also use most of the GNU
  1332. compiler options regardless of what language your program is in.  For
  1333. example, you might compile a file `firstClass.C' like this:
  1334.  
  1335.      g++ -g -felide-constructors -O -c firstClass.C
  1336.  
  1337. In this example, only `-felide-constructors' is an option meant only
  1338. for C++ programs; you can use the other options with any language
  1339. supported by GNU CC.
  1340.  
  1341.    Here is a list of options that are *only* for compiling C++ programs:
  1342.  
  1343. `-fall-virtual'
  1344.      Treat all possible member functions as virtual, implicitly.  All
  1345.      member functions (except for constructor functions and `new' or
  1346.      `delete' member operators) are treated as virtual functions of the
  1347.      class where they appear.
  1348.  
  1349.      This does not mean that all calls to these member functions will
  1350.      be made through the internal table of virtual functions.  Under
  1351.      some circumstances, the compiler can determine that a call to a
  1352.      given virtual function can be made directly; in these cases the
  1353.      calls are direct in any case.
  1354.  
  1355. `-fdollars-in-identifiers'
  1356.      Accept `$' in identifiers.  You can also explicitly prohibit use of
  1357.      `$' with the option `-fno-dollars-in-identifiers'.  (GNU C++
  1358.      allows `$' by default on some target systems but not others.)
  1359.      Traditional C allowed the character `$' to form part of
  1360.      identifiers.  However, ANSI C and C++ forbid `$' in identifiers.
  1361.  
  1362. `-felide-constructors'
  1363.      Elide constructors when this seems plausible.  With this option,
  1364.      GNU C++ initializes `y' directly from the call to `foo' without
  1365.      going through a temporary in the following code:
  1366.  
  1367.           A foo ();
  1368.           A y = foo ();
  1369.  
  1370.      Without this option, GNU C++ (1) initializes `y' by calling the
  1371.      appropriate constructor for type `A'; (2) assigns the result of
  1372.      `foo' to a temporary; and, finally, (3) replaces the initial value
  1373.      of `y' with the temporary.
  1374.  
  1375.      The default behavior (`-fno-elide-constructors') is specified by
  1376.      the draft ANSI C++ standard.  If your program's constructors have
  1377.      side effects, `-felide-constructors' can change your program's
  1378.      behavior, since some constructor calls may be omitted.
  1379.  
  1380. `-fenum-int-equiv'
  1381.      Permit implicit conversion of `int' to enumeration types.  Normally
  1382.      GNU C++ allows conversion of `enum' to `int', but not the other
  1383.      way around.
  1384.  
  1385. `-fmemoize-lookups'
  1386. `-fsave-memoized'
  1387.      Use heuristics to compile faster.  These heuristics are not
  1388.      enabled by default, since they are only effective for certain
  1389.      input files.  Other input files compile more slowly.
  1390.  
  1391.      The first time the compiler must build a call to a member function
  1392.      (or reference to a data member), it must (1) determine whether the
  1393.      class implements member functions of that name; (2) resolve which
  1394.      member function to call (which involves figuring out what sorts of
  1395.      type conversions need to be made); and (3) check the visibility of
  1396.      the member function to the caller.  All of this adds up to slower
  1397.      compilation.  Normally, the second time a call is made to that
  1398.      member function (or reference to that data member), it must go
  1399.      through the same lengthy process again.  This means that code like
  1400.      this:
  1401.  
  1402.           cout << "This " << p << " has " << n << " legs.\n";
  1403.  
  1404.      makes six passes through all three steps.  By using a software
  1405.      cache, a "hit" significantly reduces this cost.  Unfortunately,
  1406.      using the cache introduces another layer of mechanisms which must
  1407.      be implemented, and so incurs its own overhead.
  1408.      `-fmemoize-lookups' enables the software cache.
  1409.  
  1410.      Because access privileges (visibility) to members and member
  1411.      functions may differ from one function context to the next, G++
  1412.      may need to flush the cache.  With the `-fmemoize-lookups' flag,
  1413.      the cache is flushed after every function that is compiled.  The
  1414.      `-fsave-memoized' flag enables the same software cache, but when
  1415.      the compiler determines that the context of the last function
  1416.      compiled would yield the same access privileges of the next
  1417.      function to compile, it preserves the cache.  This is most helpful
  1418.      when defining many member functions for the same class: with the
  1419.      exception of member functions which are friends of other classes,
  1420.      each member function has exactly the same access privileges as
  1421.      every other, and the cache need not be flushed.
  1422.  
  1423. `-fno-strict-prototype'
  1424.      Treat a function declaration with no arguments, such as `int foo
  1425.      ();', as C would treat it--as saying nothing about the number of
  1426.      arguments or their types.  Normally, such a declaration in C++
  1427.      means that the function `foo' takes no arguments.
  1428.  
  1429. `-fnonnull-objects'
  1430.      Assume that objects reached through references are not null.
  1431.  
  1432.      Normally, GNU C++ makes conservative assumptions about objects
  1433.      reached through references.  For example, the compiler must check
  1434.      that `a' is not null in code like the following:
  1435.  
  1436.           obj &a = g ();
  1437.           a.f (2);
  1438.  
  1439.      Checking that references of this sort have non-null values requires
  1440.      extra code, however, and it is unnecessary for many programs.  You
  1441.      can use `-fnonnull-objects' to omit the checks for null, if your
  1442.      program doesn't require checking.
  1443.  
  1444. `-fthis-is-variable'
  1445.      Permit assignment to `this'.  The incorporation of user-defined
  1446.      free store management into C++ has made assignment to `this' an
  1447.      anachronism.  Therefore, by default it is invalid to assign to
  1448.      `this' within a class member function; that is, GNU C++ treats the
  1449.      type of `this' in a member function of class `X' to be `X *const'.
  1450.      However, for backwards compatibility, you can make it valid with
  1451.      `-fthis-is-variable'.
  1452.  
  1453. `-nostdinc++'
  1454.      Do not search for header files in the standard directories
  1455.      specific to C++, but do still search the other standard
  1456.      directories.  (This option is used when building libg++.)
  1457.  
  1458. `-traditional'
  1459.      For C++ programs (in addition to the effects that apply to both C
  1460.      and C++), this has the same effect as `-fthis-is-variable'.  *Note
  1461.      Options Controlling C Dialect: C Dialect Options.
  1462.  
  1463.    In addition, these optimization, warning, and code generation options
  1464. have meanings only for C++ programs:
  1465.  
  1466. `-fno-default-inline'
  1467.      Do not assume `inline' for functions defined inside a class scope.
  1468.      *Note Options That Control Optimization: Optimize Options.
  1469.  
  1470. `-Wenum-clash'
  1471. `-Woverloaded-virtual'
  1472. `-Wtemplate-debugging'
  1473.      Warnings that apply only to C++ programs.  *Note Options to
  1474.      Request or Suppress Warnings: Warning Options.
  1475.  
  1476. `+eN'
  1477.      Control how virtual function definitions are used, in a fashion
  1478.      compatible with `cfront' 1.x.  *Note Options for Code Generation
  1479.      Conventions: Code Gen Options.
  1480.  
  1481. 
  1482. File: @.Distr.UsingGCC,  Node: Warning Options,  Next: Debugging Options,  Prev: C++ Dialect Options,  Up: Invoking GCC
  1483.  
  1484. Options to Request or Suppress Warnings
  1485. =======================================
  1486.  
  1487.    Warnings are diagnostic messages that report constructions which are
  1488. not inherently erroneous but which are risky or suggest there may have
  1489. been an error.
  1490.  
  1491.    You can request many specific warnings with options beginning `-W',
  1492. for example `-Wimplicit' to request warnings on implicit declarations.
  1493. Each of these specific warning options also has a negative form
  1494. beginning `-Wno-' to turn off warnings; for example, `-Wno-implicit'.
  1495. This manual lists only one of the two forms, whichever is not the
  1496. default.
  1497.  
  1498.    These options control the amount and kinds of warnings produced by
  1499. GNU CC:
  1500.  
  1501. `-fsyntax-only'
  1502.      Check the code for syntax errors, but don't do anything beyond
  1503.      that.
  1504.  
  1505. `-w'
  1506.      Inhibit all warning messages.
  1507.  
  1508. `-Wno-import'
  1509.      Inhibit warning messages about the use of `#import'.
  1510.  
  1511. `-pedantic'
  1512.      Issue all the warnings demanded by strict ANSI standard C; reject
  1513.      all programs that use forbidden extensions.
  1514.  
  1515.      Valid ANSI standard C programs should compile properly with or
  1516.      without this option (though a rare few will require `-ansi').
  1517.      However, without this option, certain GNU extensions and
  1518.      traditional C features are supported as well.  With this option,
  1519.      they are rejected.
  1520.  
  1521.      `-pedantic' does not cause warning messages for use of the
  1522.      alternate keywords whose names begin and end with `__'.  Pedantic
  1523.      warnings are also disabled in the expression that follows
  1524.      `__extension__'.  However, only system header files should use
  1525.      these escape routes; application programs should avoid them.
  1526.      *Note Alternate Keywords::.
  1527.  
  1528.      This option is not intended to be useful; it exists only to satisfy
  1529.      pedants who would otherwise claim that GNU CC fails to support the
  1530.      ANSI standard.
  1531.  
  1532.      Some users try to use `-pedantic' to check programs for strict ANSI
  1533.      C conformance.  They soon find that it does not do quite what they
  1534.      want: it finds some non-ANSI practices, but not all--only those
  1535.      for which ANSI C *requires* a diagnostic.
  1536.  
  1537.      A feature to report any failure to conform to ANSI C might be
  1538.      useful in some instances, but would require considerable
  1539.      additional work and would be quite different from `-pedantic'.  We
  1540.      recommend, rather, that users take advantage of the extensions of
  1541.      GNU C and disregard the limitations of other compilers.  Aside
  1542.      from certain supercomputers and obsolete small machines, there is
  1543.      less and less reason ever to use any other C compiler other than
  1544.      for bootstrapping GNU CC.
  1545.  
  1546. `-pedantic-errors'
  1547.      Like `-pedantic', except that errors are produced rather than
  1548.      warnings.
  1549.  
  1550. `-W'
  1551.      Print extra warning messages for these events:
  1552.  
  1553.         * A nonvolatile automatic variable might be changed by a call to
  1554.           `longjmp'.  These warnings as well are possible only in
  1555.           optimizing compilation.
  1556.  
  1557.           The compiler sees only the calls to `setjmp'.  It cannot know
  1558.           where `longjmp' will be called; in fact, a signal handler
  1559.           could call it at any point in the code.  As a result, you may
  1560.           get a warning even when there is in fact no problem because
  1561.           `longjmp' cannot in fact be called at the place which would
  1562.           cause a problem.
  1563.  
  1564.         * A function can return either with or without a value.
  1565.           (Falling off the end of the function body is considered
  1566.           returning without a value.)  For example, this function would
  1567.           evoke such a warning:
  1568.  
  1569.                foo (a)
  1570.                {
  1571.                  if (a > 0)
  1572.                    return a;
  1573.                }
  1574.  
  1575.         * An expression-statement contains no side effects.
  1576.  
  1577.         * An unsigned value is compared against zero with `>' or `<='.
  1578.  
  1579.         * A comparison like `x<=y<=z' appears; this is equivalent to
  1580.           `(x<=y ? 1 : 0) <= z', which is a different interpretation
  1581.           from that of ordinary mathematical notation.
  1582.  
  1583.         * Storage-class specifiers like `static' are not the first
  1584.           things in a declaration.  According to the C Standard, this
  1585.           usage is obsolescent.
  1586.  
  1587.         * An aggregate has a partly bracketed initializer.  For
  1588.           example, the following code would evoke such a warning,
  1589.           because braces are missing around the initializer for `x.h':
  1590.  
  1591.                struct s { int f, g; };
  1592.                struct t { struct s h; int i; };
  1593.                struct t x = { 1, 2, 3 };
  1594.  
  1595. `-Wimplicit'
  1596.      Warn whenever a function or parameter is implicitly declared.
  1597.  
  1598. `-Wreturn-type'
  1599.      Warn whenever a function is defined with a return-type that
  1600.      defaults to `int'.  Also warn about any `return' statement with no
  1601.      return-value in a function whose return-type is not `void'.
  1602.  
  1603. `-Wunused'
  1604.      Warn whenever a local variable is unused aside from its
  1605.      declaration, whenever a function is declared static but never
  1606.      defined, and whenever a statement computes a result that is
  1607.      explicitly not used.
  1608.  
  1609.      If you want to prevent a warning for a particular variable, you
  1610.      can use this macro:
  1611.  
  1612.           #define USE(var) \
  1613.             static void * use_##var = (&use_##var, (void *) &var)
  1614.           
  1615.           USE (string);
  1616.  
  1617. `-Wswitch'
  1618.      Warn whenever a `switch' statement has an index of enumeral type
  1619.      and lacks a `case' for one or more of the named codes of that
  1620.      enumeration.  (The presence of a `default' label prevents this
  1621.      warning.)  `case' labels outside the enumeration range also
  1622.      provoke warnings when this option is used.
  1623.  
  1624. `-Wcomment'
  1625.      Warn whenever a comment-start sequence `/*' appears in a comment.
  1626.  
  1627. `-Wtrigraphs'
  1628.      Warn if any trigraphs are encountered (assuming they are enabled).
  1629.  
  1630. `-Wformat'
  1631.      Check calls to `printf' and `scanf', etc., to make sure that the
  1632.      arguments supplied have types appropriate to the format string
  1633.      specified.
  1634.  
  1635. `-Wchar-subscripts'
  1636.      Warn if an array subscript has type `char'.  This is a common cause
  1637.      of error, as programmers often forget that this type is signed on
  1638.      some machines.
  1639.  
  1640. `-Wuninitialized'
  1641.      An automatic variable is used without first being initialized.
  1642.  
  1643.      These warnings are possible only in optimizing compilation,
  1644.      because they require data flow information that is computed only
  1645.      when optimizing.  If you don't specify `-O', you simply won't get
  1646.      these warnings.
  1647.  
  1648.      These warnings occur only for variables that are candidates for
  1649.      register allocation.  Therefore, they do not occur for a variable
  1650.      that is declared `volatile', or whose address is taken, or whose
  1651.      size is other than 1, 2, 4 or 8 bytes.  Also, they do not occur for
  1652.      structures, unions or arrays, even when they are in registers.
  1653.  
  1654.      Note that there may be no warning about a variable that is used
  1655.      only to compute a value that itself is never used, because such
  1656.      computations may be deleted by data flow analysis before the
  1657.      warnings are printed.
  1658.  
  1659.      These warnings are made optional because GNU CC is not smart
  1660.      enough to see all the reasons why the code might be correct
  1661.      despite appearing to have an error.  Here is one example of how
  1662.      this can happen:
  1663.  
  1664.           {
  1665.             int x;
  1666.             switch (y)
  1667.               {
  1668.               case 1: x = 1;
  1669.                 break;
  1670.               case 2: x = 4;
  1671.                 break;
  1672.               case 3: x = 5;
  1673.               }
  1674.             foo (x);
  1675.           }
  1676.  
  1677.      If the value of `y' is always 1, 2 or 3, then `x' is always
  1678.      initialized, but GNU CC doesn't know this.  Here is another common
  1679.      case:
  1680.  
  1681.           {
  1682.             int save_y;
  1683.             if (change_y) save_y = y, y = new_y;
  1684.             ...
  1685.             if (change_y) y = save_y;
  1686.           }
  1687.  
  1688.      This has no bug because `save_y' is used only if it is set.
  1689.  
  1690.      Some spurious warnings can be avoided if you declare all the
  1691.      functions you use that never return as `volatile'.  *Note Function
  1692.      Attributes::.
  1693.  
  1694. `-Wparentheses'
  1695.      Warn if parentheses are omitted in certain contexts, such as when
  1696.      there is an assignment in a context where a truth value is
  1697.      expected, or when operators are nested whose precedence people
  1698.      often get confused about.
  1699.  
  1700. `-Wenum-clash'
  1701.      Warn about conversion between different enumeration types.  (C++
  1702.      only).
  1703.  
  1704. `-Wtemplate-debugging'
  1705.      When using templates in a C++ program, warn if debugging is not yet
  1706.      fully available (C++ only).
  1707.  
  1708. `-Wall'
  1709.      All of the above `-W' options combined.  These are all the options
  1710.      which pertain to usage that we recommend avoiding and that we
  1711.      believe is easy to avoid, even in conjunction with macros.
  1712.  
  1713.    The remaining `-W...' options are not implied by `-Wall' because
  1714. they warn about constructions that we consider reasonable to use, on
  1715. occasion, in clean programs.
  1716.  
  1717. `-Wtraditional'
  1718.      Warn about certain constructs that behave differently in
  1719.      traditional and ANSI C.
  1720.  
  1721.         * Macro arguments occurring within string constants in the
  1722.           macro body.  These would substitute the argument in
  1723.           traditional C, but are part of the constant in ANSI C.
  1724.  
  1725.         * A function declared external in one block and then used after
  1726.           the end of the block.
  1727.  
  1728.         * A `switch' statement has an operand of type `long'.
  1729.  
  1730. `-Wshadow'
  1731.      Warn whenever a local variable shadows another local variable.
  1732.  
  1733. `-Wid-clash-LEN'
  1734.      Warn whenever two distinct identifiers match in the first LEN
  1735.      characters.  This may help you prepare a program that will compile
  1736.      with certain obsolete, brain-damaged compilers.
  1737.  
  1738. `-Wpointer-arith'
  1739.      Warn about anything that depends on the "size of" a function type
  1740.      or of `void'.  GNU C assigns these types a size of 1, for
  1741.      convenience in calculations with `void *' pointers and pointers to
  1742.      functions.
  1743.  
  1744. `-Wcast-qual'
  1745.      Warn whenever a pointer is cast so as to remove a type qualifier
  1746.      from the target type.  For example, warn if a `const char *' is
  1747.      cast to an ordinary `char *'.
  1748.  
  1749. `-Wcast-align'
  1750.      Warn whenever a pointer is cast such that the required alignment
  1751.      of the target is increased.  For example, warn if a `char *' is
  1752.      cast to an `int *' on machines where integers can only be accessed
  1753.      at two- or four-byte boundaries.
  1754.  
  1755. `-Wwrite-strings'
  1756.      Give string constants the type `const char[LENGTH]' so that
  1757.      copying the address of one into a non-`const' `char *' pointer
  1758.      will get a warning.  These warnings will help you find at compile
  1759.      time code that can try to write into a string constant, but only
  1760.      if you have been very careful about using `const' in declarations
  1761.      and prototypes.  Otherwise, it will just be a nuisance; this is
  1762.      why we did not make `-Wall' request these warnings.
  1763.  
  1764. `-Wconversion'
  1765.      Warn if a prototype causes a type conversion that is different
  1766.      from what would happen to the same argument in the absence of a
  1767.      prototype.  This includes conversions of fixed point to floating
  1768.      and vice versa, and conversions changing the width or signedness
  1769.      of a fixed point argument except when the same as the default
  1770.      promotion.
  1771.  
  1772.      Also, warn if a negative integer constant expression is implicitly
  1773.      converted to an unsigned type.  For example, warn about the
  1774.      assignment `x = -1' if `x' is unsigned.  But do not warn about
  1775.      explicit casts like `(unsigned) -1'.
  1776.  
  1777. `-Waggregate-return'
  1778.      Warn if any functions that return structures or unions are defined
  1779.      or called.  (In languages where you can return an array, this also
  1780.      elicits a warning.)
  1781.  
  1782. `-Wstrict-prototypes'
  1783.      Warn if a function is declared or defined without specifying the
  1784.      argument types.  (An old-style function definition is permitted
  1785.      without a warning if preceded by a declaration which specifies the
  1786.      argument types.)
  1787.  
  1788. `-Wmissing-prototypes'
  1789.      Warn if a global function is defined without a previous prototype
  1790.      declaration.  This warning is issued even if the definition itself
  1791.      provides a prototype.  The aim is to detect global functions that
  1792.      fail to be declared in header files.
  1793.  
  1794. `-Wredundant-decls'
  1795.      Warn if anything is declared more than once in the same scope,
  1796.      even in cases where multiple declaration is valid and changes
  1797.      nothing.
  1798.  
  1799. `-Wnested-externs'
  1800.      Warn if an `extern' declaration is encountered within an function.
  1801.  
  1802. `-Winline'
  1803.      Warn if a function can not be inlined, and either it was declared
  1804.      as inline, or else the `-finline-functions' option was given.
  1805.  
  1806. `-Woverloaded-virtual'
  1807.      Warn when a derived class function declaration may be an error in
  1808.      defining a virtual function (C++ only).  In a derived class, the
  1809.      definitions of virtual functions must match the type signature of a
  1810.      virtual function declared in the base class.  With this option, the
  1811.      compiler warns when you define a function with the same name as a
  1812.      virtual function, but with a type signature that does not match any
  1813.      declarations from the base class.
  1814.  
  1815. `-Werror'
  1816.      Make all warnings into errors.
  1817.  
  1818. 
  1819. File: @.Distr.UsingGCC,  Node: Debugging Options,  Next: Optimize Options,  Prev: Warning Options,  Up: Invoking GCC
  1820.  
  1821. Options for Debugging Your Program or GNU CC
  1822. ============================================
  1823.  
  1824.    GNU CC has various special options that are used for debugging
  1825. either your program or GCC:
  1826.  
  1827. `-g'
  1828.      Produce debugging information in the operating system's native
  1829.      format (stabs, COFF, XCOFF, or DWARF).  GDB can work with this
  1830.      debugging information.
  1831.  
  1832.      On most systems that use stabs format, `-g' enables use of extra
  1833.      debugging information that only GDB can use; this extra information
  1834.      makes debugging work better in GDB but will probably make other
  1835.      debuggers crash or refuse to read the program.  If you want to
  1836.      control for certain whether to generate the extra information, use
  1837.      `-gstabs+', `-gstabs', `-gxcoff+', `-gxcoff', `-gdwarf+', or
  1838.      `-gdwarf' (see below).
  1839.  
  1840.      Unlike most other C compilers, GNU CC allows you to use `-g' with
  1841.      `-O'.  The shortcuts taken by optimized code may occasionally
  1842.      produce surprising results: some variables you declared may not
  1843.      exist at all; flow of control may briefly move where you did not
  1844.      expect it; some statements may not be executed because they
  1845.      compute constant results or their values were already at hand;
  1846.      some statements may execute in different places because they were
  1847.      moved out of loops.
  1848.  
  1849.      Nevertheless it proves possible to debug optimized output.  This
  1850.      makes it reasonable to use the optimizer for programs that might
  1851.      have bugs.
  1852.  
  1853.      The following options are useful when GNU CC is generated with the
  1854.      capability for more than one debugging format.
  1855.  
  1856. `-ggdb'
  1857.      Produce debugging information in the native format (if that is
  1858.      supported), including GDB extensions if at all possible.
  1859.  
  1860. `-gstabs'
  1861.      Produce debugging information in stabs format (if that is
  1862.      supported), without GDB extensions.  This is the format used by
  1863.      DBX on most BSD systems.
  1864.  
  1865. `-gstabs+'
  1866.      Produce debugging information in stabs format (if that is
  1867.      supported), using GNU extensions understood only by the GNU
  1868.      debugger (GDB).  The use of these extensions is likely to make
  1869.      other debuggers crash or refuse to read the program.
  1870.  
  1871. `-gcoff'
  1872.      Produce debugging information in COFF format (if that is
  1873.      supported).  This is the format used by SDB on most System V
  1874.      systems prior to System V Release 4.
  1875.  
  1876. `-gxcoff'
  1877.      Produce debugging information in XCOFF format (if that is
  1878.      supported).  This is the format used by the DBX debugger on IBM
  1879.      RS/6000 systems.
  1880.  
  1881. `-gxcoff+'
  1882.      Produce debugging information in XCOFF format (if that is
  1883.      supported), using GNU extensions understood only by the GNU
  1884.      debugger (GDB).  The use of these extensions is likely to make
  1885.      other debuggers crash or refuse to read the program.
  1886.  
  1887. `-gdwarf'
  1888.      Produce debugging information in DWARF format (if that is
  1889.      supported).  This is the format used by SDB on most System V
  1890.      Release 4 systems.
  1891.  
  1892. `-gdwarf+'
  1893.      Produce debugging information in DWARF format (if that is
  1894.      supported), using GNU extensions understood only by the GNU
  1895.      debugger (GDB).  The use of these extensions is likely to make
  1896.      other debuggers crash or refuse to read the program.
  1897.  
  1898. `-gLEVEL'
  1899. `-ggdbLEVEL'
  1900. `-gstabsLEVEL'
  1901. `-gcoffLEVEL'
  1902. `-gxcoffLEVEL'
  1903. `-gdwarfLEVEL'
  1904.      Request debugging information and also use LEVEL to specify how
  1905.      much information.  The default level is 2.
  1906.  
  1907.      Level 1 produces minimal information, enough for making backtraces
  1908.      in parts of the program that you don't plan to debug.  This
  1909.      includes descriptions of functions and external variables, but no
  1910.      information about local variables and no line numbers.
  1911.  
  1912.      Level 3 includes extra information, such as all the macro
  1913.      definitions present in the program.  Some debuggers support macro
  1914.      expansion when you use `-g3'.
  1915.  
  1916. `-p'
  1917.      Generate extra code to write profile information suitable for the
  1918.      analysis program `prof'.  You must use this option when compiling
  1919.      the source files you want data about, and you must also use it when
  1920.      linking.
  1921.  
  1922. `-pg'
  1923.      Generate extra code to write profile information suitable for the
  1924.      analysis program `gprof'.  You must use this option when compiling
  1925.      the source files you want data about, and you must also use it when
  1926.      linking.
  1927.  
  1928. `-a'
  1929.      Generate extra code to write profile information for basic blocks,
  1930.      which will record the number of times each basic block is executed.
  1931.      This data could be analyzed by a program like `tcov'.  Note,
  1932.      however, that the format of the data is not what `tcov' expects.
  1933.      Eventually GNU `gprof' should be extended to process this data.
  1934.  
  1935. `-dLETTERS'
  1936.      Says to make debugging dumps during compilation at times specified
  1937.      by LETTERS.  This is used for debugging the compiler.  The file
  1938.      names for most of the dumps are made by appending a word to the
  1939.      source file name (e.g.  `foo.c.rtl' or `foo.c.jump').  Here are the
  1940.      possible letters for use in LETTERS, and their meanings:
  1941.  
  1942.     `M'
  1943.           Dump all macro definitions, at the end of preprocessing, and
  1944.           write no output.
  1945.  
  1946.     `N'
  1947.           Dump all macro names, at the end of preprocessing.
  1948.  
  1949.     `D'
  1950.           Dump all macro definitions, at the end of preprocessing, in
  1951.           addition to normal output.
  1952.  
  1953.     `y'
  1954.           Dump debugging information during parsing, to standard error.
  1955.  
  1956.     `r'
  1957.           Dump after RTL generation, to `FILE.rtl'.
  1958.  
  1959.     `x'
  1960.           Just generate RTL for a function instead of compiling it.
  1961.           Usually used with `r'.
  1962.  
  1963.     `j'
  1964.           Dump after first jump optimization, to `FILE.jump'.
  1965.  
  1966.     `s'
  1967.           Dump after CSE (including the jump optimization that sometimes
  1968.           follows CSE), to `FILE.cse'.
  1969.  
  1970.     `L'
  1971.           Dump after loop optimization, to `FILE.loop'.
  1972.  
  1973.     `t'
  1974.           Dump after the second CSE pass (including the jump
  1975.           optimization that sometimes follows CSE), to `FILE.cse2'.
  1976.  
  1977.     `f'
  1978.           Dump after flow analysis, to `FILE.flow'.
  1979.  
  1980.     `c'
  1981.           Dump after instruction combination, to the file
  1982.           `FILE.combine'.
  1983.  
  1984.     `S'
  1985.           Dump after the first instruction scheduling pass, to
  1986.           `FILE.sched'.
  1987.  
  1988.     `l'
  1989.           Dump after local register allocation, to `FILE.lreg'.
  1990.  
  1991.     `g'
  1992.           Dump after global register allocation, to `FILE.greg'.
  1993.  
  1994.     `R'
  1995.           Dump after the second instruction scheduling pass, to
  1996.           `FILE.sched2'.
  1997.  
  1998.     `J'
  1999.           Dump after last jump optimization, to `FILE.jump2'.
  2000.  
  2001.     `d'
  2002.           Dump after delayed branch scheduling, to `FILE.dbr'.
  2003.  
  2004.     `k'
  2005.           Dump after conversion from registers to stack, to
  2006.           `FILE.stack'.
  2007.  
  2008.     `a'
  2009.           Produce all the dumps listed above.
  2010.  
  2011.     `m'
  2012.           Print statistics on memory usage, at the end of the run, to
  2013.           standard error.
  2014.  
  2015.     `p'
  2016.           Annotate the assembler output with a comment indicating which
  2017.           pattern and alternative was used.
  2018.  
  2019. `-fpretend-float'
  2020.      When running a cross-compiler, pretend that the target machine
  2021.      uses the same floating point format as the host machine.  This
  2022.      causes incorrect output of the actual floating constants, but the
  2023.      actual instruction sequence will probably be the same as GNU CC
  2024.      would make when running on the target machine.
  2025.  
  2026. `-save-temps'
  2027.      Store the usual "temporary" intermediate files permanently; place
  2028.      them in the current directory and name them based on the source
  2029.      file.  Thus, compiling `foo.c' with `-c -save-temps' would produce
  2030.      files `foo.i' and `foo.s', as well as `foo.o'.
  2031.  
  2032. `-print-libgcc-file-name'
  2033.      Print the full absolute name of the library file `libgcc.a' that
  2034.      would be used when linking--and don't do anything else.  With this
  2035.      option, GNU CC does not compile or link anything; it just prints
  2036.      the file name.
  2037.  
  2038.      This is useful when you use `-nostdlib' but you do want to link
  2039.      with `libgcc.a'.  You can do
  2040.  
  2041.           gcc -nostdlib FILES... `gcc -print-libgcc-file-name`
  2042.  
  2043. 
  2044. File: @.Distr.UsingGCC,  Node: Optimize Options,  Next: Preprocessor Options,  Prev: Debugging Options,  Up: Invoking GCC
  2045.  
  2046. Options That Control Optimization
  2047. =================================
  2048.  
  2049.    These options control various sorts of optimizations:
  2050.  
  2051. `-O'
  2052. `-O1'
  2053.      Optimize.  Optimizing compilation takes somewhat more time, and a
  2054.      lot more memory for a large function.
  2055.  
  2056.      Without `-O', the compiler's goal is to reduce the cost of
  2057.      compilation and to make debugging produce the expected results.
  2058.      Statements are independent: if you stop the program with a
  2059.      breakpoint between statements, you can then assign a new value to
  2060.      any variable or change the program counter to any other statement
  2061.      in the function and get exactly the results you would expect from
  2062.      the source code.
  2063.  
  2064.      Without `-O', only variables declared `register' are allocated in
  2065.      registers.  The resulting compiled code is a little worse than
  2066.      produced by PCC without `-O'.
  2067.  
  2068.      With `-O', the compiler tries to reduce code size and execution
  2069.      time.
  2070.  
  2071.      When `-O' is specified, the two options `-fthread-jumps' and
  2072.      `-fdelayed-branch' are turned on.  On some machines other flags may
  2073.      also be turned on.
  2074.  
  2075. `-O2'
  2076.      Optimize even more.  Nearly all supported optimizations that do not
  2077.      involve a space-speed tradeoff are performed.  As compared to `-O',
  2078.      this option increases both compilation time and the performance of
  2079.      the generated code.
  2080.  
  2081.      `-O2' turns on all optional optimizations except for loop unrolling
  2082.      and frame pointer elimination.
  2083.  
  2084. `-O0'
  2085.      Do not optimize.
  2086.  
  2087.      If you use multiple `-O' options, with or without level numbers,
  2088.      the last such option is the one that is effective.
  2089.  
  2090.    Options of the form `-fFLAG' specify machine-independent flags.
  2091. Most flags have both positive and negative forms; the negative form of
  2092. `-ffoo' would be `-fno-foo'.  In the table below, only one of the forms
  2093. is listed--the one which is not the default.  You can figure out the
  2094. other form by either removing `no-' or adding it.
  2095.  
  2096. `-ffloat-store'
  2097.      Do not store floating point variables in registers, and inhibit
  2098.      other options that might change whether a floating point value is
  2099.      taken from a register or memory.
  2100.  
  2101.      This option prevents undesirable excess precision on machines such
  2102.      as the 68000 where the floating registers (of the 68881) keep more
  2103.      precision than a `double' is supposed to have.  For most programs,
  2104.      the excess precision does only good, but a few programs rely on the
  2105.      precise definition of IEEE floating point.  Use `-ffloat-store' for
  2106.      such programs.
  2107.  
  2108. `-fno-default-inline'
  2109.      Do not make member functions inline by default merely because they
  2110.      are defined inside the class scope (C++ only).  Otherwise, when
  2111.      you specify `-O', member functions defined inside class scope are
  2112.      compiled inline by default; i.e., you don't need to add `inline'
  2113.      in front of the member function name.
  2114.  
  2115. `-fno-defer-pop'
  2116.      Always pop the arguments to each function call as soon as that
  2117.      function returns.  For machines which must pop arguments after a
  2118.      function call, the compiler normally lets arguments accumulate on
  2119.      the stack for several function calls and pops them all at once.
  2120.  
  2121. `-fforce-mem'
  2122.      Force memory operands to be copied into registers before doing
  2123.      arithmetic on them.  This may produce better code by making all
  2124.      memory references potential common subexpressions.  When they are
  2125.      not common subexpressions, instruction combination should
  2126.      eliminate the separate register-load.  I am interested in hearing
  2127.      about the difference this makes.
  2128.  
  2129. `-fforce-addr'
  2130.      Force memory address constants to be copied into registers before
  2131.      doing arithmetic on them.  This may produce better code just as
  2132.      `-fforce-mem' may.  I am interested in hearing about the
  2133.      difference this makes.
  2134.  
  2135. `-fomit-frame-pointer'
  2136.      Don't keep the frame pointer in a register for functions that
  2137.      don't need one.  This avoids the instructions to save, set up and
  2138.      restore frame pointers; it also makes an extra register available
  2139.      in many functions.  *It also makes debugging impossible on some
  2140.      machines.*
  2141.  
  2142.      On some machines, such as the Vax, this flag has no effect, because
  2143.      the standard calling sequence automatically handles the frame
  2144.      pointer and nothing is saved by pretending it doesn't exist.  The
  2145.      machine-description macro `FRAME_POINTER_REQUIRED' controls
  2146.      whether a target machine supports this flag.  *Note Register
  2147.      Usage: (gcc.info)Registers.
  2148.  
  2149. `-fno-inline'
  2150.      Don't pay attention to the `inline' keyword.  Normally this option
  2151.      is used to keep the compiler from expanding any functions inline.
  2152.      Note that if you are not optimizing, no functions can be expanded
  2153.      inline.
  2154.  
  2155. `-finline-functions'
  2156.      Integrate all simple functions into their callers.  The compiler
  2157.      heuristically decides which functions are simple enough to be worth
  2158.      integrating in this way.
  2159.  
  2160.      If all calls to a given function are integrated, and the function
  2161.      is declared `static', then the function is normally not output as
  2162.      assembler code in its own right.
  2163.  
  2164. `-fkeep-inline-functions'
  2165.      Even if all calls to a given function are integrated, and the
  2166.      function is declared `static', nevertheless output a separate
  2167.      run-time callable version of the function.
  2168.  
  2169. `-fno-function-cse'
  2170.      Do not put function addresses in registers; make each instruction
  2171.      that calls a constant function contain the function's address
  2172.      explicitly.
  2173.  
  2174.      This option results in less efficient code, but some strange hacks
  2175.      that alter the assembler output may be confused by the
  2176.      optimizations performed when this option is not used.
  2177.  
  2178. `-ffast-math'
  2179.      This option allows GCC to violate some ANSI or IEEE rules and/or
  2180.      specifications in the interest of optimizing code for speed.  For
  2181.      example, it allows the compiler to assume arguments to the `sqrt'
  2182.      function are non-negative numbers.
  2183.  
  2184.      This option should never be turned on by any `-O' option since it
  2185.      can result in incorrect output for programs which depend on an
  2186.      exact implementation of IEEE or ANSI rules/specifications for math
  2187.      functions.
  2188.  
  2189.    The following options control specific optimizations.  The `-O2'
  2190. option turns on all of these optimizations except `-funroll-loops' and
  2191. `-funroll-all-loops'.  On most machines, the `-O' option turns on the
  2192. `-fthread-jumps' and `-fdelayed-branch' options, but specific machines
  2193. may handle it differently.
  2194.  
  2195.    You can use the following flags in the rare cases when "fine-tuning"
  2196. of optimizations to be performed is desired.
  2197.  
  2198. `-fstrength-reduce'
  2199.      Perform the optimizations of loop strength reduction and
  2200.      elimination of iteration variables.
  2201.  
  2202. `-fthread-jumps'
  2203.      Perform optimizations where we check to see if a jump branches to a
  2204.      location where another comparison subsumed by the first is found.
  2205.      If so, the first branch is redirected to either the destination of
  2206.      the second branch or a point immediately following it, depending
  2207.      on whether the condition is known to be true or false.
  2208.  
  2209. `-fcse-follow-jumps'
  2210.      In common subexpression elimination, scan through jump instructions
  2211.      when the target of the jump is not reached by any other path.  For
  2212.      example, when CSE encounters an `if' statement with an `else'
  2213.      clause, CSE will follow the jump when the condition tested is
  2214.      false.
  2215.  
  2216. `-fcse-skip-blocks'
  2217.      This is similar to `-fcse-follow-jumps', but causes CSE to follow
  2218.      jumps which conditionally skip over blocks.  When CSE encounters a
  2219.      simple `if' statement with no else clause, `-fcse-skip-blocks'
  2220.      causes CSE to follow the jump around the body of the `if'.
  2221.  
  2222. `-frerun-cse-after-loop'
  2223.      Re-run common subexpression elimination after loop optimizations
  2224.      has been performed.
  2225.  
  2226. `-fexpensive-optimizations'
  2227.      Perform a number of minor optimizations that are relatively
  2228.      expensive.
  2229.  
  2230. `-fdelayed-branch'
  2231.      If supported for the target machine, attempt to reorder
  2232.      instructions to exploit instruction slots available after delayed
  2233.      branch instructions.
  2234.  
  2235. `-fschedule-insns'
  2236.      If supported for the target machine, attempt to reorder
  2237.      instructions to eliminate execution stalls due to required data
  2238.      being unavailable.  This helps machines that have slow floating
  2239.      point or memory load instructions by allowing other instructions
  2240.      to be issued until the result of the load or floating point
  2241.      instruction is required.
  2242.  
  2243. `-fschedule-insns2'
  2244.      Similar to `-fschedule-insns', but requests an additional pass of
  2245.      instruction scheduling after register allocation has been done.
  2246.      This is especially useful on machines with a relatively small
  2247.      number of registers and where memory load instructions take more
  2248.      than one cycle.
  2249.  
  2250. `-fcaller-saves'
  2251.      Enable values to be allocated in registers that will be clobbered
  2252.      by function calls, by emitting extra instructions to save and
  2253.      restore the registers around such calls.  Such allocation is done
  2254.      only when it seems to result in better code than would otherwise
  2255.      be produced.
  2256.  
  2257.      This option is enabled by default on certain machines, usually
  2258.      those which have no call-preserved registers to use instead.
  2259.  
  2260. `-funroll-loops'
  2261.      Perform the optimization of loop unrolling.  This is only done for
  2262.      loops whose number of iterations can be determined at compile time
  2263.      or run time.  `-funroll-loop' implies both `-fstrength-reduce' and
  2264.      `-frerun-cse-after-loop'.
  2265.  
  2266. `-funroll-all-loops'
  2267.      Perform the optimization of loop unrolling.  This is done for all
  2268.      loops and usually makes programs run more slowly.
  2269.      `-funroll-all-loops' implies `-fstrength-reduce' as well as
  2270.      `-frerun-cse-after-loop'.
  2271.  
  2272. `-fno-peephole'
  2273.      Disable any machine-specific peephole optimizations.
  2274.  
  2275. 
  2276. File: @.Distr.UsingGCC,  Node: Preprocessor Options,  Next: Assembler Options,  Prev: Optimize Options,  Up: Invoking GCC
  2277.  
  2278. Options Controlling the Preprocessor
  2279. ====================================
  2280.  
  2281.    These options control the C preprocessor, which is run on each C
  2282. source file before actual compilation.
  2283.  
  2284.    If you use the `-E' option, nothing is done except preprocessing.
  2285. Some of these options make sense only together with `-E' because they
  2286. cause the preprocessor output to be unsuitable for actual compilation.
  2287.  
  2288. `-include FILE'
  2289.      Process FILE as input before processing the regular input file.
  2290.      In effect, the contents of FILE are compiled first.  Any `-D' and
  2291.      `-U' options on the command line are always processed before
  2292.      `-include FILE', regardless of the order in which they are
  2293.      written.  All the `-include' and `-imacros' options are processed
  2294.      in the order in which they are written.
  2295.  
  2296. `-imacros FILE'
  2297.      Process FILE as input, discarding the resulting output, before
  2298.      processing the regular input file.  Because the output generated
  2299.      from FILE is discarded, the only effect of `-imacros FILE' is to
  2300.      make the macros defined in FILE available for use in the main
  2301.      input.
  2302.  
  2303.      Any `-D' and `-U' options on the command line are always processed
  2304.      before `-imacros FILE', regardless of the order in which they are
  2305.      written.  All the `-include' and `-imacros' options are processed
  2306.      in the order in which they are written.
  2307.  
  2308. `-idirafter DIR'
  2309.      Add the directory DIR to the second include path.  The directories
  2310.      on the second include path are searched when a header file is not
  2311.      found in any of the directories in the main include path (the one
  2312.      that `-I' adds to).
  2313.  
  2314. `-iprefix PREFIX'
  2315.      Specify PREFIX as the prefix for subsequent `-iwithprefix' options.
  2316.  
  2317. `-iwithprefix DIR'
  2318.      Add a directory to the second include path.  The directory's name
  2319.      is made by concatenating PREFIX and DIR, where PREFIX was
  2320.      specified previously with `-iprefix'.
  2321.  
  2322. `-nostdinc'
  2323.      Do not search the standard system directories for header files.
  2324.      Only the directories you have specified with `-I' options (and the
  2325.      current directory, if appropriate) are searched.  *Note Directory
  2326.      Options::, for information on `-I'.
  2327.  
  2328.      By using both `-nostdinc' and `-I-', you can limit the include-file
  2329.      search path to only those directories you specify explicitly.
  2330.  
  2331. `-undef'
  2332.      Do not predefine any nonstandard macros.  (Including architecture
  2333.      flags).
  2334.  
  2335. `-E'
  2336.      Run only the C preprocessor.  Preprocess all the C source files
  2337.      specified and output the results to standard output or to the
  2338.      specified output file.
  2339.  
  2340. `-C'
  2341.      Tell the preprocessor not to discard comments.  Used with the `-E'
  2342.      option.
  2343.  
  2344. `-P'
  2345.      Tell the preprocessor not to generate `#line' commands.  Used with
  2346.      the `-E' option.
  2347.  
  2348. `-M'
  2349.      Tell the preprocessor to output a rule suitable for `make'
  2350.      describing the dependencies of each object file.  For each source
  2351.      file, the preprocessor outputs one `make'-rule whose target is the
  2352.      object file name for that source file and whose dependencies are
  2353.      all the `#include' header files it uses.  This rule may be a
  2354.      single line or may be continued with `\'-newline if it is long.
  2355.      The list of rules is printed on standard output instead of the
  2356.      preprocessed C program.
  2357.  
  2358.      `-M' implies `-E'.
  2359.  
  2360.      Another way to specify output of a `make' rule is by setting the
  2361.      environment variable `DEPENDENCIES_OUTPUT' (*note Environment
  2362.      Variables::.).
  2363.  
  2364. `-MM'
  2365.      Like `-M' but the output mentions only the user header files
  2366.      included with `#include "FILE"'.  System header files included
  2367.      with `#include <FILE>' are omitted.
  2368.  
  2369. `-MD'
  2370.      Like `-M' but the dependency information is written to files with
  2371.      names made by replacing `.o' with `.d' at the end of the output
  2372.      file names.  This is in addition to compiling the input files as
  2373.      specified--`-MD' does not inhibit ordinary compilation the way
  2374.      `-M' does.
  2375.  
  2376.      The Mach utility `md' can be used to merge the `.d' files into a
  2377.      single dependency file suitable for using with the `make' command.
  2378.  
  2379. `-MMD'
  2380.      Like `-MD' except mention only user header files, not system
  2381.      header files.
  2382.  
  2383. `-H'
  2384.      Print the name of each header file used, in addition to other
  2385.      normal activities.
  2386.  
  2387. `-AQUESTION(ANSWER)'
  2388.      Assert the answer ANSWER for QUESTION, in case it is tested with a
  2389.      preprocessor conditional such as `#if #QUESTION(ANSWER)'.  `-A-'
  2390.      disables the standard assertions that normally describe the target
  2391.      machine.
  2392.  
  2393. `-DMACRO'
  2394.      Define macro MACRO with the string `1' as its definition.
  2395.  
  2396. `-DMACRO=DEFN'
  2397.      Define macro MACRO as DEFN.  All instances of `-D' on the command
  2398.      line are processed before any `-U' options.
  2399.  
  2400. `-UMACRO'
  2401.      Undefine macro MACRO.  `-U' options are evaluated after all `-D'
  2402.      options, but before any `-include' and `-imacros' options.
  2403.  
  2404. `-dM'
  2405.      Tell the preprocessor to output only a list of the macro
  2406.      definitions that are in effect at the end of preprocessing.  Used
  2407.      with the `-E' option.
  2408.  
  2409. `-dD'
  2410.      Tell the preprocessing to pass all macro definitions into the
  2411.      output, in their proper sequence in the rest of the output.
  2412.  
  2413. `-dN'
  2414.      Like `-dD' except that the macro arguments and contents are
  2415.      omitted.  Only `#define NAME' is included in the output.
  2416.  
  2417. `-trigraphs'
  2418.      Support ANSI C trigraphs.  You don't want to know about this
  2419.      brain-damage.  The `-ansi' option also has this effect.
  2420.  
  2421. 
  2422. File: @.Distr.UsingGCC,  Node: Assembler Options,  Next: Link Options,  Prev: Preprocessor Options,  Up: Invoking GCC
  2423.  
  2424. Passing Options to the Assembler
  2425. ================================
  2426.  
  2427. `-Wa,OPTION'
  2428.      Pass OPTION as an option to the assembler.  If OPTION contains
  2429.      commas, it is split into multiple options at the commas.
  2430.  
  2431. 
  2432. File: @.Distr.UsingGCC,  Node: Link Options,  Next: Directory Options,  Prev: Assembler Options,  Up: Invoking GCC
  2433.  
  2434. Options for Linking
  2435. ===================
  2436.  
  2437.    These options come into play when the compiler links object files
  2438. into an executable output file.  They are meaningless if the compiler is
  2439. not doing a link step.
  2440.  
  2441. `OBJECT-FILE-NAME'
  2442.      A file name that does not end in a special recognized suffix is
  2443.      considered to name an object file or library.  (Object files are
  2444.      distinguished from libraries by the linker according to the file
  2445.      contents.)  If linking is done, these object files are used as
  2446.      input to the linker.
  2447.  
  2448. `-c'
  2449. `-S'
  2450. `-E'
  2451.      If any of these options is used, then the linker is not run, and
  2452.      object file names should not be used as arguments.  *Note Overall
  2453.      Options::.
  2454.  
  2455. `-lLIBRARY'
  2456.      Search the library named LIBRARY when linking.
  2457.  
  2458.      It makes a difference where in the command you write this option;
  2459.      the linker searches processes libraries and object files in the
  2460.      order they are specified.  Thus, `foo.o -lz bar.o' searches
  2461.      library `z' after file `foo.o' but before `bar.o'.  If `bar.o'
  2462.      refers to functions in `z', those functions may not be loaded.
  2463.  
  2464.      The linker searches a standard list of directories for the library,
  2465.      which is actually a file named `libLIBRARY.a'.  The linker then
  2466.      uses this file as if it had been specified precisely by name.
  2467.  
  2468.      The directories searched include several standard system
  2469.      directories plus any that you specify with `-L'.
  2470.  
  2471.      Normally the files found this way are library files--archive files
  2472.      whose members are object files.  The linker handles an archive
  2473.      file by scanning through it for members which define symbols that
  2474.      have so far been referenced but not defined.  But if the file that
  2475.      is found is an ordinary object file, it is linked in the usual
  2476.      fashion.  The only difference between using an `-l' option and
  2477.      specifying a file name is that `-l' surrounds LIBRARY with `lib'
  2478.      and `.a' and searches several directories.
  2479.  
  2480. `-lobjc'
  2481.      You need this special case of the `-l' option in order to link an
  2482.      Objective C program.
  2483.  
  2484. `-nostartfiles'
  2485.      Do not use the standard system startup files when linking.  The
  2486.      standard libraries are used normally.
  2487.  
  2488. `-nostdlib'
  2489.      Don't use the standard system libraries and startup files when
  2490.      linking.  Only the files you specify will be passed to the linker.
  2491.  
  2492. `-static'
  2493.      On systems that support dynamic linking, this prevents linking
  2494.      with the shared libraries.  On other systems, this option has no
  2495.      effect.
  2496.  
  2497. `-shared'
  2498.      Produce a shared object which can then be linked with other
  2499.      objects to form an executable.  Only a few systems support this
  2500.      option.
  2501.  
  2502. `-symbolic'
  2503.      Bind references to global symbols when building a shared object.
  2504.      Warn about any unresolved references (unless overridden by the
  2505.      link editor option `-Xlinker -z -Xlinker defs').  Only a few
  2506.      systems support this option.
  2507.  
  2508. `-Xlinker OPTION'
  2509.      Pass OPTION as an option to the linker.  You can use this to
  2510.      supply system-specific linker options which GNU CC does not know
  2511.      how to recognize.
  2512.  
  2513.      If you want to pass an option that takes an argument, you must use
  2514.      `-Xlinker' twice, once for the option and once for the argument.
  2515.      For example, to pass `-assert definitions', you must write
  2516.      `-Xlinker -assert -Xlinker definitions'.  It does not work to write
  2517.      `-Xlinker "-assert definitions"', because this passes the entire
  2518.      string as a single argument, which is not what the linker expects.
  2519.  
  2520. `-Wl,OPTION'
  2521.      Pass OPTION as an option to the linker.  If OPTION contains
  2522.      commas, it is split into multiple options at the commas.
  2523.  
  2524. `-u SYMBOL'
  2525.      Pretend the symbol SYMBOL is undefined, to force linking of
  2526.      library modules to define it.  You can use `-u' multiple times with
  2527.      different symbols to force loading of additional library modules.
  2528.  
  2529. 
  2530. File: @.Distr.UsingGCC,  Node: Directory Options,  Next: Target Options,  Prev: Link Options,  Up: Invoking GCC
  2531.  
  2532. Options for Directory Search
  2533. ============================
  2534.  
  2535.    These options specify directories to search for header files, for
  2536. libraries and for parts of the compiler:
  2537.  
  2538. `-IDIR'
  2539.      Append directory DIR to the list of directories searched for
  2540.      include files.
  2541.  
  2542. `-I-'
  2543.      Any directories you specify with `-I' options before the `-I-'
  2544.      option are searched only for the case of `#include "FILE"'; they
  2545.      are not searched for `#include <FILE>'.
  2546.  
  2547.      If additional directories are specified with `-I' options after
  2548.      the `-I-', these directories are searched for all `#include'
  2549.      directives.  (Ordinarily *all* `-I' directories are used this way.)
  2550.  
  2551.      In addition, the `-I-' option inhibits the use of the current
  2552.      directory (where the current input file came from) as the first
  2553.      search directory for `#include "FILE"'.  There is no way to
  2554.      override this effect of `-I-'.  With `-I.' you can specify
  2555.      searching the directory which was current when the compiler was
  2556.      invoked.  That is not exactly the same as what the preprocessor
  2557.      does by default, but it is often satisfactory.
  2558.  
  2559.      `-I-' does not inhibit the use of the standard system directories
  2560.      for header files.  Thus, `-I-' and `-nostdinc' are independent.
  2561.  
  2562. `-LDIR'
  2563.      Add directory DIR to the list of directories to be searched for
  2564.      `-l'.
  2565.  
  2566. `-BPREFIX'
  2567.      This option specifies where to find the executables, libraries and
  2568.      data files of the compiler itself.
  2569.  
  2570.      The compiler driver program runs one or more of the subprograms
  2571.      `cpp', `cc1', `as' and `ld'.  It tries PREFIX as a prefix for each
  2572.      program it tries to run, both with and without `MACHINE/VERSION/'
  2573.      (*note Target Options::.).
  2574.  
  2575.      For each subprogram to be run, the compiler driver first tries the
  2576.      `-B' prefix, if any.  If that name is not found, or if `-B' was
  2577.      not specified, the driver tries two standard prefixes, which are
  2578.      `/usr/lib/gcc/' and `/usr/local/lib/gcc-lib/'.  If neither of
  2579.      those results in a file name that is found, the unmodified program
  2580.      name is searched for using the directories specified in your
  2581.      `PATH' environment variable.
  2582.  
  2583.      `-B' prefixes that effectively specify directory names also apply
  2584.      to libraries in the linker, because the compiler translates these
  2585.      options into `-L' options for the linker.
  2586.  
  2587.      The run-time support file `libgcc.a' can also be searched for using
  2588.      the `-B' prefix, if needed.  If it is not found there, the two
  2589.      standard prefixes above are tried, and that is all.  The file is
  2590.      left out of the link if it is not found by those means.
  2591.  
  2592.      Another way to specify a prefix much like the `-B' prefix is to use
  2593.      the environment variable `GCC_EXEC_PREFIX'.  *Note Environment
  2594.      Variables::.
  2595.  
  2596. 
  2597. File: @.Distr.UsingGCC,  Node: Target Options,  Next: Submodel Options,  Prev: Directory Options,  Up: Invoking GCC
  2598.  
  2599. Specifying Target Machine and Compiler Version
  2600. ==============================================
  2601.  
  2602.    By default, GNU CC compiles code for the same type of machine that
  2603. you are using.  However, it can also be installed as a cross-compiler,
  2604. to compile for some other type of machine.  In fact, several different
  2605. configurations of GNU CC, for different target machines, can be
  2606. installed side by side.  Then you specify which one to use with the
  2607. `-b' option.
  2608.  
  2609.    In addition, older and newer versions of GNU CC can be installed side
  2610. by side.  One of them (probably the newest) will be the default, but
  2611. you may sometimes wish to use another.
  2612.  
  2613. `-b MACHINE'
  2614.      The argument MACHINE specifies the target machine for compilation.
  2615.      This is useful when you have installed GNU CC as a cross-compiler.
  2616.  
  2617.      The value to use for MACHINE is the same as was specified as the
  2618.      machine type when configuring GNU CC as a cross-compiler.  For
  2619.      example, if a cross-compiler was configured with `configure
  2620.      i386v', meaning to compile for an 80386 running System V, then you
  2621.      would specify `-b i386v' to run that cross compiler.
  2622.  
  2623.      When you do not specify `-b', it normally means to compile for the
  2624.      same type of machine that you are using.
  2625.  
  2626. `-V VERSION'
  2627.      The argument VERSION specifies which version of GNU CC to run.
  2628.      This is useful when multiple versions are installed.  For example,
  2629.      VERSION might be `2.0', meaning to run GNU CC version 2.0.
  2630.  
  2631.      The default version, when you do not specify `-V', is controlled
  2632.      by the way GNU CC is installed.  Normally, it will be a version
  2633.      that is recommended for general use.
  2634.  
  2635.    The `-b' and `-V' options actually work by controlling part of the
  2636. file name used for the executable files and libraries used for
  2637. compilation.  A given version of GNU CC, for a given target machine, is
  2638. normally kept in the directory `/usr/local/lib/gcc-lib/MACHINE/VERSION'.
  2639.  
  2640.    Thus, sites can customize the effect of `-b' or `-V' either by
  2641. changing the names of these directories or adding alternate names (or
  2642. symbolic links).  If in directory `/usr/local/lib/gcc-lib/' the file
  2643. `80386' is a link to the file `i386v', then `-b 80386' becomes an alias
  2644. for `-b i386v'.
  2645.  
  2646.    In one respect, the `-b' or `-V' do not completely change to a
  2647. different compiler: the top-level driver program `gcc' that you
  2648. originally invoked continues to run and invoke the other executables
  2649. (preprocessor, compiler per se, assembler and linker) that do the real
  2650. work.  However, since no real work is done in the driver program, it
  2651. usually does not matter that the driver program in use is not the one
  2652. for the specified target and version.
  2653.  
  2654.    The only way that the driver program depends on the target machine is
  2655. in the parsing and handling of special machine-specific options.
  2656. However, this is controlled by a file which is found, along with the
  2657. other executables, in the directory for the specified version and
  2658. target machine.  As a result, a single installed driver program adapts
  2659. to any specified target machine and compiler version.
  2660.  
  2661.    The driver program executable does control one significant thing,
  2662. however: the default version and target machine.  Therefore, you can
  2663. install different instances of the driver program, compiled for
  2664. different targets or versions, under different names.
  2665.  
  2666.    For example, if the driver for version 2.0 is installed as `ogcc'
  2667. and that for version 2.1 is installed as `gcc', then the command `gcc'
  2668. will use version 2.1 by default, while `ogcc' will use 2.0 by default.
  2669. However, you can choose either version with either command with the
  2670. `-V' option.
  2671.  
  2672. 
  2673. File: @.Distr.UsingGCC,  Node: Submodel Options,  Next: Code Gen Options,  Prev: Target Options,  Up: Invoking GCC
  2674.  
  2675. Hardware Models and Configurations
  2676. ==================================
  2677.  
  2678.    Earlier we discussed the standard option `-b' which chooses among
  2679. different installed compilers for completely different target machines,
  2680. such as Vax vs. 68000 vs. 80386.
  2681.  
  2682.    In addition, each of these target machine types can have its own
  2683. special options, starting with `-m', to choose among various hardware
  2684. models or configurations--for example, 68010 vs 68020, floating
  2685. coprocessor or none.  A single installed version of the compiler can
  2686. compile for any model or configuration, according to the options
  2687. specified.
  2688.  
  2689.    Some configurations of the compiler also support additional special
  2690. options, usually for compatibility with other compilers on the same
  2691. platform.
  2692.  
  2693. * Menu:
  2694.  
  2695. * M680x0 Options::
  2696. * VAX Options::
  2697. * SPARC Options::
  2698. * Convex Options::
  2699. * AMD29K Options::
  2700. * M88K Options::
  2701. * RS/6000 Options::
  2702. * RT Options::
  2703. * MIPS Options::
  2704. * i386 Options::
  2705. * HPPA Options::
  2706. * Intel 960 Options::
  2707. * DEC Alpha Options::
  2708. * System V Options::
  2709.  
  2710. 
  2711. File: @.Distr.UsingGCC,  Node: M680x0 Options,  Next: VAX Options,  Up: Submodel Options
  2712.  
  2713. M680x0 Options
  2714. --------------
  2715.  
  2716.    These are the `-m' options defined for the 68000 series.  The default
  2717. values for these options depends on which style of 68000 was selected
  2718. when the compiler was configured; the defaults for the most common
  2719. choices are given below.
  2720.  
  2721. `-m68000'
  2722. `-mc68000'
  2723.      Generate output for a 68000.  This is the default when the
  2724.      compiler is configured for 68000-based systems.
  2725.  
  2726. `-m68020'
  2727. `-mc68020'
  2728.      Generate output for a 68020.  This is the default when the
  2729.      compiler is configured for 68020-based systems.
  2730.  
  2731. `-m68881'
  2732.      Generate output containing 68881 instructions for floating point.
  2733.      This is the default for most 68020 systems unless `-nfp' was
  2734.      specified when the compiler was configured.
  2735.  
  2736. `-m68030'
  2737.      Generate output for a 68030.  This is the default when the
  2738.      compiler is configured for 68030-based systems.
  2739.  
  2740. `-m68040'
  2741.      Generate output for a 68040.  This is the default when the
  2742.      compiler is configured for 68040-based systems.
  2743.  
  2744. `-m68020-40'
  2745.      Generate output for a 68040, without using any of the new
  2746.      instructions.  This results in code which can run relatively
  2747.      efficiently on either a 68020/68881 or a 68030 or a 68040.
  2748.  
  2749. `-mfpa'
  2750.      Generate output containing Sun FPA instructions for floating point.
  2751.  
  2752. `-msoft-float'
  2753.      Generate output containing library calls for floating point.
  2754.      *Warning:* the requisite libraries are not part of GNU CC.
  2755.      Normally the facilities of the machine's usual C compiler are
  2756.      used, but this can't be done directly in cross-compilation.  You
  2757.      must make your own arrangements to provide suitable library
  2758.      functions for cross-compilation.
  2759.  
  2760. `-mshort'
  2761.      Consider type `int' to be 16 bits wide, like `short int'.
  2762.  
  2763. `-mnobitfield'
  2764.      Do not use the bit-field instructions.  The `-m68000' option
  2765.      implies `-mnobitfield'.
  2766.  
  2767. `-mbitfield'
  2768.      Do use the bit-field instructions.  The `-m68020' option implies
  2769.      `-mbitfield'.  This is the default if you use a configuration
  2770.      designed for a 68020.
  2771.  
  2772. `-mrtd'
  2773.      Use a different function-calling convention, in which functions
  2774.      that take a fixed number of arguments return with the `rtd'
  2775.      instruction, which pops their arguments while returning.  This
  2776.      saves one instruction in the caller since there is no need to pop
  2777.      the arguments there.
  2778.  
  2779.      This calling convention is incompatible with the one normally used
  2780.      on Unix, so you cannot use it if you need to call libraries
  2781.      compiled with the Unix compiler.
  2782.  
  2783.      Also, you must provide function prototypes for all functions that
  2784.      take variable numbers of arguments (including `printf'); otherwise
  2785.      incorrect code will be generated for calls to those functions.
  2786.  
  2787.      In addition, seriously incorrect code will result if you call a
  2788.      function with too many arguments.  (Normally, extra arguments are
  2789.      harmlessly ignored.)
  2790.  
  2791.      The `rtd' instruction is supported by the 68010 and 68020
  2792.      processors, but not by the 68000.
  2793.  
  2794. 
  2795. File: @.Distr.UsingGCC,  Node: VAX Options,  Next: SPARC Options,  Prev: M680x0 Options,  Up: Submodel Options
  2796.  
  2797. VAX Options
  2798. -----------
  2799.  
  2800.    These `-m' options are defined for the Vax:
  2801.  
  2802. `-munix'
  2803.      Do not output certain jump instructions (`aobleq' and so on) that
  2804.      the Unix assembler for the Vax cannot handle across long ranges.
  2805.  
  2806. `-mgnu'
  2807.      Do output those jump instructions, on the assumption that you will
  2808.      assemble with the GNU assembler.
  2809.  
  2810. `-mg'
  2811.      Output code for g-format floating point numbers instead of
  2812.      d-format.
  2813.  
  2814. 
  2815. File: @.Distr.UsingGCC,  Node: SPARC Options,  Next: Convex Options,  Prev: VAX Options,  Up: Submodel Options
  2816.  
  2817. SPARC Options
  2818. -------------
  2819.  
  2820.    These `-m' switches are supported on the SPARC:
  2821.  
  2822. `-mfpu'
  2823. `-mhard-float'
  2824.      Generate output containing floating point instructions.  This is
  2825.      the default.
  2826.  
  2827. `-mno-fpu'
  2828. `-msoft-float'
  2829.      Generate output containing library calls for floating point.
  2830.      *Warning:* there is no GNU floating-point library for SPARC.
  2831.      Normally the facilities of the machine's usual C compiler are
  2832.      used, but this cannot be done directly in cross-compilation.  You
  2833.      must make your own arrangements to provide suitable library
  2834.      functions for cross-compilation.
  2835.  
  2836.      `-msoft-float' changes the calling convention in the output file;
  2837.      therefore, it is only useful if you compile *all* of a program with
  2838.      this option.  In particular, you need to compile `libgcc.a', the
  2839.      library that comes with GNU CC, with `-msoft-float' in order for
  2840.      this to work.
  2841.  
  2842. `-mno-epilogue'
  2843. `-mepilogue'
  2844.      With `-mepilogue' (the default), the compiler always emits code for
  2845.      function exit at the end of each function.  Any function exit in
  2846.      the middle of the function (such as a return statement in C) will
  2847.      generate a jump to the exit code at the end of the function.
  2848.  
  2849.      With `-mno-epilogue', the compiler tries to emit exit code inline
  2850.      at every function exit.
  2851.  
  2852. `-mv8'
  2853. `-msparclite'
  2854.      These two options select variations on the SPARC architecture.
  2855.  
  2856.      By default (unless specifically configured for the Fujitsu
  2857.      SPARClite), GCC generates code for the v7 variant of the SPARC
  2858.      architecture.
  2859.  
  2860.      `-mv8' will give you SPARC v8 code.  The only difference from v7
  2861.      code is that the compiler emits the integer multiply and integer
  2862.      divide instructions which exist in SPARC v8 but not in SPARC v7.
  2863.  
  2864.      `-msparclite' will give you SPARClite code.  This adds the integer
  2865.      multiply, integer divide step and scan (`ffs') instructions which
  2866.      exist in SPARClite but not in SPARC v7.
  2867.  
  2868. 
  2869. File: @.Distr.UsingGCC,  Node: Convex Options,  Next: AMD29K Options,  Prev: SPARC Options,  Up: Submodel Options
  2870.  
  2871. Convex Options
  2872. --------------
  2873.  
  2874.    These `-m' options are defined for Convex:
  2875.  
  2876. `-mc1'
  2877.      Generate output for C1.  The code will run on any Convex machine.
  2878.      The preprocessor symbol `__convex__c1__' is defined.
  2879.  
  2880. `-mc2'
  2881.      Generate output for C2.  Uses instructions not available on C1.
  2882.      Scheduling and other optimizations are chosen for max performance
  2883.      on C2.  The preprocessor symbol `__convex_c2__' is defined.
  2884.  
  2885. `-mc32'
  2886.      Generate output for C32xx.  Uses instructions not available on C1.
  2887.      Scheduling and other optimizations are chosen for max performance
  2888.      on C32.  The preprocessor symbol `__convex_c32__' is defined.
  2889.  
  2890. `-mc34'
  2891.      Generate output for C34xx.  Uses instructions not available on C1.
  2892.      Scheduling and other optimizations are chosen for max performance
  2893.      on C34.  The preprocessor symbol `__convex_c34__' is defined.
  2894.  
  2895. `-mc38'
  2896.      Generate output for C38xx.  Uses instructions not available on C1.
  2897.      Scheduling and other optimizations are chosen for max performance
  2898.      on C38.  The preprocessor symbol `__convex_c38__' is defined.
  2899.  
  2900. `-margcount'
  2901.      Generate code which puts an argument count in the word preceding
  2902.      each argument list.  This is compatible with regular CC, and a few
  2903.      programs may need the argument count word.  GDB and other
  2904.      source-level debuggers do not need it; this info is in the symbol
  2905.      table.
  2906.  
  2907. `-mnoargcount'
  2908.      Omit the argument count word.  This is the default.
  2909.  
  2910. `-mvolatile-cache'
  2911.      Allow volatile references to be cached.  This is the default.
  2912.  
  2913. `-mvolatile-nocache'
  2914.      Volatile references bypass the data cache, going all the way to
  2915.      memory.  This is only needed for multi-processor code that does
  2916.      not use standard synchronization instructions.  Making
  2917.      non-volatile references to volatile locations will not necessarily
  2918.      work.
  2919.  
  2920. `-mlong32'
  2921.      Type long is 32 bits, the same as type int.  This is the default.
  2922.  
  2923. `-mlong64'
  2924.      Type long is 64 bits, the same as type long long.  This option is
  2925.      useless, because no library support exists for it.
  2926.  
  2927. 
  2928. File: @.Distr.UsingGCC,  Node: AMD29K Options,  Next: M88K Options,  Prev: Convex Options,  Up: Submodel Options
  2929.  
  2930. AMD29K Options
  2931. --------------
  2932.  
  2933.    These `-m' options are defined for the AMD Am29000:
  2934.  
  2935. `-mdw'
  2936.      Generate code that assumes the `DW' bit is set, i.e., that byte and
  2937.      halfword operations are directly supported by the hardware.  This
  2938.      is the default.
  2939.  
  2940. `-mnodw'
  2941.      Generate code that assumes the `DW' bit is not set.
  2942.  
  2943. `-mbw'
  2944.      Generate code that assumes the system supports byte and halfword
  2945.      write operations.  This is the default.
  2946.  
  2947. `-mnbw'
  2948.      Generate code that assumes the systems does not support byte and
  2949.      halfword write operations.  `-mnbw' implies `-mnodw'.
  2950.  
  2951. `-msmall'
  2952.      Use a small memory model that assumes that all function addresses
  2953.      are either within a single 256 KB segment or at an absolute
  2954.      address of less than 256k.  This allows the `call' instruction to
  2955.      be used instead of a `const', `consth', `calli' sequence.
  2956.  
  2957. `-mlarge'
  2958.      Do not assume that the `call' instruction can be used; this is the
  2959.      default.
  2960.  
  2961. `-m29050'
  2962.      Generate code for the Am29050.
  2963.  
  2964. `-m29000'
  2965.      Generate code for the Am29000.  This is the default.
  2966.  
  2967. `-mkernel-registers'
  2968.      Generate references to registers `gr64-gr95' instead of to
  2969.      registers `gr96-gr127'.  This option can be used when compiling
  2970.      kernel code that wants a set of global registers disjoint from
  2971.      that used by user-mode code.
  2972.  
  2973.      Note that when this option is used, register names in `-f' flags
  2974.      must use the normal, user-mode, names.
  2975.  
  2976. `-muser-registers'
  2977.      Use the normal set of global registers, `gr96-gr127'.  This is the
  2978.      default.
  2979.  
  2980. `-mstack-check'
  2981.      Insert a call to `__msp_check' after each stack adjustment.  This
  2982.      is often used for kernel code.
  2983.  
  2984. 
  2985. File: @.Distr.UsingGCC,  Node: M88K Options,  Next: RS/6000 Options,  Prev: AMD29K Options,  Up: Submodel Options
  2986.  
  2987. M88K Options
  2988. ------------
  2989.  
  2990.    These `-m' options are defined for Motorola 88k architectures:
  2991.  
  2992. `-m88000'
  2993.      Generate code that works well on both the m88100 and the m88110.
  2994.  
  2995. `-m88100'
  2996.      Generate code that works best for the m88100, but that also runs
  2997.      on the m88110.
  2998.  
  2999. `-m88110'
  3000.      Generate code that works best for the m88110, and may not run on
  3001.      the m88100.
  3002.  
  3003. `-mbig-pic'
  3004.      Obsolete option to be removed from the next revision.  Use `-fPIC'.
  3005.  
  3006. `-midentify-revision'
  3007.      Include an `ident' directive in the assembler output recording the
  3008.      source file name, compiler name and version, timestamp, and
  3009.      compilation flags used.
  3010.  
  3011. `-mno-underscores'
  3012.      In assembler output, emit symbol names without adding an underscore
  3013.      character at the beginning of each name.  The default is to use an
  3014.      underscore as prefix on each name.
  3015.  
  3016. `-mocs-debug-info'
  3017. `-mno-ocs-debug-info'
  3018.      Include (or omit) additional debugging information (about
  3019.      registers used in each stack frame) as specified in the 88open
  3020.      Object Compatibility Standard, "OCS".  This extra information
  3021.      allows debugging of code that has had the frame pointer
  3022.      eliminated.  The default for DG/UX, SVr4, and Delta 88 SVr3.2 is
  3023.      to include this information; other 88k configurations omit this
  3024.      information by default.
  3025.  
  3026. `-mocs-frame-position'
  3027.      When emitting COFF debugging information for automatic variables
  3028.      and parameters stored on the stack, use the offset from the
  3029.      canonical frame address, which is the stack pointer (register 31)
  3030.      on entry to the function.  The DG/UX, SVr4, Delta88 SVr3.2, and
  3031.      BCS configurations use `-mocs-frame-position'; other 88k
  3032.      configurations have the default `-mno-ocs-frame-position'.
  3033.  
  3034. `-mno-ocs-frame-position'
  3035.      When emitting COFF debugging information for automatic variables
  3036.      and parameters stored on the stack, use the offset from the frame
  3037.      pointer register (register 30).  When this option is in effect,
  3038.      the frame pointer is not eliminated when debugging information is
  3039.      selected by the -g switch.
  3040.  
  3041. `-moptimize-arg-area'
  3042. `-mno-optimize-arg-area'
  3043.      Control how function arguments are stored in stack frames.
  3044.      `-moptimize-arg-area' saves space by optimizing them, but this
  3045.      conflicts with the 88open specifications.  The opposite
  3046.      alternative, `-mno-optimize-arg-area', agrees with 88open
  3047.      standards.  By default GNU CC does not optimize the argument area.
  3048.  
  3049. `-mshort-data-NUM'
  3050.      Generate smaller data references by making them relative to `r0',
  3051.      which allows loading a value using a single instruction (rather
  3052.      than the usual two).  You control which data references are
  3053.      affected by specifying NUM with this option.  For example, if you
  3054.      specify `-mshort-data-512', then the data references affected are
  3055.      those involving displacements of less than 512 bytes.
  3056.      `-mshort-data-NUM' is not effective for NUM greater than 64k.
  3057.  
  3058. `-mserialize-volatile'
  3059. `-mno-serialize-volatile'
  3060.      Do, or do not, generate code to guarantee sequential consistency of
  3061.      volatile memory references.
  3062.  
  3063.      GNU CC always guarantees consistency by default, for the preferred
  3064.      processor submodel.  How this is done depends on the submodel.
  3065.  
  3066.      The m88100 processor does not reorder memory references and so
  3067.      always provides sequential consistency.  If you use `-m88100', GNU
  3068.      CC does not generate any special instructions for sequential
  3069.      consistency.
  3070.  
  3071.      The order of memory references made by the m88110 processor does
  3072.      not always match the order of the instructions requesting those
  3073.      references.  In particular, a load instruction may execute before
  3074.      a preceding store instruction.  Such reordering violates
  3075.      sequential consistency of volatile memory references, when there
  3076.      are multiple processors.  When you use `-m88000' or `-m88110', GNU
  3077.      CC generates special instructions when appropriate, to force
  3078.      execution in the proper order.
  3079.  
  3080.      The extra code generated to guarantee consistency may affect the
  3081.      performance of your application.  If you know that you can safely
  3082.      forgo this guarantee, you may use the option
  3083.      `-mno-serialize-volatile'.
  3084.  
  3085.      If you use the `-m88100' option but require sequential consistency
  3086.      when running on the m88110 processor, you should use
  3087.      `-mserialize-volatile'.
  3088.  
  3089. `-msvr4'
  3090. `-msvr3'
  3091.      Turn on (`-msvr4') or off (`-msvr3') compiler extensions related
  3092.      to System V release 4 (SVr4).  This controls the following:
  3093.  
  3094.        1. Which variant of the assembler syntax to emit (which you can
  3095.           select independently using `-mversion-03.00').
  3096.  
  3097.        2. `-msvr4' makes the C preprocessor recognize `#pragma weak'
  3098.           that is used on System V release 4.
  3099.  
  3100.        3. `-msvr4' makes GNU CC issue additional declaration directives
  3101.           used in SVr4.
  3102.  
  3103.      `-msvr3' is the default for all m88k configurations except the
  3104.      SVr4 configuration.
  3105.  
  3106. `-mversion-03.00'
  3107.      In the DG/UX configuration, there are two flavors of SVr4.  This
  3108.      option modifies `-msvr4' to select whether the hybrid-COFF or
  3109.      real-ELF flavor is used.  All other configurations ignore this
  3110.      option.
  3111.  
  3112. `-mno-check-zero-division'
  3113. `-mcheck-zero-division'
  3114.      Early models of the 88k architecture had problems with division by
  3115.      zero; in particular, many of them didn't trap.  Use these options
  3116.      to avoid including (or to include explicitly) additional code to
  3117.      detect division by zero and signal an exception.  All GNU CC
  3118.      configurations for the 88k use `-mcheck-zero-division' by default.
  3119.  
  3120. `-muse-div-instruction'
  3121.      Do not emit code to check both the divisor and dividend when doing
  3122.      signed integer division to see if either is negative, and adjust
  3123.      the signs so the divide is done using non-negative numbers.
  3124.      Instead, rely on the operating system to calculate the correct
  3125.      value when the `div' instruction traps.  This results in different
  3126.      behavior when the most negative number is divided by -1, but is
  3127.      useful when most or all signed integer divisions are done with
  3128.      positive numbers.
  3129.  
  3130. `-mtrap-large-shift'
  3131. `-mhandle-large-shift'
  3132.      Include code to detect bit-shifts of more than 31 bits;
  3133.      respectively, trap such shifts or emit code to handle them
  3134.      properly.  By default GNU CC makes no special provision for large
  3135.      bit shifts.
  3136.  
  3137. `-mwarn-passed-structs'
  3138.      Warn when a function passes a struct as an argument or result.
  3139.      Structure-passing conventions have changed during the evolution of
  3140.      the C language, and are often the source of portability problems.
  3141.      By default, GNU CC issues no such warning.
  3142.  
  3143. 
  3144. File: @.Distr.UsingGCC,  Node: RS/6000 Options,  Next: RT Options,  Prev: M88K Options,  Up: Submodel Options
  3145.  
  3146. IBM RS/6000 Options
  3147. -------------------
  3148.  
  3149.    Only one pair of `-m' options is defined for the IBM RS/6000:
  3150.  
  3151. `-mfp-in-toc'
  3152. `-mno-fp-in-toc'
  3153.      Control whether or not floating-point constants go in the Table of
  3154.      Contents (TOC), a table of all global variable and function
  3155.      addresses.  By default GNU CC puts floating-point constants there;
  3156.      if the TOC overflows, `-mno-fp-in-toc' will reduce the size of the
  3157.      TOC, which may avoid the overflow.
  3158.  
  3159. 
  3160. File: @.Distr.UsingGCC,  Node: RT Options,  Next: MIPS Options,  Prev: RS/6000 Options,  Up: Submodel Options
  3161.  
  3162. IBM RT Options
  3163. --------------
  3164.  
  3165.    These `-m' options are defined for the IBM RT PC:
  3166.  
  3167. `-min-line-mul'
  3168.      Use an in-line code sequence for integer multiplies.  This is the
  3169.      default.
  3170.  
  3171. `-mcall-lib-mul'
  3172.      Call `lmul$$' for integer multiples.
  3173.  
  3174. `-mfull-fp-blocks'
  3175.      Generate full-size floating point data blocks, including the
  3176.      minimum amount of scratch space recommended by IBM.  This is the
  3177.      default.
  3178.  
  3179. `-mminimum-fp-blocks'
  3180.      Do not include extra scratch space in floating point data blocks.
  3181.      This results in smaller code, but slower execution, since scratch
  3182.      space must be allocated dynamically.
  3183.  
  3184. `-mfp-arg-in-fpregs'
  3185.      Use a calling sequence incompatible with the IBM calling
  3186.      convention in which floating point arguments are passed in
  3187.      floating point registers.  Note that `varargs.h' and `stdargs.h'
  3188.      will not work with floating point operands if this option is
  3189.      specified.
  3190.  
  3191. `-mfp-arg-in-gregs'
  3192.      Use the normal calling convention for floating point arguments.
  3193.      This is the default.
  3194.  
  3195. `-mhc-struct-return'
  3196.      Return structures of more than one word in memory, rather than in a
  3197.      register.  This provides compatibility with the MetaWare HighC (hc)
  3198.      compiler.  Use the option `-fpcc-struct-return' for compatibility
  3199.      with the Portable C Compiler (pcc).
  3200.  
  3201. `-mnohc-struct-return'
  3202.      Return some structures of more than one word in registers, when
  3203.      convenient.  This is the default.  For compatibility with the
  3204.      IBM-supplied compilers, use the option `-fpcc-struct-return' or the
  3205.      option `-mhc-struct-return'.
  3206.  
  3207. 
  3208. File: @.Distr.UsingGCC,  Node: MIPS Options,  Next: i386 Options,  Prev: RT Options,  Up: Submodel Options
  3209.  
  3210. MIPS Options
  3211. ------------
  3212.  
  3213.    These `-m' options are defined for the MIPS family of computers:
  3214.  
  3215. `-mcpu=CPU TYPE'
  3216.      Assume the defaults for the machine type CPU TYPE when scheduling
  3217.      instructions.  The default CPU TYPE is `default', which picks the
  3218.      longest cycles times for any of the machines, in order that the
  3219.      code run at reasonable rates on all MIPS cpu's.  Other choices for
  3220.      CPU TYPE are `r2000', `r3000', `r4000', and `r6000'.  While
  3221.      picking a specific CPU TYPE will schedule things appropriately for
  3222.      that particular chip, the compiler will not generate any code that
  3223.      does not meet level 1 of the MIPS ISA (instruction set
  3224.      architecture) without the `-mips2' or `-mips3' switches being used.
  3225.  
  3226. `-mips2'
  3227.      Issue instructions from level 2 of the MIPS ISA (branch likely,
  3228.      square root instructions).  The `-mcpu=r4000' or `-mcpu=r6000'
  3229.      switch must be used in conjunction with `-mips2'.
  3230.  
  3231. `-mips3'
  3232.      Issue instructions from level 3 of the MIPS ISA (64 bit
  3233.      instructions).  You must use the `-mcpu=r4000' switch along with
  3234.      `-mips3'.
  3235.  
  3236. `-mint64'
  3237. `-mlong64'
  3238. `-mlonglong128'
  3239.      These options don't work at present.
  3240.  
  3241. `-mmips-as'
  3242.      Generate code for the MIPS assembler, and invoke `mips-tfile' to
  3243.      add normal debug information.  This is the default for all
  3244.      platforms except for the OSF/1 reference platform, using the
  3245.      OSF/rose object format.  If the either of the `-gstabs' or
  3246.      `-gstabs+' switches are used, the `mips-tfile' program will
  3247.      encapsulate the stabs within MIPS ECOFF.
  3248.  
  3249. `-mgas'
  3250.      Generate code for the GNU assembler.  This is the default on the
  3251.      OSF/1 reference platform, using the OSF/rose object format.
  3252.  
  3253. `-mrnames'
  3254. `-mno-rnames'
  3255.      The `-mrnames' switch says to output code using the MIPS software
  3256.      names for the registers, instead of the hardware names (ie, A0
  3257.      instead of $4).  The GNU assembler does not support the `-mrnames'
  3258.      switch, and the MIPS assembler will be instructed to run the MIPS
  3259.      C preprocessor over the source file.  The `-mno-rnames' switch is
  3260.      default.
  3261.  
  3262. `-mgpopt'
  3263. `-mno-gpopt'
  3264.      The `-mgpopt' switch says to write all of the data declarations
  3265.      before the instructions in the text section, this allows the MIPS
  3266.      assembler to generate one word memory references instead of using
  3267.      two words for short global or static data items.  This is on by
  3268.      default if optimization is selected.
  3269.  
  3270. `-mstats'
  3271. `-mno-stats'
  3272.      For each non-inline function processed, the `-mstats' switch
  3273.      causes the compiler to emit one line to the standard error file to
  3274.      print statistics about the program (number of registers saved,
  3275.      stack size, etc.).
  3276.  
  3277. `-mmemcpy'
  3278. `-mno-memcpy'
  3279.      The `-mmemcpy' switch makes all block moves call the appropriate
  3280.      string function (`memcpy' or `bcopy') instead of possibly
  3281.      generating inline code.
  3282.  
  3283. `-mmips-tfile'
  3284. `-mno-mips-tfile'
  3285.      The `-mno-mips-tfile' switch causes the compiler not postprocess
  3286.      the object file with the `mips-tfile' program, after the MIPS
  3287.      assembler has generated it to add debug support.  If `mips-tfile'
  3288.      is not run, then no local variables will be available to the
  3289.      debugger.  In addition, `stage2' and `stage3' objects will have
  3290.      the temporary file names passed to the assembler embedded in the
  3291.      object file, which means the objects will not compare the same.
  3292.      The `-mno-mips-tfile' switch should only be used when there are
  3293.      bugs in the `mips-tfile' program that prevents compilation.
  3294.  
  3295. `-msoft-float'
  3296.      Generate output containing library calls for floating point.
  3297.      *Warning:* the requisite libraries are not part of GNU CC.
  3298.      Normally the facilities of the machine's usual C compiler are
  3299.      used, but this can't be done directly in cross-compilation.  You
  3300.      must make your own arrangements to provide suitable library
  3301.      functions for cross-compilation.
  3302.  
  3303. `-mhard-float'
  3304.      Generate output containing floating point instructions.  This is
  3305.      the default if you use the unmodified sources.
  3306.  
  3307. `-mfp64'
  3308.      Assume that the FR bit in the status word is on, and that there
  3309.      are 32 64-bit floating point registers, instead of 32 32-bit
  3310.      floating point registers.  You must also specify the `-mcpu=r4000'
  3311.      and `-mips3' switches.
  3312.  
  3313. `-mfp32'
  3314.      Assume that there are 32 32-bit floating point registers.  This is
  3315.      the default.
  3316.  
  3317. `-mabicalls'
  3318. `-mno-abicalls'
  3319.      Emit (or do not emit) the pseudo operations `.abicalls',
  3320.      `.cpload', and `.cprestore' that some System V.4 ports use for
  3321.      position independent code.
  3322.  
  3323. `-mlong-calls'
  3324. `-mlong-calls'
  3325.      Do all calls with the `JALR' instruction, which requires loading
  3326.      up a function's address into a register before the call.  You need
  3327.      to use this switch, if you call outside of the current 512
  3328.      megabyte segment to functions that are not through pointers.
  3329.  
  3330. `-mhalf-pic'
  3331. `-mno-half-pic'
  3332.      Put pointers to extern references into the data section and load
  3333.      them up, rather than put the references in the text section.
  3334.  
  3335. `-G NUM'
  3336.      Put global and static items less than or equal to NUM bytes into
  3337.      the small data or bss sections instead of the normal data or bss
  3338.      section.  This allows the assembler to emit one word memory
  3339.      reference instructions based on the global pointer (GP or $28),
  3340.      instead of the normal two words used.  By default, NUM is 8 when
  3341.      the MIPS assembler is used, and 0 when the GNU assembler is used.
  3342.      The `-G NUM' switch is also passed to the assembler and linker.
  3343.      All modules should be compiled with the same `-G NUM' value.
  3344.  
  3345. `-nocpp'
  3346.      Tell the MIPS assembler to not run it's preprocessor over user
  3347.      assembler files (with a `.s' suffix) when assembling them.
  3348.  
  3349. 
  3350. File: @.Distr.UsingGCC,  Node: i386 Options,  Next: HPPA Options,  Prev: MIPS Options,  Up: Submodel Options
  3351.  
  3352. Intel 386 Options
  3353. -----------------
  3354.  
  3355.    These `-m' options are defined for the i386 family of computers:
  3356.  
  3357. `-m486'
  3358. `-mno-486'
  3359.      Control whether or not code is optimized for a 486 instead of an
  3360.      386.  Code generated for an 486 will run on a 386 and vice versa.
  3361.  
  3362. `-msoft-float'
  3363.      Generate output containing library calls for floating point.
  3364.      *Warning:* the requisite libraries are not part of GNU CC.
  3365.      Normally the facilities of the machine's usual C compiler are
  3366.      used, but this can't be done directly in cross-compilation.  You
  3367.      must make your own arrangements to provide suitable library
  3368.      functions for cross-compilation.
  3369.  
  3370.      On machines where a function returns floating point results in the
  3371.      80387 register stack, some floating point opcodes may be emitted
  3372.      even if `-msoft-float' is used.
  3373.  
  3374. `-mno-fp-ret-in-387'
  3375.      Do not use the FPU registers for return values of functions.
  3376.  
  3377.      The usual calling convention has functions return values of types
  3378.      `float' and `double' in an FPU register, even if there is no FPU.
  3379.      The idea is that the operating system should emulate an FPU.
  3380.  
  3381.      The option `-mno-fp-ret-in-387' causes such values to be returned
  3382.      in ordinary CPU registers instead.
  3383.  
  3384. 
  3385. File: @.Distr.UsingGCC,  Node: HPPA Options,  Next: Intel 960 Options,  Prev: i386 Options,  Up: Submodel Options
  3386.  
  3387. HPPA Options
  3388. ------------
  3389.  
  3390.    These `-m' options are defined for the HPPA family of computers:
  3391.  
  3392. `-mpa-risc-1-0'
  3393.      Generate code for a PA 1.0 processor.
  3394.  
  3395. `-mpa-risc-1-1'
  3396.      Generate code for a PA 1.1 processor.
  3397.  
  3398. `-mkernel'
  3399.      Generate code which is suitable for use in kernels.  Specifically,
  3400.      avoid `add' instructions in which one of the arguments is the DP
  3401.      register; generate `addil' instructions instead.  This avoids a
  3402.      rather serious bug in the HP-UX linker.
  3403.  
  3404. `-mshared-libs'
  3405.      Generate code that can be linked against HP-UX shared libraries.
  3406.      This option is not fully function yet, and is not on by default
  3407.      for any PA target.  Using this option can cause incorrect code to
  3408.      be generated by the compiler.
  3409.  
  3410. `-mno-shared-libs'
  3411.      Don't generate code that will be linked against shared libraries.
  3412.      This is the default for all PA targets.
  3413.  
  3414. `-mlong-calls'
  3415.      Generate code which allows calls to functions greater than 256k
  3416.      away from the caller when the caller and callee are in the same
  3417.      source file.  Do not turn this option on unless code refuses to
  3418.      link with "branch out of range errors" from the linker.
  3419.  
  3420. `-mdisable-fpregs'
  3421.      Prevent floating point registers from being used in any manner.
  3422.      This is necessary for compiling kernels which perform lazy context
  3423.      switching of floating point registers.  If you use this option and
  3424.      attempt to perform floating point operations, the compiler will
  3425.      abort.
  3426.  
  3427. `-mdisable-indexing'
  3428.      Prevent the compiler from using indexing address modes.  This
  3429.      avoids some rather obscure problems when compiling MIG generated
  3430.      code under MACH.
  3431.  
  3432. `-mtrailing-colon'
  3433.      Add a colon to the end of label definitions (for ELF assemblers).
  3434.  
  3435. 
  3436. File: @.Distr.UsingGCC,  Node: Intel 960 Options,  Next: DEC Alpha Options,  Prev: HPPA Options,  Up: Submodel Options
  3437.  
  3438. Intel 960 Options
  3439. -----------------
  3440.  
  3441.    These `-m' options are defined for the Intel 960 implementations:
  3442.  
  3443. `-mCPU TYPE'
  3444.      Assume the defaults for the machine type CPU TYPE for some of the
  3445.      other options, including instruction scheduling, floating point
  3446.      support, and addressing modes.  The choices for CPU TYPE are `ka',
  3447.      `kb', `mc', `ca', `cf', `sa', and `sb'.  The default is `kb'.
  3448.  
  3449. `-mnumerics'
  3450. `-msoft-float'
  3451.      The `-mnumerics' option indicates that the processor does support
  3452.      floating-point instructions.  The `-msoft-float' option indicates
  3453.      that floating-point support should not be assumed.
  3454.  
  3455. `-mleaf-procedures'
  3456. `-mno-leaf-procedures'
  3457.      Do (or do not) attempt to alter leaf procedures to be callable
  3458.      with the `bal' instruction as well as `call'.  This will result in
  3459.      more efficient code for explicit calls when the `bal' instruction
  3460.      can be substituted by the assembler or linker, but less efficient
  3461.      code in other cases, such as calls via function pointers, or using
  3462.      a linker that doesn't support this optimization.
  3463.  
  3464. `-mtail-call'
  3465. `-mno-tail-call'
  3466.      Do (or do not) make additional attempts (beyond those of the
  3467.      machine-independent portions of the compiler) to optimize
  3468.      tail-recursive calls into branches.  You may not want to do this
  3469.      because the detection of cases where this is not valid is not
  3470.      totally complete.  The default is `-mno-tail-call'.
  3471.  
  3472. `-mcomplex-addr'
  3473. `-mno-complex-addr'
  3474.      Assume (or do not assume) that the use of a complex addressing
  3475.      mode is a win on this implementation of the i960.  Complex
  3476.      addressing modes may not be worthwhile on the K-series, but they
  3477.      definitely are on the C-series.  The default is currently
  3478.      `-mcomplex-addr' for all processors except the CB and CC.
  3479.  
  3480. `-mcode-align'
  3481. `-mno-code-align'
  3482.      Align code to 8-byte boundaries for faster fetching (or don't
  3483.      bother).  Currently turned on by default for C-series
  3484.      implementations only.
  3485.  
  3486. `-mic-compat'
  3487. `-mic2.0-compat'
  3488. `-mic3.0-compat'
  3489.      Enable compatibility with iC960 v2.0 or v3.0.
  3490.  
  3491. `-masm-compat'
  3492. `-mintel-asm'
  3493.      Enable compatibility with the iC960 assembler.
  3494.  
  3495. `-mstrict-align'
  3496. `-mno-strict-align'
  3497.      Do not permit (do permit) unaligned accesses.
  3498.  
  3499. `-mold-align'
  3500.      Enable structure-alignment compatibility with Intel's gcc release
  3501.      version 1.3 (based on gcc 1.37).  Currently this is buggy in that
  3502.      `#pragma align 1' is always assumed as well, and cannot be turned
  3503.      off.
  3504.  
  3505. 
  3506. File: @.Distr.UsingGCC,  Node: DEC Alpha Options,  Next: System V Options,  Prev: Intel 960 Options,  Up: Submodel Options
  3507.  
  3508. DEC Alpha Options
  3509. -----------------
  3510.  
  3511.    These `-m' options are defined for the DEC Alpha implementations:
  3512.  
  3513. `-mno-soft-float'
  3514. `-msoft-float'
  3515.      Use (do not use) the hardware floating-point instructions for
  3516.      floating-point operations.  When `-msoft-float' is specified,
  3517.      functions in `libgcc1.c' will be used to perform floating-point
  3518.      operations.  Unless they are replaced by routines that emulate the
  3519.      floating-point operations, or compiled in such a way as to call
  3520.      such emulations routines, these routines will issue floating-point
  3521.      operations.   If you are compiling for an Alpha without
  3522.      floating-point operations, you must ensure that the library is
  3523.      built so as not to call them.
  3524.  
  3525.      Note that Alpha implementations without floating-point operations
  3526.      are required to have floating-point registers.
  3527.  
  3528. `-mfp-reg'
  3529. `-mno-fp-regs'
  3530.      Generate code that uses (does not use) the floating-point register
  3531.      set.  `-mno-fp-regs' implies `-msoft-float'.  If the floating-point
  3532.      register set is not used, floating point operands are passed in
  3533.      integer registers as if they were integers and floating-point
  3534.      results are passed in $0 instead of $f0.  This is a non-standard
  3535.      calling sequence, so any function with a floating-point argument
  3536.      or return value called by code compiled with `-mno-fp-regs' must
  3537.      also be compiled with that option.
  3538.  
  3539.      A typical use of this option is building a kernel that does not
  3540.      use, and hence need not save and restore, any floating-point
  3541.      registers.
  3542.  
  3543. 
  3544. File: @.Distr.UsingGCC,  Node: System V Options,  Prev: DEC Alpha Options,  Up: Submodel Options
  3545.  
  3546. Options for System V
  3547. --------------------
  3548.  
  3549.    These additional options are available on System V Release 4 for
  3550. compatibility with other compilers on those systems:
  3551.  
  3552. `-Qy'
  3553.      Identify the versions of each tool used by the compiler, in a
  3554.      `.ident' assembler directive in the output.
  3555.  
  3556. `-Qn'
  3557.      Refrain from adding `.ident' directives to the output file (this is
  3558.      the default).
  3559.  
  3560. `-YP,DIRS'
  3561.      Search the directories DIRS, and no others, for libraries
  3562.      specified with `-l'.
  3563.  
  3564. `-Ym,DIR'
  3565.      Look in the directory DIR to find the M4 preprocessor.  The
  3566.      assembler uses this option.
  3567.  
  3568. 
  3569. File: @.Distr.UsingGCC,  Node: Code Gen Options,  Next: Environment Variables,  Prev: Submodel Options,  Up: Invoking GCC
  3570.  
  3571. Options for Code Generation Conventions
  3572. =======================================
  3573.  
  3574.    These machine-independent options control the interface conventions
  3575. used in code generation.
  3576.  
  3577.    Most of them have both positive and negative forms; the negative form
  3578. of `-ffoo' would be `-fno-foo'.  In the table below, only one of the
  3579. forms is listed--the one which is not the default.  You can figure out
  3580. the other form by either removing `no-' or adding it.
  3581.  
  3582. `-fpcc-struct-return'
  3583.      Return "short" `struct' and `union' values in memory like longer
  3584.      ones, rather than in registers.  This convention is less
  3585.      efficient, but it has the advantage of allowing intercallability
  3586.      between GNU CC-compiled files and files compiled with other
  3587.      compilers.
  3588.  
  3589.      The precise convention for returning structures in memory depends
  3590.      on the target configuration macros.
  3591.  
  3592.      Short structures and unions are those whose size and alignment
  3593.      match that of some integer type.
  3594.  
  3595. `-freg-struct-return'
  3596.      Use the convention that `struct' and `union' values are returned
  3597.      in registers when possible.  This is more efficient for small
  3598.      structures than `-fpcc-struct-return'.
  3599.  
  3600.      If you specify neither `-fpcc-struct-return' nor its contrary
  3601.      `-freg-struct-return', GNU CC defaults to whichever convention is
  3602.      standard for the target.  If there is no standard convention, GNU
  3603.      CC defaults to `-fpcc-struct-return', except on targets where GNU
  3604.      CC is the principal compiler.  In those cases, we can choose the
  3605.      standard, and we chose the more efficient register return
  3606.      alternative.
  3607.  
  3608. `-fshort-enums'
  3609.      Allocate to an `enum' type only as many bytes as it needs for the
  3610.      declared range of possible values.  Specifically, the `enum' type
  3611.      will be equivalent to the smallest integer type which has enough
  3612.      room.
  3613.  
  3614. `-fshort-double'
  3615.      Use the same size for `double' as for `float'.
  3616.  
  3617. `-fshared-data'
  3618.      Requests that the data and non-`const' variables of this
  3619.      compilation be shared data rather than private data.  The
  3620.      distinction makes sense only on certain operating systems, where
  3621.      shared data is shared between processes running the same program,
  3622.      while private data exists in one copy per process.
  3623.  
  3624. `-fno-common'
  3625.      Allocate even uninitialized global variables in the bss section of
  3626.      the object file, rather than generating them as common blocks.
  3627.      This has the effect that if the same variable is declared (without
  3628.      `extern') in two different compilations, you will get an error
  3629.      when you link them.  The only reason this might be useful is if
  3630.      you wish to verify that the program will work on other systems
  3631.      which always work this way.
  3632.  
  3633. `-fno-ident'
  3634.      Ignore the `#ident' directive.
  3635.  
  3636. `-fno-gnu-linker'
  3637.      Do not output global initializations (such as C++ constructors and
  3638.      destructors) in the form used by the GNU linker (on systems where
  3639.      the GNU linker is the standard method of handling them).  Use this
  3640.      option when you want to use a non-GNU linker, which also requires
  3641.      using the `collect2' program to make sure the system linker
  3642.      includes constructors and destructors.  (`collect2' is included in
  3643.      the GNU CC distribution.)  For systems which *must* use
  3644.      `collect2', the compiler driver `gcc' is configured to do this
  3645.      automatically.
  3646.  
  3647. `-finhibit-size-directive'
  3648.      Don't output a `.size' assembler directive, or anything else that
  3649.      would cause trouble if the function is split in the middle, and the
  3650.      two halves are placed at locations far apart in memory.  This
  3651.      option is used when compiling `crtstuff.c'; you should not need to
  3652.      use it for anything else.
  3653.  
  3654. `-fverbose-asm'
  3655.      Put extra commentary information in the generated assembly code to
  3656.      make it more readable.  This option is generally only of use to
  3657.      those who actually need to read the generated assembly code
  3658.      (perhaps while debugging the compiler itself).
  3659.  
  3660. `-fvolatile'
  3661.      Consider all memory references through pointers to be volatile.
  3662.  
  3663. `-fvolatile-global'
  3664.      Consider all memory references to extern and global data items to
  3665.      be volatile.
  3666.  
  3667. `-fpic'
  3668.      Generate position-independent code (PIC) suitable for use in a
  3669.      shared library, if supported for the target machine.  Such code
  3670.      accesses all constant addresses through a global offset table
  3671.      (GOT).  If the GOT size for the linked executable exceeds a
  3672.      machine-specific maximum size, you get an error message from the
  3673.      linker indicating that `-fpic' does not work; in that case,
  3674.      recompile with `-fPIC' instead.  (These maximums are 16k on the
  3675.      m88k, 8k on the Sparc, and 32k on the m68k and RS/6000.  The 386
  3676.      has no such limit.)
  3677.  
  3678.      Position-independent code requires special support, and therefore
  3679.      works only on certain machines.  For the 386, GNU CC supports PIC
  3680.      for System V but not for the Sun 386i.  Code generated for the IBM
  3681.      RS/6000 is always position-independent.
  3682.  
  3683.      The GNU assembler does not fully support PIC.  Currently, you must
  3684.      use some other assembler in order for PIC to work.  We would
  3685.      welcome volunteers to upgrade GAS to handle this; the first part
  3686.      of the job is to figure out what the assembler must do differently.
  3687.  
  3688. `-fPIC'
  3689.      If supported for the target machine, emit position-independent
  3690.      code, suitable for dynamic linking and avoiding any limit on the
  3691.      size of the global offset table.  This option makes a difference
  3692.      on the m68k, m88k and the Sparc.
  3693.  
  3694.      Position-independent code requires special support, and therefore
  3695.      works only on certain machines.
  3696.  
  3697. `-ffixed-REG'
  3698.      Treat the register named REG as a fixed register; generated code
  3699.      should never refer to it (except perhaps as a stack pointer, frame
  3700.      pointer or in some other fixed role).
  3701.  
  3702.      REG must be the name of a register.  The register names accepted
  3703.      are machine-specific and are defined in the `REGISTER_NAMES' macro
  3704.      in the machine description macro file.
  3705.  
  3706.      This flag does not have a negative form, because it specifies a
  3707.      three-way choice.
  3708.  
  3709. `-fcall-used-REG'
  3710.      Treat the register named REG as an allocatable register that is
  3711.      clobbered by function calls.  It may be allocated for temporaries
  3712.      or variables that do not live across a call.  Functions compiled
  3713.      this way will not save and restore the register REG.
  3714.  
  3715.      Use of this flag for a register that has a fixed pervasive role in
  3716.      the machine's execution model, such as the stack pointer or frame
  3717.      pointer, will produce disastrous results.
  3718.  
  3719.      This flag does not have a negative form, because it specifies a
  3720.      three-way choice.
  3721.  
  3722. `-fcall-saved-REG'
  3723.      Treat the register named REG as an allocatable register saved by
  3724.      functions.  It may be allocated even for temporaries or variables
  3725.      that live across a call.  Functions compiled this way will save
  3726.      and restore the register REG if they use it.
  3727.  
  3728.      Use of this flag for a register that has a fixed pervasive role in
  3729.      the machine's execution model, such as the stack pointer or frame
  3730.      pointer, will produce disastrous results.
  3731.  
  3732.      A different sort of disaster will result from the use of this flag
  3733.      for a register in which function values may be returned.
  3734.  
  3735.      This flag does not have a negative form, because it specifies a
  3736.      three-way choice.
  3737.  
  3738. `+e0'
  3739. `+e1'
  3740.      Control whether virtual function definitions in classes are used to
  3741.      generate code, or only to define interfaces for their callers.
  3742.      (C++ only).
  3743.  
  3744.      These options are provided for compatibility with `cfront' 1.x
  3745.      usage; the recommended alternative GNU C++ usage is in flux.
  3746.      *Note Declarations and Definitions in One Header: C++ Interface.
  3747.  
  3748.      With `+e0', virtual function definitions in classes are declared
  3749.      `extern'; the declaration is used only as an interface
  3750.      specification, not to generate code for the virtual functions (in
  3751.      this compilation).
  3752.  
  3753.      With `+e1', G++ actually generates the code implementing virtual
  3754.      functions defined in the code, and makes them publicly visible.
  3755.  
  3756. 
  3757. File: @.Distr.UsingGCC,  Node: Environment Variables,  Next: Running Protoize,  Prev: Code Gen Options,  Up: Invoking GCC
  3758.  
  3759. Environment Variables Affecting GNU CC
  3760. ======================================
  3761.  
  3762.    This section describes several environment variables that affect how
  3763. GNU CC operates.  They work by specifying directories or prefixes to use
  3764. when searching for various kinds of files.
  3765.  
  3766.    Note that you can also specify places to search using options such as
  3767. `-B', `-I' and `-L' (*note Directory Options::.).  These take
  3768. precedence over places specified using environment variables, which in
  3769. turn take precedence over those specified by the configuration of GNU
  3770. CC.
  3771.  
  3772. `TMPDIR'
  3773.      If `TMPDIR' is set, it specifies the directory to use for temporary
  3774.      files.  GNU CC uses temporary files to hold the output of one
  3775.      stage of compilation which is to be used as input to the next
  3776.      stage: for example, the output of the preprocessor, which is the
  3777.      input to the compiler proper.
  3778.  
  3779. `GCC_EXEC_PREFIX'
  3780.      If `GCC_EXEC_PREFIX' is set, it specifies a prefix to use in the
  3781.      names of the subprograms executed by the compiler.  No slash is
  3782.      added when this prefix is combined with the name of a subprogram,
  3783.      but you can specify a prefix that ends with a slash if you wish.
  3784.  
  3785.      If GNU CC cannot find the subprogram using the specified prefix, it
  3786.      tries looking in the usual places for the subprogram.
  3787.  
  3788.      Other prefixes specified with `-B' take precedence over this
  3789.      prefix.
  3790.  
  3791.      This prefix is also used for finding files such as `crt0.o' that
  3792.      are used for linking.
  3793.  
  3794.      In addition, the prefix is used in an unusual way in finding the
  3795.      directories to search for header files.  For each of the standard
  3796.      directories whose name normally begins with
  3797.      `/usr/local/lib/gcc-lib' (more precisely, with the value of
  3798.      `GCC_INCLUDE_DIR'), GNU CC tries replacing that beginning with the
  3799.      specified prefix to produce an alternate directory name.  Thus,
  3800.      with `-Bfoo/', GNU CC will search `foo/bar' where it would
  3801.      normally search `/usr/local/lib/bar'.  These alternate directories
  3802.      are searched first; the standard directories come next.
  3803.  
  3804. `COMPILER_PATH'
  3805.      The value of `COMPILER_PATH' is a colon-separated list of
  3806.      directories, much like `PATH'.  GNU CC tries the directories thus
  3807.      specified when searching for subprograms, if it can't find the
  3808.      subprograms using `GCC_EXEC_PREFIX'.
  3809.  
  3810. `LIBRARY_PATH'
  3811.      The value of `LIBRARY_PATH' is a colon-separated list of
  3812.      directories, much like `PATH'.  GNU CC tries the directories thus
  3813.      specified when searching for special linker files, if it can't
  3814.      find them using `GCC_EXEC_PREFIX'.  Linking using GNU CC also uses
  3815.      these directories when searching for ordinary libraries for the
  3816.      `-l' option (but directories specified with `-L' come first).
  3817.  
  3818. `C_INCLUDE_PATH'
  3819. `CPLUS_INCLUDE_PATH'
  3820. `OBJC_INCLUDE_PATH'
  3821.      These environment variables pertain to particular languages.  Each
  3822.      variable's value is a colon-separated list of directories, much
  3823.      like `PATH'.  When GNU CC searches for header files, it tries the
  3824.      directories listed in the variable for the language you are using,
  3825.      after the directories specified with `-I' but before the standard
  3826.      header file directories.
  3827.  
  3828. `DEPENDENCIES_OUTPUT'
  3829.      If this variable is set, its value specifies how to output
  3830.      dependencies for Make based on the header files processed by the
  3831.      compiler.  This output looks much like the output from the `-M'
  3832.      option (*note Preprocessor Options::.), but it goes to a separate
  3833.      file, and is in addition to the usual results of compilation.
  3834.  
  3835.      The value of `DEPENDENCIES_OUTPUT' can be just a file name, in
  3836.      which case the Make rules are written to that file, guessing the
  3837.      target name from the source file name.  Or the value can have the
  3838.      form `FILE TARGET', in which case the rules are written to file
  3839.      FILE using TARGET as the target name.
  3840.  
  3841. 
  3842. File: @.Distr.UsingGCC,  Node: Running Protoize,  Prev: Environment Variables,  Up: Invoking GCC
  3843.  
  3844. Running Protoize
  3845. ================
  3846.  
  3847.    The program `protoize' is an optional part of GNU C.  You can use it
  3848. to add prototypes to a program, thus converting the program to ANSI C
  3849. in one respect.  The companion program `unprotoize' does the reverse:
  3850. it removes argument types from any prototypes that are found.
  3851.  
  3852.    When you run these programs, you must specify a set of source files
  3853. as command line arguments.  The conversion programs start out by
  3854. compiling these files to see what functions they define.  The
  3855. information gathered about a file FOO is saved in a file named `FOO.X'.
  3856.  
  3857.    After scanning comes actual conversion.  The specified files are all
  3858. eligible to be converted; any files they include (whether sources or
  3859. just headers) are eligible as well.
  3860.  
  3861.    But not all the eligible files are converted.  By default,
  3862. `protoize' and `unprotoize' convert only source and header files in the
  3863. current directory.  You can specify additional directories whose files
  3864. should be converted with the `-d DIRECTORY' option.  You can also
  3865. specify particular files to exclude with the `-x FILE' option.  A file
  3866. is converted if it is eligible, its directory name matches one of the
  3867. specified directory names, and its name within the directory has not
  3868. been excluded.
  3869.  
  3870.    Basic conversion with `protoize' consists of rewriting most function
  3871. definitions and function declarations to specify the types of the
  3872. arguments.  The only ones not rewritten are those for varargs functions.
  3873.  
  3874.    `protoize' optionally inserts prototype declarations at the
  3875. beginning of the source file, to make them available for any calls that
  3876. precede the function's definition.  Or it can insert prototype
  3877. declarations with block scope in the blocks where undeclared functions
  3878. are called.
  3879.  
  3880.    Basic conversion with `unprotoize' consists of rewriting most
  3881. function declarations to remove any argument types, and rewriting
  3882. function definitions to the old-style pre-ANSI form.
  3883.  
  3884.    Both conversion programs print a warning for any function
  3885. declaration or definition that they can't convert.  You can suppress
  3886. these warnings with `-q'.
  3887.  
  3888.    The output from `protoize' or `unprotoize' replaces the original
  3889. source file.  The original file is renamed to a name ending with
  3890. `.save'.  If the `.save' file already exists, then the source file is
  3891. simply discarded.
  3892.  
  3893.    `protoize' and `unprotoize' both depend on GNU CC itself to scan the
  3894. program and collect information about the functions it uses.  So
  3895. neither of these programs will work until GNU CC is installed.
  3896.  
  3897.    Here is a table of the options you can use with `protoize' and
  3898. `unprotoize'.  Each option works with both programs unless otherwise
  3899. stated.
  3900.  
  3901. `-B DIRECTORY'
  3902.      Look for the file `SYSCALLS.c.X' in DIRECTORY, instead of the
  3903.      usual directory (normally `/usr/local/lib').  This file contains
  3904.      prototype information about standard system functions.  This option
  3905.      applies only to `protoize'.
  3906.  
  3907. `-c COMPILATION-OPTIONS'
  3908.      Use  COMPILATION-OPTIONS as the options when running `gcc' to
  3909.      produce the `.X' files.  The special option `-aux-info' is always
  3910.      passed in addition, to tell `gcc' to write a `.X' file.
  3911.  
  3912.      Note that the compilation options must be given as a single
  3913.      argument to `protoize' or `unprotoize'.  If you want to specify
  3914.      several `gcc' options, you must quote the entire set of
  3915.      compilation options to make them a single word in the shell.
  3916.  
  3917.      There are certain `gcc' arguments that you cannot use, because they
  3918.      would produce the wrong kind of output.  These include `-g', `-O',
  3919.      `-c', `-S', and `-o' If you include these in the
  3920.      COMPILATION-OPTIONS, they are ignored.
  3921.  
  3922. `-C'
  3923.      Rename files to end in `.C' instead of `.c'.  This is convenient
  3924.      if you are converting a C program to C++.  This option applies
  3925.      only to `protoize'.
  3926.  
  3927. `-g'
  3928.      Add explicit global declarations.  This means inserting explicit
  3929.      declarations at the beginning of each source file for each function
  3930.      that is called in the file and was not declared.  These
  3931.      declarations precede the first function definition that contains a
  3932.      call to an undeclared function.  This option applies only to
  3933.      `protoize'.
  3934.  
  3935. `-i STRING'
  3936.      Indent old-style parameter declarations with the string STRING.
  3937.      This option applies only to `protoize'.
  3938.  
  3939.      `unprotoize' converts prototyped function definitions to old-style
  3940.      function definitions, where the arguments are declared between the
  3941.      argument list and the initial `{'.  By default, `unprotoize' uses
  3942.      five spaces as the indentation.  If you want to indent with just
  3943.      one space instead, use `-i " "'.
  3944.  
  3945. `-k'
  3946.      Keep the `.X' files.  Normally, they are deleted after conversion
  3947.      is finished.
  3948.  
  3949. `-l'
  3950.      Add explicit local declarations.  `protoize' with `-l' inserts a
  3951.      prototype declaration for each function in each block which calls
  3952.      the function without any declaration.  This option applies only to
  3953.      `protoize'.
  3954.  
  3955. `-n'
  3956.      Make no real changes.  This mode just prints information about the
  3957.      conversions that would have been done without `-n'.
  3958.  
  3959. `-N'
  3960.      Make no `.save' files.  The original files are simply deleted.
  3961.      Use this option with caution.
  3962.  
  3963. `-p PROGRAM'
  3964.      Use the program PROGRAM as the compiler.  Normally, the name `gcc'
  3965.      is used.
  3966.  
  3967. `-q'
  3968.      Work quietly.  Most warnings are suppressed.
  3969.  
  3970. `-v'
  3971.      Print the version number, just like `-v' for `gcc'.
  3972.  
  3973.    If you need special compiler options to compile one of your program's
  3974. source files, then you should generate that file's `.X' file specially,
  3975. by running `gcc' on that source file with the appropriate options and
  3976. the option `-aux-info'.  Then run `protoize' on the entire set of
  3977. files.  `protoize' will use the existing `.X' file because it is newer
  3978. than the source file.  For example:
  3979.  
  3980.      gcc -Dfoo=bar file1.c -aux-info
  3981.      protoize *.c
  3982.  
  3983. You need to include the special files along with the rest in the
  3984. `protoize' command, even though their `.X' files already exist, because
  3985. otherwise they won't get converted.
  3986.  
  3987.    *Note Protoize Caveats::, for more information on how to use
  3988. `protoize' successfully.
  3989.  
  3990. 
  3991. File: @.Distr.UsingGCC,  Node: Installation,  Next: C Extensions,  Prev: Invoking GCC,  Up: Top
  3992.  
  3993. Installing GNU CC
  3994. *****************
  3995.  
  3996.    Here is the procedure for installing GNU CC on a Unix system.
  3997.  
  3998. * Menu:
  3999.  
  4000. * Other Dir::     Compiling in a separate directory (not where the source is).
  4001. * Cross-Compiler::   Building and installing a cross-compiler.
  4002. * PA Install::    See below for installation on the HP Precision Architecture.
  4003. * Sun Install::   See below for installation on the Sun.
  4004. * 3b1 Install::   See below for installation on the 3b1.
  4005. * Unos Install::  See below for installation on Unos (from CRDS).
  4006. * VMS Install::   See below for installation on VMS.
  4007. * WE32K Install:: See below for installation on the 3b* aside from the 3b1.
  4008. * MIPS Install::  See below for installation on the MIPS Architecture.
  4009. * Collect2::      How `collect2' works; how it finds `ld'.
  4010. * Header Dirs::   Understanding the standard header file directories.
  4011.  
  4012.    You cannot install GNU C by itself on MSDOS; it will not compile
  4013. under any MSDOS compiler except itself.  You need to get the complete
  4014. compilation package DJGPP, which includes binaries as well as sources,
  4015. and includes all the necessary compilation tools and libraries.
  4016.  
  4017.   1. If you have built GNU CC previously in the same directory for a
  4018.      different target machine, do `make distclean' to delete all files
  4019.      that might be invalid.  One of the files this deletes is
  4020.      `Makefile'; if `make distclean' complains that `Makefile' does not
  4021.      exist, it probably means that the directory is already suitably
  4022.      clean.
  4023.  
  4024.   2. On a System V release 4 system, make sure `/usr/bin' precedes
  4025.      `/usr/ucb' in `PATH'.  The `cc' command in `/usr/ucb' uses
  4026.      libraries which have bugs.
  4027.  
  4028.   3. Specify the host and target machine configurations.  You do this by
  4029.      running the file `configure' with appropriate arguments.
  4030.  
  4031.      If you are building a compiler to produce code for the machine it
  4032.      runs on, specify just one machine type, with the `--target'
  4033.      option; the host type will default to be the same as the target.
  4034.      (For information on building a cross-compiler, see *Note
  4035.      Cross-Compiler::.)  Here is an example:
  4036.  
  4037.           configure --target=sparc-sun-sunos4.1
  4038.  
  4039.      If you run `configure' without specifying configuration arguments,
  4040.      `configure' tries to guess the type of host you are on, and uses
  4041.      that configuration type for both host and target.  So you don't
  4042.      need to specify a configuration, for building a native compiler,
  4043.      unless `configure' cannot figure out what your configuration is.
  4044.  
  4045.      A configuration name may be canonical or it may be more or less
  4046.      abbreviated.
  4047.  
  4048.      A canonical configuration name has three parts, separated by
  4049.      dashes.  It looks like this: `CPU-COMPANY-SYSTEM'.  (The three
  4050.      parts may themselves contain dashes; `configure' can figure out
  4051.      which dashes serve which purpose.)  For example,
  4052.      `m68k-sun-sunos4.1' specifies a Sun 3.
  4053.  
  4054.      You can also replace parts of the configuration by nicknames or
  4055.      aliases.  For example, `sun3' stands for `m68k-sun', so
  4056.      `sun3-sunos4.1' is another way to specify a Sun 3.  You can also
  4057.      use simply `sun3-sunos', since the version of SunOS is assumed by
  4058.      default to be version 4.  `sun3-bsd' also works, since `configure'
  4059.      knows that the only BSD variant on a Sun 3 is SunOS.
  4060.  
  4061.      You can specify a version number after any of the system types,
  4062.      and some of the CPU types.  In most cases, the version is
  4063.      irrelevant, and will be ignored.  So you might as well specify the
  4064.      version if you know it.
  4065.  
  4066.      Here are the possible CPU types:
  4067.  
  4068.           a29k, alpha, arm, cN, clipper, elxsi, h8300, hppa1.0, hppa1.1,
  4069.           i370, i386, i486, i860, i960, m68000, m68k, m88k, mips,
  4070.           ns32k, pyramid, romp, rs6000, sh, sparc, sparclite, vax,
  4071.           we32k.
  4072.  
  4073.      Here are the recognized company names.  As you can see, customary
  4074.      abbreviations are used rather than the longer official names.
  4075.  
  4076.           alliant, altos, apollo, att, bull, cbm, convergent, convex,
  4077.           crds, dec, dg, dolphin, elxsi, encore, harris, hitachi, hp,
  4078.           ibm, intergraph, isi, mips, motorola, ncr, next, ns, omron,
  4079.           plexus, sequent, sgi, sony, sun, tti, unicom.
  4080.  
  4081.      The company name is meaningful only to disambiguate when the rest
  4082.      of the information supplied is insufficient.  You can omit it,
  4083.      writing just `CPU-SYSTEM', if it is not needed.  For example,
  4084.      `vax-ultrix4.2' is equivalent to `vax-dec-ultrix4.2'.
  4085.  
  4086.      Here is a list of system types:
  4087.  
  4088.           aix, acis, aos, bsd, clix, ctix, dgux, dynix, genix, hpux,
  4089.           isc, linux, luna, lynxos, mach, minix, newsos, osf, osfrose,
  4090.           riscos, sco, solaris, sunos, sysv, ultrix, unos, vms.
  4091.  
  4092.      You can omit the system type; then `configure' guesses the
  4093.      operating system from the CPU and company.
  4094.  
  4095.      You can add a version number to the system type; this may or may
  4096.      not make a difference.  For example, you can write `bsd4.3' or
  4097.      `bsd4.4' to distinguish versions of BSD.  In practice, the version
  4098.      number is most needed for `sysv3' and `sysv4', which are often
  4099.      treated differently.
  4100.  
  4101.      If you specify an impossible combination such as `i860-dg-vms',
  4102.      then you may get an error message from `configure', or it may
  4103.      ignore part of the information and do the best it can with the
  4104.      rest.  `configure' always prints the canonical name for the
  4105.      alternative that it used.
  4106.  
  4107.      Often a particular model of machine has a name.  Many machine
  4108.      names are recognized as aliases for CPU/company combinations.
  4109.      Thus, the machine name `sun3', mentioned above, is an alias for
  4110.      `m68k-sun'.  Sometimes we accept a company name as a machine name,
  4111.      when the name is popularly used for a particular machine.  Here is
  4112.      a table of the known machine names:
  4113.  
  4114.           3300, 3b1, 3bN, 7300, altos3068, altos, apollo68, att-7300,
  4115.           balance, convex-cN, crds, decstation-3100, decstation, delta,
  4116.           encore, fx2800, gmicro, hp7NN, hp8NN, hp9k2NN, hp9k3NN,
  4117.           hp9k7NN, hp9k8NN, iris4d, iris, isi68, m3230, magnum, merlin,
  4118.           miniframe, mmax, news-3600, news800, news, next, pbd, pc532,
  4119.           pmax, ps2, risc-news, rtpc, sun2, sun386i, sun386, sun3,
  4120.           sun4, symmetry, tower-32, tower.
  4121.  
  4122.      Remember that a machine name specifies both the cpu type and the
  4123.      company name.
  4124.  
  4125.      There are four additional options you can specify independently to
  4126.      describe variant hardware and software configurations.  These are
  4127.      `--with-gnu-as', `--with-gnu-ld', `--with-stabs' and `--nfp'.
  4128.  
  4129.     `--with-gnu-as'
  4130.           If you will use GNU CC with the GNU assembler (GAS), you
  4131.           should declare this by using the `--with-gnu-as' option when
  4132.           you run `configure'.
  4133.  
  4134.           Using this option does not install GAS.  It only modifies the
  4135.           output of GNU CC to work with GAS.  Building and installing
  4136.           GAS is up to you.
  4137.  
  4138.           Conversely, if you *do not* wish to use GAS and do not specify
  4139.           `--with-gnu-as' when building GNU CC, it is up to you to make
  4140.           sure that GAS is not installed.  GNU CC searches for a
  4141.           program named `as' in various directories; if the program it
  4142.           finds is GAS, then it runs GAS.  If you are not sure where
  4143.           GNU CC finds the assembler it is using, try specifying `-v'
  4144.           when you run it.
  4145.  
  4146.           The systems where it makes a difference whether you use GAS
  4147.           are
  4148.           `hppa1.0-ANY-ANY', `hppa1.1-ANY-ANY', `i386-ANY-sysv',
  4149.           `i386-ANY-isc',
  4150.           `i860-ANY-bsd', `m68k-bull-sysv', `m68k-hp-hpux',
  4151.           `m68k-sony-bsd',
  4152.           `m68k-altos-sysv', `m68000-hp-hpux', `m68000-att-sysv', and
  4153.           `mips-ANY').  On any other system, `--with-gnu-as' has no
  4154.           effect.
  4155.  
  4156.           On the systems listed above (except for the HP-PA and for ISC
  4157.           on the 386), if you use GAS, you should also use the GNU
  4158.           linker (and specify `--with-gnu-ld').
  4159.  
  4160.     `--with-gnu-ld'
  4161.           Specify the option `--with-gnu-ld' if you plan to use the GNU
  4162.           linker with GNU CC.
  4163.  
  4164.           This option does not cause the GNU linker to be installed; it
  4165.           just modifies the behavior of GNU CC to work with the GNU
  4166.           linker.  Specifically, it inhibits the installation of
  4167.           `collect2', a program which otherwise serves as a front-end
  4168.           for the system's linker on most configurations.
  4169.  
  4170.     `--with-stabs'
  4171.           On MIPS based systems and on Alphas, you must specify whether
  4172.           you want GNU CC to create the normal ECOFF debugging format,
  4173.           or to use BSD-style stabs passed through the ECOFF symbol
  4174.           table.  The normal ECOFF debug format cannot fully handle
  4175.           languages other than C.  BSD stabs format can handle other
  4176.           languages, but it only works with the GNU debugger GDB.
  4177.  
  4178.           Normally, GNU CC uses the ECOFF debugging format by default;
  4179.           if you prefer BSD stabs, specify `--with-stabs' when you
  4180.           configure GNU CC.
  4181.  
  4182.           No matter which default you choose when you configure GNU CC,
  4183.           the user can use the `-gcoff' and `-gstabs+' options to
  4184.           specify explicitly the debug format for a particular
  4185.           compilation.
  4186.  
  4187.           `--with-stabs' is meaningful on the ISC system on the 386,
  4188.           also, if `--with-gas' is used.  It selects use of stabs
  4189.           debugging information embedded in COFF output.  This kind of
  4190.           debugging information supports C++ well; ordinary COFF
  4191.           debugging information does not.
  4192.  
  4193.     `--nfp'
  4194.           On certain systems, you must specify whether the machine has
  4195.           a floating point unit.  These systems include
  4196.           `m68k-sun-sunosN' and `m68k-isi-bsd'.  On any other system,
  4197.           `--nfp' currently has no effect, though perhaps there are
  4198.           other systems where it could usefully make a difference.
  4199.  
  4200.      If you want to install your own homemade configuration files, you
  4201.      can use `local' as the company name to access them.  If you use
  4202.      configuration `CPU-local', the configuration name without the cpu
  4203.      prefix is used to form the configuration file names.
  4204.  
  4205.      Thus, if you specify `m68k-local', configuration uses files
  4206.      `local.md', `local.h', `local.c', `xm-local.h', `t-local', and
  4207.      `x-local', all in the directory `config/m68k'.
  4208.  
  4209.      Here is a list of configurations that have special treatment or
  4210.      special things you must know:
  4211.  
  4212.     `alpha-*-osf1'
  4213.           Systems using processors that implement the DEC Alpha
  4214.           architecture and are running the OSF/1 operating system, for
  4215.           example the DEC Alpha AXP systems.  (VMS on the Alpha is not
  4216.           currently supported by GNU CC.)
  4217.  
  4218.           Objective C and C++ do not yet work on the Alpha.  We hope to
  4219.           support C++ in version 2.6.
  4220.  
  4221.           GNU CC writes a `.verstamp' directive to the assembler output
  4222.           file unless it is built as a cross-compiler.  It gets the
  4223.           version to use from the system header file
  4224.           `/usr/include/stamp.h'.  If you install a new version of
  4225.           OSF/1, you should rebuild GCC to pick up the new version
  4226.           stamp.
  4227.  
  4228.           Note that since the Alpha is a 64-bit architecture,
  4229.           cross-compilers from 32-bit machines will not generate as
  4230.           efficient code as that generated when the compiler is running
  4231.           on a 64-bit machine because many optimizations that depend on
  4232.           being able to represent a word on the target in an integral
  4233.           value on the host cannot be performed.  Building
  4234.           cross-compilers on the Alpha for 32-bit machines has only
  4235.           been tested in a few cases and may not work properly.
  4236.  
  4237.           `make compare' may fail on some versions of OSF/1 unless you
  4238.           add `-save-temps' to `CFLAGS'.  The same problem occurs on
  4239.           Irix version 5.1.1.  On these systems, the name of the
  4240.           assembler input file is stored in the object file, and that
  4241.           makes comparison fail if it differs between the `stage1' and
  4242.           `stage2' compilations.  The option `-save-temps' forces a
  4243.           fixed name to be used for the assembler input file, instead
  4244.           of a randomly chosen name in `/tmp'.
  4245.  
  4246.           GNU CC now supports both the native (ECOFF) debugging format
  4247.           used by DBX and GDB and an encapsulated STABS format for use
  4248.           only with GDB.  See the discussion of the `--with-stabs'
  4249.           option of `configure' above for more information on these
  4250.           formats and how to select them.
  4251.  
  4252.           There is a bug in DEC's assembler that produces incorrect
  4253.           line numbers for ECOFF format when the `.align' directive is
  4254.           used.  To work around this problem, GNU CC will not emit such
  4255.           alignment directives even if optimization is being performed
  4256.           if it is writing ECOFF format debugging information.
  4257.           Unfortunately, this has the very undesirable side-effect that
  4258.           code addresses when `-O' is specified are different depending
  4259.           on whether or not `-g' is also specified.
  4260.  
  4261.           To avoid this behavior, specify `-gstabs+' and use GDB
  4262.           instead of DBX.  DEC is now aware of this problem with the
  4263.           assembler and hopes to provide a fix shortly.
  4264.  
  4265.     `a29k'
  4266.           AMD Am29k-family processors.  These are normally used in
  4267.           embedded applications.  There are no standard Unix
  4268.           configurations.  This configuration corresponds to AMD's
  4269.           standard calling sequence and binary interface and is
  4270.           compatible with other 29k tools.
  4271.  
  4272.           You may need to make a variant of the file `a29k.h' for your
  4273.           particular configuration.
  4274.  
  4275.     `a29k-*-bsd'
  4276.           AMD Am29050 used in a system running a variant of BSD Unix.
  4277.  
  4278.     `elxsi-elxsi-bsd'
  4279.           The Elxsi's C compiler has known limitations that prevent it
  4280.           from compiling GNU C.  Please contact `mrs@cygnus.com' for
  4281.           more details.
  4282.  
  4283.     `hppa*-*-*'
  4284.           Using GAS is highly recommended for all HP-PA configurations.
  4285.           See *Note PA Install:: for the special procedures needed to
  4286.           compile GNU CC for the HP-PA.
  4287.  
  4288.     `i386-*-sco'
  4289.           Compilation with RCC is recommended.  Also, it may be a good
  4290.           idea to link with GNU malloc instead of the malloc that comes
  4291.           with the system.
  4292.  
  4293.     `i386-*-sco3.2.4'
  4294.           Use this configuration for SCO release 3.2 version 4.
  4295.  
  4296.     `i386-*-isc'
  4297.           It may be good idea to link with GNU malloc instead of the
  4298.           malloc that comes with the system.
  4299.  
  4300.     `i386-*-esix'
  4301.           It may be good idea to link with GNU malloc instead of the
  4302.           malloc that comes with the system.
  4303.  
  4304.     `i386-ibm-aix'
  4305.           You need to use GAS version 2.1 or later, and and LD from GNU
  4306.           binutils version 2.2 or later.
  4307.  
  4308.     `i386-sequent'
  4309.           Go to the Berkeley universe before compiling.  In addition,
  4310.           you probably need to create a file named `string.h'
  4311.           containing just one line: `#include <strings.h>'.
  4312.  
  4313.     `i386-sun-sunos4'
  4314.           You may find that you need another version of GNU CC to begin
  4315.           bootstrapping with, since the current version when built with
  4316.           the system's own compiler seems to get an infinite loop
  4317.           compiling part of `libgcc2.c'.  GNU CC version 2 compiled
  4318.           with GNU CC (any version) seems not to have this problem.
  4319.  
  4320.     `i860-intel-osf1'
  4321.           This is the Paragon.  If you have version 1.0 of the
  4322.           operating system, see *Note Installation Problems::, for
  4323.           special things you need to do to compensate for peculiarities
  4324.           in the system.
  4325.  
  4326.     `m68000-att'
  4327.           AT&T 3b1, a.k.a. 7300 PC.  Special procedures are needed to
  4328.           compile GNU CC with this machine's standard C compiler, due
  4329.           to bugs in that compiler.  *Note 3b1 Install::.  You can
  4330.           bootstrap it more easily with previous versions of GNU CC if
  4331.           you have them.
  4332.  
  4333.     `m68000-hp-bsd'
  4334.           HP 9000 series 200 running BSD.  Note that the C compiler
  4335.           that comes with this system cannot compile GNU CC; contact
  4336.           `law@cs.utah.edu' to get binaries of GNU CC for bootstrapping.
  4337.  
  4338.     `m68k-altos'
  4339.           Altos 3068.  You must use the GNU assembler, linker and
  4340.           debugger.  Also, you must fix a kernel bug.  Details in the
  4341.           file `README.ALTOS'.
  4342.  
  4343.     `m68k-bull-sysv'
  4344.           Bull DPX/2 series 200 and 300 with BOS-2.00.45 up to
  4345.           BOS-2.01. GNU CC works either with native assembler or GNU
  4346.           assembler. You can use GNU assembler with native coff
  4347.           generation by providing `--gas' to the configure script or
  4348.           use GNU assembler with dbx-in-coff encapsulation by providing
  4349.           `--gas --stabs'. For any problem with native assembler or for
  4350.           availability of the DPX/2 port of GAS, contact
  4351.           `F.Pierresteguy@frcl.bull.fr'.
  4352.  
  4353.     `m68k-hp-hpux'
  4354.           HP 9000 series 300 or 400 running HP-UX.  HP-UX version 8.0
  4355.           has a bug in the assembler that prevents compilation of GNU
  4356.           CC.  To fix it, get patch PHCO_0800 from HP.
  4357.  
  4358.           In addition, `--gas' does not currently work with this
  4359.           configuration.  Changes in HP-UX have broken the library
  4360.           conversion tool and the linker.
  4361.  
  4362.     `m68k-sun'
  4363.           Sun 3.  We do not provide a configuration file to use the Sun
  4364.           FPA by default, because programs that establish signal
  4365.           handlers for floating point traps inherently cannot work with
  4366.           the FPA.
  4367.  
  4368.     `m88k-*-svr3'
  4369.           Motorola m88k running the AT&T/Unisoft/Motorola V.3 reference
  4370.           port.  These systems tend to use the Green Hills C, revision
  4371.           1.8.5, as the standard C compiler.  There are apparently bugs
  4372.           in this compiler that result in object files differences
  4373.           between stage 2 and stage 3.  If this happens, make the stage
  4374.           4 compiler and compare it to the stage 3 compiler.  If the
  4375.           stage 3 and stage 4 object files are identical, this suggests
  4376.           you encountered a problem with the standard C compiler; the
  4377.           stage 3 and 4 compilers may be usable.
  4378.  
  4379.           It is best, however, to use an older version of GNU CC for
  4380.           bootstrapping if you have one.
  4381.  
  4382.     `m88k-*-dgux'
  4383.           Motorola m88k running DG/UX.  To build native or cross
  4384.           compilers on DG/UX, you must first change to the 88open BCS
  4385.           software development environment.  This is done by issuing
  4386.           this command:
  4387.  
  4388.                eval `sde-target m88kbcs`
  4389.  
  4390.     `m88k-tektronix-sysv3'
  4391.           Tektronix XD88 running UTekV 3.2e.  Do not turn on
  4392.           optimization while building stage1 if you bootstrap with the
  4393.           buggy Green Hills compiler.  Also, The bundled LAI System V
  4394.           NFS is buggy so if you build in an NFS mounted directory,
  4395.           start from a fresh reboot, or avoid NFS all together.
  4396.           Otherwise you may have trouble getting clean comparisons
  4397.           between stages.
  4398.  
  4399.     `mips-mips-bsd'
  4400.           MIPS machines running the MIPS operating system in BSD mode.
  4401.           It's possible that some old versions of the system lack the
  4402.           functions `memcpy', `memcmp', and `memset'.  If your system
  4403.           lacks these, you must remove or undo the definition of
  4404.           `TARGET_MEM_FUNCTIONS' in `mips-bsd.h'.
  4405.  
  4406.     `mips-sgi-*'
  4407.           Silicon Graphics MIPS machines running IRIX.  In order to
  4408.           compile GCC on an SGI the "c.hdr.lib" option must be
  4409.           installed from the CD-ROM supplied from Silicon Graphics.
  4410.           This is found on the 2nd CD in release 4.0.1.
  4411.  
  4412.     `mips-sony-sysv'
  4413.           Sony MIPS NEWS.  This works in NEWSOS 5.0.1, but not in 5.0.2
  4414.           (which uses ELF instead of COFF).  Support for 5.0.2 will
  4415.           probably be provided soon by volunteers.  In particular, the
  4416.           linker does not like the code generated by GCC when shared
  4417.           libraries are linked in.
  4418.  
  4419.     `ns32k-encore'
  4420.           Encore ns32000 system.  Encore systems are supported only
  4421.           under BSD.
  4422.  
  4423.     `ns32k-*-genix'
  4424.           National Semiconductor ns32000 system.  Genix has bugs in
  4425.           `alloca' and `malloc'; you must get the compiled versions of
  4426.           these from GNU Emacs.
  4427.  
  4428.     `ns32k-sequent'
  4429.           Go to the Berkeley universe before compiling.  In addition,
  4430.           you probably need to create a file named `string.h'
  4431.           containing just one line: `#include <strings.h>'.
  4432.  
  4433.     `ns32k-utek'
  4434.           UTEK ns32000 system ("merlin").  The C compiler that comes
  4435.           with this system cannot compile GNU CC; contact
  4436.           `tektronix!reed!mason' to get binaries of GNU CC for
  4437.           bootstrapping.
  4438.  
  4439.     `romp-*-aos'
  4440.     `romp-*-mach'
  4441.           The only operating systems supported for the IBM RT PC are
  4442.           AOS and MACH.  GNU CC does not support AIX running on the RT.
  4443.           We recommend you compile GNU CC with an earlier version of
  4444.           itself; if you compile GNU CC with `hc', the Metaware
  4445.           compiler, it will work, but you will get mismatches between
  4446.           the stage 2 and stage 3 compilers in various files.  These
  4447.           errors are minor differences in some floating-point constants
  4448.           and can be safely ignored; the stage 3 compiler is correct.
  4449.  
  4450.     `rs6000-*-aix'
  4451.           *Read the file `README.RS6000' for information on how to get
  4452.           a fix for problems in the IBM assembler that interfere with
  4453.           GNU CC.* You must either obtain the new assembler or avoid
  4454.           using the `-g' switch.  Note that `Makefile.in' uses `-g' by
  4455.           default when compiling `libgcc2.c'.
  4456.  
  4457.           The PowerPC and POWER2 architectures are now supported, but
  4458.           have not been extensively tested due to lack of appropriate
  4459.           systems.  Only AIX is supported on the PowerPC.
  4460.  
  4461.           Objective C does not work on this architecture.
  4462.  
  4463.           XLC version 1.3.0.0 will miscompile `jump.c'.  XLC version
  4464.           1.3.0.1 or later fixes this problem.  We do not yet have a
  4465.           PTF number for this fix.
  4466.  
  4467.     `vax-dec-ultrix'
  4468.           Don't try compiling with Vax C (`vcc').  It produces
  4469.           incorrect code in some cases (for example, when `alloca' is
  4470.           used).
  4471.  
  4472.           Meanwhile, compiling `cp-parse.c' with pcc does not work
  4473.           because of an internal table size limitation in that
  4474.           compiler.  To avoid this problem, compile just the GNU C
  4475.           compiler first, and use it to recompile building all the
  4476.           languages that you want to run.
  4477.  
  4478.      Here we spell out what files will be set up by `configure'.
  4479.      Normally you need not be concerned with these files.
  4480.  
  4481.         * A symbolic link named `config.h' is made to the top-level
  4482.           config file for the machine you plan to run the compiler on
  4483.           (*note The Configuration File: (gcc.info)Config.).  This file
  4484.           is responsible for defining information about the host
  4485.           machine.  It includes `tm.h'.
  4486.  
  4487.           The top-level config file is located in the subdirectory
  4488.           `config'.  Its name is always `xm-SOMETHING.h'; usually
  4489.           `xm-MACHINE.h', but there are some exceptions.
  4490.  
  4491.           If your system does not support symbolic links, you might
  4492.           want to set up `config.h' to contain a `#include' command
  4493.           which refers to the appropriate file.
  4494.  
  4495.         * A symbolic link named `tconfig.h' is made to the top-level
  4496.           config file for your target machine.  This is used for
  4497.           compiling certain programs to run on that machine.
  4498.  
  4499.         * A symbolic link named `tm.h' is made to the
  4500.           machine-description macro file for your target machine.  It
  4501.           should be in the subdirectory `config' and its name is often
  4502.           `MACHINE.h'.
  4503.  
  4504.         * A symbolic link named `md' will be made to the machine
  4505.           description pattern file.  It should be in the `config'
  4506.           subdirectory and its name should be `MACHINE.md'; but MACHINE
  4507.           is often not the same as the name used in the `tm.h' file
  4508.           because the `md' files are more general.
  4509.  
  4510.         * A symbolic link named `aux-output.c' will be made to the
  4511.           output subroutine file for your machine.  It should be in the
  4512.           `config' subdirectory and its name should be `MACHINE.c'.
  4513.  
  4514.         * The command file `configure' also constructs the file
  4515.           `Makefile' by adding some text to the template file
  4516.           `Makefile.in'.  The additional text comes from files in the
  4517.           `config' directory, named `t-TARGET' and `x-HOST'.  If these
  4518.           files do not exist, it means nothing needs to be added for a
  4519.           given target or host.
  4520.  
  4521.   4. The standard directory for installing GNU CC is `/usr/local/lib'.
  4522.      If you want to install its files somewhere else, specify
  4523.      `--prefix=DIR' when you run `configure'.  Here DIR is a directory
  4524.      name to use instead of `/usr/local' for all purposes with one
  4525.      exception: the directory `/usr/local/include' is searched for
  4526.      header files no matter where you install the compiler.
  4527.  
  4528.   5. Specify `--local-prefix=DIR' if you want the compiler to search
  4529.      directory `DIR/include' for header files *instead* of
  4530.      `/usr/local/include'.  (This is for systems that have different
  4531.      conventions for where to put site-specific things.)
  4532.  
  4533.      Unless you have a convention other than `/usr/local' for
  4534.      site-specific files, it is a bad idea to specify `--local-prefix'.
  4535.  
  4536.   6. Make sure the Bison parser generator is installed.  (This is
  4537.      unnecessary if the Bison output files `c-parse.c' and `cexp.c' are
  4538.      more recent than `c-parse.y' and `cexp.y' and you do not plan to
  4539.      change the `.y' files.)
  4540.  
  4541.      Bison versions older than Sept 8, 1988 will produce incorrect
  4542.      output for `c-parse.c'.
  4543.  
  4544.   7. If you have chosen a configuration for GNU CC which requires other
  4545.      GNU tools (such as GAS or the GNU linker) instead of the standard
  4546.      system tools, install the required tools in the build directory
  4547.      under the names `as', `ld' or whatever is appropriate.  This will
  4548.      enable the compiler to find the proper tools for compilation of
  4549.      the program `enquire'.
  4550.  
  4551.      Alternatively, you can do subsequent compilation using a value of
  4552.      the `PATH' environment variable such that the necessary GNU tools
  4553.      come before the standard system tools.
  4554.  
  4555.   8. Build the compiler.  Just type `make LANGUAGES=c' in the compiler
  4556.      directory.
  4557.  
  4558.      `LANGUAGES=c' specifies that only the C compiler should be
  4559.      compiled.  The makefile normally builds compilers for all the
  4560.      supported languages; currently, C, C++ and Objective C.  However,
  4561.      C is the only language that is sure to work when you build with
  4562.      other non-GNU C compilers.  In addition, building anything but C
  4563.      at this stage is a waste of time.
  4564.  
  4565.      In general, you can specify the languages to build by typing the
  4566.      argument `LANGUAGES="LIST"', where LIST is one or more words from
  4567.      the list `c', `c++', and `objective-c'.
  4568.  
  4569.      Ignore any warnings you may see about "statement not reached" in
  4570.      `insn-emit.c'; they are normal.  Also, warnings about "unknown
  4571.      escape sequence" are normal in `genopinit.c' and perhaps some
  4572.      other files.  Any other compilation errors may represent bugs in
  4573.      the port to your machine or operating system, and should be
  4574.      investigated and reported (*note Bugs::.).
  4575.  
  4576.      Some commercial compilers fail to compile GNU CC because they have
  4577.      bugs or limitations.  For example, the Microsoft compiler is said
  4578.      to run out of macro space.  Some Ultrix compilers run out of
  4579.      expression space; then you need to break up the statement where
  4580.      the problem happens.
  4581.  
  4582.      If you are building with a previous GNU C compiler, do not use
  4583.      `CC=gcc' on the make command or by editing the Makefile.  Instead,
  4584.      use a full pathname to specify the compiler, such as
  4585.      `CC=/usr/local/bin/gcc'.  This is because make might execute the
  4586.      `gcc' in the current directory before all of the compiler
  4587.      components have been built.
  4588.  
  4589.   9. If you are building a cross-compiler, stop here.  *Note
  4590.      Cross-Compiler::.
  4591.  
  4592.  10. Move the first-stage object files and executables into a
  4593.      subdirectory with this command:
  4594.  
  4595.           make stage1
  4596.  
  4597.      The files are moved into a subdirectory named `stage1'.  Once
  4598.      installation is complete, you may wish to delete these files with
  4599.      `rm -r stage1'.
  4600.  
  4601.  11. If you have chosen a configuration for GNU CC which requires other
  4602.      GNU tools (such as GAS or the GNU linker) instead of the standard
  4603.      system tools, install the required tools in the `stage1'
  4604.      subdirectory under the names `as', `ld' or whatever is
  4605.      appropriate.  This will enable the stage 1 compiler to find the
  4606.      proper tools in the following stage.
  4607.  
  4608.      Alternatively, you can do subsequent compilation using a value of
  4609.      the `PATH' environment variable such that the necessary GNU tools
  4610.      come before the standard system tools.
  4611.  
  4612.  12. Recompile the compiler with itself, with this command:
  4613.  
  4614.           make CC="stage1/xgcc -Bstage1/" CFLAGS="-g -O"
  4615.  
  4616.      This is called making the stage 2 compiler.
  4617.  
  4618.      The command shown above builds compilers for all the supported
  4619.      languages.  If you don't want them all, you can specify the
  4620.      languages to build by typing the argument `LANGUAGES="LIST"'.  LIST
  4621.      should contain one or more words from the list `c', `c++',
  4622.      `objective-c', and `proto'.  Separate the words with spaces.
  4623.      `proto' stands for the programs `protoize' and `unprotoize'; they
  4624.      are not a separate language, but you use `LANGUAGES' to enable or
  4625.      disable their installation.
  4626.  
  4627.      If you are going to build the stage 3 compiler, then you might
  4628.      want to build only the C language in stage 2.
  4629.  
  4630.      Once you have built the stage 2 compiler, if you are short of disk
  4631.      space, you can delete the subdirectory `stage1'.
  4632.  
  4633.      On a 68000 or 68020 system lacking floating point hardware, unless
  4634.      you have selected a `tm.h' file that expects by default that there
  4635.      is no such hardware, do this instead:
  4636.  
  4637.           make CC="stage1/xgcc -Bstage1/" CFLAGS="-g -O -msoft-float"
  4638.  
  4639.  13. If you wish to test the compiler by compiling it with itself one
  4640.      more time, install any other necessary GNU tools (such as GAS or
  4641.      the GNU linker) in the `stage2' subdirectory as you did in the
  4642.      `stage1' subdirectory, then do this:
  4643.  
  4644.           make stage2
  4645.           make CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O"
  4646.  
  4647.      This is called making the stage 3 compiler.  Aside from the `-B'
  4648.      option, the compiler options should be the same as when you made
  4649.      the stage 2 compiler.  But the `LANGUAGES' option need not be the
  4650.      same.  The command shown above builds compilers for all the
  4651.      supported languages; if you don't want them all, you can specify
  4652.      the languages to build by typing the argument `LANGUAGES="LIST"',
  4653.      as described above.
  4654.  
  4655.      Then compare the latest object files with the stage 2 object
  4656.      files--they ought to be identical, aside from time stamps (if any).
  4657.  
  4658.      On some systems, meaningful comparison of object files is
  4659.      impossible; they always appear "different."  This is currently
  4660.      true on Solaris and probably on all systems that use ELF object
  4661.      file format.  Some other systems where this is so are listed below.
  4662.  
  4663.      Use this command to compare the files:
  4664.  
  4665.           make compare
  4666.  
  4667.      This will mention any object files that differ between stage 2 and
  4668.      stage 3.  Any difference, no matter how innocuous, indicates that
  4669.      the stage 2 compiler has compiled GNU CC incorrectly, and is
  4670.      therefore a potentially serious bug which you should investigate
  4671.      and report (*note Bugs::.).
  4672.  
  4673.      If your system does not put time stamps in the object files, then
  4674.      this is a faster way to compare them (using the Bourne shell):
  4675.  
  4676.           for file in *.o; do
  4677.           cmp $file stage2/$file
  4678.           done
  4679.  
  4680.      If you have built the compiler with the `-mno-mips-tfile' option on
  4681.      MIPS machines, you will not be able to compare the files.
  4682.  
  4683.      The Alpha stores file names of internal temporary files in the
  4684.      object files and `make compare' does not know how to ignore them,
  4685.      so normally you cannot compare on the Alpha.  However, if you use
  4686.      the `-save-temps' option when compiling *both* stage 2 and stage
  4687.      3, this causes the same file names to be used in both stages; then
  4688.      you can do the comparison.
  4689.  
  4690.  14. Build the Objective C library (if you have built the Objective C
  4691.      compiler).  Here is the command to do this:
  4692.  
  4693.           make objc-runtime CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O"
  4694.  
  4695.  15. Install the compiler driver, the compiler's passes and run-time
  4696.      support with `make install'.  Use the same value for `CC',
  4697.      `CFLAGS' and `LANGUAGES' that you used when compiling the files
  4698.      that are being installed.  One reason this is necessary is that
  4699.      some versions of Make have bugs and recompile files gratuitously
  4700.      when you do this step.  If you use the same variable values, those
  4701.      files will be recompiled properly.
  4702.  
  4703.      For example, if you have built the stage 2 compiler, you can use
  4704.      the following command:
  4705.  
  4706.           make install CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O" LANGUAGES="LIST"
  4707.  
  4708.      This copies the files `cc1', `cpp' and `libgcc.a' to files `cc1',
  4709.      `cpp' and `libgcc.a' in the directory
  4710.      `/usr/local/lib/gcc-lib/TARGET/VERSION', which is where the
  4711.      compiler driver program looks for them.  Here TARGET is the target
  4712.      machine type specified when you ran `configure', and VERSION is
  4713.      the version number of GNU CC.  This naming scheme permits various
  4714.      versions and/or cross-compilers to coexist.
  4715.  
  4716.      This also copies the driver program `xgcc' into
  4717.      `/usr/local/bin/gcc', so that it appears in typical execution
  4718.      search paths.
  4719.  
  4720.      On some systems, this command causes recompilation of some files.
  4721.      This is usually due to bugs in `make'.  You should either ignore
  4722.      this problem, or use GNU Make.
  4723.  
  4724.      *Warning: there is a bug in `alloca' in the Sun library.  To avoid
  4725.      this bug, be sure to install the executables of GNU CC that were
  4726.      compiled by GNU CC.  (That is, the executables from stage 2 or 3,
  4727.      not stage 1.)  They use `alloca' as a built-in function and never
  4728.      the one in the library.*
  4729.  
  4730.      (It is usually better to install GNU CC executables from stage 2
  4731.      or 3, since they usually run faster than the ones compiled with
  4732.      some other compiler.)
  4733.  
  4734.  16. Install the Objective C library (if you are installing the
  4735.      Objective C compiler).  Here is the command to do this:
  4736.  
  4737.           make install-libobjc CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O"
  4738.  
  4739.  17. If you're going to use C++, it's likely that you need to also
  4740.      install the libg++ distribution.  It should be available from the
  4741.      same place where you got the GNU C distribution.  Just as GNU C
  4742.      does not distribute a C runtime library, it also does not include
  4743.      a C++ run-time library.  All I/O functionality, special class
  4744.      libraries, etc., are available in the libg++ distribution.
  4745.  
  4746. 
  4747. File: @.Distr.UsingGCC,  Node: Other Dir,  Next: Cross-Compiler,  Up: Installation
  4748.  
  4749. Compilation in a Separate Directory
  4750. ===================================
  4751.  
  4752.    If you wish to build the object files and executables in a directory
  4753. other than the one containing the source files, here is what you must
  4754. do differently:
  4755.  
  4756.   1. Make sure you have a version of Make that supports the `VPATH'
  4757.      feature.  (GNU Make supports it, as do Make versions on most BSD
  4758.      systems.)
  4759.  
  4760.   2. If you have ever run `configure' in the source directory, you must
  4761.      undo the configuration.  Do this by running:
  4762.  
  4763.           make distclean
  4764.  
  4765.   3. Go to the directory in which you want to build the compiler before
  4766.      running `configure':
  4767.  
  4768.           mkdir gcc-sun3
  4769.           cd gcc-sun3
  4770.  
  4771.      On systems that do not support symbolic links, this directory must
  4772.      be on the same file system as the source code directory.
  4773.  
  4774.   4. Specify where to find `configure' when you run it:
  4775.  
  4776.           ../gcc/configure ...
  4777.  
  4778.      This also tells `configure' where to find the compiler sources;
  4779.      `configure' takes the directory from the file name that was used to
  4780.      invoke it.  But if you want to be sure, you can specify the source
  4781.      directory with the `--srcdir' option, like this:
  4782.  
  4783.           ../gcc/configure --srcdir=../gcc sun3
  4784.  
  4785.      The directory you specify with `--srcdir' need not be the same as
  4786.      the one that `configure' is found in.
  4787.  
  4788.    Now, you can run `make' in that directory.  You need not repeat the
  4789. configuration steps shown above, when ordinary source files change.  You
  4790. must, however, run `configure' again when the configuration files
  4791. change, if your system does not support symbolic links.
  4792.  
  4793. 
  4794. File: @.Distr.UsingGCC,  Node: Cross-Compiler,  Next: PA Install,  Prev: Other Dir,  Up: Installation
  4795.  
  4796. Building and Installing a Cross-Compiler
  4797. ========================================
  4798.  
  4799.    GNU CC can function as a cross-compiler for many machines, but not
  4800. all.
  4801.  
  4802.    * Cross-compilers for the Mips as target using the Mips assembler
  4803.      currently do not work, because the auxiliary programs
  4804.      `mips-tdump.c' and `mips-tfile.c' can't be compiled on anything
  4805.      but a Mips.  It does work to cross compile for a Mips if you use
  4806.      the GNU assembler and linker.
  4807.  
  4808.    * Cross-compilers between machines with different floating point
  4809.      formats have not all been made to work.  GNU CC now has a floating
  4810.      point emulator with which these can work, but each target machine
  4811.      description needs to be updated to take advantage of it.
  4812.  
  4813.    * Cross-compilation between machines of different word sizes has not
  4814.      really been addressed yet.
  4815.  
  4816.    Since GNU CC generates assembler code, you probably need a
  4817. cross-assembler that GNU CC can run, in order to produce object files.
  4818. If you want to link on other than the target machine, you need a
  4819. cross-linker as well.  You also need header files and libraries suitable
  4820. for the target machine that you can install on the host machine.
  4821.  
  4822. * Menu:
  4823.  
  4824. * Steps of Cross::      Using a cross-compiler involves several steps
  4825.                           that may be carried out on different machines.
  4826. * Configure Cross::     Configuring a cross-compiler.
  4827. * Tools and Libraries:: Where to put the linker and assembler, and the C library.
  4828. * Cross Headers::       Finding and installing header files
  4829.                           for a cross-compiler.
  4830. * Cross Runtime::       Supplying arithmetic runtime routines (`libgcc1.a').
  4831. * Build Cross::         Actually compiling the cross-compiler.
  4832.  
  4833. 
  4834. File: @.Distr.UsingGCC,  Node: Steps of Cross,  Next: Configure Cross,  Up: Cross-Compiler
  4835.  
  4836. Steps of Cross-Compilation
  4837. --------------------------
  4838.  
  4839.    To compile and run a program using a cross-compiler involves several
  4840. steps:
  4841.  
  4842.    * Run the cross-compiler on the host machine to produce assembler
  4843.      files for the target machine.  This requires header files for the
  4844.      target machine.
  4845.  
  4846.    * Assemble the files produced by the cross-compiler.  You can do this
  4847.      either with an assembler on the target machine, or with a
  4848.      cross-assembler on the host machine.
  4849.  
  4850.    * Link those files to make an executable.  You can do this either
  4851.      with a linker on the target machine, or with a cross-linker on the
  4852.      host machine.  Whichever machine you use, you need libraries and
  4853.      certain startup files (typically `crt....o') for the target
  4854.      machine.
  4855.  
  4856.    It is most convenient to do all of these steps on the same host
  4857. machine, since then you can do it all with a single invocation of GNU
  4858. CC.  This requires a suitable cross-assembler and cross-linker.  For
  4859. some targets, the GNU assembler and linker are available.
  4860.  
  4861. 
  4862. File: @.Distr.UsingGCC,  Node: Configure Cross,  Next: Tools and Libraries,  Prev: Steps of Cross,  Up: Cross-Compiler
  4863.  
  4864. Configuring a Cross-Compiler
  4865. ----------------------------
  4866.  
  4867.    To build GNU CC as a cross-compiler, you start out by running
  4868. `configure'.  You must specify two different configurations, the host
  4869. and the target.  Use the `--host=HOST' option for the host and
  4870. `--target=TARGET' to specify the target type.  For example, here is how
  4871. to configure for a cross-compiler that runs on a hypothetical Intel 386
  4872. system and produces code for an HP 68030 system running BSD:
  4873.  
  4874.      configure --target=m68k-hp-bsd4.3 --host=i386-bozotheclone-bsd4.3
  4875.  
  4876. 
  4877. File: @.Distr.UsingGCC,  Node: Tools and Libraries,  Next: Cross Headers,  Prev: Configure Cross,  Up: Cross-Compiler
  4878.  
  4879. Tools and Libraries for a Cross-Compiler
  4880. ----------------------------------------
  4881.  
  4882.    If you have a cross-assembler and cross-linker available, you should
  4883. install them now.  Put them in the directory `/usr/local/TARGET/bin'.
  4884. Here is a table of the tools you should put in this directory:
  4885.  
  4886. `as'
  4887.      This should be the cross-assembler.
  4888.  
  4889. `ld'
  4890.      This should be the cross-linker.
  4891.  
  4892. `ar'
  4893.      This should be the cross-archiver: a program which can manipulate
  4894.      archive files (linker libraries) in the target machine's format.
  4895.  
  4896. `ranlib'
  4897.      This should be a program to construct a symbol table in an archive
  4898.      file.
  4899.  
  4900.    The installation of GNU CC will find these programs in that
  4901. directory, and copy or link them to the proper place to for the
  4902. cross-compiler to find them when run later.
  4903.  
  4904.    The easiest way to provide these files is to build the Binutils
  4905. package and GAS.  Configure them with the same `--host' and `--target'
  4906. options that you use for configuring GNU CC, then build and install
  4907. them.  They install their executables automatically into the proper
  4908. directory.  Alas, they do not support all the targets that GNU CC
  4909. supports.
  4910.  
  4911.    If you want to install libraries to use with the cross-compiler,
  4912. such as a standard C library, put them in the directory
  4913. `/usr/local/TARGET/lib'; installation of GNU CC copies all all the
  4914. files in that subdirectory into the proper place for GNU CC to find
  4915. them and link with them.  Here's an example of copying some libraries
  4916. from a target machine:
  4917.  
  4918.      ftp TARGET-MACHINE
  4919.      lcd /usr/local/TARGET/lib
  4920.      cd /lib
  4921.      get libc.a
  4922.      cd /usr/lib
  4923.      get libg.a
  4924.      get libm.a
  4925.      quit
  4926.  
  4927. The precise set of libraries you'll need, and their locations on the
  4928. target machine, vary depending on its operating system.
  4929.  
  4930.    Many targets require "start files" such as `crt0.o' and `crtn.o'
  4931. which are linked into each executable; these too should be placed in
  4932. `/usr/local/TARGET/lib'.  There may be several alternatives for
  4933. `crt0.o', for use with profiling or other compilation options.  Check
  4934. your target's definition of `STARTFILE_SPEC' to find out what start
  4935. files it uses.  Here's an example of copying these files from a target
  4936. machine:
  4937.  
  4938.      ftp TARGET-MACHINE
  4939.      lcd /usr/local/TARGET/lib
  4940.      prompt
  4941.      cd /lib
  4942.      mget *crt*.o
  4943.      cd /usr/lib
  4944.      mget *crt*.o
  4945.      quit
  4946.  
  4947. 
  4948. File: @.Distr.UsingGCC,  Node: Cross Runtime,  Next: Build Cross,  Prev: Cross Headers,  Up: Cross-Compiler
  4949.  
  4950. `libgcc.a' and Cross-Compilers
  4951. ------------------------------
  4952.  
  4953.    Code compiled by GNU CC uses certain runtime support functions
  4954. implicitly.  Some of these functions can be compiled successfully with
  4955. GNU CC itself, but a few cannot be.  These problem functions are in the
  4956. source file `libgcc1.c'; the library made from them is called
  4957. `libgcc1.a'.
  4958.  
  4959.    When you build a native compiler, these functions are compiled with
  4960. some other compiler-the one that you use for bootstrapping GNU CC.
  4961. Presumably it knows how to open code these operations, or else knows how
  4962. to call the run-time emulation facilities that the machine comes with.
  4963. But this approach doesn't work for building a cross-compiler.  The
  4964. compiler that you use for building knows about the host system, not the
  4965. target system.
  4966.  
  4967.    So, when you build a cross-compiler you have to supply a suitable
  4968. library `libgcc1.a' that does the job it is expected to do.
  4969.  
  4970.    To compile `libgcc1.c' with the cross-compiler itself does not work.
  4971. The functions in this file are supposed to implement arithmetic
  4972. operations that GNU CC does not know how to open code, for your target
  4973. machine.  If these functions are compiled with GNU CC itself, they will
  4974. compile into infinite recursion.
  4975.  
  4976.    On any given target, most of these functions are not needed.  If GNU
  4977. CC can open code an arithmetic operation, it will not call these
  4978. functions to perform the operation.  It is possible that on your target
  4979. machine, none of these functions is needed.  If so, you can supply an
  4980. empty library as `libgcc1.a'.
  4981.  
  4982.    Many targets need library support only for multiplication and
  4983. division.  If you are linking with a library that contains functions for
  4984. multiplication and division, you can tell GNU CC to call them directly
  4985. by defining the macros `MULSI3_LIBCALL', and the like.  These macros
  4986. need to be defined in the target description macro file.  For some
  4987. targets, they are defined already.  This may be sufficient to avoid the
  4988. need for libgcc1.a; if so, you can supply an empty library.
  4989.  
  4990.    Some targets do not have floating point instructions; they need other
  4991. functions in `libgcc1.a', which do floating arithmetic.  Recent
  4992. versions of GNU CC have a file which emulates floating point.  With a
  4993. certain amount of work, you should be able to construct a floating
  4994. point emulator that can be used as `libgcc1.a'.  Perhaps future
  4995. versions will contain code to do this automatically and conveniently.
  4996. That depends on whether someone wants to implement it.
  4997.  
  4998.    If your target system has another C compiler, you can configure GNU
  4999. CC as a native compiler on that machine, build just `libgcc1.a' with
  5000. `make libgcc1.a' on that machine, and use the resulting file with the
  5001. cross-compiler.  To do this, execute the following on the target
  5002. machine:
  5003.  
  5004.      cd TARGET-BUILD-DIR
  5005.      configure --host=sparc --target=sun3
  5006.      make libgcc1.a
  5007.  
  5008. And then this on the host machine:
  5009.  
  5010.      ftp TARGET-MACHINE
  5011.      binary
  5012.      cd TARGET-BUILD-DIR
  5013.      get libgcc1.a
  5014.      quit
  5015.  
  5016.    Another way to provide the functions you need in `libgcc1.a' is to
  5017. define the appropriate `perform_...' macros for those functions.  If
  5018. these definitions do not use the C arithmetic operators that they are
  5019. meant to implement, you should be able to compile them with the
  5020. cross-compiler you are building.  (If these definitions already exist
  5021. for your target file, then you are all set.)
  5022.  
  5023.    To build `libgcc1.a' using the perform macros, use
  5024. `LIBGCC1=libgcc1.a OLDCC=./xgcc' when building the compiler.
  5025. Otherwise, you should place your replacement library under the name
  5026. `libgcc1.a' in the directory in which you will build the
  5027. cross-compiler, before you run `make'.
  5028.  
  5029. 
  5030. File: @.Distr.UsingGCC,  Node: Cross Headers,  Next: Cross Runtime,  Prev: Tools and Libraries,  Up: Cross-Compiler
  5031.  
  5032. Cross-Compilers and Header Files
  5033. --------------------------------
  5034.  
  5035.    If you are cross-compiling a standalone program or a program for an
  5036. embedded system, then you may not need any header files except the few
  5037. that are part of GNU CC (and those of your program).  However, if you
  5038. intend to link your program with a standard C library such as `libc.a',
  5039. then you probably need to compile with the header files that go with
  5040. the library you use.
  5041.  
  5042.    The GNU C compiler does not come with these files, because (1) they
  5043. are system-specific, and (2) they belong in a C library, not in a
  5044. compiler.
  5045.  
  5046.    If the GNU C library supports your target machine, then you can get
  5047. the header files from there (assuming you actually use the GNU library
  5048. when you link your program).
  5049.  
  5050.    If your target machine comes with a C compiler, it probably comes
  5051. with suitable header files also.  If you make these files accessible
  5052. from the host machine, the cross-compiler can use them also.
  5053.  
  5054.    Otherwise, you're on your own in finding header files to use when
  5055. cross-compiling.
  5056.  
  5057.    When you have found suitable header files, put them in
  5058. `/usr/local/TARGET/include', before building the cross compiler.  Then
  5059. installation will run fixincludes properly and install the corrected
  5060. versions of the header files where the compiler will use them.
  5061.  
  5062.    Provide the header files before you build the cross-compiler, because
  5063. the build stage actually runs the cross-compiler to produce parts of
  5064. `libgcc.a'.  (These are the parts that *can* be compiled with GNU CC.)
  5065. Some of them need suitable header files.
  5066.  
  5067.    Here's an example showing how to copy the header files from a target
  5068. machine.  On the target machine, do this:
  5069.  
  5070.      (cd /usr/include; tar cf - .) > tarfile
  5071.  
  5072.    Then, on the host machine, do this:
  5073.  
  5074.      ftp TARGET-MACHINE
  5075.      lcd /usr/local/TARGET/include
  5076.      get tarfile
  5077.      quit
  5078.      tar xf tarfile
  5079.  
  5080. 
  5081. File: @.Distr.UsingGCC,  Node: Build Cross,  Prev: Cross Runtime,  Up: Cross-Compiler
  5082.  
  5083. Actually Building the Cross-Compiler
  5084. ------------------------------------
  5085.  
  5086.    Now you can proceed just as for compiling a single-machine compiler
  5087. through the step of building stage 1.  If you have not provided some
  5088. sort of `libgcc1.a', then compilation will give up at the point where
  5089. it needs that file, printing a suitable error message.  If you do
  5090. provide `libgcc1.a', then building the compiler will automatically
  5091. compile and link a test program called `cross-test'; if you get errors
  5092. in the linking, it means that not all of the necessary routines in
  5093. `libgcc1.a' are available.
  5094.  
  5095.    If you are making a cross-compiler for an embedded system, and there
  5096. is no `stdio.h' header for it, then the compilation of `enquire' will
  5097. probably fail.  The job of `enquire' is to run on the target machine
  5098. and figure out by experiment the nature of its floating point
  5099. representation.  `enquire' records its findings in the header file
  5100. `float.h'.  If you can't produce this file by running `enquire' on the
  5101. target machine, then you will need to come up with a suitable `float.h'
  5102. in some other way (or else, avoid using it in your programs).
  5103.  
  5104.    Do not try to build stage 2 for a cross-compiler.  It doesn't work to
  5105. rebuild GNU CC as a cross-compiler using the cross-compiler, because
  5106. that would produce a program that runs on the target machine, not on the
  5107. host.  For example, if you compile a 386-to-68030 cross-compiler with
  5108. itself, the result will not be right either for the 386 (because it was
  5109. compiled into 68030 code) or for the 68030 (because it was configured
  5110. for a 386 as the host).  If you want to compile GNU CC into 68030 code,
  5111. whether you compile it on a 68030 or with a cross-compiler on a 386, you
  5112. must specify a 68030 as the host when you configure it.
  5113.  
  5114.    To install the cross-compiler, use `make install', as usual.
  5115.  
  5116. 
  5117. File: @.Distr.UsingGCC,  Node: PA Install,  Next: Sun Install,  Prev: Cross-Compiler,  Up: Installation
  5118.  
  5119. Installing on the HP Precision Architecture
  5120. ===========================================
  5121.  
  5122.    There are two variants of this CPU, called 1.0 and 1.1, which have
  5123. different machine descriptions.  You must use the right one for your
  5124. machine.  All 7NN machines and 8N7 machines use 1.1, while all other
  5125. 8NN machines use 1.0.
  5126.  
  5127.    The easiest way to handle this problem is to use `configure hpNNN'
  5128. or `configure hpNNN-hpux', where NNN is the model number of the
  5129. machine.  Then `configure' will figure out if the machine is a 1.0 or
  5130. 1.1.  Use `uname -a' to find out the model number of your machine.
  5131.  
  5132.    `-g' does not work on HP-UX, since that system uses a peculiar
  5133. debugging format which GNU CC does not know about.  There are
  5134. preliminary versions of GAS and GDB for the HP-PA which do work with
  5135. GNU CC for debugging.  You can get them by anonymous ftp from
  5136. `jaguar.cs.utah.edu' `dist' subdirectory.  You would need to install
  5137. GAS in the file
  5138.  
  5139.      /usr/local/lib/gcc-lib/CONFIGURATION/GCCVERSION/as
  5140.  
  5141. where CONFIGURATION is the configuration name (perhaps `hpNNN-hpux')
  5142. and GCCVERSION is the GNU CC version number.  Do this *before* starting
  5143. the build process, otherwise you will get errors from the HPUX
  5144. assembler while building `libgcc2.a'.  The command
  5145.  
  5146.      make install-dir
  5147.  
  5148. will create the necessary directory hierarchy so you can install GAS
  5149. before building GCC.
  5150.  
  5151.    If you obtained GAS before October 6, 1992 it is highly recommended
  5152. you get a new one to avoid several bugs which have been discovered
  5153. recently.
  5154.  
  5155.    To enable debugging, configure GNU CC with the `--gas' option before
  5156. building.
  5157.  
  5158.    It has been reported that GNU CC produces invalid assembly code for
  5159. 1.1 machines running HP-UX 8.02 when using the HP assembler.  Typically
  5160. the errors look like this:
  5161.      as: bug.s @line#15 [err#1060]
  5162.        Argument 0 or 2 in FARG upper
  5163.               - lookahead = ARGW1=FR,RTNVAL=GR
  5164.      as: foo.s @line#28 [err#1060]
  5165.        Argument 0 or 2 in FARG upper
  5166.               - lookahead = ARGW1=FR
  5167.  
  5168.    You can check the version of HP-UX you are running by executing the
  5169. command `uname -r'.   If you are indeed running HP-UX 8.02 on a PA and
  5170. using the HP assembler then configure GCC with "hpNNN-hpux8.02".
  5171.  
  5172. 
  5173. File: @.Distr.UsingGCC,  Node: Sun Install,  Next: 3b1 Install,  Prev: PA Install,  Up: Installation
  5174.  
  5175. Installing GNU CC on the Sun
  5176. ============================
  5177.  
  5178.    On Solaris (version 2.1), do not use the linker or other tools in
  5179. `/usr/ucb' to build GNU CC.  Use `/usr/ccs/bin'.
  5180.  
  5181.    Make sure the environment variable `FLOAT_OPTION' is not set when
  5182. you compile `libgcc.a'.  If this option were set to `f68881' when
  5183. `libgcc.a' is compiled, the resulting code would demand to be linked
  5184. with a special startup file and would not link properly without special
  5185. pains.
  5186.  
  5187.    The GNU compiler does not really support the Super SPARC processor
  5188. that is used in SPARC Station 10 and similar class machines.  You can
  5189. get code that runs by specifying `sparc' as the cpu type; however, its
  5190. performance is not very good, and may vary widely according to the
  5191. compiler version and optimization options used.  This is because the
  5192. instruction scheduling parameters designed for the Sparc are not correct
  5193. for the Super SPARC.  Implementing scheduling parameters for the Super
  5194. SPARC might be a good project for someone who is willing to learn a
  5195. great deal about instruction scheduling in GNU CC.
  5196.  
  5197.    There is a bug in `alloca' in certain versions of the Sun library.
  5198. To avoid this bug, install the binaries of GNU CC that were compiled by
  5199. GNU CC.  They use `alloca' as a built-in function and never the one in
  5200. the library.
  5201.  
  5202.    Some versions of the Sun compiler crash when compiling GNU CC.  The
  5203. problem is a segmentation fault in cpp.  This problem seems to be due to
  5204. the bulk of data in the environment variables.  You may be able to avoid
  5205. it by using the following command to compile GNU CC with Sun CC:
  5206.  
  5207.      make CC="TERMCAP=x OBJS=x LIBFUNCS=x STAGESTUFF=x cc"
  5208.  
  5209. 
  5210. File: @.Distr.UsingGCC,  Node: 3b1 Install,  Next: Unos Install,  Prev: Sun Install,  Up: Installation
  5211.  
  5212. Installing GNU CC on the 3b1
  5213. ============================
  5214.  
  5215.    Installing GNU CC on the 3b1 is difficult if you do not already have
  5216. GNU CC running, due to bugs in the installed C compiler.  However, the
  5217. following procedure might work.  We are unable to test it.
  5218.  
  5219.   1. Comment out the `#include "config.h"' line on line 37 of `cccp.c'
  5220.      and do `make cpp'.  This makes a preliminary version of GNU cpp.
  5221.  
  5222.   2. Save the old `/lib/cpp' and copy the preliminary GNU cpp to that
  5223.      file name.
  5224.  
  5225.   3. Undo your change in `cccp.c', or reinstall the original version,
  5226.      and do `make cpp' again.
  5227.  
  5228.   4. Copy this final version of GNU cpp into `/lib/cpp'.
  5229.  
  5230.   5. Replace every occurrence of `obstack_free' in the file `tree.c'
  5231.      with `_obstack_free'.
  5232.  
  5233.   6. Run `make' to get the first-stage GNU CC.
  5234.  
  5235.   7. Reinstall the original version of `/lib/cpp'.
  5236.  
  5237.   8. Now you can compile GNU CC with itself and install it in the normal
  5238.      fashion.
  5239.  
  5240. 
  5241. File: @.Distr.UsingGCC,  Node: Unos Install,  Next: VMS Install,  Prev: 3b1 Install,  Up: Installation
  5242.  
  5243. Installing GNU CC on Unos
  5244. =========================
  5245.  
  5246.    Use `configure unos' for building on Unos.
  5247.  
  5248.    The Unos assembler is named `casm' instead of `as'.  For some
  5249. strange reason linking `/bin/as' to `/bin/casm' changes the behavior,
  5250. and does not work.  So, when installing GNU CC, you should install the
  5251. following script as `as' in the subdirectory where the passes of GCC
  5252. are installed:
  5253.  
  5254.      #!/bin/sh
  5255.      casm $*
  5256.  
  5257.    The default Unos library is named `libunos.a' instead of `libc.a'.
  5258. To allow GNU CC to function, either change all references to `-lc' in
  5259. `gcc.c' to `-lunos' or link `/lib/libc.a' to `/lib/libunos.a'.
  5260.  
  5261.    When compiling GNU CC with the standard compiler, to overcome bugs in
  5262. the support of `alloca', do not use `-O' when making stage 2.  Then use
  5263. the stage 2 compiler with `-O' to make the stage 3 compiler.  This
  5264. compiler will have the same characteristics as the usual stage 2
  5265. compiler on other systems.  Use it to make a stage 4 compiler and
  5266. compare that with stage 3 to verify proper compilation.
  5267.  
  5268.    (Perhaps simply defining `ALLOCA' in `x-crds' as described in the
  5269. comments there will make the above paragraph superfluous.  Please
  5270. inform us of whether this works.)
  5271.  
  5272.    Unos uses memory segmentation instead of demand paging, so you will
  5273. need a lot of memory.  5 Mb is barely enough if no other tasks are
  5274. running.  If linking `cc1' fails, try putting the object files into a
  5275. library and linking from that library.
  5276.  
  5277. 
  5278. File: @.Distr.UsingGCC,  Node: VMS Install,  Next: WE32K Install,  Prev: Unos Install,  Up: Installation
  5279.  
  5280. Installing GNU CC on VMS
  5281. ========================
  5282.  
  5283.    The VMS version of GNU CC is distributed in a backup saveset
  5284. containing both source code and precompiled binaries.
  5285.  
  5286.    To install the `gcc' command so you can use the compiler easily, in
  5287. the same manner as you use the VMS C compiler, you must install the VMS
  5288. CLD file for GNU CC as follows:
  5289.  
  5290.   1. Define the VMS logical names `GNU_CC' and `GNU_CC_INCLUDE' to
  5291.      point to the directories where the GNU CC executables
  5292.      (`gcc-cpp.exe', `gcc-cc1.exe', etc.) and the C include files are
  5293.      kept respectively.  This should be done with the commands:
  5294.  
  5295.           $ assign /system /translation=concealed -
  5296.             disk:[gcc.] gnu_cc
  5297.           $ assign /system /translation=concealed -
  5298.             disk:[gcc.include.] gnu_cc_include
  5299.  
  5300.      with the appropriate disk and directory names.  These commands can
  5301.      be placed in your system startup file so they will be executed
  5302.      whenever the machine is rebooted.  You may, if you choose, do this
  5303.      via the `GCC_INSTALL.COM' script in the `[GCC]' directory.
  5304.  
  5305.   2. Install the `GCC' command with the command line:
  5306.  
  5307.           $ set command /table=sys$common:[syslib]dcltables -
  5308.             /output=sys$common:[syslib]dcltables gnu_cc:[000000]gcc
  5309.           $ install replace sys$common:[syslib]dcltables
  5310.  
  5311.   3. To install the help file, do the following:
  5312.  
  5313.           $ library/help sys$library:helplib.hlb gcc.hlp
  5314.  
  5315.      Now you can invoke the compiler with a command like `gcc /verbose
  5316.      file.c', which is equivalent to the command `gcc -v -c file.c' in
  5317.      Unix.
  5318.  
  5319.    If you wish to use GNU C++ you must first install GNU CC, and then
  5320. perform the following steps:
  5321.  
  5322.   1. Define the VMS logical name `GNU_GXX_INCLUDE' to point to the
  5323.      directory where the preprocessor will search for the C++ header
  5324.      files.  This can be done with the command:
  5325.  
  5326.           $ assign /system /translation=concealed -
  5327.             disk:[gcc.gxx_include.] gnu_gxx_include
  5328.  
  5329.      with the appropriate disk and directory name.  If you are going to
  5330.      be using libg++, this is where the libg++ install procedure will
  5331.      install the libg++ header files.
  5332.  
  5333.   2. Obtain the file `gcc-cc1plus.exe', and place this in the same
  5334.      directory that `gcc-cc1.exe' is kept.
  5335.  
  5336.      The GNU C++ compiler can be invoked with a command like `gcc /plus
  5337.      /verbose file.cc', which is equivalent to the command `g++ -v -c
  5338.      file.cc' in Unix.
  5339.  
  5340.    We try to put corresponding binaries and sources on the VMS
  5341. distribution tape.  But sometimes the binaries will be from an older
  5342. version than the sources, because we don't always have time to update
  5343. them.  (Use the `/version' option to determine the version number of
  5344. the binaries and compare it with the source file `version.c' to tell
  5345. whether this is so.)  In this case, you should use the binaries you get
  5346. to recompile the sources.  If you must recompile, here is how:
  5347.  
  5348.   1. Execute the command procedure `vmsconfig.com' to set up the files
  5349.      `tm.h', `config.h', `aux-output.c', and `md.', and to create files
  5350.      `tconfig.h' and `hconfig.h'.  This procedure also creates several
  5351.      linker option files used by `make-cc1.com' and a data file used by
  5352.      `make-l2.com'.
  5353.  
  5354.           $ @vmsconfig.com
  5355.  
  5356.   2. Setup the logical names and command tables as defined above.  In
  5357.      addition, define the VMS logical name `GNU_BISON' to point at the
  5358.      to the directories where the Bison executable is kept.  This
  5359.      should be done with the command:
  5360.  
  5361.           $ assign /system /translation=concealed -
  5362.             disk:[bison.] gnu_bison
  5363.  
  5364.      You may, if you choose, use the `INSTALL_BISON.COM' script in the
  5365.      `[BISON]' directory.
  5366.  
  5367.   3. Install the `BISON' command with the command line:
  5368.  
  5369.           $ set command /table=sys$common:[syslib]dcltables -
  5370.             /output=sys$common:[syslib]dcltables -
  5371.             gnu_bison:[000000]bison
  5372.           $ install replace sys$common:[syslib]dcltables
  5373.  
  5374.   4. Type `@make-gcc' to recompile everything (alternatively, submit
  5375.      the file `make-gcc.com' to a batch queue).  If you wish to build
  5376.      the GNU C++ compiler as well as the GNU CC compiler, you must
  5377.      first edit `make-gcc.com' and follow the instructions that appear
  5378.      in the comments.
  5379.  
  5380.   5. In order to use GCC, you need a library of functions which GCC
  5381.      compiled code will call to perform certain tasks, and these
  5382.      functions are defined in the file `libgcc2.c'.  To compile this
  5383.      you should use the command procedure `make-l2.com', which will
  5384.      generate the library `libgcc2.olb'.  `libgcc2.olb' should be built
  5385.      using the compiler built from the same distribution that
  5386.      `libgcc2.c' came from, and `make-gcc.com' will automatically do
  5387.      all of this for you.
  5388.  
  5389.      To install the library, use the following commands:
  5390.  
  5391.           $ library gnu_cc:[000000]gcclib/delete=(new,eprintf)
  5392.           $ library gnu_cc:[000000]gcclib/delete=L_*
  5393.           $ library libgcc2/extract=*/output=libgcc2.obj
  5394.           $ library gnu_cc:[000000]gcclib libgcc2.obj
  5395.  
  5396.      The first command simply removes old modules that will be replaced
  5397.      with modules from `libgcc2' under different module names.  The
  5398.      modules `new' and `eprintf' may not actually be present in your
  5399.      `gcclib.olb'--if the VMS librarian complains about those modules
  5400.      not being present, simply ignore the message and continue on with
  5401.      the next command.  The second command removes the modules that
  5402.      came from the previous version of the library `libgcc2.c'.
  5403.  
  5404.      Whenever you update the compiler on your system, you should also
  5405.      update the library with the above procedure.
  5406.  
  5407.   6. You may wish to build GCC in such a way that no files are written
  5408.      to the directory where the source files reside.  An example would
  5409.      be the when the source files are on a read-only disk.  In these
  5410.      cases, execute the following DCL commands (substituting your
  5411.      actual path names):
  5412.  
  5413.           $ assign dua0:[gcc.build_dir.]/translation=concealed, -
  5414.                    dua1:[gcc.source_dir.]/translation=concealed  gcc_build
  5415.           $ set default gcc_build:[000000]
  5416.  
  5417.      where the directory `dua1:[gcc.source_dir]' contains the source
  5418.      code, and the directory `dua0:[gcc.build_dir]' is meant to contain
  5419.      all of the generated object files and executables.  Once you have
  5420.      done this, you can proceed building GCC as described above.  (Keep
  5421.      in mind that `gcc_build' is a rooted logical name, and thus the
  5422.      device names in each element of the search list must be an actual
  5423.      physical device name rather than another rooted logical name).
  5424.  
  5425.   7. *If you are building GNU CC with a previous version of GNU CC, you
  5426.      also should check to see that you have the newest version of the
  5427.      assembler*.  In particular, GNU CC version 2 treats global constant
  5428.      variables slightly differently from GNU CC version 1, and GAS
  5429.      version 1.38.1 does not have the patches required to work with GCC
  5430.      version 2.  If you use GAS 1.38.1, then `extern const' variables
  5431.      will not have the read-only bit set, and the linker will generate
  5432.      warning messages about mismatched psect attributes for these
  5433.      variables.  These warning messages are merely a nuisance, and can
  5434.      safely be ignored.
  5435.  
  5436.      If you are compiling with a version of GNU CC older than 1.33,
  5437.      specify `/DEFINE=("inline=")' as an option in all the
  5438.      compilations.  This requires editing all the `gcc' commands in
  5439.      `make-cc1.com'.  (The older versions had problems supporting
  5440.      `inline'.)  Once you have a working 1.33 or newer GNU CC, you can
  5441.      change this file back.
  5442.  
  5443.   8. If you want to build GNU CC with the VAX C compiler, you will need
  5444.      to make minor changes in `make-cccp.com' and `make-cc1.com' to
  5445.      choose alternate definitions of `CC', `CFLAGS', and `LIBS'.  See
  5446.      comments in those files.  However, you must also have a working
  5447.      version of the GNU assembler (GNU as, aka GAS) as it is used as
  5448.      the back-end for GNU CC to produce binary object modules and is
  5449.      not included in the GNU CC sources.  GAS is also needed to compile
  5450.      `libgcc2' in order to build `gcclib' (see above); `make-l2.com'
  5451.      expects to be able to find it operational in
  5452.      `gnu_cc:[000000]gnu-as.exe'.
  5453.  
  5454.      To use GNU CC on VMS, you need the VMS driver programs `gcc.exe',
  5455.      `gcc.com', and `gcc.cld'.  They are distributed with the VMS
  5456.      binaries (`gcc-vms') rather than the GNU CC sources.  GAS is also
  5457.      included in `gcc-vms', as is Bison.
  5458.  
  5459.      Once you have successfully built GNU CC with VAX C, you should use
  5460.      the resulting compiler to rebuild itself.  Before doing this, be
  5461.      sure to restore the `CC', `CFLAGS', and `LIBS' definitions in
  5462.      `make-cccp.com' and `make-cc1.com'.  The second generation
  5463.      compiler will be able to take advantage of many optimizations that
  5464.      must be suppressed when building with other compilers.
  5465.  
  5466.    Under previous versions of GNU CC, the generated code would
  5467. occasionally give strange results when linked with the sharable
  5468. `VAXCRTL' library.  Now this should work.
  5469.  
  5470.    Even with this version, however, GNU CC itself should not be linked
  5471. with the sharable `VAXCRTL'.  The version of `qsort' in `VAXCRTL' has a
  5472. bug (known to be present in VMS versions V4.6 through V5.5) which
  5473. causes the compiler to fail.
  5474.  
  5475.    The executables are generated by `make-cc1.com' and `make-cccp.com'
  5476. use the object library version of `VAXCRTL' in order to make use of the
  5477. `qsort' routine in `gcclib.olb'.  If you wish to link the compiler
  5478. executables with the shareable image version of `VAXCRTL', you should
  5479. edit the file `tm.h' (created by `vmsconfig.com') to define the macro
  5480. `QSORT_WORKAROUND'.
  5481.  
  5482.    `QSORT_WORKAROUND' is always defined when GNU CC is compiled with
  5483. VAX C, to avoid a problem in case `gcclib.olb' is not yet available.
  5484.  
  5485. 
  5486. File: @.Distr.UsingGCC,  Node: WE32K Install,  Next: MIPS Install,  Prev: VMS Install,  Up: Installation
  5487.  
  5488. Installing GNU CC on the WE32K
  5489. ==============================
  5490.  
  5491.    These computers are also known as the 3b2, 3b5, 3b20 and other
  5492. similar names.  (However, the 3b1 is actually a 68000; see *Note 3b1
  5493. Install::.)
  5494.  
  5495.    Don't use `-g' when compiling with the system's compiler.  The
  5496. system's linker seems to be unable to handle such a large program with
  5497. debugging information.
  5498.  
  5499.    The system's compiler runs out of capacity when compiling `stmt.c'
  5500. in GNU CC.  You can work around this by building `cpp' in GNU CC first,
  5501. then use that instead of the system's preprocessor with the system's C
  5502. compiler to compile `stmt.c'.  Here is how:
  5503.  
  5504.      mv /lib/cpp /lib/cpp.att
  5505.      cp cpp /lib/cpp.gnu
  5506.      echo '/lib/cpp.gnu -traditional ${1+"$@"}' > /lib/cpp
  5507.      chmod +x /lib/cpp
  5508.  
  5509.    The system's compiler produces bad code for some of the GNU CC
  5510. optimization files.  So you must build the stage 2 compiler without
  5511. optimization.  Then build a stage 3 compiler with optimization.  That
  5512. executable should work.  Here are the necessary commands:
  5513.  
  5514.      make LANGUAGES=c CC=stage1/xgcc CFLAGS="-Bstage1/ -g"
  5515.      make stage2
  5516.      make CC=stage2/xgcc CFLAGS="-Bstage2/ -g -O"
  5517.  
  5518.    You may need to raise the ULIMIT setting to build a C++ compiler, as
  5519. the file `cc1plus' is larger than one megabyte.
  5520.  
  5521. 
  5522. File: @.Distr.UsingGCC,  Node: MIPS Install,  Next: Collect2,  Prev: WE32K Install,  Up: Installation
  5523.  
  5524. Installing GNU CC on the MIPS
  5525. =============================
  5526.  
  5527.    See *Note Installation:: about whether to use either of the options
  5528. `--with-stabs' or `--with-gnu-as'.
  5529.  
  5530.    The MIPS C compiler needs to be told to increase its table size for
  5531. switch statements with the `-Wf,-XNg1500' option in order to compile
  5532. `cp-parse.c'.  If you use the `-O2' optimization option, you also need
  5533. to use `-Olimit 3000'.  Both of these options are automatically
  5534. generated in the `Makefile' that the shell script `configure' builds.
  5535. If you override the `CC' make variable and use the MIPS compilers, you
  5536. may need to add `-Wf,-XNg1500 -Olimit 3000'.
  5537.  
  5538.    MIPS computers running RISC-OS can support four different
  5539. personalities: default, BSD 4.3, System V.3, and System V.4 (older
  5540. versions of RISC-OS don't support V.4).  To configure GCC for these
  5541. platforms use the following configurations:
  5542.  
  5543. `mips-mips-riscos`rev''
  5544.      Default configuration for RISC-OS, revision `rev'.
  5545.  
  5546. `mips-mips-riscos`rev'bsd'
  5547.      BSD 4.3 configuration for RISC-OS, revision `rev'.
  5548.  
  5549. `mips-mips-riscos`rev'sysv4'
  5550.      System V.4 configuration for RISC-OS, revision `rev'.
  5551.  
  5552. `mips-mips-riscos`rev'sysv'
  5553.      System V.3 configuration for RISC-OS, revision `rev'.
  5554.  
  5555.    The revision `rev' mentioned above is the revision of RISC-OS to
  5556. use.  You must reconfigure GCC when going from a RISC-OS revision 4 to
  5557. RISC-OS revision 5.  This has the effect of avoiding a linker bug (see
  5558. *Note Installation Problems:: for more details).
  5559.  
  5560.    DECstations can support three different personalities: Ultrix, DEC
  5561. OSF/1, and OSF/rose.  To configure GCC for these platforms use the
  5562. following configurations:
  5563.  
  5564. `decstation-ultrix'
  5565.      Ultrix configuration.
  5566.  
  5567. `decstation-osf1'
  5568.      Dec's version of OSF/1.
  5569.  
  5570. `decstation-osfrose'
  5571.      Open Software Foundation reference port of OSF/1 which uses the
  5572.      OSF/rose object file format instead of ECOFF.  Normally, you would
  5573.      not select this configuration.
  5574.  
  5575.    On Irix version 4.0.5F, and perhaps on some other versions as well,
  5576. there is an assembler bug that reorders instructions incorrectly.  To
  5577. work around it, specify the target configuration `mips-sgi-irix4loser'.
  5578. This configuration inhibits assembler optimization.
  5579.  
  5580.    You can turn off assembler optimization in a compiler configured with
  5581. target `mips-sgi-irix4' using the `-noasmopt' option.  This compiler
  5582. option passes the option `-O0' to the assembler, to inhibit reordering.
  5583.  
  5584.    The `-noasmopt' option can be useful for testing whether a problem
  5585. is due to erroneous assembler reordering.  Even if a problem does not go
  5586. away with `-noasmopt', it may still be due to assembler
  5587. reordering--perhaps GNU CC itself was miscompiled as a result.
  5588.  
  5589.    We know this is inconvenient, but it's the best that can be done at
  5590. the last minute.
  5591.  
  5592. 
  5593. File: @.Distr.UsingGCC,  Node: Collect2,  Next: Header Dirs,  Prev: MIPS Install,  Up: Installation
  5594.  
  5595. `collect2'
  5596. ==========
  5597.  
  5598.    Many target systems do not have support in the assembler and linker
  5599. for "constructors"--initialization functions to be called before the
  5600. official "start" of `main'.  On such systems, GNU CC uses a utility
  5601. called `collect2' to arrange to call these functions at start time.
  5602.  
  5603.    The program `collect2' works by linking the program once and looking
  5604. through the linker output file for symbols with particular names
  5605. indicating they are constructor functions.  If it finds any, it creates
  5606. a new temporary `.c' file containing a table of them, compiles it, and
  5607. links the program a second time including that file.
  5608.  
  5609.    The actual calls to the constructors are carried out by a subroutine
  5610. called `__main', which is called (automatically) at the beginning of
  5611. the body of `main' (provided `main' was compiled with GNU CC).
  5612.  
  5613.    The program `collect2' is installed as `ld' in the directory where
  5614. the passes of the compiler are installed.  When `collect2' needs to
  5615. find the *real* `ld', it tries the following file names:
  5616.  
  5617.    * `gld' in the directories listed in the compiler's search
  5618.      directories.
  5619.  
  5620.    * `gld' in the directories listed in the environment variable `PATH'.
  5621.  
  5622.    * `real-ld' in the compiler's search directories.
  5623.  
  5624.    * `real-ld' in `PATH'.
  5625.  
  5626.    * `ld' in `PATH'.
  5627.  
  5628.    "The compiler's search directories" means all the directories where
  5629. `gcc' searches for passes of the compiler.  This includes directories
  5630. that you specify with `-B'.
  5631.  
  5632.    Cross-compilers search a little differently:
  5633.  
  5634.    * `gld' in the compiler's search directories.
  5635.  
  5636.    * `TARGET-gld' in `PATH'.
  5637.  
  5638.    * `real-ld' in the compiler's search directories.
  5639.  
  5640.    * `TARGET-real-ld' in `PATH'.
  5641.  
  5642.    * `TARGET-ld' in `PATH'.
  5643.  
  5644.    `collect2' does not search for `ld' using the compiler's search
  5645. directories, because if it did, it would find itself--not the real
  5646. `ld'--and this could lead to infinite recursion.  However, the
  5647. directory where `collect2' is installed might happen to be in `PATH'.
  5648. That could lead `collect2' to invoke itself anyway.  when looking for
  5649. `ld'.
  5650.  
  5651.    To prevent this, `collect2' explicitly avoids running `ld' using the
  5652. file name under which `collect2' itself was invoked.  In fact, it
  5653. remembers up to two such names--in case one copy of `collect2' finds
  5654. another copy (or version) of `collect2' installed as `ld' in a second
  5655. place in the search path.
  5656.  
  5657.    If two file names to avoid are not sufficient, you may still
  5658. encounter an infinite recursion of `collect2' processes.  When this
  5659. happens.  check all the files installed as `ld' in any of the
  5660. directories searched, and straighten out the situation.
  5661.  
  5662.    (In a future version, we will probably change `collect2' to avoid
  5663. any reinvocation of a file from which any parent `collect2' was run.)
  5664.  
  5665. 
  5666. File: @.Distr.UsingGCC,  Node: Header Dirs,  Prev: Collect2,  Up: Installation
  5667.  
  5668. Standard Header File Directories
  5669. ================================
  5670.  
  5671.    `GCC_INCLUDE_DIR' means the same thing for native and cross.  It is
  5672. where GNU CC stores its private include files, and also where GNU CC
  5673. stores the fixed include files.  A cross compiled GNU CC runs
  5674. `fixincludes' on the header files in `$(tooldir)/include'.  (If the
  5675. cross compilation header files need to be fixed, they must be installed
  5676. before GNU CC is built.  If the cross compilation header files are
  5677. already suitable for ANSI C and GNU CC, nothing special need be done).
  5678.  
  5679.    `GPLUS_INCLUDE_DIR' means the same thing for native and cross.  It
  5680. is where `g++' looks first for header files.  `libg++' installs only
  5681. target independent header files in that directory.
  5682.  
  5683.    `LOCAL_INCLUDE_DIR' is used only for a native compiler.  It is
  5684. normally `/usr/local/include'.  GNU CC searches this directory so that
  5685. users can install header files in `/usr/local/include'.
  5686.  
  5687.    `CROSS_INCLUDE_DIR' is used only for a cross compiler.  GNU CC
  5688. doesn't install anything there.
  5689.  
  5690.    `TOOL_INCLUDE_DIR' is used for both native and cross compilers.  It
  5691. is the place for other packages to install header files that GNU CC will
  5692. use.  For a cross-compiler, this is the equivalent of `/usr/include'.
  5693. When you build a cross-compiler, `fixincludes' processes any header
  5694. files in this directory.
  5695.  
  5696. 
  5697. File: @.Distr.UsingGCC,  Node: C Extensions,  Next: C++ Extensions,  Prev: Installation,  Up: Top
  5698.  
  5699. Extensions to the C Language Family
  5700. ***********************************
  5701.  
  5702.    GNU C provides several language features not found in ANSI standard
  5703. C.  (The `-pedantic' option directs GNU CC to print a warning message if
  5704. any of these features is used.)  To test for the availability of these
  5705. features in conditional compilation, check for a predefined macro
  5706. `__GNUC__', which is always defined under GNU CC.
  5707.  
  5708.    These extensions are available in C and in the languages derived from
  5709. it, C++ and Objective C.  *Note Extensions to the C++ Language: C++
  5710. Extensions, for extensions that apply *only* to C++.
  5711.  
  5712. * Menu:
  5713.  
  5714. * Statement Exprs::     Putting statements and declarations inside expressions.
  5715. * Local Labels::        Labels local to a statement-expression.
  5716. * Labels as Values::    Getting pointers to labels, and computed gotos.
  5717. * Nested Functions::    As in Algol and Pascal, lexical scoping of functions.
  5718. * Constructing Calls::    Dispatching a call to another function.
  5719. * Naming Types::        Giving a name to the type of some expression.
  5720. * Typeof::              `typeof': referring to the type of an expression.
  5721. * Lvalues::             Using `?:', `,' and casts in lvalues.
  5722. * Conditionals::        Omitting the middle operand of a `?:' expression.
  5723. * Long Long::        Double-word integers--`long long int'.
  5724. * Zero Length::         Zero-length arrays.
  5725. * Variable Length::     Arrays whose length is computed at run time.
  5726. * Macro Varargs::    Macros with variable number of arguments.
  5727. * Subscripting::        Any array can be subscripted, even if not an lvalue.
  5728. * Pointer Arith::       Arithmetic on `void'-pointers and function pointers.
  5729. * Initializers::        Non-constant initializers.
  5730. * Constructors::        Constructor expressions give structures, unions
  5731.                          or arrays as values.
  5732. * Labeled Elements::    Labeling elements of initializers.
  5733. * Cast to Union::       Casting to union type from any member of the union.
  5734. * Case Ranges::        `case 1 ... 9' and such.
  5735. * Function Attributes:: Declaring that functions have no side effects,
  5736.                          or that they can never return.
  5737. * Function Prototypes:: Prototype declarations and old-style definitions.
  5738. * Dollar Signs::        Dollar sign is allowed in identifiers.
  5739. * Character Escapes::   `\e' stands for the character ESC.
  5740. * Variable Attributes::    Specifying attributes of variables.
  5741. * Alignment::           Inquiring about the alignment of a type or variable.
  5742. * Inline::              Defining inline functions (as fast as macros).
  5743. * Extended Asm::        Assembler instructions with C expressions as operands.
  5744.                          (With them you can define "built-in" functions.)
  5745. * Constraints::         Constraints for asm operands
  5746. * Asm Labels::          Specifying the assembler name to use for a C symbol.
  5747. * Explicit Reg Vars::   Defining variables residing in specified registers.
  5748. * Alternate Keywords::  `__const__', `__asm__', etc., for header files.
  5749. * Incomplete Enums::    `enum foo;', with details to follow.
  5750. * Function Names::    Printable strings which are the name of the current
  5751.              function.
  5752.  
  5753. 
  5754. File: @.Distr.UsingGCC,  Node: Statement Exprs,  Next: Local Labels,  Up: C Extensions
  5755.  
  5756. Statements and Declarations in Expressions
  5757. ==========================================
  5758.  
  5759.    A compound statement enclosed in parentheses may appear as an
  5760. expression in GNU C.  This allows you to use loops, switches, and local
  5761. variables within an expression.
  5762.  
  5763.    Recall that a compound statement is a sequence of statements
  5764. surrounded by braces; in this construct, parentheses go around the
  5765. braces.  For example:
  5766.  
  5767.      ({ int y = foo (); int z;
  5768.         if (y > 0) z = y;
  5769.         else z = - y;
  5770.         z; })
  5771.  
  5772. is a valid (though slightly more complex than necessary) expression for
  5773. the absolute value of `foo ()'.
  5774.  
  5775.    The last thing in the compound statement should be an expression
  5776. followed by a semicolon; the value of this subexpression serves as the
  5777. value of the entire construct.  (If you use some other kind of statement
  5778. last within the braces, the construct has type `void', and thus
  5779. effectively no value.)
  5780.  
  5781.    This feature is especially useful in making macro definitions "safe"
  5782. (so that they evaluate each operand exactly once).  For example, the
  5783. "maximum" function is commonly defined as a macro in standard C as
  5784. follows:
  5785.  
  5786.      #define max(a,b) ((a) > (b) ? (a) : (b))
  5787.  
  5788. But this definition computes either A or B twice, with bad results if
  5789. the operand has side effects.  In GNU C, if you know the type of the
  5790. operands (here let's assume `int'), you can define the macro safely as
  5791. follows:
  5792.  
  5793.      #define maxint(a,b) \
  5794.        ({int _a = (a), _b = (b); _a > _b ? _a : _b; })
  5795.  
  5796.    Embedded statements are not allowed in constant expressions, such as
  5797. the value of an enumeration constant, the width of a bit field, or the
  5798. initial value of a static variable.
  5799.  
  5800.    If you don't know the type of the operand, you can still do this,
  5801. but you must use `typeof' (*note Typeof::.) or type naming (*note
  5802. Naming Types::.).
  5803.  
  5804. 
  5805. File: @.Distr.UsingGCC,  Node: Local Labels,  Next: Labels as Values,  Prev: Statement Exprs,  Up: C Extensions
  5806.  
  5807. Locally Declared Labels
  5808. =======================
  5809.  
  5810.    Each statement expression is a scope in which "local labels" can be
  5811. declared.  A local label is simply an identifier; you can jump to it
  5812. with an ordinary `goto' statement, but only from within the statement
  5813. expression it belongs to.
  5814.  
  5815.    A local label declaration looks like this:
  5816.  
  5817.      __label__ LABEL;
  5818.  
  5819. or
  5820.  
  5821.      __label__ LABEL1, LABEL2, ...;
  5822.  
  5823.    Local label declarations must come at the beginning of the statement
  5824. expression, right after the `({', before any ordinary declarations.
  5825.  
  5826.    The label declaration defines the label *name*, but does not define
  5827. the label itself.  You must do this in the usual way, with `LABEL:',
  5828. within the statements of the statement expression.
  5829.  
  5830.    The local label feature is useful because statement expressions are
  5831. often used in macros.  If the macro contains nested loops, a `goto' can
  5832. be useful for breaking out of them.  However, an ordinary label whose
  5833. scope is the whole function cannot be used: if the macro can be
  5834. expanded several times in one function, the label will be multiply
  5835. defined in that function.  A local label avoids this problem.  For
  5836. example:
  5837.  
  5838.      #define SEARCH(array, target)                     \
  5839.      ({                                               \
  5840.        __label__ found;                                \
  5841.        typeof (target) _SEARCH_target = (target);      \
  5842.        typeof (*(array)) *_SEARCH_array = (array);     \
  5843.        int i, j;                                       \
  5844.        int value;                                      \
  5845.        for (i = 0; i < max; i++)                       \
  5846.          for (j = 0; j < max; j++)                     \
  5847.            if (_SEARCH_array[i][j] == _SEARCH_target)  \
  5848.              { value = i; goto found; }              \
  5849.        value = -1;                                     \
  5850.       found:                                           \
  5851.        value;                                          \
  5852.      })
  5853.  
  5854. 
  5855. File: @.Distr.UsingGCC,  Node: Labels as Values,  Next: Nested Functions,  Prev: Local Labels,  Up: C Extensions
  5856.  
  5857. Labels as Values
  5858. ================
  5859.  
  5860.    You can get the address of a label defined in the current function
  5861. (or a containing function) with the unary operator `&&'.  The value has
  5862. type `void *'.  This value is a constant and can be used wherever a
  5863. constant of that type is valid.  For example:
  5864.  
  5865.      void *ptr;
  5866.      ...
  5867.      ptr = &&foo;
  5868.  
  5869.    To use these values, you need to be able to jump to one.  This is
  5870. done with the computed goto statement(1), `goto *EXP;'.  For example,
  5871.  
  5872.      goto *ptr;
  5873.  
  5874. Any expression of type `void *' is allowed.
  5875.  
  5876.    One way of using these constants is in initializing a static array
  5877. that will serve as a jump table:
  5878.  
  5879.      static void *array[] = { &&foo, &&bar, &&hack };
  5880.  
  5881.    Then you can select a label with indexing, like this:
  5882.  
  5883.      goto *array[i];
  5884.  
  5885. Note that this does not check whether the subscript is in bounds--array
  5886. indexing in C never does that.
  5887.  
  5888.    Such an array of label values serves a purpose much like that of the
  5889. `switch' statement.  The `switch' statement is cleaner, so use that
  5890. rather than an array unless the problem does not fit a `switch'
  5891. statement very well.
  5892.  
  5893.    Another use of label values is in an interpreter for threaded code.
  5894. The labels within the interpreter function can be stored in the
  5895. threaded code for super-fast dispatching.
  5896.  
  5897.    You can use this mechanism to jump to code in a different function.
  5898. If you do that, totally unpredictable things will happen.  The best way
  5899. to avoid this is to store the label address only in automatic variables
  5900. and never pass it as an argument.
  5901.  
  5902.    ---------- Footnotes ----------
  5903.  
  5904.    (1)  The analogous feature in Fortran is called an assigned goto,
  5905. but that name seems inappropriate in C, where one can do more than
  5906. simply store label addresses in label variables.
  5907.  
  5908. 
  5909. File: @.Distr.UsingGCC,  Node: Nested Functions,  Next: Constructing Calls,  Prev: Labels as Values,  Up: C Extensions
  5910.  
  5911. Nested Functions
  5912. ================
  5913.  
  5914.    A "nested function" is a function defined inside another function.
  5915. (Nested functions are not supported for GNU C++.)  The nested function's
  5916. name is local to the block where it is defined.  For example, here we
  5917. define a nested function named `square', and call it twice:
  5918.  
  5919.      foo (double a, double b)
  5920.      {
  5921.        double square (double z) { return z * z; }
  5922.      
  5923.        return square (a) + square (b);
  5924.      }
  5925.  
  5926.    The nested function can access all the variables of the containing
  5927. function that are visible at the point of its definition.  This is
  5928. called "lexical scoping".  For example, here we show a nested function
  5929. which uses an inherited variable named `offset':
  5930.  
  5931.      bar (int *array, int offset, int size)
  5932.      {
  5933.        int access (int *array, int index)
  5934.          { return array[index + offset]; }
  5935.        int i;
  5936.        ...
  5937.        for (i = 0; i < size; i++)
  5938.          ... access (array, i) ...
  5939.      }
  5940.  
  5941.    Nested function definitions are permitted within functions in the
  5942. places where variable definitions are allowed; that is, in any block,
  5943. before the first statement in the block.
  5944.  
  5945.    It is possible to call the nested function from outside the scope of
  5946. its name by storing its address or passing the address to another
  5947. function:
  5948.  
  5949.      hack (int *array, int size)
  5950.      {
  5951.        void store (int index, int value)
  5952.          { array[index] = value; }
  5953.      
  5954.        intermediate (store, size);
  5955.      }
  5956.  
  5957.    Here, the function `intermediate' receives the address of `store' as
  5958. an argument.  If `intermediate' calls `store', the arguments given to
  5959. `store' are used to store into `array'.  But this technique works only
  5960. so long as the containing function (`hack', in this example) does not
  5961. exit.  If you try to call the nested function through its address after
  5962. the containing function has exited, all hell will break loose.
  5963.  
  5964.    GNU CC implements taking the address of a nested function using a
  5965. technique called "trampolines".  A paper describing them is available
  5966. from `maya.idiap.ch' in directory `pub/tmb', file `usenix88-lexic.ps.Z'.
  5967.  
  5968.    A nested function can jump to a label inherited from a containing
  5969. function, provided the label was explicitly declared in the containing
  5970. function (*note Local Labels::.).  Such a jump returns instantly to the
  5971. containing function, exiting the nested function which did the `goto'
  5972. and any intermediate functions as well.  Here is an example:
  5973.  
  5974.      bar (int *array, int offset, int size)
  5975.      {
  5976.        __label__ failure;
  5977.        int access (int *array, int index)
  5978.          {
  5979.            if (index > size)
  5980.              goto failure;
  5981.            return array[index + offset];
  5982.          }
  5983.        int i;
  5984.        ...
  5985.        for (i = 0; i < size; i++)
  5986.          ... access (array, i) ...
  5987.        ...
  5988.        return 0;
  5989.      
  5990.       /* Control comes here from `access'
  5991.          if it detects an error.  */
  5992.       failure:
  5993.        return -1;
  5994.      }
  5995.  
  5996.    A nested function always has internal linkage.  Declaring one with
  5997. `extern' is erroneous.  If you need to declare the nested function
  5998. before its definition, use `auto' (which is otherwise meaningless for
  5999. function declarations).
  6000.  
  6001.      bar (int *array, int offset, int size)
  6002.      {
  6003.        __label__ failure;
  6004.        auto int access (int *, int);
  6005.        ...
  6006.        int access (int *array, int index)
  6007.          {
  6008.            if (index > size)
  6009.              goto failure;
  6010.            return array[index + offset];
  6011.          }
  6012.        ...
  6013.      }
  6014.  
  6015. 
  6016. File: @.Distr.UsingGCC,  Node: Constructing Calls,  Next: Naming Types,  Prev: Nested Functions,  Up: C Extensions
  6017.  
  6018. Constructing Function Calls
  6019. ===========================
  6020.  
  6021.    Using the built-in functions described below, you can record the
  6022. arguments a function received, and call another function with the same
  6023. arguments, without knowing the number or types of the arguments.
  6024.  
  6025.    You can also record the return value of that function call, and
  6026. later return that value, without knowing what data type the function
  6027. tried to return (as long as your caller expects that data type).
  6028.  
  6029. `__builtin_apply_args ()'
  6030.      This built-in function returns a pointer of type `void *' to data
  6031.      describing how to perform a call with the same arguments as were
  6032.      passed to the current function.
  6033.  
  6034.      The function saves the arg pointer register, structure value
  6035.      address, and all registers that might be used to pass arguments to
  6036.      a function into a block of memory allocated on the stack.  Then it
  6037.      returns the address of that block.
  6038.  
  6039. `__builtin_apply (FUNCTION, ARGUMENTS, SIZE)'
  6040.      This built-in function invokes FUNCTION (type `void (*)()') with a
  6041.      copy of the parameters described by ARGUMENTS (type `void *') and
  6042.      SIZE (type `int').
  6043.  
  6044.      The value of ARGUMENTS should be the value returned by
  6045.      `__builtin_apply_args'.  The argument SIZE specifies the size of
  6046.      the stack argument data, in bytes.
  6047.  
  6048.      This function returns a pointer of type `void *' to data describing
  6049.      how to return whatever value was returned by FUNCTION.  The data
  6050.      is saved in a block of memory allocated on the stack.
  6051.  
  6052.      It is not always simple to compute the proper value for SIZE.  The
  6053.      value is used by `__builtin_apply' to compute the amount of data
  6054.      that should be pushed on the stack and copied from the incoming
  6055.      argument area.
  6056.  
  6057. `__builtin_return (RESULT)'
  6058.      This built-in function returns the value described by RESULT from
  6059.      the containing function.  You should specify, for RESULT, a value
  6060.      returned by `__builtin_apply'.
  6061.  
  6062. 
  6063. File: @.Distr.UsingGCC,  Node: Naming Types,  Next: Typeof,  Prev: Constructing Calls,  Up: C Extensions
  6064.  
  6065. Naming an Expression's Type
  6066. ===========================
  6067.  
  6068.    You can give a name to the type of an expression using a `typedef'
  6069. declaration with an initializer.  Here is how to define NAME as a type
  6070. name for the type of EXP:
  6071.  
  6072.      typedef NAME = EXP;
  6073.  
  6074.    This is useful in conjunction with the statements-within-expressions
  6075. feature.  Here is how the two together can be used to define a safe
  6076. "maximum" macro that operates on any arithmetic type:
  6077.  
  6078.      #define max(a,b) \
  6079.        ({typedef _ta = (a), _tb = (b);  \
  6080.          _ta _a = (a); _tb _b = (b);     \
  6081.          _a > _b ? _a : _b; })
  6082.  
  6083.    The reason for using names that start with underscores for the local
  6084. variables is to avoid conflicts with variable names that occur within
  6085. the expressions that are substituted for `a' and `b'.  Eventually we
  6086. hope to design a new form of declaration syntax that allows you to
  6087. declare variables whose scopes start only after their initializers;
  6088. this will be a more reliable way to prevent such conflicts.
  6089.  
  6090. 
  6091. File: @.Distr.UsingGCC,  Node: Typeof,  Next: Lvalues,  Prev: Naming Types,  Up: C Extensions
  6092.  
  6093. Referring to a Type with `typeof'
  6094. =================================
  6095.  
  6096.    Another way to refer to the type of an expression is with `typeof'.
  6097. The syntax of using of this keyword looks like `sizeof', but the
  6098. construct acts semantically like a type name defined with `typedef'.
  6099.  
  6100.    There are two ways of writing the argument to `typeof': with an
  6101. expression or with a type.  Here is an example with an expression:
  6102.  
  6103.      typeof (x[0](1))
  6104.  
  6105. This assumes that `x' is an array of functions; the type described is
  6106. that of the values of the functions.
  6107.  
  6108.    Here is an example with a typename as the argument:
  6109.  
  6110.      typeof (int *)
  6111.  
  6112. Here the type described is that of pointers to `int'.
  6113.  
  6114.    If you are writing a header file that must work when included in
  6115. ANSI C programs, write `__typeof__' instead of `typeof'.  *Note
  6116. Alternate Keywords::.
  6117.  
  6118.    A `typeof'-construct can be used anywhere a typedef name could be
  6119. used.  For example, you can use it in a declaration, in a cast, or
  6120. inside of `sizeof' or `typeof'.
  6121.  
  6122.    * This declares `y' with the type of what `x' points to.
  6123.  
  6124.           typeof (*x) y;
  6125.  
  6126.    * This declares `y' as an array of such values.
  6127.  
  6128.           typeof (*x) y[4];
  6129.  
  6130.    * This declares `y' as an array of pointers to characters:
  6131.  
  6132.           typeof (typeof (char *)[4]) y;
  6133.  
  6134.      It is equivalent to the following traditional C declaration:
  6135.  
  6136.           char *y[4];
  6137.  
  6138.      To see the meaning of the declaration using `typeof', and why it
  6139.      might be a useful way to write, let's rewrite it with these macros:
  6140.  
  6141.           #define pointer(T)  typeof(T *)
  6142.           #define array(T, N) typeof(T [N])
  6143.  
  6144.      Now the declaration can be rewritten this way:
  6145.  
  6146.           array (pointer (char), 4) y;
  6147.  
  6148.      Thus, `array (pointer (char), 4)' is the type of arrays of 4
  6149.      pointers to `char'.
  6150.  
  6151. 
  6152. File: @.Distr.UsingGCC,  Node: Lvalues,  Next: Conditionals,  Prev: Typeof,  Up: C Extensions
  6153.  
  6154. Generalized Lvalues
  6155. ===================
  6156.  
  6157.    Compound expressions, conditional expressions and casts are allowed
  6158. as lvalues provided their operands are lvalues.  This means that you
  6159. can take their addresses or store values into them.
  6160.  
  6161.    For example, a compound expression can be assigned, provided the last
  6162. expression in the sequence is an lvalue.  These two expressions are
  6163. equivalent:
  6164.  
  6165.      (a, b) += 5
  6166.      a, (b += 5)
  6167.  
  6168.    Similarly, the address of the compound expression can be taken.
  6169. These two expressions are equivalent:
  6170.  
  6171.      &(a, b)
  6172.      a, &b
  6173.  
  6174.    A conditional expression is a valid lvalue if its type is not void
  6175. and the true and false branches are both valid lvalues.  For example,
  6176. these two expressions are equivalent:
  6177.  
  6178.      (a ? b : c) = 5
  6179.      (a ? b = 5 : (c = 5))
  6180.  
  6181.    A cast is a valid lvalue if its operand is an lvalue.  A simple
  6182. assignment whose left-hand side is a cast works by converting the
  6183. right-hand side first to the specified type, then to the type of the
  6184. inner left-hand side expression.  After this is stored, the value is
  6185. converted back to the specified type to become the value of the
  6186. assignment.  Thus, if `a' has type `char *', the following two
  6187. expressions are equivalent:
  6188.  
  6189.      (int)a = 5
  6190.      (int)(a = (char *)(int)5)
  6191.  
  6192.    An assignment-with-arithmetic operation such as `+=' applied to a
  6193. cast performs the arithmetic using the type resulting from the cast,
  6194. and then continues as in the previous case.  Therefore, these two
  6195. expressions are equivalent:
  6196.  
  6197.      (int)a += 5
  6198.      (int)(a = (char *)(int) ((int)a + 5))
  6199.  
  6200.    You cannot take the address of an lvalue cast, because the use of its
  6201. address would not work out coherently.  Suppose that `&(int)f' were
  6202. permitted, where `f' has type `float'.  Then the following statement
  6203. would try to store an integer bit-pattern where a floating point number
  6204. belongs:
  6205.  
  6206.      *&(int)f = 1;
  6207.  
  6208.    This is quite different from what `(int)f = 1' would do--that would
  6209. convert 1 to floating point and store it.  Rather than cause this
  6210. inconsistency, we think it is better to prohibit use of `&' on a cast.
  6211.  
  6212.    If you really do want an `int *' pointer with the address of `f',
  6213. you can simply write `(int *)&f'.
  6214.  
  6215. 
  6216. File: @.Distr.UsingGCC,  Node: Conditionals,  Next: Long Long,  Prev: Lvalues,  Up: C Extensions
  6217.  
  6218. Conditionals with Omitted Operands
  6219. ==================================
  6220.  
  6221.    The middle operand in a conditional expression may be omitted.  Then
  6222. if the first operand is nonzero, its value is the value of the
  6223. conditional expression.
  6224.  
  6225.    Therefore, the expression
  6226.  
  6227.      x ? : y
  6228.  
  6229. has the value of `x' if that is nonzero; otherwise, the value of `y'.
  6230.  
  6231.    This example is perfectly equivalent to
  6232.  
  6233.      x ? x : y
  6234.  
  6235. In this simple case, the ability to omit the middle operand is not
  6236. especially useful.  When it becomes useful is when the first operand
  6237. does, or may (if it is a macro argument), contain a side effect.  Then
  6238. repeating the operand in the middle would perform the side effect
  6239. twice.  Omitting the middle operand uses the value already computed
  6240. without the undesirable effects of recomputing it.
  6241.  
  6242. 
  6243. File: @.Distr.UsingGCC,  Node: Long Long,  Next: Zero Length,  Prev: Conditionals,  Up: C Extensions
  6244.  
  6245. Double-Word Integers
  6246. ====================
  6247.  
  6248.    GNU C supports data types for integers that are twice as long as
  6249. `long int'.  Simply write `long long int' for a signed integer, or
  6250. `unsigned long long int' for an unsigned integer.  To make an integer
  6251. constant of type `long long int', add the suffix `LL' to the integer.
  6252. To make an integer constant of type `unsigned long long int', add the
  6253. suffix `ULL' to the integer.
  6254.  
  6255.    You can use these types in arithmetic like any other integer types.
  6256. Addition, subtraction, and bitwise boolean operations on these types
  6257. are open-coded on all types of machines.  Multiplication is open-coded
  6258. if the machine supports fullword-to-doubleword a widening multiply
  6259. instruction.  Division and shifts are open-coded only on machines that
  6260. provide special support.  The operations that are not open-coded use
  6261. special library routines that come with GNU CC.
  6262.  
  6263.    There may be pitfalls when you use `long long' types for function
  6264. arguments, unless you declare function prototypes.  If a function
  6265. expects type `int' for its argument, and you pass a value of type `long
  6266. long int', confusion will result because the caller and the subroutine
  6267. will disagree about the number of bytes for the argument.  Likewise, if
  6268. the function expects `long long int' and you pass `int'.  The best way
  6269. to avoid such problems is to use prototypes.
  6270.  
  6271. 
  6272. File: @.Distr.UsingGCC,  Node: Complex
  6273.  
  6274. Complex Numbers
  6275. ===============
  6276.  
  6277.    GNU C supports complex data types.  You can declare both complex
  6278. integer types and complex floating types, using the keyword
  6279. `__complex__'.
  6280.  
  6281.    For example, `__complex__ double x;' declares `x' as a variable
  6282. whose real part and imaginary part are both of type `double'.
  6283. `__complex__ short int y;' declares `y' to have real and imaginary
  6284. parts of type `short int'; this is not likely to be useful, but it
  6285. shows that the set of complex types is complete.
  6286.  
  6287.    To write a constant with a complex data type, use the suffix `i' or
  6288. `j' (either one; they are equivalent).  For example, `2.5fi' has type
  6289. `__complex__ float' and `3i' has type `__complex__ int'.  Such a
  6290. constant always has a pure imaginary value, but you can form any
  6291. complex value you like by adding one to a real constant.
  6292.  
  6293.    To extract the real part of a complex-valued expression EXP, write
  6294. `__real__ EXP'.  Likewise, use `__imag__' to extract the imaginary part.
  6295.  
  6296.    The operator `~' performs complex conjugation when used on a value
  6297. with a complex type.
  6298.  
  6299.    GNU CC can allocate complex automatic variables in a noncontiguous
  6300. fashion; it's even possible for the real part to be in a register while
  6301. the imaginary part is on the stack (or vice-versa).  None of the
  6302. supported debugging info formats has a way to represent noncontiguous
  6303. allocation like this, so GNU CC describes a noncontiguous complex
  6304. variable as if it were two separate variables of noncomplex type.  If
  6305. the variable's actual name is `foo', the two fictitious variables are
  6306. named `foo$real' and `foo$imag'.  You can examine and set these two
  6307. fictitious variables with your debugger.
  6308.  
  6309.    A future version of GDB will know how to recognize such pairs and
  6310. treat them as a single variable with a complex type.
  6311.  
  6312. 
  6313. File: @.Distr.UsingGCC,  Node: Zero Length,  Next: Variable Length,  Prev: Long Long,  Up: C Extensions
  6314.  
  6315. Arrays of Length Zero
  6316. =====================
  6317.  
  6318.    Zero-length arrays are allowed in GNU C.  They are very useful as
  6319. the last element of a structure which is really a header for a
  6320. variable-length object:
  6321.  
  6322.      struct line {
  6323.        int length;
  6324.        char contents[0];
  6325.      };
  6326.      
  6327.      {
  6328.        struct line *thisline = (struct line *)
  6329.          malloc (sizeof (struct line) + this_length);
  6330.        thisline->length = this_length;
  6331.      }
  6332.  
  6333.    In standard C, you would have to give `contents' a length of 1, which
  6334. means either you waste space or complicate the argument to `malloc'.
  6335.  
  6336. 
  6337. File: @.Distr.UsingGCC,  Node: Variable Length,  Next: Macro Varargs,  Prev: Zero Length,  Up: C Extensions
  6338.  
  6339. Arrays of Variable Length
  6340. =========================
  6341.  
  6342.    Variable-length automatic arrays are allowed in GNU C.  These arrays
  6343. are declared like any other automatic arrays, but with a length that is
  6344. not a constant expression.  The storage is allocated at the point of
  6345. declaration and deallocated when the brace-level is exited.  For
  6346. example:
  6347.  
  6348.      FILE *
  6349.      concat_fopen (char *s1, char *s2, char *mode)
  6350.      {
  6351.        char str[strlen (s1) + strlen (s2) + 1];
  6352.        strcpy (str, s1);
  6353.        strcat (str, s2);
  6354.        return fopen (str, mode);
  6355.      }
  6356.  
  6357.    Jumping or breaking out of the scope of the array name deallocates
  6358. the storage.  Jumping into the scope is not allowed; you get an error
  6359. message for it.
  6360.  
  6361.    You can use the function `alloca' to get an effect much like
  6362. variable-length arrays.  The function `alloca' is available in many
  6363. other C implementations (but not in all).  On the other hand,
  6364. variable-length arrays are more elegant.
  6365.  
  6366.    There are other differences between these two methods.  Space
  6367. allocated with `alloca' exists until the containing *function* returns.
  6368. The space for a variable-length array is deallocated as soon as the
  6369. array name's scope ends.  (If you use both variable-length arrays and
  6370. `alloca' in the same function, deallocation of a variable-length array
  6371. will also deallocate anything more recently allocated with `alloca'.)
  6372.  
  6373.    You can also use variable-length arrays as arguments to functions:
  6374.  
  6375.      struct entry
  6376.      tester (int len, char data[len][len])
  6377.      {
  6378.        ...
  6379.      }
  6380.  
  6381.    The length of an array is computed once when the storage is allocated
  6382. and is remembered for the scope of the array in case you access it with
  6383. `sizeof'.
  6384.  
  6385.    If you want to pass the array first and the length afterward, you can
  6386. use a forward declaration in the parameter list--another GNU extension.
  6387.  
  6388.      struct entry
  6389.      tester (int len; char data[len][len], int len)
  6390.      {
  6391.        ...
  6392.      }
  6393.  
  6394.    The `int len' before the semicolon is a "parameter forward
  6395. declaration", and it serves the purpose of making the name `len' known
  6396. when the declaration of `data' is parsed.
  6397.  
  6398.    You can write any number of such parameter forward declarations in
  6399. the parameter list.  They can be separated by commas or semicolons, but
  6400. the last one must end with a semicolon, which is followed by the "real"
  6401. parameter declarations.  Each forward declaration must match a "real"
  6402. declaration in parameter name and data type.
  6403.  
  6404. 
  6405. File: @.Distr.UsingGCC,  Node: Macro Varargs,  Next: Subscripting,  Prev: Variable Length,  Up: C Extensions
  6406.  
  6407. Macros with Variable Numbers of Arguments
  6408. =========================================
  6409.  
  6410.    In GNU C, a macro can accept a variable number of arguments, much as
  6411. a function can.  The syntax for defining the macro looks much like that
  6412. used for a function.  Here is an example:
  6413.  
  6414.      #define eprintf(format, args...)  \
  6415.       fprintf (stderr, format , ## args)
  6416.  
  6417.    Here `args' is a "rest argument": it takes in zero or more
  6418. arguments, as many as the call contains.  All of them plus the commas
  6419. between them form the value of `args', which is substituted into the
  6420. macro body where `args' is used.  Thus, we have this expansion:
  6421.  
  6422.      eprintf ("%s:%d: ", input_file_name, line_number)
  6423.      ==>
  6424.      fprintf (stderr, "%s:%d: " , input_file_name, line_number)
  6425.  
  6426. Note that the comma after the string constant comes from the definition
  6427. of `eprintf', whereas the last comma comes from the value of `args'.
  6428.  
  6429.    The reason for using `##' is to handle the case when `args' matches
  6430. no arguments at all.  In this case, `args' has an empty value.  In this
  6431. case, the second comma in the definition becomes an embarrassment: if
  6432. it got through to the expansion of the macro, we would get something
  6433. like this:
  6434.  
  6435.      fprintf (stderr, "success!\n" , )
  6436.  
  6437. which is invalid C syntax.  `##' gets rid of the comma, so we get the
  6438. following instead:
  6439.  
  6440.      fprintf (stderr, "success!\n")
  6441.  
  6442.    This is a special feature of the GNU C preprocessor: `##' before a
  6443. rest argument that is empty discards the preceding sequence of
  6444. non-whitespace characters from the macro definition.  (If another macro
  6445. argument precedes, none of it is discarded.)
  6446.  
  6447.    It might be better to discard the last preprocessor token instead of
  6448. the last preceding sequence of non-whitespace characters; in fact, we
  6449. may someday change this feature to do so.  We advise you to write the
  6450. macro definition so that the preceding sequence of non-whitespace
  6451. characters is just a single token, so that the meaning will not change
  6452. if we change the definition of this feature.
  6453.  
  6454. 
  6455. File: @.Distr.UsingGCC,  Node: Subscripting,  Next: Pointer Arith,  Prev: Macro Varargs,  Up: C Extensions
  6456.  
  6457. Non-Lvalue Arrays May Have Subscripts
  6458. =====================================
  6459.  
  6460.    Subscripting is allowed on arrays that are not lvalues, even though
  6461. the unary `&' operator is not.  For example, this is valid in GNU C
  6462. though not valid in other C dialects:
  6463.  
  6464.      struct foo {int a[4];};
  6465.      
  6466.      struct foo f();
  6467.      
  6468.      bar (int index)
  6469.      {
  6470.        return f().a[index];
  6471.      }
  6472.  
  6473. 
  6474. File: @.Distr.UsingGCC,  Node: Pointer Arith,  Next: Initializers,  Prev: Subscripting,  Up: C Extensions
  6475.  
  6476. Arithmetic on `void'- and Function-Pointers
  6477. ===========================================
  6478.  
  6479.    In GNU C, addition and subtraction operations are supported on
  6480. pointers to `void' and on pointers to functions.  This is done by
  6481. treating the size of a `void' or of a function as 1.
  6482.  
  6483.    A consequence of this is that `sizeof' is also allowed on `void' and
  6484. on function types, and returns 1.
  6485.  
  6486.    The option `-Wpointer-arith' requests a warning if these extensions
  6487. are used.
  6488.  
  6489. 
  6490. File: @.Distr.UsingGCC,  Node: Initializers,  Next: Constructors,  Prev: Pointer Arith,  Up: C Extensions
  6491.  
  6492. Non-Constant Initializers
  6493. =========================
  6494.  
  6495.    The elements of an aggregate initializer for an automatic variable
  6496. are not required to be constant expressions in GNU C.  Here is an
  6497. example of an initializer with run-time varying elements:
  6498.  
  6499.      foo (float f, float g)
  6500.      {
  6501.        float beat_freqs[2] = { f-g, f+g };
  6502.        ...
  6503.      }
  6504.  
  6505. 
  6506. File: @.Distr.UsingGCC,  Node: Constructors,  Next: Labeled Elements,  Prev: Initializers,  Up: C Extensions
  6507.  
  6508. Constructor Expressions
  6509. =======================
  6510.  
  6511.    GNU C supports constructor expressions.  A constructor looks like a
  6512. cast containing an initializer.  Its value is an object of the type
  6513. specified in the cast, containing the elements specified in the
  6514. initializer.
  6515.  
  6516.    Usually, the specified type is a structure.  Assume that `struct
  6517. foo' and `structure' are declared as shown:
  6518.  
  6519.      struct foo {int a; char b[2];} structure;
  6520.  
  6521. Here is an example of constructing a `struct foo' with a constructor:
  6522.  
  6523.      structure = ((struct foo) {x + y, 'a', 0});
  6524.  
  6525. This is equivalent to writing the following:
  6526.  
  6527.      {
  6528.        struct foo temp = {x + y, 'a', 0};
  6529.        structure = temp;
  6530.      }
  6531.  
  6532.    You can also construct an array.  If all the elements of the
  6533. constructor are (made up of) simple constant expressions, suitable for
  6534. use in initializers, then the constructor is an lvalue and can be
  6535. coerced to a pointer to its first element, as shown here:
  6536.  
  6537.      char **foo = (char *[]) { "x", "y", "z" };
  6538.  
  6539.    Array constructors whose elements are not simple constants are not
  6540. very useful, because the constructor is not an lvalue.  There are only
  6541. two valid ways to use it: to subscript it, or initialize an array
  6542. variable with it.  The former is probably slower than a `switch'
  6543. statement, while the latter does the same thing an ordinary C
  6544. initializer would do.  Here is an example of subscripting an array
  6545. constructor:
  6546.  
  6547.      output = ((int[]) { 2, x, 28 }) [input];
  6548.  
  6549.    Constructor expressions for scalar types and union types are is also
  6550. allowed, but then the constructor expression is equivalent to a cast.
  6551.  
  6552. 
  6553. File: @.Distr.UsingGCC,  Node: Labeled Elements,  Next: Cast to Union,  Prev: Constructors,  Up: C Extensions
  6554.  
  6555. Labeled Elements in Initializers
  6556. ================================
  6557.  
  6558.    Standard C requires the elements of an initializer to appear in a
  6559. fixed order, the same as the order of the elements in the array or
  6560. structure being initialized.
  6561.  
  6562.    In GNU C you can give the elements in any order, specifying the array
  6563. indices or structure field names they apply to.
  6564.  
  6565.    To specify an array index, write `[INDEX]' before the element value.
  6566. For example,
  6567.  
  6568.      int a[6] = { [4] 29, [2] 15 };
  6569.  
  6570. is equivalent to
  6571.  
  6572.      int a[6] = { 0, 0, 15, 0, 29, 0 };
  6573.  
  6574. The index values must be constant expressions, even if the array being
  6575. initialized is automatic.
  6576.  
  6577.    In a structure initializer, specify the name of a field to initialize
  6578. with `FIELDNAME:' before the element value.  For example, given the
  6579. following structure,
  6580.  
  6581.      struct point { int x, y; };
  6582.  
  6583. the following initialization
  6584.  
  6585.      struct point p = { y: yvalue, x: xvalue };
  6586.  
  6587. is equivalent to
  6588.  
  6589.      struct point p = { xvalue, yvalue };
  6590.  
  6591.    You can also use an element label when initializing a union, to
  6592. specify which element of the union should be used.  For example,
  6593.  
  6594.      union foo { int i; double d; };
  6595.      
  6596.      union foo f = { d: 4 };
  6597.  
  6598. will convert 4 to a `double' to store it in the union using the second
  6599. element.  By contrast, casting 4 to type `union foo' would store it
  6600. into the union as the integer `i', since it is an integer.  (*Note Cast
  6601. to Union::.)
  6602.  
  6603.    You can combine this technique of naming elements with ordinary C
  6604. initialization of successive elements.  Each initializer element that
  6605. does not have a label applies to the next consecutive element of the
  6606. array or structure.  For example,
  6607.  
  6608.      int a[6] = { [1] v1, v2, [4] v4 };
  6609.  
  6610. is equivalent to
  6611.  
  6612.      int a[6] = { 0, v1, v2, 0, v4, 0 };
  6613.  
  6614.    Labeling the elements of an array initializer is especially useful
  6615. when the indices are characters or belong to an `enum' type.  For
  6616. example:
  6617.  
  6618.      int whitespace[256]
  6619.        = { [' '] 1, ['\t'] 1, ['\h'] 1,
  6620.            ['\f'] 1, ['\n'] 1, ['\r'] 1 };
  6621.  
  6622. 
  6623. File: @.Distr.UsingGCC,  Node: Case Ranges,  Next: Function Attributes,  Prev: Cast to Union,  Up: C Extensions
  6624.  
  6625. Case Ranges
  6626. ===========
  6627.  
  6628.    You can specify a range of consecutive values in a single `case'
  6629. label, like this:
  6630.  
  6631.      case LOW ... HIGH:
  6632.  
  6633. This has the same effect as the proper number of individual `case'
  6634. labels, one for each integer value from LOW to HIGH, inclusive.
  6635.  
  6636.    This feature is especially useful for ranges of ASCII character
  6637. codes:
  6638.  
  6639.      case 'A' ... 'Z':
  6640.  
  6641.    *Be careful:* Write spaces around the `...', for otherwise it may be
  6642. parsed wrong when you use it with integer values.  For example, write
  6643. this:
  6644.  
  6645.      case 1 ... 5:
  6646.  
  6647. rather than this:
  6648.  
  6649.      case 1...5:
  6650.  
  6651.      *Warning to C++ users:* When compiling C++, you must write two dots
  6652.      `..' rather than three to specify a range in case statements, thus:
  6653.  
  6654.           case 'A' .. 'Z':
  6655.  
  6656.      This is an anachronism in the GNU C++ front end, and will be
  6657.      rectified in a future release.
  6658.  
  6659. 
  6660. File: @.Distr.UsingGCC,  Node: Cast to Union,  Next: Case Ranges,  Prev: Labeled Elements,  Up: C Extensions
  6661.  
  6662. Cast to a Union Type
  6663. ====================
  6664.  
  6665.    A cast to union type is similar to other casts, except that the type
  6666. specified is a union type.  You can specify the type either with `union
  6667. TAG' or with a typedef name.  A cast to union is actually a constructor
  6668. though, not a cast, and hence does not yield an lvalue like normal
  6669. casts.  (*Note Constructors::.)
  6670.  
  6671.    The types that may be cast to the union type are those of the members
  6672. of the union.  Thus, given the following union and variables:
  6673.  
  6674.      union foo { int i; double d; };
  6675.      int x;
  6676.      double y;
  6677.  
  6678. both `x' and `y' can be cast to type `union' foo.
  6679.  
  6680.    Using the cast as the right-hand side of an assignment to a variable
  6681. of union type is equivalent to storing in a member of the union:
  6682.  
  6683.      union foo u;
  6684.      ...
  6685.      u = (union foo) x  ==  u.i = x
  6686.      u = (union foo) y  ==  u.d = y
  6687.  
  6688.    You can also use the union cast as a function argument:
  6689.  
  6690.      void hack (union foo);
  6691.      ...
  6692.      hack ((union foo) x);
  6693.  
  6694. 
  6695. File: @.Distr.UsingGCC,  Node: Function Attributes,  Next: Function Prototypes,  Prev: Case Ranges,  Up: C Extensions
  6696.  
  6697. Declaring Attributes of Functions
  6698. =================================
  6699.  
  6700.    In GNU C, you declare certain things about functions called in your
  6701. program which help the compiler optimize function calls.
  6702.  
  6703.    A few standard library functions, such as `abort' and `exit', cannot
  6704. return.  GNU CC knows this automatically.  Some programs define their
  6705. own functions that never return.  You can declare them `volatile' to
  6706. tell the compiler this fact.  For example,
  6707.  
  6708.      typedef void voidfn ();
  6709.      
  6710.      volatile voidfn fatal;
  6711.      
  6712.      void
  6713.      fatal (...)
  6714.      {
  6715.        ... /* Print error message. */ ...
  6716.        exit (1);
  6717.      }
  6718.  
  6719.    The `volatile' keyword tells the compiler to assume that `fatal'
  6720. cannot return.  It can then optimize without regard to what would
  6721. happen if `fatal' ever did return.  This makes slightly better code.
  6722. More importantly, it helps avoid spurious warnings of uninitialized
  6723. variables.
  6724.  
  6725.    Do not assume that registers saved by the calling function are
  6726. restored before calling the `volatile' function.
  6727.  
  6728.    It does not make sense for a `volatile' function to have a return
  6729. type other than `void'.
  6730.  
  6731.    Many functions do not examine any values except their arguments, and
  6732. have no effects except the return value.  Such a function can be subject
  6733. to common subexpression elimination and loop optimization just as an
  6734. arithmetic operator would be.  These functions should be declared
  6735. `const'.  For example,
  6736.  
  6737.      typedef int intfn ();
  6738.      
  6739.      extern const intfn square;
  6740.  
  6741. says that the hypothetical function `square' is safe to call fewer
  6742. times than the program says.
  6743.  
  6744.    Note that a function that has pointer arguments and examines the data
  6745. pointed to must *not* be declared `const'.  Likewise, a function that
  6746. calls a non-`const' function usually must not be `const'.  It does not
  6747. make sense for a `const' function to return `void'.
  6748.  
  6749.    The examples above use `typedef' because that is the only way to
  6750. declare a function `const' or `volatile'.  A declaration like this:
  6751.  
  6752.      extern const int square ();
  6753.  
  6754. does not have this effect; it says that the return type of `square' is
  6755. `const', not `square' itself.
  6756.  
  6757.    Some people object to this feature, suggesting that ANSI C's
  6758. `#pragma' should be used instead.  There are two reasons for not doing
  6759. this.
  6760.  
  6761.   1. It is impossible to generate `#pragma' commands from a macro.
  6762.  
  6763.   2. There is no telling what the same `#pragma' might mean in another
  6764.      compiler.
  6765.  
  6766.    These two reasons apply to almost any application that might be
  6767. proposed for `#pragma'.  It is basically a mistake to use `#pragma' for
  6768. *anything*.
  6769.  
  6770.    The keyword `__attribute__' allows you to specify special attributes
  6771. when making a declaration.  This keyword is followed by an attribute
  6772. specification inside double parentheses.  One attribute, `format', is
  6773. currently defined for functions.  Others are implemented for variables
  6774. and structure fields (*note Variable Attributes::.).
  6775.  
  6776. `format (ARCHETYPE, STRING-INDEX, FIRST-TO-CHECK)'
  6777.      The `format' attribute specifies that a function takes `printf' or
  6778.      `scanf' style arguments which should be type-checked against a
  6779.      format string.  For example, the declaration:
  6780.  
  6781.           extern int
  6782.           my_printf (void *my_object, const char *my_format, ...)
  6783.                 __attribute__ ((format (printf, 2, 3)));
  6784.  
  6785.      causes the compiler to check the arguments in calls to `my_printf'
  6786.      for consistency with the `printf' style format string argument
  6787.      `my_format'.
  6788.  
  6789.      The parameter ARCHETYPE determines how the format string is
  6790.      interpreted, and should be either `printf' or `scanf'.  The
  6791.      parameter STRING-INDEX specifies which argument is the format
  6792.      string argument (starting from 1), while FIRST-TO-CHECK is the
  6793.      number of the first argument to check against the format string.
  6794.      For functions where the arguments are not available to be checked
  6795.      (such as `vprintf'), specify the third parameter as zero.  In this
  6796.      case the compiler only checks the format string for consistency.
  6797.  
  6798.      In the example above, the format string (`my_format') is the second
  6799.      argument of the function `my_print', and the arguments to check
  6800.      start with the third argument, so the correct parameters for the
  6801.      format attribute are 2 and 3.
  6802.  
  6803.      The `format' attribute allows you to identify your own functions
  6804.      which take format strings as arguments, so that GNU CC can check
  6805.      the calls to these functions for errors.  The compiler always
  6806.      checks formats for the ANSI library functions `printf', `fprintf',
  6807.      `sprintf', `scanf', `fscanf', `sscanf', `vprintf', `vfprintf' and
  6808.      `vsprintf' whenever such warnings are requested (using
  6809.      `-Wformat'), so there is no need to modify the header file
  6810.      `stdio.h'.
  6811.  
  6812. 
  6813. File: @.Distr.UsingGCC,  Node: Function Prototypes,  Next: Dollar Signs,  Prev: Function Attributes,  Up: C Extensions
  6814.  
  6815. Prototypes and Old-Style Function Definitions
  6816. =============================================
  6817.  
  6818.    GNU C extends ANSI C to allow a function prototype to override a
  6819. later old-style non-prototype definition.  Consider the following
  6820. example:
  6821.  
  6822.      /* Use prototypes unless the compiler is old-fashioned.  */
  6823.      #if __STDC__
  6824.      #define P(x) x
  6825.      #else
  6826.      #define P(x) ()
  6827.      #endif
  6828.      
  6829.      /* Prototype function declaration.  */
  6830.      int isroot P((uid_t));
  6831.      
  6832.      /* Old-style function definition.  */
  6833.      int
  6834.      isroot (x)   /* ??? lossage here ??? */
  6835.           uid_t x;
  6836.      {
  6837.        return x == 0;
  6838.      }
  6839.  
  6840.    Suppose the type `uid_t' happens to be `short'.  ANSI C does not
  6841. allow this example, because subword arguments in old-style
  6842. non-prototype definitions are promoted.  Therefore in this example the
  6843. function definition's argument is really an `int', which does not match
  6844. the prototype argument type of `short'.
  6845.  
  6846.    This restriction of ANSI C makes it hard to write code that is
  6847. portable to traditional C compilers, because the programmer does not
  6848. know whether the `uid_t' type is `short', `int', or `long'.  Therefore,
  6849. in cases like these GNU C allows a prototype to override a later
  6850. old-style definition.  More precisely, in GNU C, a function prototype
  6851. argument type overrides the argument type specified by a later
  6852. old-style definition if the former type is the same as the latter type
  6853. before promotion.  Thus in GNU C the above example is equivalent to the
  6854. following:
  6855.  
  6856.      int isroot (uid_t);
  6857.      
  6858.      int
  6859.      isroot (uid_t x)
  6860.      {
  6861.        return x == 0;
  6862.      }
  6863.  
  6864. 
  6865. File: @.Distr.UsingGCC,  Node: Dollar Signs,  Next: Character Escapes,  Prev: Function Prototypes,  Up: C Extensions
  6866.  
  6867. Dollar Signs in Identifier Names
  6868. ================================
  6869.  
  6870.    In GNU C, you may use dollar signs in identifier names.  This is
  6871. because many traditional C implementations allow such identifiers.
  6872.  
  6873.    On some machines, dollar signs are allowed in identifiers if you
  6874. specify `-traditional'.  On a few systems they are allowed by default,
  6875. even if you do not use `-traditional'.  But they are never allowed if
  6876. you specify `-ansi'.
  6877.  
  6878.    There are certain ANSI C programs (obscure, to be sure) that would
  6879. compile incorrectly if dollar signs were permitted in identifiers.  For
  6880. example:
  6881.  
  6882.      #define foo(a) #a
  6883.      #define lose(b) foo (b)
  6884.      #define test$
  6885.      lose (test)
  6886.  
  6887. 
  6888. File: @.Distr.UsingGCC,  Node: Character Escapes,  Next: Variable Attributes,  Prev: Dollar Signs,  Up: C Extensions
  6889.  
  6890. The Character ESC in Constants
  6891. ==============================
  6892.  
  6893.    You can use the sequence `\e' in a string or character constant to
  6894. stand for the ASCII character ESC.
  6895.  
  6896. 
  6897. File: @.Distr.UsingGCC,  Node: Alignment,  Next: Inline,  Prev: Variable Attributes,  Up: C Extensions
  6898.  
  6899. Inquiring on Alignment of Types or Variables
  6900. ============================================
  6901.  
  6902.    The keyword `__alignof__' allows you to inquire about how an object
  6903. is aligned, or the minimum alignment usually required by a type.  Its
  6904. syntax is just like `sizeof'.
  6905.  
  6906.    For example, if the target machine requires a `double' value to be
  6907. aligned on an 8-byte boundary, then `__alignof__ (double)' is 8.  This
  6908. is true on many RISC machines.  On more traditional machine designs,
  6909. `__alignof__ (double)' is 4 or even 2.
  6910.  
  6911.    Some machines never actually require alignment; they allow reference
  6912. to any data type even at an odd addresses.  For these machines,
  6913. `__alignof__' reports the *recommended* alignment of a type.
  6914.  
  6915.    When the operand of `__alignof__' is an lvalue rather than a type,
  6916. the value is the largest alignment that the lvalue is known to have.
  6917. It may have this alignment as a result of its data type, or because it
  6918. is part of a structure and inherits alignment from that structure.  For
  6919. example, after this declaration:
  6920.  
  6921.      struct foo { int x; char y; } foo1;
  6922.  
  6923. the value of `__alignof__ (foo1.y)' is probably 2 or 4, the same as
  6924. `__alignof__ (int)', even though the data type of `foo1.y' does not
  6925. itself demand any alignment.
  6926.  
  6927.    A related feature which lets you specify the alignment of an object
  6928. is `__attribute__ ((aligned (ALIGNMENT)))'; see the following section.
  6929.  
  6930. 
  6931. File: @.Distr.UsingGCC,  Node: Variable Attributes,  Next: Alignment,  Prev: Character Escapes,  Up: C Extensions
  6932.  
  6933. Specifying Attributes of Variables
  6934. ==================================
  6935.  
  6936.    The keyword `__attribute__' allows you to specify special attributes
  6937. of variables or structure fields.  This keyword is followed by an
  6938. attribute specification inside double parentheses.  Four attributes are
  6939. currently defined: `aligned', `format', `mode' and `packed'.  `format'
  6940. is used for functions, and thus not documented here; see *Note Function
  6941. Attributes::.
  6942.  
  6943. `aligned (ALIGNMENT)'
  6944.      This attribute specifies a minimum alignment for the variable or
  6945.      structure field, measured in bytes.  For example, the declaration:
  6946.  
  6947.           int x __attribute__ ((aligned (16))) = 0;
  6948.  
  6949.      causes the compiler to allocate the global variable `x' on a
  6950.      16-byte boundary.  On a 68040, this could be used in conjunction
  6951.      with an `asm' expression to access the `move16' instruction which
  6952.      requires 16-byte aligned operands.
  6953.  
  6954.      You can also specify the alignment of structure fields.  For
  6955.      example, to create a double-word aligned `int' pair, you could
  6956.      write:
  6957.  
  6958.           struct foo { int x[2] __attribute__ ((aligned (8))); };
  6959.  
  6960.      This is an alternative to creating a union with a `double' member
  6961.      that forces the union to be double-word aligned.
  6962.  
  6963.      It is not possible to specify the alignment of functions; the
  6964.      alignment of functions is determined by the machine's requirements
  6965.      and cannot be changed.  You cannot specify alignment for a typedef
  6966.      name because such a name is just an alias, not a distinct type.
  6967.  
  6968.      The `aligned' attribute can only increase the alignment; but you
  6969.      can decrease it by specifying `packed' as well.  See below.
  6970.  
  6971.      The linker of your operating system imposes a maximum alignment.
  6972.      If the linker aligns each object file on a four byte boundary,
  6973.      then it is beyond the compiler's power to cause anything to be
  6974.      aligned to a larger boundary than that.  For example, if  the
  6975.      linker happens to put this object file at address 136 (eight more
  6976.      than a multiple of 64), then the compiler cannot guarantee an
  6977.      alignment of more than 8 just by aligning variables in the object
  6978.      file.
  6979.  
  6980. `mode (MODE)'
  6981.      This attribute specifies the data type for the
  6982.      declaration--whichever type corresponds to the mode MODE.  This in
  6983.      effect lets you request an integer or floating point type
  6984.      according to its width.
  6985.  
  6986. `packed'
  6987.      The `packed' attribute specifies that a variable or structure field
  6988.      should have the smallest possible alignment--one byte for a
  6989.      variable, and one bit for a field, unless you specify a larger
  6990.      value with the `aligned' attribute.
  6991.  
  6992.    To specify multiple attributes, separate them by commas within the
  6993. double parentheses: for example, `__attribute__ ((aligned (16),
  6994. packed))'.
  6995.  
  6996. 
  6997. File: @.Distr.UsingGCC,  Node: Inline,  Next: Extended Asm,  Prev: Alignment,  Up: C Extensions
  6998.  
  6999. An Inline Function is As Fast As a Macro
  7000. ========================================
  7001.  
  7002.    By declaring a function `inline', you can direct GNU CC to integrate
  7003. that function's code into the code for its callers.  This makes
  7004. execution faster by eliminating the function-call overhead; in
  7005. addition, if any of the actual argument values are constant, their known
  7006. values may permit simplifications at compile time so that not all of the
  7007. inline function's code needs to be included.  The effect on code size is
  7008. less predictable; object code may be larger or smaller with function
  7009. inlining, depending on the particular case.  Inlining of functions is an
  7010. optimization and it really "works" only in optimizing compilation.  If
  7011. you don't use `-O', no function is really inline.
  7012.  
  7013.    To declare a function inline, use the `inline' keyword in its
  7014. declaration, like this:
  7015.  
  7016.      inline int
  7017.      inc (int *a)
  7018.      {
  7019.        (*a)++;
  7020.      }
  7021.  
  7022.    (If you are writing a header file to be included in ANSI C programs,
  7023. write `__inline__' instead of `inline'.  *Note Alternate Keywords::.)
  7024.  
  7025.    You can also make all "simple enough" functions inline with the
  7026. option `-finline-functions'.  Note that certain usages in a function
  7027. definition can make it unsuitable for inline substitution.
  7028.  
  7029.    For C++ programs, GNU CC automatically inlines member functions even
  7030. if they are not explicitly declared `inline'.  (You can override this
  7031. with `-fno-default-inline'; *note Options Controlling C++ Dialect: C++
  7032. Dialect Options..)
  7033.  
  7034.    When a function is both inline and `static', if all calls to the
  7035. function are integrated into the caller, and the function's address is
  7036. never used, then the function's own assembler code is never referenced.
  7037. In this case, GNU CC does not actually output assembler code for the
  7038. function, unless you specify the option `-fkeep-inline-functions'.
  7039. Some calls cannot be integrated for various reasons (in particular,
  7040. calls that precede the function's definition cannot be integrated, and
  7041. neither can recursive calls within the definition).  If there is a
  7042. nonintegrated call, then the function is compiled to assembler code as
  7043. usual.  The function must also be compiled as usual if the program
  7044. refers to its address, because that can't be inlined.
  7045.  
  7046.    When an inline function is not `static', then the compiler must
  7047. assume that there may be calls from other source files; since a global
  7048. symbol can be defined only once in any program, the function must not
  7049. be defined in the other source files, so the calls therein cannot be
  7050. integrated.  Therefore, a non-`static' inline function is always
  7051. compiled on its own in the usual fashion.
  7052.  
  7053.    If you specify both `inline' and `extern' in the function
  7054. definition, then the definition is used only for inlining.  In no case
  7055. is the function compiled on its own, not even if you refer to its
  7056. address explicitly.  Such an address becomes an external reference, as
  7057. if you had only declared the function, and had not defined it.
  7058.  
  7059.    This combination of `inline' and `extern' has almost the effect of a
  7060. macro.  The way to use it is to put a function definition in a header
  7061. file with these keywords, and put another copy of the definition
  7062. (lacking `inline' and `extern') in a library file.  The definition in
  7063. the header file will cause most calls to the function to be inlined.
  7064. If any uses of the function remain, they will refer to the single copy
  7065. in the library.
  7066.  
  7067.    GNU C does not inline any functions when not optimizing.  It is not
  7068. clear whether it is better to inline or not, in this case, but we found
  7069. that a correct implementation when not optimizing was difficult.  So we
  7070. did the easy thing, and turned it off.
  7071.  
  7072. 
  7073. File: @.Distr.UsingGCC,  Node: Extended Asm,  Next: Constraints,  Prev: Inline,  Up: C Extensions
  7074.  
  7075. Assembler Instructions with C Expression Operands
  7076. =================================================
  7077.  
  7078.    In an assembler instruction using `asm', you can now specify the
  7079. operands of the instruction using C expressions.  This means no more
  7080. guessing which registers or memory locations will contain the data you
  7081. want to use.
  7082.  
  7083.    You must specify an assembler instruction template much like what
  7084. appears in a machine description, plus an operand constraint string for
  7085. each operand.
  7086.  
  7087.    For example, here is how to use the 68881's `fsinx' instruction:
  7088.  
  7089.      asm ("fsinx %1,%0" : "=f" (result) : "f" (angle));
  7090.  
  7091. Here `angle' is the C expression for the input operand while `result'
  7092. is that of the output operand.  Each has `"f"' as its operand
  7093. constraint, saying that a floating point register is required.  The `='
  7094. in `=f' indicates that the operand is an output; all output operands'
  7095. constraints must use `='.  The constraints use the same language used
  7096. in the machine description (*note Constraints::.).
  7097.  
  7098.    Each operand is described by an operand-constraint string followed
  7099. by the C expression in parentheses.  A colon separates the assembler
  7100. template from the first output operand, and another separates the last
  7101. output operand from the first input, if any.  Commas separate output
  7102. operands and separate inputs.  The total number of operands is limited
  7103. to ten or to the maximum number of operands in any instruction pattern
  7104. in the machine description, whichever is greater.
  7105.  
  7106.    If there are no output operands, and there are input operands, then
  7107. there must be two consecutive colons surrounding the place where the
  7108. output operands would go.
  7109.  
  7110.    Output operand expressions must be lvalues; the compiler can check
  7111. this.  The input operands need not be lvalues.  The compiler cannot
  7112. check whether the operands have data types that are reasonable for the
  7113. instruction being executed.  It does not parse the assembler
  7114. instruction template and does not know what it means, or whether it is
  7115. valid assembler input.  The extended `asm' feature is most often used
  7116. for machine instructions that the compiler itself does not know exist.
  7117.  
  7118.    The output operands must be write-only; GNU CC will assume that the
  7119. values in these operands before the instruction are dead and need not be
  7120. generated.  Extended asm does not support input-output or read-write
  7121. operands.  For this reason, the constraint character `+', which
  7122. indicates such an operand, may not be used.
  7123.  
  7124.    When the assembler instruction has a read-write operand, or an
  7125. operand in which only some of the bits are to be changed, you must
  7126. logically split its function into two separate operands, one input
  7127. operand and one write-only output operand.  The connection between them
  7128. is expressed by constraints which say they need to be in the same
  7129. location when the instruction executes.  You can use the same C
  7130. expression for both operands, or different expressions.  For example,
  7131. here we write the (fictitious) `combine' instruction with `bar' as its
  7132. read-only source operand and `foo' as its read-write destination:
  7133.  
  7134.      asm ("combine %2,%0" : "=r" (foo) : "0" (foo), "g" (bar));
  7135.  
  7136. The constraint `"0"' for operand 1 says that it must occupy the same
  7137. location as operand 0.  A digit in constraint is allowed only in an
  7138. input operand, and it must refer to an output operand.
  7139.  
  7140.    Only a digit in the constraint can guarantee that one operand will
  7141. be in the same place as another.  The mere fact that `foo' is the value
  7142. of both operands is not enough to guarantee that they will be in the
  7143. same place in the generated assembler code.  The following would not
  7144. work:
  7145.  
  7146.      asm ("combine %2,%0" : "=r" (foo) : "r" (foo), "g" (bar));
  7147.  
  7148.    Various optimizations or reloading could cause operands 0 and 1 to
  7149. be in different registers; GNU CC knows no reason not to do so.  For
  7150. example, the compiler might find a copy of the value of `foo' in one
  7151. register and use it for operand 1, but generate the output operand 0 in
  7152. a different register (copying it afterward to `foo''s own address).  Of
  7153. course, since the register for operand 1 is not even mentioned in the
  7154. assembler code, the result will not work, but GNU CC can't tell that.
  7155.  
  7156.    Some instructions clobber specific hard registers.  To describe
  7157. this, write a third colon after the input operands, followed by the
  7158. names of the clobbered hard registers (given as strings).  Here is a
  7159. realistic example for the Vax:
  7160.  
  7161.      asm volatile ("movc3 %0,%1,%2"
  7162.                    : /* no outputs */
  7163.                    : "g" (from), "g" (to), "g" (count)
  7164.                    : "r0", "r1", "r2", "r3", "r4", "r5");
  7165.  
  7166.    If you refer to a particular hardware register from the assembler
  7167. code, then you will probably have to list the register after the third
  7168. colon to tell the compiler that the register's value is modified.  In
  7169. many assemblers, the register names begin with `%'; to produce one `%'
  7170. in the assembler code, you must write `%%' in the input.
  7171.  
  7172.    If your assembler instruction can alter the condition code register,
  7173. add `cc' to the list of clobbered registers.  GNU CC on some machines
  7174. represents the condition codes as a specific hardware register; `cc'
  7175. serves to name this register.  On other machines, the condition code is
  7176. handled differently, and specifying `cc' has no effect.  But it is
  7177. valid no matter what the machine.
  7178.  
  7179.    If your assembler instruction modifies memory in an unpredictable
  7180. fashion, add `memory' to the list of clobbered registers.  This will
  7181. cause GNU CC to not keep memory values cached in registers across the
  7182. assembler instruction.
  7183.  
  7184.    You can put multiple assembler instructions together in a single
  7185. `asm' template, separated either with newlines (written as `\n') or with
  7186. semicolons if the assembler allows such semicolons.  The GNU assembler
  7187. allows semicolons and all Unix assemblers seem to do so.  The input
  7188. operands are guaranteed not to use any of the clobbered registers, and
  7189. neither will the output operands' addresses, so you can read and write
  7190. the clobbered registers as many times as you like.  Here is an example
  7191. of multiple instructions in a template; it assumes that the subroutine
  7192. `_foo' accepts arguments in registers 9 and 10:
  7193.  
  7194.      asm ("movl %0,r9;movl %1,r10;call _foo"
  7195.           : /* no outputs */
  7196.           : "g" (from), "g" (to)
  7197.           : "r9", "r10");
  7198.  
  7199.    Unless an output operand has the `&' constraint modifier, GNU CC may
  7200. allocate it in the same register as an unrelated input operand, on the
  7201. assumption that the inputs are consumed before the outputs are produced.
  7202. This assumption may be false if the assembler code actually consists of
  7203. more than one instruction.  In such a case, use `&' for each output
  7204. operand that may not overlap an input.  *Note Modifiers::.
  7205.  
  7206.    If you want to test the condition code produced by an assembler
  7207. instruction, you must include a branch and a label in the `asm'
  7208. construct, as follows:
  7209.  
  7210.      asm ("clr %0;frob %1;beq 0f;mov #1,%0;0:"
  7211.           : "g" (result)
  7212.           : "g" (input));
  7213.  
  7214. This assumes your assembler supports local labels, as the GNU assembler
  7215. and most Unix assemblers do.
  7216.  
  7217.    Speaking of labels, jumps from one `asm' to another are not
  7218. supported.  The compiler's optimizers do not know about these jumps,
  7219. and therefore they cannot take account of them when deciding how to
  7220. optimize.
  7221.  
  7222.    Usually the most convenient way to use these `asm' instructions is to
  7223. encapsulate them in macros that look like functions.  For example,
  7224.  
  7225.      #define sin(x)       \
  7226.      ({ double __value, __arg = (x);   \
  7227.         asm ("fsinx %1,%0": "=f" (__value): "f" (__arg));  \
  7228.         __value; })
  7229.  
  7230. Here the variable `__arg' is used to make sure that the instruction
  7231. operates on a proper `double' value, and to accept only those arguments
  7232. `x' which can convert automatically to a `double'.
  7233.  
  7234.    Another way to make sure the instruction operates on the correct
  7235. data type is to use a cast in the `asm'.  This is different from using a
  7236. variable `__arg' in that it converts more different types.  For
  7237. example, if the desired type were `int', casting the argument to `int'
  7238. would accept a pointer with no complaint, while assigning the argument
  7239. to an `int' variable named `__arg' would warn about using a pointer
  7240. unless the caller explicitly casts it.
  7241.  
  7242.    If an `asm' has output operands, GNU CC assumes for optimization
  7243. purposes that the instruction has no side effects except to change the
  7244. output operands.  This does not mean that instructions with a side
  7245. effect cannot be used, but you must be careful, because the compiler
  7246. may eliminate them if the output operands aren't used, or move them out
  7247. of loops, or replace two with one if they constitute a common
  7248. subexpression.  Also, if your instruction does have a side effect on a
  7249. variable that otherwise appears not to change, the old value of the
  7250. variable may be reused later if it happens to be found in a register.
  7251.  
  7252.    You can prevent an `asm' instruction from being deleted, moved
  7253. significantly, or combined, by writing the keyword `volatile' after the
  7254. `asm'.  For example:
  7255.  
  7256.      #define set_priority(x)  \
  7257.      asm volatile ("set_priority %0": /* no outputs */ : "g" (x))
  7258.  
  7259. An instruction without output operands will not be deleted or moved
  7260. significantly, regardless, unless it is unreachable.
  7261.  
  7262.    Note that even a volatile `asm' instruction can be moved in ways
  7263. that appear insignificant to the compiler, such as across jump
  7264. instructions.  You can't expect a sequence of volatile `asm'
  7265. instructions to remain perfectly consecutive.  If you want consecutive
  7266. output, use a single `asm'.
  7267.  
  7268.    It is a natural idea to look for a way to give access to the
  7269. condition code left by the assembler instruction.  However, when we
  7270. attempted to implement this, we found no way to make it work reliably.
  7271. The problem is that output operands might need reloading, which would
  7272. result in additional following "store" instructions.  On most machines,
  7273. these instructions would alter the condition code before there was time
  7274. to test it.  This problem doesn't arise for ordinary "test" and
  7275. "compare" instructions because they don't have any output operands.
  7276.  
  7277.    If you are writing a header file that should be includable in ANSI C
  7278. programs, write `__asm__' instead of `asm'.  *Note Alternate Keywords::.
  7279.  
  7280. 
  7281. File: @.Distr.UsingGCC,  Node: Constraints,  Next: Asm Labels,  Prev: Extended Asm,  Up: C Extensions
  7282.  
  7283. Constraints for `asm' Operands
  7284. ==============================
  7285.  
  7286.    Here are specific details on what constraint letters you can use with
  7287. `asm' operands.  Constraints can say whether an operand may be in a
  7288. register, and which kinds of register; whether the operand can be a
  7289. memory reference, and which kinds of address; whether the operand may
  7290. be an immediate constant, and which possible values it may have.
  7291. Constraints can also require two operands to match.
  7292.  
  7293. * Menu:
  7294.  
  7295. * Simple Constraints::  Basic use of constraints.
  7296. * Multi-Alternative::   When an insn has two alternative constraint-patterns.
  7297. * Modifiers::           More precise control over effects of constraints.
  7298. * Machine Constraints:: Special constraints for some particular machines.
  7299.  
  7300. 
  7301. File: @.Distr.UsingGCC,  Node: Simple Constraints,  Next: Multi-Alternative,  Up: Constraints
  7302.  
  7303. Simple Constraints
  7304. ------------------
  7305.  
  7306.    The simplest kind of constraint is a string full of letters, each of
  7307. which describes one kind of operand that is permitted.  Here are the
  7308. letters that are allowed:
  7309.  
  7310. `m'
  7311.      A memory operand is allowed, with any kind of address that the
  7312.      machine supports in general.
  7313.  
  7314. `o'
  7315.      A memory operand is allowed, but only if the address is
  7316.      "offsettable".  This means that adding a small integer (actually,
  7317.      the width in bytes of the operand, as determined by its machine
  7318.      mode) may be added to the address and the result is also a valid
  7319.      memory address.
  7320.  
  7321.      For example, an address which is constant is offsettable; so is an
  7322.      address that is the sum of a register and a constant (as long as a
  7323.      slightly larger constant is also within the range of
  7324.      address-offsets supported by the machine); but an autoincrement or
  7325.      autodecrement address is not offsettable.  More complicated
  7326.      indirect/indexed addresses may or may not be offsettable depending
  7327.      on the other addressing modes that the machine supports.
  7328.  
  7329.      Note that in an output operand which can be matched by another
  7330.      operand, the constraint letter `o' is valid only when accompanied
  7331.      by both `<' (if the target machine has predecrement addressing)
  7332.      and `>' (if the target machine has preincrement addressing).
  7333.  
  7334. `V'
  7335.      A memory operand that is not offsettable.  In other words,
  7336.      anything that would fit the `m' constraint but not the `o'
  7337.      constraint.
  7338.  
  7339. `<'
  7340.      A memory operand with autodecrement addressing (either
  7341.      predecrement or postdecrement) is allowed.
  7342.  
  7343. `>'
  7344.      A memory operand with autoincrement addressing (either
  7345.      preincrement or postincrement) is allowed.
  7346.  
  7347. `r'
  7348.      A register operand is allowed provided that it is in a general
  7349.      register.
  7350.  
  7351. `d', `a', `f', ...
  7352.      Other letters can be defined in machine-dependent fashion to stand
  7353.      for particular classes of registers.  `d', `a' and `f' are defined
  7354.      on the 68000/68020 to stand for data, address and floating point
  7355.      registers.
  7356.  
  7357. `i'
  7358.      An immediate integer operand (one with constant value) is allowed.
  7359.      This includes symbolic constants whose values will be known only at
  7360.      assembly time.
  7361.  
  7362. `n'
  7363.      An immediate integer operand with a known numeric value is allowed.
  7364.      Many systems cannot support assembly-time constants for operands
  7365.      less than a word wide.  Constraints for these operands should use
  7366.      `n' rather than `i'.
  7367.  
  7368. `I', `J', `K', ... `P'
  7369.      Other letters in the range `I' through `P' may be defined in a
  7370.      machine-dependent fashion to permit immediate integer operands with
  7371.      explicit integer values in specified ranges.  For example, on the
  7372.      68000, `I' is defined to stand for the range of values 1 to 8.
  7373.      This is the range permitted as a shift count in the shift
  7374.      instructions.
  7375.  
  7376. `E'
  7377.      An immediate floating operand (expression code `const_double') is
  7378.      allowed, but only if the target floating point format is the same
  7379.      as that of the host machine (on which the compiler is running).
  7380.  
  7381. `F'
  7382.      An immediate floating operand (expression code `const_double') is
  7383.      allowed.
  7384.  
  7385. `G', `H'
  7386.      `G' and `H' may be defined in a machine-dependent fashion to
  7387.      permit immediate floating operands in particular ranges of values.
  7388.  
  7389. `s'
  7390.      An immediate integer operand whose value is not an explicit
  7391.      integer is allowed.
  7392.  
  7393.      This might appear strange; if an insn allows a constant operand
  7394.      with a value not known at compile time, it certainly must allow
  7395.      any known value.  So why use `s' instead of `i'?  Sometimes it
  7396.      allows better code to be generated.
  7397.  
  7398.      For example, on the 68000 in a fullword instruction it is possible
  7399.      to use an immediate operand; but if the immediate value is between
  7400.      -128 and 127, better code results from loading the value into a
  7401.      register and using the register.  This is because the load into
  7402.      the register can be done with a `moveq' instruction.  We arrange
  7403.      for this to happen by defining the letter `K' to mean "any integer
  7404.      outside the range -128 to 127", and then specifying `Ks' in the
  7405.      operand constraints.
  7406.  
  7407. `g'
  7408.      Any register, memory or immediate integer operand is allowed,
  7409.      except for registers that are not general registers.
  7410.  
  7411. `X'
  7412.      Any operand whatsoever is allowed.
  7413.  
  7414. `0', `1', `2', ... `9'
  7415.      An operand that matches the specified operand number is allowed.
  7416.      If a digit is used together with letters within the same
  7417.      alternative, the digit should come last.
  7418.  
  7419.      This is called a "matching constraint" and what it really means is
  7420.      that the assembler has only a single operand that fills two roles
  7421.      which `asm' distinguishes.  For example, an add instruction uses
  7422.      two input operands and an output operand, but on most CISC
  7423.      machines an add instruction really has only two operands, one of
  7424.      them an input-output operand:
  7425.  
  7426.           addl #35,r12
  7427.  
  7428.      Matching constraints are used in these circumstances.  More
  7429.      precisely, the two operands that match must include one input-only
  7430.      operand and one output-only operand.  Moreover, the digit must be a
  7431.      smaller number than the number of the operand that uses it in the
  7432.      constraint.
  7433.  
  7434. `p'
  7435.      An operand that is a valid memory address is allowed.  This is for
  7436.      "load address" and "push address" instructions.
  7437.  
  7438.      `p' in the constraint must be accompanied by `address_operand' as
  7439.      the predicate in the `match_operand'.  This predicate interprets
  7440.      the mode specified in the `match_operand' as the mode of the memory
  7441.      reference for which the address would be valid.
  7442.  
  7443. `Q', `R', `S', ... `U'
  7444.      Letters in the range `Q' through `U' may be defined in a
  7445.      machine-dependent fashion to stand for arbitrary operand types.
  7446.  
  7447. 
  7448. File: @.Distr.UsingGCC,  Node: Multi-Alternative,  Next: Modifiers,  Prev: Simple Constraints,  Up: Constraints
  7449.  
  7450. Multiple Alternative Constraints
  7451. --------------------------------
  7452.  
  7453.    Sometimes a single instruction has multiple alternative sets of
  7454. possible operands.  For example, on the 68000, a logical-or instruction
  7455. can combine register or an immediate value into memory, or it can
  7456. combine any kind of operand into a register; but it cannot combine one
  7457. memory location into another.
  7458.  
  7459.    These constraints are represented as multiple alternatives.  An
  7460. alternative can be described by a series of letters for each operand.
  7461. The overall constraint for an operand is made from the letters for this
  7462. operand from the first alternative, a comma, the letters for this
  7463. operand from the second alternative, a comma, and so on until the last
  7464. alternative.
  7465.  
  7466.    If all the operands fit any one alternative, the instruction is
  7467. valid.  Otherwise, for each alternative, the compiler counts how many
  7468. instructions must be added to copy the operands so that that
  7469. alternative applies.  The alternative requiring the least copying is
  7470. chosen.  If two alternatives need the same amount of copying, the one
  7471. that comes first is chosen.  These choices can be altered with the `?'
  7472. and `!' characters:
  7473.  
  7474. `?'
  7475.      Disparage slightly the alternative that the `?' appears in, as a
  7476.      choice when no alternative applies exactly.  The compiler regards
  7477.      this alternative as one unit more costly for each `?' that appears
  7478.      in it.
  7479.  
  7480. `!'
  7481.      Disparage severely the alternative that the `!' appears in.  This
  7482.      alternative can still be used if it fits without reloading, but if
  7483.      reloading is needed, some other alternative will be used.
  7484.  
  7485. 
  7486. File: @.Distr.UsingGCC,  Node: Modifiers,  Next: Machine Constraints,  Prev: Multi-Alternative,  Up: Constraints
  7487.  
  7488. Constraint Modifier Characters
  7489. ------------------------------
  7490.  
  7491. `='
  7492.      Means that this operand is write-only for this instruction: the
  7493.      previous value is discarded and replaced by output data.
  7494.  
  7495. `+'
  7496.      Means that this operand is both read and written by the
  7497.      instruction.
  7498.  
  7499.      When the compiler fixes up the operands to satisfy the constraints,
  7500.      it needs to know which operands are inputs to the instruction and
  7501.      which are outputs from it.  `=' identifies an output; `+'
  7502.      identifies an operand that is both input and output; all other
  7503.      operands are assumed to be input only.
  7504.  
  7505. `&'
  7506.      Means (in a particular alternative) that this operand is written
  7507.      before the instruction is finished using the input operands.
  7508.      Therefore, this operand may not lie in a register that is used as
  7509.      an input operand or as part of any memory address.
  7510.  
  7511.      `&' applies only to the alternative in which it is written.  In
  7512.      constraints with multiple alternatives, sometimes one alternative
  7513.      requires `&' while others do not.  See, for example, the `movdf'
  7514.      insn of the 68000.
  7515.  
  7516.      `&' does not obviate the need to write `='.
  7517.  
  7518. `%'
  7519.      Declares the instruction to be commutative for this operand and the
  7520.      following operand.  This means that the compiler may interchange
  7521.      the two operands if that is the cheapest way to make all operands
  7522.      fit the constraints.
  7523.  
  7524. `#'
  7525.      Says that all following characters, up to the next comma, are to be
  7526.      ignored as a constraint.  They are significant only for choosing
  7527.      register preferences.
  7528.  
  7529. 
  7530. File: @.Distr.UsingGCC,  Node: Machine Constraints,  Prev: Modifiers,  Up: Constraints
  7531.  
  7532. Constraints for Particular Machines
  7533. -----------------------------------
  7534.  
  7535.    Whenever possible, you should use the general-purpose constraint
  7536. letters in `asm' arguments, since they will convey meaning more readily
  7537. to people reading your code.  Failing that, use the constraint letters
  7538. that usually have very similar meanings across architectures.  The most
  7539. commonly used constraints are `m' and `r' (for memory and
  7540. general-purpose registers respectively; *note Simple Constraints::.),
  7541. and `I', usually the letter indicating the most common
  7542. immediate-constant format.
  7543.  
  7544.    For each machine architecture, the `config/MACHINE.h' file defines
  7545. additional constraints.  These constraints are used by the compiler
  7546. itself for instruction generation, as well as for `asm' statements;
  7547. therefore, some of the constraints are not particularly interesting for
  7548. `asm'.  The constraints are defined through these macros:
  7549.  
  7550. `REG_CLASS_FROM_LETTER'
  7551.      Register class constraints (usually lower case).
  7552.  
  7553. `CONST_OK_FOR_LETTER_P'
  7554.      Immediate constant constraints, for non-floating point constants of
  7555.      word size or smaller precision (usually upper case).
  7556.  
  7557. `CONST_DOUBLE_OK_FOR_LETTER_P'
  7558.      Immediate constant constraints, for all floating point constants
  7559.      and for constants of greater than word size precision (usually
  7560.      upper case).
  7561.  
  7562. `EXTRA_CONSTRAINT'
  7563.      Special cases of registers or memory.  This macro is not required,
  7564.      and is only defined for some machines.
  7565.  
  7566.    Inspecting these macro definitions in the compiler source for your
  7567. machine is the best way to be certain you have the right constraints.
  7568. However, here is a summary of the machine-dependent constraints
  7569. available on some particular machines.
  7570.  
  7571. *AMD 29000 family--`a29k.h'*
  7572.     `l'
  7573.           Local register 0
  7574.  
  7575.     `b'
  7576.           Byte Pointer (`BP') register
  7577.  
  7578.     `q'
  7579.           `Q' register
  7580.  
  7581.     `h'
  7582.           Special purpose register
  7583.  
  7584.     `A'
  7585.           First accumulator register
  7586.  
  7587.     `a'
  7588.           Other accumulator register
  7589.  
  7590.     `f'
  7591.           Floating point register
  7592.  
  7593.     `I'
  7594.           Constant greater than 0, less than 0x100
  7595.  
  7596.     `J'
  7597.           Constant greater than 0, less than 0x10000
  7598.  
  7599.     `K'
  7600.           Constant whose high 24 bits are on (1)
  7601.  
  7602.     `L'
  7603.           16 bit constant whose high 8 bits are on (1)
  7604.  
  7605.     `M'
  7606.           32 bit constant whose high 16 bits are on (1)
  7607.  
  7608.     `N'
  7609.           32 bit negative constant that fits in 8 bits
  7610.  
  7611.     `O'
  7612.           The constant 0x80000000 or, on the 29050, any 32 bit constant
  7613.           whose low 16 bits are 0.
  7614.  
  7615.     `P'
  7616.           16 bit negative constant that fits in 8 bits
  7617.  
  7618.     `G'
  7619.     `H'
  7620.           A floating point constant (in `asm' statements, use the
  7621.           machine independent `E' or `F' instead)
  7622.  
  7623. *IBM RS6000--`rs6000.h'*
  7624.     `b'
  7625.           Address base register
  7626.  
  7627.     `f'
  7628.           Floating point register
  7629.  
  7630.     `h'
  7631.           `MQ', `CTR', or `LINK' register
  7632.  
  7633.     `q'
  7634.           `MQ' register
  7635.  
  7636.     `c'
  7637.           `CTR' register
  7638.  
  7639.     `l'
  7640.           `LINK' register
  7641.  
  7642.     `x'
  7643.           `CR' register (condition register) number 0
  7644.  
  7645.     `y'
  7646.           `CR' register (condition register)
  7647.  
  7648.     `I'
  7649.           Signed 16 bit constant
  7650.  
  7651.     `J'
  7652.           Constant whose low 16 bits are 0
  7653.  
  7654.     `K'
  7655.           Constant whose high 16 bits are 0
  7656.  
  7657.     `L'
  7658.           Constant suitable as a mask operand
  7659.  
  7660.     `M'
  7661.           Constant larger than 31
  7662.  
  7663.     `N'
  7664.           Exact power of 2
  7665.  
  7666.     `O'
  7667.           Zero
  7668.  
  7669.     `P'
  7670.           Constant whose negation is a signed 16 bit constant
  7671.  
  7672.     `G'
  7673.           Floating point constant that can be loaded into a register
  7674.           with one instruction per word
  7675.  
  7676.     `Q'
  7677.           Memory operand that is an offset from a register (`m' is
  7678.           preferable for `asm' statements)
  7679.  
  7680. *Intel 386--`i386.h'*
  7681.     `q'
  7682.           `a', `b', `c', or `d' register
  7683.  
  7684.     `f'
  7685.           Floating point register
  7686.  
  7687.     `t'
  7688.           First (top of stack) floating point register
  7689.  
  7690.     `u'
  7691.           Second floating point register
  7692.  
  7693.     `a'
  7694.           `a' register
  7695.  
  7696.     `b'
  7697.           `b' register
  7698.  
  7699.     `c'
  7700.           `c' register
  7701.  
  7702.     `d'
  7703.           `d' register
  7704.  
  7705.     `D'
  7706.           `di' register
  7707.  
  7708.     `S'
  7709.           `si' register
  7710.  
  7711.     `I'
  7712.           Constant in range 0 to 31 (for 32 bit shifts)
  7713.  
  7714.     `J'
  7715.           Constant in range 0 to 63 (for 64 bit shifts)
  7716.  
  7717.     `K'
  7718.           `0xff'
  7719.  
  7720.     `L'
  7721.           `0xffff'
  7722.  
  7723.     `M'
  7724.           0, 1, 2, or 3 (shifts for `lea' instruction)
  7725.  
  7726.     `G'
  7727.           Standard 80387 floating point constant
  7728.  
  7729. *Intel 960--`i960.h'*
  7730.     `f'
  7731.           Floating point register (`fp0' to `fp3')
  7732.  
  7733.     `l'
  7734.           Local register (`r0' to `r15')
  7735.  
  7736.     `b'
  7737.           Global register (`g0' to `g15')
  7738.  
  7739.     `d'
  7740.           Any local or global register
  7741.  
  7742.     `I'
  7743.           Integers from 0 to 31
  7744.  
  7745.     `J'
  7746.           0
  7747.  
  7748.     `K'
  7749.           Integers from -31 to 0
  7750.  
  7751.     `G'
  7752.           Floating point 0
  7753.  
  7754.     `H'
  7755.           Floating point 1
  7756.  
  7757. *MIPS--`mips.h'*
  7758.     `d'
  7759.           General-purpose integer register
  7760.  
  7761.     `f'
  7762.           Floating-point register (if available)
  7763.  
  7764.     `h'
  7765.           `Hi' register
  7766.  
  7767.     `l'
  7768.           `Lo' register
  7769.  
  7770.     `x'
  7771.           `Hi' or `Lo' register
  7772.  
  7773.     `y'
  7774.           General-purpose integer register
  7775.  
  7776.     `z'
  7777.           Floating-point status register
  7778.  
  7779.     `I'
  7780.           Signed 16 bit constant (for arithmetic instructions)
  7781.  
  7782.     `J'
  7783.           Zero
  7784.  
  7785.     `K'
  7786.           Zero-extended 16-bit constant (for logic instructions)
  7787.  
  7788.     `L'
  7789.           Constant with low 16 bits zero (can be loaded with `lui')
  7790.  
  7791.     `M'
  7792.           32 bit constant which requires two instructions to load (a
  7793.           constant which is not `I', `K', or `L')
  7794.  
  7795.     `N'
  7796.           Negative 16 bit constant
  7797.  
  7798.     `O'
  7799.           Exact power of two
  7800.  
  7801.     `P'
  7802.           Positive 16 bit constant
  7803.  
  7804.     `G'
  7805.           Floating point zero
  7806.  
  7807.     `Q'
  7808.           Memory reference that can be loaded with more than one
  7809.           instruction (`m' is preferable for `asm' statements)
  7810.  
  7811.     `R'
  7812.           Memory reference that can be loaded with one instruction (`m'
  7813.           is preferable for `asm' statements)
  7814.  
  7815.     `S'
  7816.           Memory reference in external OSF/rose PIC format (`m' is
  7817.           preferable for `asm' statements)
  7818.  
  7819. *Motorola 680x0--`m68k.h'*
  7820.     `a'
  7821.           Address register
  7822.  
  7823.     `d'
  7824.           Data register
  7825.  
  7826.     `f'
  7827.           68881 floating-point register, if available
  7828.  
  7829.     `x'
  7830.           Sun FPA (floating-point) register, if available
  7831.  
  7832.     `y'
  7833.           First 16 Sun FPA registers, if available
  7834.  
  7835.     `I'
  7836.           Integer in the range 1 to 8
  7837.  
  7838.     `J'
  7839.           16 bit signed number
  7840.  
  7841.     `K'
  7842.           Signed number whose magnitude is greater than 0x80
  7843.  
  7844.     `L'
  7845.           Integer in the range -8 to -1
  7846.  
  7847.     `G'
  7848.           Floating point constant that is not a 68881 constant
  7849.  
  7850.     `H'
  7851.           Floating point constant that can be used by Sun FPA
  7852.  
  7853. *SPARC--`sparc.h'*
  7854.     `f'
  7855.           Floating-point register
  7856.  
  7857.     `I'
  7858.           Signed 13 bit constant
  7859.  
  7860.     `J'
  7861.           Zero
  7862.  
  7863.     `K'
  7864.           32 bit constant with the low 12 bits clear (a constant that
  7865.           can be loaded with the `sethi' instruction)
  7866.  
  7867.     `G'
  7868.           Floating-point zero
  7869.  
  7870.     `H'
  7871.           Signed 13 bit constant, sign-extended to 32 or 64 bits
  7872.  
  7873.     `Q'
  7874.           Memory reference that can be loaded with one instruction
  7875.           (`m' is more appropriate for `asm' statements)
  7876.  
  7877.     `S'
  7878.           Constant, or memory address
  7879.  
  7880.     `T'
  7881.           Memory address aligned to an 8-byte boundary
  7882.  
  7883.     `U'
  7884.           Even register
  7885.  
  7886. 
  7887. File: @.Distr.UsingGCC,  Node: Asm Labels,  Next: Explicit Reg Vars,  Prev: Constraints,  Up: C Extensions
  7888.  
  7889. Controlling Names Used in Assembler Code
  7890. ========================================
  7891.  
  7892.    You can specify the name to be used in the assembler code for a C
  7893. function or variable by writing the `asm' (or `__asm__') keyword after
  7894. the declarator as follows:
  7895.  
  7896.      int foo asm ("myfoo") = 2;
  7897.  
  7898. This specifies that the name to be used for the variable `foo' in the
  7899. assembler code should be `myfoo' rather than the usual `_foo'.
  7900.  
  7901.    On systems where an underscore is normally prepended to the name of
  7902. a C function or variable, this feature allows you to define names for
  7903. the linker that do not start with an underscore.
  7904.  
  7905.    You cannot use `asm' in this way in a function *definition*; but you
  7906. can get the same effect by writing a declaration for the function
  7907. before its definition and putting `asm' there, like this:
  7908.  
  7909.      extern func () asm ("FUNC");
  7910.      
  7911.      func (x, y)
  7912.           int x, y;
  7913.      ...
  7914.  
  7915.    It is up to you to make sure that the assembler names you choose do
  7916. not conflict with any other assembler symbols.  Also, you must not use a
  7917. register name; that would produce completely invalid assembler code.
  7918. GNU CC does not as yet have the ability to store static variables in
  7919. registers.  Perhaps that will be added.
  7920.  
  7921. 
  7922. File: @.Distr.UsingGCC,  Node: Explicit Reg Vars,  Next: Alternate Keywords,  Prev: Asm Labels,  Up: C Extensions
  7923.  
  7924. Variables in Specified Registers
  7925. ================================
  7926.  
  7927.    GNU C allows you to put a few global variables into specified
  7928. hardware registers.  You can also specify the register in which an
  7929. ordinary register variable should be allocated.
  7930.  
  7931.    * Global register variables reserve registers throughout the program.
  7932.      This may be useful in programs such as programming language
  7933.      interpreters which have a couple of global variables that are
  7934.      accessed very often.
  7935.  
  7936.    * Local register variables in specific registers do not reserve the
  7937.      registers.  The compiler's data flow analysis is capable of
  7938.      determining where the specified registers contain live values, and
  7939.      where they are available for other uses.
  7940.  
  7941.      These local variables are sometimes convenient for use with the
  7942.      extended `asm' feature (*note Extended Asm::.), if you want to
  7943.      write one output of the assembler instruction directly into a
  7944.      particular register.  (This will work provided the register you
  7945.      specify fits the constraints specified for that operand in the
  7946.      `asm'.)
  7947.  
  7948. * Menu:
  7949.  
  7950. * Global Reg Vars::
  7951. * Local Reg Vars::
  7952.  
  7953. 
  7954. File: @.Distr.UsingGCC,  Node: Global Reg Vars,  Next: Local Reg Vars,  Up: Explicit Reg Vars
  7955.  
  7956. Defining Global Register Variables
  7957. ----------------------------------
  7958.  
  7959.    You can define a global register variable in GNU C like this:
  7960.  
  7961.      register int *foo asm ("a5");
  7962.  
  7963. Here `a5' is the name of the register which should be used.  Choose a
  7964. register which is normally saved and restored by function calls on your
  7965. machine, so that library routines will not clobber it.
  7966.  
  7967.    Naturally the register name is cpu-dependent, so you would need to
  7968. conditionalize your program according to cpu type.  The register `a5'
  7969. would be a good choice on a 68000 for a variable of pointer type.  On
  7970. machines with register windows, be sure to choose a "global" register
  7971. that is not affected magically by the function call mechanism.
  7972.  
  7973.    In addition, operating systems on one type of cpu may differ in how
  7974. they name the registers; then you would need additional conditionals.
  7975. For example, some 68000 operating systems call this register `%a5'.
  7976.  
  7977.    Eventually there may be a way of asking the compiler to choose a
  7978. register automatically, but first we need to figure out how it should
  7979. choose and how to enable you to guide the choice.  No solution is
  7980. evident.
  7981.  
  7982.    Defining a global register variable in a certain register reserves
  7983. that register entirely for this use, at least within the current
  7984. compilation.  The register will not be allocated for any other purpose
  7985. in the functions in the current compilation.  The register will not be
  7986. saved and restored by these functions.  Stores into this register are
  7987. never deleted even if they would appear to be dead, but references may
  7988. be deleted or moved or simplified.
  7989.  
  7990.    It is not safe to access the global register variables from signal
  7991. handlers, or from more than one thread of control, because the system
  7992. library routines may temporarily use the register for other things
  7993. (unless you recompile them specially for the task at hand).
  7994.  
  7995.    It is not safe for one function that uses a global register variable
  7996. to call another such function `foo' by way of a third function `lose'
  7997. that was compiled without knowledge of this variable (i.e. in a
  7998. different source file in which the variable wasn't declared).  This is
  7999. because `lose' might save the register and put some other value there.
  8000. For example, you can't expect a global register variable to be
  8001. available in the comparison-function that you pass to `qsort', since
  8002. `qsort' might have put something else in that register.  (If you are
  8003. prepared to recompile `qsort' with the same global register variable,
  8004. you can solve this problem.)
  8005.  
  8006.    If you want to recompile `qsort' or other source files which do not
  8007. actually use your global register variable, so that they will not use
  8008. that register for any other purpose, then it suffices to specify the
  8009. compiler option `-ffixed-REG'.  You need not actually add a global
  8010. register declaration to their source code.
  8011.  
  8012.    A function which can alter the value of a global register variable
  8013. cannot safely be called from a function compiled without this variable,
  8014. because it could clobber the value the caller expects to find there on
  8015. return.  Therefore, the function which is the entry point into the part
  8016. of the program that uses the global register variable must explicitly
  8017. save and restore the value which belongs to its caller.
  8018.  
  8019.    On most machines, `longjmp' will restore to each global register
  8020. variable the value it had at the time of the `setjmp'.  On some
  8021. machines, however, `longjmp' will not change the value of global
  8022. register variables.  To be portable, the function that called `setjmp'
  8023. should make other arrangements to save the values of the global register
  8024. variables, and to restore them in a `longjmp'.  This way, the same
  8025. thing will happen regardless of what `longjmp' does.
  8026.  
  8027.    All global register variable declarations must precede all function
  8028. definitions.  If such a declaration could appear after function
  8029. definitions, the declaration would be too late to prevent the register
  8030. from being used for other purposes in the preceding functions.
  8031.  
  8032.    Global register variables may not have initial values, because an
  8033. executable file has no means to supply initial contents for a register.
  8034.  
  8035.    On the Sparc, there are reports that g3 ... g7 are suitable
  8036. registers, but certain library functions, such as `getwd', as well as
  8037. the subroutines for division and remainder, modify g3 and g4.  g1 and
  8038. g2 are local temporaries.
  8039.  
  8040.    On the 68000, a2 ... a5 should be suitable, as should d2 ... d7.  Of
  8041. course, it will not do to use more than a few of those.
  8042.  
  8043. 
  8044. File: @.Distr.UsingGCC,  Node: Local Reg Vars,  Prev: Global Reg Vars,  Up: Explicit Reg Vars
  8045.  
  8046. Specifying Registers for Local Variables
  8047. ----------------------------------------
  8048.  
  8049.    You can define a local register variable with a specified register
  8050. like this:
  8051.  
  8052.      register int *foo asm ("a5");
  8053.  
  8054. Here `a5' is the name of the register which should be used.  Note that
  8055. this is the same syntax used for defining global register variables,
  8056. but for a local variable it would appear within a function.
  8057.  
  8058.    Naturally the register name is cpu-dependent, but this is not a
  8059. problem, since specific registers are most often useful with explicit
  8060. assembler instructions (*note Extended Asm::.).  Both of these things
  8061. generally require that you conditionalize your program according to cpu
  8062. type.
  8063.  
  8064.    In addition, operating systems on one type of cpu may differ in how
  8065. they name the registers; then you would need additional conditionals.
  8066. For example, some 68000 operating systems call this register `%a5'.
  8067.  
  8068.    Eventually there may be a way of asking the compiler to choose a
  8069. register automatically, but first we need to figure out how it should
  8070. choose and how to enable you to guide the choice.  No solution is
  8071. evident.
  8072.  
  8073.    Defining such a register variable does not reserve the register; it
  8074. remains available for other uses in places where flow control determines
  8075. the variable's value is not live.  However, these registers are made
  8076. unavailable for use in the reload pass.  I would not be surprised if
  8077. excessive use of this feature leaves the compiler too few available
  8078. registers to compile certain functions.
  8079.  
  8080. 
  8081. File: @.Distr.UsingGCC,  Node: Alternate Keywords,  Next: Incomplete Enums,  Prev: Explicit Reg Vars,  Up: C Extensions
  8082.  
  8083. Alternate Keywords
  8084. ==================
  8085.  
  8086.    The option `-traditional' disables certain keywords; `-ansi'
  8087. disables certain others.  This causes trouble when you want to use GNU C
  8088. extensions, or ANSI C features, in a general-purpose header file that
  8089. should be usable by all programs, including ANSI C programs and
  8090. traditional ones.  The keywords `asm', `typeof' and `inline' cannot be
  8091. used since they won't work in a program compiled with `-ansi', while
  8092. the keywords `const', `volatile', `signed', `typeof' and `inline' won't
  8093. work in a program compiled with `-traditional'.
  8094.  
  8095.    The way to solve these problems is to put `__' at the beginning and
  8096. end of each problematical keyword.  For example, use `__asm__' instead
  8097. of `asm', `__const__' instead of `const', and `__inline__' instead of
  8098. `inline'.
  8099.  
  8100.    Other C compilers won't accept these alternative keywords; if you
  8101. want to compile with another compiler, you can define the alternate
  8102. keywords as macros to replace them with the customary keywords.  It
  8103. looks like this:
  8104.  
  8105.      #ifndef __GNUC__
  8106.      #define __asm__ asm
  8107.      #endif
  8108.  
  8109.    `-pedantic' causes warnings for many GNU C extensions.  You can
  8110. prevent such warnings within one expression by writing `__extension__'
  8111. before the expression.  `__extension__' has no effect aside from this.
  8112.  
  8113. 
  8114. File: @.Distr.UsingGCC,  Node: Incomplete Enums,  Next: Function Names,  Prev: Alternate Keywords,  Up: C Extensions
  8115.  
  8116. Incomplete `enum' Types
  8117. =======================
  8118.  
  8119.    You can define an `enum' tag without specifying its possible values.
  8120. This results in an incomplete type, much like what you get if you write
  8121. `struct foo' without describing the elements.  A later declaration
  8122. which does specify the possible values completes the type.
  8123.  
  8124.    You can't allocate variables or storage using the type while it is
  8125. incomplete.  However, you can work with pointers to that type.
  8126.  
  8127.    This extension may not be very useful, but it makes the handling of
  8128. `enum' more consistent with the way `struct' and `union' are handled.
  8129.  
  8130. 
  8131. File: @.Distr.UsingGCC,  Node: Function Names,  Prev: Incomplete Enums,  Up: C Extensions
  8132.  
  8133. Function Names as Strings
  8134. =========================
  8135.  
  8136.    GNU CC predefines two string variables to be the name of the current
  8137. function.  The variable `__FUNCTION__' is the name of the function as
  8138. it appears in the source.  The variable `__PRETTY_FUNCTION__' is the
  8139. name of the function pretty printed in a language specific fashion.
  8140.  
  8141.    These names are always the same in a C function, but in a C++
  8142. function they may be different.  For example, this program:
  8143.  
  8144.      extern "C" {
  8145.      extern int printf (char *, ...);
  8146.      }
  8147.      
  8148.      class a {
  8149.       public:
  8150.        sub (int i)
  8151.          {
  8152.            printf ("__FUNCTION__ = %s\n", __FUNCTION__);
  8153.            printf ("__PRETTY_FUNCTION__ = %s\n", __PRETTY_FUNCTION__);
  8154.          }
  8155.      };
  8156.      
  8157.      int
  8158.      main (void)
  8159.      {
  8160.        a ax;
  8161.        ax.sub (0);
  8162.        return 0;
  8163.      }
  8164.  
  8165. gives this output:
  8166.  
  8167.      __FUNCTION__ = sub
  8168.      __PRETTY_FUNCTION__ = int  a::sub (int)
  8169.  
  8170. 
  8171. File: @.Distr.UsingGCC,  Node: C++ Extensions,  Next: Trouble,  Prev: C Extensions,  Up: Top
  8172.  
  8173. Extensions to the C++ Language
  8174. ******************************
  8175.  
  8176.    The GNU compiler provides these extensions to the C++ language (and
  8177. you can also use most of the C language extensions in your C++
  8178. programs).  If you want to write code that checks whether these
  8179. features are available, you can test for the GNU compiler the same way
  8180. as for C programs: check for a predefined macro `__GNUC__'.  You can
  8181. also use `__GNUG__' to test specifically for GNU C++ (*note Standard
  8182. Predefined Macros: (cpp.info)Standard Predefined.).
  8183.  
  8184. * Menu:
  8185.  
  8186. * Naming Results::      Giving a name to C++ function return values.
  8187. * Min and Max::        C++ Minimum and maximum operators.
  8188. * Destructors and Goto:: Goto is safe to use in C++ even when destructors
  8189.                            are needed.
  8190. * C++ Interface::       You can use a single C++ header file for both
  8191.                          declarations and definitions.
  8192.  
  8193. 
  8194. File: @.Distr.UsingGCC,  Node: Naming Results,  Next: Min and Max,  Up: C++ Extensions
  8195.  
  8196. Named Return Values in C++
  8197. ==========================
  8198.  
  8199.    GNU C++ extends the function-definition syntax to allow you to
  8200. specify a name for the result of a function outside the body of the
  8201. definition, in C++ programs:
  8202.  
  8203.      TYPE
  8204.      FUNCTIONNAME (ARGS) return RESULTNAME;
  8205.      {
  8206.        ...
  8207.        BODY
  8208.        ...
  8209.      }
  8210.  
  8211.    You can use this feature to avoid an extra constructor call when a
  8212. function result has a class type.  For example, consider a function
  8213. `m', declared as `X v = m ();', whose result is of class `X':
  8214.  
  8215.      X
  8216.      m ()
  8217.      {
  8218.        X b;
  8219.        b.a = 23;
  8220.        return b;
  8221.      }
  8222.  
  8223.    Although `m' appears to have no arguments, in fact it has one
  8224. implicit argument: the address of the return value.  At invocation, the
  8225. address of enough space to hold `v' is sent in as the implicit argument.
  8226. Then `b' is constructed and its `a' field is set to the value 23.
  8227. Finally, a copy constructor (a constructor of the form `X(X&)') is
  8228. applied to `b', with the (implicit) return value location as the
  8229. target, so that `v' is now bound to the return value.
  8230.  
  8231.    But this is wasteful.  The local `b' is declared just to hold
  8232. something that will be copied right out.  While a compiler that
  8233. combined an "elision" algorithm with interprocedural data flow analysis
  8234. could conceivably eliminate all of this, it is much more practical to
  8235. allow you to assist the compiler in generating efficient code by
  8236. manipulating the return value explicitly, thus avoiding the local
  8237. variable and copy constructor altogether.
  8238.  
  8239.    Using the extended GNU C++ function-definition syntax, you can avoid
  8240. the temporary allocation and copying by naming `r' as your return value
  8241. as the outset, and assigning to its `a' field directly:
  8242.  
  8243.      X
  8244.      m () return r;
  8245.      {
  8246.        r.a = 23;
  8247.      }
  8248.  
  8249. The declaration of `r' is a standard, proper declaration, whose effects
  8250. are executed *before* any of the body of `m'.
  8251.  
  8252.    Functions of this type impose no additional restrictions; in
  8253. particular, you can execute `return' statements, or return implicitly by
  8254. reaching the end of the function body ("falling off the edge").  Cases
  8255. like
  8256.  
  8257.      X
  8258.      m () return r (23);
  8259.      {
  8260.        return;
  8261.      }
  8262.  
  8263. (or even `X m () return r (23); { }') are unambiguous, since the return
  8264. value `r' has been initialized in either case.  The following code may
  8265. be hard to read, but also works predictably:
  8266.  
  8267.      X
  8268.      m () return r;
  8269.      {
  8270.        X b;
  8271.        return b;
  8272.      }
  8273.  
  8274.    The return value slot denoted by `r' is initialized at the outset,
  8275. but the statement `return b;' overrides this value.  The compiler deals
  8276. with this by destroying `r' (calling the destructor if there is one, or
  8277. doing nothing if there is not), and then reinitializing `r' with `b'.
  8278.  
  8279.    This extension is provided primarily to help people who use
  8280. overloaded operators, where there is a great need to control not just
  8281. the arguments, but the return values of functions.  For classes where
  8282. the copy constructor incurs a heavy performance penalty (especially in
  8283. the common case where there is a quick default constructor), this is a
  8284. major savings.  The disadvantage of this extension is that you do not
  8285. control when the default constructor for the return value is called: it
  8286. is always called at the beginning.
  8287.  
  8288. 
  8289. File: @.Distr.UsingGCC,  Node: Min and Max,  Next: Destructors and Goto,  Prev: Naming Results,  Up: C++ Extensions
  8290.  
  8291. Minimum and Maximum Operators in C++
  8292. ====================================
  8293.  
  8294.    It is very convenient to have operators which return the "minimum"
  8295. or the "maximum" of two arguments.  In GNU C++ (but not in GNU C),
  8296.  
  8297. `A <? B'
  8298.      is the "minimum", returning the smaller of the numeric values A
  8299.      and B;
  8300.  
  8301. `A >? B'
  8302.      is the "maximum", returning the larger of the numeric values A and
  8303.      B.
  8304.  
  8305.    These operations are not primitive in ordinary C++, since you can
  8306. use a macro to return the minimum of two things in C++, as in the
  8307. following example.
  8308.  
  8309.      #define MIN(X,Y) ((X) < (Y) ? : (X) : (Y))
  8310.  
  8311. You might then use `int min = MIN (i, j);' to set MIN to the minimum
  8312. value of variables I and J.
  8313.  
  8314.    However, side effects in `X' or `Y' may cause unintended behavior.
  8315. For example, `MIN (i++, j++)' will fail, incrementing the smaller
  8316. counter twice.  A GNU C extension allows you to write safe macros that
  8317. avoid this kind of problem (*note Naming an Expression's Type: Naming
  8318. Types.).  However, writing `MIN' and `MAX' as macros also forces you to
  8319. use function-call notation notation for a fundamental arithmetic
  8320. operation.  Using GNU C++ extensions, you can write `int min = i <? j;'
  8321. instead.
  8322.  
  8323.    Since `<?' and `>?' are built into the compiler, they properly
  8324. handle expressions with side-effects;  `int min = i++ <? j++;' works
  8325. correctly.
  8326.  
  8327. 
  8328. File: @.Distr.UsingGCC,  Node: Destructors and Goto,  Next: C++ Interface,  Prev: Min and Max,  Up: C++ Extensions
  8329.  
  8330. `goto' and Destructors in GNU C++
  8331. =================================
  8332.  
  8333.    In C++ programs, you can safely use the `goto' statement.  When you
  8334. use it to exit a block which contains aggregates requiring destructors,
  8335. the destructors will run before the `goto' transfers control.  (In ANSI
  8336. C++, `goto' is restricted to targets within the current block.)
  8337.  
  8338.    The compiler still forbids using `goto' to *enter* a scope that
  8339. requires constructors.
  8340.  
  8341. 
  8342. File: @.Distr.UsingGCC,  Node: C++ Interface,  Prev: Destructors and Goto,  Up: C++ Extensions
  8343.  
  8344. Declarations and Definitions in One Header
  8345. ==========================================
  8346.  
  8347.    C++ object definitions can be quite complex.  In principle, your
  8348. source code will need two kinds of things for each object that you use
  8349. across more than one source file.  First, you need an "interface"
  8350. specification, describing its structure with type declarations and
  8351. function prototypes.  Second, you need the "implementation" itself.  It
  8352. can be tedious to maintain a separate interface description in a header
  8353. file, in parallel to the actual implementation.  It is also dangerous,
  8354. since separate interface and implementation definitions may not remain
  8355. parallel.
  8356.  
  8357.    With GNU C++, you can use a single header file for both purposes.
  8358.  
  8359.      *Warning:* The mechanism to specify this is in transition.  For the
  8360.      nonce, you must use one of two `#pragma' commands; in a future
  8361.      release of GNU C++, an alternative mechanism will make these
  8362.      `#pragma' commands unnecessary.
  8363.  
  8364.    The header file contains the full definitions, but is marked with
  8365. `#pragma interface' in the source code.  This allows the compiler to
  8366. use the header file only as an interface specification when ordinary
  8367. source files incorporate it with `#include'.  In the single source file
  8368. where the full implementation belongs, you can use either a naming
  8369. convention or `#pragma implementation' to indicate this alternate use
  8370. of the header file.
  8371.  
  8372. `#pragma interface'
  8373.      Use this directive in *header files* that define object classes,
  8374.      to save space in most of the object files that use those classes.
  8375.      Normally, local copies of certain information (backup copies of
  8376.      inline member functions, debugging information, and the internal
  8377.      tables that implement virtual functions) must be kept in each
  8378.      object file that includes class definitions.  You can use this
  8379.      pragma to avoid such duplication.  When a header file containing
  8380.      `#pragma interface' is included in a compilation, this auxiliary
  8381.      information will not be generated (unless the main input source
  8382.      file itself uses `#pragma implementation').  Instead, the object
  8383.      files will contain references to be resolved at link time.
  8384.  
  8385. `#pragma implementation'
  8386. `#pragma implementation "OBJECTS.h"'
  8387.      Use this pragma in a *main input file*, when you want full output
  8388.      from included header files to be generated (and made globally
  8389.      visible).  The included header file, in turn, should use `#pragma
  8390.      interface'.  Backup copies of inline member functions, debugging
  8391.      information, and the internal tables used to implement virtual
  8392.      functions are all generated in implementation files.
  8393.  
  8394.      `#pragma implementation' is *implied* whenever the basename(1) of
  8395.      your source file matches the basename of a header file it
  8396.      includes.  There is no way to turn this off (other than using a
  8397.      different name for one of the two files).  In the same vein, if
  8398.      you use `#pragma implementation' with no argument, it applies to an
  8399.      include file with the same basename as your source file.  For
  8400.      example, in `allclass.cc', `#pragma implementation' by itself is
  8401.      equivalent to `#pragma implementation "allclass.h"'; but even if
  8402.      you do not say `#pragma implementation' at all, `allclass.h' is
  8403.      treated as an implementation file whenever you include it from
  8404.      `allclass.cc'.
  8405.  
  8406.      If you use an explicit `#pragma implementation', it must appear in
  8407.      your source file *before* you include the affected header files.
  8408.  
  8409.      Use the string argument if you want a single implementation file to
  8410.      include code from multiple header files.  (You must also use
  8411.      `#include' to include the header file; `#pragma implementation'
  8412.      only specifies how to use the file--it doesn't actually include
  8413.      it.)
  8414.  
  8415.      There is no way to split up the contents of a single header file
  8416.      into multiple implementation files.
  8417.  
  8418.    `#pragma implementation' and `#pragma interface' also have an effect
  8419. on function inlining.
  8420.  
  8421.    If you define a class in a header file marked with `#pragma
  8422. interface', the effect on a function defined in that class is similar to
  8423. an explicit `extern' declaration--the compiler emits no code at all to
  8424. define an independent version of the function.  Its definition is used
  8425. only for inlining with its callers.
  8426.  
  8427.    Conversely, when you include the same header file in a main source
  8428. file that declares it as `#pragma implementation', the compiler emits
  8429. code for the function itself; this defines a version of the function
  8430. that can be found via pointers (or by callers compiled without
  8431. inlining).
  8432.  
  8433.    ---------- Footnotes ----------
  8434.  
  8435.    (1)  A file's "basename" is the name stripped of all leading path
  8436. information and of trailing suffixes, such as `.h' or `.C' or `.cc'.
  8437.  
  8438. 
  8439. File: @.Distr.UsingGCC,  Node: Trouble,  Next: Bugs,  Prev: C++ Extensions,  Up: Top
  8440.  
  8441. Known Causes of Trouble with GNU CC
  8442. ***********************************
  8443.  
  8444.    This section describes known problems that affect users of GNU CC.
  8445. Most of these are not GNU CC bugs per se--if they were, we would fix
  8446. them.  But the result for a user may be like the result of a bug.
  8447.  
  8448.    Some of these problems are due to bugs in other software, some are
  8449. missing features that are too much work to add, and some are places
  8450. where people's opinions differ as to what is best.
  8451.  
  8452. * Menu:
  8453.  
  8454. * Actual Bugs::              Bugs we will fix later.
  8455. * Installation Problems::     Problems that manifest when you install GNU CC.
  8456. * Cross-Compiler Problems::   Common problems of cross compiling with GNU CC.
  8457. * Interoperation::      Problems using GNU CC with other compilers,
  8458.                and with certain linkers, assemblers and debuggers.
  8459. * External Bugs::    Problems compiling certain programs.
  8460. * Incompatibilities::   GNU CC is incompatible with traditional C.
  8461. * Disappointments::     Regrettable things we can't change, but not quite bugs.
  8462. * C++ Misunderstandings::     Common misunderstandings with GNU C++.
  8463. * Protoize Caveats::    Things to watch out for when using `protoize'.
  8464. * Non-bugs::        Things we think are right, but some others disagree.
  8465. * Warnings and Errors:: Which problems in your code get warnings,
  8466.                          and which get errors.
  8467.  
  8468. 
  8469. File: @.Distr.UsingGCC,  Node: Actual Bugs,  Next: Installation Problems,  Up: Trouble
  8470.  
  8471. Actual Bugs We Haven't Fixed Yet
  8472. ================================
  8473.  
  8474.    * The `fixincludes' script interacts badly with automounters; if the
  8475.      directory of system header files is automounted, it tends to be
  8476.      unmounted while `fixincludes' is running.  This would seem to be a
  8477.      bug in the automounter.  We don't know any good way to work around
  8478.      it.
  8479.  
  8480.    * Loop unrolling doesn't work properly for certain C++ programs.
  8481.      This is because of difficulty in updating the debugging
  8482.      information within the loop being unrolled.  We plan to revamp the
  8483.      representation of debugging information so that this will work
  8484.      properly, but we have not done this in version 2.4 because we
  8485.      don't want to delay it any further.
  8486.  
  8487. 
  8488. File: @.Distr.UsingGCC,  Node: Installation Problems,  Next: Cross-Compiler Problems,  Prev: Actual Bugs,  Up: Trouble
  8489.  
  8490. Installation Problems
  8491. =====================
  8492.  
  8493.    This is a list of problems (and some apparent problems which don't
  8494. really mean anything is wrong) that show up during installation of GNU
  8495. CC.
  8496.  
  8497.    * On certain systems, defining certain environment variables such as
  8498.      `CC' can interfere with the functioning of `make'.
  8499.  
  8500.    * If you encounter seemingly strange errors when trying to build the
  8501.      compiler in a directory other than the source directory, it could
  8502.      be because you have previously configured the compiler in the
  8503.      source directory.  Make sure you have done all the necessary
  8504.      preparations.  *Note Other Dir::.
  8505.  
  8506.    * In previous versions of GNU CC, the `gcc' driver program looked for
  8507.      `as' and `ld' in various places; for example, in files beginning
  8508.      with `/usr/local/lib/gcc-'.  GNU CC version 2 looks for them in
  8509.      the directory `/usr/local/lib/gcc-lib/TARGET/VERSION'.
  8510.  
  8511.      Thus, to use a version of `as' or `ld' that is not the system
  8512.      default, for example `gas' or GNU `ld', you must put them in that
  8513.      directory (or make links to them from that directory).
  8514.  
  8515.    * Some commands executed when making the compiler may fail (return a
  8516.      non-zero status) and be ignored by `make'.  These failures, which
  8517.      are often due to files that were not found, are expected, and can
  8518.      safely be ignored.
  8519.  
  8520.    * It is normal to have warnings in compiling certain files about
  8521.      unreachable code and about enumeration type clashes.  These files'
  8522.      names begin with `insn-'.  Also, `real.c' may get some warnings
  8523.      that you can ignore.
  8524.  
  8525.    * Sometimes `make' recompiles parts of the compiler when installing
  8526.      the compiler.  In one case, this was traced down to a bug in
  8527.      `make'.  Either ignore the problem or switch to GNU Make.
  8528.  
  8529.    * If you have installed a program known as purify, you may find that
  8530.      it causes errors while linking `enquire', which is part of building
  8531.      GNU CC.  The fix is to get rid of the file `real-ld' which purify
  8532.      installs--so that GNU CC won't try to use it.
  8533.  
  8534.    * On Linux SLS 1.01, there is a problem with `libc.a': it does not
  8535.      contain the obstack functions.  However, GNU CC assumes that the
  8536.      obstack functions are in `libc.a' when it is the GNU C library.
  8537.      To work around this problem, change the `__GNU_LIBRARY__'
  8538.      conditional around line 31 to `#if 1'.
  8539.  
  8540.    * On some 386 systems, building the compiler never finishes because
  8541.      `enquire' hangs due to a hardware problem in the motherboard--it
  8542.      reports floating point exceptions to the kernel incorrectly.  You
  8543.      can install GNU CC except for `float.h' by patching out the
  8544.      command to run `enquire'.  You may also be able to fix the problem
  8545.      for real by getting a replacement motherboard.  This problem was
  8546.      observed in Revision E of the Micronics motherboard, and is fixed
  8547.      in Revision F.
  8548.  
  8549.    * On some 386 systems, GNU CC crashes trying to compile `enquire.c'.
  8550.      This happens on machines that don't have a 387 FPU chip.  On 386
  8551.      machines, the system kernel is supposed to emulate the 387 when you
  8552.      don't have one.  The crash is due to a bug in the emulator.
  8553.  
  8554.      One of these systems is the Unix from Interactive Systems: 386/ix.
  8555.      On this system, an alternate emulator is provided, and it does
  8556.      work.  To use it, execute this command as super-user:
  8557.  
  8558.           ln /etc/emulator.rel1 /etc/emulator
  8559.  
  8560.      and then reboot the system.  (The default emulator file remains
  8561.      present under the name `emulator.dflt'.)
  8562.  
  8563.      Try using `/etc/emulator.att', if you have such a problem on the
  8564.      SCO system.
  8565.  
  8566.      Another system which has this problem is Esix.  We don't know
  8567.      whether it has an alternate emulator that works.
  8568.  
  8569.      On NetBSD 0.8, a similar problem manifests itself as these error
  8570.      messages:
  8571.  
  8572.           enquire.c: In function `fprop':
  8573.           enquire.c:2328: floating overflow
  8574.  
  8575.    * Sometimes on a Sun 4 you may observe a crash in the program
  8576.      `genflags' or `genoutput' while building GNU CC.  This is said to
  8577.      be due to a bug in `sh'.  You can probably get around it by running
  8578.      `genflags' or `genoutput' manually and then retrying the `make'.
  8579.  
  8580.    * On Solaris 2, executables of GNU CC version 2.0.2 are commonly
  8581.      available, but they have a bug that shows up when compiling current
  8582.      versions of GNU CC: undefined symbol errors occur during assembly
  8583.      if you use `-g'.
  8584.  
  8585.      The solution is to compile the current version of GNU CC without
  8586.      `-g'.  That makes a working compiler which you can use to recompile
  8587.      with `-g'.
  8588.  
  8589.    * Solaris 2 comes with a number of optional OS packages.  Six of
  8590.      these packages are needed to use GNU CC fully.  If you did not
  8591.      install all optional packages when installing Solaris, you will
  8592.      need to verify that these six packages are installed.
  8593.  
  8594.      The six packages that GNU CC needs are: `SUNWarc', `SUNWbtool',
  8595.      `SUNWesu', `SUNWhea', `SUNWlibm', and `SUNWtoo'.  To check whether
  8596.      an optional package is installed, use the `pkginfo' command.  To
  8597.      add an optional package, use the `pkgadd' command.  For further
  8598.      details, see the Solaris documentation.
  8599.  
  8600.    * On Solaris 2, trying to use the linker and other tools in
  8601.      `/usr/ucb' to install GNU CC has been observed to cause trouble.
  8602.      For example, the linker may hang indefinitely.  The fix is to
  8603.      remove `/usr/ucb' from your `PATH'.
  8604.  
  8605.    * If you use the 1.31 version of the MIPS assembler (such as was
  8606.      shipped with Ultrix 3.1), you will need to use the
  8607.      -fno-delayed-branch switch when optimizing floating point code.
  8608.      Otherwise, the assembler will complain when the GCC compiler fills
  8609.      a branch delay slot with a floating point instruction, such as
  8610.      add.d.
  8611.  
  8612.    * If on a MIPS system you get an error message saying "does not have
  8613.      gp sections for all it's [sic] sectons [sic]", don't worry about
  8614.      it.  This happens whenever you use GAS with the MIPS linker, but
  8615.      there is not really anything wrong, and it is okay to use the
  8616.      output file.  You can stop such warnings by installing the GNU
  8617.      linker.
  8618.  
  8619.      It would be nice to extend GAS to produce the gp tables, but they
  8620.      are optional, and there should not be a warning about their
  8621.      absence.
  8622.  
  8623.    * Users have reported some problems with version 2.0 of the MIPS
  8624.      compiler tools that were shipped with Ultrix 4.1.  Version 2.10
  8625.      which came with Ultrix 4.2 seems to work fine.
  8626.  
  8627.    * Some versions of the MIPS linker will issue an assertion failure
  8628.      when linking code that uses `alloca' against shared libraries on
  8629.      RISC-OS 5.0, and DEC's OSF/1 systems.  This is a bug in the
  8630.      linker, that is supposed to be fixed in future revisions.  To
  8631.      protect against this, GCC passes `-non_shared' to the linker
  8632.      unless you pass an explicit `-shared' or `-call_shared' switch.
  8633.  
  8634.    * On System V release 3, you may get this error message while
  8635.      linking:
  8636.  
  8637.           ld fatal: failed to write symbol name SOMETHING
  8638.            in strings table for file WHATEVER
  8639.  
  8640.      This probably indicates that the disk is full or your ULIMIT won't
  8641.      allow the file to be as large as it needs to be.
  8642.  
  8643.      This problem can also result because the kernel parameter `MAXUMEM'
  8644.      is too small.  If so, you must regenerate the kernel and make the
  8645.      value much larger.  The default value is reported to be 1024; a
  8646.      value of 32768 is said to work.  Smaller values may also work.
  8647.  
  8648.    * On System V, if you get an error like this,
  8649.  
  8650.           /usr/local/lib/bison.simple: In function `yyparse':
  8651.           /usr/local/lib/bison.simple:625: virtual memory exhausted
  8652.  
  8653.      that too indicates a problem with disk space, ULIMIT, or `MAXUMEM'.
  8654.  
  8655.    * Current GNU CC versions probably do not work on version 2 of the
  8656.      NeXT operating system.
  8657.  
  8658.    * On the Tower models 4N0 and 6N0, by default a process is not
  8659.      allowed to have more than one megabyte of memory.  GNU CC cannot
  8660.      compile itself (or many other programs) with `-O' in that much
  8661.      memory.
  8662.  
  8663.      To solve this problem, reconfigure the kernel adding the following
  8664.      line to the configuration file:
  8665.  
  8666.           MAXUMEM = 4096
  8667.  
  8668.    * On HP 9000 series 300 or 400 running HP-UX release 8.0, there is a
  8669.      bug in the assembler that must be fixed before GNU CC can be
  8670.      built.  This bug manifests itself during the first stage of
  8671.      compilation, while building `libgcc2.a':
  8672.  
  8673.           _floatdisf
  8674.           cc1: warning: `-g' option not supported on this version of GCC
  8675.           cc1: warning: `-g1' option not supported on this version of GCC
  8676.           ./xgcc: Internal compiler error: program as got fatal signal 11
  8677.  
  8678.      A patched version of the assembler is available by anonymous ftp
  8679.      from `altdorf.ai.mit.edu' as the file
  8680.      `archive/cph/hpux-8.0-assembler'.  If you have HP software support,
  8681.      the patch can also be obtained directly from HP, as described in
  8682.      the following note:
  8683.  
  8684.           This is the patched assembler, to patch SR#1653-010439, where
  8685.           the assembler aborts on floating point constants.
  8686.  
  8687.           The bug is not really in the assembler, but in the shared
  8688.           library version of the function "cvtnum(3c)".  The bug on
  8689.           "cvtnum(3c)" is SR#4701-078451.  Anyway, the attached
  8690.           assembler uses the archive library version of "cvtnum(3c)"
  8691.           and thus does not exhibit the bug.
  8692.  
  8693.      This patch is also known as PHCO_0800.
  8694.  
  8695.    * To build GCC for HP PA model 1.1 machines running HP-UX versions
  8696.      earlier than 8.07, you have to configure for HP PA model 1.0.
  8697.      This is because a bug in the PA configuration that probably will
  8698.      be fixed in the next release of the compiler.
  8699.  
  8700.    * On HP-UX version 9.01 on the HP PA, the HP compiler `cc' does not
  8701.      compile GNU CC correctly.  We do not yet know why.  However, GNU CC
  8702.      compiled on earlier HP-UX versions works properly on HP-UX 9.01
  8703.      and can compile itself properly on 9.01.
  8704.  
  8705.    * Another assembler problem on the HP PA results in an error message
  8706.      like this while compiling part of `libgcc2.a':
  8707.  
  8708.           as: /usr/tmp/cca08196.s @line#30 [err#1060]
  8709.             Argument 1 or 3 in FARG upper
  8710.                    - lookahead = RTNVAL=GR
  8711.  
  8712.      This happens because HP changed the assembler syntax after system
  8713.      release 8.02.  GNU CC assumes the newer syntax; if your assembler
  8714.      wants the older syntax, comment out this line in the file
  8715.      `pa1-hpux.h':
  8716.  
  8717.           #define HP_FP_ARG_DESCRIPTOR_REVERSED
  8718.  
  8719.    * Some versions of the Pyramid C compiler are reported to be unable
  8720.      to compile GNU CC.  You must use an older version of GNU CC for
  8721.      bootstrapping.  One indication of this problem is if you get a
  8722.      crash when GNU CC compiles the function `muldi3' in file
  8723.      `libgcc2.c'.
  8724.  
  8725.      You may be able to succeed by getting GNU CC version 1, installing
  8726.      it, and using it to compile GNU CC version 2.  The bug in the
  8727.      Pyramid C compiler does not seem to affect GNU CC version 1.
  8728.  
  8729.    * There may be similar problems on System V Release 3.1 on 386
  8730.      systems.
  8731.  
  8732.    * On the Altos 3068, programs compiled with GNU CC won't work unless
  8733.      you fix a kernel bug.  This happens using system versions V.2.2
  8734.      1.0gT1 and V.2.2 1.0e and perhaps later versions as well.  See the
  8735.      file `README.ALTOS'.
  8736.  
  8737.    * You will get several sorts of compilation and linking errors on the
  8738.      we32k if you don't follow the special instructions.  *Note WE32K
  8739.      Install::.
  8740.  
  8741. 
  8742. File: @.Distr.UsingGCC,  Node: Cross-Compiler Problems,  Next: Interoperation,  Prev: Installation Problems,  Up: Trouble
  8743.  
  8744. Cross-Compiler Problems
  8745. =======================
  8746.  
  8747.    You may run into problems with cross compilation on certain machines,
  8748. for several reasons.
  8749.  
  8750.    * Cross compilation can run into trouble for certain machines because
  8751.      some target machines' assemblers require floating point numbers to
  8752.      be written as *integer* constants in certain contexts.
  8753.  
  8754.      The compiler writes these integer constants by examining the
  8755.      floating point value as an integer and printing that integer,
  8756.      because this is simple to write and independent of the details of
  8757.      the floating point representation.  But this does not work if the
  8758.      compiler is running on a different machine with an incompatible
  8759.      floating point format, or even a different byte-ordering.
  8760.  
  8761.      In addition, correct constant folding of floating point values
  8762.      requires representing them in the target machine's format.  (The C
  8763.      standard does not quite require this, but in practice it is the
  8764.      only way to win.)
  8765.  
  8766.      It is now possible to overcome these problems by defining macros
  8767.      such as `REAL_VALUE_TYPE'.  But doing so is a substantial amount of
  8768.      work for each target machine.  *Note Cross Compilation and
  8769.      Floating Point Format: (gcc.info)Cross-compilation.
  8770.  
  8771.    * At present, the program `mips-tfile' which adds debug support to
  8772.      object files on MIPS systems does not work in a cross compile
  8773.      environment.
  8774.  
  8775. 
  8776. File: @.Distr.UsingGCC,  Node: Interoperation,  Next: External Bugs,  Prev: Cross-Compiler Problems,  Up: Trouble
  8777.  
  8778. Interoperation
  8779. ==============
  8780.  
  8781.    This section lists various difficulties encountered in using GNU C or
  8782. GNU C++ together with other compilers or with the assemblers, linkers,
  8783. libraries and debuggers on certain systems.
  8784.  
  8785.    * If you are using version 2.3 of libg++, you need to rebuild it with
  8786.      `make CC=gcc' to avoid mismatches in the definition of `size_t'.
  8787.  
  8788.    * Objective C does not work on the RS/6000, the Alpha, or the HP PA.
  8789.  
  8790.    * C++ does not work on the Alpha.
  8791.  
  8792.    * GNU C++ does not do name mangling in the same way as other C++
  8793.      compilers.  This means that object files compiled with one compiler
  8794.      cannot be used with another.
  8795.  
  8796.      This effect is intentional, to protect you from more subtle
  8797.      problems.  Compilers differ as to many internal details of C++
  8798.      implementation, including: how class instances are laid out, how
  8799.      multiple inheritance is implemented, and how virtual function
  8800.      calls are handled.  If the name encoding were made the same, your
  8801.      programs would link against libraries provided from other
  8802.      compilers--but the programs would then crash when run.
  8803.      Incompatible libraries are then detected at link time, rather than
  8804.      at run time.
  8805.  
  8806.    * Older GDB versions sometimes fail to read the output of GNU CC
  8807.      version 2.  If you have trouble, get GDB version 4.4 or later.
  8808.  
  8809.    * DBX rejects some files produced by GNU CC, though it accepts
  8810.      similar constructs in output from PCC.  Until someone can supply a
  8811.      coherent description of what is valid DBX input and what is not,
  8812.      there is nothing I can do about these problems.  You are on your
  8813.      own.
  8814.  
  8815.    * The GNU assembler (GAS) does not support PIC.  To generate PIC
  8816.      code, you must use some other assembler, such as `/bin/as'.
  8817.  
  8818.    * On some BSD systems including some versions of Ultrix, use of
  8819.      profiling causes static variable destructors (currently used only
  8820.      in C++) not to be run.
  8821.  
  8822.    * Use of `-I/usr/include' may cause trouble.
  8823.  
  8824.      Many systems come with header files that won't work with GNU CC
  8825.      unless corrected by `fixincludes'.  The corrected header files go
  8826.      in a new directory; GNU CC searches this directory before
  8827.      `/usr/include'.  If you use `-I/usr/include', this tells GNU CC to
  8828.      search `/usr/include' earlier on, before the corrected headers.
  8829.      The result is that you get the uncorrected header files.
  8830.  
  8831.      Instead, you should use these options (when compiling C programs):
  8832.  
  8833.           -I/usr/local/lib/gcc-lib/TARGET/VERSION/include -I/usr/include
  8834.  
  8835.      For C++ programs, GNU CC also uses a special directory that
  8836.      defines C++ interfaces to standard C subroutines.  This directory
  8837.      is meant to be searched *before* other standard include
  8838.      directories, so that it takes precedence.  If you are compiling
  8839.      C++ programs and specifying include directories explicitly, use
  8840.      this option first, then the two options above:
  8841.  
  8842.           -I/usr/local/lib/g++-include
  8843.  
  8844.    * On a Sparc, GNU CC aligns all values of type `double' on an 8-byte
  8845.      boundary, and it expects every `double' to be so aligned.  The Sun
  8846.      compiler usually gives `double' values 8-byte alignment, with one
  8847.      exception: function arguments of type `double' may not be aligned.
  8848.  
  8849.      As a result, if a function compiled with Sun CC takes the address
  8850.      of an argument of type `double' and passes this pointer of type
  8851.      `double *' to a function compiled with GNU CC, dereferencing the
  8852.      pointer may cause a fatal signal.
  8853.  
  8854.      One way to solve this problem is to compile your entire program
  8855.      with GNU CC.  Another solution is to modify the function that is
  8856.      compiled with Sun CC to copy the argument into a local variable;
  8857.      local variables are always properly aligned.  A third solution is
  8858.      to modify the function that uses the pointer to dereference it via
  8859.      the following function `access_double' instead of directly with
  8860.      `*':
  8861.  
  8862.           inline double
  8863.           access_double (double *unaligned_ptr)
  8864.           {
  8865.             union d2i { double d; int i[2]; };
  8866.           
  8867.             union d2i *p = (union d2i *) unaligned_ptr;
  8868.             union d2i u;
  8869.           
  8870.             u.i[0] = p->i[0];
  8871.             u.i[1] = p->i[1];
  8872.           
  8873.             return u.d;
  8874.           }
  8875.  
  8876.      Storing into the pointer can be done likewise with the same union.
  8877.  
  8878.    * On Solaris, the `malloc' function in the `libmalloc.a' library may
  8879.      allocate memory that is only 4 byte aligned.  Since GNU CC on the
  8880.      Sparc assumes that doubles are 8 byte aligned, this may result in a
  8881.      fatal signal if doubles are stored in memory allocated by the
  8882.      `libmalloc.a' library.
  8883.  
  8884.      The solution is to not use the `libmalloc.a' library.  Use instead
  8885.      `malloc' and related functions from `libc.a'; they do not have
  8886.      this problem.
  8887.  
  8888.    * On a Sun, linking using GNU CC fails to find a shared library and
  8889.      reports that the library doesn't exist at all.
  8890.  
  8891.      This happens if you are using the GNU linker, because it does only
  8892.      static linking and looks only for unshared libraries.  If you have
  8893.      a shared library with no unshared counterpart, the GNU linker
  8894.      won't find anything.
  8895.  
  8896.      We hope to make a linker which supports Sun shared libraries, but
  8897.      please don't ask when it will be finished--we don't know.
  8898.  
  8899.    * Sun forgot to include a static version of `libdl.a' with some
  8900.      versions of SunOS (mainly 4.1).  This results in undefined symbols
  8901.      when linking static binaries (that is, if you use `-static').  If
  8902.      you see undefined symbols `_dlclose', `_dlsym' or `_dlopen' when
  8903.      linking, compile and link against the file `mit/util/misc/dlsym.c'
  8904.      from the MIT version of X windows.
  8905.  
  8906.    * On the HP PA machine, ADB sometimes fails to work on functions
  8907.      compiled with GNU CC.  Specifically, it fails to work on functions
  8908.      that use `alloca' or variable-size arrays.  This is because GNU CC
  8909.      doesn't generate HP-UX unwind descriptors for such functions.  It
  8910.      may even be impossible to generate them.
  8911.  
  8912.    * Debugging (`-g') is not supported on the HP PA machine, unless you
  8913.      use the preliminary GNU tools (*note Installation::.).
  8914.  
  8915.    * The HP-UX linker has a bug which can cause programs which make use
  8916.      of `const' variables to fail in unusual ways.  If your program
  8917.      makes use of global `const' variables, we suggest you compile with
  8918.      the following additional options:
  8919.  
  8920.           -Dconst="" -D__const="" -D__const__="" -fwritable-strings
  8921.  
  8922.      This will force the `const' variables into the DATA subspace which
  8923.      will avoid the linker bug.
  8924.  
  8925.      Another option you can use to work around this problem is
  8926.      `-mkernel'.  This changes how the address of variables is computed
  8927.      to a sequence less likely to tickle the HP-UX linker bug.
  8928.  
  8929.      We hope to work around this problem in a later version, if HP does
  8930.      not fix it.
  8931.  
  8932.    * Taking the address of a label may generate errors from the HP-UX
  8933.      PA assembler.  GAS for the PA does not have this problem.
  8934.  
  8935.    * GNU CC produced code will not yet link against HP-UX 8.0 shared
  8936.      libraries.  We expect to fix this problem in GNU CC 2.4.
  8937.  
  8938.    * GNU CC compiled code sometimes emits warnings from the HP-UX
  8939.      assembler of the form:
  8940.  
  8941.           (warning) Use of GR3 when
  8942.             frame >= 8192 may cause conflict.
  8943.  
  8944.      These warnings are harmless and can be safely ignored.
  8945.  
  8946.    * The current version of the assembler (`/bin/as') for the RS/6000
  8947.      has certain problems that prevent the `-g' option in GCC from
  8948.      working.  Note that `Makefile.in' uses `-g' by default when
  8949.      compiling `libgcc2.c'.
  8950.  
  8951.      IBM has produced a fixed version of the assembler.  The upgraded
  8952.      assembler unfortunately was not included in any of the AIX 3.2
  8953.      update PTF releases (3.2.2, 3.2.3, or 3.2.3e).  Users of AIX 3.1
  8954.      should request PTF U403044 from IBM and users of AIX 3.2 should
  8955.      request PTF U416277.  See the file `README.RS6000' for more
  8956.      details on these updates.
  8957.  
  8958.      You can test for the presense of a fixed assembler by using the
  8959.      command
  8960.  
  8961.           as -u < /dev/null
  8962.  
  8963.      If the command exits normally, the assembler fix already is
  8964.      installed.  If the assembler complains that "-u" is an unknown
  8965.      flag, you need to order the fix.
  8966.  
  8967.    * On the IBM RS/6000, compiling code of the form
  8968.  
  8969.           extern int foo;
  8970.           
  8971.           ... foo ...
  8972.           
  8973.           static int foo;
  8974.  
  8975.      will cause the linker to report an undefined symbol `foo'.
  8976.      Although this behavior differs from most other systems, it is not a
  8977.      bug because redefining an `extern' variable as `static' is
  8978.      undefined in ANSI C.
  8979.  
  8980.    * AIX on the RS/6000 provides support (NLS) for environments outside
  8981.      of the United States.  Compilers and assemblers use NLS to support
  8982.      locale-specific representations of various objects including
  8983.      floating-point numbers ("." vs "," for separating decimal
  8984.      fractions).  There have been problems reported where the library
  8985.      linked with GCC does not produce the same floating-point formats
  8986.      that the assembler accepts.  If you have this problem, set the
  8987.      LANG environment variable to "C" or "En_US".
  8988.  
  8989.    * There is an assembler bug in versions of DG/UX prior to 5.4.2.01
  8990.      that occurs when the `fldcr' instruction is used.  GNU CC uses
  8991.      `fldcr' on the 88100 to serialize volatile memory references.  Use
  8992.      the option `-fno-serialize-volatile' if your version of the
  8993.      assembler has this bug.
  8994.  
  8995.    * On VMS, GAS versions 1.38.1 and earlier may cause spurious warning
  8996.      messages from the linker.  These warning messages complain of
  8997.      mismatched psect attributes.  You can ignore them.  *Note VMS
  8998.      Install::.
  8999.  
  9000.    * On NewsOS version 3, if you include both of the files `stddef.h'
  9001.      and `sys/types.h', you get an error because there are two typedefs
  9002.      of `size_t'.  You should change `sys/types.h' by adding these
  9003.      lines around the definition of `size_t':
  9004.  
  9005.           #ifndef _SIZE_T
  9006.           #define _SIZE_T
  9007.           ACTUAL TYPEDEF HERE
  9008.           #endif
  9009.  
  9010.    * On the Alliant, the system's own convention for returning
  9011.      structures and unions is unusual, and is not compatible with GNU
  9012.      CC no matter what options are used.
  9013.  
  9014.    * On the IBM RT PC, the MetaWare HighC compiler (hc) uses a different
  9015.      convention for structure and union returning.  Use the option
  9016.      `-mhc-struct-return' to tell GNU CC to use a convention compatible
  9017.      with it.
  9018.  
  9019.    * On Ultrix, the Fortran compiler expects registers 2 through 5 to
  9020.      be saved by function calls.  However, the C compiler uses
  9021.      conventions compatible with BSD Unix: registers 2 through 5 may be
  9022.      clobbered by function calls.
  9023.  
  9024.      GNU CC uses the same convention as the Ultrix C compiler.  You can
  9025.      use these options to produce code compatible with the Fortran
  9026.      compiler:
  9027.  
  9028.           -fcall-saved-r2 -fcall-saved-r3 -fcall-saved-r4 -fcall-saved-r5
  9029.  
  9030.    * On the WE32k, you may find that programs compiled with GNU CC do
  9031.      not work with the standard shared C ilbrary.  You may need to link
  9032.      with the ordinary C compiler.  If you do so, you must specify the
  9033.      following options:
  9034.  
  9035.           -L/usr/local/lib/gcc-lib/we32k-att-sysv/2.4 -lgcc -lc_s
  9036.  
  9037.      The first specifies where to find the library `libgcc.a' specified
  9038.      with the `-lgcc' option.
  9039.  
  9040.      GNU CC does linking by invoking `ld', just as `cc' does, and there
  9041.      is no reason why it *should* matter which compilation program you
  9042.      use to invoke `ld'.  If someone tracks this problem down, it can
  9043.      probably be fixed easily.
  9044.  
  9045.    * On the Alpha, you may get assembler errors about invalid syntax as
  9046.      a result of floating point constants.  This is due to a bug in the
  9047.      C library functions `ecvt', `fcvt' and `gcvt'.  Given valid
  9048.      floating point numbers, they sometimes print `NaN'.
  9049.  
  9050.    * On Irix 4.0.5F (and perhaps in some other versions), an assembler
  9051.      bug sometimes reorders instructions incorrectly when optimization
  9052.      is turned on.  If you think this may be happening to you, try
  9053.      using the GNU assembler; GAS version 2.1 supports ECOFF on Irix.
  9054.  
  9055.      Or use the `-noasmopt' option when you compile GNU CC with itself,
  9056.      and then again when you compile your program.  (This is a temporary
  9057.      kludge to turn off assembler optimization on Irix.)  If this
  9058.      proves to be what you need, edit the assembler spec in the file
  9059.      `specs' so that it unconditionally passes `-O0' to the assembler,
  9060.      and never passes `-O2' or `-O3'.
  9061.  
  9062. 
  9063. File: @.Distr.UsingGCC,  Node: External Bugs,  Next: Incompatibilities,  Prev: Interoperation,  Up: Trouble
  9064.  
  9065. Problems Compiling Certain Programs
  9066. ===================================
  9067.  
  9068.    * Parse errors may occur compiling X11 on a Decstation running
  9069.      Ultrix 4.2 because of problems in DEC's versions of the X11 header
  9070.      files `X11/Xlib.h' and `X11/Xutil.h'.  People recommend adding
  9071.      `-I/usr/include/mit' to use the MIT versions of the header files,
  9072.      using the `-traditional' switch to turn off ANSI C, or fixing the
  9073.      header files by adding this:
  9074.  
  9075.           #ifdef __STDC__
  9076.           #define NeedFunctionPrototypes 0
  9077.           #endif
  9078.  
  9079.    * On various 386 Unix systems derived from System V, including SCO,
  9080.      ISC, and ESIX, you may get error messages about running out of
  9081.      virtual memory while compiling certain programs.
  9082.  
  9083.      You can prevent this problem by linking GNU CC with the GNU malloc
  9084.      (which thus replaces the malloc that comes with the system).  GNU
  9085.      malloc is available as a separate package, and also in the file
  9086.      `src/gmalloc.c' in the GNU Emacs 19 distribution.
  9087.  
  9088.      If you have installed GNU malloc as a separate library package,
  9089.      use this option when you relink GNU CC:
  9090.  
  9091.           MALLOC=/usr/local/lib/libgmalloc.a
  9092.  
  9093.      Alternatively, if you have compiled `gmalloc.c' from Emacs 19, copy
  9094.      the object file to `gmalloc.o' and use this option when you relink
  9095.      GNU CC:
  9096.  
  9097.           MALLOC=gmalloc.o
  9098.  
  9099. 
  9100. File: @.Distr.UsingGCC,  Node: Incompatibilities,  Next: Disappointments,  Prev: External Bugs,  Up: Trouble
  9101.  
  9102. Incompatibilities of GNU CC
  9103. ===========================
  9104.  
  9105.    There are several noteworthy incompatibilities between GNU C and most
  9106. existing (non-ANSI) versions of C.  The `-traditional' option
  9107. eliminates many of these incompatibilities, *but not all*, by telling
  9108. GNU C to behave like the other C compilers.
  9109.  
  9110.    * GNU CC normally makes string constants read-only.  If several
  9111.      identical-looking string constants are used, GNU CC stores only one
  9112.      copy of the string.
  9113.  
  9114.      One consequence is that you cannot call `mktemp' with a string
  9115.      constant argument.  The function `mktemp' always alters the string
  9116.      its argument points to.
  9117.  
  9118.      Another consequence is that `sscanf' does not work on some systems
  9119.      when passed a string constant as its format control string or
  9120.      input.  This is because `sscanf' incorrectly tries to write into
  9121.      the string constant.  Likewise `fscanf' and `scanf'.
  9122.  
  9123.      The best solution to these problems is to change the program to use
  9124.      `char'-array variables with initialization strings for these
  9125.      purposes instead of string constants.  But if this is not possible,
  9126.      you can use the `-fwritable-strings' flag, which directs GNU CC to
  9127.      handle string constants the same way most C compilers do.
  9128.      `-traditional' also has this effect, among others.
  9129.  
  9130.    * `-2147483648' is positive.
  9131.  
  9132.      This is because 2147483648 cannot fit in the type `int', so
  9133.      (following the ANSI C rules) its data type is `unsigned long int'.
  9134.      Negating this value yields 2147483648 again.
  9135.  
  9136.    * GNU CC does not substitute macro arguments when they appear inside
  9137.      of string constants.  For example, the following macro in GNU CC
  9138.  
  9139.           #define foo(a) "a"
  9140.  
  9141.      will produce output `"a"' regardless of what the argument A is.
  9142.  
  9143.      The `-traditional' option directs GNU CC to handle such cases
  9144.      (among others) in the old-fashioned (non-ANSI) fashion.
  9145.  
  9146.    * When you use `setjmp' and `longjmp', the only automatic variables
  9147.      guaranteed to remain valid are those declared `volatile'.  This is
  9148.      a consequence of automatic register allocation.  Consider this
  9149.      function:
  9150.  
  9151.           jmp_buf j;
  9152.           
  9153.           foo ()
  9154.           {
  9155.             int a, b;
  9156.           
  9157.             a = fun1 ();
  9158.             if (setjmp (j))
  9159.               return a;
  9160.           
  9161.             a = fun2 ();
  9162.             /* `longjmp (j)' may occur in `fun3'. */
  9163.             return a + fun3 ();
  9164.           }
  9165.  
  9166.      Here `a' may or may not be restored to its first value when the
  9167.      `longjmp' occurs.  If `a' is allocated in a register, then its
  9168.      first value is restored; otherwise, it keeps the last value stored
  9169.      in it.
  9170.  
  9171.      If you use the `-W' option with the `-O' option, you will get a
  9172.      warning when GNU CC thinks such a problem might be possible.
  9173.  
  9174.      The `-traditional' option directs GNU C to put variables in the
  9175.      stack by default, rather than in registers, in functions that call
  9176.      `setjmp'.  This results in the behavior found in traditional C
  9177.      compilers.
  9178.  
  9179.    * Programs that use preprocessor directives in the middle of macro
  9180.      arguments do not work with GNU CC.  For example, a program like
  9181.      this will not work:
  9182.  
  9183.           foobar (
  9184.           #define luser
  9185.                   hack)
  9186.  
  9187.      ANSI C does not permit such a construct.  It would make sense to
  9188.      support it when `-traditional' is used, but it is too much work to
  9189.      implement.
  9190.  
  9191.    * Declarations of external variables and functions within a block
  9192.      apply only to the block containing the declaration.  In other
  9193.      words, they have the same scope as any other declaration in the
  9194.      same place.
  9195.  
  9196.      In some other C compilers, a `extern' declaration affects all the
  9197.      rest of the file even if it happens within a block.
  9198.  
  9199.      The `-traditional' option directs GNU C to treat all `extern'
  9200.      declarations as global, like traditional compilers.
  9201.  
  9202.    * In traditional C, you can combine `long', etc., with a typedef
  9203.      name, as shown here:
  9204.  
  9205.           typedef int foo;
  9206.           typedef long foo bar;
  9207.  
  9208.      In ANSI C, this is not allowed: `long' and other type modifiers
  9209.      require an explicit `int'.  Because this criterion is expressed by
  9210.      Bison grammar rules rather than C code, the `-traditional' flag
  9211.      cannot alter it.
  9212.  
  9213.    * PCC allows typedef names to be used as function parameters.  The
  9214.      difficulty described immediately above applies here too.
  9215.  
  9216.    * PCC allows whitespace in the middle of compound assignment
  9217.      operators such as `+='.  GNU CC, following the ANSI standard, does
  9218.      not allow this.  The difficulty described immediately above
  9219.      applies here too.
  9220.  
  9221.    * GNU CC complains about unterminated character constants inside of
  9222.      preprocessor conditionals that fail.  Some programs have English
  9223.      comments enclosed in conditionals that are guaranteed to fail; if
  9224.      these comments contain apostrophes, GNU CC will probably report an
  9225.      error.  For example, this code would produce an error:
  9226.  
  9227.           #if 0
  9228.           You can't expect this to work.
  9229.           #endif
  9230.  
  9231.      The best solution to such a problem is to put the text into an
  9232.      actual C comment delimited by `/*...*/'.  However, `-traditional'
  9233.      suppresses these error messages.
  9234.  
  9235.    * Many user programs contain the declaration `long time ();'.  In the
  9236.      past, the system header files on many systems did not actually
  9237.      declare `time', so it did not matter what type your program
  9238.      declared it to return.  But in systems with ANSI C headers, `time'
  9239.      is declared to return `time_t', and if that is not the same as
  9240.      `long', then `long time ();' is erroneous.
  9241.  
  9242.      The solution is to change your program to use `time_t' as the
  9243.      return type of `time'.
  9244.  
  9245.    * When compiling functions that return `float', PCC converts it to a
  9246.      double.  GNU CC actually returns a `float'.  If you are concerned
  9247.      with PCC compatibility, you should declare your functions to return
  9248.      `double'; you might as well say what you mean.
  9249.  
  9250.    * When compiling functions that return structures or unions, GNU CC
  9251.      output code normally uses a method different from that used on most
  9252.      versions of Unix.  As a result, code compiled with GNU CC cannot
  9253.      call a structure-returning function compiled with PCC, and vice
  9254.      versa.
  9255.  
  9256.      The method used by GNU CC is as follows: a structure or union
  9257.      which is 1, 2, 4 or 8 bytes long is returned like a scalar.  A
  9258.      structure or union with any other size is stored into an address
  9259.      supplied by the caller (usually in a special, fixed register, but
  9260.      on some machines it is passed on the stack).  The
  9261.      machine-description macros `STRUCT_VALUE' and
  9262.      `STRUCT_INCOMING_VALUE' tell GNU CC where to pass this address.
  9263.  
  9264.      By contrast, PCC on most target machines returns structures and
  9265.      unions of any size by copying the data into an area of static
  9266.      storage, and then returning the address of that storage as if it
  9267.      were a pointer value.  The caller must copy the data from that
  9268.      memory area to the place where the value is wanted.  GNU CC does
  9269.      not use this method because it is slower and nonreentrant.
  9270.  
  9271.      On some newer machines, PCC uses a reentrant convention for all
  9272.      structure and union returning.  GNU CC on most of these machines
  9273.      uses a compatible convention when returning structures and unions
  9274.      in memory, but still returns small structures and unions in
  9275.      registers.
  9276.  
  9277.      You can tell GNU CC to use a compatible convention for all
  9278.      structure and union returning with the option
  9279.      `-fpcc-struct-return'.
  9280.  
  9281. 
  9282. File: @.Distr.UsingGCC,  Node: Disappointments,  Next: C++ Misunderstandings,  Prev: Incompatibilities,  Up: Trouble
  9283.  
  9284. Disappointments and Misunderstandings
  9285. =====================================
  9286.  
  9287.    These problems are perhaps regrettable, but we don't know any
  9288. practical way around them.
  9289.  
  9290.    * Certain local variables aren't recognized by debuggers when you
  9291.      compile with optimization.
  9292.  
  9293.      This occurs because sometimes GNU CC optimizes the variable out of
  9294.      existence.  There is no way to tell the debugger how to compute the
  9295.      value such a variable "would have had", and it is not clear that
  9296.      would be desirable anyway.  So GNU CC simply does not mention the
  9297.      eliminated variable when it writes debugging information.
  9298.  
  9299.      You have to expect a certain amount of disagreement between the
  9300.      executable and your source code, when you use optimization.
  9301.  
  9302.    * Users often think it is a bug when GNU CC reports an error for code
  9303.      like this:
  9304.  
  9305.           int foo (struct mumble *);
  9306.           
  9307.           struct mumble { ... };
  9308.           
  9309.           int foo (struct mumble *x)
  9310.           { ... }
  9311.  
  9312.      This code really is erroneous, because the scope of `struct
  9313.      mumble' in the prototype is limited to the argument list
  9314.      containing it.  It does not refer to the `struct mumble' defined
  9315.      with file scope immediately below--they are two unrelated types
  9316.      with similar names in different scopes.
  9317.  
  9318.      But in the definition of `foo', the file-scope type is used
  9319.      because that is available to be inherited.  Thus, the definition
  9320.      and the prototype do not match, and you get an error.
  9321.  
  9322.      This behavior may seem silly, but it's what the ANSI standard
  9323.      specifies.  It is easy enough for you to make your code work by
  9324.      moving the definition of `struct mumble' above the prototype.
  9325.      It's not worth being incompatible with ANSI C just to avoid an
  9326.      error for the example shown above.
  9327.  
  9328.    * Accesses to bitfields even in volatile objects works by accessing
  9329.      larger objects, such as a byte or a word.  You cannot rely on what
  9330.      size of object is accessed in order to read or write the bitfield;
  9331.      it may even vary for a given bitfield according to the precise
  9332.      usage.
  9333.  
  9334.      If you care about controlling the amount of memory that is
  9335.      accessed, use volatile but do not use bitfields.
  9336.  
  9337.    * GNU CC comes with shell scripts to fix certain known problems in
  9338.      system header files.  They install corrected copies of various
  9339.      header files in a special directory where only GNU CC will
  9340.      normally look for them.  The scripts adapt to various systems by
  9341.      searching all the system header files for the problem cases that
  9342.      we know about.
  9343.  
  9344.      If new system header files are installed, nothing automatically
  9345.      arranges to update the corrected header files.  You will have to
  9346.      reinstall GNU CC to fix the new header files.  More specifically,
  9347.      go to the build directory and delete the files `stmp-fixinc' and
  9348.      `stmp-headers', and the subdirectory `include'; then do `make
  9349.      install' again.
  9350.  
  9351.    * On 68000 systems, you can get paradoxical results if you test the
  9352.      precise values of floating point numbers.  For example, you can
  9353.      find that a floating point value which is not a NaN is not equal
  9354.      to itself.  This results from the fact that the the floating point
  9355.      registers hold a few more bits of precision than fit in a `double'
  9356.      in memory.  Compiled code moves values between memory and floating
  9357.      point registers at its convenience, and moving them into memory
  9358.      truncates them.
  9359.  
  9360.      You can partially avoid this problem by using the `-ffloat-store'
  9361.      option (*note Optimize Options::.).
  9362.  
  9363.    * On the MIPS, variable argument functions using `varargs.h' cannot
  9364.      have a floating point value for the first argument.  The reason
  9365.      for this is that in the absence of a prototype in scope, if the
  9366.      first argument is a floating point, it is passed in a floating
  9367.      point register, rather than an integer register.
  9368.  
  9369.      If the code is rewritten to use the ANSI standard `stdarg.h'
  9370.      method of variable arguments, and the prototype is in scope at the
  9371.      time of the call, everything will work fine.
  9372.  
  9373. 
  9374. File: @.Distr.UsingGCC,  Node: C++ Misunderstandings,  Next: Protoize Caveats,  Prev: Disappointments,  Up: Trouble
  9375.  
  9376. Common Misunderstandings with GNU C++
  9377. =====================================
  9378.  
  9379.    C++ is a complex language and an evolving one, and its standard
  9380. definition (the ANSI C++ draft standard) is also evolving.  As a result,
  9381. your C++ compiler may occasionally surprise you, even when its behavior
  9382. is correct.  This section discusses some areas that frequently give
  9383. rise to questions of this sort.
  9384.  
  9385. * Menu:
  9386.  
  9387. * Static Definitions::  Static member declarations are not definitions
  9388. * Temporaries::         Temporaries may vanish before you expect
  9389.  
  9390. 
  9391. File: @.Distr.UsingGCC,  Node: Static Definitions,  Next: Temporaries,  Up: C++ Misunderstandings
  9392.  
  9393. Declare *and* Define Static Members
  9394. -----------------------------------
  9395.  
  9396.    When a class has static data members, it is not enough to *declare*
  9397. the static member; you must also *define* it.  For example:
  9398.  
  9399.      class Foo
  9400.      {
  9401.        ...
  9402.        void method();
  9403.        static int bar;
  9404.      };
  9405.  
  9406.    This declaration only establishes that the class `Foo' has an `int'
  9407. named `Foo::bar', and a member function named `Foo::method'.  But you
  9408. still need to define *both* `method' and `bar' elsewhere.  According to
  9409. the draft ANSI standard, you must supply an initializer in one (and
  9410. only one) source file, such as:
  9411.  
  9412.      int Foo::bar = 0;
  9413.  
  9414.    Other C++ compilers may not correctly implement the standard
  9415. behavior.  As a result, when you switch to `g++' from one of these
  9416. compilers, you may discover that a program that appeared to work
  9417. correctly in fact does not conform to the standard: `g++' reports as
  9418. undefined symbols any static data members that lack definitions.
  9419.  
  9420. 
  9421. File: @.Distr.UsingGCC,  Node: Temporaries,  Prev: Static Definitions,  Up: C++ Misunderstandings
  9422.  
  9423. Temporaries May Vanish Before You Expect
  9424. ----------------------------------------
  9425.  
  9426.    It is dangerous to use pointers or references to *portions* of a
  9427. temporary object.  The compiler may very well delete the object before
  9428. you expect it to, leaving a pointer to garbage.  The most common place
  9429. where this problem crops up is in classes like the libg++ `String'
  9430. class, that define a conversion function to type `char *' or `const
  9431. char *'.  However, any class that returns a pointer to some internal
  9432. structure is potentially subject to this problem.
  9433.  
  9434.    For example, a program may use a function `strfunc' that returns
  9435. `String' objects, and another function `charfunc' that operates on
  9436. pointers to `char':
  9437.  
  9438.      String strfunc ();
  9439.      void charfunc (const char *);
  9440.  
  9441. In this situation, it may seem natural to write
  9442. `charfunc (strfunc ());' based on the knowledge that class `String' has
  9443. an explicit conversion to `char' pointers.  However, what really
  9444. happens is akin to `charfunc (strfunc ().convert ());', where the
  9445. `convert' method is a function to do the same data conversion normally
  9446. performed by a cast.  Since the last use of the temporary `String'
  9447. object is the call to the conversion function, the compiler may delete
  9448. that object before actually calling `charfunc'.  The compiler has no
  9449. way of knowing that deleting the `String' object will invalidate the
  9450. pointer.  The pointer then points to garbage, so that by the time
  9451. `charfunc' is called, it gets an invalid argument.
  9452.  
  9453.    Code like this may run successfully under some other compilers,
  9454. especially those that delete temporaries relatively late.  However, the
  9455. GNU C++ behavior is also standard-conformant, so if your program depends
  9456. on late destruction of temporaries it is not portable.
  9457.  
  9458.    If you think this is surprising, you should be aware that the ANSI
  9459. C++ committee continues to debate the lifetime-of-temporaries problem.
  9460.  
  9461.    For now, at least, the safe way to write such code is to give the
  9462. temporary a name, which forces it to remain until the end of the scope
  9463. of the name.  For example:
  9464.  
  9465.      String& tmp = strfunc ();
  9466.      charfunc (tmp);
  9467.  
  9468. 
  9469. File: @.Distr.UsingGCC,  Node: Protoize Caveats,  Next: Non-bugs,  Prev: C++ Misunderstandings,  Up: Trouble
  9470.  
  9471. Caveats of using `protoize'
  9472. ===========================
  9473.  
  9474.    The conversion programs `protoize' and `unprotoize' can sometimes
  9475. change a source file in a way that won't work unless you rearrange it.
  9476.  
  9477.    * `protoize' can insert references to a type name or type tag before
  9478.      the definition, or in a file where they are not defined.
  9479.  
  9480.      If this happens, compiler error messages should show you where the
  9481.      new references are, so fixing the file by hand is straightforward.
  9482.  
  9483.    * There are some C constructs which `protoize' cannot figure out.
  9484.      For example, it can't determine argument types for declaring a
  9485.      pointer-to-function variable; this you must do by hand.  `protoize'
  9486.      inserts a comment containing `???' each time it finds such a
  9487.      variable; so you can find all such variables by searching for this
  9488.      string.  ANSI C does not require declaring the argument types of
  9489.      pointer-to-function types.
  9490.  
  9491.    * Using `unprotoize' can easily introduce bugs.  If the program
  9492.      relied on prototypes to bring about conversion of arguments, these
  9493.      conversions will not take place in the program without prototypes.
  9494.      One case in which you can be sure `unprotoize' is safe is when you
  9495.      are removing prototypes that were made with `protoize'; if the
  9496.      program worked before without any prototypes, it will work again
  9497.      without them.
  9498.  
  9499.      You can find all the places where this problem might occur by
  9500.      compiling the program with the `-Wconversion' option.  It prints a
  9501.      warning whenever an argument is converted.
  9502.  
  9503.    * Both conversion programs can be confused if there are macro calls
  9504.      in and around the text to be converted.  In other words, the
  9505.      standard syntax for a declaration or definition must not result
  9506.      from expanding a macro.  This problem is inherent in the design of
  9507.      C and cannot be fixed.  If only a few functions have confusing
  9508.      macro calls, you can easily convert them manually.
  9509.  
  9510.    * `protoize' cannot get the argument types for a function whose
  9511.      definition was not actually compiled due to preprocessor
  9512.      conditionals.  When this happens, `protoize' changes nothing in
  9513.      regard to such a function.  `protoize' tries to detect such
  9514.      instances and warn about them.
  9515.  
  9516.      You can generally work around this problem by using `protoize' step
  9517.      by step, each time specifying a different set of `-D' options for
  9518.      compilation, until all of the functions have been converted.
  9519.      There is no automatic way to verify that you have got them all,
  9520.      however.
  9521.  
  9522.    * Confusion may result if there is an occasion to convert a function
  9523.      declaration or definition in a region of source code where there
  9524.      is more than one formal parameter list present.  Thus, attempts to
  9525.      convert code containing multiple (conditionally compiled) versions
  9526.      of a single function header (in the same vicinity) may not produce
  9527.      the desired (or expected) results.
  9528.  
  9529.      If you plan on converting source files which contain such code, it
  9530.      is recommended that you first make sure that each conditionally
  9531.      compiled region of source code which contains an alternative
  9532.      function header also contains at least one additional follower
  9533.      token (past the final right parenthesis of the function header).
  9534.      This should circumvent the problem.
  9535.  
  9536.    * `unprotoize' can become confused when trying to convert a function
  9537.      definition or declaration which contains a declaration for a
  9538.      pointer-to-function formal argument which has the same name as the
  9539.      function being defined or declared.  We recommand you avoid such
  9540.      choices of formal parameter names.
  9541.  
  9542.    * You might also want to correct some of the indentation by hand and
  9543.      break long lines.  (The conversion programs don't write lines
  9544.      longer than eighty characters in any case.)
  9545.  
  9546. 
  9547. File: @.Distr.UsingGCC,  Node: Non-bugs,  Next: Warnings and Errors,  Prev: Protoize Caveats,  Up: Trouble
  9548.  
  9549. Certain Changes We Don't Want to Make
  9550. =====================================
  9551.  
  9552.    This section lists changes that people frequently request, but which
  9553. we do not make because we think GNU CC is better without them.
  9554.  
  9555.    * Checking the number and type of arguments to a function which has
  9556.      an old-fashioned definition and no prototype.
  9557.  
  9558.      Such a feature would work only occasionally--only for calls that
  9559.      appear in the same file as the called function, following the
  9560.      definition.  The only way to check all calls reliably is to add a
  9561.      prototype for the function.  But adding a prototype eliminates the
  9562.      motivation for this feature.  So the feature is not worthwhile.
  9563.  
  9564.    * Warning about using an expression whose type is signed as a shift
  9565.      count.
  9566.  
  9567.      Shift count operands are probably signed more often than unsigned.
  9568.      Warning about this would cause far more annoyance than good.
  9569.  
  9570.    * Warning about assigning a signed value to an unsigned variable.
  9571.  
  9572.      Such assignments must be very common; warning about them would
  9573.      cause more annoyance than good.
  9574.  
  9575.    * Warning about unreachable code.
  9576.  
  9577.      It's very common to have unreachable code in machine-generated
  9578.      programs.  For example, this happens normally in some files of GNU
  9579.      C itself.
  9580.  
  9581.    * Warning when a non-void function value is ignored.
  9582.  
  9583.      Coming as I do from a Lisp background, I balk at the idea that
  9584.      there is something dangerous about discarding a value.  There are
  9585.      functions that return values which some callers may find useful;
  9586.      it makes no sense to clutter the program with a cast to `void'
  9587.      whenever the value isn't useful.
  9588.  
  9589.    * Assuming (for optimization) that the address of an external symbol
  9590.      is never zero.
  9591.  
  9592.      This assumption is false on certain systems when `#pragma weak' is
  9593.      used.
  9594.  
  9595.    * Making `-fshort-enums' the default.
  9596.  
  9597.      This would cause storage layout to be incompatible with most other
  9598.      C compilers.  And it doesn't seem very important, given that you
  9599.      can get the same result in other ways.  The case where it matters
  9600.      most is when the enumeration-valued object is inside a structure,
  9601.      and in that case you can specify a field width explicitly.
  9602.  
  9603.    * Making bitfields unsigned by default on particular machines where
  9604.      "the ABI standard" says to do so.
  9605.  
  9606.      The ANSI C standard leaves it up to the implementation whether a
  9607.      bitfield declared plain `int' is signed or not.  This in effect
  9608.      creates two alternative dialects of C.
  9609.  
  9610.      The GNU C compiler supports both dialects; you can specify the
  9611.      signed dialect with `-fsigned-bitfields' and the unsigned dialect
  9612.      with `-funsigned-bitfields'.  However, this leaves open the
  9613.      question of which dialect to use by default.
  9614.  
  9615.      Currently, the preferred dialect makes plain bitfields signed,
  9616.      because this is simplest.  Since `int' is the same as `signed int'
  9617.      in every other context, it is cleanest for them to be the same in
  9618.      bitfields as well.
  9619.  
  9620.      Some computer manufacturers have published Application Binary
  9621.      Interface standards which specify that plain bitfields should be
  9622.      unsigned.  It is a mistake, however, to say anything about this
  9623.      issue in an ABI.  This is because the handling of plain bitfields
  9624.      distinguishes two dialects of C.  Both dialects are meaningful on
  9625.      every type of machine.  Whether a particular object file was
  9626.      compiled using signed bitfields or unsigned is of no concern to
  9627.      other object files, even if they access the same bitfields in the
  9628.      same data structures.
  9629.  
  9630.      A given program is written in one or the other of these two
  9631.      dialects.  The program stands a chance to work on most any machine
  9632.      if it is compiled with the proper dialect.  It is unlikely to work
  9633.      at all if compiled with the wrong dialect.
  9634.  
  9635.      Many users appreciate the GNU C compiler because it provides an
  9636.      environment that is uniform across machines.  These users would be
  9637.      inconvenienced if the compiler treated plain bitfields differently
  9638.      on certain machines.
  9639.  
  9640.      Occasionally users write programs intended only for a particular
  9641.      machine type.  On these occasions, the users would benefit if the
  9642.      GNU C compiler were to support by default the same dialect as the
  9643.      other compilers on that machine.  But such applications are rare.
  9644.      And users writing a program to run on more than one type of
  9645.      machine cannot possibly benefit from this kind of compatibility.
  9646.  
  9647.      This is why GNU CC does and will treat plain bitfields in the same
  9648.      fashion on all types of machines (by default).
  9649.  
  9650.      There are some arguments for making bitfields unsigned by default
  9651.      on all machines.  If, for example, this becomes a universal de
  9652.      facto standard, it would make sense for GNU CC to go along with
  9653.      it.  This is something to be considered in the future.
  9654.  
  9655.      (Of course, users strongly concerned about portability should
  9656.      indicate explicitly in each bitfield whether it is signed or not.
  9657.      In this way, they write programs which have the same meaning in
  9658.      both C dialects.)
  9659.  
  9660.    * Undefining `__STDC__' when `-ansi' is not used.
  9661.  
  9662.      Currently, GNU CC defines `__STDC__' as long as you don't use
  9663.      `-traditional'.  This provides good results in practice.
  9664.  
  9665.      Programmers normally use conditionals on `__STDC__' to ask whether
  9666.      it is safe to use certain features of ANSI C, such as function
  9667.      prototypes or ANSI token concatenation.  Since plain `gcc' supports
  9668.      all the features of ANSI C, the correct answer to these questions
  9669.      is "yes".
  9670.  
  9671.      Some users try to use `__STDC__' to check for the availability of
  9672.      certain library facilities.  This is actually incorrect usage in
  9673.      an ANSI C program, because the ANSI C standard says that a
  9674.      conforming freestanding implementation should define `__STDC__'
  9675.      even though it does not have the library facilities.  `gcc -ansi
  9676.      -pedantic' is a conforming freestanding implementation, and it is
  9677.      therefore required to define `__STDC__', even though it does not
  9678.      come with an ANSI C library.
  9679.  
  9680.      Sometimes people say that defining `__STDC__' in a compiler that
  9681.      does not completely conform to the ANSI C standard somehow
  9682.      violates the standard.  This is illogical.  The standard is a
  9683.      standard for compilers that claim to support ANSI C, such as `gcc
  9684.      -ansi'--not for other compilers such as plain `gcc'.  Whatever the
  9685.      ANSI C standard says is relevant to the design of plain `gcc'
  9686.      without `-ansi' only for pragmatic reasons, not as a requirement.
  9687.  
  9688.    * Undefining `__STDC__' in C++.
  9689.  
  9690.      Programs written to compile with C++-to-C translators get the
  9691.      value of `__STDC__' that goes with the C compiler that is
  9692.      subsequently used.  These programs must test `__STDC__' to
  9693.      determine what kind of C preprocessor that compiler uses: whether
  9694.      they should concatenate tokens in the ANSI C fashion or in the
  9695.      traditional fashion.
  9696.  
  9697.      These programs work properly with GNU C++ if `__STDC__' is defined.
  9698.      They would not work otherwise.
  9699.  
  9700.      In addition, many header files are written to provide prototypes
  9701.      in ANSI C but not in traditional C.  Many of these header files
  9702.      can work without change in C++ provided `__STDC__' is defined.  If
  9703.      `__STDC__' is not defined, they will all fail, and will all need
  9704.      to be changed to test explicitly for C++ as well.
  9705.  
  9706.    * Deleting "empty" loops.
  9707.  
  9708.      GNU CC does not delete "empty" loops because the most likely reason
  9709.      you would put one in a program is to have a delay.  Deleting them
  9710.      will not make real programs run any faster, so it would be
  9711.      pointless.
  9712.  
  9713.      It would be different if optimization of a nonempty loop could
  9714.      produce an empty one.  But this generally can't happen.
  9715.  
  9716.    * Making side effects happen in the same order as in some other
  9717.      compiler.
  9718.  
  9719.      It is never safe to depend on the order of evaluation of side
  9720.      effects.  For example, a function call like this may very well
  9721.      behave differently from one compiler to another:
  9722.  
  9723.           void func (int, int);
  9724.           
  9725.           int i = 2;
  9726.           func (i++, i++);
  9727.  
  9728.      There is no guarantee (in either the C or the C++ standard language
  9729.      definitions) that the increments will be evaluated in any
  9730.      particular order.  Either increment might happen first.  `func'
  9731.      might get the arguments `3, 4', or it might get `4, 3', or even
  9732.      `3, 3'.
  9733.  
  9734.    * Using the "canonical" form of the target configuration name as the
  9735.      directory for installation.
  9736.  
  9737.      This would be an improvement in some respects, but it would also
  9738.      cause problems.  For one thing, users might expect to use in the
  9739.      `-b' option the same name specified at installation; if
  9740.      installation used the canonical form, that would not work.  What's
  9741.      more, the canonical name might be too long for certain file
  9742.      systems.
  9743.  
  9744.      We suggest you make a link to the installation directory under the
  9745.      canonical name, if you want to use that name in the `-b' option.
  9746.  
  9747. 
  9748. File: @.Distr.UsingGCC,  Node: Warnings and Errors,  Prev: Non-bugs,  Up: Trouble
  9749.  
  9750. Warning Messages and Error Messages
  9751. ===================================
  9752.  
  9753.    The GNU compiler can produce two kinds of diagnostics: errors and
  9754. warnings.  Each kind has a different purpose:
  9755.  
  9756.      *Errors* report problems that make it impossible to compile your
  9757.      program.  GNU CC reports errors with the source file name and line
  9758.      number where the problem is apparent.
  9759.  
  9760.      *Warnings* report other unusual conditions in your code that *may*
  9761.      indicate a problem, although compilation can (and does) proceed.
  9762.      Warning messages also report the source file name and line number,
  9763.      but include the text `warning:' to distinguish them from error
  9764.      messages.
  9765.  
  9766.    Warnings may indicate danger points where you should check to make
  9767. sure that your program really does what you intend; or the use of
  9768. obsolete features; or the use of nonstandard features of GNU C or C++.
  9769. Many warnings are issued only if you ask for them, with one of the `-W'
  9770. options (for instance, `-Wall' requests a variety of useful warnings).
  9771.  
  9772.    GNU CC always tries to compile your program if possible; it never
  9773. gratuituously rejects a program whose meaning is clear merely because
  9774. (for instance) it fails to conform to a standard.  In some cases,
  9775. however, the C and C++ standards specify that certain extensions are
  9776. forbidden, and a diagnostic *must* be issued by a conforming compiler.
  9777. The `-pedantic' option tells GNU CC to issue warnings in such cases;
  9778. `-pedantic-errors' says to make them errors instead.  This does not
  9779. mean that *all* non-ANSI constructs get warnings or errors.
  9780.  
  9781.    *Note Options to Request or Suppress Warnings: Warning Options, for
  9782. more detail on these and related command-line options.
  9783.  
  9784. 
  9785. File: @.Distr.UsingGCC,  Node: Bugs,  Next: Service,  Prev: Trouble,  Up: Top
  9786.  
  9787. Reporting Bugs
  9788. **************
  9789.  
  9790.    Your bug reports play an essential role in making GNU CC reliable.
  9791.  
  9792.    When you encounter a problem, the first thing to do is to see if it
  9793. is already known.  *Note Trouble::.  If it isn't known, then you should
  9794. report the problem.
  9795.  
  9796.    Reporting a bug may help you by bringing a solution to your problem,
  9797. or it may not.  (If it does not, look in the service directory; see
  9798. *Note Service::.)  In any case, the principal function of a bug report
  9799. is to help the entire community by making the next version of GNU CC
  9800. work better.  Bug reports are your contribution to the maintenance of
  9801. GNU CC.
  9802.  
  9803.    In order for a bug report to serve its purpose, you must include the
  9804. information that makes for fixing the bug.
  9805.  
  9806. * Menu:
  9807.  
  9808. * Criteria:  Bug Criteria.   Have you really found a bug?
  9809. * Where: Bug Lists.         Where to send your bug report.
  9810. * Reporting: Bug Reporting.  How to report a bug effectively.
  9811. * Patches: Sending Patches.  How to send a patch for GNU CC.
  9812. * Known: Trouble.            Known problems.
  9813. * Help: Service.             Where to ask for help.
  9814.  
  9815. 
  9816. File: @.Distr.UsingGCC,  Node: Bug Criteria,  Next: Bug Lists,  Up: Bugs
  9817.  
  9818. Have You Found a Bug?
  9819. =====================
  9820.  
  9821.    If you are not sure whether you have found a bug, here are some
  9822. guidelines:
  9823.  
  9824.    * If the compiler gets a fatal signal, for any input whatever, that
  9825.      is a compiler bug.  Reliable compilers never crash.
  9826.  
  9827.    * If the compiler produces invalid assembly code, for any input
  9828.      whatever (except an `asm' statement), that is a compiler bug,
  9829.      unless the compiler reports errors (not just warnings) which would
  9830.      ordinarily prevent the assembler from being run.
  9831.  
  9832.    * If the compiler produces valid assembly code that does not
  9833.      correctly execute the input source code, that is a compiler bug.
  9834.  
  9835.      However, you must double-check to make sure, because you may have
  9836.      run into an incompatibility between GNU C and traditional C (*note
  9837.      Incompatibilities::.).  These incompatibilities might be considered
  9838.      bugs, but they are inescapable consequences of valuable features.
  9839.  
  9840.      Or you may have a program whose behavior is undefined, which
  9841.      happened by chance to give the desired results with another C or
  9842.      C++ compiler.
  9843.  
  9844.      For example, in many nonoptimizing compilers, you can write `x;'
  9845.      at the end of a function instead of `return x;', with the same
  9846.      results.  But the value of the function is undefined if `return'
  9847.      is omitted; it is not a bug when GNU CC produces different results.
  9848.  
  9849.      Problems often result from expressions with two increment
  9850.      operators, as in `f (*p++, *p++)'.  Your previous compiler might
  9851.      have interpreted that expression the way you intended; GNU CC might
  9852.      interpret it another way.  Neither compiler is wrong.  The bug is
  9853.      in your code.
  9854.  
  9855.      After you have localized the error to a single source line, it
  9856.      should be easy to check for these things.  If your program is
  9857.      correct and well defined, you have found a compiler bug.
  9858.  
  9859.    * If the compiler produces an error message for valid input, that is
  9860.      a compiler bug.
  9861.  
  9862.    * If the compiler does not produce an error message for invalid
  9863.      input, that is a compiler bug.  However, you should note that your
  9864.      idea of "invalid input" might be my idea of "an extension" or
  9865.      "support for traditional practice".
  9866.  
  9867.    * If you are an experienced user of C or C++ compilers, your
  9868.      suggestions for improvement of GNU CC or GNU C++ are welcome in
  9869.      any case.
  9870.  
  9871. 
  9872. File: @.Distr.UsingGCC,  Node: Bug Lists,  Next: Bug Reporting,  Prev: Bug Criteria,  Up: Bugs
  9873.  
  9874. Where to Report Bugs
  9875. ====================
  9876.  
  9877.    Send bug reports for GNU C to one of these addresses:
  9878.  
  9879.      bug-gcc@prep.ai.mit.edu
  9880.      {ucbvax|mit-eddie|uunet}!prep.ai.mit.edu!bug-gcc
  9881.  
  9882.    Send bug reports for GNU C++ to one of these addresses:
  9883.  
  9884.      bug-g++@prep.ai.mit.edu
  9885.      {ucbvax|mit-eddie|uunet}!prep.ai.mit.edu!bug-g++
  9886.  
  9887.    If your bug involves the C++ class library libg++, send mail to
  9888. `bug-lib-g++@prep.ai.mit.edu'.  If you're not sure, you can send the
  9889. bug report to both lists.
  9890.  
  9891.    *Do not send bug reports to the mailing list `help-gcc', or to the
  9892. newsgroup `gnu.gcc.help'.* Most users of GNU CC do not want to receive
  9893. bug reports.  Those that do, have asked to be on `bug-gcc' and/or
  9894. `bug-g++'.
  9895.  
  9896.    The mailing lists `bug-gcc' and `bug-g++' both have newsgroups which
  9897. serve as repeaters: `gnu.gcc.bug' and `gnu.g++.bug'.  Each mailing list
  9898. and its newsgroup carry exactly the same messages.
  9899.  
  9900.    Often people think of posting bug reports to the newsgroup instead of
  9901. mailing them.  This appears to work, but it has one problem which can be
  9902. crucial: a newsgroup posting does not contain a mail path back to the
  9903. sender.  Thus, if maintainers need more information, they may be unable
  9904. to reach you.  For this reason, you should always send bug reports by
  9905. mail to the proper mailing list.
  9906.  
  9907.    As a last resort, send bug reports on paper to:
  9908.  
  9909.      GNU Compiler Bugs
  9910.      Free Software Foundation
  9911.      675 Mass Ave
  9912.      Cambridge, MA 02139
  9913.  
  9914. 
  9915. File: @.Distr.UsingGCC,  Node: Bug Reporting,  Next: Sending Patches,  Prev: Bug Lists,  Up: Bugs
  9916.  
  9917. How to Report Bugs
  9918. ==================
  9919.  
  9920.    The fundamental principle of reporting bugs usefully is this:
  9921. *report all the facts*.  If you are not sure whether to state a fact or
  9922. leave it out, state it!
  9923.  
  9924.    Often people omit facts because they think they know what causes the
  9925. problem and they conclude that some details don't matter.  Thus, you
  9926. might assume that the name of the variable you use in an example does
  9927. not matter.  Well, probably it doesn't, but one cannot be sure.
  9928. Perhaps the bug is a stray memory reference which happens to fetch from
  9929. the location where that name is stored in memory; perhaps, if the name
  9930. were different, the contents of that location would fool the compiler
  9931. into doing the right thing despite the bug.  Play it safe and give a
  9932. specific, complete example.  That is the easiest thing for you to do,
  9933. and the most helpful.
  9934.  
  9935.    Keep in mind that the purpose of a bug report is to enable someone to
  9936. fix the bug if it is not known.  It isn't very important what happens if
  9937. the bug is already known.  Therefore, always write your bug reports on
  9938. the assumption that the bug is not known.
  9939.  
  9940.    Sometimes people give a few sketchy facts and ask, "Does this ring a
  9941. bell?"  This cannot help us fix a bug, so it is basically useless.  We
  9942. respond by asking for enough details to enable us to investigate.  You
  9943. might as well expedite matters by sending them to begin with.
  9944.  
  9945.    Try to make your bug report self-contained.  If we have to ask you
  9946. for more information, it is best if you include all the previous
  9947. information in your response, as well as the information that was
  9948. missing.
  9949.  
  9950.    To enable someone to investigate the bug, you should include all
  9951. these things:
  9952.  
  9953.    * The version of GNU CC.  You can get this by running it with the
  9954.      `-v' option.
  9955.  
  9956.      Without this, we won't know whether there is any point in looking
  9957.      for the bug in the current version of GNU CC.
  9958.  
  9959.    * A complete input file that will reproduce the bug.  If the bug is
  9960.      in the C preprocessor, send a source file and any header files
  9961.      that it requires.  If the bug is in the compiler proper (`cc1'),
  9962.      run your source file through the C preprocessor by doing `gcc -E
  9963.      SOURCEFILE > OUTFILE', then include the contents of OUTFILE in the
  9964.      bug report.  (When you do this, use the same `-I', `-D' or `-U'
  9965.      options that you used in actual compilation.)
  9966.  
  9967.      A single statement is not enough of an example.  In order to
  9968.      compile it, it must be embedded in a complete file of compiler
  9969.      input; and the bug might depend on the details of how this is done.
  9970.  
  9971.      Without a real example one can compile, all anyone can do about
  9972.      your bug report is wish you luck.  It would be futile to try to
  9973.      guess how to provoke the bug.  For example, bugs in register
  9974.      allocation and reloading frequently depend on every little detail
  9975.      of the function they happen in.
  9976.  
  9977.      Even if the input file that fails comes from a GNU program, you
  9978.      should still send the complete test case.  Don't ask the GNU CC
  9979.      maintainers to do the extra work of obtaining the program in
  9980.      question--they are all overworked as it is.  Also, the problem may
  9981.      depend on what is in the header files on your system; it is
  9982.      unreliable for the GNU CC maintainers to try the problem with the
  9983.      header files available to them.  By sending CPP output, you can
  9984.      eliminate this source of uncertainty and save us a certain
  9985.      percentage of wild goose chases.
  9986.  
  9987.    * The command arguments you gave GNU CC or GNU C++ to compile that
  9988.      example and observe the bug.  For example, did you use `-O'?  To
  9989.      guarantee you won't omit something important, list all the options.
  9990.  
  9991.      If we were to try to guess the arguments, we would probably guess
  9992.      wrong and then we would not encounter the bug.
  9993.  
  9994.    * The type of machine you are using, and the operating system name
  9995.      and version number.
  9996.  
  9997.    * The operands you gave to the `configure' command when you installed
  9998.      the compiler.
  9999.  
  10000.    * A complete list of any modifications you have made to the compiler
  10001.      source.  (We don't promise to investigate the bug unless it
  10002.      happens in an unmodified compiler.  But if you've made
  10003.      modifications and don't tell us, then you are sending us on a wild
  10004.      goose chase.)
  10005.  
  10006.      Be precise about these changes.  A description in English is not
  10007.      enough--send a context diff for them.
  10008.  
  10009.      Adding files of your own (such as a machine description for a
  10010.      machine we don't support) is a modification of the compiler source.
  10011.  
  10012.    * Details of any other deviations from the standard procedure for
  10013.      installing GNU CC.
  10014.  
  10015.    * A description of what behavior you observe that you believe is
  10016.      incorrect.  For example, "The compiler gets a fatal signal," or,
  10017.      "The assembler instruction at line 208 in the output is incorrect."
  10018.  
  10019.      Of course, if the bug is that the compiler gets a fatal signal,
  10020.      then one can't miss it.  But if the bug is incorrect output, the
  10021.      maintainer might not notice unless it is glaringly wrong.  None of
  10022.      us has time to study all the assembler code from a 50-line C
  10023.      program just on the chance that one instruction might be wrong.
  10024.      We need *you* to do this part!
  10025.  
  10026.      Even if the problem you experience is a fatal signal, you should
  10027.      still say so explicitly.  Suppose something strange is going on,
  10028.      such as, your copy of the compiler is out of synch, or you have
  10029.      encountered a bug in the C library on your system.  (This has
  10030.      happened!)  Your copy might crash and the copy here would not.  If
  10031.      you said to expect a crash, then when the compiler here fails to
  10032.      crash, we would know that the bug was not happening.  If you don't
  10033.      say to expect a crash, then we would not know whether the bug was
  10034.      happening.  We would not be able to draw any conclusion from our
  10035.      observations.
  10036.  
  10037.      If the problem is a diagnostic when compiling GNU CC with some
  10038.      other compiler, say whether it is a warning or an error.
  10039.  
  10040.      Often the observed symptom is incorrect output when your program
  10041.      is run.  Sad to say, this is not enough information unless the
  10042.      program is short and simple.  None of us has time to study a large
  10043.      program to figure out how it would work if compiled correctly,
  10044.      much less which line of it was compiled wrong.  So you will have
  10045.      to do that.  Tell us which source line it is, and what incorrect
  10046.      result happens when that line is executed.  A person who
  10047.      understands the program can find this as easily as finding a bug
  10048.      in the program itself.
  10049.  
  10050.    * If you send examples of assembler code output from GNU CC or GNU
  10051.      C++, please use `-g' when you make them.  The debugging information
  10052.      includes source line numbers which are essential for correlating
  10053.      the output with the input.
  10054.  
  10055.    * If you wish to mention something in the GNU CC source, refer to it
  10056.      by context, not by line number.
  10057.  
  10058.      The line numbers in the development sources don't match those in
  10059.      your sources.  Your line numbers would convey no useful
  10060.      information to the maintainers.
  10061.  
  10062.    * Additional information from a debugger might enable someone to
  10063.      find a problem on a machine which he does not have available.
  10064.      However, you need to think when you collect this information if
  10065.      you want it to have any chance of being useful.
  10066.  
  10067.      For example, many people send just a backtrace, but that is never
  10068.      useful by itself.  A simple backtrace with arguments conveys little
  10069.      about GNU CC because the compiler is largely data-driven; the same
  10070.      functions are called over and over for different RTL insns, doing
  10071.      different things depending on the details of the insn.
  10072.  
  10073.      Most of the arguments listed in the backtrace are useless because
  10074.      they are pointers to RTL list structure.  The numeric values of the
  10075.      pointers, which the debugger prints in the backtrace, have no
  10076.      significance whatever; all that matters is the contents of the
  10077.      objects they point to (and most of the contents are other such
  10078.      pointers).
  10079.  
  10080.      In addition, most compiler passes consist of one or more loops that
  10081.      scan the RTL insn sequence.  The most vital piece of information
  10082.      about such a loop--which insn it has reached--is usually in a
  10083.      local variable, not in an argument.
  10084.  
  10085.      What you need to provide in addition to a backtrace are the values
  10086.      of the local variables for several stack frames up.  When a local
  10087.      variable or an argument is an RTX, first print its value and then
  10088.      use the GDB command `pr' to print the RTL expression that it points
  10089.      to.  (If GDB doesn't run on your machine, use your debugger to call
  10090.      the function `debug_rtx' with the RTX as an argument.)  In
  10091.      general, whenever a variable is a pointer, its value is no use
  10092.      without the data it points to.
  10093.  
  10094.    Here are some things that are not necessary:
  10095.  
  10096.    * A description of the envelope of the bug.
  10097.  
  10098.      Often people who encounter a bug spend a lot of time investigating
  10099.      which changes to the input file will make the bug go away and which
  10100.      changes will not affect it.
  10101.  
  10102.      This is often time consuming and not very useful, because the way
  10103.      we will find the bug is by running a single example under the
  10104.      debugger with breakpoints, not by pure deduction from a series of
  10105.      examples.  You might as well save your time for something else.
  10106.  
  10107.      Of course, if you can find a simpler example to report *instead* of
  10108.      the original one, that is a convenience.  Errors in the output
  10109.      will be easier to spot, running under the debugger will take less
  10110.      time, etc.  Most GNU CC bugs involve just one function, so the
  10111.      most straightforward way to simplify an example is to delete all
  10112.      the function definitions except the one where the bug occurs.
  10113.      Those earlier in the file may be replaced by external declarations
  10114.      if the crucial function depends on them.  (Exception: inline
  10115.      functions may affect compilation of functions defined later in the
  10116.      file.)
  10117.  
  10118.      However, simplification is not vital; if you don't want to do this,
  10119.      report the bug anyway and send the entire test case you used.
  10120.  
  10121.    * In particular, some people insert conditionals `#ifdef BUG' around
  10122.      a statement which, if removed, makes the bug not happen.  These
  10123.      are just clutter; we won't pay any attention to them anyway.
  10124.      Besides, you should send us cpp output, and that can't have
  10125.      conditionals.
  10126.  
  10127.    * A patch for the bug.
  10128.  
  10129.      A patch for the bug is useful if it is a good one.  But don't omit
  10130.      the necessary information, such as the test case, on the
  10131.      assumption that a patch is all we need.  We might see problems
  10132.      with your patch and decide to fix the problem another way, or we
  10133.      might not understand it at all.
  10134.  
  10135.      Sometimes with a program as complicated as GNU CC it is very hard
  10136.      to construct an example that will make the program follow a
  10137.      certain path through the code.  If you don't send the example, we
  10138.      won't be able to construct one, so we won't be able to verify that
  10139.      the bug is fixed.
  10140.  
  10141.      And if we can't understand what bug you are trying to fix, or why
  10142.      your patch should be an improvement, we won't install it.  A test
  10143.      case will help us to understand.
  10144.  
  10145.      *Note Sending Patches::, for guidelines on how to make it easy for
  10146.      us to understand and install your patches.
  10147.  
  10148.    * A guess about what the bug is or what it depends on.
  10149.  
  10150.      Such guesses are usually wrong.  Even I can't guess right about
  10151.      such things without first using the debugger to find the facts.
  10152.  
  10153.    * A core dump file.
  10154.  
  10155.      We have no way of examining a core dump for your type of machine
  10156.      unless we have an identical system--and if we do have one, we
  10157.      should be able to reproduce the crash ourselves.
  10158.  
  10159. 
  10160. File: @.Distr.UsingGCC,  Node: Sending Patches,  Prev: Bug Reporting,  Up: Bugs
  10161.  
  10162. Sending Patches for GNU CC
  10163. ==========================
  10164.  
  10165.    If you would like to write bug fixes or improvements for the GNU C
  10166. compiler, that is very helpful.  When you send your changes, please
  10167. follow these guidelines to avoid causing extra work for us in studying
  10168. the patches.
  10169.  
  10170.    If you don't follow these guidelines, your information might still be
  10171. useful, but using it will take extra work.  Maintaining GNU C is a lot
  10172. of work in the best of circumstances, and we can't keep up unless you do
  10173. your best to help.
  10174.  
  10175.    * Send an explanation with your changes of what problem they fix or
  10176.      what improvement they bring about.  For a bug fix, just include a
  10177.      copy of the bug report, and explain why the change fixes the bug.
  10178.  
  10179.      (Referring to a bug report is not as good as including it, because
  10180.      then we will have to look it up, and we have probably already
  10181.      deleted it if we've already fixed the bug.)
  10182.  
  10183.    * Always include a proper bug report for the problem you think you
  10184.      have fixed.  We need to convince ourselves that the change is
  10185.      right before installing it.  Even if it is right, we might have
  10186.      trouble judging it if we don't have a way to reproduce the problem.
  10187.  
  10188.    * Include all the comments that are appropriate to help people
  10189.      reading the source in the future understand why this change was
  10190.      needed.
  10191.  
  10192.    * Don't mix together changes made for different reasons.  Send them
  10193.      *individually*.
  10194.  
  10195.      If you make two changes for separate reasons, then we might not
  10196.      want to install them both.  We might want to install just one.  If
  10197.      you send them all jumbled together in a single set of diffs, we
  10198.      have to do extra work to disentangle them--to figure out which
  10199.      parts of the change serve which purpose.  If we don't have time
  10200.      for this, we might have to ignore your changes entirely.
  10201.  
  10202.      If you send each change as soon as you have written it, with its
  10203.      own explanation, then the two changes never get tangled up, and we
  10204.      can consider each one properly without any extra work to
  10205.      disentangle them.
  10206.  
  10207.      Ideally, each change you send should be impossible to subdivide
  10208.      into parts that we might want to consider separately, because each
  10209.      of its parts gets its motivation from the other parts.
  10210.  
  10211.    * Send each change as soon as that change is finished.  Sometimes
  10212.      people think they are helping us by accumulating many changes to
  10213.      send them all together.  As explained above, this is absolutely
  10214.      the worst thing you could do.
  10215.  
  10216.      Since you should send each change separately, you might as well
  10217.      send it right away.  That gives us the option of installing it
  10218.      immediately if it is important.
  10219.  
  10220.    * Use `diff -c' to make your diffs.  Diffs without context are hard
  10221.      for us to install reliably.  More than that, they make it hard for
  10222.      us to study the diffs to decide whether we want to install them.
  10223.      Unidiff format is better than contextless diffs, but not as easy
  10224.      to read as `-c' format.
  10225.  
  10226.      If you have GNU diff, use `diff -cp', which shows the name of the
  10227.      function that each change occurs in.
  10228.  
  10229.    * Write the change log entries for your changes.  We get lots of
  10230.      changes, and we don't have time to do all the change log writing
  10231.      ourselves.
  10232.  
  10233.      Read the `ChangeLog' file to see what sorts of information to put
  10234.      in, and to learn the style that we use.  The purpose of the change
  10235.      log is to show people where to find what was changed.  So you need
  10236.      to be specific about what functions you changed; in large
  10237.      functions, it's often helpful to indicate where within the
  10238.      function the change was.
  10239.  
  10240.      On the other hand, once you have shown people where to find the
  10241.      change, you need not explain its purpose.  Thus, if you add a new
  10242.      function, all you need to say about it is that it is new.  If you
  10243.      feel that the purpose needs explaining, it probably does--but the
  10244.      explanation will be much more useful if you put it in comments in
  10245.      the code.
  10246.  
  10247.      If you would like your name to appear in the header line for who
  10248.      made the change, send us the header line.
  10249.  
  10250.    * When you write the fix, keep in mind that we can't install a
  10251.      change that would break other systems.
  10252.  
  10253.      People often suggest fixing a problem by changing
  10254.      machine-independent files such as `toplev.c' to do something
  10255.      special that a particular system needs.  Sometimes it is totally
  10256.      obvious that such changes would break GNU CC for almost all users.
  10257.      We can't possibly make a change like that.  At best it might tell
  10258.      us how to write another patch that would solve the problem
  10259.      acceptably.
  10260.  
  10261.      Sometimes people send fixes that *might* be an improvement in
  10262.      general--but it is hard to be sure of this.  It's hard to install
  10263.      such changes because we have to study them very carefully.  Of
  10264.      course, a good explanation of the reasoning by which you concluded
  10265.      the change was correct can help convince us.
  10266.  
  10267.      The safest changes are changes to the configuration files for a
  10268.      particular machine.  These are safe because they can't create new
  10269.      bugs on other machines.
  10270.  
  10271.      Please help us keep up with the workload by designing the patch in
  10272.      a form that is good to install.
  10273.  
  10274. 
  10275. File: @.Distr.UsingGCC,  Node: Service,  Next: VMS,  Prev: Bugs,  Up: Top
  10276.  
  10277. How To Get Help with GNU CC
  10278. ***************************
  10279.  
  10280.    If you need help installing, using or changing GNU CC, there are two
  10281. ways to find it:
  10282.  
  10283.    * Send a message to a suitable network mailing list.  First try
  10284.      `bug-gcc@prep.ai.mit.edu', and if that brings no response, try
  10285.      `help-gcc@prep.ai.mit.edu'.
  10286.  
  10287.    * Look in the service directory for someone who might help you for a
  10288.      fee.  The service directory is found in the file named `SERVICE'
  10289.      in the GNU CC distribution.
  10290.  
  10291. 
  10292. File: @.Distr.UsingGCC,  Node: VMS,  Next: Index,  Prev: Service,  Up: Top
  10293.  
  10294. Using GNU CC on VMS
  10295. *******************
  10296.  
  10297. * Menu:
  10298.  
  10299. * Include Files and VMS::  Where the preprocessor looks for the include files.
  10300. * Global Declarations::    How to do globaldef, globalref and globalvalue with
  10301.                            GNU CC.
  10302. * VMS Misc::           Misc information.
  10303.  
  10304. 
  10305. File: @.Distr.UsingGCC,  Node: Include Files and VMS,  Next: Global Declarations,  Up: VMS
  10306.  
  10307. Include Files and VMS
  10308. =====================
  10309.  
  10310.    Due to the differences between the filesystems of Unix and VMS, GNU
  10311. CC attempts to translate file names in `#include' into names that VMS
  10312. will understand.  The basic strategy is to prepend a prefix to the
  10313. specification of the include file, convert the whole filename to a VMS
  10314. filename, and then try to open the file.  GNU CC tries various prefixes
  10315. one by one until one of them succeeds:
  10316.  
  10317.   1. The first prefix is the `GNU_CC_INCLUDE:' logical name: this is
  10318.      where GNU C header files are traditionally stored.  If you wish to
  10319.      store header files in non-standard locations, then you can assign
  10320.      the logical `GNU_CC_INCLUDE' to be a search list, where each
  10321.      element of the list is suitable for use with a rooted logical.
  10322.  
  10323.   2. The next prefix tried is `SYS$SYSROOT:[SYSLIB.]'.  This is where
  10324.      VAX-C header files are traditionally stored.
  10325.  
  10326.   3. If the include file specification by itself is a valid VMS
  10327.      filename, the preprocessor then uses this name with no prefix in
  10328.      an attempt to open the include file.
  10329.  
  10330.   4. If the file specification is not a valid VMS filename (i.e. does
  10331.      not contain a device or a directory specifier, and contains a `/'
  10332.      character), the preprocessor tries to convert it from Unix syntax
  10333.      to VMS syntax.
  10334.  
  10335.      Conversion works like this: the first directory name becomes a
  10336.      device, and the rest of the directories are converted into
  10337.      VMS-format directory names.  For example, the name `X11/foobar.h'
  10338.      is translated to `X11:[000000]foobar.h' or `X11:foobar.h',
  10339.      whichever one can be opened.  This strategy allows you to assign a
  10340.      logical name to point to the actual location of the header files.
  10341.  
  10342.   5. If none of these strategies succeeds, the `#include' fails.
  10343.  
  10344.    Include directives of the form:
  10345.  
  10346.      #include foobar
  10347.  
  10348. are a common source of incompatibility between VAX-C and GNU CC.  VAX-C
  10349. treats this much like a standard `#include <foobar.h>' directive.  That
  10350. is incompatible with the ANSI C behavior implemented by GNU CC: to
  10351. expand the name `foobar' as a macro.  Macro expansion should eventually
  10352. yield one of the two standard formats for `#include':
  10353.  
  10354.      #include "FILE"
  10355.      #include <FILE>
  10356.  
  10357.    If you have this problem, the best solution is to modify the source
  10358. to convert the `#include' directives to one of the two standard forms.
  10359. That will work with either compiler.  If you want a quick and dirty fix,
  10360. define the file names as macros with the proper expansion, like this:
  10361.  
  10362.      #define stdio <stdio.h>
  10363.  
  10364. This will work, as long as the name doesn't conflict with anything else
  10365. in the program.
  10366.  
  10367.    Another source of incompatibility is that VAX-C assumes that:
  10368.  
  10369.      #include "foobar"
  10370.  
  10371. is actually asking for the file `foobar.h'.  GNU CC does not make this
  10372. assumption, and instead takes what you ask for literally; it tries to
  10373. read the file `foobar'.  The best way to avoid this problem is to
  10374. always specify the desired file extension in your include directives.
  10375.  
  10376.    GNU CC for VMS is distributed with a set of include files that is
  10377. sufficient to compile most general purpose programs.  Even though the
  10378. GNU CC distribution does not contain header files to define constants
  10379. and structures for some VMS system-specific functions, there is no
  10380. reason why you cannot use GNU CC with any of these functions.  You first
  10381. may have to generate or create header files, either by using the public
  10382. domain utility `UNSDL' (which can be found on a DECUS tape), or by
  10383. extracting the relevant modules from one of the system macro libraries,
  10384. and using an editor to construct a C header file.
  10385.  
  10386.    A `#include' file name cannot contain a DECNET node name.  The
  10387. preprocessor reports an I/O error if you attempt to use a node name,
  10388. whether explicitly, or implicitly via a logical name.
  10389.  
  10390. 
  10391. File: @.Distr.UsingGCC,  Node: Global Declarations,  Next: VMS Misc,  Prev: Include Files and VMS,  Up: VMS
  10392.  
  10393. Global Declarations and VMS
  10394. ===========================
  10395.  
  10396.    GNU CC does not provide the `globalref', `globaldef' and
  10397. `globalvalue' keywords of VAX-C.  You can get the same effect with an
  10398. obscure feature of GAS, the GNU assembler.  (This requires GAS version
  10399. 1.39 or later.)  The following macros allow you to use this feature in
  10400. a fairly natural way:
  10401.  
  10402.      #ifdef __GNUC__
  10403.      #define GLOBALREF(TYPE,NAME)                      \
  10404.        TYPE NAME                                       \
  10405.        asm ("_$$PsectAttributes_GLOBALSYMBOL$$" #NAME)
  10406.      #define GLOBALDEF(TYPE,NAME,VALUE)                \
  10407.        TYPE NAME                                       \
  10408.        asm ("_$$PsectAttributes_GLOBALSYMBOL$$" #NAME) \
  10409.          = VALUE
  10410.      #define GLOBALVALUEREF(TYPE,NAME)                 \
  10411.        const TYPE NAME[1]                              \
  10412.        asm ("_$$PsectAttributes_GLOBALVALUE$$" #NAME)
  10413.      #define GLOBALVALUEDEF(TYPE,NAME,VALUE)           \
  10414.        const TYPE NAME[1]                              \
  10415.        asm ("_$$PsectAttributes_GLOBALVALUE$$" #NAME)  \
  10416.          = {VALUE}
  10417.      #else
  10418.      #define GLOBALREF(TYPE,NAME) \
  10419.        globalref TYPE NAME
  10420.      #define GLOBALDEF(TYPE,NAME,VALUE) \
  10421.        globaldef TYPE NAME = VALUE
  10422.      #define GLOBALVALUEDEF(TYPE,NAME,VALUE) \
  10423.        globalvalue TYPE NAME = VALUE
  10424.      #define GLOBALVALUEREF(TYPE,NAME) \
  10425.        globalvalue TYPE NAME
  10426.      #endif
  10427.  
  10428. (The `_$$PsectAttributes_GLOBALSYMBOL' prefix at the start of the name
  10429. is removed by the assembler, after it has modified the attributes of
  10430. the symbol).  These macros are provided in the VMS binaries
  10431. distribution in a header file `GNU_HACKS.H'.  An example of the usage
  10432. is:
  10433.  
  10434.      GLOBALREF (int, ijk);
  10435.      GLOBALDEF (int, jkl, 0);
  10436.  
  10437.    The macros `GLOBALREF' and `GLOBALDEF' cannot be used
  10438. straightforwardly for arrays, since there is no way to insert the array
  10439. dimension into the declaration at the right place.  However, you can
  10440. declare an array with these macros if you first define a typedef for the
  10441. array type, like this:
  10442.  
  10443.      typedef int intvector[10];
  10444.      GLOBALREF (intvector, foo);
  10445.  
  10446.    Array and structure initializers will also break the macros; you can
  10447. define the initializer to be a macro of its own, or you can expand the
  10448. `GLOBALDEF' macro by hand.  You may find a case where you wish to use
  10449. the `GLOBALDEF' macro with a large array, but you are not interested in
  10450. explicitly initializing each element of the array.  In such cases you
  10451. can use an initializer like: `{0,}', which will initialize the entire
  10452. array to `0'.
  10453.  
  10454.    A shortcoming of this implementation is that a variable declared with
  10455. `GLOBALVALUEREF' or `GLOBALVALUEDEF' is always an array.  For example,
  10456. the declaration:
  10457.  
  10458.      GLOBALVALUEREF(int, ijk);
  10459.  
  10460. declares the variable `ijk' as an array of type `int [1]'.  This is
  10461. done because a globalvalue is actually a constant; its "value" is what
  10462. the linker would normally consider an address.  That is not how an
  10463. integer value works in C, but it is how an array works.  So treating
  10464. the symbol as an array name gives consistent results--with the
  10465. exception that the value seems to have the wrong type.  *Don't try to
  10466. access an element of the array.*  It doesn't have any elements.  The
  10467. array "address" may not be the address of actual storage.
  10468.  
  10469.    The fact that the symbol is an array may lead to warnings where the
  10470. variable is used.  Insert type casts to avoid the warnings.  Here is an
  10471. example; it takes advantage of the ANSI C feature allowing macros that
  10472. expand to use the same name as the macro itself.
  10473.  
  10474.      GLOBALVALUEREF (int, ss$_normal);
  10475.      GLOBALVALUEDEF (int, xyzzy,123);
  10476.      #ifdef __GNUC__
  10477.      #define ss$_normal ((int) ss$_normal)
  10478.      #define xyzzy ((int) xyzzy)
  10479.      #endif
  10480.  
  10481.    Don't use `globaldef' or `globalref' with a variable whose type is
  10482. an enumeration type; this is not implemented.  Instead, make the
  10483. variable an integer, and use a `globalvaluedef' for each of the
  10484. enumeration values.  An example of this would be:
  10485.  
  10486.      #ifdef __GNUC__
  10487.      GLOBALDEF (int, color, 0);
  10488.      GLOBALVALUEDEF (int, RED, 0);
  10489.      GLOBALVALUEDEF (int, BLUE, 1);
  10490.      GLOBALVALUEDEF (int, GREEN, 3);
  10491.      #else
  10492.      enum globaldef color {RED, BLUE, GREEN = 3};
  10493.      #endif
  10494.  
  10495. 
  10496. File: @.Distr.UsingGCC,  Node: VMS Misc,  Prev: Global Declarations,  Up: VMS
  10497.  
  10498. Other VMS Issues
  10499. ================
  10500.  
  10501.    GNU CC automatically arranges for `main' to return 1 by default if
  10502. you fail to specify an explicit return value.  This will be interpreted
  10503. by VMS as a status code indicating a normal successful completion.
  10504. Version 1 of GNU CC did not provide this default.
  10505.  
  10506.    GNU CC on VMS works only with the GNU assembler, GAS.  You need
  10507. version 1.37 or later of GAS in order to produce value debugging
  10508. information for the VMS debugger.  Use the ordinary VMS linker with the
  10509. object files produced by GAS.
  10510.  
  10511.    Under previous versions of GNU CC, the generated code would
  10512. occasionally give strange results when linked to the sharable `VAXCRTL'
  10513. library.  Now this should work.
  10514.  
  10515.    A caveat for use of `const' global variables: the `const' modifier
  10516. must be specified in every external declaration of the variable in all
  10517. of the source files that use that variable.  Otherwise the linker will
  10518. issue warnings about conflicting attributes for the variable.  Your
  10519. program will still work despite the warnings, but the variable will be
  10520. placed in writable storage.
  10521.  
  10522.    Although the VMS linker does distinguish between upper and lower case
  10523. letters in global symbols, most VMS compilers convert all such symbols
  10524. into upper case and most run-time library routines also have upper case
  10525. names.  To be able to reliably call such routines, GNU CC (by means of
  10526. the assembler GAS) converts global symbols into upper case like other
  10527. VMS compilers.  However, since the usual practice in C is to distinguish
  10528. case, GNU CC (via GAS) tries to preserve usual C behavior by augmenting
  10529. each name that is not all lower case.  This means truncating the name
  10530. to at most 23 characters and then adding more characters at the end
  10531. which encode the case pattern of those 23.   Names which contain at
  10532. least one dollar sign are an exception; they are converted directly into
  10533. upper case without augmentation.
  10534.  
  10535.    Name augmentation yields bad results for programs that use
  10536. precompiled libraries (such as Xlib) which were generated by another
  10537. compiler.  You can use the compiler option `/NOCASE_HACK' to inhibit
  10538. augmentation; it makes external C functions and variables
  10539. case-independent as is usual on VMS.  Alternatively, you could write
  10540. all references to the functions and variables in such libraries using
  10541. lower case; this will work on VMS, but is not portable to other
  10542. systems.  The compiler option `/NAMES' also provides control over
  10543. global name handling.
  10544.  
  10545.    Function and variable names are handled somewhat differently with GNU
  10546. C++.  The GNU C++ compiler performs "name mangling" on function names,
  10547. which means that it adds information to the function name to describe
  10548. the data types of the arguments that the function takes.  One result of
  10549. this is that the name of a function can become very long.  Since the
  10550. VMS linker only recognizes the first 31 characters in a name, special
  10551. action is taken to ensure that each function and variable has a unique
  10552. name that can be represented in 31 characters.
  10553.  
  10554.    If the name (plus a name augmentation, if required) is less than 32
  10555. characters in length, then no special action is performed.  If the name
  10556. is longer than 31 characters, the assembler (GAS) will generate a hash
  10557. string based upon the function name, truncate the function name to 23
  10558. characters, and append the hash string to the truncated name.  If the
  10559. `/VERBOSE' compiler option is used, the assembler will print both the
  10560. full and truncated names of each symbol that is truncated.
  10561.  
  10562.    The `/NOCASE_HACK' compiler option should not be used when you are
  10563. compiling programs that use libg++.  libg++ has several instances of
  10564. objects (i.e.  `Filebuf' and `filebuf') which become indistinguishable
  10565. in a case-insensitive environment.  This leads to cases where you need
  10566. to inhibit augmentation selectively (if you were using libg++ and Xlib
  10567. in the same program, for example).  There is no special feature for
  10568. doing this, but you can get the result by defining a macro for each
  10569. mixed case symbol for which you wish to inhibit augmentation.  The
  10570. macro should expand into the lower case equivalent of itself.  For
  10571. example:
  10572.  
  10573.      #define StuDlyCapS studlycaps
  10574.  
  10575.    These macro definitions can be placed in a header file to minimize
  10576. the number of changes to your source code.
  10577.  
  10578. 
  10579. File: @.Distr.UsingGCC,  Node: Index,  Prev: VMS,  Up: Top
  10580.  
  10581. Index
  10582. *****
  10583.  
  10584. * Menu:
  10585.  
  10586. * $:                                    Dollar Signs.
  10587. * ':                                    Incompatibilities.
  10588. * 3b1 installation:                     3b1 Install.
  10589. * <?:                                   Min and Max.
  10590. * >?:                                   Min and Max.
  10591. * ?: side effect:                       Conditionals.
  10592. * #pragma implementation, implied:      C++ Interface.
  10593. * #pragma, reason for not using:        Function Attributes.
  10594. * ?: extensions:                        Lvalues.
  10595. * ?: extensions:                        Conditionals.
  10596. * aligned attribute:                    Variable Attributes.
  10597. * alloca and SunOs:                     Installation.
  10598. * alloca vs variable-length arrays:     Variable Length.
  10599. * alloca, for SunOs:                    Sun Install.
  10600. * alloca, for Unos:                     Unos Install.
  10601. * asm constraints:                      Constraints.
  10602. * asm expressions:                      Extended Asm.
  10603. * const applied to function:            Function Attributes.
  10604. * float as function value type:         Incompatibilities.
  10605. * format attribute:                     Function Attributes.
  10606. * fscanf, and constant strings:         Incompatibilities.
  10607. * g++ 1.XX:                             Invoking G++.
  10608. * g++ older version:                    Invoking G++.
  10609. * g++, separate compiler:               Invoking G++.
  10610. * genflags, crash on Sun 4:             Installation Problems.
  10611. * goto in C++:                          Destructors and Goto.
  10612. * gprof:                                Debugging Options.
  10613. * inline automatic for C++ member fns:  Inline.
  10614. * long long data types:                 Long Long.
  10615. * longjmp and automatic variables:      C Dialect Options.
  10616. * longjmp incompatibilities:            Incompatibilities.
  10617. * longjmp warnings:                     Warning Options.
  10618. * main and the exit status:             VMS Misc.
  10619. * mktemp, and constant strings:         Incompatibilities.
  10620. * mode attribute:                       Variable Attributes.
  10621. * packed attribute:                     Variable Attributes.
  10622. * prof:                                 Debugging Options.
  10623. * qsort, and global register variables: Global Reg Vars.
  10624. * return, in C++ function header:       Naming Results.
  10625. * scanf, and constant strings:          Incompatibilities.
  10626. * setjmp incompatibilities:             Incompatibilities.
  10627. * sscanf, and constant strings:         Incompatibilities.
  10628. * tcov:                                 Debugging Options.
  10629. * volatile applied to function:         Function Attributes.
  10630. * stdarg.h and RT PC:                   RT Options.
  10631. * varargs.h and RT PC:                  RT Options.
  10632. * VAXCRTL:                              VMS Misc.
  10633. * ! in constraint:                      Multi-Alternative.
  10634. * # in constraint:                      Modifiers.
  10635. * % in constraint:                      Modifiers.
  10636. * & in constraint:                      Modifiers.
  10637. * + in constraint:                      Modifiers.
  10638. * 0 in constraint:                      Simple Constraints.
  10639. * < in constraint:                      Simple Constraints.
  10640. * = in constraint:                      Modifiers.
  10641. * > in constraint:                      Simple Constraints.
  10642. * ? in constraint:                      Multi-Alternative.
  10643. * d in constraint:                      Simple Constraints.
  10644. * E in constraint:                      Simple Constraints.
  10645. * F in constraint:                      Simple Constraints.
  10646. * g in constraint:                      Simple Constraints.
  10647. * G in constraint:                      Simple Constraints.
  10648. * H in constraint:                      Simple Constraints.
  10649. * I in constraint:                      Simple Constraints.
  10650. * i in constraint:                      Simple Constraints.
  10651. * m in constraint:                      Simple Constraints.
  10652. * n in constraint:                      Simple Constraints.
  10653. * o in constraint:                      Simple Constraints.
  10654. * p in constraint:                      Simple Constraints.
  10655. * Q, in constraint:                     Simple Constraints.
  10656. * r in constraint:                      Simple Constraints.
  10657. * s in constraint:                      Simple Constraints.
  10658. * V in constraint:                      Simple Constraints.
  10659. * X in constraint:                      Simple Constraints.
  10660. * _ in variables in macros:             Naming Types.
  10661. * address constraints:                  Simple Constraints.
  10662. * address of a label:                   Labels as Values.
  10663. * address_operand:                      Simple Constraints.
  10664. * alignment:                            Alignment.
  10665. * Alliant:                              Interoperation.
  10666. * alternate keywords:                   Alternate Keywords.
  10667. * AMD29K options:                       AMD29K Options.
  10668. * ANSI support:                         C Dialect Options.
  10669. * apostrophes:                          Incompatibilities.
  10670. * arguments in frame (88k):             M88K Options.
  10671. * arrays of length zero:                Zero Length.
  10672. * arrays of variable length:            Variable Length.
  10673. * arrays, non-lvalue:                   Subscripting.
  10674. * assembler instructions:               Extended Asm.
  10675. * assembler names for identifiers:      Asm Labels.
  10676. * assembler syntax, 88k:                M88K Options.
  10677. * assembly code, invalid:               Bug Criteria.
  10678. * attribute of variables:               Variable Attributes.
  10679. * autoincrement/decrement addressing:   Simple Constraints.
  10680. * automatic inline for C++ member fns:  Inline.
  10681. * backtrace for bug reports:            Bug Reporting.
  10682. * Bison parser generator:               Installation.
  10683. * bit shift overflow (88k):             M88K Options.
  10684. * bug criteria:                         Bug Criteria.
  10685. * bug report mailing lists:             Bug Lists.
  10686. * bugs:                                 Bugs.
  10687. * bugs, known:                          Trouble.
  10688. * C compilation options:                Invoking GCC.
  10689. * C intermediate output, nonexistent:   G++ and GCC.
  10690. * C language extensions:                C Extensions.
  10691. * C language, traditional:              C Dialect Options.
  10692. * C++:                                  G++ and GCC.
  10693. * c++:                                  Invoking G++.
  10694. * C++ compilation options:              Invoking GCC.
  10695. * C++ interface and implementation headers: C++ Interface.
  10696. * C++ language extensions:              C++ Extensions.
  10697. * C++ member fns, automatically inline: Inline.
  10698. * C++ misunderstandings:                C++ Misunderstandings.
  10699. * C++ named return value:               Naming Results.
  10700. * C++ options, command line:            C++ Dialect Options.
  10701. * C++ pragmas, effect on inlining:      C++ Interface.
  10702. * C++ source file suffixes:             Invoking G++.
  10703. * C++ static data, declaring and defining: Static Definitions.
  10704. * case labels in initializers:          Labeled Elements.
  10705. * case ranges:                          Case Ranges.
  10706. * case sensitivity and VMS:             VMS Misc.
  10707. * cast to a union:                      Cast to Union.
  10708. * casts as lvalues:                     Lvalues.
  10709. * code generation conventions:          Code Gen Options.
  10710. * command options:                      Invoking GCC.
  10711. * compilation in a separate directory:  Other Dir.
  10712. * compiler bugs, reporting:             Bug Reporting.
  10713. * compiler compared to C++ preprocessor: G++ and GCC.
  10714. * compiler options, C++:                C++ Dialect Options.
  10715. * compiler version, specifying:         Target Options.
  10716. * COMPILER_PATH:                        Environment Variables.
  10717. * complex numbers:                      Complex.
  10718. * compound expressions as lvalues:      Lvalues.
  10719. * computed gotos:                       Labels as Values.
  10720. * conditional expressions as lvalues:   Lvalues.
  10721. * conditional expressions, extensions:  Conditionals.
  10722. * conflicting types:                    Disappointments.
  10723. * constants in constraints:             Simple Constraints.
  10724. * constraint modifier characters:       Modifiers.
  10725. * constraint, matching:                 Simple Constraints.
  10726. * constraints, asm:                     Constraints.
  10727. * constraints, machine specific:        Machine Constraints.
  10728. * constructing calls:                   Constructing Calls.
  10729. * constructor expressions:              Constructors.
  10730. * constructors vs goto:                 Destructors and Goto.
  10731. * contributors:                         Contributors.
  10732. * Convex options:                       Convex Options.
  10733. * core dump:                            Bug Criteria.
  10734. * CPLUS_INCLUDE_PATH:                   Environment Variables.
  10735. * cross compiling:                      Target Options.
  10736. * cross-compiler, installation:         Cross-Compiler.
  10737. * C_INCLUDE_PATH:                       Environment Variables.
  10738. * DBX:                                  Interoperation.
  10739. * deallocating variable length arrays:  Variable Length.
  10740. * debugging information options:        Debugging Options.
  10741. * debugging, 88k OCS:                   M88K Options.
  10742. * debug_rtx:                            Bug Reporting.
  10743. * declaration scope:                    Incompatibilities.
  10744. * declarations inside expressions:      Statement Exprs.
  10745. * declaring attributes of functions:    Function Attributes.
  10746. * declaring static data in C++:         Static Definitions.
  10747. * defining static data in C++:          Static Definitions.
  10748. * dependencies for make as output:      Environment Variables.
  10749. * dependencies, make:                   Preprocessor Options.
  10750. * DEPENDENCIES_OUTPUT:                  Environment Variables.
  10751. * destructors vs goto:                  Destructors and Goto.
  10752. * detecting -traditional:               C Dialect Options.
  10753. * dialect options:                      C Dialect Options.
  10754. * digits in constraint:                 Simple Constraints.
  10755. * directory options:                    Directory Options.
  10756. * divide instruction, 88k:              M88K Options.
  10757. * dollar signs in identifier names:     Dollar Signs.
  10758. * double-word arithmetic:               Long Long.
  10759. * downward funargs:                     Nested Functions.
  10760. * enumeration clash warnings:           Warning Options.
  10761. * environment variables:                Environment Variables.
  10762. * error messages:                       Warnings and Errors.
  10763. * escape sequences, traditional:        C Dialect Options.
  10764. * exclamation point:                    Multi-Alternative.
  10765. * exit status and VMS:                  VMS Misc.
  10766. * explicit register variables:          Explicit Reg Vars.
  10767. * expressions containing statements:    Statement Exprs.
  10768. * expressions, compound, as lvalues:    Lvalues.
  10769. * expressions, conditional, as lvalues: Lvalues.
  10770. * expressions, constructor:             Constructors.
  10771. * extended asm:                         Extended Asm.
  10772. * extensible constraints:               Simple Constraints.
  10773. * extensions, ?::                       Lvalues.
  10774. * extensions, ?::                       Conditionals.
  10775. * extensions, C language:               C Extensions.
  10776. * extensions, C++ language:             C++ Extensions.
  10777. * external declaration scope:           Incompatibilities.
  10778. * fatal signal:                         Bug Criteria.
  10779. * file name suffix:                     Overall Options.
  10780. * file names:                           Link Options.
  10781. * forwarding calls:                     Constructing Calls.
  10782. * function attributes:                  Function Attributes.
  10783. * function pointers, arithmetic:        Pointer Arith.
  10784. * function prototype declarations:      Function Prototypes.
  10785. * function, size of pointer to:         Pointer Arith.
  10786. * functions that have no side effects:  Function Attributes.
  10787. * functions that never return:          Function Attributes.
  10788. * G++:                                  G++ and GCC.
  10789. * g++:                                  Invoking G++.
  10790. * GCC:                                  G++ and GCC.
  10791. * GCC_EXEC_PREFIX:                      Environment Variables.
  10792. * generalized lvalues:                  Lvalues.
  10793. * global offset table:                  Code Gen Options.
  10794. * global register after longjmp:        Global Reg Vars.
  10795. * global register variables:            Global Reg Vars.
  10796. * GLOBALDEF:                            Global Declarations.
  10797. * GLOBALREF:                            Global Declarations.
  10798. * GLOBALVALUEDEF:                       Global Declarations.
  10799. * GLOBALVALUEREF:                       Global Declarations.
  10800. * GNU CC command options:               Invoking GCC.
  10801. * goto with computed label:             Labels as Values.
  10802. * gp-relative references (MIPS):        MIPS Options.
  10803. * grouping options:                     Invoking GCC.
  10804. * hardware models and configurations, specifying: Submodel Options.
  10805. * header files and VMS:                 Include Files and VMS.
  10806. * HPPA Options:                         HPPA Options.
  10807. * i386 Options:                         i386 Options.
  10808. * IBM RS/6000 Options:                  RS/6000 Options.
  10809. * IBM RT options:                       RT Options.
  10810. * IBM RT PC:                            Interoperation.
  10811. * identifier names, dollar signs in:    Dollar Signs.
  10812. * identifiers, names in assembler code: Asm Labels.
  10813. * identifying source, compiler (88k):   M88K Options.
  10814. * implicit argument: return value:      Naming Results.
  10815. * implied #pragma implementation:       C++ Interface.
  10816. * include files and VMS:                Include Files and VMS.
  10817. * incompatibilities of GNU CC:          Incompatibilities.
  10818. * increment operators:                  Bug Criteria.
  10819. * initializations in expressions:       Constructors.
  10820. * initializers with labeled elements:   Labeled Elements.
  10821. * initializers, non-constant:           Initializers.
  10822. * inline functions:                     Inline.
  10823. * inline functions, omission of:        Inline.
  10824. * inlining and C++ pragmas:             C++ Interface.
  10825. * installation trouble:                 Trouble.
  10826. * installing GNU CC:                    Installation.
  10827. * installing GNU CC on the 3b1:         3b1 Install.
  10828. * installing GNU CC on the Sun:         Sun Install.
  10829. * installing GNU CC on Unos:            Unos Install.
  10830. * installing GNU CC on VMS:             VMS Install.
  10831. * integrating function code:            Inline.
  10832. * Intel 386 Options:                    i386 Options.
  10833. * interface and implementation headers, C++: C++ Interface.
  10834. * intermediate C version, nonexistent:  G++ and GCC.
  10835. * introduction:                         Top.
  10836. * invalid assembly code:                Bug Criteria.
  10837. * invalid input:                        Bug Criteria.
  10838. * invoking g++:                         Invoking G++.
  10839. * keywords, alternate:                  Alternate Keywords.
  10840. * known causes of trouble:              Trouble.
  10841. * labeled elements in initializers:     Labeled Elements.
  10842. * labels as values:                     Labels as Values.
  10843. * language dialect options:             C Dialect Options.
  10844. * large bit shifts (88k):               M88K Options.
  10845. * length-zero arrays:                   Zero Length.
  10846. * Libraries:                            Link Options.
  10847. * LIBRARY_PATH:                         Environment Variables.
  10848. * link options:                         Link Options.
  10849. * load address instruction:             Simple Constraints.
  10850. * local labels:                         Local Labels.
  10851. * local variables in macros:            Naming Types.
  10852. * local variables, specifying registers: Local Reg Vars.
  10853. * longjmp:                              Global Reg Vars.
  10854. * lvalues, generalized:                 Lvalues.
  10855. * M680x0 options:                       M680x0 Options.
  10856. * M88k options:                         M88K Options.
  10857. * machine dependent options:            Submodel Options.
  10858. * machine specific constraints:         Machine Constraints.
  10859. * macro with variable arguments:        Macro Varargs.
  10860. * macros containing asm:                Extended Asm.
  10861. * macros, inline alternative:           Inline.
  10862. * macros, local labels:                 Local Labels.
  10863. * macros, local variables in:           Naming Types.
  10864. * macros, statements in expressions:    Statement Exprs.
  10865. * macros, types of arguments:           Typeof.
  10866. * make:                                 Preprocessor Options.
  10867. * matching constraint:                  Simple Constraints.
  10868. * maximum operator:                     Min and Max.
  10869. * member fns, automatically inline:     Inline.
  10870. * memory references in constraints:     Simple Constraints.
  10871. * messages, warning:                    Warning Options.
  10872. * messages, warning and error:          Warnings and Errors.
  10873. * middle-operands, omitted:             Conditionals.
  10874. * minimum operator:                     Min and Max.
  10875. * MIPS options:                         MIPS Options.
  10876. * misunderstandings in C++:             C++ Misunderstandings.
  10877. * modifiers in constraints:             Modifiers.
  10878. * multiple alternative constraints:     Multi-Alternative.
  10879. * multiprecision arithmetic:            Long Long.
  10880. * name augmentation:                    VMS Misc.
  10881. * named return value in C++:            Naming Results.
  10882. * names used in assembler code:         Asm Labels.
  10883. * naming convention, implementation headers: C++ Interface.
  10884. * naming types:                         Naming Types.
  10885. * nested functions:                     Nested Functions.
  10886. * newline vs string constants:          C Dialect Options.
  10887. * non-constant initializers:            Initializers.
  10888. * non-static inline function:           Inline.
  10889. * OBJC_INCLUDE_PATH:                    Environment Variables.
  10890. * Objective C:                          G++ and GCC.
  10891. * obstack_free:                         3b1 Install.
  10892. * OCS (88k):                            M88K Options.
  10893. * offsettable address:                  Simple Constraints.
  10894. * old-style function definitions:       Function Prototypes.
  10895. * omitted middle-operands:              Conditionals.
  10896. * open coding:                          Inline.
  10897. * operand constraints, asm:             Constraints.
  10898. * optimize options:                     Optimize Options.
  10899. * options to control warnings:          Warning Options.
  10900. * options, C++:                         C++ Dialect Options.
  10901. * options, code generation:             Code Gen Options.
  10902. * options, debugging:                   Debugging Options.
  10903. * options, dialect:                     C Dialect Options.
  10904. * options, directory search:            Directory Options.
  10905. * options, GNU CC command:              Invoking GCC.
  10906. * options, grouping:                    Invoking GCC.
  10907. * options, linking:                     Link Options.
  10908. * options, optimization:                Optimize Options.
  10909. * options, order:                       Invoking GCC.
  10910. * options, preprocessor:                Preprocessor Options.
  10911. * order of evaluation, side effects:    Non-bugs.
  10912. * order of options:                     Invoking GCC.
  10913. * other directory, compilation in:      Other Dir.
  10914. * output file option:                   Overall Options.
  10915. * overloaded virtual fn, warning:       Warning Options.
  10916. * parameter forward declaration:        Variable Length.
  10917. * parser generator, Bison:              Installation.
  10918. * PIC:                                  Code Gen Options.
  10919. * pointer arguments:                    Function Attributes.
  10920. * portions of temporary objects, pointers to: Temporaries.
  10921. * pragma, reason for not using:         Function Attributes.
  10922. * pragmas in C++, effect on inlining:   C++ Interface.
  10923. * pragmas, interface and implementation: C++ Interface.
  10924. * preprocessor options:                 Preprocessor Options.
  10925. * promotion of formal parameters:       Function Prototypes.
  10926. * push address instruction:             Simple Constraints.
  10927. * question mark:                        Multi-Alternative.
  10928. * r0-relative references (88k):         M88K Options.
  10929. * ranges in case statements:            Case Ranges.
  10930. * read-only strings:                    Incompatibilities.
  10931. * register positions in frame (88k):    M88K Options.
  10932. * register positions in frame (88k):    M88K Options.
  10933. * register variable after longjmp:      Global Reg Vars.
  10934. * registers:                            Extended Asm.
  10935. * registers for local variables:        Local Reg Vars.
  10936. * registers in constraints:             Simple Constraints.
  10937. * registers, global allocation:         Explicit Reg Vars.
  10938. * registers, global variables in:       Global Reg Vars.
  10939. * reporting bugs:                       Bugs.
  10940. * rest argument (in macro):             Macro Varargs.
  10941. * return value of main:                 VMS Misc.
  10942. * return value, named, in C++:          Naming Results.
  10943. * RS/6000 Options:                      RS/6000 Options.
  10944. * RT options:                           RT Options.
  10945. * RT PC:                                Interoperation.
  10946. * run-time options:                     Code Gen Options.
  10947. * scope of a variable length array:     Variable Length.
  10948. * scope of declaration:                 Disappointments.
  10949. * scope of external declarations:       Incompatibilities.
  10950. * search path:                          Directory Options.
  10951. * second include path:                  Preprocessor Options.
  10952. * separate directory, compilation in:   Other Dir.
  10953. * sequential consistency on 88k:        M88K Options.
  10954. * setjmp:                               Global Reg Vars.
  10955. * shared strings:                       Incompatibilities.
  10956. * shared VMS run time system:           VMS Misc.
  10957. * side effect in ?::                    Conditionals.
  10958. * side effects, macro argument:         Statement Exprs.
  10959. * side effects, order of evaluation:    Non-bugs.
  10960. * simple constraints:                   Simple Constraints.
  10961. * sizeof:                               Typeof.
  10962. * smaller data references (88k):        M88K Options.
  10963. * smaller data references (MIPS):       MIPS Options.
  10964. * SPARC options:                        SPARC Options.
  10965. * specified registers:                  Explicit Reg Vars.
  10966. * specifying compiler version and target machine: Target Options.
  10967. * specifying hardware config:           Submodel Options.
  10968. * specifying machine version:           Target Options.
  10969. * specifying registers for local variables: Local Reg Vars.
  10970. * stage1:                               Installation.
  10971. * start files:                          Tools and Libraries.
  10972. * statements inside expressions:        Statement Exprs.
  10973. * static data in C++, declaring and defining: Static Definitions.
  10974. * string constants:                     Incompatibilities.
  10975. * string constants vs newline:          C Dialect Options.
  10976. * structure passing (88k):              M88K Options.
  10977. * structures:                           Incompatibilities.
  10978. * structures, constructor expression:   Constructors.
  10979. * submodel options:                     Submodel Options.
  10980. * subscripting:                         Subscripting.
  10981. * subscripting and function values:     Subscripting.
  10982. * suffixes for C++ source:              Invoking G++.
  10983. * Sun installation:                     Sun Install.
  10984. * suppressing warnings:                 Warning Options.
  10985. * surprises in C++:                     C++ Misunderstandings.
  10986. * SVr4:                                 M88K Options.
  10987. * syntax checking:                      Warning Options.
  10988. * target machine, specifying:           Target Options.
  10989. * target options:                       Target Options.
  10990. * template debugging:                   Warning Options.
  10991. * temporaries, lifetime of:             Temporaries.
  10992. * thunks:                               Nested Functions.
  10993. * TMPDIR:                               Environment Variables.
  10994. * traditional C language:               C Dialect Options.
  10995. * type alignment:                       Alignment.
  10996. * typedef names as function parameters: Incompatibilities.
  10997. * typeof:                               Typeof.
  10998. * Ultrix calling convention:            Interoperation.
  10999. * undefined behavior:                   Bug Criteria.
  11000. * undefined function value:             Bug Criteria.
  11001. * underscores in variables in macros:   Naming Types.
  11002. * underscores, avoiding (88k):          M88K Options.
  11003. * union, casting to a:                  Cast to Union.
  11004. * unions:                               Incompatibilities.
  11005. * Unos installation:                    Unos Install.
  11006. * value after longjmp:                  Global Reg Vars.
  11007. * variable alignment:                   Alignment.
  11008. * variable attributes:                  Variable Attributes.
  11009. * variable number of arguments:         Macro Varargs.
  11010. * variable-length array scope:          Variable Length.
  11011. * variable-length arrays:               Variable Length.
  11012. * variables in specified registers:     Explicit Reg Vars.
  11013. * variables, local, in macros:          Naming Types.
  11014. * Vax calling convention:               Interoperation.
  11015. * VAX options:                          VAX Options.
  11016. * VMS and case sensitivity:             VMS Misc.
  11017. * VMS and include files:                Include Files and VMS.
  11018. * VMS installation:                     VMS Install.
  11019. * void pointers, arithmetic:            Pointer Arith.
  11020. * void, size of pointer to:             Pointer Arith.
  11021. * warning for enumeration conversions:  Warning Options.
  11022. * warning for overloaded virtual fn:    Warning Options.
  11023. * warning messages:                     Warning Options.
  11024. * warnings vs errors:                   Warnings and Errors.
  11025. * whitespace:                           Incompatibilities.
  11026. * zero division on 88k:                 M88K Options.
  11027. * zero-length arrays:                   Zero Length.
  11028. * __builtin_apply:                      Constructing Calls.
  11029. * __builtin_apply_args:                 Constructing Calls.
  11030. * __builtin_return:                     Constructing Calls.
  11031.  
  11032.  
  11033. 
  11034. Tag Table:
  11035. Node: Top1295
  11036. Node: Copying2372
  11037. Node: Contributors21528
  11038. Node: Boycott26137
  11039. Node: G++ and GCC31663
  11040. Node: Invoking GCC33006
  11041. Node: Option Summary36393
  11042. Node: Overall Options44450
  11043. Node: Invoking G++49010
  11044. Node: C Dialect Options50890
  11045. Node: C++ Dialect Options59160
  11046. Node: Warning Options66239
  11047. Node: Debugging Options79484
  11048. Node: Optimize Options87649
  11049. Node: Preprocessor Options97642
  11050. Node: Assembler Options103236
  11051. Node: Link Options103568
  11052. Node: Directory Options107584
  11053. Node: Target Options110492
  11054. Node: Submodel Options114227
  11055. Node: M680x0 Options115358
  11056. Node: VAX Options118452
  11057. Node: SPARC Options118995
  11058. Node: Convex Options121059
  11059. Node: AMD29K Options123248
  11060. Node: M88K Options125048
  11061. Node: RS/6000 Options131849
  11062. Node: RT Options132422
  11063. Node: MIPS Options134122
  11064. Node: i386 Options140004
  11065. Node: HPPA Options141358
  11066. Node: Intel 960 Options143227
  11067. Node: DEC Alpha Options145845
  11068. Node: System V Options147526
  11069. Node: Code Gen Options148223
  11070. Node: Environment Variables156496
  11071. Node: Running Protoize160512
  11072. Node: Installation166749
  11073. Node: Other Dir202161
  11074. Node: Cross-Compiler203853
  11075. Node: Steps of Cross205673
  11076. Node: Configure Cross206799
  11077. Node: Tools and Libraries207456
  11078. Node: Cross Runtime209907
  11079. Node: Cross Headers213667
  11080. Node: Build Cross215660
  11081. Node: PA Install217573
  11082. Node: Sun Install219883
  11083. Node: 3b1 Install221630
  11084. Node: Unos Install222671
  11085. Node: VMS Install224219
  11086. Node: WE32K Install234162
  11087. Node: MIPS Install235549
  11088. Node: Collect2238419
  11089. Node: Header Dirs241270
  11090. Node: C Extensions242692
  11091. Node: Statement Exprs245872
  11092. Node: Local Labels247774
  11093. Node: Labels as Values249844
  11094. Node: Nested Functions251717
  11095. Node: Constructing Calls255278
  11096. Node: Naming Types257343
  11097. Node: Typeof258445
  11098. Node: Lvalues260318
  11099. Node: Conditionals262591
  11100. Node: Long Long263490
  11101. Node: Complex264946
  11102. Node: Zero Length266759
  11103. Node: Variable Length267443
  11104. Node: Macro Varargs269976
  11105. Node: Subscripting272087
  11106. Node: Pointer Arith272578
  11107. Node: Initializers273151
  11108. Node: Constructors273605
  11109. Node: Labeled Elements275307
  11110. Node: Case Ranges277422
  11111. Node: Cast to Union278389
  11112. Node: Function Attributes279475
  11113. Node: Function Prototypes284339
  11114. Node: Dollar Signs286052
  11115. Node: Character Escapes286847
  11116. Node: Alignment287136
  11117. Node: Variable Attributes288620
  11118. Node: Inline291527
  11119. Node: Extended Asm295270
  11120. Node: Constraints305566
  11121. Node: Simple Constraints306417
  11122. Node: Multi-Alternative312342
  11123. Node: Modifiers314061
  11124. Node: Machine Constraints315753
  11125. Node: Asm Labels323233
  11126. Node: Explicit Reg Vars324559
  11127. Node: Global Reg Vars325815
  11128. Node: Local Reg Vars330388
  11129. Node: Alternate Keywords331988
  11130. Node: Incomplete Enums333398
  11131. Node: Function Names334114
  11132. Node: C++ Extensions335127
  11133. Node: Naming Results336115
  11134. Node: Min and Max339437
  11135. Node: Destructors and Goto340895
  11136. Node: C++ Interface341453
  11137. Node: Trouble346328
  11138. Node: Actual Bugs347746
  11139. Node: Installation Problems348576
  11140. Node: Cross-Compiler Problems360173
  11141. Node: Interoperation361710
  11142. Node: External Bugs374366
  11143. Node: Incompatibilities375830
  11144. Node: Disappointments383532
  11145. Node: C++ Misunderstandings387764
  11146. Node: Static Definitions388419
  11147. Node: Temporaries389481
  11148. Node: Protoize Caveats391693
  11149. Node: Non-bugs395656
  11150. Node: Warnings and Errors404866
  11151. Node: Bugs406645
  11152. Node: Bug Criteria407811
  11153. Node: Bug Lists410249
  11154. Node: Bug Reporting411795
  11155. Node: Sending Patches423747
  11156. Node: Service429107
  11157. Node: VMS429676
  11158. Node: Include Files and VMS430033
  11159. Node: Global Declarations433931
  11160. Node: VMS Misc438248
  11161. Node: Index442582
  11162. 
  11163. End Tag Table
  11164.