home *** CD-ROM | disk | FTP | other *** search
/ APDL Public Domain 1 / APDL_PD1A.iso / program / c / gnu_c / docs / gccuser < prev    next >
Encoding:
GNU Info File  |  1996-05-06  |  560.2 KB  |  13,400 lines

  1. This is Info file !gcc.docs.gccuser, produced by Makeinfo-1.63 from the
  2. input file texi.gcc.
  3.  
  4.    This file documents the use of the GNU compiler.
  5.  
  6.    Published by the Free Software Foundation 59 Temple Place - Suite 330
  7. Boston, MA 02111-1307 USA
  8.  
  9.    Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995 Free Software
  10. Foundation, Inc.
  11.  
  12.    Permission is granted to make and distribute verbatim copies of this
  13. manual provided the copyright notice and this permission notice are
  14. preserved on all copies.
  15.  
  16.    Permission is granted to copy and distribute modified versions of
  17. this manual under the conditions for verbatim copying, provided also
  18. that the sections entitled "GNU General Public License," "Funding for
  19. Free Software," and "Protect Your Freedom--Fight `Look And Feel'" are
  20. included exactly as in the original, and provided that the entire
  21. resulting derived work is distributed under the terms of a permission
  22. notice identical to this one.
  23.  
  24.    Permission is granted to copy and distribute translations of this
  25. manual into another language, under the above conditions for modified
  26. versions, except that the sections entitled "GNU General Public
  27. License," "Funding for Free Software," and "Protect Your Freedom--Fight
  28. `Look And Feel'", and this permission notice, may be included in
  29. translations approved by the Free Software Foundation instead of in the
  30. original English.
  31.  
  32. 
  33. File: !gcc.docs.gccuser,  Node: Top,  Next: Copying,  Up: (DIR)
  34.  
  35. Introduction
  36. ************
  37.  
  38.    This manual documents how to run and install the GNU compiler, as
  39. well as its new features and incompatibilities, and how to report bugs.
  40. It corresponds to GNU CC version 2.7.2.
  41.  
  42. * Menu:
  43.  
  44. * Copying::         GNU General Public License says
  45.                      how you can copy and share GNU CC.
  46. * Contributors::    People who have contributed to GNU CC.
  47. * Funding::         How to help assure funding for free software.
  48. * Look and Feel::   Protect your freedom--fight "look and feel".
  49.  
  50. * G++ and GCC::     You can compile C or C++ programs.
  51. * Invoking GCC::    Command options supported by `gcc'.
  52. * Installation::    How to configure, compile and install GNU CC.
  53. * C Extensions::    GNU extensions to the C language family.
  54. * C++ Extensions::  GNU extensions to the C++ language.
  55. * Trouble::         If you have trouble installing GNU CC.
  56. * Bugs::            How, why and where to report bugs.
  57. * Service::         How to find suppliers of support for GNU CC.
  58. * VMS::             Using GNU CC on VMS.
  59.  
  60. * Index::        Index of concepts and symbol names.
  61.  
  62. 
  63. File: !gcc.docs.gccuser,  Node: Copying,  Next: Contributors,  Prev: Top,  Up: Top
  64.  
  65. GNU GENERAL PUBLIC LICENSE
  66. **************************
  67.  
  68.                          Version 2, June 1991
  69.  
  70.      Copyright (C) 1989, 1991 Free Software Foundation, Inc.
  71.      59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
  72.      
  73.      Everyone is permitted to copy and distribute verbatim copies
  74.      of this license document, but changing it is not allowed.
  75.  
  76. Preamble
  77. ========
  78.  
  79.    The licenses for most software are designed to take away your
  80. freedom to share and change it.  By contrast, the GNU General Public
  81. License is intended to guarantee your freedom to share and change free
  82. software--to make sure the software is free for all its users.  This
  83. General Public License applies to most of the Free Software
  84. Foundation's software and to any other program whose authors commit to
  85. using it.  (Some other Free Software Foundation software is covered by
  86. the GNU Library General Public License instead.)  You can apply it to
  87. your programs, too.
  88.  
  89.    When we speak of free software, we are referring to freedom, not
  90. price.  Our General Public Licenses are designed to make sure that you
  91. have the freedom to distribute copies of free software (and charge for
  92. this service if you wish), that you receive source code or can get it
  93. if you want it, that you can change the software or use pieces of it in
  94. new free programs; and that you know you can do these things.
  95.  
  96.    To protect your rights, we need to make restrictions that forbid
  97. anyone to deny you these rights or to ask you to surrender the rights.
  98. These restrictions translate to certain responsibilities for you if you
  99. distribute copies of the software, or if you modify it.
  100.  
  101.    For example, if you distribute copies of such a program, whether
  102. gratis or for a fee, you must give the recipients all the rights that
  103. you have.  You must make sure that they, too, receive or can get the
  104. source code.  And you must show them these terms so they know their
  105. rights.
  106.  
  107.    We protect your rights with two steps: (1) copyright the software,
  108. and (2) offer you this license which gives you legal permission to copy,
  109. distribute and/or modify the software.
  110.  
  111.    Also, for each author's protection and ours, we want to make certain
  112. that everyone understands that there is no warranty for this free
  113. software.  If the software is modified by someone else and passed on, we
  114. want its recipients to know that what they have is not the original, so
  115. that any problems introduced by others will not reflect on the original
  116. authors' reputations.
  117.  
  118.    Finally, any free program is threatened constantly by software
  119. patents.  We wish to avoid the danger that redistributors of a free
  120. program will individually obtain patent licenses, in effect making the
  121. program proprietary.  To prevent this, we have made it clear that any
  122. patent must be licensed for everyone's free use or not licensed at all.
  123.  
  124.    The precise terms and conditions for copying, distribution and
  125. modification follow.
  126.  
  127.     TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
  128.  
  129.   0. This License applies to any program or other work which contains a
  130.      notice placed by the copyright holder saying it may be distributed
  131.      under the terms of this General Public License.  The "Program",
  132.      below, refers to any such program or work, and a "work based on
  133.      the Program" means either the Program or any derivative work under
  134.      copyright law: that is to say, a work containing the Program or a
  135.      portion of it, either verbatim or with modifications and/or
  136.      translated into another language.  (Hereinafter, translation is
  137.      included without limitation in the term "modification".)  Each
  138.      licensee is addressed as "you".
  139.  
  140.      Activities other than copying, distribution and modification are
  141.      not covered by this License; they are outside its scope.  The act
  142.      of running the Program is not restricted, and the output from the
  143.      Program is covered only if its contents constitute a work based on
  144.      the Program (independent of having been made by running the
  145.      Program).  Whether that is true depends on what the Program does.
  146.  
  147.   1. You may copy and distribute verbatim copies of the Program's
  148.      source code as you receive it, in any medium, provided that you
  149.      conspicuously and appropriately publish on each copy an appropriate
  150.      copyright notice and disclaimer of warranty; keep intact all the
  151.      notices that refer to this License and to the absence of any
  152.      warranty; and give any other recipients of the Program a copy of
  153.      this License along with the Program.
  154.  
  155.      You may charge a fee for the physical act of transferring a copy,
  156.      and you may at your option offer warranty protection in exchange
  157.      for a fee.
  158.  
  159.   2. You may modify your copy or copies of the Program or any portion
  160.      of it, thus forming a work based on the Program, and copy and
  161.      distribute such modifications or work under the terms of Section 1
  162.      above, provided that you also meet all of these conditions:
  163.  
  164.        a. You must cause the modified files to carry prominent notices
  165.           stating that you changed the files and the date of any change.
  166.  
  167.        b. You must cause any work that you distribute or publish, that
  168.           in whole or in part contains or is derived from the Program
  169.           or any part thereof, to be licensed as a whole at no charge
  170.           to all third parties under the terms of this License.
  171.  
  172.        c. If the modified program normally reads commands interactively
  173.           when run, you must cause it, when started running for such
  174.           interactive use in the most ordinary way, to print or display
  175.           an announcement including an appropriate copyright notice and
  176.           a notice that there is no warranty (or else, saying that you
  177.           provide a warranty) and that users may redistribute the
  178.           program under these conditions, and telling the user how to
  179.           view a copy of this License.  (Exception: if the Program
  180.           itself is interactive but does not normally print such an
  181.           announcement, your work based on the Program is not required
  182.           to print an announcement.)
  183.  
  184.      These requirements apply to the modified work as a whole.  If
  185.      identifiable sections of that work are not derived from the
  186.      Program, and can be reasonably considered independent and separate
  187.      works in themselves, then this License, and its terms, do not
  188.      apply to those sections when you distribute them as separate
  189.      works.  But when you distribute the same sections as part of a
  190.      whole which is a work based on the Program, the distribution of
  191.      the whole must be on the terms of this License, whose permissions
  192.      for other licensees extend to the entire whole, and thus to each
  193.      and every part regardless of who wrote it.
  194.  
  195.      Thus, it is not the intent of this section to claim rights or
  196.      contest your rights to work written entirely by you; rather, the
  197.      intent is to exercise the right to control the distribution of
  198.      derivative or collective works based on the Program.
  199.  
  200.      In addition, mere aggregation of another work not based on the
  201.      Program with the Program (or with a work based on the Program) on
  202.      a volume of a storage or distribution medium does not bring the
  203.      other work under the scope of this License.
  204.  
  205.   3. You may copy and distribute the Program (or a work based on it,
  206.      under Section 2) in object code or executable form under the terms
  207.      of Sections 1 and 2 above provided that you also do one of the
  208.      following:
  209.  
  210.        a. Accompany it with the complete corresponding machine-readable
  211.           source code, which must be distributed under the terms of
  212.           Sections 1 and 2 above on a medium customarily used for
  213.           software interchange; or,
  214.  
  215.        b. Accompany it with a written offer, valid for at least three
  216.           years, to give any third party, for a charge no more than your
  217.           cost of physically performing source distribution, a complete
  218.           machine-readable copy of the corresponding source code, to be
  219.           distributed under the terms of Sections 1 and 2 above on a
  220.           medium customarily used for software interchange; or,
  221.  
  222.        c. Accompany it with the information you received as to the offer
  223.           to distribute corresponding source code.  (This alternative is
  224.           allowed only for noncommercial distribution and only if you
  225.           received the program in object code or executable form with
  226.           such an offer, in accord with Subsection b above.)
  227.  
  228.      The source code for a work means the preferred form of the work for
  229.      making modifications to it.  For an executable work, complete
  230.      source code means all the source code for all modules it contains,
  231.      plus any associated interface definition files, plus the scripts
  232.      used to control compilation and installation of the executable.
  233.      However, as a special exception, the source code distributed need
  234.      not include anything that is normally distributed (in either
  235.      source or binary form) with the major components (compiler,
  236.      kernel, and so on) of the operating system on which the executable
  237.      runs, unless that component itself accompanies the executable.
  238.  
  239.      If distribution of executable or object code is made by offering
  240.      access to copy from a designated place, then offering equivalent
  241.      access to copy the source code from the same place counts as
  242.      distribution of the source code, even though third parties are not
  243.      compelled to copy the source along with the object code.
  244.  
  245.   4. You may not copy, modify, sublicense, or distribute the Program
  246.      except as expressly provided under this License.  Any attempt
  247.      otherwise to copy, modify, sublicense or distribute the Program is
  248.      void, and will automatically terminate your rights under this
  249.      License.  However, parties who have received copies, or rights,
  250.      from you under this License will not have their licenses
  251.      terminated so long as such parties remain in full compliance.
  252.  
  253.   5. You are not required to accept this License, since you have not
  254.      signed it.  However, nothing else grants you permission to modify
  255.      or distribute the Program or its derivative works.  These actions
  256.      are prohibited by law if you do not accept this License.
  257.      Therefore, by modifying or distributing the Program (or any work
  258.      based on the Program), you indicate your acceptance of this
  259.      License to do so, and all its terms and conditions for copying,
  260.      distributing or modifying the Program or works based on it.
  261.  
  262.   6. Each time you redistribute the Program (or any work based on the
  263.      Program), the recipient automatically receives a license from the
  264.      original licensor to copy, distribute or modify the Program
  265.      subject to these terms and conditions.  You may not impose any
  266.      further restrictions on the recipients' exercise of the rights
  267.      granted herein.  You are not responsible for enforcing compliance
  268.      by third parties to this License.
  269.  
  270.   7. If, as a consequence of a court judgment or allegation of patent
  271.      infringement or for any other reason (not limited to patent
  272.      issues), conditions are imposed on you (whether by court order,
  273.      agreement or otherwise) that contradict the conditions of this
  274.      License, they do not excuse you from the conditions of this
  275.      License.  If you cannot distribute so as to satisfy simultaneously
  276.      your obligations under this License and any other pertinent
  277.      obligations, then as a consequence you may not distribute the
  278.      Program at all.  For example, if a patent license would not permit
  279.      royalty-free redistribution of the Program by all those who
  280.      receive copies directly or indirectly through you, then the only
  281.      way you could satisfy both it and this License would be to refrain
  282.      entirely from distribution of the Program.
  283.  
  284.      If any portion of this section is held invalid or unenforceable
  285.      under any particular circumstance, the balance of the section is
  286.      intended to apply and the section as a whole is intended to apply
  287.      in other circumstances.
  288.  
  289.      It is not the purpose of this section to induce you to infringe any
  290.      patents or other property right claims or to contest validity of
  291.      any such claims; this section has the sole purpose of protecting
  292.      the integrity of the free software distribution system, which is
  293.      implemented by public license practices.  Many people have made
  294.      generous contributions to the wide range of software distributed
  295.      through that system in reliance on consistent application of that
  296.      system; it is up to the author/donor to decide if he or she is
  297.      willing to distribute software through any other system and a
  298.      licensee cannot impose that choice.
  299.  
  300.      This section is intended to make thoroughly clear what is believed
  301.      to be a consequence of the rest of this License.
  302.  
  303.   8. If the distribution and/or use of the Program is restricted in
  304.      certain countries either by patents or by copyrighted interfaces,
  305.      the original copyright holder who places the Program under this
  306.      License may add an explicit geographical distribution limitation
  307.      excluding those countries, so that distribution is permitted only
  308.      in or among countries not thus excluded.  In such case, this
  309.      License incorporates the limitation as if written in the body of
  310.      this License.
  311.  
  312.   9. The Free Software Foundation may publish revised and/or new
  313.      versions of the General Public License from time to time.  Such
  314.      new versions will be similar in spirit to the present version, but
  315.      may differ in detail to address new problems or concerns.
  316.  
  317.      Each version is given a distinguishing version number.  If the
  318.      Program specifies a version number of this License which applies
  319.      to it and "any later version", you have the option of following
  320.      the terms and conditions either of that version or of any later
  321.      version published by the Free Software Foundation.  If the Program
  322.      does not specify a version number of this License, you may choose
  323.      any version ever published by the Free Software Foundation.
  324.  
  325.  10. If you wish to incorporate parts of the Program into other free
  326.      programs whose distribution conditions are different, write to the
  327.      author to ask for permission.  For software which is copyrighted
  328.      by the Free Software Foundation, write to the Free Software
  329.      Foundation; we sometimes make exceptions for this.  Our decision
  330.      will be guided by the two goals of preserving the free status of
  331.      all derivatives of our free software and of promoting the sharing
  332.      and reuse of software generally.
  333.  
  334.                                 NO WARRANTY
  335.  
  336.  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO
  337.      WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE
  338.      LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
  339.      HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT
  340.      WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT
  341.      NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  342.      FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS TO THE
  343.      QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
  344.      PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY
  345.      SERVICING, REPAIR OR CORRECTION.
  346.  
  347.  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
  348.      WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY
  349.      MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE
  350.      LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL,
  351.      INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
  352.      INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
  353.      DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU
  354.      OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY
  355.      OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN
  356.      ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
  357.  
  358.                       END OF TERMS AND CONDITIONS
  359.  
  360. How to Apply These Terms to Your New Programs
  361. =============================================
  362.  
  363.    If you develop a new program, and you want it to be of the greatest
  364. possible use to the public, the best way to achieve this is to make it
  365. free software which everyone can redistribute and change under these
  366. terms.
  367.  
  368.    To do so, attach the following notices to the program.  It is safest
  369. to attach them to the start of each source file to most effectively
  370. convey the exclusion of warranty; and each file should have at least
  371. the "copyright" line and a pointer to where the full notice is found.
  372.  
  373.      ONE LINE TO GIVE THE PROGRAM'S NAME AND A BRIEF IDEA OF WHAT IT DOES.
  374.      Copyright (C) 19YY  NAME OF AUTHOR
  375.      
  376.      This program is free software; you can redistribute it and/or modify
  377.      it under the terms of the GNU General Public License as published by
  378.      the Free Software Foundation; either version 2 of the License, or
  379.      (at your option) any later version.
  380.      
  381.      This program is distributed in the hope that it will be useful,
  382.      but WITHOUT ANY WARRANTY; without even the implied warranty of
  383.      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  384.      GNU General Public License for more details.
  385.      
  386.      You should have received a copy of the GNU General Public License
  387.      along with this program; if not, write to the Free Software
  388.      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  389.  
  390.    Also add information on how to contact you by electronic and paper
  391. mail.
  392.  
  393.    If the program is interactive, make it output a short notice like
  394. this when it starts in an interactive mode:
  395.  
  396.      Gnomovision version 69, Copyright (C) 19YY NAME OF AUTHOR
  397.      Gnomovision comes with ABSOLUTELY NO WARRANTY; for details
  398.      type `show w'.
  399.      This is free software, and you are welcome to redistribute it
  400.      under certain conditions; type `show c' for details.
  401.  
  402.    The hypothetical commands `show w' and `show c' should show the
  403. appropriate parts of the General Public License.  Of course, the
  404. commands you use may be called something other than `show w' and `show
  405. c'; they could even be mouse-clicks or menu items--whatever suits your
  406. program.
  407.  
  408.    You should also get your employer (if you work as a programmer) or
  409. your school, if any, to sign a "copyright disclaimer" for the program,
  410. if necessary.  Here is a sample; alter the names:
  411.  
  412.      Yoyodyne, Inc., hereby disclaims all copyright interest in the program
  413.      `Gnomovision' (which makes passes at compilers) written by James Hacker.
  414.      
  415.      SIGNATURE OF TY COON, 1 April 1989
  416.      Ty Coon, President of Vice
  417.  
  418.    This General Public License does not permit incorporating your
  419. program into proprietary programs.  If your program is a subroutine
  420. library, you may consider it more useful to permit linking proprietary
  421. applications with the library.  If this is what you want to do, use the
  422. GNU Library General Public License instead of this License.
  423.  
  424. 
  425. File: !gcc.docs.gccuser,  Node: Contributors,  Next: Funding,  Prev: Copying,  Up: Top
  426.  
  427. Contributors to GNU CC
  428. **********************
  429.  
  430.    In addition to Richard Stallman, several people have written parts
  431. of GNU CC.
  432.  
  433.    * The idea of using RTL and some of the optimization ideas came from
  434.      the program PO written at the University of Arizona by Jack
  435.      Davidson and Christopher Fraser.  See "Register Allocation and
  436.      Exhaustive Peephole Optimization", Software Practice and
  437.      Experience 14 (9), Sept. 1984, 857-866.
  438.  
  439.    * Paul Rubin wrote most of the preprocessor.
  440.  
  441.    * Leonard Tower wrote parts of the parser, RTL generator, and RTL
  442.      definitions, and of the Vax machine description.
  443.  
  444.    * Ted Lemon wrote parts of the RTL reader and printer.
  445.  
  446.    * Jim Wilson implemented loop strength reduction and some other loop
  447.      optimizations.
  448.  
  449.    * Nobuyuki Hikichi of Software Research Associates, Tokyo,
  450.      contributed the support for the Sony NEWS machine.
  451.  
  452.    * Charles LaBrec contributed the support for the Integrated Solutions
  453.      68020 system.
  454.  
  455.    * Michael Tiemann of Cygnus Support wrote the front end for C++, as
  456.      well as the support for inline functions and instruction
  457.      scheduling.  Also the descriptions of the National Semiconductor
  458.      32000 series cpu, the SPARC cpu and part of the Motorola 88000 cpu.
  459.  
  460.    * Gerald Baumgartner added the signature extension to the C++
  461.      front-end.
  462.  
  463.    * Jan Stein of the Chalmers Computer Society provided support for
  464.      Genix, as well as part of the 32000 machine description.
  465.  
  466.    * Randy Smith finished the Sun FPA support.
  467.  
  468.    * Robert Brown implemented the support for Encore 32000 systems.
  469.  
  470.    * David Kashtan of SRI adapted GNU CC to VMS.
  471.  
  472.    * Alex Crain provided changes for the 3b1.
  473.  
  474.    * Greg Satz and Chris Hanson assisted in making GNU CC work on HP-UX
  475.      for the 9000 series 300.
  476.  
  477.    * William Schelter did most of the work on the Intel 80386 support.
  478.  
  479.    * Christopher Smith did the port for Convex machines.
  480.  
  481.    * Paul Petersen wrote the machine description for the Alliant FX/8.
  482.  
  483.    * Dario Dariol contributed the four varieties of sample programs
  484.      that print a copy of their source.
  485.  
  486.    * Alain Lichnewsky ported GNU CC to the Mips cpu.
  487.  
  488.    * Devon Bowen, Dale Wiles and Kevin Zachmann ported GNU CC to the
  489.      Tahoe.
  490.  
  491.    * Jonathan Stone wrote the machine description for the Pyramid
  492.      computer.
  493.  
  494.    * Gary Miller ported GNU CC to Charles River Data Systems machines.
  495.  
  496.    * Richard Kenner of the New York University Ultracomputer Research
  497.      Laboratory wrote the machine descriptions for the AMD 29000, the
  498.      DEC Alpha, the IBM RT PC, and the IBM RS/6000 as well as the
  499.      support for instruction attributes.  He also made changes to
  500.      better support RISC processors including changes to common
  501.      subexpression elimination, strength reduction, function calling
  502.      sequence handling, and condition code support, in addition to
  503.      generalizing the code for frame pointer elimination.
  504.  
  505.    * Richard Kenner and Michael Tiemann jointly developed reorg.c, the
  506.      delay slot scheduler.
  507.  
  508.    * Mike Meissner and Tom Wood of Data General finished the port to the
  509.      Motorola 88000.
  510.  
  511.    * Masanobu Yuhara of Fujitsu Laboratories implemented the machine
  512.      description for the Tron architecture (specifically, the Gmicro).
  513.  
  514.    * NeXT, Inc. donated the front end that supports the Objective C
  515.      language.
  516.  
  517.    * James van Artsdalen wrote the code that makes efficient use of the
  518.      Intel 80387 register stack.
  519.  
  520.    * Mike Meissner at the Open Software Foundation finished the port to
  521.      the MIPS cpu, including adding ECOFF debug support, and worked on
  522.      the Intel port for the Intel 80386 cpu.
  523.  
  524.    * Ron Guilmette implemented the `protoize' and `unprotoize' tools,
  525.      the support for Dwarf symbolic debugging information, and much of
  526.      the support for System V Release 4.  He has also worked heavily on
  527.      the Intel 386 and 860 support.
  528.  
  529.    * Torbjorn Granlund implemented multiply- and divide-by-constant
  530.      optimization, improved long long support, and improved leaf
  531.      function register allocation.
  532.  
  533.    * Mike Stump implemented the support for Elxsi 64 bit CPU.
  534.  
  535.    * John Wehle added the machine description for the Western Electric
  536.      32000 processor used in several 3b series machines (no relation to
  537.      the National Semiconductor 32000 processor).
  538.  
  539.    * Holger Teutsch provided the support for the Clipper cpu.
  540.  
  541.    * Kresten Krab Thorup wrote the run time support for the Objective C
  542.      language.
  543.  
  544.    * Stephen Moshier contributed the floating point emulator that
  545.      assists in cross-compilation and permits support for floating
  546.      point numbers wider than 64 bits.
  547.  
  548.    * David Edelsohn contributed the changes to RS/6000 port to make it
  549.      support the PowerPC and POWER2 architectures.
  550.  
  551.    * Steve Chamberlain wrote the support for the Hitachi SH processor.
  552.  
  553.    * Peter Schauer wrote the code to allow debugging to work on the
  554.      Alpha.
  555.  
  556.    * Oliver M. Kellogg of Deutsche Aerospace contributed the port to the
  557.      MIL-STD-1750A.
  558.  
  559.    * Michael K. Gschwind contributed the port to the PDP-11.
  560.  
  561. 
  562. File: !gcc.docs.gccuser,  Node: Funding,  Next: Look and Feel,  Prev: Contributors,  Up: Top
  563.  
  564. Funding Free Software
  565. *********************
  566.  
  567.    If you want to have more free software a few years from now, it makes
  568. sense for you to help encourage people to contribute funds for its
  569. development.  The most effective approach known is to encourage
  570. commercial redistributors to donate.
  571.  
  572.    Users of free software systems can boost the pace of development by
  573. encouraging for-a-fee distributors to donate part of their selling price
  574. to free software developers--the Free Software Foundation, and others.
  575.  
  576.    The way to convince distributors to do this is to demand it and
  577. expect it from them.  So when you compare distributors, judge them
  578. partly by how much they give to free software development.  Show
  579. distributors they must compete to be the one who gives the most.
  580.  
  581.    To make this approach work, you must insist on numbers that you can
  582. compare, such as, "We will donate ten dollars to the Frobnitz project
  583. for each disk sold."  Don't be satisfied with a vague promise, such as
  584. "A portion of the profits are donated," since it doesn't give a basis
  585. for comparison.
  586.  
  587.    Even a precise fraction "of the profits from this disk" is not very
  588. meaningful, since creative accounting and unrelated business decisions
  589. can greatly alter what fraction of the sales price counts as profit.
  590. If the price you pay is $50, ten percent of the profit is probably less
  591. than a dollar; it might be a few cents, or nothing at all.
  592.  
  593.    Some redistributors do development work themselves.  This is useful
  594. too; but to keep everyone honest, you need to inquire how much they do,
  595. and what kind.  Some kinds of development make much more long-term
  596. difference than others.  For example, maintaining a separate version of
  597. a program contributes very little; maintaining the standard version of a
  598. program for the whole community contributes much.  Easy new ports
  599. contribute little, since someone else would surely do them; difficult
  600. ports such as adding a new CPU to the GNU C compiler contribute more;
  601. major new features or packages contribute the most.
  602.  
  603.    By establishing the idea that supporting further development is "the
  604. proper thing to do" when distributing free software for a fee, we can
  605. assure a steady flow of resources into making more free software.
  606.  
  607.      Copyright (C) 1994 Free Software Foundation, Inc.
  608.      Verbatim copying and redistribution of this section is permitted
  609.      without royalty; alteration is not permitted.
  610.  
  611. 
  612. File: !gcc.docs.gccuser,  Node: Look and Feel,  Next: G++ and GCC,  Prev: Funding,  Up: Top
  613.  
  614. Protect Your Freedom--Fight "Look And Feel"
  615. *******************************************
  616.  
  617.      This section is a political message from the League for Programming
  618.      Freedom to the users of GNU CC.  We have included it here because
  619.      the issue of interface copyright is important to the GNU project.
  620.  
  621.    Apple, Lotus, and now CDC have tried to create a new form of legal
  622. monopoly: a copyright on a user interface.
  623.  
  624.    An interface is a kind of language--a set of conventions for
  625. communication between two entities, human or machine.  Until a few years
  626. ago, the law seemed clear: interfaces were outside the domain of
  627. copyright, so programmers could program freely and implement whatever
  628. interface the users demanded.  Imitating de-facto standard interfaces,
  629. sometimes with improvements, was standard practice in the computer
  630. field.  These improvements, if accepted by the users, caught on and
  631. became the norm; in this way, much progress took place.
  632.  
  633.    Computer users, and most software developers, were happy with this
  634. state of affairs.  However, large companies such as Apple and Lotus
  635. would prefer a different system--one in which they can own interfaces
  636. and thereby rid themselves of all serious competitors.  They hope that
  637. interface copyright will give them, in effect, monopolies on major
  638. classes of software.
  639.  
  640.    Other large companies such as IBM and Digital also favor interface
  641. monopolies, for the same reason: if languages become property, they
  642. expect to own many de-facto standard languages.  But Apple and Lotus are
  643. the ones who have actually sued.  Apple's lawsuit was defeated, for
  644. reasons only partly related to the general issue of interface copyright.
  645.  
  646.    Lotus won lawsuits against two small companies, which were thus put
  647. out of business.  Then they sued Borland; they won in the trial court
  648. (no surprise, since it was the same court that had ruled for Lotus twice
  649. before), but the decision was reversed by the court of appeals, with
  650. help from the League for Programming Freedom in the form of a
  651. friend-of-the-court brief.  We are now waiting to see if the Supreme
  652. Court will hear the case.  If it does, the League for Programming
  653. Freedom will again submit a brief.
  654.  
  655.    The battle is not over.  Just this summer a company that produced a
  656. simulator for a CDC computer was shut down by a copyright lawsuit by
  657. CDC, which charged that the simulator infringed the copyright on the
  658. manuals for the computer.
  659.  
  660.    If the monopolists get their way, they will hobble the software
  661. field:
  662.  
  663.    * Gratuitous incompatibilities will burden users.  Imagine if each
  664.      car manufacturer had to design a different way to start, stop, and
  665.      steer a car.
  666.  
  667.    * Users will be "locked in" to whichever interface they learn; then
  668.      they will be prisoners of one supplier, who will charge a
  669.      monopolistic price.
  670.  
  671.    * Large companies have an unfair advantage wherever lawsuits become
  672.      commonplace.  Since they can afford to sue, they can intimidate
  673.      smaller developers with threats even when they don't really have a
  674.      case.
  675.  
  676.    * Interface improvements will come slower, since incremental
  677.      evolution through creative partial imitation will no longer occur.
  678.  
  679.    If interface monopolies are accepted, other large companies are
  680. waiting to grab theirs:
  681.  
  682.    * Adobe is expected to claim a monopoly on the interfaces of various
  683.      popular application programs, if Lotus ultimately wins the case
  684.      against Borland.
  685.  
  686.    * Open Computing magazine reported a Microsoft vice president as
  687.      threatening to sue people who imitate the interface of Windows.
  688.  
  689.    Users invest a great deal of time and money in learning to use
  690. computer interfaces.  Far more, in fact, than software developers
  691. invest in developing *and even implementing* the interfaces.  Whoever
  692. can own an interface, has made its users into captives, and
  693. misappropriated their investment.
  694.  
  695.    To protect our freedom from monopolies like these, a group of
  696. programmers and users have formed a grass-roots political organization,
  697. the League for Programming Freedom.
  698.  
  699.    The purpose of the League is to oppose monopolistic practices such as
  700. interface copyright and software patents.  The League calls for a return
  701. to the legal policies of the recent past, in which programmers could
  702. program freely.  The League is not concerned with free software as an
  703. issue, and is not affiliated with the Free Software Foundation.
  704.  
  705.    The League's activities include publicizing the issues, as is being
  706. done here, and filing friend-of-the-court briefs on behalf of
  707. defendants sued by monopolists.
  708.  
  709.    The League's membership rolls include Donald Knuth, the foremost
  710. authority on algorithms, John McCarthy, inventor of Lisp, Marvin Minsky,
  711. founder of the MIT Artificial Intelligence lab, Guy L.  Steele, Jr.,
  712. author of well-known books on Lisp and C, as well as Richard Stallman,
  713. the developer of GNU CC.  Please join and add your name to the list.
  714. Membership dues in the League are $42 per year for programmers, managers
  715. and professionals; $10.50 for students; $21 for others.
  716.  
  717.    Activist members are especially important, but members who have no
  718. time to give are also important.  Surveys at major ACM conferences have
  719. indicated a vast majority of attendees agree with the League on both
  720. issues (interface copyrights and software patents).  If just ten percent
  721. of the programmers who agree with the League join the League, we will
  722. probably triumph.
  723.  
  724.    To join, or for more information, phone (617) 243-4091 or write to:
  725.  
  726.      League for Programming Freedom
  727.      1 Kendall Square #143
  728.      P.O. Box 9171
  729.      Cambridge, MA 02139
  730.  
  731.    You can also send electronic mail to `lpf@uunet.uu.net'.
  732.  
  733.    In addition to joining the League, here are some suggestions from the
  734. League for other things you can do to protect your freedom to write
  735. programs:
  736.  
  737.    * Tell your friends and colleagues about this issue and how it
  738.      threatens to ruin the computer industry.
  739.  
  740.    * Mention that you are a League member in your `.signature', and
  741.      mention the League's email address for inquiries.
  742.  
  743.    * Ask the companies you consider working for or working with to make
  744.      statements against software monopolies, and give preference to
  745.      those that do.
  746.  
  747.    * When employers ask you to sign contracts giving them copyright on
  748.      your work, insist on a clause saying they will not claim the
  749.      copyright covers imitating the interface.
  750.  
  751.    * When employers ask you to sign contracts giving them patent rights,
  752.      insist on clauses saying they can use these rights only
  753.      defensively.  Don't rely on "company policy," since that can
  754.      change at any time; don't rely on an individual executive's
  755.      private word, since that person may be replaced.  Get a commitment
  756.      just as binding as the commitment they get from you.
  757.  
  758.    * Write to Congress to explain the importance of these issues.
  759.  
  760.           House Subcommittee on Intellectual Property
  761.           2137 Rayburn Bldg
  762.           Washington, DC 20515
  763.           
  764.           Senate Subcommittee on Patents, Trademarks and Copyrights
  765.           United States Senate
  766.           Washington, DC 20510
  767.  
  768.      (These committees have received lots of mail already; let's give
  769.      them even more.)
  770.  
  771.    Democracy means nothing if you don't use it.  Stand up and be
  772. counted!
  773.  
  774. 
  775. File: !gcc.docs.gccuser,  Node: G++ and GCC,  Next: Invoking GCC,  Prev: Look and Feel,  Up: Top
  776.  
  777. Compile C, C++, or Objective C
  778. ******************************
  779.  
  780.    The C, C++, and Objective C versions of the compiler are integrated;
  781. the GNU C compiler can compile programs written in C, C++, or Objective
  782. C.
  783.  
  784.    "GCC" is a common shorthand term for the GNU C compiler.  This is
  785. both the most general name for the compiler, and the name used when the
  786. emphasis is on compiling C programs.
  787.  
  788.    When referring to C++ compilation, it is usual to call the compiler
  789. "G++".  Since there is only one compiler, it is also accurate to call
  790. it "GCC" no matter what the language context; however, the term "G++"
  791. is more useful when the emphasis is on compiling C++ programs.
  792.  
  793.    We use the name "GNU CC" to refer to the compilation system as a
  794. whole, and more specifically to the language-independent part of the
  795. compiler.  For example, we refer to the optimization options as
  796. affecting the behavior of "GNU CC" or sometimes just "the compiler".
  797.  
  798.    Front ends for other languages, such as Ada 9X, Fortran, Modula-3,
  799. and Pascal, are under development.  These front-ends, like that for
  800. C++, are built in subdirectories of GNU CC and link to it.  The result
  801. is an integrated compiler that can compile programs written in C, C++,
  802. Objective C, or any of the languages for which you have installed front
  803. ends.
  804.  
  805.    In this manual, we only discuss the options for the C, Objective-C,
  806. and C++ compilers and those of the GNU CC core.  Consult the
  807. documentation of the other front ends for the options to use when
  808. compiling programs written in other languages.
  809.  
  810.    G++ is a *compiler*, not merely a preprocessor.  G++ builds object
  811. code directly from your C++ program source.  There is no intermediate C
  812. version of the program.  (By contrast, for example, some other
  813. implementations use a program that generates a C program from your C++
  814. source.)  Avoiding an intermediate C representation of the program means
  815. that you get better object code, and better debugging information.  The
  816. GNU debugger, GDB, works with this information in the object code to
  817. give you comprehensive C++ source-level editing capabilities (*note C
  818. and C++: (gdb.info)C.).
  819.  
  820. 
  821. File: !gcc.docs.gccuser,  Node: Invoking GCC,  Next: Installation,  Prev: G++ and GCC,  Up: Top
  822.  
  823. GNU CC Command Options
  824. **********************
  825.  
  826.    When you invoke GNU CC, it normally does preprocessing, compilation,
  827. assembly and linking.  The "overall options" allow you to stop this
  828. process at an intermediate stage.  For example, the `-c' option says
  829. not to run the linker.  Then the output consists of object files output
  830. by the assembler.
  831.  
  832.    Other options are passed on to one stage of processing.  Some options
  833. control the preprocessor and others the compiler itself.  Yet other
  834. options control the assembler and linker; most of these are not
  835. documented here, since you rarely need to use any of them.
  836.  
  837.    Most of the command line options that you can use with GNU CC are
  838. useful for C programs; when an option is only useful with another
  839. language (usually C++), the explanation says so explicitly.  If the
  840. description for a particular option does not mention a source language,
  841. you can use that option with all supported languages.
  842.  
  843.    *Note Compiling C++ Programs: Invoking G++, for a summary of special
  844. options for compiling C++ programs.
  845.  
  846.    The `gcc' program accepts options and file names as operands.  Many
  847. options have multiletter names; therefore multiple single-letter options
  848. may *not* be grouped: `-dr' is very different from `-d -r'.
  849.  
  850.    You can mix options and other arguments.  For the most part, the
  851. order you use doesn't matter.  Order does matter when you use several
  852. options of the same kind; for example, if you specify `-L' more than
  853. once, the directories are searched in the order specified.
  854.  
  855.    Many options have long names starting with `-f' or with `-W'--for
  856. example, `-fforce-mem', `-fstrength-reduce', `-Wformat' and so on.
  857. Most of these have both positive and negative forms; the negative form
  858. of `-ffoo' would be `-fno-foo'.  This manual documents only one of
  859. these two forms, whichever one is not the default.
  860.  
  861. * Menu:
  862.  
  863. * Option Summary::    Brief list of all options, without explanations.
  864. * Overall Options::     Controlling the kind of output:
  865.                         an executable, object files, assembler files,
  866.                         or preprocessed source.
  867. * Invoking G++::    Compiling C++ programs.
  868. * C Dialect Options::   Controlling the variant of C language compiled.
  869. * C++ Dialect Options:: Variations on C++.
  870. * Warning Options::     How picky should the compiler be?
  871. * Debugging Options::   Symbol tables, measurements, and debugging dumps.
  872. * Optimize Options::    How much optimization?
  873. * Preprocessor Options:: Controlling header files and macro definitions.
  874.                          Also, getting dependency information for Make.
  875. * Assembler Options::   Passing options to the assembler.
  876. * Link Options::        Specifying libraries and so on.
  877. * Directory Options::   Where to find header files and libraries.
  878.                         Where to find the compiler executable files.
  879. * Target Options::      Running a cross-compiler, or an old version of GNU CC.
  880. * Submodel Options::    Specifying minor hardware or convention variations,
  881.                         such as 68010 vs 68020.
  882. * Code Gen Options::    Specifying conventions for function calls, data layout
  883.                         and register usage.
  884. * Environment Variables:: Env vars that affect GNU CC.
  885. * Running Protoize::    Automatically adding or removing function prototypes.
  886.  
  887. 
  888. File: !gcc.docs.gccuser,  Node: Option Summary,  Next: Overall Options,  Up: Invoking GCC
  889.  
  890. Option Summary
  891. ==============
  892.  
  893.    Here is a summary of all the options, grouped by type.  Explanations
  894. are in the following sections.
  895.  
  896. *Overall Options*
  897.      *Note Options Controlling the Kind of Output: Overall Options.
  898.           -c  -S  -E  -o FILE  -pipe  -v  -x LANGUAGE
  899.  
  900. *C Language Options*
  901.      *Note Options Controlling C Dialect: C Dialect Options.
  902.           -ansi  -fallow-single-precision -fcond-mismatch  -fno-asm
  903.           -fno-builtin  -fsigned-bitfields  -fsigned-char
  904.           -funsigned-bitfields  -funsigned-char  -fwritable-strings
  905.           -traditional  -traditional-cpp  -trigraphs
  906.  
  907. *C++ Language Options*
  908.      *Note Options Controlling C++ Dialect: C++ Dialect Options.
  909.           -fall-virtual  -fdollars-in-identifiers  -felide-constructors
  910.           -fenum-int-equiv -fexternal-templates  -ffor-scope -fno-for-scope
  911.           -fhandle-signatures -fmemoize-lookups  -fno-default-inline -fno-gnu-keywords
  912.           -fnonnull-objects  -foperator-names  -fstrict-prototype
  913.           -fthis-is-variable -nostdinc++ -traditional  +eN
  914.  
  915. *Warning Options*
  916.      *Note Options to Request or Suppress Warnings: Warning Options.
  917.           -fsyntax-only  -pedantic  -pedantic-errors
  918.           -w  -W  -Wall  -Waggregate-return  -Wbad-function-cast
  919.           -Wcast-align -Wcast-qual  -Wchar-subscript  -Wcomment
  920.           -Wconversion -Wenum-clash  -Werror  -Wformat
  921.           -Wid-clash-LEN  -Wimplicit  -Wimport  -Winline
  922.           -Wlarger-than-LEN  -Wmissing-declarations
  923.           -Wmissing-prototypes  -Wnested-externs
  924.           -Wno-import  -Woverloaded-virtual -Wparentheses
  925.           -Wpointer-arith  -Wredundant-decls -Wreorder -Wreturn-type -Wshadow
  926.           -Wstrict-prototypes  -Wswitch  -Wsynth  -Wtemplate-debugging
  927.           -Wtraditional  -Wtrigraphs -Wuninitialized  -Wunused
  928.           -Wwrite-strings
  929.  
  930. *Debugging Options*
  931.      *Note Options for Debugging Your Program or GCC: Debugging Options.
  932.           -a  -dLETTERS  -fpretend-float
  933.           -g  -gLEVEL -gcoff  -gdwarf  -gdwarf+
  934.           -ggdb  -gstabs  -gstabs+  -gxcoff  -gxcoff+
  935.           -p  -pg  -print-file-name=LIBRARY  -print-libgcc-file-name
  936.           -print-prog-name=PROGRAM  -print-search-dirs  -save-temps
  937.  
  938. *Optimization Options*
  939.      *Note Options that Control Optimization: Optimize Options.
  940.           -fcaller-saves  -fcse-follow-jumps  -fcse-skip-blocks
  941.           -fdelayed-branch   -fexpensive-optimizations
  942.           -ffast-math  -ffloat-store  -fforce-addr  -fforce-mem
  943.           -finline-functions  -fkeep-inline-functions
  944.           -fno-default-inline  -fno-defer-pop  -fno-function-cse
  945.           -fno-inline  -fno-peephole  -fomit-frame-pointer
  946.           -frerun-cse-after-loop  -fschedule-insns
  947.           -fschedule-insns2  -fstrength-reduce  -fthread-jumps
  948.           -funroll-all-loops  -funroll-loops
  949.           -O  -O0  -O1  -O2  -O3
  950.  
  951. *Preprocessor Options*
  952.      *Note Options Controlling the Preprocessor: Preprocessor Options.
  953.           -AQUESTION(ANSWER)  -C  -dD  -dM  -dN
  954.           -DMACRO[=DEFN]  -E  -H
  955.           -idirafter DIR
  956.           -include FILE  -imacros FILE
  957.           -iprefix FILE  -iwithprefix DIR
  958.           -iwithprefixbefore DIR  -isystem DIR
  959.           -M  -MD  -MM  -MMD  -MG  -nostdinc  -P  -trigraphs
  960.           -undef  -UMACRO  -Wp,OPTION
  961.  
  962. *Assembler Option*
  963.      *Note Passing Options to the Assembler: Assembler Options.
  964.           -Wa,OPTION
  965.  
  966. *Linker Options*
  967.      *Note Options for Linking: Link Options.
  968.           OBJECT-FILE-NAME  -lLIBRARY
  969.           -nostartfiles  -nodefaultlibs  -nostdlib
  970.           -s  -static  -shared  -symbolic
  971.           -Wl,OPTION  -Xlinker OPTION
  972.           -u SYMBOL
  973.  
  974. *Directory Options*
  975.      *Note Options for Directory Search: Directory Options.
  976.           -BPREFIX  -IDIR  -I-  -LDIR
  977.  
  978. *Target Options*
  979.      *Note Target Options::.
  980.           -b MACHINE  -V VERSION
  981.  
  982. *Machine Dependent Options*
  983.      *Note Hardware Models and Configurations: Submodel Options.
  984.           *M680x0 Options*
  985.           -m68000  -m68020  -m68020-40  -m68030  -m68040  -m68881
  986.           -mbitfield  -mc68000  -mc68020  -mfpa  -mnobitfield
  987.           -mrtd  -mshort  -msoft-float
  988.           
  989.           *VAX Options*
  990.           -mg  -mgnu  -munix
  991.           
  992.           *SPARC Options*
  993.           -mapp-regs  -mcypress  -mepilogue  -mflat  -mfpu  -mhard-float
  994.           -mhard-quad-float  -mno-app-regs  -mno-flat  -mno-fpu
  995.           -mno-epilogue  -mno-unaligned-doubles
  996.           -msoft-float  -msoft-quad-float
  997.           -msparclite  -msupersparc  -munaligned-doubles  -mv8
  998.           
  999.           SPARC V9 compilers support the following options
  1000.           in addition to the above:
  1001.           
  1002.           -mmedlow  -mmedany
  1003.           -mint32  -mint64  -mlong32  -mlong64
  1004.           -mno-stack-bias  -mstack-bias
  1005.           
  1006.           *Convex Options*
  1007.           -mc1  -mc2  -mc32  -mc34  -mc38
  1008.           -margcount  -mnoargcount
  1009.           -mlong32  -mlong64
  1010.           -mvolatile-cache  -mvolatile-nocache
  1011.           
  1012.           *AMD29K Options*
  1013.           -m29000  -m29050  -mbw  -mnbw  -mdw  -mndw
  1014.           -mlarge  -mnormal  -msmall
  1015.           -mkernel-registers  -mno-reuse-arg-regs
  1016.           -mno-stack-check  -mno-storem-bug
  1017.           -mreuse-arg-regs  -msoft-float  -mstack-check
  1018.           -mstorem-bug  -muser-registers
  1019.           
  1020.           *ARM Options*
  1021.           -mapcs -m2 -m3 -m6 -mbsd -mxopen -mno-symrename
  1022.           
  1023.           *M88K Options*
  1024.           -m88000  -m88100  -m88110  -mbig-pic
  1025.           -mcheck-zero-division  -mhandle-large-shift
  1026.           -midentify-revision  -mno-check-zero-division
  1027.           -mno-ocs-debug-info  -mno-ocs-frame-position
  1028.           -mno-optimize-arg-area  -mno-serialize-volatile
  1029.           -mno-underscores  -mocs-debug-info
  1030.           -mocs-frame-position  -moptimize-arg-area
  1031.           -mserialize-volatile  -mshort-data-NUM  -msvr3
  1032.           -msvr4  -mtrap-large-shift  -muse-div-instruction
  1033.           -mversion-03.00  -mwarn-passed-structs
  1034.           
  1035.           *RS/6000 and PowerPC Options*
  1036.           -mcpu=CPU  TYPE
  1037.           -mpower  -mno-power  -mpower2  -mno-power2
  1038.           -mpowerpc  -mno-powerpc
  1039.           -mpowerpc-gpopt  -mno-powerpc-gpopt
  1040.           -mpowerpc-gfxopt  -mno-powerpc-gfxopt
  1041.           -mnew-mnemonics  -mno-new-mnemonics
  1042.           -mfull-toc   -mminimal-toc  -mno-fop-in-toc  -mno-sum-in-toc
  1043.           -msoft-float  -mhard-float -mmultiple -mno-multiple
  1044.           -mstring -mno-string -mbit-align -mno-bit-align
  1045.           -mstrict-align -mno-strict-align -mrelocatable -mno-relocatable
  1046.           -mtoc -mno-toc -mtraceback -mno-traceback
  1047.           -mlittle -mlittle-endian -mbig -mbig-endian
  1048.           -mcall-aix -mcall-sysv -mprototype
  1049.           
  1050.           *RT Options*
  1051.           -mcall-lib-mul  -mfp-arg-in-fpregs  -mfp-arg-in-gregs
  1052.           -mfull-fp-blocks  -mhc-struct-return  -min-line-mul
  1053.           -mminimum-fp-blocks  -mnohc-struct-return
  1054.           
  1055.           *MIPS Options*
  1056.           -mabicalls  -mcpu=CPU  TYPE  -membedded-data
  1057.           -membedded-pic  -mfp32  -mfp64  -mgas  -mgp32  -mgp64
  1058.           -mgpopt  -mhalf-pic  -mhard-float  -mint64 -mips1
  1059.           -mips2 -mips3  -mlong64  -mlong-calls  -mmemcpy
  1060.           -mmips-as  -mmips-tfile  -mno-abicalls
  1061.           -mno-embedded-data  -mno-embedded-pic
  1062.           -mno-gpopt  -mno-long-calls
  1063.           -mno-memcpy  -mno-mips-tfile  -mno-rnames  -mno-stats
  1064.           -mrnames -msoft-float
  1065.           -m4650 -msingle-float -mmad
  1066.           -mstats  -EL  -EB  -G NUM  -nocpp
  1067.           
  1068.           *i386 Options*
  1069.           -m486  -m386 -mieee-fp  -mno-fancy-math-387
  1070.           -mno-fp-ret-in-387  -msoft-float  -msvr3-shlib
  1071.           -mno-wide-multiply -mrtd -malign-double
  1072.           -mreg-alloc=LIST -mregparm=NUM
  1073.           -malign-jumps=NUM -malign-loops=NUM
  1074.           -malign-functions=NUM
  1075.           
  1076.           *HPPA Options*
  1077.           -mdisable-fpregs  -mdisable-indexing  -mfast-indirect-calls
  1078.           -mgas  -mjump-in-delay -mlong-millicode-calls -mno-disable-fpregs
  1079.           -mno-disable-indexing -mno-fast-indirect-calls -mno-gas
  1080.           -mno-jump-in-delay -mno-millicode-long-calls
  1081.           -mno-portable-runtime -mno-soft-float -msoft-float
  1082.           -mpa-risc-1-0  -mpa-risc-1-1  -mportable-runtime -mschedule=LIST
  1083.           
  1084.           *Intel 960 Options*
  1085.           -mCPU TYPE  -masm-compat  -mclean-linkage
  1086.           -mcode-align  -mcomplex-addr  -mleaf-procedures
  1087.           -mic-compat  -mic2.0-compat  -mic3.0-compat
  1088.           -mintel-asm  -mno-clean-linkage  -mno-code-align
  1089.           -mno-complex-addr  -mno-leaf-procedures
  1090.           -mno-old-align  -mno-strict-align  -mno-tail-call
  1091.           -mnumerics  -mold-align  -msoft-float  -mstrict-align
  1092.           -mtail-call
  1093.           
  1094.           *DEC Alpha Options*
  1095.           -mfp-regs  -mno-fp-regs  -mno-soft-float
  1096.           -msoft-float
  1097.           
  1098.           *Clipper Options*
  1099.           -mc300 -mc400
  1100.           
  1101.           *H8/300 Options*
  1102.           -mrelax  -mh
  1103.           
  1104.           *System V Options*
  1105.           -Qy  -Qn  -YP,PATHS  -Ym,DIR
  1106.  
  1107. *Code Generation Options*
  1108.      *Note Options for Code Generation Conventions: Code Gen Options.
  1109.           -fcall-saved-REG  -fcall-used-REG
  1110.           -ffixed-REG  -finhibit-size-directive
  1111.           -fno-common  -fno-ident  -fno-gnu-linker
  1112.           -fpcc-struct-return  -fpic  -fPIC
  1113.           -freg-struct-return  -fshared-data  -fshort-enums
  1114.           -fshort-double  -fvolatile  -fvolatile-global
  1115.           -fverbose-asm -fpack-struct +e0  +e1
  1116.  
  1117. * Menu:
  1118.  
  1119. * Overall Options::     Controlling the kind of output:
  1120.                         an executable, object files, assembler files,
  1121.                         or preprocessed source.
  1122. * C Dialect Options::   Controlling the variant of C language compiled.
  1123. * C++ Dialect Options:: Variations on C++.
  1124. * Warning Options::     How picky should the compiler be?
  1125. * Debugging Options::   Symbol tables, measurements, and debugging dumps.
  1126. * Optimize Options::    How much optimization?
  1127. * Preprocessor Options:: Controlling header files and macro definitions.
  1128.                          Also, getting dependency information for Make.
  1129. * Assembler Options::   Passing options to the assembler.
  1130. * Link Options::        Specifying libraries and so on.
  1131. * Directory Options::   Where to find header files and libraries.
  1132.                         Where to find the compiler executable files.
  1133. * Target Options::      Running a cross-compiler, or an old version of GNU CC.
  1134.  
  1135. 
  1136. File: !gcc.docs.gccuser,  Node: Overall Options,  Next: Invoking G++,  Prev: Option Summary,  Up: Invoking GCC
  1137.  
  1138. Options Controlling the Kind of Output
  1139. ======================================
  1140.  
  1141.    Compilation can involve up to four stages: preprocessing, compilation
  1142. proper, assembly and linking, always in that order.  The first three
  1143. stages apply to an individual source file, and end by producing an
  1144. object file; linking combines all the object files (those newly
  1145. compiled, and those specified as input) into an executable file.
  1146.  
  1147.    For any given input file, the file name suffix determines what kind
  1148. of compilation is done:
  1149.  
  1150. `FILE.c'
  1151.      C source code which must be preprocessed.
  1152.  
  1153. `FILE.i'
  1154.      C source code which should not be preprocessed.
  1155.  
  1156. `FILE.ii'
  1157.      C++ source code which should not be preprocessed.
  1158.  
  1159. `FILE.m'
  1160.      Objective-C source code.  Note that you must link with the library
  1161.      `libobjc.a' to make an Objective-C program work.
  1162.  
  1163. `FILE.h'
  1164.      C header file (not to be compiled or linked).
  1165.  
  1166. `FILE.cc'
  1167. `FILE.cxx'
  1168. `FILE.cpp'
  1169. `FILE.C'
  1170.      C++ source code which must be preprocessed.  Note that in `.cxx',
  1171.      the last two letters must both be literally `x'.  Likewise, `.C'
  1172.      refers to a literal capital C.
  1173.  
  1174. `FILE.s'
  1175.      Assembler code.
  1176.  
  1177. `FILE.S'
  1178.      Assembler code which must be preprocessed.
  1179.  
  1180. `OTHER'
  1181.      An object file to be fed straight into linking.  Any file name
  1182.      with no recognized suffix is treated this way.
  1183.  
  1184.    You can specify the input language explicitly with the `-x' option:
  1185.  
  1186. `-x LANGUAGE'
  1187.      Specify explicitly the LANGUAGE for the following input files
  1188.      (rather than letting the compiler choose a default based on the
  1189.      file name suffix).  This option applies to all following input
  1190.      files until the next `-x' option.  Possible values for LANGUAGE
  1191.      are:
  1192.           c  objective-c  c++
  1193.           c-header  cpp-output  c++-cpp-output
  1194.           assembler  assembler-with-cpp
  1195.  
  1196. `-x none'
  1197.      Turn off any specification of a language, so that subsequent files
  1198.      are handled according to their file name suffixes (as they are if
  1199.      `-x' has not been used at all).
  1200.  
  1201.    If you only want some of the stages of compilation, you can use `-x'
  1202. (or filename suffixes) to tell `gcc' where to start, and one of the
  1203. options `-c', `-S', or `-E' to say where `gcc' is to stop.  Note that
  1204. some combinations (for example, `-x cpp-output -E' instruct `gcc' to do
  1205. nothing at all.
  1206.  
  1207. `-c'
  1208.      Compile or assemble the source files, but do not link.  The linking
  1209.      stage simply is not done.  The ultimate output is in the form of an
  1210.      object file for each source file.
  1211.  
  1212.      By default, the object file name for a source file is made by
  1213.      replacing the suffix `.c', `.i', `.s', etc., with `.o'.
  1214.  
  1215.      Unrecognized input files, not requiring compilation or assembly,
  1216.      are ignored.
  1217.  
  1218. `-S'
  1219.      Stop after the stage of compilation proper; do not assemble.  The
  1220.      output is in the form of an assembler code file for each
  1221.      non-assembler input file specified.
  1222.  
  1223.      By default, the assembler file name for a source file is made by
  1224.      replacing the suffix `.c', `.i', etc., with `.s'.
  1225.  
  1226.      Input files that don't require compilation are ignored.
  1227.  
  1228. `-E'
  1229.      Stop after the preprocessing stage; do not run the compiler
  1230.      proper.  The output is in the form of preprocessed source code,
  1231.      which is sent to the standard output.
  1232.  
  1233.      Input files which don't require preprocessing are ignored.
  1234.  
  1235. `-o FILE'
  1236.      Place output in file FILE.  This applies regardless to whatever
  1237.      sort of output is being produced, whether it be an executable file,
  1238.      an object file, an assembler file or preprocessed C code.
  1239.  
  1240.      Since only one output file can be specified, it does not make
  1241.      sense to use `-o' when compiling more than one input file, unless
  1242.      you are producing an executable file as output.
  1243.  
  1244.      If `-o' is not specified, the default is to put an executable file
  1245.      in `a.out', the object file for `SOURCE.SUFFIX' in `SOURCE.o', its
  1246.      assembler file in `SOURCE.s', and all preprocessed C source on
  1247.      standard output.
  1248.  
  1249. `-v'
  1250.      Print (on standard error output) the commands executed to run the
  1251.      stages of compilation.  Also print the version number of the
  1252.      compiler driver program and of the preprocessor and the compiler
  1253.      proper.
  1254.  
  1255. `-pipe'
  1256.      Use pipes rather than temporary files for communication between the
  1257.      various stages of compilation.  This fails to work on some systems
  1258.      where the assembler is unable to read from a pipe; but the GNU
  1259.      assembler has no trouble.
  1260.  
  1261. 
  1262. File: !gcc.docs.gccuser,  Node: Invoking G++,  Next: C Dialect Options,  Prev: Overall Options,  Up: Invoking GCC
  1263.  
  1264. Compiling C++ Programs
  1265. ======================
  1266.  
  1267.    C++ source files conventionally use one of the suffixes `.C', `.cc',
  1268. `cpp', or `.cxx'; preprocessed C++ files use the suffix `.ii'.  GNU CC
  1269. recognizes files with these names and compiles them as C++ programs
  1270. even if you call the compiler the same way as for compiling C programs
  1271. (usually with the name `gcc').
  1272.  
  1273.    However, C++ programs often require class libraries as well as a
  1274. compiler that understands the C++ language--and under some
  1275. circumstances, you might want to compile programs from standard input,
  1276. or otherwise without a suffix that flags them as C++ programs.  `g++'
  1277. is a program that calls GNU CC with the default language set to C++,
  1278. and automatically specifies linking against the GNU class library
  1279. libg++.  (1) On many systems, the script `g++' is also installed with
  1280. the name `c++'.
  1281.  
  1282.    When you compile C++ programs, you may specify many of the same
  1283. command-line options that you use for compiling programs in any
  1284. language; or command-line options meaningful for C and related
  1285. languages; or options that are meaningful only for C++ programs.  *Note
  1286. Options Controlling C Dialect: C Dialect Options, for explanations of
  1287. options for languages related to C.  *Note Options Controlling C++
  1288. Dialect: C++ Dialect Options, for explanations of options that are
  1289. meaningful only for C++ programs.
  1290.  
  1291.    ---------- Footnotes ----------
  1292.  
  1293.    (1)  Prior to release 2 of the compiler, there was a separate `g++'
  1294. compiler.  That version was based on GNU CC, but not integrated with
  1295. it.  Versions of `g++' with a `1.XX' version number--for example, `g++'
  1296. version 1.37 or 1.42--are much less reliable than the versions
  1297. integrated with GCC 2.  Moreover, combining G++ `1.XX' with a version 2
  1298. GCC will simply not work.
  1299.  
  1300. 
  1301. File: !gcc.docs.gccuser,  Node: C Dialect Options,  Next: C++ Dialect Options,  Prev: Invoking G++,  Up: Invoking GCC
  1302.  
  1303. Options Controlling C Dialect
  1304. =============================
  1305.  
  1306.    The following options control the dialect of C (or languages derived
  1307. from C, such as C++ and Objective C) that the compiler accepts:
  1308.  
  1309. `-ansi'
  1310.      Support all ANSI standard C programs.
  1311.  
  1312.      This turns off certain features of GNU C that are incompatible
  1313.      with ANSI C, such as the `asm', `inline' and `typeof' keywords, and
  1314.      predefined macros such as `unix' and `vax' that identify the type
  1315.      of system you are using.  It also enables the undesirable and
  1316.      rarely used ANSI trigraph feature, disallows `$' as part of
  1317.      identifiers, and disables recognition of C++ style `//' comments.
  1318.  
  1319.      The alternate keywords `__asm__', `__extension__', `__inline__'
  1320.      and `__typeof__' continue to work despite `-ansi'.  You would not
  1321.      want to use them in an ANSI C program, of course, but it is useful
  1322.      to put them in header files that might be included in compilations
  1323.      done with `-ansi'.  Alternate predefined macros such as `__unix__'
  1324.      and `__vax__' are also available, with or without `-ansi'.
  1325.  
  1326.      The `-ansi' option does not cause non-ANSI programs to be rejected
  1327.      gratuitously.  For that, `-pedantic' is required in addition to
  1328.      `-ansi'.  *Note Warning Options::.
  1329.  
  1330.      The macro `__STRICT_ANSI__' is predefined when the `-ansi' option
  1331.      is used.  Some header files may notice this macro and refrain from
  1332.      declaring certain functions or defining certain macros that the
  1333.      ANSI standard doesn't call for; this is to avoid interfering with
  1334.      any programs that might use these names for other things.
  1335.  
  1336.      The functions `alloca', `abort', `exit', and `_exit' are not
  1337.      builtin functions when `-ansi' is used.
  1338.  
  1339. `-fno-asm'
  1340.      Do not recognize `asm', `inline' or `typeof' as a keyword, so that
  1341.      code can use these words as identifiers.  You can use the keywords
  1342.      `__asm__', `__inline__' and `__typeof__' instead.  `-ansi' implies
  1343.      `-fno-asm'.
  1344.  
  1345.      In C++, this switch only affects the `typeof' keyword, since `asm'
  1346.      and `inline' are standard keywords.  You may want to use the
  1347.      `-fno-gnu-keywords' flag instead, as it also disables the other,
  1348.      C++-specific, extension keywords such as `headof'.
  1349.  
  1350. `-fno-builtin'
  1351.      Don't recognize builtin functions that do not begin with two
  1352.      leading underscores.  Currently, the functions affected include
  1353.      `abort', `abs', `alloca', `cos', `exit', `fabs', `ffs', `labs',
  1354.      `memcmp', `memcpy', `sin', `sqrt', `strcmp', `strcpy', and
  1355.      `strlen'.
  1356.  
  1357.      GCC normally generates special code to handle certain builtin
  1358.      functions more efficiently; for instance, calls to `alloca' may
  1359.      become single instructions that adjust the stack directly, and
  1360.      calls to `memcpy' may become inline copy loops.  The resulting
  1361.      code is often both smaller and faster, but since the function
  1362.      calls no longer appear as such, you cannot set a breakpoint on
  1363.      those calls, nor can you change the behavior of the functions by
  1364.      linking with a different library.
  1365.  
  1366.      The `-ansi' option prevents `alloca' and `ffs' from being builtin
  1367.      functions, since these functions do not have an ANSI standard
  1368.      meaning.
  1369.  
  1370. `-trigraphs'
  1371.      Support ANSI C trigraphs.  You don't want to know about this
  1372.      brain-damage.  The `-ansi' option implies `-trigraphs'.
  1373.  
  1374. `-traditional'
  1375.      Attempt to support some aspects of traditional C compilers.
  1376.      Specifically:
  1377.  
  1378.         * All `extern' declarations take effect globally even if they
  1379.           are written inside of a function definition.  This includes
  1380.           implicit declarations of functions.
  1381.  
  1382.         * The newer keywords `typeof', `inline', `signed', `const' and
  1383.           `volatile' are not recognized.  (You can still use the
  1384.           alternative keywords such as `__typeof__', `__inline__', and
  1385.           so on.)
  1386.  
  1387.         * Comparisons between pointers and integers are always allowed.
  1388.  
  1389.         * Integer types `unsigned short' and `unsigned char' promote to
  1390.           `unsigned int'.
  1391.  
  1392.         * Out-of-range floating point literals are not an error.
  1393.  
  1394.         * Certain constructs which ANSI regards as a single invalid
  1395.           preprocessing number, such as `0xe-0xd', are treated as
  1396.           expressions instead.
  1397.  
  1398.         * String "constants" are not necessarily constant; they are
  1399.           stored in writable space, and identical looking constants are
  1400.           allocated separately.  (This is the same as the effect of
  1401.           `-fwritable-strings'.)
  1402.  
  1403.         * All automatic variables not declared `register' are preserved
  1404.           by `longjmp'.  Ordinarily, GNU C follows ANSI C: automatic
  1405.           variables not declared `volatile' may be clobbered.
  1406.  
  1407.         * The character escape sequences `\x' and `\a' evaluate as the
  1408.           literal characters `x' and `a' respectively.  Without
  1409.           `-traditional', `\x' is a prefix for the hexadecimal
  1410.           representation of a character, and `\a' produces a bell.
  1411.  
  1412.         * In C++ programs, assignment to `this' is permitted with
  1413.           `-traditional'.  (The option `-fthis-is-variable' also has
  1414.           this effect.)
  1415.  
  1416.      You may wish to use `-fno-builtin' as well as `-traditional' if
  1417.      your program uses names that are normally GNU C builtin functions
  1418.      for other purposes of its own.
  1419.  
  1420.      You cannot use `-traditional' if you include any header files that
  1421.      rely on ANSI C features.  Some vendors are starting to ship
  1422.      systems with ANSI C header files and you cannot use `-traditional'
  1423.      on such systems to compile files that include any system headers.
  1424.  
  1425. `'
  1426.      In the preprocessor, comments convert to nothing at all, rather
  1427.      than to a space.  This allows traditional token concatenation.
  1428.  
  1429. `'
  1430.      In preprocessing directive, the `#' symbol must appear as the first
  1431.      character of a line.
  1432.  
  1433. `'
  1434.      In the preprocessor, macro arguments are recognized within string
  1435.      constants in a macro definition (and their values are stringified,
  1436.      though without additional quote marks, when they appear in such a
  1437.      context).  The preprocessor always considers a string constant to
  1438.      end at a newline.
  1439.  
  1440. `'
  1441.      The predefined macro `__STDC__' is not defined when you use
  1442.      `-traditional', but `__GNUC__' is (since the GNU extensions which
  1443.      `__GNUC__' indicates are not affected by `-traditional').  If you
  1444.      need to write header files that work differently depending on
  1445.      whether `-traditional' is in use, by testing both of these
  1446.      predefined macros you can distinguish four situations: GNU C,
  1447.      traditional GNU C, other ANSI C compilers, and other old C
  1448.      compilers.  The predefined macro `__STDC_VERSION__' is also not
  1449.      defined when you use `-traditional'.  *Note Standard Predefined
  1450.      Macros: (cpp.info)Standard Predefined, for more discussion of
  1451.      these and other predefined macros.
  1452.  
  1453. `'
  1454.      The preprocessor considers a string constant to end at a newline
  1455.      (unless the newline is escaped with `\').  (Without `-traditional',
  1456.      string constants can contain the newline character as typed.)
  1457.  
  1458. `-traditional-cpp'
  1459.      Attempt to support some aspects of traditional C preprocessors.
  1460.      This includes the last five items in the table immediately above,
  1461.      but none of the other effects of `-traditional'.
  1462.  
  1463. `-fcond-mismatch'
  1464.      Allow conditional expressions with mismatched types in the second
  1465.      and third arguments.  The value of such an expression is void.
  1466.  
  1467. `-funsigned-char'
  1468.      Let the type `char' be unsigned, like `unsigned char'.
  1469.  
  1470.      Each kind of machine has a default for what `char' should be.  It
  1471.      is either like `unsigned char' by default or like `signed char' by
  1472.      default.
  1473.  
  1474.      Ideally, a portable program should always use `signed char' or
  1475.      `unsigned char' when it depends on the signedness of an object.
  1476.      But many programs have been written to use plain `char' and expect
  1477.      it to be signed, or expect it to be unsigned, depending on the
  1478.      machines they were written for.  This option, and its inverse, let
  1479.      you make such a program work with the opposite default.
  1480.  
  1481.      The type `char' is always a distinct type from each of `signed
  1482.      char' or `unsigned char', even though its behavior is always just
  1483.      like one of those two.
  1484.  
  1485. `-fsigned-char'
  1486.      Let the type `char' be signed, like `signed char'.
  1487.  
  1488.      Note that this is equivalent to `-fno-unsigned-char', which is the
  1489.      negative form of `-funsigned-char'.  Likewise, the option
  1490.      `-fno-signed-char' is equivalent to `-funsigned-char'.
  1491.  
  1492. `-fsigned-bitfields'
  1493. `-funsigned-bitfields'
  1494. `-fno-signed-bitfields'
  1495. `-fno-unsigned-bitfields'
  1496.      These options control whether a bitfield is signed or unsigned,
  1497.      when the declaration does not use either `signed' or `unsigned'.
  1498.      By default, such a bitfield is signed, because this is consistent:
  1499.      the basic integer types such as `int' are signed types.
  1500.  
  1501.      However, when `-traditional' is used, bitfields are all unsigned
  1502.      no matter what.
  1503.  
  1504. `-fwritable-strings'
  1505.      Store string constants in the writable data segment and don't
  1506.      uniquize them.  This is for compatibility with old programs which
  1507.      assume they can write into string constants.  The option
  1508.      `-traditional' also has this effect.
  1509.  
  1510.      Writing into string constants is a very bad idea; "constants"
  1511.      should be constant.
  1512.  
  1513. `-fallow-single-precision'
  1514.      Do not promote single precision math operations to double
  1515.      precision, even when compiling with `-traditional'.
  1516.  
  1517.      Traditional K&R C promotes all floating point operations to double
  1518.      precision, regardless of the sizes of the operands.   On the
  1519.      architecture for which you are compiling, single precision may be
  1520.      faster than double precision.   If you must use `-traditional',
  1521.      but want to use single precision operations when the operands are
  1522.      single precision, use this option.   This option has no effect
  1523.      when compiling with ANSI or GNU C conventions (the default).
  1524.  
  1525. 
  1526. File: !gcc.docs.gccuser,  Node: C++ Dialect Options,  Next: Warning Options,  Prev: C Dialect Options,  Up: Invoking GCC
  1527.  
  1528. Options Controlling C++ Dialect
  1529. ===============================
  1530.  
  1531.    This section describes the command-line options that are only
  1532. meaningful for C++ programs; but you can also use most of the GNU
  1533. compiler options regardless of what language your program is in.  For
  1534. example, you might compile a file `firstClass.C' like this:
  1535.  
  1536.      g++ -g -felide-constructors -O -c firstClass.C
  1537.  
  1538. In this example, only `-felide-constructors' is an option meant only
  1539. for C++ programs; you can use the other options with any language
  1540. supported by GNU CC.
  1541.  
  1542.    Here is a list of options that are *only* for compiling C++ programs:
  1543.  
  1544. `-fno-access-control'
  1545.      Turn off all access checking.  This switch is mainly useful for
  1546.      working around bugs in the access control code.
  1547.  
  1548. `-fall-virtual'
  1549.      Treat all possible member functions as virtual, implicitly.  All
  1550.      member functions (except for constructor functions and `new' or
  1551.      `delete' member operators) are treated as virtual functions of the
  1552.      class where they appear.
  1553.  
  1554.      This does not mean that all calls to these member functions will
  1555.      be made through the internal table of virtual functions.  Under
  1556.      some circumstances, the compiler can determine that a call to a
  1557.      given virtual function can be made directly; in these cases the
  1558.      calls are direct in any case.
  1559.  
  1560. `-fcheck-new'
  1561.      Check that the pointer returned by `operator new' is non-null
  1562.      before attempting to modify the storage allocated.  The current
  1563.      Working Paper requires that `operator new' never return a null
  1564.      pointer, so this check is normally unnecessary.
  1565.  
  1566. `-fconserve-space'
  1567.      Put uninitialized or runtime-initialized global variables into the
  1568.      common segment, as C does.  This saves space in the executable at
  1569.      the cost of not diagnosing duplicate definitions.  If you compile
  1570.      with this flag and your program mysteriously crashes after
  1571.      `main()' has completed, you may have an object that is being
  1572.      destroyed twice because two definitions were merged.
  1573.  
  1574. `-fdollars-in-identifiers'
  1575.      Accept `$' in identifiers.  You can also explicitly prohibit use of
  1576.      `$' with the option `-fno-dollars-in-identifiers'.  (GNU C++
  1577.      allows `$' by default on some target systems but not others.)
  1578.      Traditional C allowed the character `$' to form part of
  1579.      identifiers.  However, ANSI C and C++ forbid `$' in identifiers.
  1580.  
  1581. `-fenum-int-equiv'
  1582.      Anachronistically permit implicit conversion of `int' to
  1583.      enumeration types.  Current C++ allows conversion of `enum' to
  1584.      `int', but not the other way around.
  1585.  
  1586. `-fexternal-templates'
  1587.      Cause template instantiations to obey `#pragma interface' and
  1588.      `implementation'; template instances are emitted or not according
  1589.      to the location of the template definition.  *Note Template
  1590.      Instantiation::, for more information.
  1591.  
  1592. `-falt-external-templates'
  1593.      Similar to -fexternal-templates, but template instances are
  1594.      emitted or not according to the place where they are first
  1595.      instantiated.  *Note Template Instantiation::, for more
  1596.      information.
  1597.  
  1598. `-ffor-scope'
  1599. `-fno-for-scope'
  1600.      If -ffor-scope is specified, the scope of variables declared in a
  1601.      for-init-statement is limited to the `for' loop itself, as
  1602.      specified by the draft C++ standard.  If -fno-for-scope is
  1603.      specified, the scope of variables declared in a for-init-statement
  1604.      extends to the end of the enclosing scope, as was the case in old
  1605.      versions of gcc, and other (traditional) implementations of C++.
  1606.  
  1607.      The default if neither flag is given to follow the standard, but
  1608.      to allow and give a warning for old-style code that would
  1609.      otherwise be invalid, or have different behavior.
  1610.  
  1611. `-fno-gnu-keywords'
  1612.      Do not recognize `classof', `headof', `signature', `sigof' or
  1613.      `typeof' as a keyword, so that code can use these words as
  1614.      identifiers.  You can use the keywords `__classof__',
  1615.      `__headof__', `__signature__', `__sigof__', and `__typeof__'
  1616.      instead.  `-ansi' implies `-fno-gnu-keywords'.
  1617.  
  1618. `-fno-implicit-templates'
  1619.      Never emit code for templates which are instantiated implicitly
  1620.      (i.e. by use); only emit code for explicit instantiations.  *Note
  1621.      Template Instantiation::, for more information.
  1622.  
  1623. `-fhandle-signatures'
  1624.      Recognize the `signature' and `sigof' keywords for specifying
  1625.      abstract types.  The default (`-fno-handle-signatures') is not to
  1626.      recognize them.  *Note Type Abstraction using Signatures: C++
  1627.      Signatures.
  1628.  
  1629. `-fhuge-objects'
  1630.      Support virtual function calls for objects that exceed the size
  1631.      representable by a `short int'.  Users should not use this flag by
  1632.      default; if you need to use it, the compiler will tell you so.  If
  1633.      you compile any of your code with this flag, you must compile
  1634.      *all* of your code with this flag (including libg++, if you use
  1635.      it).
  1636.  
  1637.      This flag is not useful when compiling with -fvtable-thunks.
  1638.  
  1639. `-fno-implement-inlines'
  1640.      To save space, do not emit out-of-line copies of inline functions
  1641.      controlled by `#pragma implementation'.  This will cause linker
  1642.      errors if these functions are not inlined everywhere they are
  1643.      called.
  1644.  
  1645. `-fmemoize-lookups'
  1646. `-fsave-memoized'
  1647.      Use heuristics to compile faster.  These heuristics are not
  1648.      enabled by default, since they are only effective for certain
  1649.      input files.  Other input files compile more slowly.
  1650.  
  1651.      The first time the compiler must build a call to a member function
  1652.      (or reference to a data member), it must (1) determine whether the
  1653.      class implements member functions of that name; (2) resolve which
  1654.      member function to call (which involves figuring out what sorts of
  1655.      type conversions need to be made); and (3) check the visibility of
  1656.      the member function to the caller.  All of this adds up to slower
  1657.      compilation.  Normally, the second time a call is made to that
  1658.      member function (or reference to that data member), it must go
  1659.      through the same lengthy process again.  This means that code like
  1660.      this:
  1661.  
  1662.           cout << "This " << p << " has " << n << " legs.\n";
  1663.  
  1664.      makes six passes through all three steps.  By using a software
  1665.      cache, a "hit" significantly reduces this cost.  Unfortunately,
  1666.      using the cache introduces another layer of mechanisms which must
  1667.      be implemented, and so incurs its own overhead.
  1668.      `-fmemoize-lookups' enables the software cache.
  1669.  
  1670.      Because access privileges (visibility) to members and member
  1671.      functions may differ from one function context to the next, G++
  1672.      may need to flush the cache.  With the `-fmemoize-lookups' flag,
  1673.      the cache is flushed after every function that is compiled.  The
  1674.      `-fsave-memoized' flag enables the same software cache, but when
  1675.      the compiler determines that the context of the last function
  1676.      compiled would yield the same access privileges of the next
  1677.      function to compile, it preserves the cache.  This is most helpful
  1678.      when defining many member functions for the same class: with the
  1679.      exception of member functions which are friends of other classes,
  1680.      each member function has exactly the same access privileges as
  1681.      every other, and the cache need not be flushed.
  1682.  
  1683.      The code that implements these flags has rotted; you should
  1684.      probably avoid using them.
  1685.  
  1686. `-fstrict-prototype'
  1687.      Within an `extern "C"' linkage specification, treat a function
  1688.      declaration with no arguments, such as `int foo ();', as declaring
  1689.      the function to take no arguments.  Normally, such a declaration
  1690.      means that the function `foo' can take any combination of
  1691.      arguments, as in C.  `-pedantic' implies `-fstrict-prototype'
  1692.      unless overridden with `-fno-strict-prototype'.
  1693.  
  1694.      This flag no longer affects declarations with C++ linkage.
  1695.  
  1696. `-fno-nonnull-objects'
  1697.      Don't assume that a reference is initialized to refer to a valid
  1698.      object.  Although the current C++ Working Paper prohibits null
  1699.      references, some old code may rely on them, and you can use
  1700.      `-fno-nonnull-objects' to turn on checking.
  1701.  
  1702.      At the moment, the compiler only does this checking for
  1703.      conversions to virtual base classes.
  1704.  
  1705. `-foperator-names'
  1706.      Recognize the operator name keywords `and', `bitand', `bitor',
  1707.      `compl', `not', `or' and `xor' as synonyms for the symbols they
  1708.      refer to.  `-ansi' implies `-foperator-names'.
  1709.  
  1710. `-fthis-is-variable'
  1711.      Permit assignment to `this'.  The incorporation of user-defined
  1712.      free store management into C++ has made assignment to `this' an
  1713.      anachronism.  Therefore, by default it is invalid to assign to
  1714.      `this' within a class member function; that is, GNU C++ treats
  1715.      `this' in a member function of class `X' as a non-lvalue of type
  1716.      `X *'.  However, for backwards compatibility, you can make it
  1717.      valid with `-fthis-is-variable'.
  1718.  
  1719. `-fvtable-thunks'
  1720.      Use `thunks' to implement the virtual function dispatch table
  1721.      (`vtable').  The traditional (cfront-style) approach to
  1722.      implementing vtables was to store a pointer to the function and two
  1723.      offsets for adjusting the `this' pointer at the call site.  Newer
  1724.      implementations store a single pointer to a `thunk' function which
  1725.      does any necessary adjustment and then calls the target function.
  1726.  
  1727.      This option also enables a heuristic for controlling emission of
  1728.      vtables; if a class has any non-inline virtual functions, the
  1729.      vtable will be emitted in the translation unit containing the
  1730.      first one of those.
  1731.  
  1732. `-nostdinc++'
  1733.      Do not search for header files in the standard directories
  1734.      specific to C++, but do still search the other standard
  1735.      directories.  (This option is used when building libg++.)
  1736.  
  1737. `-traditional'
  1738.      For C++ programs (in addition to the effects that apply to both C
  1739.      and C++), this has the same effect as `-fthis-is-variable'.  *Note
  1740.      Options Controlling C Dialect: C Dialect Options.
  1741.  
  1742.    In addition, these optimization, warning, and code generation options
  1743. have meanings only for C++ programs:
  1744.  
  1745. `-fno-default-inline'
  1746.      Do not assume `inline' for functions defined inside a class scope.
  1747.      *Note Options That Control Optimization: Optimize Options.
  1748.  
  1749. `-Wenum-clash'
  1750. `-Woverloaded-virtual'
  1751. `-Wtemplate-debugging'
  1752.      Warnings that apply only to C++ programs.  *Note Options to
  1753.      Request or Suppress Warnings: Warning Options.
  1754.  
  1755. `+eN'
  1756.      Control how virtual function definitions are used, in a fashion
  1757.      compatible with `cfront' 1.x.  *Note Options for Code Generation
  1758.      Conventions: Code Gen Options.
  1759.  
  1760. 
  1761. File: !gcc.docs.gccuser,  Node: Warning Options,  Next: Debugging Options,  Prev: C++ Dialect Options,  Up: Invoking GCC
  1762.  
  1763. Options to Request or Suppress Warnings
  1764. =======================================
  1765.  
  1766.    Warnings are diagnostic messages that report constructions which are
  1767. not inherently erroneous but which are risky or suggest there may have
  1768. been an error.
  1769.  
  1770.    You can request many specific warnings with options beginning `-W',
  1771. for example `-Wimplicit' to request warnings on implicit declarations.
  1772. Each of these specific warning options also has a negative form
  1773. beginning `-Wno-' to turn off warnings; for example, `-Wno-implicit'.
  1774. This manual lists only one of the two forms, whichever is not the
  1775. default.
  1776.  
  1777.    These options control the amount and kinds of warnings produced by
  1778. GNU CC:
  1779.  
  1780. `-fsyntax-only'
  1781.      Check the code for syntax errors, but don't do anything beyond
  1782.      that.
  1783.  
  1784. `-pedantic'
  1785.      Issue all the warnings demanded by strict ANSI standard C; reject
  1786.      all programs that use forbidden extensions.
  1787.  
  1788.      Valid ANSI standard C programs should compile properly with or
  1789.      without this option (though a rare few will require `-ansi').
  1790.      However, without this option, certain GNU extensions and
  1791.      traditional C features are supported as well.  With this option,
  1792.      they are rejected.
  1793.  
  1794.      `-pedantic' does not cause warning messages for use of the
  1795.      alternate keywords whose names begin and end with `__'.  Pedantic
  1796.      warnings are also disabled in the expression that follows
  1797.      `__extension__'.  However, only system header files should use
  1798.      these escape routes; application programs should avoid them.
  1799.      *Note Alternate Keywords::.
  1800.  
  1801.      This option is not intended to be useful; it exists only to satisfy
  1802.      pedants who would otherwise claim that GNU CC fails to support the
  1803.      ANSI standard.
  1804.  
  1805.      Some users try to use `-pedantic' to check programs for strict ANSI
  1806.      C conformance.  They soon find that it does not do quite what they
  1807.      want: it finds some non-ANSI practices, but not all--only those
  1808.      for which ANSI C *requires* a diagnostic.
  1809.  
  1810.      A feature to report any failure to conform to ANSI C might be
  1811.      useful in some instances, but would require considerable
  1812.      additional work and would be quite different from `-pedantic'.  We
  1813.      recommend, rather, that users take advantage of the extensions of
  1814.      GNU C and disregard the limitations of other compilers.  Aside
  1815.      from certain supercomputers and obsolete small machines, there is
  1816.      less and less reason ever to use any other C compiler other than
  1817.      for bootstrapping GNU CC.
  1818.  
  1819. `-pedantic-errors'
  1820.      Like `-pedantic', except that errors are produced rather than
  1821.      warnings.
  1822.  
  1823. `-w'
  1824.      Inhibit all warning messages.
  1825.  
  1826. `-Wno-import'
  1827.      Inhibit warning messages about the use of `#import'.
  1828.  
  1829. `-Wchar-subscripts'
  1830.      Warn if an array subscript has type `char'.  This is a common cause
  1831.      of error, as programmers often forget that this type is signed on
  1832.      some machines.
  1833.  
  1834. `-Wcomment'
  1835.      Warn whenever a comment-start sequence `/*' appears in a comment.
  1836.  
  1837. `-Wformat'
  1838.      Check calls to `printf' and `scanf', etc., to make sure that the
  1839.      arguments supplied have types appropriate to the format string
  1840.      specified.
  1841.  
  1842. `-Wimplicit'
  1843.      Warn whenever a function or parameter is implicitly declared.
  1844.  
  1845. `-Wparentheses'
  1846.      Warn if parentheses are omitted in certain contexts, such as when
  1847.      there is an assignment in a context where a truth value is
  1848.      expected, or when operators are nested whose precedence people
  1849.      often get confused about.
  1850.  
  1851. `-Wreturn-type'
  1852.      Warn whenever a function is defined with a return-type that
  1853.      defaults to `int'.  Also warn about any `return' statement with no
  1854.      return-value in a function whose return-type is not `void'.
  1855.  
  1856. `-Wswitch'
  1857.      Warn whenever a `switch' statement has an index of enumeral type
  1858.      and lacks a `case' for one or more of the named codes of that
  1859.      enumeration.  (The presence of a `default' label prevents this
  1860.      warning.)  `case' labels outside the enumeration range also
  1861.      provoke warnings when this option is used.
  1862.  
  1863. `-Wtrigraphs'
  1864.      Warn if any trigraphs are encountered (assuming they are enabled).
  1865.  
  1866. `-Wunused'
  1867.      Warn whenever a variable is unused aside from its declaration,
  1868.      whenever a function is declared static but never defined, whenever
  1869.      a label is declared but not used, and whenever a statement
  1870.      computes a result that is explicitly not used.
  1871.  
  1872.      To suppress this warning for an expression, simply cast it to
  1873.      void.  For unused variables and parameters, use the `unused'
  1874.      attribute (*note Variable Attributes::.).
  1875.  
  1876. `-Wuninitialized'
  1877.      An automatic variable is used without first being initialized.
  1878.  
  1879.      These warnings are possible only in optimizing compilation,
  1880.      because they require data flow information that is computed only
  1881.      when optimizing.  If you don't specify `-O', you simply won't get
  1882.      these warnings.
  1883.  
  1884.      These warnings occur only for variables that are candidates for
  1885.      register allocation.  Therefore, they do not occur for a variable
  1886.      that is declared `volatile', or whose address is taken, or whose
  1887.      size is other than 1, 2, 4 or 8 bytes.  Also, they do not occur for
  1888.      structures, unions or arrays, even when they are in registers.
  1889.  
  1890.      Note that there may be no warning about a variable that is used
  1891.      only to compute a value that itself is never used, because such
  1892.      computations may be deleted by data flow analysis before the
  1893.      warnings are printed.
  1894.  
  1895.      These warnings are made optional because GNU CC is not smart
  1896.      enough to see all the reasons why the code might be correct
  1897.      despite appearing to have an error.  Here is one example of how
  1898.      this can happen:
  1899.  
  1900.           {
  1901.             int x;
  1902.             switch (y)
  1903.               {
  1904.               case 1: x = 1;
  1905.                 break;
  1906.               case 2: x = 4;
  1907.                 break;
  1908.               case 3: x = 5;
  1909.               }
  1910.             foo (x);
  1911.           }
  1912.  
  1913.      If the value of `y' is always 1, 2 or 3, then `x' is always
  1914.      initialized, but GNU CC doesn't know this.  Here is another common
  1915.      case:
  1916.  
  1917.           {
  1918.             int save_y;
  1919.             if (change_y) save_y = y, y = new_y;
  1920.             ...
  1921.             if (change_y) y = save_y;
  1922.           }
  1923.  
  1924.      This has no bug because `save_y' is used only if it is set.
  1925.  
  1926.      Some spurious warnings can be avoided if you declare all the
  1927.      functions you use that never return as `noreturn'.  *Note Function
  1928.      Attributes::.
  1929.  
  1930. `-Wenum-clash'
  1931.      Warn about conversion between different enumeration types.  (C++
  1932.      only).
  1933.  
  1934. `-Wreorder (C++ only)'
  1935.      Warn when the order of member initializers given in the code does
  1936.      not match the order in which they must be executed.  For instance:
  1937.  
  1938.           struct A {
  1939.             int i;
  1940.             int j;
  1941.             A(): j (0), i (1) { }
  1942.           };
  1943.  
  1944.      Here the compiler will warn that the member initializers for `i'
  1945.      and `j' will be rearranged to match the declaration order of the
  1946.      members.
  1947.  
  1948. `-Wtemplate-debugging'
  1949.      When using templates in a C++ program, warn if debugging is not yet
  1950.      fully available (C++ only).
  1951.  
  1952. `-Wall'
  1953.      All of the above `-W' options combined.  These are all the options
  1954.      which pertain to usage that we recommend avoiding and that we
  1955.      believe is easy to avoid, even in conjunction with macros.
  1956.  
  1957.    The remaining `-W...' options are not implied by `-Wall' because
  1958. they warn about constructions that we consider reasonable to use, on
  1959. occasion, in clean programs.
  1960.  
  1961. `-W'
  1962.      Print extra warning messages for these events:
  1963.  
  1964.         * A nonvolatile automatic variable might be changed by a call to
  1965.           `longjmp'.  These warnings as well are possible only in
  1966.           optimizing compilation.
  1967.  
  1968.           The compiler sees only the calls to `setjmp'.  It cannot know
  1969.           where `longjmp' will be called; in fact, a signal handler
  1970.           could call it at any point in the code.  As a result, you may
  1971.           get a warning even when there is in fact no problem because
  1972.           `longjmp' cannot in fact be called at the place which would
  1973.           cause a problem.
  1974.  
  1975.         * A function can return either with or without a value.
  1976.           (Falling off the end of the function body is considered
  1977.           returning without a value.)  For example, this function would
  1978.           evoke such a warning:
  1979.  
  1980.                foo (a)
  1981.                {
  1982.                  if (a > 0)
  1983.                    return a;
  1984.                }
  1985.  
  1986.         * An expression-statement or the left-hand side of a comma
  1987.           expression contains no side effects.  To suppress the
  1988.           warning, cast the unused expression to void.  For example, an
  1989.           expression such as `x[i,j]' will cause a warning, but
  1990.           `x[(void)i,j]' will not.
  1991.  
  1992.         * An unsigned value is compared against zero with `<' or `<='.
  1993.  
  1994.         * A comparison like `x<=y<=z' appears; this is equivalent to
  1995.           `(x<=y ? 1 : 0) <= z', which is a different interpretation
  1996.           from that of ordinary mathematical notation.
  1997.  
  1998.         * Storage-class specifiers like `static' are not the first
  1999.           things in a declaration.  According to the C Standard, this
  2000.           usage is obsolescent.
  2001.  
  2002.         * If `-Wall' or `-Wunused' is also specified, warn about unused
  2003.           arguments.
  2004.  
  2005.         * An aggregate has a partly bracketed initializer.  For
  2006.           example, the following code would evoke such a warning,
  2007.           because braces are missing around the initializer for `x.h':
  2008.  
  2009.                struct s { int f, g; };
  2010.                struct t { struct s h; int i; };
  2011.                struct t x = { 1, 2, 3 };
  2012.  
  2013. `-Wtraditional'
  2014.      Warn about certain constructs that behave differently in
  2015.      traditional and ANSI C.
  2016.  
  2017.         * Macro arguments occurring within string constants in the
  2018.           macro body.  These would substitute the argument in
  2019.           traditional C, but are part of the constant in ANSI C.
  2020.  
  2021.         * A function declared external in one block and then used after
  2022.           the end of the block.
  2023.  
  2024.         * A `switch' statement has an operand of type `long'.
  2025.  
  2026. `-Wshadow'
  2027.      Warn whenever a local variable shadows another local variable.
  2028.  
  2029. `-Wid-clash-LEN'
  2030.      Warn whenever two distinct identifiers match in the first LEN
  2031.      characters.  This may help you prepare a program that will compile
  2032.      with certain obsolete, brain-damaged compilers.
  2033.  
  2034. `-Wlarger-than-LEN'
  2035.      Warn whenever an object of larger than LEN bytes is defined.
  2036.  
  2037. `-Wpointer-arith'
  2038.      Warn about anything that depends on the "size of" a function type
  2039.      or of `void'.  GNU C assigns these types a size of 1, for
  2040.      convenience in calculations with `void *' pointers and pointers to
  2041.      functions.
  2042.  
  2043. `-Wbad-function-cast'
  2044.      Warn whenever a function call is cast to a non-matching type.  For
  2045.      example, warn if `int malloc()' is cast to `anything *'.
  2046.  
  2047. `-Wcast-qual'
  2048.      Warn whenever a pointer is cast so as to remove a type qualifier
  2049.      from the target type.  For example, warn if a `const char *' is
  2050.      cast to an ordinary `char *'.
  2051.  
  2052. `-Wcast-align'
  2053.      Warn whenever a pointer is cast such that the required alignment
  2054.      of the target is increased.  For example, warn if a `char *' is
  2055.      cast to an `int *' on machines where integers can only be accessed
  2056.      at two- or four-byte boundaries.
  2057.  
  2058. `-Wwrite-strings'
  2059.      Give string constants the type `const char[LENGTH]' so that
  2060.      copying the address of one into a non-`const' `char *' pointer
  2061.      will get a warning.  These warnings will help you find at compile
  2062.      time code that can try to write into a string constant, but only
  2063.      if you have been very careful about using `const' in declarations
  2064.      and prototypes.  Otherwise, it will just be a nuisance; this is
  2065.      why we did not make `-Wall' request these warnings.
  2066.  
  2067. `-Wconversion'
  2068.      Warn if a prototype causes a type conversion that is different
  2069.      from what would happen to the same argument in the absence of a
  2070.      prototype.  This includes conversions of fixed point to floating
  2071.      and vice versa, and conversions changing the width or signedness
  2072.      of a fixed point argument except when the same as the default
  2073.      promotion.
  2074.  
  2075.      Also, warn if a negative integer constant expression is implicitly
  2076.      converted to an unsigned type.  For example, warn about the
  2077.      assignment `x = -1' if `x' is unsigned.  But do not warn about
  2078.      explicit casts like `(unsigned) -1'.
  2079.  
  2080. `-Waggregate-return'
  2081.      Warn if any functions that return structures or unions are defined
  2082.      or called.  (In languages where you can return an array, this also
  2083.      elicits a warning.)
  2084.  
  2085. `-Wstrict-prototypes'
  2086.      Warn if a function is declared or defined without specifying the
  2087.      argument types.  (An old-style function definition is permitted
  2088.      without a warning if preceded by a declaration which specifies the
  2089.      argument types.)
  2090.  
  2091. `-Wmissing-prototypes'
  2092.      Warn if a global function is defined without a previous prototype
  2093.      declaration.  This warning is issued even if the definition itself
  2094.      provides a prototype.  The aim is to detect global functions that
  2095.      fail to be declared in header files.
  2096.  
  2097. `-Wmissing-declarations'
  2098.      Warn if a global function is defined without a previous
  2099.      declaration.  Do so even if the definition itself provides a
  2100.      prototype.  Use this option to detect global functions that are
  2101.      not declared in header files.
  2102.  
  2103. `-Wredundant-decls'
  2104.      Warn if anything is declared more than once in the same scope,
  2105.      even in cases where multiple declaration is valid and changes
  2106.      nothing.
  2107.  
  2108. `-Wnested-externs'
  2109.      Warn if an `extern' declaration is encountered within an function.
  2110.  
  2111. `-Winline'
  2112.      Warn if a function can not be inlined, and either it was declared
  2113.      as inline, or else the `-finline-functions' option was given.
  2114.  
  2115. `-Woverloaded-virtual'
  2116.      Warn when a derived class function declaration may be an error in
  2117.      defining a virtual function (C++ only).  In a derived class, the
  2118.      definitions of virtual functions must match the type signature of a
  2119.      virtual function declared in the base class.  With this option, the
  2120.      compiler warns when you define a function with the same name as a
  2121.      virtual function, but with a type signature that does not match any
  2122.      declarations from the base class.
  2123.  
  2124. `-Wsynth (C++ only)'
  2125.      Warn when g++'s synthesis behavior does not match that of cfront.
  2126.      For instance:
  2127.  
  2128.           struct A {
  2129.             operator int ();
  2130.             A& operator = (int);
  2131.           };
  2132.           
  2133.           main ()
  2134.           {
  2135.             A a,b;
  2136.             a = b;
  2137.           }
  2138.  
  2139.      In this example, g++ will synthesize a default `A& operator =
  2140.      (const A&);', while cfront will use the user-defined `operator ='.
  2141.  
  2142. `-Werror'
  2143.      Make all warnings into errors.
  2144.  
  2145. 
  2146. File: !gcc.docs.gccuser,  Node: Debugging Options,  Next: Optimize Options,  Prev: Warning Options,  Up: Invoking GCC
  2147.  
  2148. Options for Debugging Your Program or GNU CC
  2149. ============================================
  2150.  
  2151.    GNU CC has various special options that are used for debugging
  2152. either your program or GCC:
  2153.  
  2154. `-g'
  2155.      Produce debugging information in the operating system's native
  2156.      format (stabs, COFF, XCOFF, or DWARF).  GDB can work with this
  2157.      debugging information.
  2158.  
  2159.      On most systems that use stabs format, `-g' enables use of extra
  2160.      debugging information that only GDB can use; this extra information
  2161.      makes debugging work better in GDB but will probably make other
  2162.      debuggers crash or refuse to read the program.  If you want to
  2163.      control for certain whether to generate the extra information, use
  2164.      `-gstabs+', `-gstabs', `-gxcoff+', `-gxcoff', `-gdwarf+', or
  2165.      `-gdwarf' (see below).
  2166.  
  2167.      Unlike most other C compilers, GNU CC allows you to use `-g' with
  2168.      `-O'.  The shortcuts taken by optimized code may occasionally
  2169.      produce surprising results: some variables you declared may not
  2170.      exist at all; flow of control may briefly move where you did not
  2171.      expect it; some statements may not be executed because they
  2172.      compute constant results or their values were already at hand;
  2173.      some statements may execute in different places because they were
  2174.      moved out of loops.
  2175.  
  2176.      Nevertheless it proves possible to debug optimized output.  This
  2177.      makes it reasonable to use the optimizer for programs that might
  2178.      have bugs.
  2179.  
  2180.      The following options are useful when GNU CC is generated with the
  2181.      capability for more than one debugging format.
  2182.  
  2183. `-ggdb'
  2184.      Produce debugging information in the native format (if that is
  2185.      supported), including GDB extensions if at all possible.
  2186.  
  2187. `-gstabs'
  2188.      Produce debugging information in stabs format (if that is
  2189.      supported), without GDB extensions.  This is the format used by
  2190.      DBX on most BSD systems.  On MIPS, Alpha and System V Release 4
  2191.      systems this option produces stabs debugging output which is not
  2192.      understood by DBX or SDB.  On System V Release 4 systems this
  2193.      option requires the GNU assembler.
  2194.  
  2195. `-gstabs+'
  2196.      Produce debugging information in stabs format (if that is
  2197.      supported), using GNU extensions understood only by the GNU
  2198.      debugger (GDB).  The use of these extensions is likely to make
  2199.      other debuggers crash or refuse to read the program.
  2200.  
  2201. `-gcoff'
  2202.      Produce debugging information in COFF format (if that is
  2203.      supported).  This is the format used by SDB on most System V
  2204.      systems prior to System V Release 4.
  2205.  
  2206. `-gxcoff'
  2207.      Produce debugging information in XCOFF format (if that is
  2208.      supported).  This is the format used by the DBX debugger on IBM
  2209.      RS/6000 systems.
  2210.  
  2211. `-gxcoff+'
  2212.      Produce debugging information in XCOFF format (if that is
  2213.      supported), using GNU extensions understood only by the GNU
  2214.      debugger (GDB).  The use of these extensions is likely to make
  2215.      other debuggers crash or refuse to read the program, and may cause
  2216.      assemblers other than the GNU assembler (GAS) to fail with an
  2217.      error.
  2218.  
  2219. `-gdwarf'
  2220.      Produce debugging information in DWARF format (if that is
  2221.      supported).  This is the format used by SDB on most System V
  2222.      Release 4 systems.
  2223.  
  2224. `-gdwarf+'
  2225.      Produce debugging information in DWARF format (if that is
  2226.      supported), using GNU extensions understood only by the GNU
  2227.      debugger (GDB).  The use of these extensions is likely to make
  2228.      other debuggers crash or refuse to read the program.
  2229.  
  2230. `-gLEVEL'
  2231. `-ggdbLEVEL'
  2232. `-gstabsLEVEL'
  2233. `-gcoffLEVEL'
  2234. `-gxcoffLEVEL'
  2235. `-gdwarfLEVEL'
  2236.      Request debugging information and also use LEVEL to specify how
  2237.      much information.  The default level is 2.
  2238.  
  2239.      Level 1 produces minimal information, enough for making backtraces
  2240.      in parts of the program that you don't plan to debug.  This
  2241.      includes descriptions of functions and external variables, but no
  2242.      information about local variables and no line numbers.
  2243.  
  2244.      Level 3 includes extra information, such as all the macro
  2245.      definitions present in the program.  Some debuggers support macro
  2246.      expansion when you use `-g3'.
  2247.  
  2248. `-p'
  2249.      Generate extra code to write profile information suitable for the
  2250.      analysis program `prof'.  You must use this option when compiling
  2251.      the source files you want data about, and you must also use it when
  2252.      linking.
  2253.  
  2254. `-pg'
  2255.      Generate extra code to write profile information suitable for the
  2256.      analysis program `gprof'.  You must use this option when compiling
  2257.      the source files you want data about, and you must also use it when
  2258.      linking.
  2259.  
  2260. `-a'
  2261.      Generate extra code to write profile information for basic blocks,
  2262.      which will record the number of times each basic block is
  2263.      executed, the basic block start address, and the function name
  2264.      containing the basic block.  If `-g' is used, the line number and
  2265.      filename of the start of the basic block will also be recorded.
  2266.      If not overridden by the machine description, the default action is
  2267.      to append to the text file `bb.out'.
  2268.  
  2269.      This data could be analyzed by a program like `tcov'.  Note,
  2270.      however, that the format of the data is not what `tcov' expects.
  2271.      Eventually GNU `gprof' should be extended to process this data.
  2272.  
  2273. `-dLETTERS'
  2274.      Says to make debugging dumps during compilation at times specified
  2275.      by LETTERS.  This is used for debugging the compiler.  The file
  2276.      names for most of the dumps are made by appending a word to the
  2277.      source file name (e.g.  `foo.c.rtl' or `foo.c.jump').  Here are the
  2278.      possible letters for use in LETTERS, and their meanings:
  2279.  
  2280.     `M'
  2281.           Dump all macro definitions, at the end of preprocessing, and
  2282.           write no output.
  2283.  
  2284.     `N'
  2285.           Dump all macro names, at the end of preprocessing.
  2286.  
  2287.     `D'
  2288.           Dump all macro definitions, at the end of preprocessing, in
  2289.           addition to normal output.
  2290.  
  2291.     `y'
  2292.           Dump debugging information during parsing, to standard error.
  2293.  
  2294.     `r'
  2295.           Dump after RTL generation, to `FILE.rtl'.
  2296.  
  2297.     `x'
  2298.           Just generate RTL for a function instead of compiling it.
  2299.           Usually used with `r'.
  2300.  
  2301.     `j'
  2302.           Dump after first jump optimization, to `FILE.jump'.
  2303.  
  2304.     `s'
  2305.           Dump after CSE (including the jump optimization that sometimes
  2306.           follows CSE), to `FILE.cse'.
  2307.  
  2308.     `L'
  2309.           Dump after loop optimization, to `FILE.loop'.
  2310.  
  2311.     `t'
  2312.           Dump after the second CSE pass (including the jump
  2313.           optimization that sometimes follows CSE), to `FILE.cse2'.
  2314.  
  2315.     `f'
  2316.           Dump after flow analysis, to `FILE.flow'.
  2317.  
  2318.     `c'
  2319.           Dump after instruction combination, to the file
  2320.           `FILE.combine'.
  2321.  
  2322.     `S'
  2323.           Dump after the first instruction scheduling pass, to
  2324.           `FILE.sched'.
  2325.  
  2326.     `l'
  2327.           Dump after local register allocation, to `FILE.lreg'.
  2328.  
  2329.     `g'
  2330.           Dump after global register allocation, to `FILE.greg'.
  2331.  
  2332.     `R'
  2333.           Dump after the second instruction scheduling pass, to
  2334.           `FILE.sched2'.
  2335.  
  2336.     `J'
  2337.           Dump after last jump optimization, to `FILE.jump2'.
  2338.  
  2339.     `d'
  2340.           Dump after delayed branch scheduling, to `FILE.dbr'.
  2341.  
  2342.     `k'
  2343.           Dump after conversion from registers to stack, to
  2344.           `FILE.stack'.
  2345.  
  2346.     `a'
  2347.           Produce all the dumps listed above.
  2348.  
  2349.     `m'
  2350.           Print statistics on memory usage, at the end of the run, to
  2351.           standard error.
  2352.  
  2353.     `p'
  2354.           Annotate the assembler output with a comment indicating which
  2355.           pattern and alternative was used.
  2356.  
  2357. `-fpretend-float'
  2358.      When running a cross-compiler, pretend that the target machine
  2359.      uses the same floating point format as the host machine.  This
  2360.      causes incorrect output of the actual floating constants, but the
  2361.      actual instruction sequence will probably be the same as GNU CC
  2362.      would make when running on the target machine.
  2363.  
  2364. `-save-temps'
  2365.      Store the usual "temporary" intermediate files permanently; place
  2366.      them in the current directory and name them based on the source
  2367.      file.  Thus, compiling `foo.c' with `-c -save-temps' would produce
  2368.      files `foo.i' and `foo.s', as well as `foo.o'.
  2369.  
  2370. `-print-file-name=LIBRARY'
  2371.      Print the full absolute name of the library file LIBRARY that
  2372.      would be used when linking--and don't do anything else.  With this
  2373.      option, GNU CC does not compile or link anything; it just prints
  2374.      the file name.
  2375.  
  2376. `-print-prog-name=PROGRAM'
  2377.      Like `-print-file-name', but searches for a program such as `cpp'.
  2378.  
  2379. `-print-libgcc-file-name'
  2380.      Same as `-print-file-name=libgcc.a'.
  2381.  
  2382.      This is useful when you use `-nostdlib' or `-nodefaultlibs' but
  2383.      you do want to link with `libgcc.a'.  You can do
  2384.  
  2385.           gcc -nostdlib FILES... `gcc -print-libgcc-file-name`
  2386.  
  2387. `-print-search-dirs'
  2388.      Print the name of the configured installation directory and a list
  2389.      of program and library directories gcc will search--and don't do
  2390.      anything else.
  2391.  
  2392.      This is useful when gcc prints the error message `installation
  2393.      problem, cannot exec cpp: No such file or directory'.  To resolve
  2394.      this you either need to put `cpp' and the other compiler
  2395.      components where gcc expects to find them, or you can set the
  2396.      environment variable `GCC_EXEC_PREFIX' to the directory where you
  2397.      installed them.  Don't forget the trailing '/'.  *Note Environment
  2398.      Variables::.
  2399.  
  2400. 
  2401. File: !gcc.docs.gccuser,  Node: Optimize Options,  Next: Preprocessor Options,  Prev: Debugging Options,  Up: Invoking GCC
  2402.  
  2403. Options That Control Optimization
  2404. =================================
  2405.  
  2406.    These options control various sorts of optimizations:
  2407.  
  2408. `-O'
  2409. `-O1'
  2410.      Optimize.  Optimizing compilation takes somewhat more time, and a
  2411.      lot more memory for a large function.
  2412.  
  2413.      Without `-O', the compiler's goal is to reduce the cost of
  2414.      compilation and to make debugging produce the expected results.
  2415.      Statements are independent: if you stop the program with a
  2416.      breakpoint between statements, you can then assign a new value to
  2417.      any variable or change the program counter to any other statement
  2418.      in the function and get exactly the results you would expect from
  2419.      the source code.
  2420.  
  2421.      Without `-O', the compiler only allocates variables declared
  2422.      `register' in registers.  The resulting compiled code is a little
  2423.      worse than produced by PCC without `-O'.
  2424.  
  2425.      With `-O', the compiler tries to reduce code size and execution
  2426.      time.
  2427.  
  2428.      When you specify `-O', the compiler turns on `-fthread-jumps' and
  2429.      `-fdefer-pop' on all machines.  The compiler turns on
  2430.      `-fdelayed-branch' on machines that have delay slots, and
  2431.      `-fomit-frame-pointer' on machines that can support debugging even
  2432.      without a frame pointer.  On some machines the compiler also turns
  2433.      on other flags.
  2434.  
  2435. `-O2'
  2436.      Optimize even more.  GNU CC performs nearly all supported
  2437.      optimizations that do not involve a space-speed tradeoff.  The
  2438.      compiler does not perform loop unrolling or function inlining when
  2439.      you specify `-O2'.  As compared to `-O', this option increases
  2440.      both compilation time and the performance of the generated code.
  2441.  
  2442.      `-O2' turns on all optional optimizations except for loop unrolling
  2443.      and function inlining.  It also turns on the `-fforce-mem' option
  2444.      on all machines and frame pointer elimination on machines where
  2445.      doing so does not interfere with debugging.
  2446.  
  2447. `-O3'
  2448.      Optimize yet more.  `-O3' turns on all optimizations specified by
  2449.      `-O2' and also turns on the `inline-functions' option.
  2450.  
  2451. `-O0'
  2452.      Do not optimize.
  2453.  
  2454.      If you use multiple `-O' options, with or without level numbers,
  2455.      the last such option is the one that is effective.
  2456.  
  2457.    Options of the form `-fFLAG' specify machine-independent flags.
  2458. Most flags have both positive and negative forms; the negative form of
  2459. `-ffoo' would be `-fno-foo'.  In the table below, only one of the forms
  2460. is listed--the one which is not the default.  You can figure out the
  2461. other form by either removing `no-' or adding it.
  2462.  
  2463. `-ffloat-store'
  2464.      Do not store floating point variables in registers, and inhibit
  2465.      other options that might change whether a floating point value is
  2466.      taken from a register or memory.
  2467.  
  2468.      This option prevents undesirable excess precision on machines such
  2469.      as the 68000 where the floating registers (of the 68881) keep more
  2470.      precision than a `double' is supposed to have.  For most programs,
  2471.      the excess precision does only good, but a few programs rely on the
  2472.      precise definition of IEEE floating point.  Use `-ffloat-store' for
  2473.      such programs.
  2474.  
  2475. `-fno-default-inline'
  2476.      Do not make member functions inline by default merely because they
  2477.      are defined inside the class scope (C++ only).  Otherwise, when
  2478.      you specify `-O', member functions defined inside class scope are
  2479.      compiled inline by default; i.e., you don't need to add `inline'
  2480.      in front of the member function name.
  2481.  
  2482. `-fno-defer-pop'
  2483.      Always pop the arguments to each function call as soon as that
  2484.      function returns.  For machines which must pop arguments after a
  2485.      function call, the compiler normally lets arguments accumulate on
  2486.      the stack for several function calls and pops them all at once.
  2487.  
  2488. `-fforce-mem'
  2489.      Force memory operands to be copied into registers before doing
  2490.      arithmetic on them.  This produces better code by making all memory
  2491.      references potential common subexpressions.  When they are not
  2492.      common subexpressions, instruction combination should eliminate
  2493.      the separate register-load.  The `-O2' option turns on this option.
  2494.  
  2495. `-fforce-addr'
  2496.      Force memory address constants to be copied into registers before
  2497.      doing arithmetic on them.  This may produce better code just as
  2498.      `-fforce-mem' may.
  2499.  
  2500. `-fomit-frame-pointer'
  2501.      Don't keep the frame pointer in a register for functions that
  2502.      don't need one.  This avoids the instructions to save, set up and
  2503.      restore frame pointers; it also makes an extra register available
  2504.      in many functions.  *It also makes debugging impossible on some
  2505.      machines.*
  2506.  
  2507.      On some machines, such as the Vax, this flag has no effect, because
  2508.      the standard calling sequence automatically handles the frame
  2509.      pointer and nothing is saved by pretending it doesn't exist.  The
  2510.      machine-description macro `FRAME_POINTER_REQUIRED' controls
  2511.      whether a target machine supports this flag.  *Note Register
  2512.      Usage: (gcc.info)Registers.
  2513.  
  2514. `-fno-inline'
  2515.      Don't pay attention to the `inline' keyword.  Normally this option
  2516.      is used to keep the compiler from expanding any functions inline.
  2517.      Note that if you are not optimizing, no functions can be expanded
  2518.      inline.
  2519.  
  2520. `-finline-functions'
  2521.      Integrate all simple functions into their callers.  The compiler
  2522.      heuristically decides which functions are simple enough to be worth
  2523.      integrating in this way.
  2524.  
  2525.      If all calls to a given function are integrated, and the function
  2526.      is declared `static', then the function is normally not output as
  2527.      assembler code in its own right.
  2528.  
  2529. `-fkeep-inline-functions'
  2530.      Even if all calls to a given function are integrated, and the
  2531.      function is declared `static', nevertheless output a separate
  2532.      run-time callable version of the function.
  2533.  
  2534. `-fno-function-cse'
  2535.      Do not put function addresses in registers; make each instruction
  2536.      that calls a constant function contain the function's address
  2537.      explicitly.
  2538.  
  2539.      This option results in less efficient code, but some strange hacks
  2540.      that alter the assembler output may be confused by the
  2541.      optimizations performed when this option is not used.
  2542.  
  2543. `-ffast-math'
  2544.      This option allows GCC to violate some ANSI or IEEE rules and/or
  2545.      specifications in the interest of optimizing code for speed.  For
  2546.      example, it allows the compiler to assume arguments to the `sqrt'
  2547.      function are non-negative numbers and that no floating-point values
  2548.      are NaNs.
  2549.  
  2550.      This option should never be turned on by any `-O' option since it
  2551.      can result in incorrect output for programs which depend on an
  2552.      exact implementation of IEEE or ANSI rules/specifications for math
  2553.      functions.
  2554.  
  2555.    The following options control specific optimizations.  The `-O2'
  2556. option turns on all of these optimizations except `-funroll-loops' and
  2557. `-funroll-all-loops'.  On most machines, the `-O' option turns on the
  2558. `-fthread-jumps' and `-fdelayed-branch' options, but specific machines
  2559. may handle it differently.
  2560.  
  2561.    You can use the following flags in the rare cases when "fine-tuning"
  2562. of optimizations to be performed is desired.
  2563.  
  2564. `-fstrength-reduce'
  2565.      Perform the optimizations of loop strength reduction and
  2566.      elimination of iteration variables.
  2567.  
  2568. `-fthread-jumps'
  2569.      Perform optimizations where we check to see if a jump branches to a
  2570.      location where another comparison subsumed by the first is found.
  2571.      If so, the first branch is redirected to either the destination of
  2572.      the second branch or a point immediately following it, depending
  2573.      on whether the condition is known to be true or false.
  2574.  
  2575. `-fcse-follow-jumps'
  2576.      In common subexpression elimination, scan through jump instructions
  2577.      when the target of the jump is not reached by any other path.  For
  2578.      example, when CSE encounters an `if' statement with an `else'
  2579.      clause, CSE will follow the jump when the condition tested is
  2580.      false.
  2581.  
  2582. `-fcse-skip-blocks'
  2583.      This is similar to `-fcse-follow-jumps', but causes CSE to follow
  2584.      jumps which conditionally skip over blocks.  When CSE encounters a
  2585.      simple `if' statement with no else clause, `-fcse-skip-blocks'
  2586.      causes CSE to follow the jump around the body of the `if'.
  2587.  
  2588. `-frerun-cse-after-loop'
  2589.      Re-run common subexpression elimination after loop optimizations
  2590.      has been performed.
  2591.  
  2592. `-fexpensive-optimizations'
  2593.      Perform a number of minor optimizations that are relatively
  2594.      expensive.
  2595.  
  2596. `-fdelayed-branch'
  2597.      If supported for the target machine, attempt to reorder
  2598.      instructions to exploit instruction slots available after delayed
  2599.      branch instructions.
  2600.  
  2601. `-fschedule-insns'
  2602.      If supported for the target machine, attempt to reorder
  2603.      instructions to eliminate execution stalls due to required data
  2604.      being unavailable.  This helps machines that have slow floating
  2605.      point or memory load instructions by allowing other instructions
  2606.      to be issued until the result of the load or floating point
  2607.      instruction is required.
  2608.  
  2609. `-fschedule-insns2'
  2610.      Similar to `-fschedule-insns', but requests an additional pass of
  2611.      instruction scheduling after register allocation has been done.
  2612.      This is especially useful on machines with a relatively small
  2613.      number of registers and where memory load instructions take more
  2614.      than one cycle.
  2615.  
  2616. `-fcaller-saves'
  2617.      Enable values to be allocated in registers that will be clobbered
  2618.      by function calls, by emitting extra instructions to save and
  2619.      restore the registers around such calls.  Such allocation is done
  2620.      only when it seems to result in better code than would otherwise
  2621.      be produced.
  2622.  
  2623.      This option is enabled by default on certain machines, usually
  2624.      those which have no call-preserved registers to use instead.
  2625.  
  2626. `-funroll-loops'
  2627.      Perform the optimization of loop unrolling.  This is only done for
  2628.      loops whose number of iterations can be determined at compile time
  2629.      or run time.  `-funroll-loop' implies both `-fstrength-reduce' and
  2630.      `-frerun-cse-after-loop'.
  2631.  
  2632. `-funroll-all-loops'
  2633.      Perform the optimization of loop unrolling.  This is done for all
  2634.      loops and usually makes programs run more slowly.
  2635.      `-funroll-all-loops' implies `-fstrength-reduce' as well as
  2636.      `-frerun-cse-after-loop'.
  2637.  
  2638. `-fno-peephole'
  2639.      Disable any machine-specific peephole optimizations.
  2640.  
  2641. 
  2642. File: !gcc.docs.gccuser,  Node: Preprocessor Options,  Next: Assembler Options,  Prev: Optimize Options,  Up: Invoking GCC
  2643.  
  2644. Options Controlling the Preprocessor
  2645. ====================================
  2646.  
  2647.    These options control the C preprocessor, which is run on each C
  2648. source file before actual compilation.
  2649.  
  2650.    If you use the `-E' option, nothing is done except preprocessing.
  2651. Some of these options make sense only together with `-E' because they
  2652. cause the preprocessor output to be unsuitable for actual compilation.
  2653.  
  2654. `-include FILE'
  2655.      Process FILE as input before processing the regular input file.
  2656.      In effect, the contents of FILE are compiled first.  Any `-D' and
  2657.      `-U' options on the command line are always processed before
  2658.      `-include FILE', regardless of the order in which they are
  2659.      written.  All the `-include' and `-imacros' options are processed
  2660.      in the order in which they are written.
  2661.  
  2662. `-imacros FILE'
  2663.      Process FILE as input, discarding the resulting output, before
  2664.      processing the regular input file.  Because the output generated
  2665.      from FILE is discarded, the only effect of `-imacros FILE' is to
  2666.      make the macros defined in FILE available for use in the main
  2667.      input.
  2668.  
  2669.      Any `-D' and `-U' options on the command line are always processed
  2670.      before `-imacros FILE', regardless of the order in which they are
  2671.      written.  All the `-include' and `-imacros' options are processed
  2672.      in the order in which they are written.
  2673.  
  2674. `-idirafter DIR'
  2675.      Add the directory DIR to the second include path.  The directories
  2676.      on the second include path are searched when a header file is not
  2677.      found in any of the directories in the main include path (the one
  2678.      that `-I' adds to).
  2679.  
  2680. `-iprefix PREFIX'
  2681.      Specify PREFIX as the prefix for subsequent `-iwithprefix' options.
  2682.  
  2683. `-iwithprefix DIR'
  2684.      Add a directory to the second include path.  The directory's name
  2685.      is made by concatenating PREFIX and DIR, where PREFIX was
  2686.      specified previously with `-iprefix'.  If you have not specified a
  2687.      prefix yet, the directory containing the installed passes of the
  2688.      compiler is used as the default.
  2689.  
  2690. `-iwithprefixbefore DIR'
  2691.      Add a directory to the main include path.  The directory's name is
  2692.      made by concatenating PREFIX and DIR, as in the case of
  2693.      `-iwithprefix'.
  2694.  
  2695. `-isystem DIR'
  2696.      Add a directory to the beginning of the second include path,
  2697.      marking it as a system directory, so that it gets the same special
  2698.      treatment as is applied to the standard system directories.
  2699.  
  2700. `-nostdinc'
  2701.      Do not search the standard system directories for header files.
  2702.      Only the directories you have specified with `-I' options (and the
  2703.      current directory, if appropriate) are searched.  *Note Directory
  2704.      Options::, for information on `-I'.
  2705.  
  2706.      By using both `-nostdinc' and `-I-', you can limit the include-file
  2707.      search path to only those directories you specify explicitly.
  2708.  
  2709. `-undef'
  2710.      Do not predefine any nonstandard macros.  (Including architecture
  2711.      flags).
  2712.  
  2713. `-E'
  2714.      Run only the C preprocessor.  Preprocess all the C source files
  2715.      specified and output the results to standard output or to the
  2716.      specified output file.
  2717.  
  2718. `-C'
  2719.      Tell the preprocessor not to discard comments.  Used with the `-E'
  2720.      option.
  2721.  
  2722. `-P'
  2723.      Tell the preprocessor not to generate `#line' directives.  Used
  2724.      with the `-E' option.
  2725.  
  2726. `-M'
  2727.      Tell the preprocessor to output a rule suitable for `make'
  2728.      describing the dependencies of each object file.  For each source
  2729.      file, the preprocessor outputs one `make'-rule whose target is the
  2730.      object file name for that source file and whose dependencies are
  2731.      all the `#include' header files it uses.  This rule may be a
  2732.      single line or may be continued with `\'-newline if it is long.
  2733.      The list of rules is printed on standard output instead of the
  2734.      preprocessed C program.
  2735.  
  2736.      `-M' implies `-E'.
  2737.  
  2738.      Another way to specify output of a `make' rule is by setting the
  2739.      environment variable `DEPENDENCIES_OUTPUT' (*note Environment
  2740.      Variables::.).
  2741.  
  2742. `-MM'
  2743.      Like `-M' but the output mentions only the user header files
  2744.      included with `#include "FILE"'.  System header files included
  2745.      with `#include <FILE>' are omitted.
  2746.  
  2747. `-MD'
  2748.      Like `-M' but the dependency information is written to a file made
  2749.      by replacing ".c" with ".d" at the end of the input file names.
  2750.      This is in addition to compiling the file as specified--`-MD' does
  2751.      not inhibit ordinary compilation the way `-M' does.
  2752.  
  2753.      In Mach, you can use the utility `md' to merge multiple dependency
  2754.      files into a single dependency file suitable for using with the
  2755.      `make' command.
  2756.  
  2757. `-MMD'
  2758.      Like `-MD' except mention only user header files, not system
  2759.      header files.
  2760.  
  2761. `-MG'
  2762.      Treat missing header files as generated files and assume they live
  2763.      in the same directory as the source file.  If you specify `-MG',
  2764.      you must also specify either `-M' or `-MM'.  `-MG' is not
  2765.      supported with `-MD' or `-MMD'.
  2766.  
  2767. `-H'
  2768.      Print the name of each header file used, in addition to other
  2769.      normal activities.
  2770.  
  2771. `-AQUESTION(ANSWER)'
  2772.      Assert the answer ANSWER for QUESTION, in case it is tested with a
  2773.      preprocessing conditional such as `#if #QUESTION(ANSWER)'.  `-A-'
  2774.      disables the standard assertions that normally describe the target
  2775.      machine.
  2776.  
  2777. `-DMACRO'
  2778.      Define macro MACRO with the string `1' as its definition.
  2779.  
  2780. `-DMACRO=DEFN'
  2781.      Define macro MACRO as DEFN.  All instances of `-D' on the command
  2782.      line are processed before any `-U' options.
  2783.  
  2784. `-UMACRO'
  2785.      Undefine macro MACRO.  `-U' options are evaluated after all `-D'
  2786.      options, but before any `-include' and `-imacros' options.
  2787.  
  2788. `-dM'
  2789.      Tell the preprocessor to output only a list of the macro
  2790.      definitions that are in effect at the end of preprocessing.  Used
  2791.      with the `-E' option.
  2792.  
  2793. `-dD'
  2794.      Tell the preprocessing to pass all macro definitions into the
  2795.      output, in their proper sequence in the rest of the output.
  2796.  
  2797. `-dN'
  2798.      Like `-dD' except that the macro arguments and contents are
  2799.      omitted.  Only `#define NAME' is included in the output.
  2800.  
  2801. `-trigraphs'
  2802.      Support ANSI C trigraphs.  The `-ansi' option also has this effect.
  2803.  
  2804. `-Wp,OPTION'
  2805.      Pass OPTION as an option to the preprocessor.  If OPTION contains
  2806.      commas, it is split into multiple options at the commas.
  2807.  
  2808. 
  2809. File: !gcc.docs.gccuser,  Node: Assembler Options,  Next: Link Options,  Prev: Preprocessor Options,  Up: Invoking GCC
  2810.  
  2811. Passing Options to the Assembler
  2812. ================================
  2813.  
  2814.    You can pass options to the assembler.
  2815.  
  2816. `-Wa,OPTION'
  2817.      Pass OPTION as an option to the assembler.  If OPTION contains
  2818.      commas, it is split into multiple options at the commas.
  2819.  
  2820. 
  2821. File: !gcc.docs.gccuser,  Node: Link Options,  Next: Directory Options,  Prev: Assembler Options,  Up: Invoking GCC
  2822.  
  2823. Options for Linking
  2824. ===================
  2825.  
  2826.    These options come into play when the compiler links object files
  2827. into an executable output file.  They are meaningless if the compiler is
  2828. not doing a link step.
  2829.  
  2830. `OBJECT-FILE-NAME'
  2831.      A file name that does not end in a special recognized suffix is
  2832.      considered to name an object file or library.  (Object files are
  2833.      distinguished from libraries by the linker according to the file
  2834.      contents.)  If linking is done, these object files are used as
  2835.      input to the linker.
  2836.  
  2837. `-c'
  2838. `-S'
  2839. `-E'
  2840.      If any of these options is used, then the linker is not run, and
  2841.      object file names should not be used as arguments.  *Note Overall
  2842.      Options::.
  2843.  
  2844. `-lLIBRARY'
  2845.      Search the library named LIBRARY when linking.
  2846.  
  2847.      It makes a difference where in the command you write this option;
  2848.      the linker searches processes libraries and object files in the
  2849.      order they are specified.  Thus, `foo.o -lz bar.o' searches
  2850.      library `z' after file `foo.o' but before `bar.o'.  If `bar.o'
  2851.      refers to functions in `z', those functions may not be loaded.
  2852.  
  2853.      The linker searches a standard list of directories for the library,
  2854.      which is actually a file named `libLIBRARY.a'.  The linker then
  2855.      uses this file as if it had been specified precisely by name.
  2856.  
  2857.      The directories searched include several standard system
  2858.      directories plus any that you specify with `-L'.
  2859.  
  2860.      Normally the files found this way are library files--archive files
  2861.      whose members are object files.  The linker handles an archive
  2862.      file by scanning through it for members which define symbols that
  2863.      have so far been referenced but not defined.  But if the file that
  2864.      is found is an ordinary object file, it is linked in the usual
  2865.      fashion.  The only difference between using an `-l' option and
  2866.      specifying a file name is that `-l' surrounds LIBRARY with `lib'
  2867.      and `.a' and searches several directories.
  2868.  
  2869. `-lobjc'
  2870.      You need this special case of the `-l' option in order to link an
  2871.      Objective C program.
  2872.  
  2873. `-nostartfiles'
  2874.      Do not use the standard system startup files when linking.  The
  2875.      standard system libraries are used normally, unless `-nostdlib' or
  2876.      `-nodefaultlibs' is used.
  2877.  
  2878. `-nodefaultlibs'
  2879.      Do not use the standard system libraries when linking.  Only the
  2880.      libraries you specify will be passed to the linker.  The standard
  2881.      startup files are used normally, unless `-nostartfiles' is used.
  2882.  
  2883. `-nostdlib'
  2884.      Do not use the standard system startup files or libraries when
  2885.      linking.  No startup files and only the libraries you specify will
  2886.      be passed to the linker.
  2887.  
  2888.      One of the standard libraries bypassed by `-nostdlib' and
  2889.      `-nodefaultlibs' is `libgcc.a', a library of internal subroutines
  2890.      that GNU CC uses to overcome shortcomings of particular machines,
  2891.      or special needs for some languages.  (*Note Interfacing to GNU CC
  2892.      Output: (gcc.info)Interface, for more discussion of `libgcc.a'.)
  2893.      In most cases, you need `libgcc.a' even when you want to avoid
  2894.      other standard libraries.  In other words, when you specify
  2895.      `-nostdlib' or `-nodefaultlibs' you should usually specify `-lgcc'
  2896.      as well.  This ensures that you have no unresolved references to
  2897.      internal GNU CC library subroutines.  (For example, `__main', used
  2898.      to ensure C++ constructors will be called; *note `collect2':
  2899.      Collect2..)
  2900.  
  2901. `-s'
  2902.      Remove all symbol table and relocation information from the
  2903.      executable.
  2904.  
  2905. `-static'
  2906.      On systems that support dynamic linking, this prevents linking
  2907.      with the shared libraries.  On other systems, this option has no
  2908.      effect.
  2909.  
  2910. `-shared'
  2911.      Produce a shared object which can then be linked with other
  2912.      objects to form an executable.  Only a few systems support this
  2913.      option.
  2914.  
  2915. `-symbolic'
  2916.      Bind references to global symbols when building a shared object.
  2917.      Warn about any unresolved references (unless overridden by the
  2918.      link editor option `-Xlinker -z -Xlinker defs').  Only a few
  2919.      systems support this option.
  2920.  
  2921. `-Xlinker OPTION'
  2922.      Pass OPTION as an option to the linker.  You can use this to
  2923.      supply system-specific linker options which GNU CC does not know
  2924.      how to recognize.
  2925.  
  2926.      If you want to pass an option that takes an argument, you must use
  2927.      `-Xlinker' twice, once for the option and once for the argument.
  2928.      For example, to pass `-assert definitions', you must write
  2929.      `-Xlinker -assert -Xlinker definitions'.  It does not work to write
  2930.      `-Xlinker "-assert definitions"', because this passes the entire
  2931.      string as a single argument, which is not what the linker expects.
  2932.  
  2933. `-Wl,OPTION'
  2934.      Pass OPTION as an option to the linker.  If OPTION contains
  2935.      commas, it is split into multiple options at the commas.
  2936.  
  2937. `-u SYMBOL'
  2938.      Pretend the symbol SYMBOL is undefined, to force linking of
  2939.      library modules to define it.  You can use `-u' multiple times with
  2940.      different symbols to force loading of additional library modules.
  2941.  
  2942. 
  2943. File: !gcc.docs.gccuser,  Node: Directory Options,  Next: Target Options,  Prev: Link Options,  Up: Invoking GCC
  2944.  
  2945. Options for Directory Search
  2946. ============================
  2947.  
  2948.    These options specify directories to search for header files, for
  2949. libraries and for parts of the compiler:
  2950.  
  2951. `-IDIR'
  2952.      Add the directory DIRECTORY to the head of the list of directories
  2953.      to be searched for header files.  This can be used to override a
  2954.      system header file, substituting your own version, since these
  2955.      directories are searched before the system header file
  2956.      directories.  If you use more than one `-I' option, the
  2957.      directories are scanned in left-to-right order; the standard
  2958.      system directories come after.
  2959.  
  2960. `-I-'
  2961.      Any directories you specify with `-I' options before the `-I-'
  2962.      option are searched only for the case of `#include "FILE"'; they
  2963.      are not searched for `#include <FILE>'.
  2964.  
  2965.      If additional directories are specified with `-I' options after
  2966.      the `-I-', these directories are searched for all `#include'
  2967.      directives.  (Ordinarily *all* `-I' directories are used this way.)
  2968.  
  2969.      In addition, the `-I-' option inhibits the use of the current
  2970.      directory (where the current input file came from) as the first
  2971.      search directory for `#include "FILE"'.  There is no way to
  2972.      override this effect of `-I-'.  With `-I.' you can specify
  2973.      searching the directory which was current when the compiler was
  2974.      invoked.  That is not exactly the same as what the preprocessor
  2975.      does by default, but it is often satisfactory.
  2976.  
  2977.      `-I-' does not inhibit the use of the standard system directories
  2978.      for header files.  Thus, `-I-' and `-nostdinc' are independent.
  2979.  
  2980. `-LDIR'
  2981.      Add directory DIR to the list of directories to be searched for
  2982.      `-l'.
  2983.  
  2984. `-BPREFIX'
  2985.      This option specifies where to find the executables, libraries,
  2986.      include files, and data files of the compiler itself.
  2987.  
  2988.      The compiler driver program runs one or more of the subprograms
  2989.      `cpp', `cc1', `as' and `ld'.  It tries PREFIX as a prefix for each
  2990.      program it tries to run, both with and without `MACHINE/VERSION/'
  2991.      (*note Target Options::.).
  2992.  
  2993.      For each subprogram to be run, the compiler driver first tries the
  2994.      `-B' prefix, if any.  If that name is not found, or if `-B' was
  2995.      not specified, the driver tries two standard prefixes, which are
  2996.      `/usr/lib/gcc/' and `/usr/local/lib/gcc-lib/'.  If neither of
  2997.      those results in a file name that is found, the unmodified program
  2998.      name is searched for using the directories specified in your
  2999.      `PATH' environment variable.
  3000.  
  3001.      `-B' prefixes that effectively specify directory names also apply
  3002.      to libraries in the linker, because the compiler translates these
  3003.      options into `-L' options for the linker.  They also apply to
  3004.      includes files in the preprocessor, because the compiler
  3005.      translates these options into `-isystem' options for the
  3006.      preprocessor.  In this case, the compiler appends `include' to the
  3007.      prefix.
  3008.  
  3009.      The run-time support file `libgcc.a' can also be searched for using
  3010.      the `-B' prefix, if needed.  If it is not found there, the two
  3011.      standard prefixes above are tried, and that is all.  The file is
  3012.      left out of the link if it is not found by those means.
  3013.  
  3014.      Another way to specify a prefix much like the `-B' prefix is to use
  3015.      the environment variable `GCC_EXEC_PREFIX'.  *Note Environment
  3016.      Variables::.
  3017.  
  3018. 
  3019. File: !gcc.docs.gccuser,  Node: Target Options,  Next: Submodel Options,  Prev: Directory Options,  Up: Invoking GCC
  3020.  
  3021. Specifying Target Machine and Compiler Version
  3022. ==============================================
  3023.  
  3024.    By default, GNU CC compiles code for the same type of machine that
  3025. you are using.  However, it can also be installed as a cross-compiler,
  3026. to compile for some other type of machine.  In fact, several different
  3027. configurations of GNU CC, for different target machines, can be
  3028. installed side by side.  Then you specify which one to use with the
  3029. `-b' option.
  3030.  
  3031.    In addition, older and newer versions of GNU CC can be installed side
  3032. by side.  One of them (probably the newest) will be the default, but
  3033. you may sometimes wish to use another.
  3034.  
  3035. `-b MACHINE'
  3036.      The argument MACHINE specifies the target machine for compilation.
  3037.      This is useful when you have installed GNU CC as a cross-compiler.
  3038.  
  3039.      The value to use for MACHINE is the same as was specified as the
  3040.      machine type when configuring GNU CC as a cross-compiler.  For
  3041.      example, if a cross-compiler was configured with `configure
  3042.      i386v', meaning to compile for an 80386 running System V, then you
  3043.      would specify `-b i386v' to run that cross compiler.
  3044.  
  3045.      When you do not specify `-b', it normally means to compile for the
  3046.      same type of machine that you are using.
  3047.  
  3048. `-V VERSION'
  3049.      The argument VERSION specifies which version of GNU CC to run.
  3050.      This is useful when multiple versions are installed.  For example,
  3051.      VERSION might be `2.0', meaning to run GNU CC version 2.0.
  3052.  
  3053.      The default version, when you do not specify `-V', is the last
  3054.      version of GNU CC that you installed.
  3055.  
  3056.    The `-b' and `-V' options actually work by controlling part of the
  3057. file name used for the executable files and libraries used for
  3058. compilation.  A given version of GNU CC, for a given target machine, is
  3059. normally kept in the directory `/usr/local/lib/gcc-lib/MACHINE/VERSION'.
  3060.  
  3061.    Thus, sites can customize the effect of `-b' or `-V' either by
  3062. changing the names of these directories or adding alternate names (or
  3063. symbolic links).  If in directory `/usr/local/lib/gcc-lib/' the file
  3064. `80386' is a link to the file `i386v', then `-b 80386' becomes an alias
  3065. for `-b i386v'.
  3066.  
  3067.    In one respect, the `-b' or `-V' do not completely change to a
  3068. different compiler: the top-level driver program `gcc' that you
  3069. originally invoked continues to run and invoke the other executables
  3070. (preprocessor, compiler per se, assembler and linker) that do the real
  3071. work.  However, since no real work is done in the driver program, it
  3072. usually does not matter that the driver program in use is not the one
  3073. for the specified target and version.
  3074.  
  3075.    The only way that the driver program depends on the target machine is
  3076. in the parsing and handling of special machine-specific options.
  3077. However, this is controlled by a file which is found, along with the
  3078. other executables, in the directory for the specified version and
  3079. target machine.  As a result, a single installed driver program adapts
  3080. to any specified target machine and compiler version.
  3081.  
  3082.    The driver program executable does control one significant thing,
  3083. however: the default version and target machine.  Therefore, you can
  3084. install different instances of the driver program, compiled for
  3085. different targets or versions, under different names.
  3086.  
  3087.    For example, if the driver for version 2.0 is installed as `ogcc'
  3088. and that for version 2.1 is installed as `gcc', then the command `gcc'
  3089. will use version 2.1 by default, while `ogcc' will use 2.0 by default.
  3090. However, you can choose either version with either command with the
  3091. `-V' option.
  3092.  
  3093. 
  3094. File: !gcc.docs.gccuser,  Node: Submodel Options,  Next: Code Gen Options,  Prev: Target Options,  Up: Invoking GCC
  3095.  
  3096. Hardware Models and Configurations
  3097. ==================================
  3098.  
  3099.    Earlier we discussed the standard option `-b' which chooses among
  3100. different installed compilers for completely different target machines,
  3101. such as Vax vs. 68000 vs. 80386.
  3102.  
  3103.    In addition, each of these target machine types can have its own
  3104. special options, starting with `-m', to choose among various hardware
  3105. models or configurations--for example, 68010 vs 68020, floating
  3106. coprocessor or none.  A single installed version of the compiler can
  3107. compile for any model or configuration, according to the options
  3108. specified.
  3109.  
  3110.    Some configurations of the compiler also support additional special
  3111. options, usually for compatibility with other compilers on the same
  3112. platform.
  3113.  
  3114. * Menu:
  3115.  
  3116. * M680x0 Options::
  3117. * VAX Options::
  3118. * SPARC Options::
  3119. * Convex Options::
  3120. * AMD29K Options::
  3121. * ARM Options::
  3122. * M88K Options::
  3123. * RS/6000 and PowerPC Options::
  3124. * RT Options::
  3125. * MIPS Options::
  3126. * i386 Options::
  3127. * HPPA Options::
  3128. * Intel 960 Options::
  3129. * DEC Alpha Options::
  3130. * Clipper Options::
  3131. * H8/300 Options::
  3132. * System V Options::
  3133.  
  3134. 
  3135. File: !gcc.docs.gccuser,  Node: M680x0 Options,  Next: VAX Options,  Up: Submodel Options
  3136.  
  3137. M680x0 Options
  3138. --------------
  3139.  
  3140.    These are the `-m' options defined for the 68000 series.  The default
  3141. values for these options depends on which style of 68000 was selected
  3142. when the compiler was configured; the defaults for the most common
  3143. choices are given below.
  3144.  
  3145. `-m68000'
  3146. `-mc68000'
  3147.      Generate output for a 68000.  This is the default when the
  3148.      compiler is configured for 68000-based systems.
  3149.  
  3150. `-m68020'
  3151. `-mc68020'
  3152.      Generate output for a 68020.  This is the default when the
  3153.      compiler is configured for 68020-based systems.
  3154.  
  3155. `-m68881'
  3156.      Generate output containing 68881 instructions for floating point.
  3157.      This is the default for most 68020 systems unless `-nfp' was
  3158.      specified when the compiler was configured.
  3159.  
  3160. `-m68030'
  3161.      Generate output for a 68030.  This is the default when the
  3162.      compiler is configured for 68030-based systems.
  3163.  
  3164. `-m68040'
  3165.      Generate output for a 68040.  This is the default when the
  3166.      compiler is configured for 68040-based systems.
  3167.  
  3168.      This option inhibits the use of 68881/68882 instructions that have
  3169.      to be emulated by software on the 68040.  If your 68040 does not
  3170.      have code to emulate those instructions, use `-m68040'.
  3171.  
  3172. `-m68020-40'
  3173.      Generate output for a 68040, without using any of the new
  3174.      instructions.  This results in code which can run relatively
  3175.      efficiently on either a 68020/68881 or a 68030 or a 68040.  The
  3176.      generated code does use the 68881 instructions that are emulated
  3177.      on the 68040.
  3178.  
  3179. `-mfpa'
  3180.      Generate output containing Sun FPA instructions for floating point.
  3181.  
  3182. `-msoft-float'
  3183.      Generate output containing library calls for floating point.
  3184.      *Warning:* the requisite libraries are not available for all m68k
  3185.      targets.  Normally the facilities of the machine's usual C
  3186.      compiler are used, but this can't be done directly in
  3187.      cross-compilation.  You must make your own arrangements to provide
  3188.      suitable library functions for cross-compilation.  The embedded
  3189.      targets `m68k-*-aout' and `m68k-*-coff' do provide software
  3190.      floating point support.
  3191.  
  3192. `-mshort'
  3193.      Consider type `int' to be 16 bits wide, like `short int'.
  3194.  
  3195. `-mnobitfield'
  3196.      Do not use the bit-field instructions.  The `-m68000' option
  3197.      implies `-mnobitfield'.
  3198.  
  3199. `-mbitfield'
  3200.      Do use the bit-field instructions.  The `-m68020' option implies
  3201.      `-mbitfield'.  This is the default if you use a configuration
  3202.      designed for a 68020.
  3203.  
  3204. `-mrtd'
  3205.      Use a different function-calling convention, in which functions
  3206.      that take a fixed number of arguments return with the `rtd'
  3207.      instruction, which pops their arguments while returning.  This
  3208.      saves one instruction in the caller since there is no need to pop
  3209.      the arguments there.
  3210.  
  3211.      This calling convention is incompatible with the one normally used
  3212.      on Unix, so you cannot use it if you need to call libraries
  3213.      compiled with the Unix compiler.
  3214.  
  3215.      Also, you must provide function prototypes for all functions that
  3216.      take variable numbers of arguments (including `printf'); otherwise
  3217.      incorrect code will be generated for calls to those functions.
  3218.  
  3219.      In addition, seriously incorrect code will result if you call a
  3220.      function with too many arguments.  (Normally, extra arguments are
  3221.      harmlessly ignored.)
  3222.  
  3223.      The `rtd' instruction is supported by the 68010 and 68020
  3224.      processors, but not by the 68000.
  3225.  
  3226. 
  3227. File: !gcc.docs.gccuser,  Node: VAX Options,  Next: SPARC Options,  Prev: M680x0 Options,  Up: Submodel Options
  3228.  
  3229. VAX Options
  3230. -----------
  3231.  
  3232.    These `-m' options are defined for the Vax:
  3233.  
  3234. `-munix'
  3235.      Do not output certain jump instructions (`aobleq' and so on) that
  3236.      the Unix assembler for the Vax cannot handle across long ranges.
  3237.  
  3238. `-mgnu'
  3239.      Do output those jump instructions, on the assumption that you will
  3240.      assemble with the GNU assembler.
  3241.  
  3242. `-mg'
  3243.      Output code for g-format floating point numbers instead of
  3244.      d-format.
  3245.  
  3246. 
  3247. File: !gcc.docs.gccuser,  Node: SPARC Options,  Next: Convex Options,  Prev: VAX Options,  Up: Submodel Options
  3248.  
  3249. SPARC Options
  3250. -------------
  3251.  
  3252.    These `-m' switches are supported on the SPARC:
  3253.  
  3254. `-mno-app-regs'
  3255. `-mapp-regs'
  3256.      Specify `-mapp-regs' to generate output using the global registers
  3257.      2 through 4, which the SPARC SVR4 ABI reserves for applications.
  3258.      This is the default.
  3259.  
  3260.      To be fully SVR4 ABI compliant at the cost of some performance
  3261.      loss, specify `-mno-app-regs'.  You should compile libraries and
  3262.      system software with this option.
  3263.  
  3264. `-mfpu'
  3265. `-mhard-float'
  3266.      Generate output containing floating point instructions.  This is
  3267.      the default.
  3268.  
  3269. `-mno-fpu'
  3270. `-msoft-float'
  3271.      Generate output containing library calls for floating point.
  3272.      *Warning:* the requisite libraries are not available for all SPARC
  3273.      targets.  Normally the facilities of the machine's usual C
  3274.      compiler are used, but this cannot be done directly in
  3275.      cross-compilation.  You must make your own arrangements to provide
  3276.      suitable library functions for cross-compilation.  The embedded
  3277.      targets `sparc-*-aout' and `sparclite-*-*' do provide software
  3278.      floating point support.
  3279.  
  3280.      `-msoft-float' changes the calling convention in the output file;
  3281.      therefore, it is only useful if you compile *all* of a program with
  3282.      this option.  In particular, you need to compile `libgcc.a', the
  3283.      library that comes with GNU CC, with `-msoft-float' in order for
  3284.      this to work.
  3285.  
  3286. `-mhard-quad-float'
  3287.      Generate output containing quad-word (long double) floating point
  3288.      instructions.
  3289.  
  3290. `-msoft-quad-float'
  3291.      Generate output containing library calls for quad-word (long
  3292.      double) floating point instructions.  The functions called are
  3293.      those specified in the SPARC ABI.  This is the default.
  3294.  
  3295.      As of this writing, there are no sparc implementations that have
  3296.      hardware support for the quad-word floating point instructions.
  3297.      They all invoke a trap handler for one of these instructions, and
  3298.      then the trap handler emulates the effect of the instruction.
  3299.      Because of the trap handler overhead, this is much slower than
  3300.      calling the ABI library routines.  Thus the `-msoft-quad-float'
  3301.      option is the default.
  3302.  
  3303. `-mno-epilogue'
  3304. `-mepilogue'
  3305.      With `-mepilogue' (the default), the compiler always emits code for
  3306.      function exit at the end of each function.  Any function exit in
  3307.      the middle of the function (such as a return statement in C) will
  3308.      generate a jump to the exit code at the end of the function.
  3309.  
  3310.      With `-mno-epilogue', the compiler tries to emit exit code inline
  3311.      at every function exit.
  3312.  
  3313. `-mno-flat'
  3314. `-mflat'
  3315.      With `-mflat', the compiler does not generate save/restore
  3316.      instructions and will use a "flat" or single register window
  3317.      calling convention.  This model uses %i7 as the frame pointer and
  3318.      is compatible with the normal register window model.  Code from
  3319.      either may be intermixed although debugger support is still
  3320.      incomplete.  The local registers and the input registers (0-5) are
  3321.      still treated as "call saved" registers and will be saved on the
  3322.      stack as necessary.
  3323.  
  3324.      With `-mno-flat' (the default), the compiler emits save/restore
  3325.      instructions (except for leaf functions) and is the normal mode of
  3326.      operation.
  3327.  
  3328. `-mno-unaligned-doubles'
  3329. `-munaligned-doubles'
  3330.      Assume that doubles have 8 byte alignment.  This is the default.
  3331.  
  3332.      With `-munaligned-doubles', GNU CC assumes that doubles have 8 byte
  3333.      alignment only if they are contained in another type, or if they
  3334.      have an absolute address.  Otherwise, it assumes they have 4 byte
  3335.      alignment.  Specifying this option avoids some rare compatibility
  3336.      problems with code generated by other compilers.  It is not the
  3337.      default because it results in a performance loss, especially for
  3338.      floating point code.
  3339.  
  3340. `-mv8'
  3341. `-msparclite'
  3342.      These two options select variations on the SPARC architecture.
  3343.  
  3344.      By default (unless specifically configured for the Fujitsu
  3345.      SPARClite), GCC generates code for the v7 variant of the SPARC
  3346.      architecture.
  3347.  
  3348.      `-mv8' will give you SPARC v8 code.  The only difference from v7
  3349.      code is that the compiler emits the integer multiply and integer
  3350.      divide instructions which exist in SPARC v8 but not in SPARC v7.
  3351.  
  3352.      `-msparclite' will give you SPARClite code.  This adds the integer
  3353.      multiply, integer divide step and scan (`ffs') instructions which
  3354.      exist in SPARClite but not in SPARC v7.
  3355.  
  3356. `-mcypress'
  3357. `-msupersparc'
  3358.      These two options select the processor for which the code is
  3359.      optimised.
  3360.  
  3361.      With `-mcypress' (the default), the compiler optimizes code for the
  3362.      Cypress CY7C602 chip, as used in the SparcStation/SparcServer 3xx
  3363.      series.  This is also appropriate for the older SparcStation 1, 2,
  3364.      IPX etc.
  3365.  
  3366.      With `-msupersparc' the compiler optimizes code for the SuperSparc
  3367.      cpu, as used in the SparcStation 10, 1000 and 2000 series. This
  3368.      flag also enables use of the full SPARC v8 instruction set.
  3369.  
  3370.    In a future version of GCC, these options will very likely be
  3371. renamed to `-mcpu=cypress' and `-mcpu=supersparc'.
  3372.  
  3373.    These `-m' switches are supported in addition to the above on SPARC
  3374. V9 processors:
  3375.  
  3376. `-mmedlow'
  3377.      Generate code for the Medium/Low code model: assume a 32 bit
  3378.      address space.  Programs are statically linked, PIC is not
  3379.      supported.  Pointers are still 64 bits.
  3380.  
  3381.      It is very likely that a future version of GCC will rename this
  3382.      option.
  3383.  
  3384. `-mmedany'
  3385.      Generate code for the Medium/Anywhere code model: assume a 32 bit
  3386.      text segment starting at offset 0, and a 32 bit data segment
  3387.      starting anywhere (determined at link time).  Programs are
  3388.      statically linked, PIC is not supported.  Pointers are still 64
  3389.      bits.
  3390.  
  3391.      It is very likely that a future version of GCC will rename this
  3392.      option.
  3393.  
  3394. `-mint64'
  3395.      Types long and int are 64 bits.
  3396.  
  3397. `-mlong32'
  3398.      Types long and int are 32 bits.
  3399.  
  3400. `-mlong64'
  3401. `-mint32'
  3402.      Type long is 64 bits, and type int is 32 bits.
  3403.  
  3404. `-mstack-bias'
  3405. `-mno-stack-bias'
  3406.      With `-mstack-bias', GNU CC assumes that the stack pointer, and
  3407.      frame pointer if present, are offset by -2047 which must be added
  3408.      back when making stack frame references.  Otherwise, assume no
  3409.      such offset is present.
  3410.  
  3411. 
  3412. File: !gcc.docs.gccuser,  Node: Convex Options,  Next: AMD29K Options,  Prev: SPARC Options,  Up: Submodel Options
  3413.  
  3414. Convex Options
  3415. --------------
  3416.  
  3417.    These `-m' options are defined for Convex:
  3418.  
  3419. `-mc1'
  3420.      Generate output for C1.  The code will run on any Convex machine.
  3421.      The preprocessor symbol `__convex__c1__' is defined.
  3422.  
  3423. `-mc2'
  3424.      Generate output for C2.  Uses instructions not available on C1.
  3425.      Scheduling and other optimizations are chosen for max performance
  3426.      on C2.  The preprocessor symbol `__convex_c2__' is defined.
  3427.  
  3428. `-mc32'
  3429.      Generate output for C32xx.  Uses instructions not available on C1.
  3430.      Scheduling and other optimizations are chosen for max performance
  3431.      on C32.  The preprocessor symbol `__convex_c32__' is defined.
  3432.  
  3433. `-mc34'
  3434.      Generate output for C34xx.  Uses instructions not available on C1.
  3435.      Scheduling and other optimizations are chosen for max performance
  3436.      on C34.  The preprocessor symbol `__convex_c34__' is defined.
  3437.  
  3438. `-mc38'
  3439.      Generate output for C38xx.  Uses instructions not available on C1.
  3440.      Scheduling and other optimizations are chosen for max performance
  3441.      on C38.  The preprocessor symbol `__convex_c38__' is defined.
  3442.  
  3443. `-margcount'
  3444.      Generate code which puts an argument count in the word preceding
  3445.      each argument list.  This is compatible with regular CC, and a few
  3446.      programs may need the argument count word.  GDB and other
  3447.      source-level debuggers do not need it; this info is in the symbol
  3448.      table.
  3449.  
  3450. `-mnoargcount'
  3451.      Omit the argument count word.  This is the default.
  3452.  
  3453. `-mvolatile-cache'
  3454.      Allow volatile references to be cached.  This is the default.
  3455.  
  3456. `-mvolatile-nocache'
  3457.      Volatile references bypass the data cache, going all the way to
  3458.      memory.  This is only needed for multi-processor code that does
  3459.      not use standard synchronization instructions.  Making
  3460.      non-volatile references to volatile locations will not necessarily
  3461.      work.
  3462.  
  3463. `-mlong32'
  3464.      Type long is 32 bits, the same as type int.  This is the default.
  3465.  
  3466. `-mlong64'
  3467.      Type long is 64 bits, the same as type long long.  This option is
  3468.      useless, because no library support exists for it.
  3469.  
  3470. 
  3471. File: !gcc.docs.gccuser,  Node: AMD29K Options,  Next: ARM Options,  Prev: Convex Options,  Up: Submodel Options
  3472.  
  3473. AMD29K Options
  3474. --------------
  3475.  
  3476.    These `-m' options are defined for the AMD Am29000:
  3477.  
  3478. `-mdw'
  3479.      Generate code that assumes the `DW' bit is set, i.e., that byte and
  3480.      halfword operations are directly supported by the hardware.  This
  3481.      is the default.
  3482.  
  3483. `-mndw'
  3484.      Generate code that assumes the `DW' bit is not set.
  3485.  
  3486. `-mbw'
  3487.      Generate code that assumes the system supports byte and halfword
  3488.      write operations.  This is the default.
  3489.  
  3490. `-mnbw'
  3491.      Generate code that assumes the systems does not support byte and
  3492.      halfword write operations.  `-mnbw' implies `-mndw'.
  3493.  
  3494. `-msmall'
  3495.      Use a small memory model that assumes that all function addresses
  3496.      are either within a single 256 KB segment or at an absolute
  3497.      address of less than 256k.  This allows the `call' instruction to
  3498.      be used instead of a `const', `consth', `calli' sequence.
  3499.  
  3500. `-mnormal'
  3501.      Use the normal memory model: Generate `call' instructions only when
  3502.      calling functions in the same file and `calli' instructions
  3503.      otherwise.  This works if each file occupies less than 256 KB but
  3504.      allows the entire executable to be larger than 256 KB.  This is
  3505.      the default.
  3506.  
  3507. `-mlarge'
  3508.      Always use `calli' instructions.  Specify this option if you expect
  3509.      a single file to compile into more than 256 KB of code.
  3510.  
  3511. `-m29050'
  3512.      Generate code for the Am29050.
  3513.  
  3514. `-m29000'
  3515.      Generate code for the Am29000.  This is the default.
  3516.  
  3517. `-mkernel-registers'
  3518.      Generate references to registers `gr64-gr95' instead of to
  3519.      registers `gr96-gr127'.  This option can be used when compiling
  3520.      kernel code that wants a set of global registers disjoint from
  3521.      that used by user-mode code.
  3522.  
  3523.      Note that when this option is used, register names in `-f' flags
  3524.      must use the normal, user-mode, names.
  3525.  
  3526. `-muser-registers'
  3527.      Use the normal set of global registers, `gr96-gr127'.  This is the
  3528.      default.
  3529.  
  3530. `-mstack-check'
  3531. `-mno-stack-check'
  3532.      Insert (or do not insert) a call to `__msp_check' after each stack
  3533.      adjustment.  This is often used for kernel code.
  3534.  
  3535. `-mstorem-bug'
  3536. `-mno-storem-bug'
  3537.      `-mstorem-bug' handles 29k processors which cannot handle the
  3538.      separation of a mtsrim insn and a storem instruction (most 29000
  3539.      chips to date, but not the 29050).
  3540.  
  3541. `-mno-reuse-arg-regs'
  3542. `-mreuse-arg-regs'
  3543.      `-mno-reuse-arg-regs' tells the compiler to only use incoming
  3544.      argument registers for copying out arguments.  This helps detect
  3545.      calling a function with fewer arguments than it was declared with.
  3546.  
  3547. `-msoft-float'
  3548.      Generate output containing library calls for floating point.
  3549.      *Warning:* the requisite libraries are not part of GNU CC.
  3550.      Normally the facilities of the machine's usual C compiler are
  3551.      used, but this can't be done directly in cross-compilation.  You
  3552.      must make your own arrangements to provide suitable library
  3553.      functions for cross-compilation.
  3554.  
  3555. 
  3556. File: !gcc.docs.gccuser,  Node: ARM Options,  Next: M88K Options,  Prev: AMD29K Options,  Up: Submodel Options
  3557.  
  3558. ARM Options
  3559. -----------
  3560.  
  3561.    These `-m' options are defined for Advanced RISC Machines (ARM)
  3562. architectures:
  3563.  
  3564. `-m2'
  3565. `-m3'
  3566.      These options are identical.  Generate code for the ARM2 and ARM3
  3567.      processors.  This option is the default.  You should also use this
  3568.      option to generate code for ARM6 processors that are running with a
  3569.      26-bit program counter.
  3570.  
  3571. `-m6'
  3572.      Generate code for the ARM6 processor when running with a 32-bit
  3573.      program counter.
  3574.  
  3575. `-mapcs'
  3576.      Generate a stack frame that is compliant with the ARM Procedure
  3577.      Call Standard for all functions, even if this is not strictly
  3578.      necessary for correct execution of the code.
  3579.  
  3580. `-mbsd'
  3581.      This option only applies to RISC iX.  Emulate the native BSD-mode
  3582.      compiler.  This is the default if `-ansi' is not specified.
  3583.  
  3584. `-mxopen'
  3585.      This option only applies to RISC iX.  Emulate the native
  3586.      X/Open-mode compiler.
  3587.  
  3588. `-mno-symrename'
  3589.      This option only applies to RISC iX.  Do not run the assembler
  3590.      post-processor, `symrename', after code has been assembled.
  3591.      Normally it is necessary to modify some of the standard symbols in
  3592.      preparation for linking with the RISC iX C library; this option
  3593.      suppresses this pass.  The post-processor is never run when the
  3594.      compiler is built for cross-compilation.
  3595.  
  3596. 
  3597. File: !gcc.docs.gccuser,  Node: M88K Options,  Next: RS/6000 and PowerPC Options,  Prev: ARM Options,  Up: Submodel Options
  3598.  
  3599. M88K Options
  3600. ------------
  3601.  
  3602.    These `-m' options are defined for Motorola 88k architectures:
  3603.  
  3604. `-m88000'
  3605.      Generate code that works well on both the m88100 and the m88110.
  3606.  
  3607. `-m88100'
  3608.      Generate code that works best for the m88100, but that also runs
  3609.      on the m88110.
  3610.  
  3611. `-m88110'
  3612.      Generate code that works best for the m88110, and may not run on
  3613.      the m88100.
  3614.  
  3615. `-mbig-pic'
  3616.      Obsolete option to be removed from the next revision.  Use `-fPIC'.
  3617.  
  3618. `-midentify-revision'
  3619.      Include an `ident' directive in the assembler output recording the
  3620.      source file name, compiler name and version, timestamp, and
  3621.      compilation flags used.
  3622.  
  3623. `-mno-underscores'
  3624.      In assembler output, emit symbol names without adding an underscore
  3625.      character at the beginning of each name.  The default is to use an
  3626.      underscore as prefix on each name.
  3627.  
  3628. `-mocs-debug-info'
  3629. `-mno-ocs-debug-info'
  3630.      Include (or omit) additional debugging information (about
  3631.      registers used in each stack frame) as specified in the 88open
  3632.      Object Compatibility Standard, "OCS".  This extra information
  3633.      allows debugging of code that has had the frame pointer
  3634.      eliminated.  The default for DG/UX, SVr4, and Delta 88 SVr3.2 is
  3635.      to include this information; other 88k configurations omit this
  3636.      information by default.
  3637.  
  3638. `-mocs-frame-position'
  3639.      When emitting COFF debugging information for automatic variables
  3640.      and parameters stored on the stack, use the offset from the
  3641.      canonical frame address, which is the stack pointer (register 31)
  3642.      on entry to the function.  The DG/UX, SVr4, Delta88 SVr3.2, and
  3643.      BCS configurations use `-mocs-frame-position'; other 88k
  3644.      configurations have the default `-mno-ocs-frame-position'.
  3645.  
  3646. `-mno-ocs-frame-position'
  3647.      When emitting COFF debugging information for automatic variables
  3648.      and parameters stored on the stack, use the offset from the frame
  3649.      pointer register (register 30).  When this option is in effect,
  3650.      the frame pointer is not eliminated when debugging information is
  3651.      selected by the -g switch.
  3652.  
  3653. `-moptimize-arg-area'
  3654. `-mno-optimize-arg-area'
  3655.      Control how function arguments are stored in stack frames.
  3656.      `-moptimize-arg-area' saves space by optimizing them, but this
  3657.      conflicts with the 88open specifications.  The opposite
  3658.      alternative, `-mno-optimize-arg-area', agrees with 88open
  3659.      standards.  By default GNU CC does not optimize the argument area.
  3660.  
  3661. `-mshort-data-NUM'
  3662.      Generate smaller data references by making them relative to `r0',
  3663.      which allows loading a value using a single instruction (rather
  3664.      than the usual two).  You control which data references are
  3665.      affected by specifying NUM with this option.  For example, if you
  3666.      specify `-mshort-data-512', then the data references affected are
  3667.      those involving displacements of less than 512 bytes.
  3668.      `-mshort-data-NUM' is not effective for NUM greater than 64k.
  3669.  
  3670. `-mserialize-volatile'
  3671. `-mno-serialize-volatile'
  3672.      Do, or don't, generate code to guarantee sequential consistency of
  3673.      volatile memory references.  By default, consistency is guaranteed.
  3674.  
  3675.      The order of memory references made by the MC88110 processor does
  3676.      not always match the order of the instructions requesting those
  3677.      references.  In particular, a load instruction may execute before
  3678.      a preceding store instruction.  Such reordering violates
  3679.      sequential consistency of volatile memory references, when there
  3680.      are multiple processors.   When consistency must be guaranteed,
  3681.      GNU C generates special instructions, as needed, to force
  3682.      execution in the proper order.
  3683.  
  3684.      The MC88100 processor does not reorder memory references and so
  3685.      always provides sequential consistency.  However, by default, GNU
  3686.      C generates the special instructions to guarantee consistency even
  3687.      when you use `-m88100', so that the code may be run on an MC88110
  3688.      processor.  If you intend to run your code only on the MC88100
  3689.      processor, you may use `-mno-serialize-volatile'.
  3690.  
  3691.      The extra code generated to guarantee consistency may affect the
  3692.      performance of your application.  If you know that you can safely
  3693.      forgo this guarantee, you may use `-mno-serialize-volatile'.
  3694.  
  3695. `-msvr4'
  3696. `-msvr3'
  3697.      Turn on (`-msvr4') or off (`-msvr3') compiler extensions related
  3698.      to System V release 4 (SVr4).  This controls the following:
  3699.  
  3700.        1. Which variant of the assembler syntax to emit.
  3701.  
  3702.        2. `-msvr4' makes the C preprocessor recognize `#pragma weak'
  3703.           that is used on System V release 4.
  3704.  
  3705.        3. `-msvr4' makes GNU CC issue additional declaration directives
  3706.           used in SVr4.
  3707.  
  3708.      `-msvr4' is the default for the m88k-motorola-sysv4 and
  3709.      m88k-dg-dgux m88k configurations. `-msvr3' is the default for all
  3710.      other m88k configurations.
  3711.  
  3712. `-mversion-03.00'
  3713.      This option is obsolete, and is ignored.
  3714.  
  3715. `-mno-check-zero-division'
  3716. `-mcheck-zero-division'
  3717.      Do, or don't, generate code to guarantee that integer division by
  3718.      zero will be detected.  By default, detection is guaranteed.
  3719.  
  3720.      Some models of the MC88100 processor fail to trap upon integer
  3721.      division by zero under certain conditions.  By default, when
  3722.      compiling code that might be run on such a processor, GNU C
  3723.      generates code that explicitly checks for zero-valued divisors and
  3724.      traps with exception number 503 when one is detected.  Use of
  3725.      mno-check-zero-division suppresses such checking for code
  3726.      generated to run on an MC88100 processor.
  3727.  
  3728.      GNU C assumes that the MC88110 processor correctly detects all
  3729.      instances of integer division by zero.  When `-m88110' is
  3730.      specified, both `-mcheck-zero-division' and
  3731.      `-mno-check-zero-division' are ignored, and no explicit checks for
  3732.      zero-valued divisors are generated.
  3733.  
  3734. `-muse-div-instruction'
  3735.      Use the div instruction for signed integer division on the MC88100
  3736.      processor.  By default, the div instruction is not used.
  3737.  
  3738.      On the MC88100 processor the signed integer division instruction
  3739.      div) traps to the operating system on a negative operand.  The
  3740.      operating system transparently completes the operation, but at a
  3741.      large cost in execution time.  By default, when compiling code
  3742.      that might be run on an MC88100 processor, GNU C emulates signed
  3743.      integer division using the unsigned integer division instruction
  3744.      divu), thereby avoiding the large penalty of a trap to the
  3745.      operating system.  Such emulation has its own, smaller, execution
  3746.      cost in both time and space.  To the extent that your code's
  3747.      important signed integer division operations are performed on two
  3748.      nonnegative operands, it may be desirable to use the div
  3749.      instruction directly.
  3750.  
  3751.      On the MC88110 processor the div instruction (also known as the
  3752.      divs instruction) processes negative operands without trapping to
  3753.      the operating system.  When `-m88110' is specified,
  3754.      `-muse-div-instruction' is ignored, and the div instruction is used
  3755.      for signed integer division.
  3756.  
  3757.      Note that the result of dividing INT_MIN by -1 is undefined.  In
  3758.      particular, the behavior of such a division with and without
  3759.      `-muse-div-instruction'  may differ.
  3760.  
  3761. `-mtrap-large-shift'
  3762. `-mhandle-large-shift'
  3763.      Include code to detect bit-shifts of more than 31 bits;
  3764.      respectively, trap such shifts or emit code to handle them
  3765.      properly.  By default GNU CC makes no special provision for large
  3766.      bit shifts.
  3767.  
  3768. `-mwarn-passed-structs'
  3769.      Warn when a function passes a struct as an argument or result.
  3770.      Structure-passing conventions have changed during the evolution of
  3771.      the C language, and are often the source of portability problems.
  3772.      By default, GNU CC issues no such warning.
  3773.  
  3774. 
  3775. File: !gcc.docs.gccuser,  Node: RS/6000 and PowerPC Options,  Next: RT Options,  Prev: M88K Options,  Up: Submodel Options
  3776.  
  3777. IBM RS/6000 and PowerPC Options
  3778. -------------------------------
  3779.  
  3780.    These `-m' options are defined for the IBM RS/6000 and PowerPC:
  3781. `-mpower'
  3782. `-mno-power'
  3783. `-mpower2'
  3784. `-mno-power2'
  3785. `-mpowerpc'
  3786. `-mno-powerpc'
  3787. `-mpowerpc-gpopt'
  3788. `-mno-powerpc-gpopt'
  3789. `-mpowerpc-gfxopt'
  3790. `-mno-powerpc-gfxopt'
  3791.      GNU CC supports two related instruction set architectures for the
  3792.      RS/6000 and PowerPC.  The "POWER" instruction set are those
  3793.      instructions supported by the `rios' chip set used in the original
  3794.      RS/6000 systems and the "PowerPC" instruction set is the
  3795.      architecture of the Motorola MPC6xx microprocessors.  The PowerPC
  3796.      architecture defines 64-bit instructions, but they are not
  3797.      supported by any current processors.
  3798.  
  3799.      Neither architecture is a subset of the other.  However there is a
  3800.      large common subset of instructions supported by both.  An MQ
  3801.      register is included in processors supporting the POWER
  3802.      architecture.
  3803.  
  3804.      You use these options to specify which instructions are available
  3805.      on the processor you are using.  The default value of these
  3806.      options is determined when configuring GNU CC.  Specifying the
  3807.      `-mcpu=CPU_TYPE' overrides the specification of these options.  We
  3808.      recommend you use that option rather than these.
  3809.  
  3810.      The `-mpower' option allows GNU CC to generate instructions that
  3811.      are found only in the POWER architecture and to use the MQ
  3812.      register.  Specifying `-mpower2' implies `-power' and also allows
  3813.      GNU CC to generate instructions that are present in the POWER2
  3814.      architecture but not the original POWER architecture.
  3815.  
  3816.      The `-mpowerpc' option allows GNU CC to generate instructions that
  3817.      are found only in the 32-bit subset of the PowerPC architecture.
  3818.      Specifying `-mpowerpc-gpopt' implies `-mpowerpc' and also allows
  3819.      GNU CC to use the optional PowerPC architecture instructions in the
  3820.      General Purpose group, including floating-point square root.
  3821.      Specifying `-mpowerpc-gfxopt' implies `-mpowerpc' and also allows
  3822.      GNU CC to use the optional PowerPC architecture instructions in
  3823.      the Graphics group, including floating-point select.
  3824.  
  3825.      If you specify both `-mno-power' and `-mno-powerpc', GNU CC will
  3826.      use only the instructions in the common subset of both
  3827.      architectures plus some special AIX common-mode calls, and will
  3828.      not use the MQ register.  Specifying both `-mpower' and `-mpowerpc'
  3829.      permits GNU CC to use any instruction from either architecture and
  3830.      to allow use of the MQ register; specify this for the Motorola
  3831.      MPC601.
  3832.  
  3833. `-mnew-mnemonics'
  3834. `-mold-mnemonics'
  3835.      Select which mnemonics to use in the generated assembler code.
  3836.      `-mnew-mnemonics' requests output that uses the assembler mnemonics
  3837.      defined for the PowerPC architecture, while `-mold-mnemonics'
  3838.      requests the assembler mnemonics defined for the POWER
  3839.      architecture.  Instructions defined in only one architecture have
  3840.      only one mnemonic; GNU CC uses that mnemonic irrespective of which
  3841.      of these options is specified.
  3842.  
  3843.      PowerPC assemblers support both the old and new mnemonics, as will
  3844.      later POWER assemblers.  Current POWER assemblers only support the
  3845.      old mnemonics.  Specify `-mnew-mnemonics' if you have an assembler
  3846.      that supports them, otherwise specify `-mold-mnemonics'.
  3847.  
  3848.      The default value of these options depends on how GNU CC was
  3849.      configured.  Specifying `-mcpu=CPU_TYPE' sometimes overrides the
  3850.      value of these option.  Unless you are building a cross-compiler,
  3851.      you should normally not specify either `-mnew-mnemonics' or
  3852.      `-mold-mnemonics', but should instead accept the default.
  3853.  
  3854. `-mcpu=CPU_TYPE'
  3855.      Set architecture type, register usage, choice of mnemonics, and
  3856.      instruction scheduling parameters for machine type CPU_TYPE.  By
  3857.      default, CPU_TYPE is the target system defined when GNU CC was
  3858.      configured.  Supported values for CPU_TYPE are `rios1', `rios2',
  3859.      `rsc', `601', `603', `604', `power', `powerpc', `403', and
  3860.      `common'.  `-mcpu=power' and `-mcpu=powerpc' specify generic POWER
  3861.      and pure PowerPC (i.e., not MPC601) architecture machine types,
  3862.      with an appropriate, generic processor model assumed for
  3863.      scheduling purposes.
  3864.  
  3865.      Specifying `-mcpu=rios1', `-mcpu=rios2', `-mcpu=rsc', or
  3866.      `-mcpu=power' enables the `-mpower' option and disables the
  3867.      `-mpowerpc' option; `-mcpu=601' enables both the `-mpower' and
  3868.      `-mpowerpc' options; `-mcpu=603', `-mcpu=604', `-mcpu=403', and
  3869.      `-mcpu=powerpc' enable the `-mpowerpc' option and disable the
  3870.      `-mpower' option; `-mcpu=common' disables both the `-mpower' and
  3871.      `-mpowerpc' options.
  3872.  
  3873.      To generate code that will operate on all members of the RS/6000
  3874.      and PowerPC families, specify `-mcpu=common'.  In that case, GNU CC
  3875.      will use only the instructions in the common subset of both
  3876.      architectures plus some special AIX common-mode calls, and will
  3877.      not use the MQ register.  GNU CC assumes a generic processor model
  3878.      for scheduling purposes.
  3879.  
  3880.      Specifying `-mcpu=rios1', `-mcpu=rios2', `-mcpu=rsc', or
  3881.      `-mcpu=power' also disables the `new-mnemonics' option.
  3882.      Specifying `-mcpu=601', `-mcpu=603', `-mcpu=604', `403', or
  3883.      `-mcpu=powerpc' also enables the `new-mnemonics' option.
  3884.  
  3885. `-mfull-toc'
  3886. `-mno-fp-in-toc'
  3887. `-mno-sum-in-toc'
  3888. `-mminimal-toc'
  3889.      Modify generation of the TOC (Table Of Contents), which is created
  3890.      for every executable file.  The `-mfull-toc' option is selected by
  3891.      default.  In that case, GNU CC will allocate at least one TOC
  3892.      entry for each unique non-automatic variable reference in your
  3893.      program.  GNU CC will also place floating-point constants in the
  3894.      TOC.  However, only 16,384 entries are available in the TOC.
  3895.  
  3896.      If you receive a linker error message that saying you have
  3897.      overflowed the available TOC space, you can reduce the amount of
  3898.      TOC space used with the `-mno-fp-in-toc' and `-mno-sum-in-toc'
  3899.      options.  `-mno-fp-in-toc' prevents GNU CC from putting
  3900.      floating-point constants in the TOC and `-mno-sum-in-toc' forces
  3901.      GNU CC to generate code to calculate the sum of an address and a
  3902.      constant at run-time instead of putting that sum into the TOC.
  3903.      You may specify one or both of these options.  Each causes GNU CC
  3904.      to produce very slightly slower and larger code at the expense of
  3905.      conserving TOC space.
  3906.  
  3907.      If you still run out of space in the TOC even when you specify
  3908.      both of these options, specify `-mminimal-toc' instead.  This
  3909.      option causes GNU CC to make only one TOC entry for every file.
  3910.      When you specify this option, GNU CC will produce code that is
  3911.      slower and larger but which uses extremely little TOC space.  You
  3912.      may wish to use this option only on files that contain less
  3913.      frequently executed code.
  3914.  
  3915. `-msoft-float'
  3916. `-mhard-float'
  3917.      Generate code that does not use (uses) the floating-point register
  3918.      set.  Software floating point emulation is provided if you use the
  3919.      `-msoft-float' option, and pass the option to GNU CC when linking.
  3920.  
  3921. `-mmultiple'
  3922. `-mno-multiple'
  3923.      Generate code that uses (does not use) the load multiple word
  3924.      instructions and the store multiple word instructions.  These
  3925.      instructions are generated by default on POWER systems, and not
  3926.      generated on PowerPC systems.  Do not use `-mmultiple' on little
  3927.      endian PowerPC systems, since those instructions do not work when
  3928.      the processor is in little endian mode.
  3929.  
  3930. `-mstring'
  3931. `-mno-string'
  3932.      Generate code that uses (does not use) the load string
  3933.      instructions and the store string word instructions to save
  3934.      multiple registers and do small block moves.  These instructions
  3935.      are generated by default on POWER systems, anod not generated on
  3936.      PowerPC systems.  Do not use `-mstring' on little endian PowerPC
  3937.      systems, since those instructions do not work when the processor
  3938.      is in little endian mode.
  3939.  
  3940. `-mno-bit-align'
  3941. `-mbit-align'
  3942.      On System V.4 and embedded PowerPC systems do not (do) force
  3943.      structures and unions that contain bit fields to be aligned to the
  3944.      base type of the bit field.
  3945.  
  3946.      For example, by default a structure containing nothing but 8
  3947.      `unsigned' bitfields of length 1 would be aligned to a 4 byte
  3948.      boundary and have a size of 4 bytes.  By using `-mno-bit-align',
  3949.      the structure would be aligned to a 1 byte boundary and be one
  3950.      byte in size.
  3951.  
  3952. `-mno-strict-align'
  3953. `-mstrict-align'
  3954.      On System V.4 and embedded PowerPC systems do not (do) assume that
  3955.      unaligned memory references will be handled by the system.
  3956.  
  3957. `-mrelocatable'
  3958. `-mno-relocatable'
  3959.      On embedded PowerPC systems generate code that allows (does not
  3960.      allow) the program to be relocated to a different address at
  3961.      runtime.
  3962.  
  3963. `-mno-toc'
  3964. `-mtoc'
  3965.      On System V.4 and embedded PowerPC systems do not (do) assume that
  3966.      register 2 contains a pointer to a global area pointing to the
  3967.      addresses used in the program.
  3968.  
  3969. `-mno-traceback'
  3970. `-mtraceback'
  3971.      On embedded PowerPC systems do not (do) generate a traceback tag
  3972.      before the start of the function.  This tag can be used by the
  3973.      debugger to identify where the start of a function is.
  3974.  
  3975. `-mlittle'
  3976. `-mlittle-endian'
  3977.      On System V.4 and embedded PowerPC systems compile code for the
  3978.      processor in little endian mode.  The `-mlittle-endian' option is
  3979.      the same as `-mlittle'.
  3980.  
  3981. `-mbig'
  3982. `-mbig-endian'
  3983.      On System V.4 and embedded PowerPC systems compile code for the
  3984.      processor in big endian mode.  The `-mbig-endian' option is the
  3985.      same as `-mbig'.
  3986.  
  3987. `-mcall-sysv'
  3988.      On System V.4 and embedded PowerPC systems compile code using
  3989.      calling conventions that adheres to the March 1995 draft of the
  3990.      System V Application Binary Interface, PowerPC processor
  3991.      supplement.  This is the default unless you configured GCC using
  3992.      `powerpc-*-eabiaix'.
  3993.  
  3994. `-mcall-aix'
  3995.      On System V.4 and embedded PowerPC systems compile code using
  3996.      calling conventions that are similar to those used on AIX.  This
  3997.      is the default if you configured GCC using `powerpc-*-eabiaix'.
  3998.  
  3999. `-mprototype'
  4000. `-mno-prototype'
  4001.      On System V.4 and embedded PowerPC systems assume that all calls to
  4002.      variable argument functions are properly prototyped.  Otherwise,
  4003.      the compiler must insert an instruction before every non
  4004.      prototyped call to set or clear bit 6 of the condition code
  4005.      register (CR) to indicate whether floating point values were
  4006.      passed in the floating point registers in case the function takes
  4007.      a variable arguments.  With `-mprototype', only calls to
  4008.      prototyped variable argument functions will set or clear the bit.
  4009.  
  4010. 
  4011. File: !gcc.docs.gccuser,  Node: RT Options,  Next: MIPS Options,  Prev: RS/6000 and PowerPC Options,  Up: Submodel Options
  4012.  
  4013. IBM RT Options
  4014. --------------
  4015.  
  4016.    These `-m' options are defined for the IBM RT PC:
  4017.  
  4018. `-min-line-mul'
  4019.      Use an in-line code sequence for integer multiplies.  This is the
  4020.      default.
  4021.  
  4022. `-mcall-lib-mul'
  4023.      Call `lmul$$' for integer multiples.
  4024.  
  4025. `-mfull-fp-blocks'
  4026.      Generate full-size floating point data blocks, including the
  4027.      minimum amount of scratch space recommended by IBM.  This is the
  4028.      default.
  4029.  
  4030. `-mminimum-fp-blocks'
  4031.      Do not include extra scratch space in floating point data blocks.
  4032.      This results in smaller code, but slower execution, since scratch
  4033.      space must be allocated dynamically.
  4034.  
  4035. `-mfp-arg-in-fpregs'
  4036.      Use a calling sequence incompatible with the IBM calling
  4037.      convention in which floating point arguments are passed in
  4038.      floating point registers.  Note that `varargs.h' and `stdargs.h'
  4039.      will not work with floating point operands if this option is
  4040.      specified.
  4041.  
  4042. `-mfp-arg-in-gregs'
  4043.      Use the normal calling convention for floating point arguments.
  4044.      This is the default.
  4045.  
  4046. `-mhc-struct-return'
  4047.      Return structures of more than one word in memory, rather than in a
  4048.      register.  This provides compatibility with the MetaWare HighC (hc)
  4049.      compiler.  Use the option `-fpcc-struct-return' for compatibility
  4050.      with the Portable C Compiler (pcc).
  4051.  
  4052. `-mnohc-struct-return'
  4053.      Return some structures of more than one word in registers, when
  4054.      convenient.  This is the default.  For compatibility with the
  4055.      IBM-supplied compilers, use the option `-fpcc-struct-return' or the
  4056.      option `-mhc-struct-return'.
  4057.  
  4058. 
  4059. File: !gcc.docs.gccuser,  Node: MIPS Options,  Next: i386 Options,  Prev: RT Options,  Up: Submodel Options
  4060.  
  4061. MIPS Options
  4062. ------------
  4063.  
  4064.    These `-m' options are defined for the MIPS family of computers:
  4065.  
  4066. `-mcpu=CPU TYPE'
  4067.      Assume the defaults for the machine type CPU TYPE when scheduling
  4068.      instructions.  The choices for CPU TYPE are `r2000', `r3000',
  4069.      `r4000', `r4400', `r4600', and `r6000'.  While picking a specific
  4070.      CPU TYPE will schedule things appropriately for that particular
  4071.      chip, the compiler will not generate any code that does not meet
  4072.      level 1 of the MIPS ISA (instruction set architecture) without the
  4073.      `-mips2' or `-mips3' switches being used.
  4074.  
  4075. `-mips1'
  4076.      Issue instructions from level 1 of the MIPS ISA.  This is the
  4077.      default.  `r3000' is the default CPU TYPE at this ISA level.
  4078.  
  4079. `-mips2'
  4080.      Issue instructions from level 2 of the MIPS ISA (branch likely,
  4081.      square root instructions).  `r6000' is the default CPU TYPE at this
  4082.      ISA level.
  4083.  
  4084. `-mips3'
  4085.      Issue instructions from level 3 of the MIPS ISA (64 bit
  4086.      instructions).  `r4000' is the default CPU TYPE at this ISA level.
  4087.      This option does not change the sizes of any of the C data types.
  4088.  
  4089. `-mfp32'
  4090.      Assume that 32 32-bit floating point registers are available.
  4091.      This is the default.
  4092.  
  4093. `-mfp64'
  4094.      Assume that 32 64-bit floating point registers are available.
  4095.      This is the default when the `-mips3' option is used.
  4096.  
  4097. `-mgp32'
  4098.      Assume that 32 32-bit general purpose registers are available.
  4099.      This is the default.
  4100.  
  4101. `-mgp64'
  4102.      Assume that 32 64-bit general purpose registers are available.
  4103.      This is the default when the `-mips3' option is used.
  4104.  
  4105. `-mint64'
  4106.      Types long, int, and pointer are 64 bits.  This works only if
  4107.      `-mips3' is also specified.
  4108.  
  4109. `-mlong64'
  4110.      Types long and pointer are 64 bits, and type int is 32 bits.  This
  4111.      works only if `-mips3' is also specified.
  4112.  
  4113. `-mmips-as'
  4114.      Generate code for the MIPS assembler, and invoke `mips-tfile' to
  4115.      add normal debug information.  This is the default for all
  4116.      platforms except for the OSF/1 reference platform, using the
  4117.      OSF/rose object format.  If the either of the `-gstabs' or
  4118.      `-gstabs+' switches are used, the `mips-tfile' program will
  4119.      encapsulate the stabs within MIPS ECOFF.
  4120.  
  4121. `-mgas'
  4122.      Generate code for the GNU assembler.  This is the default on the
  4123.      OSF/1 reference platform, using the OSF/rose object format.
  4124.  
  4125. `-mrnames'
  4126. `-mno-rnames'
  4127.      The `-mrnames' switch says to output code using the MIPS software
  4128.      names for the registers, instead of the hardware names (ie, A0
  4129.      instead of $4).  The only known assembler that supports this option
  4130.      is the Algorithmics assembler.
  4131.  
  4132. `-mgpopt'
  4133. `-mno-gpopt'
  4134.      The `-mgpopt' switch says to write all of the data declarations
  4135.      before the instructions in the text section, this allows the MIPS
  4136.      assembler to generate one word memory references instead of using
  4137.      two words for short global or static data items.  This is on by
  4138.      default if optimization is selected.
  4139.  
  4140. `-mstats'
  4141. `-mno-stats'
  4142.      For each non-inline function processed, the `-mstats' switch
  4143.      causes the compiler to emit one line to the standard error file to
  4144.      print statistics about the program (number of registers saved,
  4145.      stack size, etc.).
  4146.  
  4147. `-mmemcpy'
  4148. `-mno-memcpy'
  4149.      The `-mmemcpy' switch makes all block moves call the appropriate
  4150.      string function (`memcpy' or `bcopy') instead of possibly
  4151.      generating inline code.
  4152.  
  4153. `-mmips-tfile'
  4154. `-mno-mips-tfile'
  4155.      The `-mno-mips-tfile' switch causes the compiler not postprocess
  4156.      the object file with the `mips-tfile' program, after the MIPS
  4157.      assembler has generated it to add debug support.  If `mips-tfile'
  4158.      is not run, then no local variables will be available to the
  4159.      debugger.  In addition, `stage2' and `stage3' objects will have
  4160.      the temporary file names passed to the assembler embedded in the
  4161.      object file, which means the objects will not compare the same.
  4162.      The `-mno-mips-tfile' switch should only be used when there are
  4163.      bugs in the `mips-tfile' program that prevents compilation.
  4164.  
  4165. `-msoft-float'
  4166.      Generate output containing library calls for floating point.
  4167.      *Warning:* the requisite libraries are not part of GNU CC.
  4168.      Normally the facilities of the machine's usual C compiler are
  4169.      used, but this can't be done directly in cross-compilation.  You
  4170.      must make your own arrangements to provide suitable library
  4171.      functions for cross-compilation.
  4172.  
  4173. `-mhard-float'
  4174.      Generate output containing floating point instructions.  This is
  4175.      the default if you use the unmodified sources.
  4176.  
  4177. `-mabicalls'
  4178. `-mno-abicalls'
  4179.      Emit (or do not emit) the pseudo operations `.abicalls',
  4180.      `.cpload', and `.cprestore' that some System V.4 ports use for
  4181.      position independent code.
  4182.  
  4183. `-mlong-calls'
  4184. `-mno-long-calls'
  4185.      Do all calls with the `JALR' instruction, which requires loading
  4186.      up a function's address into a register before the call.  You need
  4187.      to use this switch, if you call outside of the current 512
  4188.      megabyte segment to functions that are not through pointers.
  4189.  
  4190. `-mhalf-pic'
  4191. `-mno-half-pic'
  4192.      Put pointers to extern references into the data section and load
  4193.      them up, rather than put the references in the text section.
  4194.  
  4195. `-membedded-pic'
  4196. `-mno-embedded-pic'
  4197.      Generate PIC code suitable for some embedded systems.  All calls
  4198.      are made using PC relative address, and all data is addressed
  4199.      using the $gp register.  This requires GNU as and GNU ld which do
  4200.      most of the work.
  4201.  
  4202. `-membedded-data'
  4203. `-mno-embedded-data'
  4204.      Allocate variables to the read-only data section first if
  4205.      possible, then next in the small data section if possible,
  4206.      otherwise in data.  This gives slightly slower code than the
  4207.      default, but reduces the amount of RAM required when executing,
  4208.      and thus may be preferred for some embedded systems.
  4209.  
  4210. `-msingle-float'
  4211. `-mdouble-float'
  4212.      The `-msingle-float' switch tells gcc to assume that the floating
  4213.      point coprocessor only supports single precision operations, as on
  4214.      the `r4650' chip.  The `-mdouble-float' switch permits gcc to use
  4215.      double precision operations.  This is the default.
  4216.  
  4217. `-mmad'
  4218. `-mno-mad'
  4219.      Permit use of the `mad', `madu' and `mul' instructions, as on the
  4220.      `r4650' chip.
  4221.  
  4222. `-m4650'
  4223.      Turns on `-msingle-float', `-mmad', and, at least for now,
  4224.      `-mcpu=r4650'.
  4225.  
  4226. `-EL'
  4227.      Compile code for the processor in little endian mode.  The
  4228.      requisite libraries are assumed to exist.
  4229.  
  4230. `-EB'
  4231.      Compile code for the processor in big endian mode.  The requisite
  4232.      libraries are assumed to exist.
  4233.  
  4234. `-G NUM'
  4235.      Put global and static items less than or equal to NUM bytes into
  4236.      the small data or bss sections instead of the normal data or bss
  4237.      section.  This allows the assembler to emit one word memory
  4238.      reference instructions based on the global pointer (GP or $28),
  4239.      instead of the normal two words used.  By default, NUM is 8 when
  4240.      the MIPS assembler is used, and 0 when the GNU assembler is used.
  4241.      The `-G NUM' switch is also passed to the assembler and linker.
  4242.      All modules should be compiled with the same `-G NUM' value.
  4243.  
  4244. `-nocpp'
  4245.      Tell the MIPS assembler to not run it's preprocessor over user
  4246.      assembler files (with a `.s' suffix) when assembling them.
  4247.  
  4248. 
  4249. File: !gcc.docs.gccuser,  Node: i386 Options,  Next: HPPA Options,  Prev: MIPS Options,  Up: Submodel Options
  4250.  
  4251. Intel 386 Options
  4252. -----------------
  4253.  
  4254.    These `-m' options are defined for the i386 family of computers:
  4255.  
  4256. `-m486'
  4257. `-m386'
  4258.      Control whether or not code is optimized for a 486 instead of an
  4259.      386.  Code generated for an 486 will run on a 386 and vice versa.
  4260.  
  4261. `-mieee-fp'
  4262. `-mno-ieee-fp'
  4263.      Control whether or not the compiler uses IEEE floating point
  4264.      comparisons.  These handle correctly the case where the result of a
  4265.      comparison is unordered.
  4266.  
  4267. `-msoft-float'
  4268.      Generate output containing library calls for floating point.
  4269.      *Warning:* the requisite libraries are not part of GNU CC.
  4270.      Normally the facilities of the machine's usual C compiler are
  4271.      used, but this can't be done directly in cross-compilation.  You
  4272.      must make your own arrangements to provide suitable library
  4273.      functions for cross-compilation.
  4274.  
  4275.      On machines where a function returns floating point results in the
  4276.      80387 register stack, some floating point opcodes may be emitted
  4277.      even if `-msoft-float' is used.
  4278.  
  4279. `-mno-fp-ret-in-387'
  4280.      Do not use the FPU registers for return values of functions.
  4281.  
  4282.      The usual calling convention has functions return values of types
  4283.      `float' and `double' in an FPU register, even if there is no FPU.
  4284.      The idea is that the operating system should emulate an FPU.
  4285.  
  4286.      The option `-mno-fp-ret-in-387' causes such values to be returned
  4287.      in ordinary CPU registers instead.
  4288.  
  4289. `-mno-fancy-math-387'
  4290.      Some 387 emulators do not support the `sin', `cos' and `sqrt'
  4291.      instructions for the 387.  Specify this option to avoid generating
  4292.      those instructions. This option is the default on FreeBSD.  As of
  4293.      revision 2.6.1, these instructions are not generated unless you
  4294.      also use the `-ffast-math' switch.
  4295.  
  4296. `-malign-double'
  4297. `-mno-align-double'
  4298.      Control whether GNU CC aligns `double', `long double', and `long
  4299.      long' variables on a two word boundary or a one word boundary.
  4300.      Aligning `double' variables on a two word boundary will produce
  4301.      code that runs somewhat faster on a `Pentium' at the expense of
  4302.      more memory.
  4303.  
  4304.      *Warning:* if you use the `-malign-double' switch, structures
  4305.      containing the above types will be aligned differently than the
  4306.      published application binary interface specifications for the 386.
  4307.  
  4308. `-msvr3-shlib'
  4309. `-mno-svr3-shlib'
  4310.      Control whether GNU CC places uninitialized locals into `bss' or
  4311.      `data'.  `-msvr3-shlib' places these locals into `bss'.  These
  4312.      options are meaningful only on System V Release 3.
  4313.  
  4314. `-mno-wide-multiply'
  4315. `-mwide-multiply'
  4316.      Control whether GNU CC uses the `mul' and `imul' that produce 64
  4317.      bit results in `eax:edx' from 32 bit operands to do `long long'
  4318.      multiplies and 32-bit division by constants.
  4319.  
  4320. `-mrtd'
  4321.      Use a different function-calling convention, in which functions
  4322.      that take a fixed number of arguments return with the `ret' NUM
  4323.      instruction, which pops their arguments while returning.  This
  4324.      saves one instruction in the caller since there is no need to pop
  4325.      the arguments there.
  4326.  
  4327.      You can specify that an individual function is called with this
  4328.      calling sequence with the function attribute `stdcall'.  You can
  4329.      also override the `-mrtd' option by using the function attribute
  4330.      `cdecl'. *Note Function Attributes::
  4331.  
  4332.      *Warning:* this calling convention is incompatible with the one
  4333.      normally used on Unix, so you cannot use it if you need to call
  4334.      libraries compiled with the Unix compiler.
  4335.  
  4336.      Also, you must provide function prototypes for all functions that
  4337.      take variable numbers of arguments (including `printf'); otherwise
  4338.      incorrect code will be generated for calls to those functions.
  4339.  
  4340.      In addition, seriously incorrect code will result if you call a
  4341.      function with too many arguments.  (Normally, extra arguments are
  4342.      harmlessly ignored.)
  4343.  
  4344. `-mreg-alloc=REGS'
  4345.      Control the default allocation order of integer registers.  The
  4346.      string REGS is a series of letters specifying a register.  The
  4347.      supported letters are: `a' allocate EAX; `b' allocate EBX; `c'
  4348.      allocate ECX; `d' allocate EDX; `S' allocate ESI; `D' allocate
  4349.      EDI; `B' allocate EBP.
  4350.  
  4351. `-mregparm=NUM'
  4352.      Control how many registers are used to pass integer arguments.  By
  4353.      default, no registers are used to pass arguments, and at most 3
  4354.      registers can be used.  You can control this behavior for a
  4355.      specific function by using the function attribute `regparm'.
  4356.      *Note Function Attributes::
  4357.  
  4358.      *Warning:* if you use this switch, and NUM is nonzero, then you
  4359.      must build all modules with the same value, including any
  4360.      libraries.  This includes the system libraries and startup modules.
  4361.  
  4362. `-malign-loops=NUM'
  4363.      Align loops to a 2 raised to a NUM byte boundary.  If
  4364.      `-malign-loops' is not specified, the default is 2.
  4365.  
  4366. `-malign-jumps=NUM'
  4367.      Align instructions that are only jumped to to a 2 raised to a NUM
  4368.      byte boundary.  If `-malign-jumps' is not specified, the default is
  4369.      2 if optimizing for a 386, and 4 if optimizing for a 486.
  4370.  
  4371. `-malign-functions=NUM'
  4372.      Align the start of functions to a 2 raised to NUM byte boundary.
  4373.      If `-malign-jumps' is not specified, the default is 2 if optimizing
  4374.      for a 386, and 4 if optimizing for a 486.
  4375.  
  4376. 
  4377. File: !gcc.docs.gccuser,  Node: HPPA Options,  Next: Intel 960 Options,  Prev: i386 Options,  Up: Submodel Options
  4378.  
  4379. HPPA Options
  4380. ------------
  4381.  
  4382.    These `-m' options are defined for the HPPA family of computers:
  4383.  
  4384. `-mpa-risc-1-0'
  4385.      Generate code for a PA 1.0 processor.
  4386.  
  4387. `-mpa-risc-1-1'
  4388.      Generate code for a PA 1.1 processor.
  4389.  
  4390. `-mjump-in-delay'
  4391.      Fill delay slots of function calls with unconditional jump
  4392.      instructions by modifying the return pointer for the function call
  4393.      to be the target of the conditional jump.
  4394.  
  4395. `-mmillicode-long-calls'
  4396.      Generate code which assumes millicode routines can not be reached
  4397.      by the standard millicode call sequence, linker-generated
  4398.      long-calls, or linker-modified millicode calls.  In practice this
  4399.      should only be needed for dynamicly linked executables with
  4400.      extremely large SHLIB_INFO sections.
  4401.  
  4402. `-mdisable-fpregs'
  4403.      Prevent floating point registers from being used in any manner.
  4404.      This is necessary for compiling kernels which perform lazy context
  4405.      switching of floating point registers.  If you use this option and
  4406.      attempt to perform floating point operations, the compiler will
  4407.      abort.
  4408.  
  4409. `-mdisable-indexing'
  4410.      Prevent the compiler from using indexing address modes.  This
  4411.      avoids some rather obscure problems when compiling MIG generated
  4412.      code under MACH.
  4413.  
  4414. `-mfast-indirect-calls'
  4415.      Generate code which performs faster indirect calls.  Such code is
  4416.      suitable for kernels and for static linking.  The fast indirect
  4417.      call code will fail miserably if it's part of a dynamically linked
  4418.      executable and in the presense of nested functions.
  4419.  
  4420. `-mportable-runtime'
  4421.      Use the portable calling conventions proposed by HP for ELF
  4422.      systems.
  4423.  
  4424. `-mgas'
  4425.      Enable the use of assembler directives only GAS understands.
  4426.  
  4427. `-mschedule=CPU TYPE'
  4428.      Schedule code according to the constraints for the machine type
  4429.      CPU TYPE.  The choices for CPU TYPE are `700' for 7N0 machines,
  4430.      `7100' for 7N5 machines, and `7100' for 7N2 machines.  `700' is
  4431.      the default for CPU TYPE.
  4432.  
  4433.      Note the `7100LC' scheduling information is incomplete and using
  4434.      `7100LC' often leads to bad schedules.  For now it's probably best
  4435.      to use `7100' instead of `7100LC' for the 7N2 machines.
  4436.  
  4437. `-msoft-float'
  4438.      Generate output containing library calls for floating point.
  4439.      *Warning:* the requisite libraries are not available for all HPPA
  4440.      targets.  Normally the facilities of the machine's usual C
  4441.      compiler are used, but this cannot be done directly in
  4442.      cross-compilation.  You must make your own arrangements to provide
  4443.      suitable library functions for cross-compilation.  The embedded
  4444.      target `hppa1.1-*-pro' does provide software floating point
  4445.      support.
  4446.  
  4447.      `-msoft-float' changes the calling convention in the output file;
  4448.      therefore, it is only useful if you compile *all* of a program with
  4449.      this option.  In particular, you need to compile `libgcc.a', the
  4450.      library that comes with GNU CC, with `-msoft-float' in order for
  4451.      this to work.
  4452.  
  4453. 
  4454. File: !gcc.docs.gccuser,  Node: Intel 960 Options,  Next: DEC Alpha Options,  Prev: HPPA Options,  Up: Submodel Options
  4455.  
  4456. Intel 960 Options
  4457. -----------------
  4458.  
  4459.    These `-m' options are defined for the Intel 960 implementations:
  4460.  
  4461. `-mCPU TYPE'
  4462.      Assume the defaults for the machine type CPU TYPE for some of the
  4463.      other options, including instruction scheduling, floating point
  4464.      support, and addressing modes.  The choices for CPU TYPE are `ka',
  4465.      `kb', `mc', `ca', `cf', `sa', and `sb'.  The default is `kb'.
  4466.  
  4467. `-mnumerics'
  4468. `-msoft-float'
  4469.      The `-mnumerics' option indicates that the processor does support
  4470.      floating-point instructions.  The `-msoft-float' option indicates
  4471.      that floating-point support should not be assumed.
  4472.  
  4473. `-mleaf-procedures'
  4474. `-mno-leaf-procedures'
  4475.      Do (or do not) attempt to alter leaf procedures to be callable
  4476.      with the `bal' instruction as well as `call'.  This will result in
  4477.      more efficient code for explicit calls when the `bal' instruction
  4478.      can be substituted by the assembler or linker, but less efficient
  4479.      code in other cases, such as calls via function pointers, or using
  4480.      a linker that doesn't support this optimization.
  4481.  
  4482. `-mtail-call'
  4483. `-mno-tail-call'
  4484.      Do (or do not) make additional attempts (beyond those of the
  4485.      machine-independent portions of the compiler) to optimize
  4486.      tail-recursive calls into branches.  You may not want to do this
  4487.      because the detection of cases where this is not valid is not
  4488.      totally complete.  The default is `-mno-tail-call'.
  4489.  
  4490. `-mcomplex-addr'
  4491. `-mno-complex-addr'
  4492.      Assume (or do not assume) that the use of a complex addressing
  4493.      mode is a win on this implementation of the i960.  Complex
  4494.      addressing modes may not be worthwhile on the K-series, but they
  4495.      definitely are on the C-series.  The default is currently
  4496.      `-mcomplex-addr' for all processors except the CB and CC.
  4497.  
  4498. `-mcode-align'
  4499. `-mno-code-align'
  4500.      Align code to 8-byte boundaries for faster fetching (or don't
  4501.      bother).  Currently turned on by default for C-series
  4502.      implementations only.
  4503.  
  4504. `-mic-compat'
  4505. `-mic2.0-compat'
  4506. `-mic3.0-compat'
  4507.      Enable compatibility with iC960 v2.0 or v3.0.
  4508.  
  4509. `-masm-compat'
  4510. `-mintel-asm'
  4511.      Enable compatibility with the iC960 assembler.
  4512.  
  4513. `-mstrict-align'
  4514. `-mno-strict-align'
  4515.      Do not permit (do permit) unaligned accesses.
  4516.  
  4517. `-mold-align'
  4518.      Enable structure-alignment compatibility with Intel's gcc release
  4519.      version 1.3 (based on gcc 1.37).  Currently this is buggy in that
  4520.      `#pragma align 1' is always assumed as well, and cannot be turned
  4521.      off.
  4522.  
  4523. 
  4524. File: !gcc.docs.gccuser,  Node: DEC Alpha Options,  Next: Clipper Options,  Prev: Intel 960 Options,  Up: Submodel Options
  4525.  
  4526. DEC Alpha Options
  4527. -----------------
  4528.  
  4529.    These `-m' options are defined for the DEC Alpha implementations:
  4530.  
  4531. `-mno-soft-float'
  4532. `-msoft-float'
  4533.      Use (do not use) the hardware floating-point instructions for
  4534.      floating-point operations.  When `-msoft-float' is specified,
  4535.      functions in `libgcc1.c' will be used to perform floating-point
  4536.      operations.  Unless they are replaced by routines that emulate the
  4537.      floating-point operations, or compiled in such a way as to call
  4538.      such emulations routines, these routines will issue floating-point
  4539.      operations.   If you are compiling for an Alpha without
  4540.      floating-point operations, you must ensure that the library is
  4541.      built so as not to call them.
  4542.  
  4543.      Note that Alpha implementations without floating-point operations
  4544.      are required to have floating-point registers.
  4545.  
  4546. `-mfp-reg'
  4547. `-mno-fp-regs'
  4548.      Generate code that uses (does not use) the floating-point register
  4549.      set.  `-mno-fp-regs' implies `-msoft-float'.  If the floating-point
  4550.      register set is not used, floating point operands are passed in
  4551.      integer registers as if they were integers and floating-point
  4552.      results are passed in $0 instead of $f0.  This is a non-standard
  4553.      calling sequence, so any function with a floating-point argument
  4554.      or return value called by code compiled with `-mno-fp-regs' must
  4555.      also be compiled with that option.
  4556.  
  4557.      A typical use of this option is building a kernel that does not
  4558.      use, and hence need not save and restore, any floating-point
  4559.      registers.
  4560.  
  4561. 
  4562. File: !gcc.docs.gccuser,  Node: Clipper Options,  Next: H8/300 Options,  Prev: DEC Alpha Options,  Up: Submodel Options
  4563.  
  4564. Clipper Options
  4565. ---------------
  4566.  
  4567.    These `-m' options are defined for the Clipper implementations:
  4568.  
  4569. `-mc300'
  4570.      Produce code for a C300 Clipper processor. This is the default.
  4571.  
  4572. `-mc400'
  4573.      Produce code for a C400 Clipper processor i.e. use floating point
  4574.      registers f8..f15.
  4575.  
  4576. 
  4577. File: !gcc.docs.gccuser,  Node: H8/300 Options,  Next: System V Options,  Prev: Clipper Options,  Up: Submodel Options
  4578.  
  4579. H8/300 Options
  4580. --------------
  4581.  
  4582.    These `-m' options are defined for the H8/300 implementations:
  4583.  
  4584. `-mrelax'
  4585.      Shorten some address references at link time, when possible; uses
  4586.      the linker option `-relax'.  *Note `ld' and the H8/300:
  4587.      (ld.info)H8/300, for a fuller description.
  4588.  
  4589. `-mh'
  4590.      Generate code for the H8/300H.
  4591.  
  4592. 
  4593. File: !gcc.docs.gccuser,  Node: System V Options,  Prev: H8/300 Options,  Up: Submodel Options
  4594.  
  4595. Options for System V
  4596. --------------------
  4597.  
  4598.    These additional options are available on System V Release 4 for
  4599. compatibility with other compilers on those systems:
  4600.  
  4601. `-Qy'
  4602.      Identify the versions of each tool used by the compiler, in a
  4603.      `.ident' assembler directive in the output.
  4604.  
  4605. `-Qn'
  4606.      Refrain from adding `.ident' directives to the output file (this is
  4607.      the default).
  4608.  
  4609. `-YP,DIRS'
  4610.      Search the directories DIRS, and no others, for libraries
  4611.      specified with `-l'.
  4612.  
  4613. `-Ym,DIR'
  4614.      Look in the directory DIR to find the M4 preprocessor.  The
  4615.      assembler uses this option.
  4616.  
  4617. 
  4618. File: !gcc.docs.gccuser,  Node: Code Gen Options,  Next: Environment Variables,  Prev: Submodel Options,  Up: Invoking GCC
  4619.  
  4620. Options for Code Generation Conventions
  4621. =======================================
  4622.  
  4623.    These machine-independent options control the interface conventions
  4624. used in code generation.
  4625.  
  4626.    Most of them have both positive and negative forms; the negative form
  4627. of `-ffoo' would be `-fno-foo'.  In the table below, only one of the
  4628. forms is listed--the one which is not the default.  You can figure out
  4629. the other form by either removing `no-' or adding it.
  4630.  
  4631. `-fpcc-struct-return'
  4632.      Return "short" `struct' and `union' values in memory like longer
  4633.      ones, rather than in registers.  This convention is less
  4634.      efficient, but it has the advantage of allowing intercallability
  4635.      between GNU CC-compiled files and files compiled with other
  4636.      compilers.
  4637.  
  4638.      The precise convention for returning structures in memory depends
  4639.      on the target configuration macros.
  4640.  
  4641.      Short structures and unions are those whose size and alignment
  4642.      match that of some integer type.
  4643.  
  4644. `-freg-struct-return'
  4645.      Use the convention that `struct' and `union' values are returned
  4646.      in registers when possible.  This is more efficient for small
  4647.      structures than `-fpcc-struct-return'.
  4648.  
  4649.      If you specify neither `-fpcc-struct-return' nor its contrary
  4650.      `-freg-struct-return', GNU CC defaults to whichever convention is
  4651.      standard for the target.  If there is no standard convention, GNU
  4652.      CC defaults to `-fpcc-struct-return', except on targets where GNU
  4653.      CC is the principal compiler.  In those cases, we can choose the
  4654.      standard, and we chose the more efficient register return
  4655.      alternative.
  4656.  
  4657. `-fshort-enums'
  4658.      Allocate to an `enum' type only as many bytes as it needs for the
  4659.      declared range of possible values.  Specifically, the `enum' type
  4660.      will be equivalent to the smallest integer type which has enough
  4661.      room.
  4662.  
  4663. `-fshort-double'
  4664.      Use the same size for `double' as for `float'.
  4665.  
  4666. `-fshared-data'
  4667.      Requests that the data and non-`const' variables of this
  4668.      compilation be shared data rather than private data.  The
  4669.      distinction makes sense only on certain operating systems, where
  4670.      shared data is shared between processes running the same program,
  4671.      while private data exists in one copy per process.
  4672.  
  4673. `-fno-common'
  4674.      Allocate even uninitialized global variables in the bss section of
  4675.      the object file, rather than generating them as common blocks.
  4676.      This has the effect that if the same variable is declared (without
  4677.      `extern') in two different compilations, you will get an error
  4678.      when you link them.  The only reason this might be useful is if
  4679.      you wish to verify that the program will work on other systems
  4680.      which always work this way.
  4681.  
  4682. `-fno-ident'
  4683.      Ignore the `#ident' directive.
  4684.  
  4685. `-fno-gnu-linker'
  4686.      Do not output global initializations (such as C++ constructors and
  4687.      destructors) in the form used by the GNU linker (on systems where
  4688.      the GNU linker is the standard method of handling them).  Use this
  4689.      option when you want to use a non-GNU linker, which also requires
  4690.      using the `collect2' program to make sure the system linker
  4691.      includes constructors and destructors.  (`collect2' is included in
  4692.      the GNU CC distribution.)  For systems which *must* use
  4693.      `collect2', the compiler driver `gcc' is configured to do this
  4694.      automatically.
  4695.  
  4696. `-finhibit-size-directive'
  4697.      Don't output a `.size' assembler directive, or anything else that
  4698.      would cause trouble if the function is split in the middle, and the
  4699.      two halves are placed at locations far apart in memory.  This
  4700.      option is used when compiling `crtstuff.c'; you should not need to
  4701.      use it for anything else.
  4702.  
  4703. `-fverbose-asm'
  4704.      Put extra commentary information in the generated assembly code to
  4705.      make it more readable.  This option is generally only of use to
  4706.      those who actually need to read the generated assembly code
  4707.      (perhaps while debugging the compiler itself).
  4708.  
  4709. `-fvolatile'
  4710.      Consider all memory references through pointers to be volatile.
  4711.  
  4712. `-fvolatile-global'
  4713.      Consider all memory references to extern and global data items to
  4714.      be volatile.
  4715.  
  4716. `-fpic'
  4717.      Generate position-independent code (PIC) suitable for use in a
  4718.      shared library, if supported for the target machine.  Such code
  4719.      accesses all constant addresses through a global offset table
  4720.      (GOT).  If the GOT size for the linked executable exceeds a
  4721.      machine-specific maximum size, you get an error message from the
  4722.      linker indicating that `-fpic' does not work; in that case,
  4723.      recompile with `-fPIC' instead.  (These maximums are 16k on the
  4724.      m88k, 8k on the Sparc, and 32k on the m68k and RS/6000.  The 386
  4725.      has no such limit.)
  4726.  
  4727.      Position-independent code requires special support, and therefore
  4728.      works only on certain machines.  For the 386, GNU CC supports PIC
  4729.      for System V but not for the Sun 386i.  Code generated for the IBM
  4730.      RS/6000 is always position-independent.
  4731.  
  4732.      The GNU assembler does not fully support PIC.  Currently, you must
  4733.      use some other assembler in order for PIC to work.  We would
  4734.      welcome volunteers to upgrade GAS to handle this; the first part
  4735.      of the job is to figure out what the assembler must do differently.
  4736.  
  4737. `-fPIC'
  4738.      If supported for the target machine, emit position-independent
  4739.      code, suitable for dynamic linking and avoiding any limit on the
  4740.      size of the global offset table.  This option makes a difference
  4741.      on the m68k, m88k and the Sparc.
  4742.  
  4743.      Position-independent code requires special support, and therefore
  4744.      works only on certain machines.
  4745.  
  4746. `-ffixed-REG'
  4747.      Treat the register named REG as a fixed register; generated code
  4748.      should never refer to it (except perhaps as a stack pointer, frame
  4749.      pointer or in some other fixed role).
  4750.  
  4751.      REG must be the name of a register.  The register names accepted
  4752.      are machine-specific and are defined in the `REGISTER_NAMES' macro
  4753.      in the machine description macro file.
  4754.  
  4755.      This flag does not have a negative form, because it specifies a
  4756.      three-way choice.
  4757.  
  4758. `-fcall-used-REG'
  4759.      Treat the register named REG as an allocatable register that is
  4760.      clobbered by function calls.  It may be allocated for temporaries
  4761.      or variables that do not live across a call.  Functions compiled
  4762.      this way will not save and restore the register REG.
  4763.  
  4764.      Use of this flag for a register that has a fixed pervasive role in
  4765.      the machine's execution model, such as the stack pointer or frame
  4766.      pointer, will produce disastrous results.
  4767.  
  4768.      This flag does not have a negative form, because it specifies a
  4769.      three-way choice.
  4770.  
  4771. `-fcall-saved-REG'
  4772.      Treat the register named REG as an allocatable register saved by
  4773.      functions.  It may be allocated even for temporaries or variables
  4774.      that live across a call.  Functions compiled this way will save
  4775.      and restore the register REG if they use it.
  4776.  
  4777.      Use of this flag for a register that has a fixed pervasive role in
  4778.      the machine's execution model, such as the stack pointer or frame
  4779.      pointer, will produce disastrous results.
  4780.  
  4781.      A different sort of disaster will result from the use of this flag
  4782.      for a register in which function values may be returned.
  4783.  
  4784.      This flag does not have a negative form, because it specifies a
  4785.      three-way choice.
  4786.  
  4787. `-fpack-struct'
  4788.      Pack all structure members together without holes.  Usually you
  4789.      would not want to use this option, since it makes the code
  4790.      suboptimal, and the offsets of structure members won't agree with
  4791.      system libraries.
  4792.  
  4793. `+e0'
  4794. `+e1'
  4795.      Control whether virtual function definitions in classes are used to
  4796.      generate code, or only to define interfaces for their callers.
  4797.      (C++ only).
  4798.  
  4799.      These options are provided for compatibility with `cfront' 1.x
  4800.      usage; the recommended alternative GNU C++ usage is in flux.
  4801.      *Note Declarations and Definitions in One Header: C++ Interface.
  4802.  
  4803.      With `+e0', virtual function definitions in classes are declared
  4804.      `extern'; the declaration is used only as an interface
  4805.      specification, not to generate code for the virtual functions (in
  4806.      this compilation).
  4807.  
  4808.      With `+e1', G++ actually generates the code implementing virtual
  4809.      functions defined in the code, and makes them publicly visible.
  4810.  
  4811. 
  4812. File: !gcc.docs.gccuser,  Node: Environment Variables,  Next: Running Protoize,  Prev: Code Gen Options,  Up: Invoking GCC
  4813.  
  4814. Environment Variables Affecting GNU CC
  4815. ======================================
  4816.  
  4817.    This section describes several environment variables that affect how
  4818. GNU CC operates.  They work by specifying directories or prefixes to use
  4819. when searching for various kinds of files.
  4820.  
  4821.    Note that you can also specify places to search using options such as
  4822. `-B', `-I' and `-L' (*note Directory Options::.).  These take
  4823. precedence over places specified using environment variables, which in
  4824. turn take precedence over those specified by the configuration of GNU
  4825. CC.
  4826.  
  4827. `TMPDIR'
  4828.      If `TMPDIR' is set, it specifies the directory to use for temporary
  4829.      files.  GNU CC uses temporary files to hold the output of one
  4830.      stage of compilation which is to be used as input to the next
  4831.      stage: for example, the output of the preprocessor, which is the
  4832.      input to the compiler proper.
  4833.  
  4834. `GCC_EXEC_PREFIX'
  4835.      If `GCC_EXEC_PREFIX' is set, it specifies a prefix to use in the
  4836.      names of the subprograms executed by the compiler.  No slash is
  4837.      added when this prefix is combined with the name of a subprogram,
  4838.      but you can specify a prefix that ends with a slash if you wish.
  4839.  
  4840.      If GNU CC cannot find the subprogram using the specified prefix, it
  4841.      tries looking in the usual places for the subprogram.
  4842.  
  4843.      The default value of `GCC_EXEC_PREFIX' is `PREFIX/lib/gcc-lib/'
  4844.      where PREFIX is the value of `prefix' when you ran the `configure'
  4845.      script.
  4846.  
  4847.      Other prefixes specified with `-B' take precedence over this
  4848.      prefix.
  4849.  
  4850.      This prefix is also used for finding files such as `crt0.o' that
  4851.      are used for linking.
  4852.  
  4853.      In addition, the prefix is used in an unusual way in finding the
  4854.      directories to search for header files.  For each of the standard
  4855.      directories whose name normally begins with
  4856.      `/usr/local/lib/gcc-lib' (more precisely, with the value of
  4857.      `GCC_INCLUDE_DIR'), GNU CC tries replacing that beginning with the
  4858.      specified prefix to produce an alternate directory name.  Thus,
  4859.      with `-Bfoo/', GNU CC will search `foo/bar' where it would
  4860.      normally search `/usr/local/lib/bar'.  These alternate directories
  4861.      are searched first; the standard directories come next.
  4862.  
  4863. `COMPILER_PATH'
  4864.      The value of `COMPILER_PATH' is a colon-separated list of
  4865.      directories, much like `PATH'.  GNU CC tries the directories thus
  4866.      specified when searching for subprograms, if it can't find the
  4867.      subprograms using `GCC_EXEC_PREFIX'.
  4868.  
  4869. `LIBRARY_PATH'
  4870.      The value of `LIBRARY_PATH' is a colon-separated list of
  4871.      directories, much like `PATH'.  When configured as a native
  4872.      compiler, GNU CC tries the directories thus specified when
  4873.      searching for special linker files, if it can't find them using
  4874.      `GCC_EXEC_PREFIX'.  Linking using GNU CC also uses these
  4875.      directories when searching for ordinary libraries for the `-l'
  4876.      option (but directories specified with `-L' come first).
  4877.  
  4878. `C_INCLUDE_PATH'
  4879. `CPLUS_INCLUDE_PATH'
  4880. `OBJC_INCLUDE_PATH'
  4881.      These environment variables pertain to particular languages.  Each
  4882.      variable's value is a colon-separated list of directories, much
  4883.      like `PATH'.  When GNU CC searches for header files, it tries the
  4884.      directories listed in the variable for the language you are using,
  4885.      after the directories specified with `-I' but before the standard
  4886.      header file directories.
  4887.  
  4888. `DEPENDENCIES_OUTPUT'
  4889.      If this variable is set, its value specifies how to output
  4890.      dependencies for Make based on the header files processed by the
  4891.      compiler.  This output looks much like the output from the `-M'
  4892.      option (*note Preprocessor Options::.), but it goes to a separate
  4893.      file, and is in addition to the usual results of compilation.
  4894.  
  4895.      The value of `DEPENDENCIES_OUTPUT' can be just a file name, in
  4896.      which case the Make rules are written to that file, guessing the
  4897.      target name from the source file name.  Or the value can have the
  4898.      form `FILE TARGET', in which case the rules are written to file
  4899.      FILE using TARGET as the target name.
  4900.  
  4901. 
  4902. File: !gcc.docs.gccuser,  Node: Running Protoize,  Prev: Environment Variables,  Up: Invoking GCC
  4903.  
  4904. Running Protoize
  4905. ================
  4906.  
  4907.    The program `protoize' is an optional part of GNU C.  You can use it
  4908. to add prototypes to a program, thus converting the program to ANSI C
  4909. in one respect.  The companion program `unprotoize' does the reverse:
  4910. it removes argument types from any prototypes that are found.
  4911.  
  4912.    When you run these programs, you must specify a set of source files
  4913. as command line arguments.  The conversion programs start out by
  4914. compiling these files to see what functions they define.  The
  4915. information gathered about a file FOO is saved in a file named `FOO.X'.
  4916.  
  4917.    After scanning comes actual conversion.  The specified files are all
  4918. eligible to be converted; any files they include (whether sources or
  4919. just headers) are eligible as well.
  4920.  
  4921.    But not all the eligible files are converted.  By default,
  4922. `protoize' and `unprotoize' convert only source and header files in the
  4923. current directory.  You can specify additional directories whose files
  4924. should be converted with the `-d DIRECTORY' option.  You can also
  4925. specify particular files to exclude with the `-x FILE' option.  A file
  4926. is converted if it is eligible, its directory name matches one of the
  4927. specified directory names, and its name within the directory has not
  4928. been excluded.
  4929.  
  4930.    Basic conversion with `protoize' consists of rewriting most function
  4931. definitions and function declarations to specify the types of the
  4932. arguments.  The only ones not rewritten are those for varargs functions.
  4933.  
  4934.    `protoize' optionally inserts prototype declarations at the
  4935. beginning of the source file, to make them available for any calls that
  4936. precede the function's definition.  Or it can insert prototype
  4937. declarations with block scope in the blocks where undeclared functions
  4938. are called.
  4939.  
  4940.    Basic conversion with `unprotoize' consists of rewriting most
  4941. function declarations to remove any argument types, and rewriting
  4942. function definitions to the old-style pre-ANSI form.
  4943.  
  4944.    Both conversion programs print a warning for any function
  4945. declaration or definition that they can't convert.  You can suppress
  4946. these warnings with `-q'.
  4947.  
  4948.    The output from `protoize' or `unprotoize' replaces the original
  4949. source file.  The original file is renamed to a name ending with
  4950. `.save'.  If the `.save' file already exists, then the source file is
  4951. simply discarded.
  4952.  
  4953.    `protoize' and `unprotoize' both depend on GNU CC itself to scan the
  4954. program and collect information about the functions it uses.  So
  4955. neither of these programs will work until GNU CC is installed.
  4956.  
  4957.    Here is a table of the options you can use with `protoize' and
  4958. `unprotoize'.  Each option works with both programs unless otherwise
  4959. stated.
  4960.  
  4961. `-B DIRECTORY'
  4962.      Look for the file `SYSCALLS.c.X' in DIRECTORY, instead of the
  4963.      usual directory (normally `/usr/local/lib').  This file contains
  4964.      prototype information about standard system functions.  This option
  4965.      applies only to `protoize'.
  4966.  
  4967. `-c COMPILATION-OPTIONS'
  4968.      Use  COMPILATION-OPTIONS as the options when running `gcc' to
  4969.      produce the `.X' files.  The special option `-aux-info' is always
  4970.      passed in addition, to tell `gcc' to write a `.X' file.
  4971.  
  4972.      Note that the compilation options must be given as a single
  4973.      argument to `protoize' or `unprotoize'.  If you want to specify
  4974.      several `gcc' options, you must quote the entire set of
  4975.      compilation options to make them a single word in the shell.
  4976.  
  4977.      There are certain `gcc' arguments that you cannot use, because they
  4978.      would produce the wrong kind of output.  These include `-g', `-O',
  4979.      `-c', `-S', and `-o' If you include these in the
  4980.      COMPILATION-OPTIONS, they are ignored.
  4981.  
  4982. `-C'
  4983.      Rename files to end in `.C' instead of `.c'.  This is convenient
  4984.      if you are converting a C program to C++.  This option applies
  4985.      only to `protoize'.
  4986.  
  4987. `-g'
  4988.      Add explicit global declarations.  This means inserting explicit
  4989.      declarations at the beginning of each source file for each function
  4990.      that is called in the file and was not declared.  These
  4991.      declarations precede the first function definition that contains a
  4992.      call to an undeclared function.  This option applies only to
  4993.      `protoize'.
  4994.  
  4995. `-i STRING'
  4996.      Indent old-style parameter declarations with the string STRING.
  4997.      This option applies only to `protoize'.
  4998.  
  4999.      `unprotoize' converts prototyped function definitions to old-style
  5000.      function definitions, where the arguments are declared between the
  5001.      argument list and the initial `{'.  By default, `unprotoize' uses
  5002.      five spaces as the indentation.  If you want to indent with just
  5003.      one space instead, use `-i " "'.
  5004.  
  5005. `-k'
  5006.      Keep the `.X' files.  Normally, they are deleted after conversion
  5007.      is finished.
  5008.  
  5009. `-l'
  5010.      Add explicit local declarations.  `protoize' with `-l' inserts a
  5011.      prototype declaration for each function in each block which calls
  5012.      the function without any declaration.  This option applies only to
  5013.      `protoize'.
  5014.  
  5015. `-n'
  5016.      Make no real changes.  This mode just prints information about the
  5017.      conversions that would have been done without `-n'.
  5018.  
  5019. `-N'
  5020.      Make no `.save' files.  The original files are simply deleted.
  5021.      Use this option with caution.
  5022.  
  5023. `-p PROGRAM'
  5024.      Use the program PROGRAM as the compiler.  Normally, the name `gcc'
  5025.      is used.
  5026.  
  5027. `-q'
  5028.      Work quietly.  Most warnings are suppressed.
  5029.  
  5030. `-v'
  5031.      Print the version number, just like `-v' for `gcc'.
  5032.  
  5033.    If you need special compiler options to compile one of your program's
  5034. source files, then you should generate that file's `.X' file specially,
  5035. by running `gcc' on that source file with the appropriate options and
  5036. the option `-aux-info'.  Then run `protoize' on the entire set of
  5037. files.  `protoize' will use the existing `.X' file because it is newer
  5038. than the source file.  For example:
  5039.  
  5040.      gcc -Dfoo=bar file1.c -aux-info
  5041.      protoize *.c
  5042.  
  5043. You need to include the special files along with the rest in the
  5044. `protoize' command, even though their `.X' files already exist, because
  5045. otherwise they won't get converted.
  5046.  
  5047.    *Note Protoize Caveats::, for more information on how to use
  5048. `protoize' successfully.
  5049.  
  5050. 
  5051. File: !gcc.docs.gccuser,  Node: Installation,  Next: C Extensions,  Prev: Invoking GCC,  Up: Top
  5052.  
  5053. Installing GNU CC
  5054. *****************
  5055.  
  5056. * Menu:
  5057.  
  5058. * Configurations::    Configurations Supported by GNU CC.
  5059. * Other Dir::     Compiling in a separate directory (not where the source is).
  5060. * Cross-Compiler::   Building and installing a cross-compiler.
  5061. * Sun Install::   See below for installation on the Sun.
  5062. * VMS Install::   See below for installation on VMS.
  5063. * Collect2::      How `collect2' works; how it finds `ld'.
  5064. * Header Dirs::   Understanding the standard header file directories.
  5065.  
  5066.    Here is the procedure for installing GNU CC on a Unix system.  See
  5067. *Note VMS Install::, for VMS systems.  In this section we assume you
  5068. compile in the same directory that contains the source files; see *Note
  5069. Other Dir::, to find out how to compile in a separate directory on Unix
  5070. systems.
  5071.  
  5072.    You cannot install GNU C by itself on MSDOS; it will not compile
  5073. under any MSDOS compiler except itself.  You need to get the complete
  5074. compilation package DJGPP, which includes binaries as well as sources,
  5075. and includes all the necessary compilation tools and libraries.
  5076.  
  5077.   1. If you have built GNU CC previously in the same directory for a
  5078.      different target machine, do `make distclean' to delete all files
  5079.      that might be invalid.  One of the files this deletes is
  5080.      `Makefile'; if `make distclean' complains that `Makefile' does not
  5081.      exist, it probably means that the directory is already suitably
  5082.      clean.
  5083.  
  5084.   2. On a System V release 4 system, make sure `/usr/bin' precedes
  5085.      `/usr/ucb' in `PATH'.  The `cc' command in `/usr/ucb' uses
  5086.      libraries which have bugs.
  5087.  
  5088.   3. Specify the host, build and target machine configurations.  You do
  5089.      this by running the file `configure'.
  5090.  
  5091.      The "build" machine is the system which you are using, the "host"
  5092.      machine is the system where you want to run the resulting compiler
  5093.      (normally the build machine), and the "target" machine is the
  5094.      system for which you want the compiler to generate code.
  5095.  
  5096.      If you are building a compiler to produce code for the machine it
  5097.      runs on (a native compiler), you normally do not need to specify
  5098.      any operands to `configure'; it will try to guess the type of
  5099.      machine you are on and use that as the build, host and target
  5100.      machines.  So you don't need to specify a configuration when
  5101.      building a native compiler unless `configure' cannot figure out
  5102.      what your configuration is or guesses wrong.
  5103.  
  5104.      In those cases, specify the build machine's "configuration name"
  5105.      with the `--build' option; the host and target will default to be
  5106.      the same as the build machine.  (If you are building a
  5107.      cross-compiler, see *Note Cross-Compiler::.)
  5108.  
  5109.      Here is an example:
  5110.  
  5111.           ./configure --build=sparc-sun-sunos4.1
  5112.  
  5113.      A configuration name may be canonical or it may be more or less
  5114.      abbreviated.
  5115.  
  5116.      A canonical configuration name has three parts, separated by
  5117.      dashes.  It looks like this: `CPU-COMPANY-SYSTEM'.  (The three
  5118.      parts may themselves contain dashes; `configure' can figure out
  5119.      which dashes serve which purpose.)  For example,
  5120.      `m68k-sun-sunos4.1' specifies a Sun 3.
  5121.  
  5122.      You can also replace parts of the configuration by nicknames or
  5123.      aliases.  For example, `sun3' stands for `m68k-sun', so
  5124.      `sun3-sunos4.1' is another way to specify a Sun 3.  You can also
  5125.      use simply `sun3-sunos', since the version of SunOS is assumed by
  5126.      default to be version 4.  `sun3-bsd' also works, since `configure'
  5127.      knows that the only BSD variant on a Sun 3 is SunOS.
  5128.  
  5129.      You can specify a version number after any of the system types,
  5130.      and some of the CPU types.  In most cases, the version is
  5131.      irrelevant, and will be ignored.  So you might as well specify the
  5132.      version if you know it.
  5133.  
  5134.      See *Note Configurations::, for a list of supported configuration
  5135.      names and notes on many of the configurations.  You should check
  5136.      the notes in that section before proceeding any further with the
  5137.      installation of GNU CC.
  5138.  
  5139.      There are four additional options you can specify independently to
  5140.      describe variant hardware and software configurations.  These are
  5141.      `--with-gnu-as', `--with-gnu-ld', `--with-stabs' and `--nfp'.
  5142.  
  5143.     `--with-gnu-as'
  5144.           If you will use GNU CC with the GNU assembler (GAS), you
  5145.           should declare this by using the `--with-gnu-as' option when
  5146.           you run `configure'.
  5147.  
  5148.           Using this option does not install GAS.  It only modifies the
  5149.           output of GNU CC to work with GAS.  Building and installing
  5150.           GAS is up to you.
  5151.  
  5152.           Conversely, if you *do not* wish to use GAS and do not specify
  5153.           `--with-gnu-as' when building GNU CC, it is up to you to make
  5154.           sure that GAS is not installed.  GNU CC searches for a
  5155.           program named `as' in various directories; if the program it
  5156.           finds is GAS, then it runs GAS.  If you are not sure where
  5157.           GNU CC finds the assembler it is using, try specifying `-v'
  5158.           when you run it.
  5159.  
  5160.           The systems where it makes a difference whether you use GAS
  5161.           are
  5162.           `hppa1.0-ANY-ANY', `hppa1.1-ANY-ANY', `i386-ANY-sysv',
  5163.           `i386-ANY-isc',
  5164.           `i860-ANY-bsd', `m68k-bull-sysv', `m68k-hp-hpux',
  5165.           `m68k-sony-bsd',
  5166.           `m68k-altos-sysv', `m68000-hp-hpux', `m68000-att-sysv',
  5167.           `ANY-lynx-lynxos', and `mips-ANY').  On any other system,
  5168.           `--with-gnu-as' has no effect.
  5169.  
  5170.           On the systems listed above (except for the HP-PA, for ISC on
  5171.           the 386, and for `mips-sgi-irix5.*'), if you use GAS, you
  5172.           should also use the GNU linker (and specify `--with-gnu-ld').
  5173.  
  5174.     `--with-gnu-ld'
  5175.           Specify the option `--with-gnu-ld' if you plan to use the GNU
  5176.           linker with GNU CC.
  5177.  
  5178.           This option does not cause the GNU linker to be installed; it
  5179.           just modifies the behavior of GNU CC to work with the GNU
  5180.           linker.  Specifically, it inhibits the installation of
  5181.           `collect2', a program which otherwise serves as a front-end
  5182.           for the system's linker on most configurations.
  5183.  
  5184.     `--with-stabs'
  5185.           On MIPS based systems and on Alphas, you must specify whether
  5186.           you want GNU CC to create the normal ECOFF debugging format,
  5187.           or to use BSD-style stabs passed through the ECOFF symbol
  5188.           table.  The normal ECOFF debug format cannot fully handle
  5189.           languages other than C.  BSD stabs format can handle other
  5190.           languages, but it only works with the GNU debugger GDB.
  5191.  
  5192.           Normally, GNU CC uses the ECOFF debugging format by default;
  5193.           if you prefer BSD stabs, specify `--with-stabs' when you
  5194.           configure GNU CC.
  5195.  
  5196.           No matter which default you choose when you configure GNU CC,
  5197.           the user can use the `-gcoff' and `-gstabs+' options to
  5198.           specify explicitly the debug format for a particular
  5199.           compilation.
  5200.  
  5201.           `--with-stabs' is meaningful on the ISC system on the 386,
  5202.           also, if `--with-gas' is used.  It selects use of stabs
  5203.           debugging information embedded in COFF output.  This kind of
  5204.           debugging information supports C++ well; ordinary COFF
  5205.           debugging information does not.
  5206.  
  5207.           `--with-stabs' is also meaningful on 386 systems running
  5208.           SVR4.  It selects use of stabs debugging information embedded
  5209.           in ELF output.  The C++ compiler currently (2.6.0) does not
  5210.           support the DWARF debugging information normally used on 386
  5211.           SVR4 platforms; stabs provide a workable alternative.  This
  5212.           requires gas and gdb, as the normal SVR4 tools can not
  5213.           generate or interpret stabs.
  5214.  
  5215.     `--nfp'
  5216.           On certain systems, you must specify whether the machine has
  5217.           a floating point unit.  These systems include
  5218.           `m68k-sun-sunosN' and `m68k-isi-bsd'.  On any other system,
  5219.           `--nfp' currently has no effect, though perhaps there are
  5220.           other systems where it could usefully make a difference.
  5221.  
  5222.      The `configure' script searches subdirectories of the source
  5223.      directory for other compilers that are to be integrated into GNU
  5224.      CC.  The GNU compiler for C++, called G++ is in a subdirectory
  5225.      named `cp'.  `configure' inserts rules into `Makefile' to build
  5226.      all of those compilers.
  5227.  
  5228.      Here we spell out what files will be set up by `configure'.
  5229.      Normally you need not be concerned with these files.
  5230.  
  5231.         * A file named `config.h' is created that contains a `#include'
  5232.           of the top-level config file for the machine you will run the
  5233.           compiler on (*note The Configuration File:
  5234.           (gcc.info)Config.).  This file is responsible for defining
  5235.           information about the host machine.  It includes `tm.h'.
  5236.  
  5237.           The top-level config file is located in the subdirectory
  5238.           `config'.  Its name is always `xm-SOMETHING.h'; usually
  5239.           `xm-MACHINE.h', but there are some exceptions.
  5240.  
  5241.           If your system does not support symbolic links, you might
  5242.           want to set up `config.h' to contain a `#include' command
  5243.           which refers to the appropriate file.
  5244.  
  5245.         * A file named `tconfig.h' is created which includes the
  5246.           top-level config file for your target machine.  This is used
  5247.           for compiling certain programs to run on that machine.
  5248.  
  5249.         * A file named `tm.h' is created which includes the
  5250.           machine-description macro file for your target machine.  It
  5251.           should be in the subdirectory `config' and its name is often
  5252.           `MACHINE.h'.
  5253.  
  5254.         * The command file `configure' also constructs the file
  5255.           `Makefile' by adding some text to the template file
  5256.           `Makefile.in'.  The additional text comes from files in the
  5257.           `config' directory, named `t-TARGET' and `x-HOST'.  If these
  5258.           files do not exist, it means nothing needs to be added for a
  5259.           given target or host.
  5260.  
  5261.   4. The standard directory for installing GNU CC is `/usr/local/lib'.
  5262.      If you want to install its files somewhere else, specify
  5263.      `--prefix=DIR' when you run `configure'.  Here DIR is a directory
  5264.      name to use instead of `/usr/local' for all purposes with one
  5265.      exception: the directory `/usr/local/include' is searched for
  5266.      header files no matter where you install the compiler.  To override
  5267.      this name, use the `--local-prefix' option below.
  5268.  
  5269.   5. Specify `--local-prefix=DIR' if you want the compiler to search
  5270.      directory `DIR/include' for locally installed header files
  5271.      *instead* of `/usr/local/include'.
  5272.  
  5273.      You should specify `--local-prefix' *only* if your site has a
  5274.      different convention (not `/usr/local') for where to put
  5275.      site-specific files.
  5276.  
  5277.      *Do not* specify `/usr' as the `--local-prefix'!  The directory
  5278.      you use for `--local-prefix' *must not* contain any of the
  5279.      system's standard header files.  If it did contain them, certain
  5280.      programs would be miscompiled (including GNU Emacs, on certain
  5281.      targets), because this would override and nullify the header file
  5282.      corrections made by the `fixincludes' script.
  5283.  
  5284.   6. Make sure the Bison parser generator is installed.  (This is
  5285.      unnecessary if the Bison output files `c-parse.c' and `cexp.c' are
  5286.      more recent than `c-parse.y' and `cexp.y' and you do not plan to
  5287.      change the `.y' files.)
  5288.  
  5289.      Bison versions older than Sept 8, 1988 will produce incorrect
  5290.      output for `c-parse.c'.
  5291.  
  5292.   7. If you have chosen a configuration for GNU CC which requires other
  5293.      GNU tools (such as GAS or the GNU linker) instead of the standard
  5294.      system tools, install the required tools in the build directory
  5295.      under the names `as', `ld' or whatever is appropriate.  This will
  5296.      enable the compiler to find the proper tools for compilation of
  5297.      the program `enquire'.
  5298.  
  5299.      Alternatively, you can do subsequent compilation using a value of
  5300.      the `PATH' environment variable such that the necessary GNU tools
  5301.      come before the standard system tools.
  5302.  
  5303.   8. Build the compiler.  Just type `make LANGUAGES=c' in the compiler
  5304.      directory.
  5305.  
  5306.      `LANGUAGES=c' specifies that only the C compiler should be
  5307.      compiled.  The makefile normally builds compilers for all the
  5308.      supported languages; currently, C, C++ and Objective C.  However,
  5309.      C is the only language that is sure to work when you build with
  5310.      other non-GNU C compilers.  In addition, building anything but C
  5311.      at this stage is a waste of time.
  5312.  
  5313.      In general, you can specify the languages to build by typing the
  5314.      argument `LANGUAGES="LIST"', where LIST is one or more words from
  5315.      the list `c', `c++', and `objective-c'.  If you have any
  5316.      additional GNU compilers as subdirectories of the GNU CC source
  5317.      directory, you may also specify their names in this list.
  5318.  
  5319.      Ignore any warnings you may see about "statement not reached" in
  5320.      `insn-emit.c'; they are normal.  Also, warnings about "unknown
  5321.      escape sequence" are normal in `genopinit.c' and perhaps some
  5322.      other files.  Likewise, you should ignore warnings about "constant
  5323.      is so large that it is unsigned" in `insn-emit.c' and
  5324.      `insn-recog.c' and a warning about a comparison always being zero
  5325.      in `enquire.o'.  Any other compilation errors may represent bugs in
  5326.      the port to your machine or operating system, and should be
  5327.      investigated and reported (*note Bugs::.).
  5328.  
  5329.      Some commercial compilers fail to compile GNU CC because they have
  5330.      bugs or limitations.  For example, the Microsoft compiler is said
  5331.      to run out of macro space.  Some Ultrix compilers run out of
  5332.      expression space; then you need to break up the statement where
  5333.      the problem happens.
  5334.  
  5335.   9. If you are building a cross-compiler, stop here.  *Note
  5336.      Cross-Compiler::.
  5337.  
  5338.  10. Move the first-stage object files and executables into a
  5339.      subdirectory with this command:
  5340.  
  5341.           make stage1
  5342.  
  5343.      The files are moved into a subdirectory named `stage1'.  Once
  5344.      installation is complete, you may wish to delete these files with
  5345.      `rm -r stage1'.
  5346.  
  5347.  11. If you have chosen a configuration for GNU CC which requires other
  5348.      GNU tools (such as GAS or the GNU linker) instead of the standard
  5349.      system tools, install the required tools in the `stage1'
  5350.      subdirectory under the names `as', `ld' or whatever is
  5351.      appropriate.  This will enable the stage 1 compiler to find the
  5352.      proper tools in the following stage.
  5353.  
  5354.      Alternatively, you can do subsequent compilation using a value of
  5355.      the `PATH' environment variable such that the necessary GNU tools
  5356.      come before the standard system tools.
  5357.  
  5358.  12. Recompile the compiler with itself, with this command:
  5359.  
  5360.           make CC="stage1/xgcc -Bstage1/" CFLAGS="-g -O2"
  5361.  
  5362.      This is called making the stage 2 compiler.
  5363.  
  5364.      The command shown above builds compilers for all the supported
  5365.      languages.  If you don't want them all, you can specify the
  5366.      languages to build by typing the argument `LANGUAGES="LIST"'.  LIST
  5367.      should contain one or more words from the list `c', `c++',
  5368.      `objective-c', and `proto'.  Separate the words with spaces.
  5369.      `proto' stands for the programs `protoize' and `unprotoize'; they
  5370.      are not a separate language, but you use `LANGUAGES' to enable or
  5371.      disable their installation.
  5372.  
  5373.      If you are going to build the stage 3 compiler, then you might
  5374.      want to build only the C language in stage 2.
  5375.  
  5376.      Once you have built the stage 2 compiler, if you are short of disk
  5377.      space, you can delete the subdirectory `stage1'.
  5378.  
  5379.      On a 68000 or 68020 system lacking floating point hardware, unless
  5380.      you have selected a `tm.h' file that expects by default that there
  5381.      is no such hardware, do this instead:
  5382.  
  5383.           make CC="stage1/xgcc -Bstage1/" CFLAGS="-g -O2 -msoft-float"
  5384.  
  5385.  13. If you wish to test the compiler by compiling it with itself one
  5386.      more time, install any other necessary GNU tools (such as GAS or
  5387.      the GNU linker) in the `stage2' subdirectory as you did in the
  5388.      `stage1' subdirectory, then do this:
  5389.  
  5390.           make stage2
  5391.           make CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O2"
  5392.  
  5393.      This is called making the stage 3 compiler.  Aside from the `-B'
  5394.      option, the compiler options should be the same as when you made
  5395.      the stage 2 compiler.  But the `LANGUAGES' option need not be the
  5396.      same.  The command shown above builds compilers for all the
  5397.      supported languages; if you don't want them all, you can specify
  5398.      the languages to build by typing the argument `LANGUAGES="LIST"',
  5399.      as described above.
  5400.  
  5401.      If you do not have to install any additional GNU tools, you may
  5402.      use the command
  5403.  
  5404.           make bootstrap LANGUAGES=LANGUAGE-LIST BOOT_CFLAGS=OPTION-LIST
  5405.  
  5406.      instead of making `stage1', `stage2', and performing the two
  5407.      compiler builds.
  5408.  
  5409.  14. Then compare the latest object files with the stage 2 object
  5410.      files--they ought to be identical, aside from time stamps (if any).
  5411.  
  5412.      On some systems, meaningful comparison of object files is
  5413.      impossible; they always appear "different."  This is currently
  5414.      true on Solaris and some systems that use ELF object file format.
  5415.      On some versions of Irix on SGI machines and DEC Unix (OSF/1) on
  5416.      Alpha systems, you will not be able to compare the files without
  5417.      specifying `-save-temps'; see the description of individual
  5418.      systems above to see if you get comparison failures.  You may have
  5419.      similar problems on other systems.
  5420.  
  5421.      Use this command to compare the files:
  5422.  
  5423.           make compare
  5424.  
  5425.      This will mention any object files that differ between stage 2 and
  5426.      stage 3.  Any difference, no matter how innocuous, indicates that
  5427.      the stage 2 compiler has compiled GNU CC incorrectly, and is
  5428.      therefore a potentially serious bug which you should investigate
  5429.      and report (*note Bugs::.).
  5430.  
  5431.      If your system does not put time stamps in the object files, then
  5432.      this is a faster way to compare them (using the Bourne shell):
  5433.  
  5434.           for file in *.o; do
  5435.           cmp $file stage2/$file
  5436.           done
  5437.  
  5438.      If you have built the compiler with the `-mno-mips-tfile' option on
  5439.      MIPS machines, you will not be able to compare the files.
  5440.  
  5441.  15. Install the compiler driver, the compiler's passes and run-time
  5442.      support with `make install'.  Use the same value for `CC',
  5443.      `CFLAGS' and `LANGUAGES' that you used when compiling the files
  5444.      that are being installed.  One reason this is necessary is that
  5445.      some versions of Make have bugs and recompile files gratuitously
  5446.      when you do this step.  If you use the same variable values, those
  5447.      files will be recompiled properly.
  5448.  
  5449.      For example, if you have built the stage 2 compiler, you can use
  5450.      the following command:
  5451.  
  5452.           make install CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O" LANGUAGES="LIST"
  5453.  
  5454.      This copies the files `cc1', `cpp' and `libgcc.a' to files `cc1',
  5455.      `cpp' and `libgcc.a' in the directory
  5456.      `/usr/local/lib/gcc-lib/TARGET/VERSION', which is where the
  5457.      compiler driver program looks for them.  Here TARGET is the target
  5458.      machine type specified when you ran `configure', and VERSION is
  5459.      the version number of GNU CC.  This naming scheme permits various
  5460.      versions and/or cross-compilers to coexist.
  5461.  
  5462.      This also copies the driver program `xgcc' into
  5463.      `/usr/local/bin/gcc', so that it appears in typical execution
  5464.      search paths.
  5465.  
  5466.      On some systems, this command causes recompilation of some files.
  5467.      This is usually due to bugs in `make'.  You should either ignore
  5468.      this problem, or use GNU Make.
  5469.  
  5470.      *Warning: there is a bug in `alloca' in the Sun library.  To avoid
  5471.      this bug, be sure to install the executables of GNU CC that were
  5472.      compiled by GNU CC.  (That is, the executables from stage 2 or 3,
  5473.      not stage 1.)  They use `alloca' as a built-in function and never
  5474.      the one in the library.*
  5475.  
  5476.      (It is usually better to install GNU CC executables from stage 2
  5477.      or 3, since they usually run faster than the ones compiled with
  5478.      some other compiler.)
  5479.  
  5480.  16. If you're going to use C++, it's likely that you need to also
  5481.      install the libg++ distribution.  It should be available from the
  5482.      same place where you got the GNU C distribution.  Just as GNU C
  5483.      does not distribute a C runtime library, it also does not include
  5484.      a C++ run-time library.  All I/O functionality, special class
  5485.      libraries, etc., are available in the libg++ distribution.
  5486.  
  5487. 
  5488. File: !gcc.docs.gccuser,  Node: Configurations,  Next: Other Dir,  Up: Installation
  5489.  
  5490. Configurations Supported by GNU CC
  5491. ==================================
  5492.  
  5493.    Here are the possible CPU types:
  5494.  
  5495.      1750a, a29k, alpha, arm, cN, clipper, dsp16xx, elxsi, h8300,
  5496.      hppa1.0, hppa1.1, i370, i386, i486, i586, i860, i960, m68000, m68k,
  5497.      m88k, mips, mipsel, mips64, mips64el, ns32k, powerpc, powerpcle,
  5498.      pyramid, romp, rs6000, sh, sparc, sparclite, sparc64, vax, we32k.
  5499.  
  5500.    Here are the recognized company names.  As you can see, customary
  5501. abbreviations are used rather than the longer official names.
  5502.  
  5503.      acorn, alliant, altos, apollo, att, bull, cbm, convergent, convex,
  5504.      crds, dec, dg, dolphin, elxsi, encore, harris, hitachi, hp, ibm,
  5505.      intergraph, isi, mips, motorola, ncr, next, ns, omron, plexus,
  5506.      sequent, sgi, sony, sun, tti, unicom, wrs.
  5507.  
  5508.    The company name is meaningful only to disambiguate when the rest of
  5509. the information supplied is insufficient.  You can omit it, writing
  5510. just `CPU-SYSTEM', if it is not needed.  For example, `vax-ultrix4.2'
  5511. is equivalent to `vax-dec-ultrix4.2'.
  5512.  
  5513.    Here is a list of system types:
  5514.  
  5515.      386bsd, aix, acis, amigados, aos, aout, bosx, bsd, clix, coff,
  5516.      ctix, cxux, dgux, dynix, ebmon, ecoff, elf, esix, freebsd, hms,
  5517.      genix, gnu, gnu/linux, hiux, hpux, iris, irix, isc, luna, lynxos,
  5518.      mach, minix, msdos, mvs, netbsd, newsos, nindy, ns, osf, osfrose,
  5519.      ptx, riscix, riscos, rtu, sco, sim, solaris, sunos, sym, sysv,
  5520.      udi, ultrix, unicos, uniplus, unos, vms, vsta, vxworks, winnt,
  5521.      xenix.
  5522.  
  5523. You can omit the system type; then `configure' guesses the operating
  5524. system from the CPU and company.
  5525.  
  5526.    You can add a version number to the system type; this may or may not
  5527. make a difference.  For example, you can write `bsd4.3' or `bsd4.4' to
  5528. distinguish versions of BSD.  In practice, the version number is most
  5529. needed for `sysv3' and `sysv4', which are often treated differently.
  5530.  
  5531.    If you specify an impossible combination such as `i860-dg-vms', then
  5532. you may get an error message from `configure', or it may ignore part of
  5533. the information and do the best it can with the rest.  `configure'
  5534. always prints the canonical name for the alternative that it used.  GNU
  5535. CC does not support all possible alternatives.
  5536.  
  5537.    Often a particular model of machine has a name.  Many machine names
  5538. are recognized as aliases for CPU/company combinations.  Thus, the
  5539. machine name `sun3', mentioned above, is an alias for `m68k-sun'.
  5540. Sometimes we accept a company name as a machine name, when the name is
  5541. popularly used for a particular machine.  Here is a table of the known
  5542. machine names:
  5543.  
  5544.      3300, 3b1, 3bN, 7300, altos3068, altos, apollo68, att-7300,
  5545.      balance, convex-cN, crds, decstation-3100, decstation, delta,
  5546.      encore, fx2800, gmicro, hp7NN, hp8NN, hp9k2NN, hp9k3NN, hp9k7NN,
  5547.      hp9k8NN, iris4d, iris, isi68, m3230, magnum, merlin, miniframe,
  5548.      mmax, news-3600, news800, news, next, pbd, pc532, pmax, powerpc,
  5549.      powerpcle, ps2, risc-news, rtpc, sun2, sun386i, sun386, sun3,
  5550.      sun4, symmetry, tower-32, tower.
  5551.  
  5552. Remember that a machine name specifies both the cpu type and the company
  5553. name.  If you want to install your own homemade configuration files,
  5554. you can use `local' as the company name to access them.  If you use
  5555. configuration `CPU-local', the configuration name without the cpu prefix
  5556. is used to form the configuration file names.
  5557.  
  5558.    Thus, if you specify `m68k-local', configuration uses files
  5559. `m68k.md', `local.h', `m68k.c', `xm-local.h', `t-local', and `x-local',
  5560. all in the directory `config/m68k'.
  5561.  
  5562.    Here is a list of configurations that have special treatment or
  5563. special things you must know:
  5564.  
  5565. `1750a-*-*'
  5566.      MIL-STD-1750A processors.
  5567.  
  5568.      Starting with GCC 2.6.1, the MIL-STD-1750A cross configuration no
  5569.      longer supports the Tektronix Assembler, but instead produces
  5570.      output for `as1750', an assembler/linker available under the GNU
  5571.      Public License for the 1750A. Contact *kellogg@space.otn.dasa.de*
  5572.      for more details on obtaining `as1750'.  A similarly licensed
  5573.      simulator for the 1750A is available from same address.
  5574.  
  5575.      You should ignore a fatal error during the building of libgcc
  5576.      (libgcc is not yet implemented for the 1750A.)
  5577.  
  5578.      The `as1750' assembler requires the file `ms1750.inc', which is
  5579.      found in the directory `config/1750a'.
  5580.  
  5581.      GNU CC produced the same sections as the Fairchild F9450 C
  5582.      Compiler, namely:
  5583.  
  5584.     `Normal'
  5585.           The program code section.
  5586.  
  5587.     `Static'
  5588.           The read/write (RAM) data section.
  5589.  
  5590.     `Konst'
  5591.           The read-only (ROM) constants section.
  5592.  
  5593.     `Init'
  5594.           Initialization section (code to copy KREL to SREL).
  5595.  
  5596.      The smallest addressable unit is 16 bits (BITS_PER_UNIT is 16).
  5597.      This means that type `char' is represented with a 16-bit word per
  5598.      character.  The 1750A's "Load/Store Upper/Lower Byte" instructions
  5599.      are not used by GNU CC.
  5600.  
  5601. `alpha-*-osf1'
  5602.      Systems using processors that implement the DEC Alpha architecture
  5603.      and are running the DEC Unix (OSF/1) operating system, for example
  5604.      the DEC Alpha AXP systems.  (VMS on the Alpha is not currently
  5605.      supported by GNU CC.)
  5606.  
  5607.      GNU CC writes a `.verstamp' directive to the assembler output file
  5608.      unless it is built as a cross-compiler.  It gets the version to
  5609.      use from the system header file `/usr/include/stamp.h'.  If you
  5610.      install a new version of DEC Unix, you should rebuild GCC to pick
  5611.      up the new version stamp.
  5612.  
  5613.      Note that since the Alpha is a 64-bit architecture,
  5614.      cross-compilers from 32-bit machines will not generate code as
  5615.      efficient as that generated when the compiler is running on a
  5616.      64-bit machine because many optimizations that depend on being
  5617.      able to represent a word on the target in an integral value on the
  5618.      host cannot be performed.  Building cross-compilers on the Alpha
  5619.      for 32-bit machines has only been tested in a few cases and may
  5620.      not work properly.
  5621.  
  5622.      `make compare' may fail on old versions of DEC Unix unless you add
  5623.      `-save-temps' to `CFLAGS'.  On these systems, the name of the
  5624.      assembler input file is stored in the object file, and that makes
  5625.      comparison fail if it differs between the `stage1' and `stage2'
  5626.      compilations.  The option `-save-temps' forces a fixed name to be
  5627.      used for the assembler input file, instead of a randomly chosen
  5628.      name in `/tmp'.  Do not add `-save-temps' unless the comparisons
  5629.      fail without that option.  If you add `-save-temps', you will have
  5630.      to manually delete the `.i' and `.s' files after each series of
  5631.      compilations.
  5632.  
  5633.      GNU CC now supports both the native (ECOFF) debugging format used
  5634.      by DBX and GDB and an encapsulated STABS format for use only with
  5635.      GDB.  See the discussion of the `--with-stabs' option of
  5636.      `configure' above for more information on these formats and how to
  5637.      select them.
  5638.  
  5639.      There is a bug in DEC's assembler that produces incorrect line
  5640.      numbers for ECOFF format when the `.align' directive is used.  To
  5641.      work around this problem, GNU CC will not emit such alignment
  5642.      directives while writing ECOFF format debugging information even
  5643.      if optimization is being performed.  Unfortunately, this has the
  5644.      very undesirable side-effect that code addresses when `-O' is
  5645.      specified are different depending on whether or not `-g' is also
  5646.      specified.
  5647.  
  5648.      To avoid this behavior, specify `-gstabs+' and use GDB instead of
  5649.      DBX.  DEC is now aware of this problem with the assembler and
  5650.      hopes to provide a fix shortly.
  5651.  
  5652. `arm'
  5653.      Advanced RISC Machines ARM-family processors.  These are often
  5654.      used in embedded applications.  There are no standard Unix
  5655.      configurations.  This configuration corresponds to the basic
  5656.      instruction sequences and will produce a.out format object modules.
  5657.  
  5658.      You may need to make a variant of the file `arm.h' for your
  5659.      particular configuration.
  5660.  
  5661. `arm-*-riscix'
  5662.      The ARM2 or ARM3 processor running RISC iX, Acorn's port of BSD
  5663.      Unix.  If you are running a version of RISC iX prior to 1.2 then
  5664.      you must specify the version number during configuration.  Note
  5665.      that the assembler shipped with RISC iX does not support stabs
  5666.      debugging information; a new version of the assembler, with stabs
  5667.      support included, is now available from Acorn.
  5668.  
  5669. `a29k'
  5670.      AMD Am29k-family processors.  These are normally used in embedded
  5671.      applications.  There are no standard Unix configurations.  This
  5672.      configuration corresponds to AMD's standard calling sequence and
  5673.      binary interface and is compatible with other 29k tools.
  5674.  
  5675.      You may need to make a variant of the file `a29k.h' for your
  5676.      particular configuration.
  5677.  
  5678. `a29k-*-bsd'
  5679.      AMD Am29050 used in a system running a variant of BSD Unix.
  5680.  
  5681. `decstation-*'
  5682.      DECstations can support three different personalities: Ultrix, DEC
  5683.      OSF/1, and OSF/rose.  To configure GCC for these platforms use the
  5684.      following configurations:
  5685.  
  5686.     `decstation-ultrix'
  5687.           Ultrix configuration.
  5688.  
  5689.     `decstation-osf1'
  5690.           Dec's version of OSF/1.
  5691.  
  5692.     `decstation-osfrose'
  5693.           Open Software Foundation reference port of OSF/1 which uses
  5694.           the OSF/rose object file format instead of ECOFF.  Normally,
  5695.           you would not select this configuration.
  5696.  
  5697.      The MIPS C compiler needs to be told to increase its table size
  5698.      for switch statements with the `-Wf,-XNg1500' option in order to
  5699.      compile `cp/parse.c'.  If you use the `-O2' optimization option,
  5700.      you also need to use `-Olimit 3000'.  Both of these options are
  5701.      automatically generated in the `Makefile' that the shell script
  5702.      `configure' builds.  If you override the `CC' make variable and
  5703.      use the MIPS compilers, you may need to add `-Wf,-XNg1500 -Olimit
  5704.      3000'.
  5705.  
  5706. `elxsi-elxsi-bsd'
  5707.      The Elxsi's C compiler has known limitations that prevent it from
  5708.      compiling GNU C.  Please contact `mrs@cygnus.com' for more details.
  5709.  
  5710. `dsp16xx'
  5711.      A port to the AT&T DSP1610 family of processors.
  5712.  
  5713. `h8300-*-*'
  5714.      The calling convention and structure layout has changed in release
  5715.      2.6.  All code must be recompiled.  The calling convention now
  5716.      passes the first three arguments in function calls in registers.
  5717.      Structures are no longer a multiple of 2 bytes.
  5718.  
  5719. `hppa*-*-*'
  5720.      There are two variants of this CPU, called 1.0 and 1.1, which have
  5721.      different machine descriptions.  You must use the right one for
  5722.      your machine.  All 7NN machines and 8N7 machines use 1.1, while
  5723.      all other 8NN machines use 1.0.
  5724.  
  5725.      The easiest way to handle this problem is to use `configure hpNNN'
  5726.      or `configure hpNNN-hpux', where NNN is the model number of the
  5727.      machine.  Then `configure' will figure out if the machine is a 1.0
  5728.      or 1.1.  Use `uname -a' to find out the model number of your
  5729.      machine.
  5730.  
  5731.      `-g' does not work on HP-UX, since that system uses a peculiar
  5732.      debugging format which GNU CC does not know about.  However, `-g'
  5733.      will work if you also use GAS and GDB in conjunction with GCC.  We
  5734.      highly recommend using GAS for all HP-PA configurations.
  5735.  
  5736.      You should be using GAS-2.3 (or later) along with GDB-4.12 (or
  5737.      later).  These can be retrieved from all the traditional GNU ftp
  5738.      archive sites.
  5739.  
  5740.      Build GAS and install the resulting binary as:
  5741.  
  5742.           /usr/local/lib/gcc-lib/CONFIGURATION/GCCVERSION/as
  5743.  
  5744.      where CONFIGURATION is the configuration name (perhaps
  5745.      `hpNNN-hpux') and GCCVERSION is the GNU CC version number.  Do
  5746.      this *before* starting the build process, otherwise you will get
  5747.      errors from the HPUX assembler while building `libgcc2.a'.  The
  5748.      command
  5749.  
  5750.           make install-dir
  5751.  
  5752.      will create the necessary directory hierarchy so you can install
  5753.      GAS before building GCC.
  5754.  
  5755.      To enable debugging, configure GNU CC with the `--with-gnu-as'
  5756.      option before building.
  5757.  
  5758.      It has been reported that GNU CC produces invalid assembly code for
  5759.      1.1 machines running HP-UX 8.02 when using the HP assembler.
  5760.      Typically the errors look like this:
  5761.           as: bug.s @line#15 [err#1060]
  5762.             Argument 0 or 2 in FARG upper
  5763.                    - lookahead = ARGW1=FR,RTNVAL=GR
  5764.           as: foo.s @line#28 [err#1060]
  5765.             Argument 0 or 2 in FARG upper
  5766.                    - lookahead = ARGW1=FR
  5767.  
  5768.      You can check the version of HP-UX you are running by executing
  5769.      the command `uname -r'.   If you are indeed running HP-UX 8.02 on
  5770.      a PA and using the HP assembler then configure GCC with
  5771.      "hpNNN-hpux8.02".
  5772.  
  5773. `i370-*-*'
  5774.      This port is very preliminary and has many known bugs.  We hope to
  5775.      have a higher-quality port for this machine soon.
  5776.  
  5777. `i386-*-linuxoldld'
  5778.      Use this configuration to generate a.out binaries on Linux if you
  5779.      do not have gas/binutils version 2.5.2 or later installed. This is
  5780.      an obsolete configuration.
  5781.  
  5782. `i386-*-linuxaout'
  5783.      Use this configuration to generate a.out binaries on Linux. This
  5784.      configuration is being superseded. You must use gas/binutils
  5785.      version 2.5.2 or later.
  5786.  
  5787. `i386-*-linux'
  5788.      Use this configuration to generate ELF binaries on Linux.  You must
  5789.      use gas/binutils version 2.5.2 or later.
  5790.  
  5791. `i386-*-sco'
  5792.      Compilation with RCC is recommended.  Also, it may be a good idea
  5793.      to link with GNU malloc instead of the malloc that comes with the
  5794.      system.
  5795.  
  5796. `i386-*-sco3.2v4'
  5797.      Use this configuration for SCO release 3.2 version 4.
  5798.  
  5799. `i386-*-isc'
  5800.      It may be a good idea to link with GNU malloc instead of the
  5801.      malloc that comes with the system.
  5802.  
  5803.      In ISC version 4.1, `sed' core dumps when building `deduced.h'.
  5804.      Use the version of `sed' from version 4.0.
  5805.  
  5806. `i386-*-esix'
  5807.      It may be good idea to link with GNU malloc instead of the malloc
  5808.      that comes with the system.
  5809.  
  5810. `i386-ibm-aix'
  5811.      You need to use GAS version 2.1 or later, and and LD from GNU
  5812.      binutils version 2.2 or later.
  5813.  
  5814. `i386-sequent-bsd'
  5815.      Go to the Berkeley universe before compiling.  In addition, you
  5816.      probably need to create a file named `string.h' containing just
  5817.      one line: `#include <strings.h>'.
  5818.  
  5819. `i386-sequent-ptx1*'
  5820.      Sequent DYNIX/ptx 1.x.
  5821.  
  5822. `i386-sequent-ptx2*'
  5823.      Sequent DYNIX/ptx 2.x.
  5824.  
  5825. `i386-sun-sunos4'
  5826.      You may find that you need another version of GNU CC to begin
  5827.      bootstrapping with, since the current version when built with the
  5828.      system's own compiler seems to get an infinite loop compiling part
  5829.      of `libgcc2.c'.  GNU CC version 2 compiled with GNU CC (any
  5830.      version) seems not to have this problem.
  5831.  
  5832.      See *Note Sun Install::, for information on installing GNU CC on
  5833.      Sun systems.
  5834.  
  5835. `i[345]86-*-winnt3.5'
  5836.      This version requires a GAS that has not let been released.  Until
  5837.      it is, you can get a prebuilt binary version via anonymous ftp from
  5838.      `cs.washington.edu:pub/gnat' or `cs.nyu.edu:pub/gnat'. You must
  5839.      also use the Microsoft header files from the Windows NT 3.5 SDK.
  5840.      Find these on the CDROM in the `/mstools/h' directory dated
  5841.      9/4/94.  You must use a fixed version of Microsoft linker made
  5842.      especially for NT 3.5, which is also is available on the NT 3.5
  5843.      SDK CDROM.  If you do not have this linker, can you also use the
  5844.      linker from Visual C/C++ 1.0 or 2.0.
  5845.  
  5846.      Installing GNU CC for NT builds a wrapper linker, called `ld.exe',
  5847.      which mimics the behaviour of Unix `ld' in the specification of
  5848.      libraries (`-L' and `-l').  `ld.exe' looks for both Unix and
  5849.      Microsoft named libraries.  For example, if you specify `-lfoo',
  5850.      `ld.exe' will look first for `libfoo.a' and then for `foo.lib'.
  5851.  
  5852.      You may install GNU CC for Windows NT in one of two ways,
  5853.      depending on whether or not you have a Unix-like shell and various
  5854.      Unix-like utilities.
  5855.  
  5856.        1. If you do not have a Unix-like shell and few Unix-like
  5857.           utilities, you will use a DOS style batch script called
  5858.           `configure.bat'.  Invoke it as `configure winnt' from an
  5859.           MSDOS console window or from the program manager dialog box.
  5860.           `configure.bat' assumes you have already installed and have
  5861.           in your path a Unix-like `sed' program which is used to
  5862.           create a working `Makefile' from `Makefile.in'.
  5863.  
  5864.           `Makefile' uses the Microsoft Nmake program maintenance
  5865.           utility and the Visual C/C++ V8.00 compiler to build GNU CC.
  5866.           You need only have the utilities `sed' and `touch' to use
  5867.           this installation method, which only automatically builds the
  5868.           compiler itself.  You must then examine what `fixinc.winnt'
  5869.           does, edit the header files by hand and build `libgcc.a'
  5870.           manually.
  5871.  
  5872.        2. The second type of installation assumes you are running a
  5873.           Unix-like shell, have a complete suite of Unix-like utilities
  5874.           in your path, and have a previous version of GNU CC already
  5875.           installed, either through building it via the above
  5876.           installation method or acquiring a pre-built binary.  In this
  5877.           case, use the `configure' script in the normal fashion.
  5878.  
  5879. `i860-intel-osf1'
  5880.      This is the Paragon.  If you have version 1.0 of the operating
  5881.      system, see *Note Installation Problems::, for special things you
  5882.      need to do to compensate for peculiarities in the system.
  5883.  
  5884. `*-lynx-lynxos'
  5885.      LynxOS 2.2 and earlier comes with GNU CC 1.x already installed as
  5886.      `/bin/gcc'.  You should compile with this instead of `/bin/cc'.
  5887.      You can tell GNU CC to use the GNU assembler and linker, by
  5888.      specifying `--with-gnu-as --with-gnu-ld' when configuring.  These
  5889.      will produce COFF format object files and executables;  otherwise
  5890.      GNU CC will use the installed tools, which produce a.out format
  5891.      executables.
  5892.  
  5893. `m68000-hp-bsd'
  5894.      HP 9000 series 200 running BSD.  Note that the C compiler that
  5895.      comes with this system cannot compile GNU CC; contact
  5896.      `law@cs.utah.edu' to get binaries of GNU CC for bootstrapping.
  5897.  
  5898. `m68k-altos'
  5899.      Altos 3068.  You must use the GNU assembler, linker and debugger.
  5900.      Also, you must fix a kernel bug.  Details in the file
  5901.      `README.ALTOS'.
  5902.  
  5903. `m68k-att-sysv'
  5904.      AT&T 3b1, a.k.a. 7300 PC.  Special procedures are needed to
  5905.      compile GNU CC with this machine's standard C compiler, due to
  5906.      bugs in that compiler.  You can bootstrap it more easily with
  5907.      previous versions of GNU CC if you have them.
  5908.  
  5909.      Installing GNU CC on the 3b1 is difficult if you do not already
  5910.      have GNU CC running, due to bugs in the installed C compiler.
  5911.      However, the following procedure might work.  We are unable to
  5912.      test it.
  5913.  
  5914.        1. Comment out the `#include "config.h"' line on line 37 of
  5915.           `cccp.c' and do `make cpp'.  This makes a preliminary version
  5916.           of GNU cpp.
  5917.  
  5918.        2. Save the old `/lib/cpp' and copy the preliminary GNU cpp to
  5919.           that file name.
  5920.  
  5921.        3. Undo your change in `cccp.c', or reinstall the original
  5922.           version, and do `make cpp' again.
  5923.  
  5924.        4. Copy this final version of GNU cpp into `/lib/cpp'.
  5925.  
  5926.        5. Replace every occurrence of `obstack_free' in the file
  5927.           `tree.c' with `_obstack_free'.
  5928.  
  5929.        6. Run `make' to get the first-stage GNU CC.
  5930.  
  5931.        7. Reinstall the original version of `/lib/cpp'.
  5932.  
  5933.        8. Now you can compile GNU CC with itself and install it in the
  5934.           normal fashion.
  5935.  
  5936. `m68k-bull-sysv'
  5937.      Bull DPX/2 series 200 and 300 with BOS-2.00.45 up to BOS-2.01. GNU
  5938.      CC works either with native assembler or GNU assembler. You can use
  5939.      GNU assembler with native coff generation by providing
  5940.      `--with-gnu-as' to the configure script or use GNU assembler with
  5941.      dbx-in-coff encapsulation by providing `--with-gnu-as --stabs'.
  5942.      For any problem with native assembler or for availability of the
  5943.      DPX/2 port of GAS, contact `F.Pierresteguy@frcl.bull.fr'.
  5944.  
  5945. `m68k-crds-unox'
  5946.      Use `configure unos' for building on Unos.
  5947.  
  5948.      The Unos assembler is named `casm' instead of `as'.  For some
  5949.      strange reason linking `/bin/as' to `/bin/casm' changes the
  5950.      behavior, and does not work.  So, when installing GNU CC, you
  5951.      should install the following script as `as' in the subdirectory
  5952.      where the passes of GCC are installed:
  5953.  
  5954.           #!/bin/sh
  5955.           casm $*
  5956.  
  5957.      The default Unos library is named `libunos.a' instead of `libc.a'.
  5958.      To allow GNU CC to function, either change all references to
  5959.      `-lc' in `gcc.c' to `-lunos' or link `/lib/libc.a' to
  5960.      `/lib/libunos.a'.
  5961.  
  5962.      When compiling GNU CC with the standard compiler, to overcome bugs
  5963.      in the support of `alloca', do not use `-O' when making stage 2.
  5964.      Then use the stage 2 compiler with `-O' to make the stage 3
  5965.      compiler.  This compiler will have the same characteristics as the
  5966.      usual stage 2 compiler on other systems.  Use it to make a stage 4
  5967.      compiler and compare that with stage 3 to verify proper
  5968.      compilation.
  5969.  
  5970.      (Perhaps simply defining `ALLOCA' in `x-crds' as described in the
  5971.      comments there will make the above paragraph superfluous.  Please
  5972.      inform us of whether this works.)
  5973.  
  5974.      Unos uses memory segmentation instead of demand paging, so you
  5975.      will need a lot of memory.  5 Mb is barely enough if no other
  5976.      tasks are running.  If linking `cc1' fails, try putting the object
  5977.      files into a library and linking from that library.
  5978.  
  5979. `m68k-hp-hpux'
  5980.      HP 9000 series 300 or 400 running HP-UX.  HP-UX version 8.0 has a
  5981.      bug in the assembler that prevents compilation of GNU CC.  To fix
  5982.      it, get patch PHCO_4484 from HP.
  5983.  
  5984.      In addition, if you wish to use gas `--with-gnu-as' you must use
  5985.      gas version 2.1 or later, and you must use the GNU linker version
  5986.      2.1 or later.  Earlier versions of gas relied upon a program which
  5987.      converted the gas output into the native HP/UX format, but that
  5988.      program has not been kept up to date.  gdb does not understand
  5989.      that native HP/UX format, so you must use gas if you wish to use
  5990.      gdb.
  5991.  
  5992. `m68k-sun'
  5993.      Sun 3.  We do not provide a configuration file to use the Sun FPA
  5994.      by default, because programs that establish signal handlers for
  5995.      floating point traps inherently cannot work with the FPA.
  5996.  
  5997.      See *Note Sun Install::, for information on installing GNU CC on
  5998.      Sun systems.
  5999.  
  6000. `m88k-*-svr3'
  6001.      Motorola m88k running the AT&T/Unisoft/Motorola V.3 reference port.
  6002.      These systems tend to use the Green Hills C, revision 1.8.5, as the
  6003.      standard C compiler.  There are apparently bugs in this compiler
  6004.      that result in object files differences between stage 2 and stage
  6005.      3.  If this happens, make the stage 4 compiler and compare it to
  6006.      the stage 3 compiler.  If the stage 3 and stage 4 object files are
  6007.      identical, this suggests you encountered a problem with the
  6008.      standard C compiler; the stage 3 and 4 compilers may be usable.
  6009.  
  6010.      It is best, however, to use an older version of GNU CC for
  6011.      bootstrapping if you have one.
  6012.  
  6013. `m88k-*-dgux'
  6014.      Motorola m88k running DG/UX.  To build 88open BCS native or cross
  6015.      compilers on DG/UX, specify the configuration name as
  6016.      `m88k-*-dguxbcs' and build in the 88open BCS software development
  6017.      environment.  To build ELF native or cross compilers on DG/UX,
  6018.      specify `m88k-*-dgux' and build in the DG/UX ELF development
  6019.      environment.  You set the software development environment by
  6020.      issuing `sde-target' command and specifying either `m88kbcs' or
  6021.      `m88kdguxelf' as the operand.
  6022.  
  6023.      If you do not specify a configuration name, `configure' guesses the
  6024.      configuration based on the current software development
  6025.      environment.
  6026.  
  6027. `m88k-tektronix-sysv3'
  6028.      Tektronix XD88 running UTekV 3.2e.  Do not turn on optimization
  6029.      while building stage1 if you bootstrap with the buggy Green Hills
  6030.      compiler.  Also, The bundled LAI System V NFS is buggy so if you
  6031.      build in an NFS mounted directory, start from a fresh reboot, or
  6032.      avoid NFS all together.  Otherwise you may have trouble getting
  6033.      clean comparisons between stages.
  6034.  
  6035. `mips-mips-bsd'
  6036.      MIPS machines running the MIPS operating system in BSD mode.  It's
  6037.      possible that some old versions of the system lack the functions
  6038.      `memcpy', `memcmp', and `memset'.  If your system lacks these, you
  6039.      must remove or undo the definition of `TARGET_MEM_FUNCTIONS' in
  6040.      `mips-bsd.h'.
  6041.  
  6042.      The MIPS C compiler needs to be told to increase its table size
  6043.      for switch statements with the `-Wf,-XNg1500' option in order to
  6044.      compile `cp/parse.c'.  If you use the `-O2' optimization option,
  6045.      you also need to use `-Olimit 3000'.  Both of these options are
  6046.      automatically generated in the `Makefile' that the shell script
  6047.      `configure' builds.  If you override the `CC' make variable and
  6048.      use the MIPS compilers, you may need to add `-Wf,-XNg1500 -Olimit
  6049.      3000'.
  6050.  
  6051. `mips-mips-riscos*'
  6052.      The MIPS C compiler needs to be told to increase its table size
  6053.      for switch statements with the `-Wf,-XNg1500' option in order to
  6054.      compile `cp/parse.c'.  If you use the `-O2' optimization option,
  6055.      you also need to use `-Olimit 3000'.  Both of these options are
  6056.      automatically generated in the `Makefile' that the shell script
  6057.      `configure' builds.  If you override the `CC' make variable and
  6058.      use the MIPS compilers, you may need to add `-Wf,-XNg1500 -Olimit
  6059.      3000'.
  6060.  
  6061.      MIPS computers running RISC-OS can support four different
  6062.      personalities: default, BSD 4.3, System V.3, and System V.4 (older
  6063.      versions of RISC-OS don't support V.4).  To configure GCC for
  6064.      these platforms use the following configurations:
  6065.  
  6066.     `mips-mips-riscos`rev''
  6067.           Default configuration for RISC-OS, revision `rev'.
  6068.  
  6069.     `mips-mips-riscos`rev'bsd'
  6070.           BSD 4.3 configuration for RISC-OS, revision `rev'.
  6071.  
  6072.     `mips-mips-riscos`rev'sysv4'
  6073.           System V.4 configuration for RISC-OS, revision `rev'.
  6074.  
  6075.     `mips-mips-riscos`rev'sysv'
  6076.           System V.3 configuration for RISC-OS, revision `rev'.
  6077.  
  6078.      The revision `rev' mentioned above is the revision of RISC-OS to
  6079.      use.  You must reconfigure GCC when going from a RISC-OS revision
  6080.      4 to RISC-OS revision 5.  This has the effect of avoiding a linker
  6081.      bug (see *Note Installation Problems::, for more details).
  6082.  
  6083. `mips-sgi-*'
  6084.      In order to compile GCC on an SGI running IRIX 4, the "c.hdr.lib"
  6085.      option must be installed from the CD-ROM supplied from Silicon
  6086.      Graphics.  This is found on the 2nd CD in release 4.0.1.
  6087.  
  6088.      In order to compile GCC on an SGI running IRIX 5, the
  6089.      "compiler_dev.hdr" subsystem must be installed from the IDO CD-ROM
  6090.      supplied by Silicon Graphics.
  6091.  
  6092.      `make compare' may fail on version 5 of IRIX unless you add
  6093.      `-save-temps' to `CFLAGS'.  On these systems, the name of the
  6094.      assembler input file is stored in the object file, and that makes
  6095.      comparison fail if it differs between the `stage1' and `stage2'
  6096.      compilations.  The option `-save-temps' forces a fixed name to be
  6097.      used for the assembler input file, instead of a randomly chosen
  6098.      name in `/tmp'.  Do not add `-save-temps' unless the comparisons
  6099.      fail without that option.  If you do you `-save-temps', you will
  6100.      have to manually delete the `.i' and `.s' files after each series
  6101.      of compilations.
  6102.  
  6103.      The MIPS C compiler needs to be told to increase its table size
  6104.      for switch statements with the `-Wf,-XNg1500' option in order to
  6105.      compile `cp/parse.c'.  If you use the `-O2' optimization option,
  6106.      you also need to use `-Olimit 3000'.  Both of these options are
  6107.      automatically generated in the `Makefile' that the shell script
  6108.      `configure' builds.  If you override the `CC' make variable and
  6109.      use the MIPS compilers, you may need to add `-Wf,-XNg1500 -Olimit
  6110.      3000'.
  6111.  
  6112.      On Irix version 4.0.5F, and perhaps on some other versions as well,
  6113.      there is an assembler bug that reorders instructions incorrectly.
  6114.      To work around it, specify the target configuration
  6115.      `mips-sgi-irix4loser'.  This configuration inhibits assembler
  6116.      optimization.
  6117.  
  6118.      In a compiler configured with target `mips-sgi-irix4', you can turn
  6119.      off assembler optimization by using the `-noasmopt' option.  This
  6120.      compiler option passes the option `-O0' to the assembler, to
  6121.      inhibit reordering.
  6122.  
  6123.      The `-noasmopt' option can be useful for testing whether a problem
  6124.      is due to erroneous assembler reordering.  Even if a problem does
  6125.      not go away with `-noasmopt', it may still be due to assembler
  6126.      reordering--perhaps GNU CC itself was miscompiled as a result.
  6127.  
  6128.      To enable debugging under Irix 5, you must use GNU as 2.5 or later,
  6129.      and use the `--with-gnu-as' configure option when configuring gcc.
  6130.      GNU as is distributed as part of the binutils package.
  6131.  
  6132. `mips-sony-sysv'
  6133.      Sony MIPS NEWS.  This works in NEWSOS 5.0.1, but not in 5.0.2
  6134.      (which uses ELF instead of COFF).  Support for 5.0.2 will probably
  6135.      be provided soon by volunteers.  In particular, the linker does
  6136.      not like the code generated by GCC when shared libraries are
  6137.      linked in.
  6138.  
  6139. `ns32k-encore'
  6140.      Encore ns32000 system.  Encore systems are supported only under
  6141.      BSD.
  6142.  
  6143. `ns32k-*-genix'
  6144.      National Semiconductor ns32000 system.  Genix has bugs in `alloca'
  6145.      and `malloc'; you must get the compiled versions of these from GNU
  6146.      Emacs.
  6147.  
  6148. `ns32k-sequent'
  6149.      Go to the Berkeley universe before compiling.  In addition, you
  6150.      probably need to create a file named `string.h' containing just
  6151.      one line: `#include <strings.h>'.
  6152.  
  6153. `ns32k-utek'
  6154.      UTEK ns32000 system ("merlin").  The C compiler that comes with
  6155.      this system cannot compile GNU CC; contact `tektronix!reed!mason'
  6156.      to get binaries of GNU CC for bootstrapping.
  6157.  
  6158. `romp-*-aos'
  6159. `romp-*-mach'
  6160.      The only operating systems supported for the IBM RT PC are AOS and
  6161.      MACH.  GNU CC does not support AIX running on the RT.  We
  6162.      recommend you compile GNU CC with an earlier version of itself; if
  6163.      you compile GNU CC with `hc', the Metaware compiler, it will work,
  6164.      but you will get mismatches between the stage 2 and stage 3
  6165.      compilers in various files.  These errors are minor differences in
  6166.      some floating-point constants and can be safely ignored; the stage
  6167.      3 compiler is correct.
  6168.  
  6169. `rs6000-*-aix'
  6170. `powerpc-*-aix'
  6171.      Various early versions of each release of the IBM XLC compiler
  6172.      will not bootstrap GNU CC.  Symptoms include differences between
  6173.      the stage2 and stage3 object files, and errors when compiling
  6174.      `libgcc.a' or `enquire'.  Known problematic releases include:
  6175.      xlc-1.2.1.8, xlc-1.3.0.0 (distributed with AIX 3.2.5), and
  6176.      xlc-1.3.0.19.  Both xlc-1.2.1.28 and xlc-1.3.0.24 (PTF 432238) are
  6177.      known to produce working versions of GNU CC, but most other recent
  6178.      releases correctly bootstrap GNU CC.  Also, releases of AIX prior
  6179.      to AIX 3.2.4 include a version of the IBM assembler which does not
  6180.      accept debugging directives: assembler updates are available as
  6181.      PTFs.  Also, if you are using AIX 3.2.5 or greater and the GNU
  6182.      assembler, you must have a version modified after October 16th,
  6183.      1995 in order for the GNU C compiler to build.  See the file
  6184.      `README.RS6000' for more details on of these problems.
  6185.  
  6186.      GNU CC does not yet support the 64-bit PowerPC instructions.
  6187.  
  6188.      Objective C does not work on this architecture because it makes
  6189.      assumptions that are incompatible with the calling conventions.
  6190.  
  6191.      AIX on the RS/6000 provides support (NLS) for environments outside
  6192.      of the United States.  Compilers and assemblers use NLS to support
  6193.      locale-specific representations of various objects including
  6194.      floating-point numbers ("." vs "," for separating decimal
  6195.      fractions).  There have been problems reported where the library
  6196.      linked with GNU CC does not produce the same floating-point
  6197.      formats that the assembler accepts.  If you have this problem, set
  6198.      the LANG environment variable to "C" or "En_US".
  6199.  
  6200.      Due to changes in the way that GNU CC invokes the binder (linker)
  6201.      for AIX 4.1, you may now receive warnings of duplicate symbols
  6202.      from the link step that were not reported before.  The assembly
  6203.      files generated by GNU CC for AIX have always included multiple
  6204.      symbol definitions for certain global variable and function
  6205.      declarations in the original program.  The warnings should not
  6206.      prevent the linker from producing a correct library or runnable
  6207.      executable.
  6208.  
  6209. `powerpc-*-elf'
  6210. `powerpc-*-sysv4'
  6211.      PowerPC system in big endian mode, running System V.4.
  6212.  
  6213.      This configuration is currently under development.
  6214.  
  6215. `powerpc-*-eabiaix'
  6216.      Embedded PowerPC system in big endian mode with -mcall-aix
  6217.      selected as the default.  This system is currently under
  6218.      development.
  6219.  
  6220. `powerpc-*-eabisim'
  6221.      Embedded PowerPC system in big endian mode for use in running
  6222.      under the PSIM simulator.  This system is currently under
  6223.      development.
  6224.  
  6225. `powerpc-*-eabi'
  6226.      Embedded PowerPC system in big endian mode.
  6227.  
  6228.      This configuration is currently under development.
  6229.  
  6230. `powerpcle-*-elf'
  6231. `powerpcle-*-sysv4'
  6232.      PowerPC system in little endian mode, running System V.4.
  6233.  
  6234.      This configuration is currently under development.
  6235.  
  6236. `powerpcle-*-sysv4'
  6237.      Embedded PowerPC system in little endian mode.
  6238.  
  6239.      This system is currently under development.
  6240.  
  6241. `powerpcle-*-eabisim'
  6242.      Embedded PowerPC system in little endian mode for use in running
  6243.      under the PSIM simulator.
  6244.  
  6245.      This system is currently under development.
  6246.  
  6247. `powerpcle-*-eabi'
  6248.      Embedded PowerPC system in little endian mode.
  6249.  
  6250.      This configuration is currently under development.
  6251.  
  6252. `vax-dec-ultrix'
  6253.      Don't try compiling with Vax C (`vcc').  It produces incorrect code
  6254.      in some cases (for example, when `alloca' is used).
  6255.  
  6256.      Meanwhile, compiling `cp/parse.c' with pcc does not work because of
  6257.      an internal table size limitation in that compiler.  To avoid this
  6258.      problem, compile just the GNU C compiler first, and use it to
  6259.      recompile building all the languages that you want to run.
  6260.  
  6261. `sparc-sun-*'
  6262.      See *Note Sun Install::, for information on installing GNU CC on
  6263.      Sun systems.
  6264.  
  6265. `vax-dec-vms'
  6266.      See *Note VMS Install::, for details on how to install GNU CC on
  6267.      VMS.
  6268.  
  6269. `we32k-*-*'
  6270.      These computers are also known as the 3b2, 3b5, 3b20 and other
  6271.      similar names.  (However, the 3b1 is actually a 68000; see *Note
  6272.      Configurations::.)
  6273.  
  6274.      Don't use `-g' when compiling with the system's compiler.  The
  6275.      system's linker seems to be unable to handle such a large program
  6276.      with debugging information.
  6277.  
  6278.      The system's compiler runs out of capacity when compiling `stmt.c'
  6279.      in GNU CC.  You can work around this by building `cpp' in GNU CC
  6280.      first, then use that instead of the system's preprocessor with the
  6281.      system's C compiler to compile `stmt.c'.  Here is how:
  6282.  
  6283.           mv /lib/cpp /lib/cpp.att
  6284.           cp cpp /lib/cpp.gnu
  6285.           echo '/lib/cpp.gnu -traditional ${1+"$@"}' > /lib/cpp
  6286.           chmod +x /lib/cpp
  6287.  
  6288.      The system's compiler produces bad code for some of the GNU CC
  6289.      optimization files.  So you must build the stage 2 compiler without
  6290.      optimization.  Then build a stage 3 compiler with optimization.
  6291.      That executable should work.  Here are the necessary commands:
  6292.  
  6293.           make LANGUAGES=c CC=stage1/xgcc CFLAGS="-Bstage1/ -g"
  6294.           make stage2
  6295.           make CC=stage2/xgcc CFLAGS="-Bstage2/ -g -O"
  6296.  
  6297.      You may need to raise the ULIMIT setting to build a C++ compiler,
  6298.      as the file `cc1plus' is larger than one megabyte.
  6299.  
  6300. 
  6301. File: !gcc.docs.gccuser,  Node: Other Dir,  Next: Cross-Compiler,  Prev: Configurations,  Up: Installation
  6302.  
  6303. Compilation in a Separate Directory
  6304. ===================================
  6305.  
  6306.    If you wish to build the object files and executables in a directory
  6307. other than the one containing the source files, here is what you must
  6308. do differently:
  6309.  
  6310.   1. Make sure you have a version of Make that supports the `VPATH'
  6311.      feature.  (GNU Make supports it, as do Make versions on most BSD
  6312.      systems.)
  6313.  
  6314.   2. If you have ever run `configure' in the source directory, you must
  6315.      undo the configuration.  Do this by running:
  6316.  
  6317.           make distclean
  6318.  
  6319.   3. Go to the directory in which you want to build the compiler before
  6320.      running `configure':
  6321.  
  6322.           mkdir gcc-sun3
  6323.           cd gcc-sun3
  6324.  
  6325.      On systems that do not support symbolic links, this directory must
  6326.      be on the same file system as the source code directory.
  6327.  
  6328.   4. Specify where to find `configure' when you run it:
  6329.  
  6330.           ../gcc/configure ...
  6331.  
  6332.      This also tells `configure' where to find the compiler sources;
  6333.      `configure' takes the directory from the file name that was used to
  6334.      invoke it.  But if you want to be sure, you can specify the source
  6335.      directory with the `--srcdir' option, like this:
  6336.  
  6337.           ../gcc/configure --srcdir=../gcc OTHER OPTIONS
  6338.  
  6339.      The directory you specify with `--srcdir' need not be the same as
  6340.      the one that `configure' is found in.
  6341.  
  6342.    Now, you can run `make' in that directory.  You need not repeat the
  6343. configuration steps shown above, when ordinary source files change.  You
  6344. must, however, run `configure' again when the configuration files
  6345. change, if your system does not support symbolic links.
  6346.  
  6347. 
  6348. File: !gcc.docs.gccuser,  Node: Cross-Compiler,  Next: Sun Install,  Prev: Other Dir,  Up: Installation
  6349.  
  6350. Building and Installing a Cross-Compiler
  6351. ========================================
  6352.  
  6353.    GNU CC can function as a cross-compiler for many machines, but not
  6354. all.
  6355.  
  6356.    * Cross-compilers for the Mips as target using the Mips assembler
  6357.      currently do not work, because the auxiliary programs
  6358.      `mips-tdump.c' and `mips-tfile.c' can't be compiled on anything
  6359.      but a Mips.  It does work to cross compile for a Mips if you use
  6360.      the GNU assembler and linker.
  6361.  
  6362.    * Cross-compilers between machines with different floating point
  6363.      formats have not all been made to work.  GNU CC now has a floating
  6364.      point emulator with which these can work, but each target machine
  6365.      description needs to be updated to take advantage of it.
  6366.  
  6367.    * Cross-compilation between machines of different word sizes is
  6368.      somewhat problematic and sometimes does not work.
  6369.  
  6370.    Since GNU CC generates assembler code, you probably need a
  6371. cross-assembler that GNU CC can run, in order to produce object files.
  6372. If you want to link on other than the target machine, you need a
  6373. cross-linker as well.  You also need header files and libraries suitable
  6374. for the target machine that you can install on the host machine.
  6375.  
  6376. * Menu:
  6377.  
  6378. * Steps of Cross::      Using a cross-compiler involves several steps
  6379.                           that may be carried out on different machines.
  6380. * Configure Cross::     Configuring a cross-compiler.
  6381. * Tools and Libraries:: Where to put the linker and assembler, and the C library.
  6382. * Cross Headers::       Finding and installing header files
  6383.                           for a cross-compiler.
  6384. * Cross Runtime::       Supplying arithmetic runtime routines (`libgcc1.a').
  6385. * Build Cross::         Actually compiling the cross-compiler.
  6386.  
  6387. 
  6388. File: !gcc.docs.gccuser,  Node: Steps of Cross,  Next: Configure Cross,  Up: Cross-Compiler
  6389.  
  6390. Steps of Cross-Compilation
  6391. --------------------------
  6392.  
  6393.    To compile and run a program using a cross-compiler involves several
  6394. steps:
  6395.  
  6396.    * Run the cross-compiler on the host machine to produce assembler
  6397.      files for the target machine.  This requires header files for the
  6398.      target machine.
  6399.  
  6400.    * Assemble the files produced by the cross-compiler.  You can do this
  6401.      either with an assembler on the target machine, or with a
  6402.      cross-assembler on the host machine.
  6403.  
  6404.    * Link those files to make an executable.  You can do this either
  6405.      with a linker on the target machine, or with a cross-linker on the
  6406.      host machine.  Whichever machine you use, you need libraries and
  6407.      certain startup files (typically `crt....o') for the target
  6408.      machine.
  6409.  
  6410.    It is most convenient to do all of these steps on the same host
  6411. machine, since then you can do it all with a single invocation of GNU
  6412. CC.  This requires a suitable cross-assembler and cross-linker.  For
  6413. some targets, the GNU assembler and linker are available.
  6414.  
  6415. 
  6416. File: !gcc.docs.gccuser,  Node: Configure Cross,  Next: Tools and Libraries,  Prev: Steps of Cross,  Up: Cross-Compiler
  6417.  
  6418. Configuring a Cross-Compiler
  6419. ----------------------------
  6420.  
  6421.    To build GNU CC as a cross-compiler, you start out by running
  6422. `configure'.  Use the `--target=TARGET' to specify the target type.  If
  6423. `configure' was unable to correctly identify the system you are running
  6424. on, also specify the `--build=BUILD' option.  For example, here is how
  6425. to configure for a cross-compiler that produces code for an HP 68030
  6426. system running BSD on a system that `configure' can correctly identify:
  6427.  
  6428.      ./configure --target=m68k-hp-bsd4.3
  6429.  
  6430. 
  6431. File: !gcc.docs.gccuser,  Node: Tools and Libraries,  Next: Cross Headers,  Prev: Configure Cross,  Up: Cross-Compiler
  6432.  
  6433. Tools and Libraries for a Cross-Compiler
  6434. ----------------------------------------
  6435.  
  6436.    If you have a cross-assembler and cross-linker available, you should
  6437. install them now.  Put them in the directory `/usr/local/TARGET/bin'.
  6438. Here is a table of the tools you should put in this directory:
  6439.  
  6440. `as'
  6441.      This should be the cross-assembler.
  6442.  
  6443. `ld'
  6444.      This should be the cross-linker.
  6445.  
  6446. `ar'
  6447.      This should be the cross-archiver: a program which can manipulate
  6448.      archive files (linker libraries) in the target machine's format.
  6449.  
  6450. `ranlib'
  6451.      This should be a program to construct a symbol table in an archive
  6452.      file.
  6453.  
  6454.    The installation of GNU CC will find these programs in that
  6455. directory, and copy or link them to the proper place to for the
  6456. cross-compiler to find them when run later.
  6457.  
  6458.    The easiest way to provide these files is to build the Binutils
  6459. package and GAS.  Configure them with the same `--host' and `--target'
  6460. options that you use for configuring GNU CC, then build and install
  6461. them.  They install their executables automatically into the proper
  6462. directory.  Alas, they do not support all the targets that GNU CC
  6463. supports.
  6464.  
  6465.    If you want to install libraries to use with the cross-compiler,
  6466. such as a standard C library, put them in the directory
  6467. `/usr/local/TARGET/lib'; installation of GNU CC copies all all the
  6468. files in that subdirectory into the proper place for GNU CC to find
  6469. them and link with them.  Here's an example of copying some libraries
  6470. from a target machine:
  6471.  
  6472.      ftp TARGET-MACHINE
  6473.      lcd /usr/local/TARGET/lib
  6474.      cd /lib
  6475.      get libc.a
  6476.      cd /usr/lib
  6477.      get libg.a
  6478.      get libm.a
  6479.      quit
  6480.  
  6481. The precise set of libraries you'll need, and their locations on the
  6482. target machine, vary depending on its operating system.
  6483.  
  6484.    Many targets require "start files" such as `crt0.o' and `crtn.o'
  6485. which are linked into each executable; these too should be placed in
  6486. `/usr/local/TARGET/lib'.  There may be several alternatives for
  6487. `crt0.o', for use with profiling or other compilation options.  Check
  6488. your target's definition of `STARTFILE_SPEC' to find out what start
  6489. files it uses.  Here's an example of copying these files from a target
  6490. machine:
  6491.  
  6492.      ftp TARGET-MACHINE
  6493.      lcd /usr/local/TARGET/lib
  6494.      prompt
  6495.      cd /lib
  6496.      mget *crt*.o
  6497.      cd /usr/lib
  6498.      mget *crt*.o
  6499.      quit
  6500.  
  6501. 
  6502. File: !gcc.docs.gccuser,  Node: Cross Runtime,  Next: Build Cross,  Prev: Cross Headers,  Up: Cross-Compiler
  6503.  
  6504. `libgcc.a' and Cross-Compilers
  6505. ------------------------------
  6506.  
  6507.    Code compiled by GNU CC uses certain runtime support functions
  6508. implicitly.  Some of these functions can be compiled successfully with
  6509. GNU CC itself, but a few cannot be.  These problem functions are in the
  6510. source file `libgcc1.c'; the library made from them is called
  6511. `libgcc1.a'.
  6512.  
  6513.    When you build a native compiler, these functions are compiled with
  6514. some other compiler-the one that you use for bootstrapping GNU CC.
  6515. Presumably it knows how to open code these operations, or else knows how
  6516. to call the run-time emulation facilities that the machine comes with.
  6517. But this approach doesn't work for building a cross-compiler.  The
  6518. compiler that you use for building knows about the host system, not the
  6519. target system.
  6520.  
  6521.    So, when you build a cross-compiler you have to supply a suitable
  6522. library `libgcc1.a' that does the job it is expected to do.
  6523.  
  6524.    To compile `libgcc1.c' with the cross-compiler itself does not work.
  6525. The functions in this file are supposed to implement arithmetic
  6526. operations that GNU CC does not know how to open code for your target
  6527. machine.  If these functions are compiled with GNU CC itself, they will
  6528. compile into infinite recursion.
  6529.  
  6530.    On any given target, most of these functions are not needed.  If GNU
  6531. CC can open code an arithmetic operation, it will not call these
  6532. functions to perform the operation.  It is possible that on your target
  6533. machine, none of these functions is needed.  If so, you can supply an
  6534. empty library as `libgcc1.a'.
  6535.  
  6536.    Many targets need library support only for multiplication and
  6537. division.  If you are linking with a library that contains functions for
  6538. multiplication and division, you can tell GNU CC to call them directly
  6539. by defining the macros `MULSI3_LIBCALL', and the like.  These macros
  6540. need to be defined in the target description macro file.  For some
  6541. targets, they are defined already.  This may be sufficient to avoid the
  6542. need for libgcc1.a; if so, you can supply an empty library.
  6543.  
  6544.    Some targets do not have floating point instructions; they need other
  6545. functions in `libgcc1.a', which do floating arithmetic.  Recent
  6546. versions of GNU CC have a file which emulates floating point.  With a
  6547. certain amount of work, you should be able to construct a floating
  6548. point emulator that can be used as `libgcc1.a'.  Perhaps future
  6549. versions will contain code to do this automatically and conveniently.
  6550. That depends on whether someone wants to implement it.
  6551.  
  6552.    Some embedded targets come with all the necessary `libgcc1.a'
  6553. routines written in C or assembler.  These targets build `libgcc1.a'
  6554. automatically and you do not need to do anything special for them.
  6555. Other embedded targets do not need any `libgcc1.a' routines since all
  6556. the necessary operations are supported by the hardware.
  6557.  
  6558.    If your target system has another C compiler, you can configure GNU
  6559. CC as a native compiler on that machine, build just `libgcc1.a' with
  6560. `make libgcc1.a' on that machine, and use the resulting file with the
  6561. cross-compiler.  To do this, execute the following on the target
  6562. machine:
  6563.  
  6564.      cd TARGET-BUILD-DIR
  6565.      ./configure --host=sparc --target=sun3
  6566.      make libgcc1.a
  6567.  
  6568. And then this on the host machine:
  6569.  
  6570.      ftp TARGET-MACHINE
  6571.      binary
  6572.      cd TARGET-BUILD-DIR
  6573.      get libgcc1.a
  6574.      quit
  6575.  
  6576.    Another way to provide the functions you need in `libgcc1.a' is to
  6577. define the appropriate `perform_...' macros for those functions.  If
  6578. these definitions do not use the C arithmetic operators that they are
  6579. meant to implement, you should be able to compile them with the
  6580. cross-compiler you are building.  (If these definitions already exist
  6581. for your target file, then you are all set.)
  6582.  
  6583.    To build `libgcc1.a' using the perform macros, use
  6584. `LIBGCC1=libgcc1.a OLDCC=./xgcc' when building the compiler.
  6585. Otherwise, you should place your replacement library under the name
  6586. `libgcc1.a' in the directory in which you will build the
  6587. cross-compiler, before you run `make'.
  6588.  
  6589. 
  6590. File: !gcc.docs.gccuser,  Node: Cross Headers,  Next: Cross Runtime,  Prev: Tools and Libraries,  Up: Cross-Compiler
  6591.  
  6592. Cross-Compilers and Header Files
  6593. --------------------------------
  6594.  
  6595.    If you are cross-compiling a standalone program or a program for an
  6596. embedded system, then you may not need any header files except the few
  6597. that are part of GNU CC (and those of your program).  However, if you
  6598. intend to link your program with a standard C library such as `libc.a',
  6599. then you probably need to compile with the header files that go with
  6600. the library you use.
  6601.  
  6602.    The GNU C compiler does not come with these files, because (1) they
  6603. are system-specific, and (2) they belong in a C library, not in a
  6604. compiler.
  6605.  
  6606.    If the GNU C library supports your target machine, then you can get
  6607. the header files from there (assuming you actually use the GNU library
  6608. when you link your program).
  6609.  
  6610.    If your target machine comes with a C compiler, it probably comes
  6611. with suitable header files also.  If you make these files accessible
  6612. from the host machine, the cross-compiler can use them also.
  6613.  
  6614.    Otherwise, you're on your own in finding header files to use when
  6615. cross-compiling.
  6616.  
  6617.    When you have found suitable header files, put them in
  6618. `/usr/local/TARGET/include', before building the cross compiler.  Then
  6619. installation will run fixincludes properly and install the corrected
  6620. versions of the header files where the compiler will use them.
  6621.  
  6622.    Provide the header files before you build the cross-compiler, because
  6623. the build stage actually runs the cross-compiler to produce parts of
  6624. `libgcc.a'.  (These are the parts that *can* be compiled with GNU CC.)
  6625. Some of them need suitable header files.
  6626.  
  6627.    Here's an example showing how to copy the header files from a target
  6628. machine.  On the target machine, do this:
  6629.  
  6630.      (cd /usr/include; tar cf - .) > tarfile
  6631.  
  6632.    Then, on the host machine, do this:
  6633.  
  6634.      ftp TARGET-MACHINE
  6635.      lcd /usr/local/TARGET/include
  6636.      get tarfile
  6637.      quit
  6638.      tar xf tarfile
  6639.  
  6640. 
  6641. File: !gcc.docs.gccuser,  Node: Build Cross,  Prev: Cross Runtime,  Up: Cross-Compiler
  6642.  
  6643. Actually Building the Cross-Compiler
  6644. ------------------------------------
  6645.  
  6646.    Now you can proceed just as for compiling a single-machine compiler
  6647. through the step of building stage 1.  If you have not provided some
  6648. sort of `libgcc1.a', then compilation will give up at the point where
  6649. it needs that file, printing a suitable error message.  If you do
  6650. provide `libgcc1.a', then building the compiler will automatically
  6651. compile and link a test program called `libgcc1-test'; if you get
  6652. errors in the linking, it means that not all of the necessary routines
  6653. in `libgcc1.a' are available.
  6654.  
  6655.    You must provide the header file `float.h'.  One way to do this is
  6656. to compile `enquire' and run it on your target machine.  The job of
  6657. `enquire' is to run on the target machine and figure out by experiment
  6658. the nature of its floating point representation.  `enquire' records its
  6659. findings in the header file `float.h'.  If you can't produce this file
  6660. by running `enquire' on the target machine, then you will need to come
  6661. up with a suitable `float.h' in some other way (or else, avoid using it
  6662. in your programs).
  6663.  
  6664.    Do not try to build stage 2 for a cross-compiler.  It doesn't work to
  6665. rebuild GNU CC as a cross-compiler using the cross-compiler, because
  6666. that would produce a program that runs on the target machine, not on the
  6667. host.  For example, if you compile a 386-to-68030 cross-compiler with
  6668. itself, the result will not be right either for the 386 (because it was
  6669. compiled into 68030 code) or for the 68030 (because it was configured
  6670. for a 386 as the host).  If you want to compile GNU CC into 68030 code,
  6671. whether you compile it on a 68030 or with a cross-compiler on a 386, you
  6672. must specify a 68030 as the host when you configure it.
  6673.  
  6674.    To install the cross-compiler, use `make install', as usual.
  6675.  
  6676. 
  6677. File: !gcc.docs.gccuser,  Node: Sun Install,  Next: VMS Install,  Prev: Cross-Compiler,  Up: Installation
  6678.  
  6679. Installing GNU CC on the Sun
  6680. ============================
  6681.  
  6682.    On Solaris (version 2.1), do not use the linker or other tools in
  6683. `/usr/ucb' to build GNU CC.  Use `/usr/ccs/bin'.
  6684.  
  6685.    Make sure the environment variable `FLOAT_OPTION' is not set when
  6686. you compile `libgcc.a'.  If this option were set to `f68881' when
  6687. `libgcc.a' is compiled, the resulting code would demand to be linked
  6688. with a special startup file and would not link properly without special
  6689. pains.
  6690.  
  6691.    There is a bug in `alloca' in certain versions of the Sun library.
  6692. To avoid this bug, install the binaries of GNU CC that were compiled by
  6693. GNU CC.  They use `alloca' as a built-in function and never the one in
  6694. the library.
  6695.  
  6696.    Some versions of the Sun compiler crash when compiling GNU CC.  The
  6697. problem is a segmentation fault in cpp.  This problem seems to be due to
  6698. the bulk of data in the environment variables.  You may be able to avoid
  6699. it by using the following command to compile GNU CC with Sun CC:
  6700.  
  6701.      make CC="TERMCAP=x OBJS=x LIBFUNCS=x STAGESTUFF=x cc"
  6702.  
  6703. 
  6704. File: !gcc.docs.gccuser,  Node: VMS Install,  Next: Collect2,  Prev: Sun Install,  Up: Installation
  6705.  
  6706. Installing GNU CC on VMS
  6707. ========================
  6708.  
  6709.    The VMS version of GNU CC is distributed in a backup saveset
  6710. containing both source code and precompiled binaries.
  6711.  
  6712.    To install the `gcc' command so you can use the compiler easily, in
  6713. the same manner as you use the VMS C compiler, you must install the VMS
  6714. CLD file for GNU CC as follows:
  6715.  
  6716.   1. Define the VMS logical names `GNU_CC' and `GNU_CC_INCLUDE' to
  6717.      point to the directories where the GNU CC executables
  6718.      (`gcc-cpp.exe', `gcc-cc1.exe', etc.) and the C include files are
  6719.      kept respectively.  This should be done with the commands:
  6720.  
  6721.           $ assign /system /translation=concealed -
  6722.             disk:[gcc.] gnu_cc
  6723.           $ assign /system /translation=concealed -
  6724.             disk:[gcc.include.] gnu_cc_include
  6725.  
  6726.      with the appropriate disk and directory names.  These commands can
  6727.      be placed in your system startup file so they will be executed
  6728.      whenever the machine is rebooted.  You may, if you choose, do this
  6729.      via the `GCC_INSTALL.COM' script in the `[GCC]' directory.
  6730.  
  6731.   2. Install the `GCC' command with the command line:
  6732.  
  6733.           $ set command /table=sys$common:[syslib]dcltables -
  6734.             /output=sys$common:[syslib]dcltables gnu_cc:[000000]gcc
  6735.           $ install replace sys$common:[syslib]dcltables
  6736.  
  6737.   3. To install the help file, do the following:
  6738.  
  6739.           $ library/help sys$library:helplib.hlb gcc.hlp
  6740.  
  6741.      Now you can invoke the compiler with a command like `gcc /verbose
  6742.      file.c', which is equivalent to the command `gcc -v -c file.c' in
  6743.      Unix.
  6744.  
  6745.    If you wish to use GNU C++ you must first install GNU CC, and then
  6746. perform the following steps:
  6747.  
  6748.   1. Define the VMS logical name `GNU_GXX_INCLUDE' to point to the
  6749.      directory where the preprocessor will search for the C++ header
  6750.      files.  This can be done with the command:
  6751.  
  6752.           $ assign /system /translation=concealed -
  6753.             disk:[gcc.gxx_include.] gnu_gxx_include
  6754.  
  6755.      with the appropriate disk and directory name.  If you are going to
  6756.      be using libg++, this is where the libg++ install procedure will
  6757.      install the libg++ header files.
  6758.  
  6759.   2. Obtain the file `gcc-cc1plus.exe', and place this in the same
  6760.      directory that `gcc-cc1.exe' is kept.
  6761.  
  6762.      The GNU C++ compiler can be invoked with a command like `gcc /plus
  6763.      /verbose file.cc', which is equivalent to the command `g++ -v -c
  6764.      file.cc' in Unix.
  6765.  
  6766.    We try to put corresponding binaries and sources on the VMS
  6767. distribution tape.  But sometimes the binaries will be from an older
  6768. version than the sources, because we don't always have time to update
  6769. them.  (Use the `/version' option to determine the version number of
  6770. the binaries and compare it with the source file `version.c' to tell
  6771. whether this is so.)  In this case, you should use the binaries you get
  6772. to recompile the sources.  If you must recompile, here is how:
  6773.  
  6774.   1. Execute the command procedure `vmsconfig.com' to set up the files
  6775.      `tm.h', `config.h', `aux-output.c', and `md.', and to create files
  6776.      `tconfig.h' and `hconfig.h'.  This procedure also creates several
  6777.      linker option files used by `make-cc1.com' and a data file used by
  6778.      `make-l2.com'.
  6779.  
  6780.           $ @vmsconfig.com
  6781.  
  6782.   2. Setup the logical names and command tables as defined above.  In
  6783.      addition, define the VMS logical name `GNU_BISON' to point at the
  6784.      to the directories where the Bison executable is kept.  This
  6785.      should be done with the command:
  6786.  
  6787.           $ assign /system /translation=concealed -
  6788.             disk:[bison.] gnu_bison
  6789.  
  6790.      You may, if you choose, use the `INSTALL_BISON.COM' script in the
  6791.      `[BISON]' directory.
  6792.  
  6793.   3. Install the `BISON' command with the command line:
  6794.  
  6795.           $ set command /table=sys$common:[syslib]dcltables -
  6796.             /output=sys$common:[syslib]dcltables -
  6797.             gnu_bison:[000000]bison
  6798.           $ install replace sys$common:[syslib]dcltables
  6799.  
  6800.   4. Type `@make-gcc' to recompile everything (alternatively, submit
  6801.      the file `make-gcc.com' to a batch queue).  If you wish to build
  6802.      the GNU C++ compiler as well as the GNU CC compiler, you must
  6803.      first edit `make-gcc.com' and follow the instructions that appear
  6804.      in the comments.
  6805.  
  6806.   5. In order to use GCC, you need a library of functions which GCC
  6807.      compiled code will call to perform certain tasks, and these
  6808.      functions are defined in the file `libgcc2.c'.  To compile this
  6809.      you should use the command procedure `make-l2.com', which will
  6810.      generate the library `libgcc2.olb'.  `libgcc2.olb' should be built
  6811.      using the compiler built from the same distribution that
  6812.      `libgcc2.c' came from, and `make-gcc.com' will automatically do
  6813.      all of this for you.
  6814.  
  6815.      To install the library, use the following commands:
  6816.  
  6817.           $ library gnu_cc:[000000]gcclib/delete=(new,eprintf)
  6818.           $ library gnu_cc:[000000]gcclib/delete=L_*
  6819.           $ library libgcc2/extract=*/output=libgcc2.obj
  6820.           $ library gnu_cc:[000000]gcclib libgcc2.obj
  6821.  
  6822.      The first command simply removes old modules that will be replaced
  6823.      with modules from `libgcc2' under different module names.  The
  6824.      modules `new' and `eprintf' may not actually be present in your
  6825.      `gcclib.olb'--if the VMS librarian complains about those modules
  6826.      not being present, simply ignore the message and continue on with
  6827.      the next command.  The second command removes the modules that
  6828.      came from the previous version of the library `libgcc2.c'.
  6829.  
  6830.      Whenever you update the compiler on your system, you should also
  6831.      update the library with the above procedure.
  6832.  
  6833.   6. You may wish to build GCC in such a way that no files are written
  6834.      to the directory where the source files reside.  An example would
  6835.      be the when the source files are on a read-only disk.  In these
  6836.      cases, execute the following DCL commands (substituting your
  6837.      actual path names):
  6838.  
  6839.           $ assign dua0:[gcc.build_dir.]/translation=concealed, -
  6840.                    dua1:[gcc.source_dir.]/translation=concealed  gcc_build
  6841.           $ set default gcc_build:[000000]
  6842.  
  6843.      where the directory `dua1:[gcc.source_dir]' contains the source
  6844.      code, and the directory `dua0:[gcc.build_dir]' is meant to contain
  6845.      all of the generated object files and executables.  Once you have
  6846.      done this, you can proceed building GCC as described above.  (Keep
  6847.      in mind that `gcc_build' is a rooted logical name, and thus the
  6848.      device names in each element of the search list must be an actual
  6849.      physical device name rather than another rooted logical name).
  6850.  
  6851.   7. *If you are building GNU CC with a previous version of GNU CC, you
  6852.      also should check to see that you have the newest version of the
  6853.      assembler*.  In particular, GNU CC version 2 treats global constant
  6854.      variables slightly differently from GNU CC version 1, and GAS
  6855.      version 1.38.1 does not have the patches required to work with GCC
  6856.      version 2.  If you use GAS 1.38.1, then `extern const' variables
  6857.      will not have the read-only bit set, and the linker will generate
  6858.      warning messages about mismatched psect attributes for these
  6859.      variables.  These warning messages are merely a nuisance, and can
  6860.      safely be ignored.
  6861.  
  6862.      If you are compiling with a version of GNU CC older than 1.33,
  6863.      specify `/DEFINE=("inline=")' as an option in all the
  6864.      compilations.  This requires editing all the `gcc' commands in
  6865.      `make-cc1.com'.  (The older versions had problems supporting
  6866.      `inline'.)  Once you have a working 1.33 or newer GNU CC, you can
  6867.      change this file back.
  6868.  
  6869.   8. If you want to build GNU CC with the VAX C compiler, you will need
  6870.      to make minor changes in `make-cccp.com' and `make-cc1.com' to
  6871.      choose alternate definitions of `CC', `CFLAGS', and `LIBS'.  See
  6872.      comments in those files.  However, you must also have a working
  6873.      version of the GNU assembler (GNU as, aka GAS) as it is used as
  6874.      the back-end for GNU CC to produce binary object modules and is
  6875.      not included in the GNU CC sources.  GAS is also needed to compile
  6876.      `libgcc2' in order to build `gcclib' (see above); `make-l2.com'
  6877.      expects to be able to find it operational in
  6878.      `gnu_cc:[000000]gnu-as.exe'.
  6879.  
  6880.      To use GNU CC on VMS, you need the VMS driver programs `gcc.exe',
  6881.      `gcc.com', and `gcc.cld'.  They are distributed with the VMS
  6882.      binaries (`gcc-vms') rather than the GNU CC sources.  GAS is also
  6883.      included in `gcc-vms', as is Bison.
  6884.  
  6885.      Once you have successfully built GNU CC with VAX C, you should use
  6886.      the resulting compiler to rebuild itself.  Before doing this, be
  6887.      sure to restore the `CC', `CFLAGS', and `LIBS' definitions in
  6888.      `make-cccp.com' and `make-cc1.com'.  The second generation
  6889.      compiler will be able to take advantage of many optimizations that
  6890.      must be suppressed when building with other compilers.
  6891.  
  6892.    Under previous versions of GNU CC, the generated code would
  6893. occasionally give strange results when linked with the sharable
  6894. `VAXCRTL' library.  Now this should work.
  6895.  
  6896.    Even with this version, however, GNU CC itself should not be linked
  6897. with the sharable `VAXCRTL'.  The version of `qsort' in `VAXCRTL' has a
  6898. bug (known to be present in VMS versions V4.6 through V5.5) which
  6899. causes the compiler to fail.
  6900.  
  6901.    The executables are generated by `make-cc1.com' and `make-cccp.com'
  6902. use the object library version of `VAXCRTL' in order to make use of the
  6903. `qsort' routine in `gcclib.olb'.  If you wish to link the compiler
  6904. executables with the shareable image version of `VAXCRTL', you should
  6905. edit the file `tm.h' (created by `vmsconfig.com') to define the macro
  6906. `QSORT_WORKAROUND'.
  6907.  
  6908.    `QSORT_WORKAROUND' is always defined when GNU CC is compiled with
  6909. VAX C, to avoid a problem in case `gcclib.olb' is not yet available.
  6910.  
  6911. 
  6912. File: !gcc.docs.gccuser,  Node: Collect2,  Next: Header Dirs,  Prev: VMS Install,  Up: Installation
  6913.  
  6914. `collect2'
  6915. ==========
  6916.  
  6917.    Many target systems do not have support in the assembler and linker
  6918. for "constructors"--initialization functions to be called before the
  6919. official "start" of `main'.  On such systems, GNU CC uses a utility
  6920. called `collect2' to arrange to call these functions at start time.
  6921.  
  6922.    The program `collect2' works by linking the program once and looking
  6923. through the linker output file for symbols with particular names
  6924. indicating they are constructor functions.  If it finds any, it creates
  6925. a new temporary `.c' file containing a table of them, compiles it, and
  6926. links the program a second time including that file.
  6927.  
  6928.    The actual calls to the constructors are carried out by a subroutine
  6929. called `__main', which is called (automatically) at the beginning of
  6930. the body of `main' (provided `main' was compiled with GNU CC).  Calling
  6931. `__main' is necessary, even when compiling C code, to allow linking C
  6932. and C++ object code together.  (If you use `-nostdlib', you get an
  6933. unresolved reference to `__main', since it's defined in the standard
  6934. GCC library.  Include `-lgcc' at the end of your compiler command line
  6935. to resolve this reference.)
  6936.  
  6937.    The program `collect2' is installed as `ld' in the directory where
  6938. the passes of the compiler are installed.  When `collect2' needs to
  6939. find the *real* `ld', it tries the following file names:
  6940.  
  6941.    * `real-ld' in the directories listed in the compiler's search
  6942.      directories.
  6943.  
  6944.    * `real-ld' in the directories listed in the environment variable
  6945.      `PATH'.
  6946.  
  6947.    * The file specified in the `REAL_LD_FILE_NAME' configuration macro,
  6948.      if specified.
  6949.  
  6950.    * `ld' in the compiler's search directories, except that `collect2'
  6951.      will not execute itself recursively.
  6952.  
  6953.    * `ld' in `PATH'.
  6954.  
  6955.    "The compiler's search directories" means all the directories where
  6956. `gcc' searches for passes of the compiler.  This includes directories
  6957. that you specify with `-B'.
  6958.  
  6959.    Cross-compilers search a little differently:
  6960.  
  6961.    * `real-ld' in the compiler's search directories.
  6962.  
  6963.    * `TARGET-real-ld' in `PATH'.
  6964.  
  6965.    * The file specified in the `REAL_LD_FILE_NAME' configuration macro,
  6966.      if specified.
  6967.  
  6968.    * `ld' in the compiler's search directories.
  6969.  
  6970.    * `TARGET-ld' in `PATH'.
  6971.  
  6972.    `collect2' explicitly avoids running `ld' using the file name under
  6973. which `collect2' itself was invoked.  In fact, it remembers up a list
  6974. of such names--in case one copy of `collect2' finds another copy (or
  6975. version) of `collect2' installed as `ld' in a second place in the
  6976. search path.
  6977.  
  6978.    `collect2' searches for the utilities `nm' and `strip' using the
  6979. same algorithm as above for `ld'.
  6980.  
  6981. 
  6982. File: !gcc.docs.gccuser,  Node: Header Dirs,  Prev: Collect2,  Up: Installation
  6983.  
  6984. Standard Header File Directories
  6985. ================================
  6986.  
  6987.    `GCC_INCLUDE_DIR' means the same thing for native and cross.  It is
  6988. where GNU CC stores its private include files, and also where GNU CC
  6989. stores the fixed include files.  A cross compiled GNU CC runs
  6990. `fixincludes' on the header files in `$(tooldir)/include'.  (If the
  6991. cross compilation header files need to be fixed, they must be installed
  6992. before GNU CC is built.  If the cross compilation header files are
  6993. already suitable for ANSI C and GNU CC, nothing special need be done).
  6994.  
  6995.    `GPLUS_INCLUDE_DIR' means the same thing for native and cross.  It
  6996. is where `g++' looks first for header files.  `libg++' installs only
  6997. target independent header files in that directory.
  6998.  
  6999.    `LOCAL_INCLUDE_DIR' is used only for a native compiler.  It is
  7000. normally `/usr/local/include'.  GNU CC searches this directory so that
  7001. users can install header files in `/usr/local/include'.
  7002.  
  7003.    `CROSS_INCLUDE_DIR' is used only for a cross compiler.  GNU CC
  7004. doesn't install anything there.
  7005.  
  7006.    `TOOL_INCLUDE_DIR' is used for both native and cross compilers.  It
  7007. is the place for other packages to install header files that GNU CC will
  7008. use.  For a cross-compiler, this is the equivalent of `/usr/include'.
  7009. When you build a cross-compiler, `fixincludes' processes any header
  7010. files in this directory.
  7011.  
  7012. 
  7013. File: !gcc.docs.gccuser,  Node: C Extensions,  Next: C++ Extensions,  Prev: Installation,  Up: Top
  7014.  
  7015. Extensions to the C Language Family
  7016. ***********************************
  7017.  
  7018.    GNU C provides several language features not found in ANSI standard
  7019. C.  (The `-pedantic' option directs GNU CC to print a warning message if
  7020. any of these features is used.)  To test for the availability of these
  7021. features in conditional compilation, check for a predefined macro
  7022. `__GNUC__', which is always defined under GNU CC.
  7023.  
  7024.    These extensions are available in C and Objective C.  Most of them
  7025. are also available in C++.  *Note Extensions to the C++ Language: C++
  7026. Extensions, for extensions that apply *only* to C++.
  7027.  
  7028. * Menu:
  7029.  
  7030. * Statement Exprs::     Putting statements and declarations inside expressions.
  7031. * Local Labels::        Labels local to a statement-expression.
  7032. * Labels as Values::    Getting pointers to labels, and computed gotos.
  7033. * Nested Functions::    As in Algol and Pascal, lexical scoping of functions.
  7034. * Constructing Calls::    Dispatching a call to another function.
  7035. * Naming Types::        Giving a name to the type of some expression.
  7036. * Typeof::              `typeof': referring to the type of an expression.
  7037. * Lvalues::             Using `?:', `,' and casts in lvalues.
  7038. * Conditionals::        Omitting the middle operand of a `?:' expression.
  7039. * Long Long::        Double-word integers--`long long int'.
  7040. * Complex::             Data types for complex numbers.
  7041. * Zero Length::         Zero-length arrays.
  7042. * Variable Length::     Arrays whose length is computed at run time.
  7043. * Macro Varargs::    Macros with variable number of arguments.
  7044. * Subscripting::        Any array can be subscripted, even if not an lvalue.
  7045. * Pointer Arith::       Arithmetic on `void'-pointers and function pointers.
  7046. * Initializers::        Non-constant initializers.
  7047. * Constructors::        Constructor expressions give structures, unions
  7048.                          or arrays as values.
  7049. * Labeled Elements::    Labeling elements of initializers.
  7050. * Cast to Union::       Casting to union type from any member of the union.
  7051. * Case Ranges::        `case 1 ... 9' and such.
  7052. * Function Attributes:: Declaring that functions have no side effects,
  7053.                          or that they can never return.
  7054. * Function Prototypes:: Prototype declarations and old-style definitions.
  7055. * C++ Comments::        C++ comments are recognized.
  7056. * Dollar Signs::        Dollar sign is allowed in identifiers.
  7057. * Character Escapes::   `\e' stands for the character ESC.
  7058. * Variable Attributes::    Specifying attributes of variables.
  7059. * Type Attributes::    Specifying attributes of types.
  7060. * Alignment::           Inquiring about the alignment of a type or variable.
  7061. * Inline::              Defining inline functions (as fast as macros).
  7062. * Extended Asm::        Assembler instructions with C expressions as operands.
  7063.                          (With them you can define "built-in" functions.)
  7064. * Constraints::         Constraints for asm operands
  7065. * Asm Labels::          Specifying the assembler name to use for a C symbol.
  7066. * Explicit Reg Vars::   Defining variables residing in specified registers.
  7067. * Alternate Keywords::  `__const__', `__asm__', etc., for header files.
  7068. * Incomplete Enums::    `enum foo;', with details to follow.
  7069. * Function Names::    Printable strings which are the name of the current
  7070.              function.
  7071.  
  7072. 
  7073. File: !gcc.docs.gccuser,  Node: Statement Exprs,  Next: Local Labels,  Up: C Extensions
  7074.  
  7075. Statements and Declarations in Expressions
  7076. ==========================================
  7077.  
  7078.    A compound statement enclosed in parentheses may appear as an
  7079. expression in GNU C.  This allows you to use loops, switches, and local
  7080. variables within an expression.
  7081.  
  7082.    Recall that a compound statement is a sequence of statements
  7083. surrounded by braces; in this construct, parentheses go around the
  7084. braces.  For example:
  7085.  
  7086.      ({ int y = foo (); int z;
  7087.         if (y > 0) z = y;
  7088.         else z = - y;
  7089.         z; })
  7090.  
  7091. is a valid (though slightly more complex than necessary) expression for
  7092. the absolute value of `foo ()'.
  7093.  
  7094.    The last thing in the compound statement should be an expression
  7095. followed by a semicolon; the value of this subexpression serves as the
  7096. value of the entire construct.  (If you use some other kind of statement
  7097. last within the braces, the construct has type `void', and thus
  7098. effectively no value.)
  7099.  
  7100.    This feature is especially useful in making macro definitions "safe"
  7101. (so that they evaluate each operand exactly once).  For example, the
  7102. "maximum" function is commonly defined as a macro in standard C as
  7103. follows:
  7104.  
  7105.      #define max(a,b) ((a) > (b) ? (a) : (b))
  7106.  
  7107. But this definition computes either A or B twice, with bad results if
  7108. the operand has side effects.  In GNU C, if you know the type of the
  7109. operands (here let's assume `int'), you can define the macro safely as
  7110. follows:
  7111.  
  7112.      #define maxint(a,b) \
  7113.        ({int _a = (a), _b = (b); _a > _b ? _a : _b; })
  7114.  
  7115.    Embedded statements are not allowed in constant expressions, such as
  7116. the value of an enumeration constant, the width of a bit field, or the
  7117. initial value of a static variable.
  7118.  
  7119.    If you don't know the type of the operand, you can still do this,
  7120. but you must use `typeof' (*note Typeof::.) or type naming (*note
  7121. Naming Types::.).
  7122.  
  7123. 
  7124. File: !gcc.docs.gccuser,  Node: Local Labels,  Next: Labels as Values,  Prev: Statement Exprs,  Up: C Extensions
  7125.  
  7126. Locally Declared Labels
  7127. =======================
  7128.  
  7129.    Each statement expression is a scope in which "local labels" can be
  7130. declared.  A local label is simply an identifier; you can jump to it
  7131. with an ordinary `goto' statement, but only from within the statement
  7132. expression it belongs to.
  7133.  
  7134.    A local label declaration looks like this:
  7135.  
  7136.      __label__ LABEL;
  7137.  
  7138. or
  7139.  
  7140.      __label__ LABEL1, LABEL2, ...;
  7141.  
  7142.    Local label declarations must come at the beginning of the statement
  7143. expression, right after the `({', before any ordinary declarations.
  7144.  
  7145.    The label declaration defines the label *name*, but does not define
  7146. the label itself.  You must do this in the usual way, with `LABEL:',
  7147. within the statements of the statement expression.
  7148.  
  7149.    The local label feature is useful because statement expressions are
  7150. often used in macros.  If the macro contains nested loops, a `goto' can
  7151. be useful for breaking out of them.  However, an ordinary label whose
  7152. scope is the whole function cannot be used: if the macro can be
  7153. expanded several times in one function, the label will be multiply
  7154. defined in that function.  A local label avoids this problem.  For
  7155. example:
  7156.  
  7157.      #define SEARCH(array, target)                     \
  7158.      ({                                               \
  7159.        __label__ found;                                \
  7160.        typeof (target) _SEARCH_target = (target);      \
  7161.        typeof (*(array)) *_SEARCH_array = (array);     \
  7162.        int i, j;                                       \
  7163.        int value;                                      \
  7164.        for (i = 0; i < max; i++)                       \
  7165.          for (j = 0; j < max; j++)                     \
  7166.            if (_SEARCH_array[i][j] == _SEARCH_target)  \
  7167.              { value = i; goto found; }              \
  7168.        value = -1;                                     \
  7169.       found:                                           \
  7170.        value;                                          \
  7171.      })
  7172.  
  7173. 
  7174. File: !gcc.docs.gccuser,  Node: Labels as Values,  Next: Nested Functions,  Prev: Local Labels,  Up: C Extensions
  7175.  
  7176. Labels as Values
  7177. ================
  7178.  
  7179.    You can get the address of a label defined in the current function
  7180. (or a containing function) with the unary operator `&&'.  The value has
  7181. type `void *'.  This value is a constant and can be used wherever a
  7182. constant of that type is valid.  For example:
  7183.  
  7184.      void *ptr;
  7185.      ...
  7186.      ptr = &&foo;
  7187.  
  7188.    To use these values, you need to be able to jump to one.  This is
  7189. done with the computed goto statement(1), `goto *EXP;'.  For example,
  7190.  
  7191.      goto *ptr;
  7192.  
  7193. Any expression of type `void *' is allowed.
  7194.  
  7195.    One way of using these constants is in initializing a static array
  7196. that will serve as a jump table:
  7197.  
  7198.      static void *array[] = { &&foo, &&bar, &&hack };
  7199.  
  7200.    Then you can select a label with indexing, like this:
  7201.  
  7202.      goto *array[i];
  7203.  
  7204. Note that this does not check whether the subscript is in bounds--array
  7205. indexing in C never does that.
  7206.  
  7207.    Such an array of label values serves a purpose much like that of the
  7208. `switch' statement.  The `switch' statement is cleaner, so use that
  7209. rather than an array unless the problem does not fit a `switch'
  7210. statement very well.
  7211.  
  7212.    Another use of label values is in an interpreter for threaded code.
  7213. The labels within the interpreter function can be stored in the
  7214. threaded code for super-fast dispatching.
  7215.  
  7216.    You can use this mechanism to jump to code in a different function.
  7217. If you do that, totally unpredictable things will happen.  The best way
  7218. to avoid this is to store the label address only in automatic variables
  7219. and never pass it as an argument.
  7220.  
  7221.    ---------- Footnotes ----------
  7222.  
  7223.    (1)  The analogous feature in Fortran is called an assigned goto,
  7224. but that name seems inappropriate in C, where one can do more than
  7225. simply store label addresses in label variables.
  7226.  
  7227. 
  7228. File: !gcc.docs.gccuser,  Node: Nested Functions,  Next: Constructing Calls,  Prev: Labels as Values,  Up: C Extensions
  7229.  
  7230. Nested Functions
  7231. ================
  7232.  
  7233.    A "nested function" is a function defined inside another function.
  7234. (Nested functions are not supported for GNU C++.)  The nested function's
  7235. name is local to the block where it is defined.  For example, here we
  7236. define a nested function named `square', and call it twice:
  7237.  
  7238.      foo (double a, double b)
  7239.      {
  7240.        double square (double z) { return z * z; }
  7241.      
  7242.        return square (a) + square (b);
  7243.      }
  7244.  
  7245.    The nested function can access all the variables of the containing
  7246. function that are visible at the point of its definition.  This is
  7247. called "lexical scoping".  For example, here we show a nested function
  7248. which uses an inherited variable named `offset':
  7249.  
  7250.      bar (int *array, int offset, int size)
  7251.      {
  7252.        int access (int *array, int index)
  7253.          { return array[index + offset]; }
  7254.        int i;
  7255.        ...
  7256.        for (i = 0; i < size; i++)
  7257.          ... access (array, i) ...
  7258.      }
  7259.  
  7260.    Nested function definitions are permitted within functions in the
  7261. places where variable definitions are allowed; that is, in any block,
  7262. before the first statement in the block.
  7263.  
  7264.    It is possible to call the nested function from outside the scope of
  7265. its name by storing its address or passing the address to another
  7266. function:
  7267.  
  7268.      hack (int *array, int size)
  7269.      {
  7270.        void store (int index, int value)
  7271.          { array[index] = value; }
  7272.      
  7273.        intermediate (store, size);
  7274.      }
  7275.  
  7276.    Here, the function `intermediate' receives the address of `store' as
  7277. an argument.  If `intermediate' calls `store', the arguments given to
  7278. `store' are used to store into `array'.  But this technique works only
  7279. so long as the containing function (`hack', in this example) does not
  7280. exit.
  7281.  
  7282.    If you try to call the nested function through its address after the
  7283. containing function has exited, all hell will break loose.  If you try
  7284. to call it after a containing scope level has exited, and if it refers
  7285. to some of the variables that are no longer in scope, you may be lucky,
  7286. but it's not wise to take the risk.  If, however, the nested function
  7287. does not refer to anything that has gone out of scope, you should be
  7288. safe.
  7289.  
  7290.    GNU CC implements taking the address of a nested function using a
  7291. technique called "trampolines".  A paper describing them is available
  7292. from `maya.idiap.ch' in directory `pub/tmb', file `usenix88-lexic.ps.Z'.
  7293.  
  7294.    A nested function can jump to a label inherited from a containing
  7295. function, provided the label was explicitly declared in the containing
  7296. function (*note Local Labels::.).  Such a jump returns instantly to the
  7297. containing function, exiting the nested function which did the `goto'
  7298. and any intermediate functions as well.  Here is an example:
  7299.  
  7300.      bar (int *array, int offset, int size)
  7301.      {
  7302.        __label__ failure;
  7303.        int access (int *array, int index)
  7304.          {
  7305.            if (index > size)
  7306.              goto failure;
  7307.            return array[index + offset];
  7308.          }
  7309.        int i;
  7310.        ...
  7311.        for (i = 0; i < size; i++)
  7312.          ... access (array, i) ...
  7313.        ...
  7314.        return 0;
  7315.      
  7316.       /* Control comes here from `access'
  7317.          if it detects an error.  */
  7318.       failure:
  7319.        return -1;
  7320.      }
  7321.  
  7322.    A nested function always has internal linkage.  Declaring one with
  7323. `extern' is erroneous.  If you need to declare the nested function
  7324. before its definition, use `auto' (which is otherwise meaningless for
  7325. function declarations).
  7326.  
  7327.      bar (int *array, int offset, int size)
  7328.      {
  7329.        __label__ failure;
  7330.        auto int access (int *, int);
  7331.        ...
  7332.        int access (int *array, int index)
  7333.          {
  7334.            if (index > size)
  7335.              goto failure;
  7336.            return array[index + offset];
  7337.          }
  7338.        ...
  7339.      }
  7340.  
  7341. 
  7342. File: !gcc.docs.gccuser,  Node: Constructing Calls,  Next: Naming Types,  Prev: Nested Functions,  Up: C Extensions
  7343.  
  7344. Constructing Function Calls
  7345. ===========================
  7346.  
  7347.    Using the built-in functions described below, you can record the
  7348. arguments a function received, and call another function with the same
  7349. arguments, without knowing the number or types of the arguments.
  7350.  
  7351.    You can also record the return value of that function call, and
  7352. later return that value, without knowing what data type the function
  7353. tried to return (as long as your caller expects that data type).
  7354.  
  7355. `__builtin_apply_args ()'
  7356.      This built-in function returns a pointer of type `void *' to data
  7357.      describing how to perform a call with the same arguments as were
  7358.      passed to the current function.
  7359.  
  7360.      The function saves the arg pointer register, structure value
  7361.      address, and all registers that might be used to pass arguments to
  7362.      a function into a block of memory allocated on the stack.  Then it
  7363.      returns the address of that block.
  7364.  
  7365. `__builtin_apply (FUNCTION, ARGUMENTS, SIZE)'
  7366.      This built-in function invokes FUNCTION (type `void (*)()') with a
  7367.      copy of the parameters described by ARGUMENTS (type `void *') and
  7368.      SIZE (type `int').
  7369.  
  7370.      The value of ARGUMENTS should be the value returned by
  7371.      `__builtin_apply_args'.  The argument SIZE specifies the size of
  7372.      the stack argument data, in bytes.
  7373.  
  7374.      This function returns a pointer of type `void *' to data describing
  7375.      how to return whatever value was returned by FUNCTION.  The data
  7376.      is saved in a block of memory allocated on the stack.
  7377.  
  7378.      It is not always simple to compute the proper value for SIZE.  The
  7379.      value is used by `__builtin_apply' to compute the amount of data
  7380.      that should be pushed on the stack and copied from the incoming
  7381.      argument area.
  7382.  
  7383. `__builtin_return (RESULT)'
  7384.      This built-in function returns the value described by RESULT from
  7385.      the containing function.  You should specify, for RESULT, a value
  7386.      returned by `__builtin_apply'.
  7387.  
  7388. 
  7389. File: !gcc.docs.gccuser,  Node: Naming Types,  Next: Typeof,  Prev: Constructing Calls,  Up: C Extensions
  7390.  
  7391. Naming an Expression's Type
  7392. ===========================
  7393.  
  7394.    You can give a name to the type of an expression using a `typedef'
  7395. declaration with an initializer.  Here is how to define NAME as a type
  7396. name for the type of EXP:
  7397.  
  7398.      typedef NAME = EXP;
  7399.  
  7400.    This is useful in conjunction with the statements-within-expressions
  7401. feature.  Here is how the two together can be used to define a safe
  7402. "maximum" macro that operates on any arithmetic type:
  7403.  
  7404.      #define max(a,b) \
  7405.        ({typedef _ta = (a), _tb = (b);  \
  7406.          _ta _a = (a); _tb _b = (b);     \
  7407.          _a > _b ? _a : _b; })
  7408.  
  7409.    The reason for using names that start with underscores for the local
  7410. variables is to avoid conflicts with variable names that occur within
  7411. the expressions that are substituted for `a' and `b'.  Eventually we
  7412. hope to design a new form of declaration syntax that allows you to
  7413. declare variables whose scopes start only after their initializers;
  7414. this will be a more reliable way to prevent such conflicts.
  7415.  
  7416. 
  7417. File: !gcc.docs.gccuser,  Node: Typeof,  Next: Lvalues,  Prev: Naming Types,  Up: C Extensions
  7418.  
  7419. Referring to a Type with `typeof'
  7420. =================================
  7421.  
  7422.    Another way to refer to the type of an expression is with `typeof'.
  7423. The syntax of using of this keyword looks like `sizeof', but the
  7424. construct acts semantically like a type name defined with `typedef'.
  7425.  
  7426.    There are two ways of writing the argument to `typeof': with an
  7427. expression or with a type.  Here is an example with an expression:
  7428.  
  7429.      typeof (x[0](1))
  7430.  
  7431. This assumes that `x' is an array of functions; the type described is
  7432. that of the values of the functions.
  7433.  
  7434.    Here is an example with a typename as the argument:
  7435.  
  7436.      typeof (int *)
  7437.  
  7438. Here the type described is that of pointers to `int'.
  7439.  
  7440.    If you are writing a header file that must work when included in
  7441. ANSI C programs, write `__typeof__' instead of `typeof'.  *Note
  7442. Alternate Keywords::.
  7443.  
  7444.    A `typeof'-construct can be used anywhere a typedef name could be
  7445. used.  For example, you can use it in a declaration, in a cast, or
  7446. inside of `sizeof' or `typeof'.
  7447.  
  7448.    * This declares `y' with the type of what `x' points to.
  7449.  
  7450.           typeof (*x) y;
  7451.  
  7452.    * This declares `y' as an array of such values.
  7453.  
  7454.           typeof (*x) y[4];
  7455.  
  7456.    * This declares `y' as an array of pointers to characters:
  7457.  
  7458.           typeof (typeof (char *)[4]) y;
  7459.  
  7460.      It is equivalent to the following traditional C declaration:
  7461.  
  7462.           char *y[4];
  7463.  
  7464.      To see the meaning of the declaration using `typeof', and why it
  7465.      might be a useful way to write, let's rewrite it with these macros:
  7466.  
  7467.           #define pointer(T)  typeof(T *)
  7468.           #define array(T, N) typeof(T [N])
  7469.  
  7470.      Now the declaration can be rewritten this way:
  7471.  
  7472.           array (pointer (char), 4) y;
  7473.  
  7474.      Thus, `array (pointer (char), 4)' is the type of arrays of 4
  7475.      pointers to `char'.
  7476.  
  7477. 
  7478. File: !gcc.docs.gccuser,  Node: Lvalues,  Next: Conditionals,  Prev: Typeof,  Up: C Extensions
  7479.  
  7480. Generalized Lvalues
  7481. ===================
  7482.  
  7483.    Compound expressions, conditional expressions and casts are allowed
  7484. as lvalues provided their operands are lvalues.  This means that you
  7485. can take their addresses or store values into them.
  7486.  
  7487.    Standard C++ allows compound expressions and conditional expressions
  7488. as lvalues, and permits casts to reference type, so use of this
  7489. extension is deprecated for C++ code.
  7490.  
  7491.    For example, a compound expression can be assigned, provided the last
  7492. expression in the sequence is an lvalue.  These two expressions are
  7493. equivalent:
  7494.  
  7495.      (a, b) += 5
  7496.      a, (b += 5)
  7497.  
  7498.    Similarly, the address of the compound expression can be taken.
  7499. These two expressions are equivalent:
  7500.  
  7501.      &(a, b)
  7502.      a, &b
  7503.  
  7504.    A conditional expression is a valid lvalue if its type is not void
  7505. and the true and false branches are both valid lvalues.  For example,
  7506. these two expressions are equivalent:
  7507.  
  7508.      (a ? b : c) = 5
  7509.      (a ? b = 5 : (c = 5))
  7510.  
  7511.    A cast is a valid lvalue if its operand is an lvalue.  A simple
  7512. assignment whose left-hand side is a cast works by converting the
  7513. right-hand side first to the specified type, then to the type of the
  7514. inner left-hand side expression.  After this is stored, the value is
  7515. converted back to the specified type to become the value of the
  7516. assignment.  Thus, if `a' has type `char *', the following two
  7517. expressions are equivalent:
  7518.  
  7519.      (int)a = 5
  7520.      (int)(a = (char *)(int)5)
  7521.  
  7522.    An assignment-with-arithmetic operation such as `+=' applied to a
  7523. cast performs the arithmetic using the type resulting from the cast,
  7524. and then continues as in the previous case.  Therefore, these two
  7525. expressions are equivalent:
  7526.  
  7527.      (int)a += 5
  7528.      (int)(a = (char *)(int) ((int)a + 5))
  7529.  
  7530.    You cannot take the address of an lvalue cast, because the use of its
  7531. address would not work out coherently.  Suppose that `&(int)f' were
  7532. permitted, where `f' has type `float'.  Then the following statement
  7533. would try to store an integer bit-pattern where a floating point number
  7534. belongs:
  7535.  
  7536.      *&(int)f = 1;
  7537.  
  7538.    This is quite different from what `(int)f = 1' would do--that would
  7539. convert 1 to floating point and store it.  Rather than cause this
  7540. inconsistency, we think it is better to prohibit use of `&' on a cast.
  7541.  
  7542.    If you really do want an `int *' pointer with the address of `f',
  7543. you can simply write `(int *)&f'.
  7544.  
  7545. 
  7546. File: !gcc.docs.gccuser,  Node: Conditionals,  Next: Long Long,  Prev: Lvalues,  Up: C Extensions
  7547.  
  7548. Conditionals with Omitted Operands
  7549. ==================================
  7550.  
  7551.    The middle operand in a conditional expression may be omitted.  Then
  7552. if the first operand is nonzero, its value is the value of the
  7553. conditional expression.
  7554.  
  7555.    Therefore, the expression
  7556.  
  7557.      x ? : y
  7558.  
  7559. has the value of `x' if that is nonzero; otherwise, the value of `y'.
  7560.  
  7561.    This example is perfectly equivalent to
  7562.  
  7563.      x ? x : y
  7564.  
  7565. In this simple case, the ability to omit the middle operand is not
  7566. especially useful.  When it becomes useful is when the first operand
  7567. does, or may (if it is a macro argument), contain a side effect.  Then
  7568. repeating the operand in the middle would perform the side effect
  7569. twice.  Omitting the middle operand uses the value already computed
  7570. without the undesirable effects of recomputing it.
  7571.  
  7572. 
  7573. File: !gcc.docs.gccuser,  Node: Long Long,  Next: Complex,  Prev: Conditionals,  Up: C Extensions
  7574.  
  7575. Double-Word Integers
  7576. ====================
  7577.  
  7578.    GNU C supports data types for integers that are twice as long as
  7579. `long int'.  Simply write `long long int' for a signed integer, or
  7580. `unsigned long long int' for an unsigned integer.  To make an integer
  7581. constant of type `long long int', add the suffix `LL' to the integer.
  7582. To make an integer constant of type `unsigned long long int', add the
  7583. suffix `ULL' to the integer.
  7584.  
  7585.    You can use these types in arithmetic like any other integer types.
  7586. Addition, subtraction, and bitwise boolean operations on these types
  7587. are open-coded on all types of machines.  Multiplication is open-coded
  7588. if the machine supports fullword-to-doubleword a widening multiply
  7589. instruction.  Division and shifts are open-coded only on machines that
  7590. provide special support.  The operations that are not open-coded use
  7591. special library routines that come with GNU CC.
  7592.  
  7593.    There may be pitfalls when you use `long long' types for function
  7594. arguments, unless you declare function prototypes.  If a function
  7595. expects type `int' for its argument, and you pass a value of type `long
  7596. long int', confusion will result because the caller and the subroutine
  7597. will disagree about the number of bytes for the argument.  Likewise, if
  7598. the function expects `long long int' and you pass `int'.  The best way
  7599. to avoid such problems is to use prototypes.
  7600.  
  7601. 
  7602. File: !gcc.docs.gccuser,  Node: Complex,  Next: Zero Length,  Prev: Long Long,  Up: C Extensions
  7603.  
  7604. Complex Numbers
  7605. ===============
  7606.  
  7607.    GNU C supports complex data types.  You can declare both complex
  7608. integer types and complex floating types, using the keyword
  7609. `__complex__'.
  7610.  
  7611.    For example, `__complex__ double x;' declares `x' as a variable
  7612. whose real part and imaginary part are both of type `double'.
  7613. `__complex__ short int y;' declares `y' to have real and imaginary
  7614. parts of type `short int'; this is not likely to be useful, but it
  7615. shows that the set of complex types is complete.
  7616.  
  7617.    To write a constant with a complex data type, use the suffix `i' or
  7618. `j' (either one; they are equivalent).  For example, `2.5fi' has type
  7619. `__complex__ float' and `3i' has type `__complex__ int'.  Such a
  7620. constant always has a pure imaginary value, but you can form any
  7621. complex value you like by adding one to a real constant.
  7622.  
  7623.    To extract the real part of a complex-valued expression EXP, write
  7624. `__real__ EXP'.  Likewise, use `__imag__' to extract the imaginary part.
  7625.  
  7626.    The operator `~' performs complex conjugation when used on a value
  7627. with a complex type.
  7628.  
  7629.    GNU CC can allocate complex automatic variables in a noncontiguous
  7630. fashion; it's even possible for the real part to be in a register while
  7631. the imaginary part is on the stack (or vice-versa).  None of the
  7632. supported debugging info formats has a way to represent noncontiguous
  7633. allocation like this, so GNU CC describes a noncontiguous complex
  7634. variable as if it were two separate variables of noncomplex type.  If
  7635. the variable's actual name is `foo', the two fictitious variables are
  7636. named `foo$real' and `foo$imag'.  You can examine and set these two
  7637. fictitious variables with your debugger.
  7638.  
  7639.    A future version of GDB will know how to recognize such pairs and
  7640. treat them as a single variable with a complex type.
  7641.  
  7642. 
  7643. File: !gcc.docs.gccuser,  Node: Zero Length,  Next: Variable Length,  Prev: Complex,  Up: C Extensions
  7644.  
  7645. Arrays of Length Zero
  7646. =====================
  7647.  
  7648.    Zero-length arrays are allowed in GNU C.  They are very useful as
  7649. the last element of a structure which is really a header for a
  7650. variable-length object:
  7651.  
  7652.      struct line {
  7653.        int length;
  7654.        char contents[0];
  7655.      };
  7656.      
  7657.      {
  7658.        struct line *thisline = (struct line *)
  7659.          malloc (sizeof (struct line) + this_length);
  7660.        thisline->length = this_length;
  7661.      }
  7662.  
  7663.    In standard C, you would have to give `contents' a length of 1, which
  7664. means either you waste space or complicate the argument to `malloc'.
  7665.  
  7666. 
  7667. File: !gcc.docs.gccuser,  Node: Variable Length,  Next: Macro Varargs,  Prev: Zero Length,  Up: C Extensions
  7668.  
  7669. Arrays of Variable Length
  7670. =========================
  7671.  
  7672.    Variable-length automatic arrays are allowed in GNU C.  These arrays
  7673. are declared like any other automatic arrays, but with a length that is
  7674. not a constant expression.  The storage is allocated at the point of
  7675. declaration and deallocated when the brace-level is exited.  For
  7676. example:
  7677.  
  7678.      FILE *
  7679.      concat_fopen (char *s1, char *s2, char *mode)
  7680.      {
  7681.        char str[strlen (s1) + strlen (s2) + 1];
  7682.        strcpy (str, s1);
  7683.        strcat (str, s2);
  7684.        return fopen (str, mode);
  7685.      }
  7686.  
  7687.    Jumping or breaking out of the scope of the array name deallocates
  7688. the storage.  Jumping into the scope is not allowed; you get an error
  7689. message for it.
  7690.  
  7691.    You can use the function `alloca' to get an effect much like
  7692. variable-length arrays.  The function `alloca' is available in many
  7693. other C implementations (but not in all).  On the other hand,
  7694. variable-length arrays are more elegant.
  7695.  
  7696.    There are other differences between these two methods.  Space
  7697. allocated with `alloca' exists until the containing *function* returns.
  7698. The space for a variable-length array is deallocated as soon as the
  7699. array name's scope ends.  (If you use both variable-length arrays and
  7700. `alloca' in the same function, deallocation of a variable-length array
  7701. will also deallocate anything more recently allocated with `alloca'.)
  7702.  
  7703.    You can also use variable-length arrays as arguments to functions:
  7704.  
  7705.      struct entry
  7706.      tester (int len, char data[len][len])
  7707.      {
  7708.        ...
  7709.      }
  7710.  
  7711.    The length of an array is computed once when the storage is allocated
  7712. and is remembered for the scope of the array in case you access it with
  7713. `sizeof'.
  7714.  
  7715.    If you want to pass the array first and the length afterward, you can
  7716. use a forward declaration in the parameter list--another GNU extension.
  7717.  
  7718.      struct entry
  7719.      tester (int len; char data[len][len], int len)
  7720.      {
  7721.        ...
  7722.      }
  7723.  
  7724.    The `int len' before the semicolon is a "parameter forward
  7725. declaration", and it serves the purpose of making the name `len' known
  7726. when the declaration of `data' is parsed.
  7727.  
  7728.    You can write any number of such parameter forward declarations in
  7729. the parameter list.  They can be separated by commas or semicolons, but
  7730. the last one must end with a semicolon, which is followed by the "real"
  7731. parameter declarations.  Each forward declaration must match a "real"
  7732. declaration in parameter name and data type.
  7733.  
  7734. 
  7735. File: !gcc.docs.gccuser,  Node: Macro Varargs,  Next: Subscripting,  Prev: Variable Length,  Up: C Extensions
  7736.  
  7737. Macros with Variable Numbers of Arguments
  7738. =========================================
  7739.  
  7740.    In GNU C, a macro can accept a variable number of arguments, much as
  7741. a function can.  The syntax for defining the macro looks much like that
  7742. used for a function.  Here is an example:
  7743.  
  7744.      #define eprintf(format, args...)  \
  7745.       fprintf (stderr, format , ## args)
  7746.  
  7747.    Here `args' is a "rest argument": it takes in zero or more
  7748. arguments, as many as the call contains.  All of them plus the commas
  7749. between them form the value of `args', which is substituted into the
  7750. macro body where `args' is used.  Thus, we have this expansion:
  7751.  
  7752.      eprintf ("%s:%d: ", input_file_name, line_number)
  7753.      ==>
  7754.      fprintf (stderr, "%s:%d: " , input_file_name, line_number)
  7755.  
  7756. Note that the comma after the string constant comes from the definition
  7757. of `eprintf', whereas the last comma comes from the value of `args'.
  7758.  
  7759.    The reason for using `##' is to handle the case when `args' matches
  7760. no arguments at all.  In this case, `args' has an empty value.  In this
  7761. case, the second comma in the definition becomes an embarrassment: if
  7762. it got through to the expansion of the macro, we would get something
  7763. like this:
  7764.  
  7765.      fprintf (stderr, "success!\n" , )
  7766.  
  7767. which is invalid C syntax.  `##' gets rid of the comma, so we get the
  7768. following instead:
  7769.  
  7770.      fprintf (stderr, "success!\n")
  7771.  
  7772.    This is a special feature of the GNU C preprocessor: `##' before a
  7773. rest argument that is empty discards the preceding sequence of
  7774. non-whitespace characters from the macro definition.  (If another macro
  7775. argument precedes, none of it is discarded.)
  7776.  
  7777.    It might be better to discard the last preprocessor token instead of
  7778. the last preceding sequence of non-whitespace characters; in fact, we
  7779. may someday change this feature to do so.  We advise you to write the
  7780. macro definition so that the preceding sequence of non-whitespace
  7781. characters is just a single token, so that the meaning will not change
  7782. if we change the definition of this feature.
  7783.  
  7784. 
  7785. File: !gcc.docs.gccuser,  Node: Subscripting,  Next: Pointer Arith,  Prev: Macro Varargs,  Up: C Extensions
  7786.  
  7787. Non-Lvalue Arrays May Have Subscripts
  7788. =====================================
  7789.  
  7790.    Subscripting is allowed on arrays that are not lvalues, even though
  7791. the unary `&' operator is not.  For example, this is valid in GNU C
  7792. though not valid in other C dialects:
  7793.  
  7794.      struct foo {int a[4];};
  7795.      
  7796.      struct foo f();
  7797.      
  7798.      bar (int index)
  7799.      {
  7800.        return f().a[index];
  7801.      }
  7802.  
  7803. 
  7804. File: !gcc.docs.gccuser,  Node: Pointer Arith,  Next: Initializers,  Prev: Subscripting,  Up: C Extensions
  7805.  
  7806. Arithmetic on `void'- and Function-Pointers
  7807. ===========================================
  7808.  
  7809.    In GNU C, addition and subtraction operations are supported on
  7810. pointers to `void' and on pointers to functions.  This is done by
  7811. treating the size of a `void' or of a function as 1.
  7812.  
  7813.    A consequence of this is that `sizeof' is also allowed on `void' and
  7814. on function types, and returns 1.
  7815.  
  7816.    The option `-Wpointer-arith' requests a warning if these extensions
  7817. are used.
  7818.  
  7819. 
  7820. File: !gcc.docs.gccuser,  Node: Initializers,  Next: Constructors,  Prev: Pointer Arith,  Up: C Extensions
  7821.  
  7822. Non-Constant Initializers
  7823. =========================
  7824.  
  7825.    As in standard C++, the elements of an aggregate initializer for an
  7826. automatic variable are not required to be constant expressions in GNU C.
  7827. Here is an example of an initializer with run-time varying elements:
  7828.  
  7829.      foo (float f, float g)
  7830.      {
  7831.        float beat_freqs[2] = { f-g, f+g };
  7832.        ...
  7833.      }
  7834.  
  7835. 
  7836. File: !gcc.docs.gccuser,  Node: Constructors,  Next: Labeled Elements,  Prev: Initializers,  Up: C Extensions
  7837.  
  7838. Constructor Expressions
  7839. =======================
  7840.  
  7841.    GNU C supports constructor expressions.  A constructor looks like a
  7842. cast containing an initializer.  Its value is an object of the type
  7843. specified in the cast, containing the elements specified in the
  7844. initializer.
  7845.  
  7846.    Usually, the specified type is a structure.  Assume that `struct
  7847. foo' and `structure' are declared as shown:
  7848.  
  7849.      struct foo {int a; char b[2];} structure;
  7850.  
  7851. Here is an example of constructing a `struct foo' with a constructor:
  7852.  
  7853.      structure = ((struct foo) {x + y, 'a', 0});
  7854.  
  7855. This is equivalent to writing the following:
  7856.  
  7857.      {
  7858.        struct foo temp = {x + y, 'a', 0};
  7859.        structure = temp;
  7860.      }
  7861.  
  7862.    You can also construct an array.  If all the elements of the
  7863. constructor are (made up of) simple constant expressions, suitable for
  7864. use in initializers, then the constructor is an lvalue and can be
  7865. coerced to a pointer to its first element, as shown here:
  7866.  
  7867.      char **foo = (char *[]) { "x", "y", "z" };
  7868.  
  7869.    Array constructors whose elements are not simple constants are not
  7870. very useful, because the constructor is not an lvalue.  There are only
  7871. two valid ways to use it: to subscript it, or initialize an array
  7872. variable with it.  The former is probably slower than a `switch'
  7873. statement, while the latter does the same thing an ordinary C
  7874. initializer would do.  Here is an example of subscripting an array
  7875. constructor:
  7876.  
  7877.      output = ((int[]) { 2, x, 28 }) [input];
  7878.  
  7879.    Constructor expressions for scalar types and union types are is also
  7880. allowed, but then the constructor expression is equivalent to a cast.
  7881.  
  7882. 
  7883. File: !gcc.docs.gccuser,  Node: Labeled Elements,  Next: Cast to Union,  Prev: Constructors,  Up: C Extensions
  7884.  
  7885. Labeled Elements in Initializers
  7886. ================================
  7887.  
  7888.    Standard C requires the elements of an initializer to appear in a
  7889. fixed order, the same as the order of the elements in the array or
  7890. structure being initialized.
  7891.  
  7892.    In GNU C you can give the elements in any order, specifying the array
  7893. indices or structure field names they apply to.  This extension is not
  7894. implemented in GNU C++.
  7895.  
  7896.    To specify an array index, write `[INDEX]' or `[INDEX] =' before the
  7897. element value.  For example,
  7898.  
  7899.      int a[6] = { [4] 29, [2] = 15 };
  7900.  
  7901. is equivalent to
  7902.  
  7903.      int a[6] = { 0, 0, 15, 0, 29, 0 };
  7904.  
  7905. The index values must be constant expressions, even if the array being
  7906. initialized is automatic.
  7907.  
  7908.    To initialize a range of elements to the same value, write `[FIRST
  7909. ... LAST] = VALUE'.  For example,
  7910.  
  7911.      int widths[] = { [0 ... 9] = 1, [10 ... 99] = 2, [100] = 3 };
  7912.  
  7913. Note that the length of the array is the highest value specified plus
  7914. one.
  7915.  
  7916.    In a structure initializer, specify the name of a field to initialize
  7917. with `FIELDNAME:' before the element value.  For example, given the
  7918. following structure,
  7919.  
  7920.      struct point { int x, y; };
  7921.  
  7922. the following initialization
  7923.  
  7924.      struct point p = { y: yvalue, x: xvalue };
  7925.  
  7926. is equivalent to
  7927.  
  7928.      struct point p = { xvalue, yvalue };
  7929.  
  7930.    Another syntax which has the same meaning is `.FIELDNAME ='., as
  7931. shown here:
  7932.  
  7933.      struct point p = { .y = yvalue, .x = xvalue };
  7934.  
  7935.    You can also use an element label (with either the colon syntax or
  7936. the period-equal syntax) when initializing a union, to specify which
  7937. element of the union should be used.  For example,
  7938.  
  7939.      union foo { int i; double d; };
  7940.      
  7941.      union foo f = { d: 4 };
  7942.  
  7943. will convert 4 to a `double' to store it in the union using the second
  7944. element.  By contrast, casting 4 to type `union foo' would store it
  7945. into the union as the integer `i', since it is an integer.  (*Note Cast
  7946. to Union::.)
  7947.  
  7948.    You can combine this technique of naming elements with ordinary C
  7949. initialization of successive elements.  Each initializer element that
  7950. does not have a label applies to the next consecutive element of the
  7951. array or structure.  For example,
  7952.  
  7953.      int a[6] = { [1] = v1, v2, [4] = v4 };
  7954.  
  7955. is equivalent to
  7956.  
  7957.      int a[6] = { 0, v1, v2, 0, v4, 0 };
  7958.  
  7959.    Labeling the elements of an array initializer is especially useful
  7960. when the indices are characters or belong to an `enum' type.  For
  7961. example:
  7962.  
  7963.      int whitespace[256]
  7964.        = { [' '] = 1, ['\t'] = 1, ['\h'] = 1,
  7965.            ['\f'] = 1, ['\n'] = 1, ['\r'] = 1 };
  7966.  
  7967. 
  7968. File: !gcc.docs.gccuser,  Node: Case Ranges,  Next: Function Attributes,  Prev: Cast to Union,  Up: C Extensions
  7969.  
  7970. Case Ranges
  7971. ===========
  7972.  
  7973.    You can specify a range of consecutive values in a single `case'
  7974. label, like this:
  7975.  
  7976.      case LOW ... HIGH:
  7977.  
  7978. This has the same effect as the proper number of individual `case'
  7979. labels, one for each integer value from LOW to HIGH, inclusive.
  7980.  
  7981.    This feature is especially useful for ranges of ASCII character
  7982. codes:
  7983.  
  7984.      case 'A' ... 'Z':
  7985.  
  7986.    *Be careful:* Write spaces around the `...', for otherwise it may be
  7987. parsed wrong when you use it with integer values.  For example, write
  7988. this:
  7989.  
  7990.      case 1 ... 5:
  7991.  
  7992. rather than this:
  7993.  
  7994.      case 1...5:
  7995.  
  7996. 
  7997. File: !gcc.docs.gccuser,  Node: Cast to Union,  Next: Case Ranges,  Prev: Labeled Elements,  Up: C Extensions
  7998.  
  7999. Cast to a Union Type
  8000. ====================
  8001.  
  8002.    A cast to union type is similar to other casts, except that the type
  8003. specified is a union type.  You can specify the type either with `union
  8004. TAG' or with a typedef name.  A cast to union is actually a constructor
  8005. though, not a cast, and hence does not yield an lvalue like normal
  8006. casts.  (*Note Constructors::.)
  8007.  
  8008.    The types that may be cast to the union type are those of the members
  8009. of the union.  Thus, given the following union and variables:
  8010.  
  8011.      union foo { int i; double d; };
  8012.      int x;
  8013.      double y;
  8014.  
  8015. both `x' and `y' can be cast to type `union' foo.
  8016.  
  8017.    Using the cast as the right-hand side of an assignment to a variable
  8018. of union type is equivalent to storing in a member of the union:
  8019.  
  8020.      union foo u;
  8021.      ...
  8022.      u = (union foo) x  ==  u.i = x
  8023.      u = (union foo) y  ==  u.d = y
  8024.  
  8025.    You can also use the union cast as a function argument:
  8026.  
  8027.      void hack (union foo);
  8028.      ...
  8029.      hack ((union foo) x);
  8030.  
  8031. 
  8032. File: !gcc.docs.gccuser,  Node: Function Attributes,  Next: Function Prototypes,  Prev: Case Ranges,  Up: C Extensions
  8033.  
  8034. Declaring Attributes of Functions
  8035. =================================
  8036.  
  8037.    In GNU C, you declare certain things about functions called in your
  8038. program which help the compiler optimize function calls and check your
  8039. code more carefully.
  8040.  
  8041.    The keyword `__attribute__' allows you to specify special attributes
  8042. when making a declaration.  This keyword is followed by an attribute
  8043. specification inside double parentheses.  Eight attributes, `noreturn',
  8044. `const', `format', `section', `constructor', `destructor', `unused' and
  8045. `weak' are currently defined for functions.  Other attributes, including
  8046. `section' are supported for variables declarations (*note Variable
  8047. Attributes::.) and for types (*note Type Attributes::.).
  8048.  
  8049.    You may also specify attributes with `__' preceding and following
  8050. each keyword.  This allows you to use them in header files without
  8051. being concerned about a possible macro of the same name.  For example,
  8052. you may use `__noreturn__' instead of `noreturn'.
  8053.  
  8054. `noreturn'
  8055.      A few standard library functions, such as `abort' and `exit',
  8056.      cannot return.  GNU CC knows this automatically.  Some programs
  8057.      define their own functions that never return.  You can declare them
  8058.      `noreturn' to tell the compiler this fact.  For example,
  8059.  
  8060.           void fatal () __attribute__ ((noreturn));
  8061.           
  8062.           void
  8063.           fatal (...)
  8064.           {
  8065.             ... /* Print error message. */ ...
  8066.             exit (1);
  8067.           }
  8068.  
  8069.      The `noreturn' keyword tells the compiler to assume that `fatal'
  8070.      cannot return.  It can then optimize without regard to what would
  8071.      happen if `fatal' ever did return.  This makes slightly better
  8072.      code.  More importantly, it helps avoid spurious warnings of
  8073.      uninitialized variables.
  8074.  
  8075.      Do not assume that registers saved by the calling function are
  8076.      restored before calling the `noreturn' function.
  8077.  
  8078.      It does not make sense for a `noreturn' function to have a return
  8079.      type other than `void'.
  8080.  
  8081.      The attribute `noreturn' is not implemented in GNU C versions
  8082.      earlier than 2.5.  An alternative way to declare that a function
  8083.      does not return, which works in the current version and in some
  8084.      older versions, is as follows:
  8085.  
  8086.           typedef void voidfn ();
  8087.           
  8088.           volatile voidfn fatal;
  8089.  
  8090. `const'
  8091.      Many functions do not examine any values except their arguments,
  8092.      and have no effects except the return value.  Such a function can
  8093.      be subject to common subexpression elimination and loop
  8094.      optimization just as an arithmetic operator would be.  These
  8095.      functions should be declared with the attribute `const'.  For
  8096.      example,
  8097.  
  8098.           int square (int) __attribute__ ((const));
  8099.  
  8100.      says that the hypothetical function `square' is safe to call fewer
  8101.      times than the program says.
  8102.  
  8103.      The attribute `const' is not implemented in GNU C versions earlier
  8104.      than 2.5.  An alternative way to declare that a function has no
  8105.      side effects, which works in the current version and in some older
  8106.      versions, is as follows:
  8107.  
  8108.           typedef int intfn ();
  8109.           
  8110.           extern const intfn square;
  8111.  
  8112.      This approach does not work in GNU C++ from 2.6.0 on, since the
  8113.      language specifies that the `const' must be attached to the return
  8114.      value.
  8115.  
  8116.      Note that a function that has pointer arguments and examines the
  8117.      data pointed to must *not* be declared `const'.  Likewise, a
  8118.      function that calls a non-`const' function usually must not be
  8119.      `const'.  It does not make sense for a `const' function to return
  8120.      `void'.
  8121.  
  8122. `format (ARCHETYPE, STRING-INDEX, FIRST-TO-CHECK)'
  8123.      The `format' attribute specifies that a function takes `printf' or
  8124.      `scanf' style arguments which should be type-checked against a
  8125.      format string.  For example, the declaration:
  8126.  
  8127.           extern int
  8128.           my_printf (void *my_object, const char *my_format, ...)
  8129.                 __attribute__ ((format (printf, 2, 3)));
  8130.  
  8131.      causes the compiler to check the arguments in calls to `my_printf'
  8132.      for consistency with the `printf' style format string argument
  8133.      `my_format'.
  8134.  
  8135.      The parameter ARCHETYPE determines how the format string is
  8136.      interpreted, and should be either `printf' or `scanf'.  The
  8137.      parameter STRING-INDEX specifies which argument is the format
  8138.      string argument (starting from 1), while FIRST-TO-CHECK is the
  8139.      number of the first argument to check against the format string.
  8140.      For functions where the arguments are not available to be checked
  8141.      (such as `vprintf'), specify the third parameter as zero.  In this
  8142.      case the compiler only checks the format string for consistency.
  8143.  
  8144.      In the example above, the format string (`my_format') is the second
  8145.      argument of the function `my_print', and the arguments to check
  8146.      start with the third argument, so the correct parameters for the
  8147.      format attribute are 2 and 3.
  8148.  
  8149.      The `format' attribute allows you to identify your own functions
  8150.      which take format strings as arguments, so that GNU CC can check
  8151.      the calls to these functions for errors.  The compiler always
  8152.      checks formats for the ANSI library functions `printf', `fprintf',
  8153.      `sprintf', `scanf', `fscanf', `sscanf', `vprintf', `vfprintf' and
  8154.      `vsprintf' whenever such warnings are requested (using
  8155.      `-Wformat'), so there is no need to modify the header file
  8156.      `stdio.h'.
  8157.  
  8158. `section ("section-name")'
  8159.      Normally, the compiler places the code it generates in the `text'
  8160.      section.  Sometimes, however, you need additional sections, or you
  8161.      need certain particular functions to appear in special sections.
  8162.      The `section' attribute specifies that a function lives in a
  8163.      particular section.  For example, the declaration:
  8164.  
  8165.           extern void foobar (void) __attribute__ ((section ("bar")));
  8166.  
  8167.      puts the function `foobar' in the `bar' section.
  8168.  
  8169.      Some file formats do not support arbitrary sections so the
  8170.      `section' attribute is not available on all platforms.  If you
  8171.      need to map the entire contents of a module to a particular
  8172.      section, consider using the facilities of the linker instead.
  8173.  
  8174. `constructor'
  8175. `destructor'
  8176.      The `constructor' attribute causes the function to be called
  8177.      automatically before execution enters `main ()'.  Similarly, the
  8178.      `destructor' attribute causes the function to be called
  8179.      automatically after `main ()' has completed or `exit ()' has been
  8180.      called.  Functions with these attributes are useful for
  8181.      initializing data that will be used implicitly during the
  8182.      execution of the program.
  8183.  
  8184.      These attributes are not currently implemented for Objective C.
  8185.  
  8186. `unused'
  8187.      This attribute, attached to a function, means that the function is
  8188.      meant to be possibly unused.  GNU CC will not produce a warning
  8189.      for this function.
  8190.  
  8191. `weak'
  8192.      The `weak' attribute causes the declaration to be emitted as a weak
  8193.      symbol rather than a global.  This is primarily useful in defining
  8194.      library functions which can be overridden in user code, though it
  8195.      can also be used with non-function declarations.  Weak symbols are
  8196.      supported for ELF targets, and also for a.out targets when using
  8197.      the GNU assembler and linker.
  8198.  
  8199. `alias ("target")'
  8200.      The `alias' attribute causes the declaration to be emitted as an
  8201.      alias for another symbol, which must be specified.  For instance,
  8202.  
  8203.           void __f () { /* do something */; }
  8204.           void f () __attribute__ ((weak, alias ("__f")));
  8205.  
  8206.      declares `f' to be a weak alias for `__f'.  In C++, the mangled
  8207.      name for the target must be used.
  8208.  
  8209. `regparm (NUMBER)'
  8210.      On the Intel 386, the `regparm' attribute causes the compiler to
  8211.      pass up to NUMBER integer arguments in registers EAX, EDX, and ECX
  8212.      instead of on the stack.  Functions that take a variable number of
  8213.      arguments will continue to be passed all of their arguments on the
  8214.      stack.
  8215.  
  8216. `stdcall'
  8217.      On the Intel 386, the `stdcall' attribute causes the compiler to
  8218.      assume that the called function will pop off the stack space used
  8219.      to pass arguments, unless it takes a variable number of arguments.
  8220.  
  8221. `cdecl'
  8222.      On the Intel 386, the `cdecl' attribute causes the compiler to
  8223.      assume that the called function will pop off the stack space used
  8224.      to pass arguments, unless it takes a variable number of arguments.
  8225.      This is useful to override the effects of the `-mrtd' switch.
  8226.  
  8227.    You can specify multiple attributes in a declaration by separating
  8228. them by commas within the double parentheses or by immediately
  8229. following an attribute declaration with another attribute declaration.
  8230.  
  8231.    Some people object to the `__attribute__' feature, suggesting that
  8232. ANSI C's `#pragma' should be used instead.  There are two reasons for
  8233. not doing this.
  8234.  
  8235.   1. It is impossible to generate `#pragma' commands from a macro.
  8236.  
  8237.   2. There is no telling what the same `#pragma' might mean in another
  8238.      compiler.
  8239.  
  8240.    These two reasons apply to almost any application that might be
  8241. proposed for `#pragma'.  It is basically a mistake to use `#pragma' for
  8242. *anything*.
  8243.  
  8244. 
  8245. File: !gcc.docs.gccuser,  Node: Function Prototypes,  Next: C++ Comments,  Prev: Function Attributes,  Up: C Extensions
  8246.  
  8247. Prototypes and Old-Style Function Definitions
  8248. =============================================
  8249.  
  8250.    GNU C extends ANSI C to allow a function prototype to override a
  8251. later old-style non-prototype definition.  Consider the following
  8252. example:
  8253.  
  8254.      /* Use prototypes unless the compiler is old-fashioned.  */
  8255.      #if __STDC__
  8256.      #define P(x) x
  8257.      #else
  8258.      #define P(x) ()
  8259.      #endif
  8260.      
  8261.      /* Prototype function declaration.  */
  8262.      int isroot P((uid_t));
  8263.      
  8264.      /* Old-style function definition.  */
  8265.      int
  8266.      isroot (x)   /* ??? lossage here ??? */
  8267.           uid_t x;
  8268.      {
  8269.        return x == 0;
  8270.      }
  8271.  
  8272.    Suppose the type `uid_t' happens to be `short'.  ANSI C does not
  8273. allow this example, because subword arguments in old-style
  8274. non-prototype definitions are promoted.  Therefore in this example the
  8275. function definition's argument is really an `int', which does not match
  8276. the prototype argument type of `short'.
  8277.  
  8278.    This restriction of ANSI C makes it hard to write code that is
  8279. portable to traditional C compilers, because the programmer does not
  8280. know whether the `uid_t' type is `short', `int', or `long'.  Therefore,
  8281. in cases like these GNU C allows a prototype to override a later
  8282. old-style definition.  More precisely, in GNU C, a function prototype
  8283. argument type overrides the argument type specified by a later
  8284. old-style definition if the former type is the same as the latter type
  8285. before promotion.  Thus in GNU C the above example is equivalent to the
  8286. following:
  8287.  
  8288.      int isroot (uid_t);
  8289.      
  8290.      int
  8291.      isroot (uid_t x)
  8292.      {
  8293.        return x == 0;
  8294.      }
  8295.  
  8296.    GNU C++ does not support old-style function definitions, so this
  8297. extension is irrelevant.
  8298.  
  8299. 
  8300. File: !gcc.docs.gccuser,  Node: C++ Comments,  Next: Dollar Signs,  Prev: Function Prototypes,  Up: C Extensions
  8301.  
  8302. C++ Style Comments
  8303. ==================
  8304.  
  8305.    In GNU C, you may use C++ style comments, which start with `//' and
  8306. continue until the end of the line.  Many other C implementations allow
  8307. such comments, and they are likely to be in a future C standard.
  8308. However, C++ style comments are not recognized if you specify `-ansi'
  8309. or `-traditional', since they are incompatible with traditional
  8310. constructs like `dividend//*comment*/divisor'.
  8311.  
  8312. 
  8313. File: !gcc.docs.gccuser,  Node: Dollar Signs,  Next: Character Escapes,  Prev: C++ Comments,  Up: C Extensions
  8314.  
  8315. Dollar Signs in Identifier Names
  8316. ================================
  8317.  
  8318.    In GNU C, you may use dollar signs in identifier names.  This is
  8319. because many traditional C implementations allow such identifiers.
  8320.  
  8321.    On some machines, dollar signs are allowed in identifiers if you
  8322. specify `-traditional'.  On a few systems they are allowed by default,
  8323. even if you do not use `-traditional'.  But they are never allowed if
  8324. you specify `-ansi'.
  8325.  
  8326.    There are certain ANSI C programs (obscure, to be sure) that would
  8327. compile incorrectly if dollar signs were permitted in identifiers.  For
  8328. example:
  8329.  
  8330.      #define foo(a) #a
  8331.      #define lose(b) foo (b)
  8332.      #define test$
  8333.      lose (test)
  8334.  
  8335. 
  8336. File: !gcc.docs.gccuser,  Node: Character Escapes,  Next: Variable Attributes,  Prev: Dollar Signs,  Up: C Extensions
  8337.  
  8338. The Character ESC in Constants
  8339. ==============================
  8340.  
  8341.    You can use the sequence `\e' in a string or character constant to
  8342. stand for the ASCII character ESC.
  8343.  
  8344. 
  8345. File: !gcc.docs.gccuser,  Node: Alignment,  Next: Inline,  Prev: Type Attributes,  Up: C Extensions
  8346.  
  8347. Inquiring on Alignment of Types or Variables
  8348. ============================================
  8349.  
  8350.    The keyword `__alignof__' allows you to inquire about how an object
  8351. is aligned, or the minimum alignment usually required by a type.  Its
  8352. syntax is just like `sizeof'.
  8353.  
  8354.    For example, if the target machine requires a `double' value to be
  8355. aligned on an 8-byte boundary, then `__alignof__ (double)' is 8.  This
  8356. is true on many RISC machines.  On more traditional machine designs,
  8357. `__alignof__ (double)' is 4 or even 2.
  8358.  
  8359.    Some machines never actually require alignment; they allow reference
  8360. to any data type even at an odd addresses.  For these machines,
  8361. `__alignof__' reports the *recommended* alignment of a type.
  8362.  
  8363.    When the operand of `__alignof__' is an lvalue rather than a type,
  8364. the value is the largest alignment that the lvalue is known to have.
  8365. It may have this alignment as a result of its data type, or because it
  8366. is part of a structure and inherits alignment from that structure.  For
  8367. example, after this declaration:
  8368.  
  8369.      struct foo { int x; char y; } foo1;
  8370.  
  8371. the value of `__alignof__ (foo1.y)' is probably 2 or 4, the same as
  8372. `__alignof__ (int)', even though the data type of `foo1.y' does not
  8373. itself demand any alignment.
  8374.  
  8375.    A related feature which lets you specify the alignment of an object
  8376. is `__attribute__ ((aligned (ALIGNMENT)))'; see the following section.
  8377.  
  8378. 
  8379. File: !gcc.docs.gccuser,  Node: Variable Attributes,  Next: Type Attributes,  Prev: Character Escapes,  Up: C Extensions
  8380.  
  8381. Specifying Attributes of Variables
  8382. ==================================
  8383.  
  8384.    The keyword `__attribute__' allows you to specify special attributes
  8385. of variables or structure fields.  This keyword is followed by an
  8386. attribute specification inside double parentheses.  Eight attributes
  8387. are currently defined for variables: `aligned', `mode', `nocommon',
  8388. `packed', `section', `transparent_union', `unused', and `weak'.  Other
  8389. attributes are available for functions (*note Function Attributes::.)
  8390. and for types (*note Type Attributes::.).
  8391.  
  8392.    You may also specify attributes with `__' preceding and following
  8393. each keyword.  This allows you to use them in header files without
  8394. being concerned about a possible macro of the same name.  For example,
  8395. you may use `__aligned__' instead of `aligned'.
  8396.  
  8397. `aligned (ALIGNMENT)'
  8398.      This attribute specifies a minimum alignment for the variable or
  8399.      structure field, measured in bytes.  For example, the declaration:
  8400.  
  8401.           int x __attribute__ ((aligned (16))) = 0;
  8402.  
  8403.      causes the compiler to allocate the global variable `x' on a
  8404.      16-byte boundary.  On a 68040, this could be used in conjunction
  8405.      with an `asm' expression to access the `move16' instruction which
  8406.      requires 16-byte aligned operands.
  8407.  
  8408.      You can also specify the alignment of structure fields.  For
  8409.      example, to create a double-word aligned `int' pair, you could
  8410.      write:
  8411.  
  8412.           struct foo { int x[2] __attribute__ ((aligned (8))); };
  8413.  
  8414.      This is an alternative to creating a union with a `double' member
  8415.      that forces the union to be double-word aligned.
  8416.  
  8417.      It is not possible to specify the alignment of functions; the
  8418.      alignment of functions is determined by the machine's requirements
  8419.      and cannot be changed.  You cannot specify alignment for a typedef
  8420.      name because such a name is just an alias, not a distinct type.
  8421.  
  8422.      As in the preceding examples, you can explicitly specify the
  8423.      alignment (in bytes) that you wish the compiler to use for a given
  8424.      variable or structure field.  Alternatively, you can leave out the
  8425.      alignment factor and just ask the compiler to align a variable or
  8426.      field to the maximum useful alignment for the target machine you
  8427.      are compiling for.  For example, you could write:
  8428.  
  8429.           short array[3] __attribute__ ((aligned));
  8430.  
  8431.      Whenever you leave out the alignment factor in an `aligned'
  8432.      attribute specification, the compiler automatically sets the
  8433.      alignment for the declared variable or field to the largest
  8434.      alignment which is ever used for any data type on the target
  8435.      machine you are compiling for.  Doing this can often make copy
  8436.      operations more efficient, because the compiler can use whatever
  8437.      instructions copy the biggest chunks of memory when performing
  8438.      copies to or from the variables or fields that you have aligned
  8439.      this way.
  8440.  
  8441.      The `aligned' attribute can only increase the alignment; but you
  8442.      can decrease it by specifying `packed' as well.  See below.
  8443.  
  8444.      Note that the effectiveness of `aligned' attributes may be limited
  8445.      by inherent limitations in your linker.  On many systems, the
  8446.      linker is only able to arrange for variables to be aligned up to a
  8447.      certain maximum alignment.  (For some linkers, the maximum
  8448.      supported alignment may be very very small.)  If your linker is
  8449.      only able to align variables up to a maximum of 8 byte alignment,
  8450.      then specifying `aligned(16)' in an `__attribute__' will still
  8451.      only provide you with 8 byte alignment.  See your linker
  8452.      documentation for further information.
  8453.  
  8454. `mode (MODE)'
  8455.      This attribute specifies the data type for the
  8456.      declaration--whichever type corresponds to the mode MODE.  This in
  8457.      effect lets you request an integer or floating point type
  8458.      according to its width.
  8459.  
  8460.      You may also specify a mode of `byte' or `__byte__' to indicate
  8461.      the mode corresponding to a one-byte integer, `word' or `__word__'
  8462.      for the mode of a one-word integer, and `pointer' or `__pointer__'
  8463.      for the mode used to represent pointers.
  8464.  
  8465. `nocommon'
  8466.      This attribute specifies requests GNU CC not to place a variable
  8467.      "common" but instead to allocate space for it directly.  If you
  8468.      specify the `-fno-common' flag, GNU CC will do this for all
  8469.      variables.
  8470.  
  8471.      Specifying the `nocommon' attribute for a variable provides an
  8472.      initialization of zeros.  A variable may only be initialized in one
  8473.      source file.
  8474.  
  8475. `packed'
  8476.      The `packed' attribute specifies that a variable or structure field
  8477.      should have the smallest possible alignment--one byte for a
  8478.      variable, and one bit for a field, unless you specify a larger
  8479.      value with the `aligned' attribute.
  8480.  
  8481.      Here is a structure in which the field `x' is packed, so that it
  8482.      immediately follows `a':
  8483.  
  8484.           struct foo
  8485.           {
  8486.             char a;
  8487.             int x[2] __attribute__ ((packed));
  8488.           };
  8489.  
  8490. `section ("section-name")'
  8491.      Normally, the compiler places the objects it generates in sections
  8492.      like `data' and `bss'.  Sometimes, however, you need additional
  8493.      sections, or you need certain particular variables to appear in
  8494.      special sections, for example to map to special hardware.  The
  8495.      `section' attribute specifies that a variable (or function) lives
  8496.      in a particular section.  For example, this small program uses
  8497.      several specific section names:
  8498.  
  8499.           struct duart a __attribute__ ((section ("DUART_A"))) = { 0 };
  8500.           struct duart b __attribute__ ((section ("DUART_B"))) = { 0 };
  8501.           char stack[10000] __attribute__ ((section ("STACK"))) = { 0 };
  8502.           int init_data_copy __attribute__ ((section ("INITDATACOPY"))) = 0;
  8503.           
  8504.           main()
  8505.           {
  8506.             /* Initialize stack pointer */
  8507.             init_sp (stack + sizeof (stack));
  8508.           
  8509.             /* Initialize initialized data */
  8510.             memcpy (&init_data_copy, &data, &edata - &data);
  8511.           
  8512.             /* Turn on the serial ports */
  8513.             init_duart (&a);
  8514.             init_duart (&b);
  8515.           }
  8516.  
  8517.      Use the `section' attribute with an *initialized* definition of a
  8518.      *global* variable, as shown in the example.  GNU CC issues a
  8519.      warning and otherwise ignores the `section' attribute in
  8520.      uninitialized variable declarations.
  8521.  
  8522.      You may only use the `section' attribute with a fully initialized
  8523.      global definition because of the way linkers work.  The linker
  8524.      requires each object be defined once, with the exception that
  8525.      uninitialized variables tentatively go in the `common' (or `bss')
  8526.      section and can be multiply "defined".  You can force a variable
  8527.      to be initialized with the `-fno-common' flag or the `nocommon'
  8528.      attribute.
  8529.  
  8530.      Some file formats do not support arbitrary sections so the
  8531.      `section' attribute is not available on all platforms.  If you
  8532.      need to map the entire contents of a module to a particular
  8533.      section, consider using the facilities of the linker instead.
  8534.  
  8535. `transparent_union'
  8536.      This attribute, attached to a function argument variable which is a
  8537.      union, means to pass the argument in the same way that the first
  8538.      union member would be passed.  You can also use this attribute on a
  8539.      `typedef' for a union data type; then it applies to all function
  8540.      arguments with that type.
  8541.  
  8542. `unused'
  8543.      This attribute, attached to a variable, means that the variable is
  8544.      meant to be possibly unused.  GNU CC will not produce a warning
  8545.      for this variable.
  8546.  
  8547. `weak'
  8548.      The `weak' attribute is described in *Note Function Attributes::.
  8549.  
  8550.    To specify multiple attributes, separate them by commas within the
  8551. double parentheses: for example, `__attribute__ ((aligned (16),
  8552. packed))'.
  8553.  
  8554. 
  8555. File: !gcc.docs.gccuser,  Node: Type Attributes,  Next: Alignment,  Prev: Variable Attributes,  Up: C Extensions
  8556.  
  8557. Specifying Attributes of Types
  8558. ==============================
  8559.  
  8560.    The keyword `__attribute__' allows you to specify special attributes
  8561. of `struct' and `union' types when you define such types.  This keyword
  8562. is followed by an attribute specification inside double parentheses.
  8563. Three attributes are currently defined for types: `aligned', `packed',
  8564. and `transparent_union'.  Other attributes are defined for functions
  8565. (*note Function Attributes::.) and for variables (*note Variable
  8566. Attributes::.).
  8567.  
  8568.    You may also specify any one of these attributes with `__' preceding
  8569. and following its keyword.  This allows you to use these attributes in
  8570. header files without being concerned about a possible macro of the same
  8571. name.  For example, you may use `__aligned__' instead of `aligned'.
  8572.  
  8573.    You may specify the `aligned' and `transparent_union' attributes
  8574. either in a `typedef' declaration or just past the closing curly brace
  8575. of a complete enum, struct or union type *definition* and the `packed'
  8576. attribute only past the closing brace of a definition.
  8577.  
  8578. `aligned (ALIGNMENT)'
  8579.      This attribute specifies a minimum alignment (in bytes) for
  8580.      variables of the specified type.  For example, the declarations:
  8581.  
  8582.           struct S { short f[3]; } __attribute__ ((aligned (8));
  8583.           typedef int more_aligned_int __attribute__ ((aligned (8));
  8584.  
  8585.      force the compiler to insure (as fas as it can) that each variable
  8586.      whose type is `struct S' or `more_aligned_int' will be allocated
  8587.      and aligned *at least* on a 8-byte boundary.  On a Sparc, having
  8588.      all variables of type `struct S' aligned to 8-byte boundaries
  8589.      allows the compiler to use the `ldd' and `std' (doubleword load and
  8590.      store) instructions when copying one variable of type `struct S' to
  8591.      another, thus improving run-time efficiency.
  8592.  
  8593.      Note that the alignment of any given `struct' or `union' type is
  8594.      required by the ANSI C standard to be at least a perfect multiple
  8595.      of the lowest common multiple of the alignments of all of the
  8596.      members of the `struct' or `union' in question.  This means that
  8597.      you *can* effectively adjust the alignment of a `struct' or `union'
  8598.      type by attaching an `aligned' attribute to any one of the members
  8599.      of such a type, but the notation illustrated in the example above
  8600.      is a more obvious, intuitive, and readable way to request the
  8601.      compiler to adjust the alignment of an entire `struct' or `union'
  8602.      type.
  8603.  
  8604.      As in the preceding example, you can explicitly specify the
  8605.      alignment (in bytes) that you wish the compiler to use for a given
  8606.      `struct' or `union' type.  Alternatively, you can leave out the
  8607.      alignment factor and just ask the compiler to align a type to the
  8608.      maximum useful alignment for the target machine you are compiling
  8609.      for.  For example, you could write:
  8610.  
  8611.           struct S { short f[3]; } __attribute__ ((aligned));
  8612.  
  8613.      Whenever you leave out the alignment factor in an `aligned'
  8614.      attribute specification, the compiler automatically sets the
  8615.      alignment for the type to the largest alignment which is ever used
  8616.      for any data type on the target machine you are compiling for.
  8617.      Doing this can often make copy operations more efficient, because
  8618.      the compiler can use whatever instructions copy the biggest chunks
  8619.      of memory when performing copies to or from the variables which
  8620.      have types that you have aligned this way.
  8621.  
  8622.      In the example above, if the size of each `short' is 2 bytes, then
  8623.      the size of the entire `struct S' type is 6 bytes.  The smallest
  8624.      power of two which is greater than or equal to that is 8, so the
  8625.      compiler sets the alignment for the entire `struct S' type to 8
  8626.      bytes.
  8627.  
  8628.      Note that although you can ask the compiler to select a
  8629.      time-efficient alignment for a given type and then declare only
  8630.      individual stand-alone objects of that type, the compiler's
  8631.      ability to select a time-efficient alignment is primarily useful
  8632.      only when you plan to create arrays of variables having the
  8633.      relevant (efficiently aligned) type.  If you declare or use arrays
  8634.      of variables of an efficiently-aligned type, then it is likely
  8635.      that your program will also be doing pointer arithmetic (or
  8636.      subscripting, which amounts to the same thing) on pointers to the
  8637.      relevant type, and the code that the compiler generates for these
  8638.      pointer arithmetic operations will often be more efficient for
  8639.      efficiently-aligned types than for other types.
  8640.  
  8641.      The `aligned' attribute can only increase the alignment; but you
  8642.      can decrease it by specifying `packed' as well.  See below.
  8643.  
  8644.      Note that the effectiveness of `aligned' attributes may be limited
  8645.      by inherent limitations in your linker.  On many systems, the
  8646.      linker is only able to arrange for variables to be aligned up to a
  8647.      certain maximum alignment.  (For some linkers, the maximum
  8648.      supported alignment may be very very small.)  If your linker is
  8649.      only able to align variables up to a maximum of 8 byte alignment,
  8650.      then specifying `aligned(16)' in an `__attribute__' will still
  8651.      only provide you with 8 byte alignment.  See your linker
  8652.      documentation for further information.
  8653.  
  8654. `packed'
  8655.      This attribute, attached to an `enum', `struct', or `union' type
  8656.      definition, specified that the minimum required memory be used to
  8657.      represent the type.
  8658.  
  8659.      Specifying this attribute for `struct' and `union' types is
  8660.      equivalent to specifying the `packed' attribute on each of the
  8661.      structure or union members.  Specifying the `-fshort-enums' flag
  8662.      on the line is equivalent to specifying the `packed' attribute on
  8663.      all `enum' definitions.
  8664.  
  8665.      You may only specify this attribute after a closing curly brace on
  8666.      an `enum' definition, not in a `typedef' declaration.
  8667.  
  8668. `transparent_union'
  8669.      This attribute, attached to a `union' type definition, indicates
  8670.      that any variable having that union type should, if passed to a
  8671.      function, be passed in the same way that the first union member
  8672.      would be passed.  For example:
  8673.  
  8674.           union foo
  8675.           {
  8676.             char a;
  8677.             int x[2];
  8678.           } __attribute__ ((transparent_union));
  8679.  
  8680.    To specify multiple attributes, separate them by commas within the
  8681. double parentheses: for example, `__attribute__ ((aligned (16),
  8682. packed))'.
  8683.  
  8684. 
  8685. File: !gcc.docs.gccuser,  Node: Inline,  Next: Extended Asm,  Prev: Alignment,  Up: C Extensions
  8686.  
  8687. An Inline Function is As Fast As a Macro
  8688. ========================================
  8689.  
  8690.    By declaring a function `inline', you can direct GNU CC to integrate
  8691. that function's code into the code for its callers.  This makes
  8692. execution faster by eliminating the function-call overhead; in
  8693. addition, if any of the actual argument values are constant, their known
  8694. values may permit simplifications at compile time so that not all of the
  8695. inline function's code needs to be included.  The effect on code size is
  8696. less predictable; object code may be larger or smaller with function
  8697. inlining, depending on the particular case.  Inlining of functions is an
  8698. optimization and it really "works" only in optimizing compilation.  If
  8699. you don't use `-O', no function is really inline.
  8700.  
  8701.    To declare a function inline, use the `inline' keyword in its
  8702. declaration, like this:
  8703.  
  8704.      inline int
  8705.      inc (int *a)
  8706.      {
  8707.        (*a)++;
  8708.      }
  8709.  
  8710.    (If you are writing a header file to be included in ANSI C programs,
  8711. write `__inline__' instead of `inline'.  *Note Alternate Keywords::.)
  8712.  
  8713.    You can also make all "simple enough" functions inline with the
  8714. option `-finline-functions'.  Note that certain usages in a function
  8715. definition can make it unsuitable for inline substitution.
  8716.  
  8717.    Note that in C and Objective C, unlike C++, the `inline' keyword
  8718. does not affect the linkage of the function.
  8719.  
  8720.    GNU CC automatically inlines member functions defined within the
  8721. class body of C++ programs even if they are not explicitly declared
  8722. `inline'.  (You can override this with `-fno-default-inline'; *note
  8723. Options Controlling C++ Dialect: C++ Dialect Options..)
  8724.  
  8725.    When a function is both inline and `static', if all calls to the
  8726. function are integrated into the caller, and the function's address is
  8727. never used, then the function's own assembler code is never referenced.
  8728. In this case, GNU CC does not actually output assembler code for the
  8729. function, unless you specify the option `-fkeep-inline-functions'.
  8730. Some calls cannot be integrated for various reasons (in particular,
  8731. calls that precede the function's definition cannot be integrated, and
  8732. neither can recursive calls within the definition).  If there is a
  8733. nonintegrated call, then the function is compiled to assembler code as
  8734. usual.  The function must also be compiled as usual if the program
  8735. refers to its address, because that can't be inlined.
  8736.  
  8737.    When an inline function is not `static', then the compiler must
  8738. assume that there may be calls from other source files; since a global
  8739. symbol can be defined only once in any program, the function must not
  8740. be defined in the other source files, so the calls therein cannot be
  8741. integrated.  Therefore, a non-`static' inline function is always
  8742. compiled on its own in the usual fashion.
  8743.  
  8744.    If you specify both `inline' and `extern' in the function
  8745. definition, then the definition is used only for inlining.  In no case
  8746. is the function compiled on its own, not even if you refer to its
  8747. address explicitly.  Such an address becomes an external reference, as
  8748. if you had only declared the function, and had not defined it.
  8749.  
  8750.    This combination of `inline' and `extern' has almost the effect of a
  8751. macro.  The way to use it is to put a function definition in a header
  8752. file with these keywords, and put another copy of the definition
  8753. (lacking `inline' and `extern') in a library file.  The definition in
  8754. the header file will cause most calls to the function to be inlined.
  8755. If any uses of the function remain, they will refer to the single copy
  8756. in the library.
  8757.  
  8758.    GNU C does not inline any functions when not optimizing.  It is not
  8759. clear whether it is better to inline or not, in this case, but we found
  8760. that a correct implementation when not optimizing was difficult.  So we
  8761. did the easy thing, and turned it off.
  8762.  
  8763. 
  8764. File: !gcc.docs.gccuser,  Node: Extended Asm,  Next: Constraints,  Prev: Inline,  Up: C Extensions
  8765.  
  8766. Assembler Instructions with C Expression Operands
  8767. =================================================
  8768.  
  8769.    In an assembler instruction using `asm', you can now specify the
  8770. operands of the instruction using C expressions.  This means no more
  8771. guessing which registers or memory locations will contain the data you
  8772. want to use.
  8773.  
  8774.    You must specify an assembler instruction template much like what
  8775. appears in a machine description, plus an operand constraint string for
  8776. each operand.
  8777.  
  8778.    For example, here is how to use the 68881's `fsinx' instruction:
  8779.  
  8780.      asm ("fsinx %1,%0" : "=f" (result) : "f" (angle));
  8781.  
  8782. Here `angle' is the C expression for the input operand while `result'
  8783. is that of the output operand.  Each has `"f"' as its operand
  8784. constraint, saying that a floating point register is required.  The `='
  8785. in `=f' indicates that the operand is an output; all output operands'
  8786. constraints must use `='.  The constraints use the same language used
  8787. in the machine description (*note Constraints::.).
  8788.  
  8789.    Each operand is described by an operand-constraint string followed
  8790. by the C expression in parentheses.  A colon separates the assembler
  8791. template from the first output operand, and another separates the last
  8792. output operand from the first input, if any.  Commas separate output
  8793. operands and separate inputs.  The total number of operands is limited
  8794. to ten or to the maximum number of operands in any instruction pattern
  8795. in the machine description, whichever is greater.
  8796.  
  8797.    If there are no output operands, and there are input operands, then
  8798. there must be two consecutive colons surrounding the place where the
  8799. output operands would go.
  8800.  
  8801.    Output operand expressions must be lvalues; the compiler can check
  8802. this.  The input operands need not be lvalues.  The compiler cannot
  8803. check whether the operands have data types that are reasonable for the
  8804. instruction being executed.  It does not parse the assembler
  8805. instruction template and does not know what it means, or whether it is
  8806. valid assembler input.  The extended `asm' feature is most often used
  8807. for machine instructions that the compiler itself does not know exist.
  8808. If the output expression cannot be directly addressed (for example, it
  8809. is a bit field), your constraint must allow a register.  In that case,
  8810. GNU CC will use the register as the output of the `asm', and then store
  8811. that register into the output.
  8812.  
  8813.    The output operands must be write-only; GNU CC will assume that the
  8814. values in these operands before the instruction are dead and need not be
  8815. generated.  Extended asm does not support input-output or read-write
  8816. operands.  For this reason, the constraint character `+', which
  8817. indicates such an operand, may not be used.
  8818.  
  8819.    When the assembler instruction has a read-write operand, or an
  8820. operand in which only some of the bits are to be changed, you must
  8821. logically split its function into two separate operands, one input
  8822. operand and one write-only output operand.  The connection between them
  8823. is expressed by constraints which say they need to be in the same
  8824. location when the instruction executes.  You can use the same C
  8825. expression for both operands, or different expressions.  For example,
  8826. here we write the (fictitious) `combine' instruction with `bar' as its
  8827. read-only source operand and `foo' as its read-write destination:
  8828.  
  8829.      asm ("combine %2,%0" : "=r" (foo) : "0" (foo), "g" (bar));
  8830.  
  8831. The constraint `"0"' for operand 1 says that it must occupy the same
  8832. location as operand 0.  A digit in constraint is allowed only in an
  8833. input operand, and it must refer to an output operand.
  8834.  
  8835.    Only a digit in the constraint can guarantee that one operand will
  8836. be in the same place as another.  The mere fact that `foo' is the value
  8837. of both operands is not enough to guarantee that they will be in the
  8838. same place in the generated assembler code.  The following would not
  8839. work:
  8840.  
  8841.      asm ("combine %2,%0" : "=r" (foo) : "r" (foo), "g" (bar));
  8842.  
  8843.    Various optimizations or reloading could cause operands 0 and 1 to
  8844. be in different registers; GNU CC knows no reason not to do so.  For
  8845. example, the compiler might find a copy of the value of `foo' in one
  8846. register and use it for operand 1, but generate the output operand 0 in
  8847. a different register (copying it afterward to `foo''s own address).  Of
  8848. course, since the register for operand 1 is not even mentioned in the
  8849. assembler code, the result will not work, but GNU CC can't tell that.
  8850.  
  8851.    Some instructions clobber specific hard registers.  To describe
  8852. this, write a third colon after the input operands, followed by the
  8853. names of the clobbered hard registers (given as strings).  Here is a
  8854. realistic example for the Vax:
  8855.  
  8856.      asm volatile ("movc3 %0,%1,%2"
  8857.                    : /* no outputs */
  8858.                    : "g" (from), "g" (to), "g" (count)
  8859.                    : "r0", "r1", "r2", "r3", "r4", "r5");
  8860.  
  8861.    If you refer to a particular hardware register from the assembler
  8862. code, then you will probably have to list the register after the third
  8863. colon to tell the compiler that the register's value is modified.  In
  8864. many assemblers, the register names begin with `%'; to produce one `%'
  8865. in the assembler code, you must write `%%' in the input.
  8866.  
  8867.    If your assembler instruction can alter the condition code register,
  8868. add `cc' to the list of clobbered registers.  GNU CC on some machines
  8869. represents the condition codes as a specific hardware register; `cc'
  8870. serves to name this register.  On other machines, the condition code is
  8871. handled differently, and specifying `cc' has no effect.  But it is
  8872. valid no matter what the machine.
  8873.  
  8874.    If your assembler instruction modifies memory in an unpredictable
  8875. fashion, add `memory' to the list of clobbered registers.  This will
  8876. cause GNU CC to not keep memory values cached in registers across the
  8877. assembler instruction.
  8878.  
  8879.    You can put multiple assembler instructions together in a single
  8880. `asm' template, separated either with newlines (written as `\n') or with
  8881. semicolons if the assembler allows such semicolons.  The GNU assembler
  8882. allows semicolons and all Unix assemblers seem to do so.  The input
  8883. operands are guaranteed not to use any of the clobbered registers, and
  8884. neither will the output operands' addresses, so you can read and write
  8885. the clobbered registers as many times as you like.  Here is an example
  8886. of multiple instructions in a template; it assumes that the subroutine
  8887. `_foo' accepts arguments in registers 9 and 10:
  8888.  
  8889.      asm ("movl %0,r9;movl %1,r10;call _foo"
  8890.           : /* no outputs */
  8891.           : "g" (from), "g" (to)
  8892.           : "r9", "r10");
  8893.  
  8894.    Unless an output operand has the `&' constraint modifier, GNU CC may
  8895. allocate it in the same register as an unrelated input operand, on the
  8896. assumption that the inputs are consumed before the outputs are produced.
  8897. This assumption may be false if the assembler code actually consists of
  8898. more than one instruction.  In such a case, use `&' for each output
  8899. operand that may not overlap an input.  *Note Modifiers::.
  8900.  
  8901.    If you want to test the condition code produced by an assembler
  8902. instruction, you must include a branch and a label in the `asm'
  8903. construct, as follows:
  8904.  
  8905.      asm ("clr %0;frob %1;beq 0f;mov #1,%0;0:"
  8906.           : "g" (result)
  8907.           : "g" (input));
  8908.  
  8909. This assumes your assembler supports local labels, as the GNU assembler
  8910. and most Unix assemblers do.
  8911.  
  8912.    Speaking of labels, jumps from one `asm' to another are not
  8913. supported.  The compiler's optimizers do not know about these jumps,
  8914. and therefore they cannot take account of them when deciding how to
  8915. optimize.
  8916.  
  8917.    Usually the most convenient way to use these `asm' instructions is to
  8918. encapsulate them in macros that look like functions.  For example,
  8919.  
  8920.      #define sin(x)       \
  8921.      ({ double __value, __arg = (x);   \
  8922.         asm ("fsinx %1,%0": "=f" (__value): "f" (__arg));  \
  8923.         __value; })
  8924.  
  8925. Here the variable `__arg' is used to make sure that the instruction
  8926. operates on a proper `double' value, and to accept only those arguments
  8927. `x' which can convert automatically to a `double'.
  8928.  
  8929.    Another way to make sure the instruction operates on the correct
  8930. data type is to use a cast in the `asm'.  This is different from using a
  8931. variable `__arg' in that it converts more different types.  For
  8932. example, if the desired type were `int', casting the argument to `int'
  8933. would accept a pointer with no complaint, while assigning the argument
  8934. to an `int' variable named `__arg' would warn about using a pointer
  8935. unless the caller explicitly casts it.
  8936.  
  8937.    If an `asm' has output operands, GNU CC assumes for optimization
  8938. purposes that the instruction has no side effects except to change the
  8939. output operands.  This does not mean that instructions with a side
  8940. effect cannot be used, but you must be careful, because the compiler
  8941. may eliminate them if the output operands aren't used, or move them out
  8942. of loops, or replace two with one if they constitute a common
  8943. subexpression.  Also, if your instruction does have a side effect on a
  8944. variable that otherwise appears not to change, the old value of the
  8945. variable may be reused later if it happens to be found in a register.
  8946.  
  8947.    You can prevent an `asm' instruction from being deleted, moved
  8948. significantly, or combined, by writing the keyword `volatile' after the
  8949. `asm'.  For example:
  8950.  
  8951.      #define set_priority(x)  \
  8952.      asm volatile ("set_priority %0": /* no outputs */ : "g" (x))
  8953.  
  8954. An instruction without output operands will not be deleted or moved
  8955. significantly, regardless, unless it is unreachable.
  8956.  
  8957.    Note that even a volatile `asm' instruction can be moved in ways
  8958. that appear insignificant to the compiler, such as across jump
  8959. instructions.  You can't expect a sequence of volatile `asm'
  8960. instructions to remain perfectly consecutive.  If you want consecutive
  8961. output, use a single `asm'.
  8962.  
  8963.    It is a natural idea to look for a way to give access to the
  8964. condition code left by the assembler instruction.  However, when we
  8965. attempted to implement this, we found no way to make it work reliably.
  8966. The problem is that output operands might need reloading, which would
  8967. result in additional following "store" instructions.  On most machines,
  8968. these instructions would alter the condition code before there was time
  8969. to test it.  This problem doesn't arise for ordinary "test" and
  8970. "compare" instructions because they don't have any output operands.
  8971.  
  8972.    If you are writing a header file that should be includable in ANSI C
  8973. programs, write `__asm__' instead of `asm'.  *Note Alternate Keywords::.
  8974.  
  8975. 
  8976. File: !gcc.docs.gccuser,  Node: Constraints,  Next: Asm Labels,  Prev: Extended Asm,  Up: C Extensions
  8977.  
  8978. Constraints for `asm' Operands
  8979. ==============================
  8980.  
  8981.    Here are specific details on what constraint letters you can use with
  8982. `asm' operands.  Constraints can say whether an operand may be in a
  8983. register, and which kinds of register; whether the operand can be a
  8984. memory reference, and which kinds of address; whether the operand may
  8985. be an immediate constant, and which possible values it may have.
  8986. Constraints can also require two operands to match.
  8987.  
  8988. * Menu:
  8989.  
  8990. * Simple Constraints::  Basic use of constraints.
  8991. * Multi-Alternative::   When an insn has two alternative constraint-patterns.
  8992. * Modifiers::           More precise control over effects of constraints.
  8993. * Machine Constraints:: Special constraints for some particular machines.
  8994.  
  8995. 
  8996. File: !gcc.docs.gccuser,  Node: Simple Constraints,  Next: Multi-Alternative,  Up: Constraints
  8997.  
  8998. Simple Constraints
  8999. ------------------
  9000.  
  9001.    The simplest kind of constraint is a string full of letters, each of
  9002. which describes one kind of operand that is permitted.  Here are the
  9003. letters that are allowed:
  9004.  
  9005. `m'
  9006.      A memory operand is allowed, with any kind of address that the
  9007.      machine supports in general.
  9008.  
  9009. `o'
  9010.      A memory operand is allowed, but only if the address is
  9011.      "offsettable".  This means that adding a small integer (actually,
  9012.      the width in bytes of the operand, as determined by its machine
  9013.      mode) may be added to the address and the result is also a valid
  9014.      memory address.
  9015.  
  9016.      For example, an address which is constant is offsettable; so is an
  9017.      address that is the sum of a register and a constant (as long as a
  9018.      slightly larger constant is also within the range of
  9019.      address-offsets supported by the machine); but an autoincrement or
  9020.      autodecrement address is not offsettable.  More complicated
  9021.      indirect/indexed addresses may or may not be offsettable depending
  9022.      on the other addressing modes that the machine supports.
  9023.  
  9024.      Note that in an output operand which can be matched by another
  9025.      operand, the constraint letter `o' is valid only when accompanied
  9026.      by both `<' (if the target machine has predecrement addressing)
  9027.      and `>' (if the target machine has preincrement addressing).
  9028.  
  9029. `V'
  9030.      A memory operand that is not offsettable.  In other words,
  9031.      anything that would fit the `m' constraint but not the `o'
  9032.      constraint.
  9033.  
  9034. `<'
  9035.      A memory operand with autodecrement addressing (either
  9036.      predecrement or postdecrement) is allowed.
  9037.  
  9038. `>'
  9039.      A memory operand with autoincrement addressing (either
  9040.      preincrement or postincrement) is allowed.
  9041.  
  9042. `r'
  9043.      A register operand is allowed provided that it is in a general
  9044.      register.
  9045.  
  9046. `d', `a', `f', ...
  9047.      Other letters can be defined in machine-dependent fashion to stand
  9048.      for particular classes of registers.  `d', `a' and `f' are defined
  9049.      on the 68000/68020 to stand for data, address and floating point
  9050.      registers.
  9051.  
  9052. `i'
  9053.      An immediate integer operand (one with constant value) is allowed.
  9054.      This includes symbolic constants whose values will be known only at
  9055.      assembly time.
  9056.  
  9057. `n'
  9058.      An immediate integer operand with a known numeric value is allowed.
  9059.      Many systems cannot support assembly-time constants for operands
  9060.      less than a word wide.  Constraints for these operands should use
  9061.      `n' rather than `i'.
  9062.  
  9063. `I', `J', `K', ... `P'
  9064.      Other letters in the range `I' through `P' may be defined in a
  9065.      machine-dependent fashion to permit immediate integer operands with
  9066.      explicit integer values in specified ranges.  For example, on the
  9067.      68000, `I' is defined to stand for the range of values 1 to 8.
  9068.      This is the range permitted as a shift count in the shift
  9069.      instructions.
  9070.  
  9071. `E'
  9072.      An immediate floating operand (expression code `const_double') is
  9073.      allowed, but only if the target floating point format is the same
  9074.      as that of the host machine (on which the compiler is running).
  9075.  
  9076. `F'
  9077.      An immediate floating operand (expression code `const_double') is
  9078.      allowed.
  9079.  
  9080. `G', `H'
  9081.      `G' and `H' may be defined in a machine-dependent fashion to
  9082.      permit immediate floating operands in particular ranges of values.
  9083.  
  9084. `s'
  9085.      An immediate integer operand whose value is not an explicit
  9086.      integer is allowed.
  9087.  
  9088.      This might appear strange; if an insn allows a constant operand
  9089.      with a value not known at compile time, it certainly must allow
  9090.      any known value.  So why use `s' instead of `i'?  Sometimes it
  9091.      allows better code to be generated.
  9092.  
  9093.      For example, on the 68000 in a fullword instruction it is possible
  9094.      to use an immediate operand; but if the immediate value is between
  9095.      -128 and 127, better code results from loading the value into a
  9096.      register and using the register.  This is because the load into
  9097.      the register can be done with a `moveq' instruction.  We arrange
  9098.      for this to happen by defining the letter `K' to mean "any integer
  9099.      outside the range -128 to 127", and then specifying `Ks' in the
  9100.      operand constraints.
  9101.  
  9102. `g'
  9103.      Any register, memory or immediate integer operand is allowed,
  9104.      except for registers that are not general registers.
  9105.  
  9106. `X'
  9107.      Any operand whatsoever is allowed.
  9108.  
  9109. `0', `1', `2', ... `9'
  9110.      An operand that matches the specified operand number is allowed.
  9111.      If a digit is used together with letters within the same
  9112.      alternative, the digit should come last.
  9113.  
  9114.      This is called a "matching constraint" and what it really means is
  9115.      that the assembler has only a single operand that fills two roles
  9116.      which `asm' distinguishes.  For example, an add instruction uses
  9117.      two input operands and an output operand, but on most CISC
  9118.      machines an add instruction really has only two operands, one of
  9119.      them an input-output operand:
  9120.  
  9121.           addl #35,r12
  9122.  
  9123.      Matching constraints are used in these circumstances.  More
  9124.      precisely, the two operands that match must include one input-only
  9125.      operand and one output-only operand.  Moreover, the digit must be a
  9126.      smaller number than the number of the operand that uses it in the
  9127.      constraint.
  9128.  
  9129. `p'
  9130.      An operand that is a valid memory address is allowed.  This is for
  9131.      "load address" and "push address" instructions.
  9132.  
  9133.      `p' in the constraint must be accompanied by `address_operand' as
  9134.      the predicate in the `match_operand'.  This predicate interprets
  9135.      the mode specified in the `match_operand' as the mode of the memory
  9136.      reference for which the address would be valid.
  9137.  
  9138. `Q', `R', `S', ... `U'
  9139.      Letters in the range `Q' through `U' may be defined in a
  9140.      machine-dependent fashion to stand for arbitrary operand types.
  9141.  
  9142. 
  9143. File: !gcc.docs.gccuser,  Node: Multi-Alternative,  Next: Modifiers,  Prev: Simple Constraints,  Up: Constraints
  9144.  
  9145. Multiple Alternative Constraints
  9146. --------------------------------
  9147.  
  9148.    Sometimes a single instruction has multiple alternative sets of
  9149. possible operands.  For example, on the 68000, a logical-or instruction
  9150. can combine register or an immediate value into memory, or it can
  9151. combine any kind of operand into a register; but it cannot combine one
  9152. memory location into another.
  9153.  
  9154.    These constraints are represented as multiple alternatives.  An
  9155. alternative can be described by a series of letters for each operand.
  9156. The overall constraint for an operand is made from the letters for this
  9157. operand from the first alternative, a comma, the letters for this
  9158. operand from the second alternative, a comma, and so on until the last
  9159. alternative.
  9160.  
  9161.    If all the operands fit any one alternative, the instruction is
  9162. valid.  Otherwise, for each alternative, the compiler counts how many
  9163. instructions must be added to copy the operands so that that
  9164. alternative applies.  The alternative requiring the least copying is
  9165. chosen.  If two alternatives need the same amount of copying, the one
  9166. that comes first is chosen.  These choices can be altered with the `?'
  9167. and `!' characters:
  9168.  
  9169. `?'
  9170.      Disparage slightly the alternative that the `?' appears in, as a
  9171.      choice when no alternative applies exactly.  The compiler regards
  9172.      this alternative as one unit more costly for each `?' that appears
  9173.      in it.
  9174.  
  9175. `!'
  9176.      Disparage severely the alternative that the `!' appears in.  This
  9177.      alternative can still be used if it fits without reloading, but if
  9178.      reloading is needed, some other alternative will be used.
  9179.  
  9180. 
  9181. File: !gcc.docs.gccuser,  Node: Modifiers,  Next: Machine Constraints,  Prev: Multi-Alternative,  Up: Constraints
  9182.  
  9183. Constraint Modifier Characters
  9184. ------------------------------
  9185.  
  9186.    Here are constraint modifier characters.
  9187.  
  9188. `='
  9189.      Means that this operand is write-only for this instruction: the
  9190.      previous value is discarded and replaced by output data.
  9191.  
  9192. `+'
  9193.      Means that this operand is both read and written by the
  9194.      instruction.
  9195.  
  9196.      When the compiler fixes up the operands to satisfy the constraints,
  9197.      it needs to know which operands are inputs to the instruction and
  9198.      which are outputs from it.  `=' identifies an output; `+'
  9199.      identifies an operand that is both input and output; all other
  9200.      operands are assumed to be input only.
  9201.  
  9202. `&'
  9203.      Means (in a particular alternative) that this operand is written
  9204.      before the instruction is finished using the input operands.
  9205.      Therefore, this operand may not lie in a register that is used as
  9206.      an input operand or as part of any memory address.
  9207.  
  9208.      `&' applies only to the alternative in which it is written.  In
  9209.      constraints with multiple alternatives, sometimes one alternative
  9210.      requires `&' while others do not.  See, for example, the `movdf'
  9211.      insn of the 68000.
  9212.  
  9213.      `&' does not obviate the need to write `='.
  9214.  
  9215. `%'
  9216.      Declares the instruction to be commutative for this operand and the
  9217.      following operand.  This means that the compiler may interchange
  9218.      the two operands if that is the cheapest way to make all operands
  9219.      fit the constraints.
  9220.  
  9221. `#'
  9222.      Says that all following characters, up to the next comma, are to be
  9223.      ignored as a constraint.  They are significant only for choosing
  9224.      register preferences.
  9225.  
  9226. 
  9227. File: !gcc.docs.gccuser,  Node: Machine Constraints,  Prev: Modifiers,  Up: Constraints
  9228.  
  9229. Constraints for Particular Machines
  9230. -----------------------------------
  9231.  
  9232.    Whenever possible, you should use the general-purpose constraint
  9233. letters in `asm' arguments, since they will convey meaning more readily
  9234. to people reading your code.  Failing that, use the constraint letters
  9235. that usually have very similar meanings across architectures.  The most
  9236. commonly used constraints are `m' and `r' (for memory and
  9237. general-purpose registers respectively; *note Simple Constraints::.),
  9238. and `I', usually the letter indicating the most common
  9239. immediate-constant format.
  9240.  
  9241.    For each machine architecture, the `config/MACHINE.h' file defines
  9242. additional constraints.  These constraints are used by the compiler
  9243. itself for instruction generation, as well as for `asm' statements;
  9244. therefore, some of the constraints are not particularly interesting for
  9245. `asm'.  The constraints are defined through these macros:
  9246.  
  9247. `REG_CLASS_FROM_LETTER'
  9248.      Register class constraints (usually lower case).
  9249.  
  9250. `CONST_OK_FOR_LETTER_P'
  9251.      Immediate constant constraints, for non-floating point constants of
  9252.      word size or smaller precision (usually upper case).
  9253.  
  9254. `CONST_DOUBLE_OK_FOR_LETTER_P'
  9255.      Immediate constant constraints, for all floating point constants
  9256.      and for constants of greater than word size precision (usually
  9257.      upper case).
  9258.  
  9259. `EXTRA_CONSTRAINT'
  9260.      Special cases of registers or memory.  This macro is not required,
  9261.      and is only defined for some machines.
  9262.  
  9263.    Inspecting these macro definitions in the compiler source for your
  9264. machine is the best way to be certain you have the right constraints.
  9265. However, here is a summary of the machine-dependent constraints
  9266. available on some particular machines.
  9267.  
  9268. *ARM family--`arm.h'*
  9269.     `f'
  9270.           Floating-point register
  9271.  
  9272.     `F'
  9273.           One of the floating-point constants 0.0, 0.5, 1.0, 2.0, 3.0,
  9274.           4.0, 5.0 or 10.0
  9275.  
  9276.     `G'
  9277.           Floating-point constant that would satisfy the constraint `F'
  9278.           if it were negated
  9279.  
  9280.     `I'
  9281.           Integer that is valid as an immediate operand in a data
  9282.           processing instruction.  That is, an integer in the range 0
  9283.           to 255 rotated by a multiple of 2
  9284.  
  9285.     `J'
  9286.           Integer in the range -4095 to 4095
  9287.  
  9288.     `K'
  9289.           Integer that satisfies constraint `I' when inverted (ones
  9290.           complement)
  9291.  
  9292.     `L'
  9293.           Integer that satisfies constraint `I' when negated (twos
  9294.           complement)
  9295.  
  9296.     `M'
  9297.           Integer in the range 0 to 32
  9298.  
  9299.     `Q'
  9300.           A memory reference where the exact address is in a single
  9301.           register (``m'' is preferable for `asm' statements)
  9302.  
  9303.     `R'
  9304.           An item in the constant pool
  9305.  
  9306.     `S'
  9307.           A symbol in the text segment of the current file
  9308.  
  9309. *AMD 29000 family--`a29k.h'*
  9310.     `l'
  9311.           Local register 0
  9312.  
  9313.     `b'
  9314.           Byte Pointer (`BP') register
  9315.  
  9316.     `q'
  9317.           `Q' register
  9318.  
  9319.     `h'
  9320.           Special purpose register
  9321.  
  9322.     `A'
  9323.           First accumulator register
  9324.  
  9325.     `a'
  9326.           Other accumulator register
  9327.  
  9328.     `f'
  9329.           Floating point register
  9330.  
  9331.     `I'
  9332.           Constant greater than 0, less than 0x100
  9333.  
  9334.     `J'
  9335.           Constant greater than 0, less than 0x10000
  9336.  
  9337.     `K'
  9338.           Constant whose high 24 bits are on (1)
  9339.  
  9340.     `L'
  9341.           16 bit constant whose high 8 bits are on (1)
  9342.  
  9343.     `M'
  9344.           32 bit constant whose high 16 bits are on (1)
  9345.  
  9346.     `N'
  9347.           32 bit negative constant that fits in 8 bits
  9348.  
  9349.     `O'
  9350.           The constant 0x80000000 or, on the 29050, any 32 bit constant
  9351.           whose low 16 bits are 0.
  9352.  
  9353.     `P'
  9354.           16 bit negative constant that fits in 8 bits
  9355.  
  9356.     `G'
  9357.     `H'
  9358.           A floating point constant (in `asm' statements, use the
  9359.           machine independent `E' or `F' instead)
  9360.  
  9361. *IBM RS6000--`rs6000.h'*
  9362.     `b'
  9363.           Address base register
  9364.  
  9365.     `f'
  9366.           Floating point register
  9367.  
  9368.     `h'
  9369.           `MQ', `CTR', or `LINK' register
  9370.  
  9371.     `q'
  9372.           `MQ' register
  9373.  
  9374.     `c'
  9375.           `CTR' register
  9376.  
  9377.     `l'
  9378.           `LINK' register
  9379.  
  9380.     `x'
  9381.           `CR' register (condition register) number 0
  9382.  
  9383.     `y'
  9384.           `CR' register (condition register)
  9385.  
  9386.     `I'
  9387.           Signed 16 bit constant
  9388.  
  9389.     `J'
  9390.           Constant whose low 16 bits are 0
  9391.  
  9392.     `K'
  9393.           Constant whose high 16 bits are 0
  9394.  
  9395.     `L'
  9396.           Constant suitable as a mask operand
  9397.  
  9398.     `M'
  9399.           Constant larger than 31
  9400.  
  9401.     `N'
  9402.           Exact power of 2
  9403.  
  9404.     `O'
  9405.           Zero
  9406.  
  9407.     `P'
  9408.           Constant whose negation is a signed 16 bit constant
  9409.  
  9410.     `G'
  9411.           Floating point constant that can be loaded into a register
  9412.           with one instruction per word
  9413.  
  9414.     `Q'
  9415.           Memory operand that is an offset from a register (`m' is
  9416.           preferable for `asm' statements)
  9417.  
  9418. *Intel 386--`i386.h'*
  9419.     `q'
  9420.           `a', `b', `c', or `d' register
  9421.  
  9422.     `A'
  9423.           `a', or `d' register (for 64-bit ints)
  9424.  
  9425.     `f'
  9426.           Floating point register
  9427.  
  9428.     `t'
  9429.           First (top of stack) floating point register
  9430.  
  9431.     `u'
  9432.           Second floating point register
  9433.  
  9434.     `a'
  9435.           `a' register
  9436.  
  9437.     `b'
  9438.           `b' register
  9439.  
  9440.     `c'
  9441.           `c' register
  9442.  
  9443.     `d'
  9444.           `d' register
  9445.  
  9446.     `D'
  9447.           `di' register
  9448.  
  9449.     `S'
  9450.           `si' register
  9451.  
  9452.     `I'
  9453.           Constant in range 0 to 31 (for 32 bit shifts)
  9454.  
  9455.     `J'
  9456.           Constant in range 0 to 63 (for 64 bit shifts)
  9457.  
  9458.     `K'
  9459.           `0xff'
  9460.  
  9461.     `L'
  9462.           `0xffff'
  9463.  
  9464.     `M'
  9465.           0, 1, 2, or 3 (shifts for `lea' instruction)
  9466.  
  9467.     `N'
  9468.           Constant in range 0 to 255 (for `out' instruction)
  9469.  
  9470.     `G'
  9471.           Standard 80387 floating point constant
  9472.  
  9473. *Intel 960--`i960.h'*
  9474.     `f'
  9475.           Floating point register (`fp0' to `fp3')
  9476.  
  9477.     `l'
  9478.           Local register (`r0' to `r15')
  9479.  
  9480.     `b'
  9481.           Global register (`g0' to `g15')
  9482.  
  9483.     `d'
  9484.           Any local or global register
  9485.  
  9486.     `I'
  9487.           Integers from 0 to 31
  9488.  
  9489.     `J'
  9490.           0
  9491.  
  9492.     `K'
  9493.           Integers from -31 to 0
  9494.  
  9495.     `G'
  9496.           Floating point 0
  9497.  
  9498.     `H'
  9499.           Floating point 1
  9500.  
  9501. *MIPS--`mips.h'*
  9502.     `d'
  9503.           General-purpose integer register
  9504.  
  9505.     `f'
  9506.           Floating-point register (if available)
  9507.  
  9508.     `h'
  9509.           `Hi' register
  9510.  
  9511.     `l'
  9512.           `Lo' register
  9513.  
  9514.     `x'
  9515.           `Hi' or `Lo' register
  9516.  
  9517.     `y'
  9518.           General-purpose integer register
  9519.  
  9520.     `z'
  9521.           Floating-point status register
  9522.  
  9523.     `I'
  9524.           Signed 16 bit constant (for arithmetic instructions)
  9525.  
  9526.     `J'
  9527.           Zero
  9528.  
  9529.     `K'
  9530.           Zero-extended 16-bit constant (for logic instructions)
  9531.  
  9532.     `L'
  9533.           Constant with low 16 bits zero (can be loaded with `lui')
  9534.  
  9535.     `M'
  9536.           32 bit constant which requires two instructions to load (a
  9537.           constant which is not `I', `K', or `L')
  9538.  
  9539.     `N'
  9540.           Negative 16 bit constant
  9541.  
  9542.     `O'
  9543.           Exact power of two
  9544.  
  9545.     `P'
  9546.           Positive 16 bit constant
  9547.  
  9548.     `G'
  9549.           Floating point zero
  9550.  
  9551.     `Q'
  9552.           Memory reference that can be loaded with more than one
  9553.           instruction (`m' is preferable for `asm' statements)
  9554.  
  9555.     `R'
  9556.           Memory reference that can be loaded with one instruction (`m'
  9557.           is preferable for `asm' statements)
  9558.  
  9559.     `S'
  9560.           Memory reference in external OSF/rose PIC format (`m' is
  9561.           preferable for `asm' statements)
  9562.  
  9563. *Motorola 680x0--`m68k.h'*
  9564.     `a'
  9565.           Address register
  9566.  
  9567.     `d'
  9568.           Data register
  9569.  
  9570.     `f'
  9571.           68881 floating-point register, if available
  9572.  
  9573.     `x'
  9574.           Sun FPA (floating-point) register, if available
  9575.  
  9576.     `y'
  9577.           First 16 Sun FPA registers, if available
  9578.  
  9579.     `I'
  9580.           Integer in the range 1 to 8
  9581.  
  9582.     `J'
  9583.           16 bit signed number
  9584.  
  9585.     `K'
  9586.           Signed number whose magnitude is greater than 0x80
  9587.  
  9588.     `L'
  9589.           Integer in the range -8 to -1
  9590.  
  9591.     `G'
  9592.           Floating point constant that is not a 68881 constant
  9593.  
  9594.     `H'
  9595.           Floating point constant that can be used by Sun FPA
  9596.  
  9597. *SPARC--`sparc.h'*
  9598.     `f'
  9599.           Floating-point register
  9600.  
  9601.     `I'
  9602.           Signed 13 bit constant
  9603.  
  9604.     `J'
  9605.           Zero
  9606.  
  9607.     `K'
  9608.           32 bit constant with the low 12 bits clear (a constant that
  9609.           can be loaded with the `sethi' instruction)
  9610.  
  9611.     `G'
  9612.           Floating-point zero
  9613.  
  9614.     `H'
  9615.           Signed 13 bit constant, sign-extended to 32 or 64 bits
  9616.  
  9617.     `Q'
  9618.           Memory reference that can be loaded with one instruction
  9619.           (`m' is more appropriate for `asm' statements)
  9620.  
  9621.     `S'
  9622.           Constant, or memory address
  9623.  
  9624.     `T'
  9625.           Memory address aligned to an 8-byte boundary
  9626.  
  9627.     `U'
  9628.           Even register
  9629.  
  9630. 
  9631. File: !gcc.docs.gccuser,  Node: Asm Labels,  Next: Explicit Reg Vars,  Prev: Constraints,  Up: C Extensions
  9632.  
  9633. Controlling Names Used in Assembler Code
  9634. ========================================
  9635.  
  9636.    You can specify the name to be used in the assembler code for a C
  9637. function or variable by writing the `asm' (or `__asm__') keyword after
  9638. the declarator as follows:
  9639.  
  9640.      int foo asm ("myfoo") = 2;
  9641.  
  9642. This specifies that the name to be used for the variable `foo' in the
  9643. assembler code should be `myfoo' rather than the usual `_foo'.
  9644.  
  9645.    On systems where an underscore is normally prepended to the name of
  9646. a C function or variable, this feature allows you to define names for
  9647. the linker that do not start with an underscore.
  9648.  
  9649.    You cannot use `asm' in this way in a function *definition*; but you
  9650. can get the same effect by writing a declaration for the function
  9651. before its definition and putting `asm' there, like this:
  9652.  
  9653.      extern func () asm ("FUNC");
  9654.      
  9655.      func (x, y)
  9656.           int x, y;
  9657.      ...
  9658.  
  9659.    It is up to you to make sure that the assembler names you choose do
  9660. not conflict with any other assembler symbols.  Also, you must not use a
  9661. register name; that would produce completely invalid assembler code.
  9662. GNU CC does not as yet have the ability to store static variables in
  9663. registers.  Perhaps that will be added.
  9664.  
  9665. 
  9666. File: !gcc.docs.gccuser,  Node: Explicit Reg Vars,  Next: Alternate Keywords,  Prev: Asm Labels,  Up: C Extensions
  9667.  
  9668. Variables in Specified Registers
  9669. ================================
  9670.  
  9671.    GNU C allows you to put a few global variables into specified
  9672. hardware registers.  You can also specify the register in which an
  9673. ordinary register variable should be allocated.
  9674.  
  9675.    * Global register variables reserve registers throughout the program.
  9676.      This may be useful in programs such as programming language
  9677.      interpreters which have a couple of global variables that are
  9678.      accessed very often.
  9679.  
  9680.    * Local register variables in specific registers do not reserve the
  9681.      registers.  The compiler's data flow analysis is capable of
  9682.      determining where the specified registers contain live values, and
  9683.      where they are available for other uses.
  9684.  
  9685.      These local variables are sometimes convenient for use with the
  9686.      extended `asm' feature (*note Extended Asm::.), if you want to
  9687.      write one output of the assembler instruction directly into a
  9688.      particular register.  (This will work provided the register you
  9689.      specify fits the constraints specified for that operand in the
  9690.      `asm'.)
  9691.  
  9692. * Menu:
  9693.  
  9694. * Global Reg Vars::
  9695. * Local Reg Vars::
  9696.  
  9697. 
  9698. File: !gcc.docs.gccuser,  Node: Global Reg Vars,  Next: Local Reg Vars,  Up: Explicit Reg Vars
  9699.  
  9700. Defining Global Register Variables
  9701. ----------------------------------
  9702.  
  9703.    You can define a global register variable in GNU C like this:
  9704.  
  9705.      register int *foo asm ("a5");
  9706.  
  9707. Here `a5' is the name of the register which should be used.  Choose a
  9708. register which is normally saved and restored by function calls on your
  9709. machine, so that library routines will not clobber it.
  9710.  
  9711.    Naturally the register name is cpu-dependent, so you would need to
  9712. conditionalize your program according to cpu type.  The register `a5'
  9713. would be a good choice on a 68000 for a variable of pointer type.  On
  9714. machines with register windows, be sure to choose a "global" register
  9715. that is not affected magically by the function call mechanism.
  9716.  
  9717.    In addition, operating systems on one type of cpu may differ in how
  9718. they name the registers; then you would need additional conditionals.
  9719. For example, some 68000 operating systems call this register `%a5'.
  9720.  
  9721.    Eventually there may be a way of asking the compiler to choose a
  9722. register automatically, but first we need to figure out how it should
  9723. choose and how to enable you to guide the choice.  No solution is
  9724. evident.
  9725.  
  9726.    Defining a global register variable in a certain register reserves
  9727. that register entirely for this use, at least within the current
  9728. compilation.  The register will not be allocated for any other purpose
  9729. in the functions in the current compilation.  The register will not be
  9730. saved and restored by these functions.  Stores into this register are
  9731. never deleted even if they would appear to be dead, but references may
  9732. be deleted or moved or simplified.
  9733.  
  9734.    It is not safe to access the global register variables from signal
  9735. handlers, or from more than one thread of control, because the system
  9736. library routines may temporarily use the register for other things
  9737. (unless you recompile them specially for the task at hand).
  9738.  
  9739.    It is not safe for one function that uses a global register variable
  9740. to call another such function `foo' by way of a third function `lose'
  9741. that was compiled without knowledge of this variable (i.e. in a
  9742. different source file in which the variable wasn't declared).  This is
  9743. because `lose' might save the register and put some other value there.
  9744. For example, you can't expect a global register variable to be
  9745. available in the comparison-function that you pass to `qsort', since
  9746. `qsort' might have put something else in that register.  (If you are
  9747. prepared to recompile `qsort' with the same global register variable,
  9748. you can solve this problem.)
  9749.  
  9750.    If you want to recompile `qsort' or other source files which do not
  9751. actually use your global register variable, so that they will not use
  9752. that register for any other purpose, then it suffices to specify the
  9753. compiler option `-ffixed-REG'.  You need not actually add a global
  9754. register declaration to their source code.
  9755.  
  9756.    A function which can alter the value of a global register variable
  9757. cannot safely be called from a function compiled without this variable,
  9758. because it could clobber the value the caller expects to find there on
  9759. return.  Therefore, the function which is the entry point into the part
  9760. of the program that uses the global register variable must explicitly
  9761. save and restore the value which belongs to its caller.
  9762.  
  9763.    On most machines, `longjmp' will restore to each global register
  9764. variable the value it had at the time of the `setjmp'.  On some
  9765. machines, however, `longjmp' will not change the value of global
  9766. register variables.  To be portable, the function that called `setjmp'
  9767. should make other arrangements to save the values of the global register
  9768. variables, and to restore them in a `longjmp'.  This way, the same
  9769. thing will happen regardless of what `longjmp' does.
  9770.  
  9771.    All global register variable declarations must precede all function
  9772. definitions.  If such a declaration could appear after function
  9773. definitions, the declaration would be too late to prevent the register
  9774. from being used for other purposes in the preceding functions.
  9775.  
  9776.    Global register variables may not have initial values, because an
  9777. executable file has no means to supply initial contents for a register.
  9778.  
  9779.    On the Sparc, there are reports that g3 ... g7 are suitable
  9780. registers, but certain library functions, such as `getwd', as well as
  9781. the subroutines for division and remainder, modify g3 and g4.  g1 and
  9782. g2 are local temporaries.
  9783.  
  9784.    On the 68000, a2 ... a5 should be suitable, as should d2 ... d7.  Of
  9785. course, it will not do to use more than a few of those.
  9786.  
  9787. 
  9788. File: !gcc.docs.gccuser,  Node: Local Reg Vars,  Prev: Global Reg Vars,  Up: Explicit Reg Vars
  9789.  
  9790. Specifying Registers for Local Variables
  9791. ----------------------------------------
  9792.  
  9793.    You can define a local register variable with a specified register
  9794. like this:
  9795.  
  9796.      register int *foo asm ("a5");
  9797.  
  9798. Here `a5' is the name of the register which should be used.  Note that
  9799. this is the same syntax used for defining global register variables,
  9800. but for a local variable it would appear within a function.
  9801.  
  9802.    Naturally the register name is cpu-dependent, but this is not a
  9803. problem, since specific registers are most often useful with explicit
  9804. assembler instructions (*note Extended Asm::.).  Both of these things
  9805. generally require that you conditionalize your program according to cpu
  9806. type.
  9807.  
  9808.    In addition, operating systems on one type of cpu may differ in how
  9809. they name the registers; then you would need additional conditionals.
  9810. For example, some 68000 operating systems call this register `%a5'.
  9811.  
  9812.    Eventually there may be a way of asking the compiler to choose a
  9813. register automatically, but first we need to figure out how it should
  9814. choose and how to enable you to guide the choice.  No solution is
  9815. evident.
  9816.  
  9817.    Defining such a register variable does not reserve the register; it
  9818. remains available for other uses in places where flow control determines
  9819. the variable's value is not live.  However, these registers are made
  9820. unavailable for use in the reload pass.  I would not be surprised if
  9821. excessive use of this feature leaves the compiler too few available
  9822. registers to compile certain functions.
  9823.  
  9824. 
  9825. File: !gcc.docs.gccuser,  Node: Alternate Keywords,  Next: Incomplete Enums,  Prev: Explicit Reg Vars,  Up: C Extensions
  9826.  
  9827. Alternate Keywords
  9828. ==================
  9829.  
  9830.    The option `-traditional' disables certain keywords; `-ansi'
  9831. disables certain others.  This causes trouble when you want to use GNU C
  9832. extensions, or ANSI C features, in a general-purpose header file that
  9833. should be usable by all programs, including ANSI C programs and
  9834. traditional ones.  The keywords `asm', `typeof' and `inline' cannot be
  9835. used since they won't work in a program compiled with `-ansi', while
  9836. the keywords `const', `volatile', `signed', `typeof' and `inline' won't
  9837. work in a program compiled with `-traditional'.
  9838.  
  9839.    The way to solve these problems is to put `__' at the beginning and
  9840. end of each problematical keyword.  For example, use `__asm__' instead
  9841. of `asm', `__const__' instead of `const', and `__inline__' instead of
  9842. `inline'.
  9843.  
  9844.    Other C compilers won't accept these alternative keywords; if you
  9845. want to compile with another compiler, you can define the alternate
  9846. keywords as macros to replace them with the customary keywords.  It
  9847. looks like this:
  9848.  
  9849.      #ifndef __GNUC__
  9850.      #define __asm__ asm
  9851.      #endif
  9852.  
  9853.    `-pedantic' causes warnings for many GNU C extensions.  You can
  9854. prevent such warnings within one expression by writing `__extension__'
  9855. before the expression.  `__extension__' has no effect aside from this.
  9856.  
  9857. 
  9858. File: !gcc.docs.gccuser,  Node: Incomplete Enums,  Next: Function Names,  Prev: Alternate Keywords,  Up: C Extensions
  9859.  
  9860. Incomplete `enum' Types
  9861. =======================
  9862.  
  9863.    You can define an `enum' tag without specifying its possible values.
  9864. This results in an incomplete type, much like what you get if you write
  9865. `struct foo' without describing the elements.  A later declaration
  9866. which does specify the possible values completes the type.
  9867.  
  9868.    You can't allocate variables or storage using the type while it is
  9869. incomplete.  However, you can work with pointers to that type.
  9870.  
  9871.    This extension may not be very useful, but it makes the handling of
  9872. `enum' more consistent with the way `struct' and `union' are handled.
  9873.  
  9874.    This extension is not supported by GNU C++.
  9875.  
  9876. 
  9877. File: !gcc.docs.gccuser,  Node: Function Names,  Prev: Incomplete Enums,  Up: C Extensions
  9878.  
  9879. Function Names as Strings
  9880. =========================
  9881.  
  9882.    GNU CC predefines two string variables to be the name of the current
  9883. function.  The variable `__FUNCTION__' is the name of the function as
  9884. it appears in the source.  The variable `__PRETTY_FUNCTION__' is the
  9885. name of the function pretty printed in a language specific fashion.
  9886.  
  9887.    These names are always the same in a C function, but in a C++
  9888. function they may be different.  For example, this program:
  9889.  
  9890.      extern "C" {
  9891.      extern int printf (char *, ...);
  9892.      }
  9893.      
  9894.      class a {
  9895.       public:
  9896.        sub (int i)
  9897.          {
  9898.            printf ("__FUNCTION__ = %s\n", __FUNCTION__);
  9899.            printf ("__PRETTY_FUNCTION__ = %s\n", __PRETTY_FUNCTION__);
  9900.          }
  9901.      };
  9902.      
  9903.      int
  9904.      main (void)
  9905.      {
  9906.        a ax;
  9907.        ax.sub (0);
  9908.        return 0;
  9909.      }
  9910.  
  9911. gives this output:
  9912.  
  9913.      __FUNCTION__ = sub
  9914.      __PRETTY_FUNCTION__ = int  a::sub (int)
  9915.  
  9916.    These names are not macros: they are predefined string variables.
  9917. For example, `#ifdef __FUNCTION__' does not have any special meaning
  9918. inside a function, since the preprocessor does not do anything special
  9919. with the identifier `__FUNCTION__'.
  9920.  
  9921. 
  9922. File: !gcc.docs.gccuser,  Node: C++ Extensions,  Next: Trouble,  Prev: C Extensions,  Up: Top
  9923.  
  9924. Extensions to the C++ Language
  9925. ******************************
  9926.  
  9927.    The GNU compiler provides these extensions to the C++ language (and
  9928. you can also use most of the C language extensions in your C++
  9929. programs).  If you want to write code that checks whether these
  9930. features are available, you can test for the GNU compiler the same way
  9931. as for C programs: check for a predefined macro `__GNUC__'.  You can
  9932. also use `__GNUG__' to test specifically for GNU C++ (*note Standard
  9933. Predefined Macros: (cpp.info)Standard Predefined.).
  9934.  
  9935. * Menu:
  9936.  
  9937. * Naming Results::      Giving a name to C++ function return values.
  9938. * Min and Max::        C++ Minimum and maximum operators.
  9939. * Destructors and Goto:: Goto is safe to use in C++ even when destructors
  9940.                            are needed.
  9941. * C++ Interface::       You can use a single C++ header file for both
  9942.                          declarations and definitions.
  9943. * Template Instantiation:: Methods for ensuring that exactly one copy of
  9944.                          each needed template instantiation is emitted.
  9945. * C++ Signatures::    You can specify abstract types to get subtype
  9946.              polymorphism independent from inheritance.
  9947.  
  9948. 
  9949. File: !gcc.docs.gccuser,  Node: Naming Results,  Next: Min and Max,  Up: C++ Extensions
  9950.  
  9951. Named Return Values in C++
  9952. ==========================
  9953.  
  9954.    GNU C++ extends the function-definition syntax to allow you to
  9955. specify a name for the result of a function outside the body of the
  9956. definition, in C++ programs:
  9957.  
  9958.      TYPE
  9959.      FUNCTIONNAME (ARGS) return RESULTNAME;
  9960.      {
  9961.        ...
  9962.        BODY
  9963.        ...
  9964.      }
  9965.  
  9966.    You can use this feature to avoid an extra constructor call when a
  9967. function result has a class type.  For example, consider a function
  9968. `m', declared as `X v = m ();', whose result is of class `X':
  9969.  
  9970.      X
  9971.      m ()
  9972.      {
  9973.        X b;
  9974.        b.a = 23;
  9975.        return b;
  9976.      }
  9977.  
  9978.    Although `m' appears to have no arguments, in fact it has one
  9979. implicit argument: the address of the return value.  At invocation, the
  9980. address of enough space to hold `v' is sent in as the implicit argument.
  9981. Then `b' is constructed and its `a' field is set to the value 23.
  9982. Finally, a copy constructor (a constructor of the form `X(X&)') is
  9983. applied to `b', with the (implicit) return value location as the
  9984. target, so that `v' is now bound to the return value.
  9985.  
  9986.    But this is wasteful.  The local `b' is declared just to hold
  9987. something that will be copied right out.  While a compiler that
  9988. combined an "elision" algorithm with interprocedural data flow analysis
  9989. could conceivably eliminate all of this, it is much more practical to
  9990. allow you to assist the compiler in generating efficient code by
  9991. manipulating the return value explicitly, thus avoiding the local
  9992. variable and copy constructor altogether.
  9993.  
  9994.    Using the extended GNU C++ function-definition syntax, you can avoid
  9995. the temporary allocation and copying by naming `r' as your return value
  9996. at the outset, and assigning to its `a' field directly:
  9997.  
  9998.      X
  9999.      m () return r;
  10000.      {
  10001.        r.a = 23;
  10002.      }
  10003.  
  10004. The declaration of `r' is a standard, proper declaration, whose effects
  10005. are executed *before* any of the body of `m'.
  10006.  
  10007.    Functions of this type impose no additional restrictions; in
  10008. particular, you can execute `return' statements, or return implicitly by
  10009. reaching the end of the function body ("falling off the edge").  Cases
  10010. like
  10011.  
  10012.      X
  10013.      m () return r (23);
  10014.      {
  10015.        return;
  10016.      }
  10017.  
  10018. (or even `X m () return r (23); { }') are unambiguous, since the return
  10019. value `r' has been initialized in either case.  The following code may
  10020. be hard to read, but also works predictably:
  10021.  
  10022.      X
  10023.      m () return r;
  10024.      {
  10025.        X b;
  10026.        return b;
  10027.      }
  10028.  
  10029.    The return value slot denoted by `r' is initialized at the outset,
  10030. but the statement `return b;' overrides this value.  The compiler deals
  10031. with this by destroying `r' (calling the destructor if there is one, or
  10032. doing nothing if there is not), and then reinitializing `r' with `b'.
  10033.  
  10034.    This extension is provided primarily to help people who use
  10035. overloaded operators, where there is a great need to control not just
  10036. the arguments, but the return values of functions.  For classes where
  10037. the copy constructor incurs a heavy performance penalty (especially in
  10038. the common case where there is a quick default constructor), this is a
  10039. major savings.  The disadvantage of this extension is that you do not
  10040. control when the default constructor for the return value is called: it
  10041. is always called at the beginning.
  10042.  
  10043. 
  10044. File: !gcc.docs.gccuser,  Node: Min and Max,  Next: Destructors and Goto,  Prev: Naming Results,  Up: C++ Extensions
  10045.  
  10046. Minimum and Maximum Operators in C++
  10047. ====================================
  10048.  
  10049.    It is very convenient to have operators which return the "minimum"
  10050. or the "maximum" of two arguments.  In GNU C++ (but not in GNU C),
  10051.  
  10052. `A <? B'
  10053.      is the "minimum", returning the smaller of the numeric values A
  10054.      and B;
  10055.  
  10056. `A >? B'
  10057.      is the "maximum", returning the larger of the numeric values A and
  10058.      B.
  10059.  
  10060.    These operations are not primitive in ordinary C++, since you can
  10061. use a macro to return the minimum of two things in C++, as in the
  10062. following example.
  10063.  
  10064.      #define MIN(X,Y) ((X) < (Y) ? : (X) : (Y))
  10065.  
  10066. You might then use `int min = MIN (i, j);' to set MIN to the minimum
  10067. value of variables I and J.
  10068.  
  10069.    However, side effects in `X' or `Y' may cause unintended behavior.
  10070. For example, `MIN (i++, j++)' will fail, incrementing the smaller
  10071. counter twice.  A GNU C extension allows you to write safe macros that
  10072. avoid this kind of problem (*note Naming an Expression's Type: Naming
  10073. Types.).  However, writing `MIN' and `MAX' as macros also forces you to
  10074. use function-call notation notation for a fundamental arithmetic
  10075. operation.  Using GNU C++ extensions, you can write `int min = i <? j;'
  10076. instead.
  10077.  
  10078.    Since `<?' and `>?' are built into the compiler, they properly
  10079. handle expressions with side-effects;  `int min = i++ <? j++;' works
  10080. correctly.
  10081.  
  10082. 
  10083. File: !gcc.docs.gccuser,  Node: Destructors and Goto,  Next: C++ Interface,  Prev: Min and Max,  Up: C++ Extensions
  10084.  
  10085. `goto' and Destructors in GNU C++
  10086. =================================
  10087.  
  10088.    In C++ programs, you can safely use the `goto' statement.  When you
  10089. use it to exit a block which contains aggregates requiring destructors,
  10090. the destructors will run before the `goto' transfers control.  (In ANSI
  10091. C++, `goto' is restricted to targets within the current block.)
  10092.  
  10093.    The compiler still forbids using `goto' to *enter* a scope that
  10094. requires constructors.
  10095.  
  10096. 
  10097. File: !gcc.docs.gccuser,  Node: C++ Interface,  Next: Template Instantiation,  Prev: Destructors and Goto,  Up: C++ Extensions
  10098.  
  10099. Declarations and Definitions in One Header
  10100. ==========================================
  10101.  
  10102.    C++ object definitions can be quite complex.  In principle, your
  10103. source code will need two kinds of things for each object that you use
  10104. across more than one source file.  First, you need an "interface"
  10105. specification, describing its structure with type declarations and
  10106. function prototypes.  Second, you need the "implementation" itself.  It
  10107. can be tedious to maintain a separate interface description in a header
  10108. file, in parallel to the actual implementation.  It is also dangerous,
  10109. since separate interface and implementation definitions may not remain
  10110. parallel.
  10111.  
  10112.    With GNU C++, you can use a single header file for both purposes.
  10113.  
  10114.      *Warning:* The mechanism to specify this is in transition.  For the
  10115.      nonce, you must use one of two `#pragma' commands; in a future
  10116.      release of GNU C++, an alternative mechanism will make these
  10117.      `#pragma' commands unnecessary.
  10118.  
  10119.    The header file contains the full definitions, but is marked with
  10120. `#pragma interface' in the source code.  This allows the compiler to
  10121. use the header file only as an interface specification when ordinary
  10122. source files incorporate it with `#include'.  In the single source file
  10123. where the full implementation belongs, you can use either a naming
  10124. convention or `#pragma implementation' to indicate this alternate use
  10125. of the header file.
  10126.  
  10127. `#pragma interface'
  10128. `#pragma interface "SUBDIR/OBJECTS.h"'
  10129.      Use this directive in *header files* that define object classes,
  10130.      to save space in most of the object files that use those classes.
  10131.      Normally, local copies of certain information (backup copies of
  10132.      inline member functions, debugging information, and the internal
  10133.      tables that implement virtual functions) must be kept in each
  10134.      object file that includes class definitions.  You can use this
  10135.      pragma to avoid such duplication.  When a header file containing
  10136.      `#pragma interface' is included in a compilation, this auxiliary
  10137.      information will not be generated (unless the main input source
  10138.      file itself uses `#pragma implementation').  Instead, the object
  10139.      files will contain references to be resolved at link time.
  10140.  
  10141.      The second form of this directive is useful for the case where you
  10142.      have multiple headers with the same name in different directories.
  10143.      If you use this form, you must specify the same string to `#pragma
  10144.      implementation'.
  10145.  
  10146. `#pragma implementation'
  10147. `#pragma implementation "OBJECTS.h"'
  10148.      Use this pragma in a *main input file*, when you want full output
  10149.      from included header files to be generated (and made globally
  10150.      visible).  The included header file, in turn, should use `#pragma
  10151.      interface'.  Backup copies of inline member functions, debugging
  10152.      information, and the internal tables used to implement virtual
  10153.      functions are all generated in implementation files.
  10154.  
  10155.      If you use `#pragma implementation' with no argument, it applies to
  10156.      an include file with the same basename(1) as your source file.
  10157.      For example, in `allclass.cc', `#pragma implementation' by itself
  10158.      is equivalent to `#pragma implementation "allclass.h"'.
  10159.  
  10160.      In versions of GNU C++ prior to 2.6.0 `allclass.h' was treated as
  10161.      an implementation file whenever you would include it from
  10162.      `allclass.cc' even if you never specified `#pragma
  10163.      implementation'.  This was deemed to be more trouble than it was
  10164.      worth, however, and disabled.
  10165.  
  10166.      If you use an explicit `#pragma implementation', it must appear in
  10167.      your source file *before* you include the affected header files.
  10168.  
  10169.      Use the string argument if you want a single implementation file to
  10170.      include code from multiple header files.  (You must also use
  10171.      `#include' to include the header file; `#pragma implementation'
  10172.      only specifies how to use the file--it doesn't actually include
  10173.      it.)
  10174.  
  10175.      There is no way to split up the contents of a single header file
  10176.      into multiple implementation files.
  10177.  
  10178.    `#pragma implementation' and `#pragma interface' also have an effect
  10179. on function inlining.
  10180.  
  10181.    If you define a class in a header file marked with `#pragma
  10182. interface', the effect on a function defined in that class is similar to
  10183. an explicit `extern' declaration--the compiler emits no code at all to
  10184. define an independent version of the function.  Its definition is used
  10185. only for inlining with its callers.
  10186.  
  10187.    Conversely, when you include the same header file in a main source
  10188. file that declares it as `#pragma implementation', the compiler emits
  10189. code for the function itself; this defines a version of the function
  10190. that can be found via pointers (or by callers compiled without
  10191. inlining).  If all calls to the function can be inlined, you can avoid
  10192. emitting the function by compiling with `-fno-implement-inlines'.  If
  10193. any calls were not inlined, you will get linker errors.
  10194.  
  10195.    ---------- Footnotes ----------
  10196.  
  10197.    (1)  A file's "basename" was the name stripped of all leading path
  10198. information and of trailing suffixes, such as `.h' or `.C' or `.cc'.
  10199.  
  10200. 
  10201. File: !gcc.docs.gccuser,  Node: Template Instantiation,  Next: C++ Signatures,  Prev: C++ Interface,  Up: C++ Extensions
  10202.  
  10203. Where's the Template?
  10204. =====================
  10205.  
  10206.    C++ templates are the first language feature to require more
  10207. intelligence from the environment than one usually finds on a UNIX
  10208. system.  Somehow the compiler and linker have to make sure that each
  10209. template instance occurs exactly once in the executable if it is needed,
  10210. and not at all otherwise.  There are two basic approaches to this
  10211. problem, which I will refer to as the Borland model and the Cfront
  10212. model.
  10213.  
  10214. Borland model
  10215.      Borland C++ solved the template instantiation problem by adding
  10216.      the code equivalent of common blocks to their linker; template
  10217.      instances are emitted in each translation unit that uses them, and
  10218.      they are collapsed together at run time.  The advantage of this
  10219.      model is that the linker only has to consider the object files
  10220.      themselves; there is no external complexity to worry about.  This
  10221.      disadvantage is that compilation time is increased because the
  10222.      template code is being compiled repeatedly.  Code written for this
  10223.      model tends to include definitions of all member templates in the
  10224.      header file, since they must be seen to be compiled.
  10225.  
  10226. Cfront model
  10227.      The AT&T C++ translator, Cfront, solved the template instantiation
  10228.      problem by creating the notion of a template repository, an
  10229.      automatically maintained place where template instances are
  10230.      stored.  As individual object files are built, notes are placed in
  10231.      the repository to record where templates and potential type
  10232.      arguments were seen so that the subsequent instantiation step
  10233.      knows where to find them.  At link time, any needed instances are
  10234.      generated and linked in.  The advantages of this model are more
  10235.      optimal compilation speed and the ability to use the system
  10236.      linker; to implement the Borland model a compiler vendor also
  10237.      needs to replace the linker.  The disadvantages are vastly
  10238.      increased complexity, and thus potential for error; theoretically,
  10239.      this should be just as transparent, but in practice it has been
  10240.      very difficult to build multiple programs in one directory and one
  10241.      program in multiple directories using Cfront.  Code written for
  10242.      this model tends to separate definitions of non-inline member
  10243.      templates into a separate file, which is magically found by the
  10244.      link preprocessor when a template needs to be instantiated.
  10245.  
  10246.    Currently, g++ implements neither automatic model.  In the mean time,
  10247. you have three options for dealing with template instantiations:
  10248.  
  10249.   1. Do nothing.  Pretend g++ does implement automatic instantiation
  10250.      management.  Code written for the Borland model will work fine, but
  10251.      each translation unit will contain instances of each of the
  10252.      templates it uses.  In a large program, this can lead to an
  10253.      unacceptable amount of code duplication.
  10254.  
  10255.   2. Add `#pragma interface' to all files containing template
  10256.      definitions.  For each of these files, add `#pragma implementation
  10257.      "FILENAME"' to the top of some `.C' file which `#include's it.
  10258.      Then compile everything with -fexternal-templates.  The templates
  10259.      will then only be expanded in the translation unit which
  10260.      implements them (i.e. has a `#pragma implementation' line for the
  10261.      file where they live); all other files will use external
  10262.      references.  If you're lucky, everything should work properly.  If
  10263.      you get undefined symbol errors, you need to make sure that each
  10264.      template instance which is used in the program is used in the file
  10265.      which implements that template.  If you don't have any use for a
  10266.      particular instance in that file, you can just instantiate it
  10267.      explicitly, using the syntax from the latest C++ working paper:
  10268.  
  10269.           template class A<int>;
  10270.           template ostream& operator << (ostream&, const A<int>&);
  10271.  
  10272.      This strategy will work with code written for either model.  If
  10273.      you are using code written for the Cfront model, the file
  10274.      containing a class template and the file containing its member
  10275.      templates should be implemented in the same translation unit.
  10276.  
  10277.      A slight variation on this approach is to use the flag
  10278.      -falt-external-templates instead; this flag causes template
  10279.      instances to be emitted in the translation unit that implements
  10280.      the header where they are first instantiated, rather than the one
  10281.      which implements the file where the templates are defined.  This
  10282.      header must be the same in all translation units, or things are
  10283.      likely to break.
  10284.  
  10285.      *Note Declarations and Definitions in One Header: C++ Interface,
  10286.      for more discussion of these pragmas.
  10287.  
  10288.   3. Explicitly instantiate all the template instances you use, and
  10289.      compile with -fno-implicit-templates.  This is probably your best
  10290.      bet; it may require more knowledge of exactly which templates you
  10291.      are using, but it's less mysterious than the previous approach,
  10292.      and it doesn't require any `#pragma's or other g++-specific code.
  10293.      You can scatter the instantiations throughout your program, you
  10294.      can create one big file to do all the instantiations, or you can
  10295.      create tiny files like
  10296.  
  10297.           #include "Foo.h"
  10298.           #include "Foo.cc"
  10299.           
  10300.           template class Foo<int>;
  10301.  
  10302.      for each instance you need, and create a template instantiation
  10303.      library from those.  I'm partial to the last, but your mileage may
  10304.      vary.  If you are using Cfront-model code, you can probably get
  10305.      away with not using -fno-implicit-templates when compiling files
  10306.      that don't `#include' the member template definitions.
  10307.  
  10308. 
  10309. File: !gcc.docs.gccuser,  Node: C++ Signatures,  Prev: Template Instantiation,  Up: C++ Extensions
  10310.  
  10311. Type Abstraction using Signatures
  10312. =================================
  10313.  
  10314.    In GNU C++, you can use the keyword `signature' to define a
  10315. completely abstract class interface as a datatype.  You can connect this
  10316. abstraction with actual classes using signature pointers.  If you want
  10317. to use signatures, run the GNU compiler with the `-fhandle-signatures'
  10318. command-line option.  (With this option, the compiler reserves a second
  10319. keyword `sigof' as well, for a future extension.)
  10320.  
  10321.    Roughly, signatures are type abstractions or interfaces of classes.
  10322. Some other languages have similar facilities.  C++ signatures are
  10323. related to ML's signatures, Haskell's type classes, definition modules
  10324. in Modula-2, interface modules in Modula-3, abstract types in Emerald,
  10325. type modules in Trellis/Owl, categories in Scratchpad II, and types in
  10326. POOL-I.  For a more detailed discussion of signatures, see `Signatures:
  10327. A Language Extension for Improving Type Abstraction and Subtype
  10328. Polymorphism in C++' by Gerald Baumgartner and Vincent F. Russo (Tech
  10329. report CSD-TR-95-051, Dept. of Computer Sciences, Purdue University,
  10330. August 1995, a slightly improved version appeared in
  10331. *Software--Practice & Experience*, 25(8), pp. 863-889, August 1995).
  10332. You can get the tech report by anonymous FTP from `ftp.cs.purdue.edu'
  10333. in `pub/gb/Signature-design.ps.gz'.
  10334.  
  10335.    Syntactically, a signature declaration is a collection of member
  10336. function declarations and nested type declarations.  For example, this
  10337. signature declaration defines a new abstract type `S' with member
  10338. functions `int foo ()' and `int bar (int)':
  10339.  
  10340.      signature S
  10341.      {
  10342.        int foo ();
  10343.        int bar (int);
  10344.      };
  10345.  
  10346.    Since signature types do not include implementation definitions, you
  10347. cannot write an instance of a signature directly.  Instead, you can
  10348. define a pointer to any class that contains the required interfaces as a
  10349. "signature pointer".  Such a class "implements" the signature type.
  10350.  
  10351.    To use a class as an implementation of `S', you must ensure that the
  10352. class has public member functions `int foo ()' and `int bar (int)'.
  10353. The class can have other member functions as well, public or not; as
  10354. long as it offers what's declared in the signature, it is suitable as
  10355. an implementation of that signature type.
  10356.  
  10357.    For example, suppose that `C' is a class that meets the requirements
  10358. of signature `S' (`C' "conforms to" `S').  Then
  10359.  
  10360.      C obj;
  10361.      S * p = &obj;
  10362.  
  10363. defines a signature pointer `p' and initializes it to point to an
  10364. object of type `C'.  The member function call `int i = p->foo ();'
  10365. executes `obj.foo ()'.
  10366.  
  10367.    Abstract virtual classes provide somewhat similar facilities in
  10368. standard C++.  There are two main advantages to using signatures
  10369. instead:
  10370.  
  10371.   1. Subtyping becomes independent from inheritance.  A class or
  10372.      signature type `T' is a subtype of a signature type `S'
  10373.      independent of any inheritance hierarchy as long as all the member
  10374.      functions declared in `S' are also found in `T'.  So you can
  10375.      define a subtype hierarchy that is completely independent from any
  10376.      inheritance (implementation) hierarchy, instead of being forced to
  10377.      use types that mirror the class inheritance hierarchy.
  10378.  
  10379.   2. Signatures allow you to work with existing class hierarchies as
  10380.      implementations of a signature type.  If those class hierarchies
  10381.      are only available in compiled form, you're out of luck with
  10382.      abstract virtual classes, since an abstract virtual class cannot
  10383.      be retrofitted on top of existing class hierarchies.  So you would
  10384.      be required to write interface classes as subtypes of the abstract
  10385.      virtual class.
  10386.  
  10387.    There is one more detail about signatures.  A signature declaration
  10388. can contain member function *definitions* as well as member function
  10389. declarations.  A signature member function with a full definition is
  10390. called a *default implementation*; classes need not contain that
  10391. particular interface in order to conform.  For example, a class `C' can
  10392. conform to the signature
  10393.  
  10394.      signature T
  10395.      {
  10396.        int f (int);
  10397.        int f0 () { return f (0); };
  10398.      };
  10399.  
  10400. whether or not `C' implements the member function `int f0 ()'.  If you
  10401. define `C::f0', that definition takes precedence; otherwise, the
  10402. default implementation `S::f0' applies.
  10403.  
  10404. 
  10405. File: !gcc.docs.gccuser,  Node: Trouble,  Next: Bugs,  Prev: C++ Extensions,  Up: Top
  10406.  
  10407. Known Causes of Trouble with GNU CC
  10408. ***********************************
  10409.  
  10410.    This section describes known problems that affect users of GNU CC.
  10411. Most of these are not GNU CC bugs per se--if they were, we would fix
  10412. them.  But the result for a user may be like the result of a bug.
  10413.  
  10414.    Some of these problems are due to bugs in other software, some are
  10415. missing features that are too much work to add, and some are places
  10416. where people's opinions differ as to what is best.
  10417.  
  10418. * Menu:
  10419.  
  10420. * Actual Bugs::              Bugs we will fix later.
  10421. * Installation Problems::     Problems that manifest when you install GNU CC.
  10422. * Cross-Compiler Problems::   Common problems of cross compiling with GNU CC.
  10423. * Interoperation::      Problems using GNU CC with other compilers,
  10424.                and with certain linkers, assemblers and debuggers.
  10425. * External Bugs::    Problems compiling certain programs.
  10426. * Incompatibilities::   GNU CC is incompatible with traditional C.
  10427. * Fixed Headers::       GNU C uses corrected versions of system header files.
  10428.                            This is necessary, but doesn't always work smoothly.
  10429. * Standard Libraries::  GNU C uses the system C library, which might not be
  10430.                            compliant with the ISO/ANSI C standard.
  10431. * Disappointments::     Regrettable things we can't change, but not quite bugs.
  10432. * C++ Misunderstandings::     Common misunderstandings with GNU C++.
  10433. * Protoize Caveats::    Things to watch out for when using `protoize'.
  10434. * Non-bugs::        Things we think are right, but some others disagree.
  10435. * Warnings and Errors:: Which problems in your code get warnings,
  10436.                          and which get errors.
  10437.  
  10438. 
  10439. File: !gcc.docs.gccuser,  Node: Actual Bugs,  Next: Installation Problems,  Up: Trouble
  10440.  
  10441. Actual Bugs We Haven't Fixed Yet
  10442. ================================
  10443.  
  10444.    * The `fixincludes' script interacts badly with automounters; if the
  10445.      directory of system header files is automounted, it tends to be
  10446.      unmounted while `fixincludes' is running.  This would seem to be a
  10447.      bug in the automounter.  We don't know any good way to work around
  10448.      it.
  10449.  
  10450.    * The `fixproto' script will sometimes add prototypes for the
  10451.      `sigsetjmp' and `siglongjmp' functions that reference the
  10452.      `jmp_buf' type before that type is defined.  To work around this,
  10453.      edit the offending file and place the typedef in front of the
  10454.      prototypes.
  10455.  
  10456.    * There are several obscure case of mis-using struct, union, and
  10457.      enum tags that are not detected as errors by the compiler.
  10458.  
  10459.    * When `-pedantic-errors' is specified, GNU C will incorrectly give
  10460.      an error message when a function name is specified in an expression
  10461.      involving the comma operator.
  10462.  
  10463.    * Loop unrolling doesn't work properly for certain C++ programs.
  10464.      This is a bug in the C++ front end.  It sometimes emits incorrect
  10465.      debug info, and the loop unrolling code is unable to recover from
  10466.      this error.
  10467.  
  10468. 
  10469. File: !gcc.docs.gccuser,  Node: Installation Problems,  Next: Cross-Compiler Problems,  Prev: Actual Bugs,  Up: Trouble
  10470.  
  10471. Installation Problems
  10472. =====================
  10473.  
  10474.    This is a list of problems (and some apparent problems which don't
  10475. really mean anything is wrong) that show up during installation of GNU
  10476. CC.
  10477.  
  10478.    * On certain systems, defining certain environment variables such as
  10479.      `CC' can interfere with the functioning of `make'.
  10480.  
  10481.    * If you encounter seemingly strange errors when trying to build the
  10482.      compiler in a directory other than the source directory, it could
  10483.      be because you have previously configured the compiler in the
  10484.      source directory.  Make sure you have done all the necessary
  10485.      preparations.  *Note Other Dir::.
  10486.  
  10487.    * If you build GNU CC on a BSD system using a directory stored in a
  10488.      System V file system, problems may occur in running `fixincludes'
  10489.      if the System V file system doesn't support symbolic links.  These
  10490.      problems result in a failure to fix the declaration of `size_t' in
  10491.      `sys/types.h'.  If you find that `size_t' is a signed type and
  10492.      that type mismatches occur, this could be the cause.
  10493.  
  10494.      The solution is not to use such a directory for building GNU CC.
  10495.  
  10496.    * In previous versions of GNU CC, the `gcc' driver program looked for
  10497.      `as' and `ld' in various places; for example, in files beginning
  10498.      with `/usr/local/lib/gcc-'.  GNU CC version 2 looks for them in
  10499.      the directory `/usr/local/lib/gcc-lib/TARGET/VERSION'.
  10500.  
  10501.      Thus, to use a version of `as' or `ld' that is not the system
  10502.      default, for example `gas' or GNU `ld', you must put them in that
  10503.      directory (or make links to them from that directory).
  10504.  
  10505.    * Some commands executed when making the compiler may fail (return a
  10506.      non-zero status) and be ignored by `make'.  These failures, which
  10507.      are often due to files that were not found, are expected, and can
  10508.      safely be ignored.
  10509.  
  10510.    * It is normal to have warnings in compiling certain files about
  10511.      unreachable code and about enumeration type clashes.  These files'
  10512.      names begin with `insn-'.  Also, `real.c' may get some warnings
  10513.      that you can ignore.
  10514.  
  10515.    * Sometimes `make' recompiles parts of the compiler when installing
  10516.      the compiler.  In one case, this was traced down to a bug in
  10517.      `make'.  Either ignore the problem or switch to GNU Make.
  10518.  
  10519.    * If you have installed a program known as purify, you may find that
  10520.      it causes errors while linking `enquire', which is part of building
  10521.      GNU CC.  The fix is to get rid of the file `real-ld' which purify
  10522.      installs--so that GNU CC won't try to use it.
  10523.  
  10524.    * On Linux SLS 1.01, there is a problem with `libc.a': it does not
  10525.      contain the obstack functions.  However, GNU CC assumes that the
  10526.      obstack functions are in `libc.a' when it is the GNU C library.
  10527.      To work around this problem, change the `__GNU_LIBRARY__'
  10528.      conditional around line 31 to `#if 1'.
  10529.  
  10530.    * On some 386 systems, building the compiler never finishes because
  10531.      `enquire' hangs due to a hardware problem in the motherboard--it
  10532.      reports floating point exceptions to the kernel incorrectly.  You
  10533.      can install GNU CC except for `float.h' by patching out the
  10534.      command to run `enquire'.  You may also be able to fix the problem
  10535.      for real by getting a replacement motherboard.  This problem was
  10536.      observed in Revision E of the Micronics motherboard, and is fixed
  10537.      in Revision F.  It has also been observed in the MYLEX MXA-33
  10538.      motherboard.
  10539.  
  10540.      If you encounter this problem, you may also want to consider
  10541.      removing the FPU from the socket during the compilation.
  10542.      Alternatively, if you are running SCO Unix, you can reboot and
  10543.      force the FPU to be ignored.  To do this, type `hd(40)unix auto
  10544.      ignorefpu'.
  10545.  
  10546.    * On some 386 systems, GNU CC crashes trying to compile `enquire.c'.
  10547.      This happens on machines that don't have a 387 FPU chip.  On 386
  10548.      machines, the system kernel is supposed to emulate the 387 when you
  10549.      don't have one.  The crash is due to a bug in the emulator.
  10550.  
  10551.      One of these systems is the Unix from Interactive Systems: 386/ix.
  10552.      On this system, an alternate emulator is provided, and it does
  10553.      work.  To use it, execute this command as super-user:
  10554.  
  10555.           ln /etc/emulator.rel1 /etc/emulator
  10556.  
  10557.      and then reboot the system.  (The default emulator file remains
  10558.      present under the name `emulator.dflt'.)
  10559.  
  10560.      Try using `/etc/emulator.att', if you have such a problem on the
  10561.      SCO system.
  10562.  
  10563.      Another system which has this problem is Esix.  We don't know
  10564.      whether it has an alternate emulator that works.
  10565.  
  10566.      On NetBSD 0.8, a similar problem manifests itself as these error
  10567.      messages:
  10568.  
  10569.           enquire.c: In function `fprop':
  10570.           enquire.c:2328: floating overflow
  10571.  
  10572.    * On SCO systems, when compiling GNU CC with the system's compiler,
  10573.      do not use `-O'.  Some versions of the system's compiler miscompile
  10574.      GNU CC with `-O'.
  10575.  
  10576.    * Sometimes on a Sun 4 you may observe a crash in the program
  10577.      `genflags' or `genoutput' while building GNU CC.  This is said to
  10578.      be due to a bug in `sh'.  You can probably get around it by running
  10579.      `genflags' or `genoutput' manually and then retrying the `make'.
  10580.  
  10581.    * On Solaris 2, executables of GNU CC version 2.0.2 are commonly
  10582.      available, but they have a bug that shows up when compiling current
  10583.      versions of GNU CC: undefined symbol errors occur during assembly
  10584.      if you use `-g'.
  10585.  
  10586.      The solution is to compile the current version of GNU CC without
  10587.      `-g'.  That makes a working compiler which you can use to recompile
  10588.      with `-g'.
  10589.  
  10590.    * Solaris 2 comes with a number of optional OS packages.  Some of
  10591.      these packages are needed to use GNU CC fully.  If you did not
  10592.      install all optional packages when installing Solaris, you will
  10593.      need to verify that the packages that GNU CC needs are installed.
  10594.  
  10595.      To check whether an optional package is installed, use the
  10596.      `pkginfo' command.  To add an optional package, use the `pkgadd'
  10597.      command.  For further details, see the Solaris documentation.
  10598.  
  10599.      For Solaris 2.0 and 2.1, GNU CC needs six packages: `SUNWarc',
  10600.      `SUNWbtool', `SUNWesu', `SUNWhea', `SUNWlibm', and `SUNWtoo'.
  10601.  
  10602.      For Solaris 2.2, GNU CC needs an additional seventh package:
  10603.      `SUNWsprot'.
  10604.  
  10605.    * On Solaris 2, trying to use the linker and other tools in
  10606.      `/usr/ucb' to install GNU CC has been observed to cause trouble.
  10607.      For example, the linker may hang indefinitely.  The fix is to
  10608.      remove `/usr/ucb' from your `PATH'.
  10609.  
  10610.    * If you use the 1.31 version of the MIPS assembler (such as was
  10611.      shipped with Ultrix 3.1), you will need to use the
  10612.      -fno-delayed-branch switch when optimizing floating point code.
  10613.      Otherwise, the assembler will complain when the GCC compiler fills
  10614.      a branch delay slot with a floating point instruction, such as
  10615.      `add.d'.
  10616.  
  10617.    * If on a MIPS system you get an error message saying "does not have
  10618.      gp sections for all it's [sic] sectons [sic]", don't worry about
  10619.      it.  This happens whenever you use GAS with the MIPS linker, but
  10620.      there is not really anything wrong, and it is okay to use the
  10621.      output file.  You can stop such warnings by installing the GNU
  10622.      linker.
  10623.  
  10624.      It would be nice to extend GAS to produce the gp tables, but they
  10625.      are optional, and there should not be a warning about their
  10626.      absence.
  10627.  
  10628.    * In Ultrix 4.0 on the MIPS machine, `stdio.h' does not work with GNU
  10629.      CC at all unless it has been fixed with `fixincludes'.  This causes
  10630.      problems in building GNU CC.  Once GNU CC is installed, the
  10631.      problems go away.
  10632.  
  10633.      To work around this problem, when making the stage 1 compiler,
  10634.      specify this option to Make:
  10635.  
  10636.           GCC_FOR_TARGET="./xgcc -B./ -I./include"
  10637.  
  10638.      When making stage 2 and stage 3, specify this option:
  10639.  
  10640.           CFLAGS="-g -I./include"
  10641.  
  10642.    * Users have reported some problems with version 2.0 of the MIPS
  10643.      compiler tools that were shipped with Ultrix 4.1.  Version 2.10
  10644.      which came with Ultrix 4.2 seems to work fine.
  10645.  
  10646.      Users have also reported some problems with version 2.20 of the
  10647.      MIPS compiler tools that were shipped with RISC/os 4.x.  The
  10648.      earlier version 2.11 seems to work fine.
  10649.  
  10650.    * Some versions of the MIPS linker will issue an assertion failure
  10651.      when linking code that uses `alloca' against shared libraries on
  10652.      RISC-OS 5.0, and DEC's OSF/1 systems.  This is a bug in the
  10653.      linker, that is supposed to be fixed in future revisions.  To
  10654.      protect against this, GNU CC passes `-non_shared' to the linker
  10655.      unless you pass an explicit `-shared' or `-call_shared' switch.
  10656.  
  10657.    * On System V release 3, you may get this error message while
  10658.      linking:
  10659.  
  10660.           ld fatal: failed to write symbol name SOMETHING
  10661.            in strings table for file WHATEVER
  10662.  
  10663.      This probably indicates that the disk is full or your ULIMIT won't
  10664.      allow the file to be as large as it needs to be.
  10665.  
  10666.      This problem can also result because the kernel parameter `MAXUMEM'
  10667.      is too small.  If so, you must regenerate the kernel and make the
  10668.      value much larger.  The default value is reported to be 1024; a
  10669.      value of 32768 is said to work.  Smaller values may also work.
  10670.  
  10671.    * On System V, if you get an error like this,
  10672.  
  10673.           /usr/local/lib/bison.simple: In function `yyparse':
  10674.           /usr/local/lib/bison.simple:625: virtual memory exhausted
  10675.  
  10676.      that too indicates a problem with disk space, ULIMIT, or `MAXUMEM'.
  10677.  
  10678.    * Current GNU CC versions probably do not work on version 2 of the
  10679.      NeXT operating system.
  10680.  
  10681.    * On NeXTStep 3.0, the Objective C compiler does not work, due,
  10682.      apparently, to a kernel bug that it happens to trigger.  This
  10683.      problem does not happen on 3.1.
  10684.  
  10685.    * On the Tower models 4N0 and 6N0, by default a process is not
  10686.      allowed to have more than one megabyte of memory.  GNU CC cannot
  10687.      compile itself (or many other programs) with `-O' in that much
  10688.      memory.
  10689.  
  10690.      To solve this problem, reconfigure the kernel adding the following
  10691.      line to the configuration file:
  10692.  
  10693.           MAXUMEM = 4096
  10694.  
  10695.    * On HP 9000 series 300 or 400 running HP-UX release 8.0, there is a
  10696.      bug in the assembler that must be fixed before GNU CC can be
  10697.      built.  This bug manifests itself during the first stage of
  10698.      compilation, while building `libgcc2.a':
  10699.  
  10700.           _floatdisf
  10701.           cc1: warning: `-g' option not supported on this version of GCC
  10702.           cc1: warning: `-g1' option not supported on this version of GCC
  10703.           ./xgcc: Internal compiler error: program as got fatal signal 11
  10704.  
  10705.      A patched version of the assembler is available by anonymous ftp
  10706.      from `altdorf.ai.mit.edu' as the file
  10707.      `archive/cph/hpux-8.0-assembler'.  If you have HP software support,
  10708.      the patch can also be obtained directly from HP, as described in
  10709.      the following note:
  10710.  
  10711.           This is the patched assembler, to patch SR#1653-010439, where
  10712.           the assembler aborts on floating point constants.
  10713.  
  10714.           The bug is not really in the assembler, but in the shared
  10715.           library version of the function "cvtnum(3c)".  The bug on
  10716.           "cvtnum(3c)" is SR#4701-078451.  Anyway, the attached
  10717.           assembler uses the archive library version of "cvtnum(3c)"
  10718.           and thus does not exhibit the bug.
  10719.  
  10720.      This patch is also known as PHCO_4484.
  10721.  
  10722.    * On HP-UX version 8.05, but not on 8.07 or more recent versions,
  10723.      the `fixproto' shell script triggers a bug in the system shell.
  10724.      If you encounter this problem, upgrade your operating system or
  10725.      use BASH (the GNU shell) to run `fixproto'.
  10726.  
  10727.    * Some versions of the Pyramid C compiler are reported to be unable
  10728.      to compile GNU CC.  You must use an older version of GNU CC for
  10729.      bootstrapping.  One indication of this problem is if you get a
  10730.      crash when GNU CC compiles the function `muldi3' in file
  10731.      `libgcc2.c'.
  10732.  
  10733.      You may be able to succeed by getting GNU CC version 1, installing
  10734.      it, and using it to compile GNU CC version 2.  The bug in the
  10735.      Pyramid C compiler does not seem to affect GNU CC version 1.
  10736.  
  10737.    * There may be similar problems on System V Release 3.1 on 386
  10738.      systems.
  10739.  
  10740.    * On the Intel Paragon (an i860 machine), if you are using operating
  10741.      system version 1.0, you will get warnings or errors about
  10742.      redefinition of `va_arg' when you build GNU CC.
  10743.  
  10744.      If this happens, then you need to link most programs with the
  10745.      library `iclib.a'.  You must also modify `stdio.h' as follows:
  10746.      before the lines
  10747.  
  10748.           #if     defined(__i860__) && !defined(_VA_LIST)
  10749.           #include <va_list.h>
  10750.  
  10751.      insert the line
  10752.  
  10753.           #if __PGC__
  10754.  
  10755.      and after the lines
  10756.  
  10757.           extern int  vprintf(const char *, va_list );
  10758.           extern int  vsprintf(char *, const char *, va_list );
  10759.           #endif
  10760.  
  10761.      insert the line
  10762.  
  10763.           #endif /* __PGC__ */
  10764.  
  10765.      These problems don't exist in operating system version 1.1.
  10766.  
  10767.    * On the Altos 3068, programs compiled with GNU CC won't work unless
  10768.      you fix a kernel bug.  This happens using system versions V.2.2
  10769.      1.0gT1 and V.2.2 1.0e and perhaps later versions as well.  See the
  10770.      file `README.ALTOS'.
  10771.  
  10772.    * You will get several sorts of compilation and linking errors on the
  10773.      we32k if you don't follow the special instructions.  *Note
  10774.      Configurations::.
  10775.  
  10776.    * A bug in the HP-UX 8.05 (and earlier) shell will cause the fixproto
  10777.      program to report an error of the form:
  10778.  
  10779.           ./fixproto: sh internal 1K buffer overflow
  10780.  
  10781.      To fix this, change the first line of the fixproto script to look
  10782.      like:
  10783.  
  10784.           #!/bin/ksh
  10785.  
  10786. 
  10787. File: !gcc.docs.gccuser,  Node: Cross-Compiler Problems,  Next: Interoperation,  Prev: Installation Problems,  Up: Trouble
  10788.  
  10789. Cross-Compiler Problems
  10790. =======================
  10791.  
  10792.    You may run into problems with cross compilation on certain machines,
  10793. for several reasons.
  10794.  
  10795.    * Cross compilation can run into trouble for certain machines because
  10796.      some target machines' assemblers require floating point numbers to
  10797.      be written as *integer* constants in certain contexts.
  10798.  
  10799.      The compiler writes these integer constants by examining the
  10800.      floating point value as an integer and printing that integer,
  10801.      because this is simple to write and independent of the details of
  10802.      the floating point representation.  But this does not work if the
  10803.      compiler is running on a different machine with an incompatible
  10804.      floating point format, or even a different byte-ordering.
  10805.  
  10806.      In addition, correct constant folding of floating point values
  10807.      requires representing them in the target machine's format.  (The C
  10808.      standard does not quite require this, but in practice it is the
  10809.      only way to win.)
  10810.  
  10811.      It is now possible to overcome these problems by defining macros
  10812.      such as `REAL_VALUE_TYPE'.  But doing so is a substantial amount of
  10813.      work for each target machine.  *Note Cross Compilation and
  10814.      Floating Point Format: (gcc.info)Cross-compilation.
  10815.  
  10816.    * At present, the program `mips-tfile' which adds debug support to
  10817.      object files on MIPS systems does not work in a cross compile
  10818.      environment.
  10819.  
  10820. 
  10821. File: !gcc.docs.gccuser,  Node: Interoperation,  Next: External Bugs,  Prev: Cross-Compiler Problems,  Up: Trouble
  10822.  
  10823. Interoperation
  10824. ==============
  10825.  
  10826.    This section lists various difficulties encountered in using GNU C or
  10827. GNU C++ together with other compilers or with the assemblers, linkers,
  10828. libraries and debuggers on certain systems.
  10829.  
  10830.    * Objective C does not work on the RS/6000.
  10831.  
  10832.    * GNU C++ does not do name mangling in the same way as other C++
  10833.      compilers.  This means that object files compiled with one compiler
  10834.      cannot be used with another.
  10835.  
  10836.      This effect is intentional, to protect you from more subtle
  10837.      problems.  Compilers differ as to many internal details of C++
  10838.      implementation, including: how class instances are laid out, how
  10839.      multiple inheritance is implemented, and how virtual function
  10840.      calls are handled.  If the name encoding were made the same, your
  10841.      programs would link against libraries provided from other
  10842.      compilers--but the programs would then crash when run.
  10843.      Incompatible libraries are then detected at link time, rather than
  10844.      at run time.
  10845.  
  10846.    * Older GDB versions sometimes fail to read the output of GNU CC
  10847.      version 2.  If you have trouble, get GDB version 4.4 or later.
  10848.  
  10849.    * DBX rejects some files produced by GNU CC, though it accepts
  10850.      similar constructs in output from PCC.  Until someone can supply a
  10851.      coherent description of what is valid DBX input and what is not,
  10852.      there is nothing I can do about these problems.  You are on your
  10853.      own.
  10854.  
  10855.    * The GNU assembler (GAS) does not support PIC.  To generate PIC
  10856.      code, you must use some other assembler, such as `/bin/as'.
  10857.  
  10858.    * On some BSD systems, including some versions of Ultrix, use of
  10859.      profiling causes static variable destructors (currently used only
  10860.      in C++) not to be run.
  10861.  
  10862.    * Use of `-I/usr/include' may cause trouble.
  10863.  
  10864.      Many systems come with header files that won't work with GNU CC
  10865.      unless corrected by `fixincludes'.  The corrected header files go
  10866.      in a new directory; GNU CC searches this directory before
  10867.      `/usr/include'.  If you use `-I/usr/include', this tells GNU CC to
  10868.      search `/usr/include' earlier on, before the corrected headers.
  10869.      The result is that you get the uncorrected header files.
  10870.  
  10871.      Instead, you should use these options (when compiling C programs):
  10872.  
  10873.           -I/usr/local/lib/gcc-lib/TARGET/VERSION/include -I/usr/include
  10874.  
  10875.      For C++ programs, GNU CC also uses a special directory that
  10876.      defines C++ interfaces to standard C subroutines.  This directory
  10877.      is meant to be searched *before* other standard include
  10878.      directories, so that it takes precedence.  If you are compiling
  10879.      C++ programs and specifying include directories explicitly, use
  10880.      this option first, then the two options above:
  10881.  
  10882.           -I/usr/local/lib/g++-include
  10883.  
  10884.    * On some SGI systems, when you use `-lgl_s' as an option, it gets
  10885.      translated magically to `-lgl_s -lX11_s -lc_s'.  Naturally, this
  10886.      does not happen when you use GNU CC.  You must specify all three
  10887.      options explicitly.
  10888.  
  10889.    * On a Sparc, GNU CC aligns all values of type `double' on an 8-byte
  10890.      boundary, and it expects every `double' to be so aligned.  The Sun
  10891.      compiler usually gives `double' values 8-byte alignment, with one
  10892.      exception: function arguments of type `double' may not be aligned.
  10893.  
  10894.      As a result, if a function compiled with Sun CC takes the address
  10895.      of an argument of type `double' and passes this pointer of type
  10896.      `double *' to a function compiled with GNU CC, dereferencing the
  10897.      pointer may cause a fatal signal.
  10898.  
  10899.      One way to solve this problem is to compile your entire program
  10900.      with GNU CC.  Another solution is to modify the function that is
  10901.      compiled with Sun CC to copy the argument into a local variable;
  10902.      local variables are always properly aligned.  A third solution is
  10903.      to modify the function that uses the pointer to dereference it via
  10904.      the following function `access_double' instead of directly with
  10905.      `*':
  10906.  
  10907.           inline double
  10908.           access_double (double *unaligned_ptr)
  10909.           {
  10910.             union d2i { double d; int i[2]; };
  10911.           
  10912.             union d2i *p = (union d2i *) unaligned_ptr;
  10913.             union d2i u;
  10914.           
  10915.             u.i[0] = p->i[0];
  10916.             u.i[1] = p->i[1];
  10917.           
  10918.             return u.d;
  10919.           }
  10920.  
  10921.      Storing into the pointer can be done likewise with the same union.
  10922.  
  10923.    * On Solaris, the `malloc' function in the `libmalloc.a' library may
  10924.      allocate memory that is only 4 byte aligned.  Since GNU CC on the
  10925.      Sparc assumes that doubles are 8 byte aligned, this may result in a
  10926.      fatal signal if doubles are stored in memory allocated by the
  10927.      `libmalloc.a' library.
  10928.  
  10929.      The solution is to not use the `libmalloc.a' library.  Use instead
  10930.      `malloc' and related functions from `libc.a'; they do not have
  10931.      this problem.
  10932.  
  10933.    * Sun forgot to include a static version of `libdl.a' with some
  10934.      versions of SunOS (mainly 4.1).  This results in undefined symbols
  10935.      when linking static binaries (that is, if you use `-static').  If
  10936.      you see undefined symbols `_dlclose', `_dlsym' or `_dlopen' when
  10937.      linking, compile and link against the file `mit/util/misc/dlsym.c'
  10938.      from the MIT version of X windows.
  10939.  
  10940.    * The 128-bit long double format that the Sparc port supports
  10941.      currently works by using the architecturally defined quad-word
  10942.      floating point instructions.  Since there is no hardware that
  10943.      supports these instructions they must be emulated by the operating
  10944.      system.  Long doubles do not work in Sun OS versions 4.0.3 and
  10945.      earlier, because the kernel emulator uses an obsolete and
  10946.      incompatible format.  Long doubles do not work in Sun OS version
  10947.      4.1.1 due to a problem in a Sun library.  Long doubles do work on
  10948.      Sun OS versions 4.1.2 and higher, but GNU CC does not enable them
  10949.      by default.  Long doubles appear to work in Sun OS 5.x (Solaris
  10950.      2.x).
  10951.  
  10952.    * On HP-UX version 9.01 on the HP PA, the HP compiler `cc' does not
  10953.      compile GNU CC correctly.  We do not yet know why.  However, GNU CC
  10954.      compiled on earlier HP-UX versions works properly on HP-UX 9.01
  10955.      and can compile itself properly on 9.01.
  10956.  
  10957.    * On the HP PA machine, ADB sometimes fails to work on functions
  10958.      compiled with GNU CC.  Specifically, it fails to work on functions
  10959.      that use `alloca' or variable-size arrays.  This is because GNU CC
  10960.      doesn't generate HP-UX unwind descriptors for such functions.  It
  10961.      may even be impossible to generate them.
  10962.  
  10963.    * Debugging (`-g') is not supported on the HP PA machine, unless you
  10964.      use the preliminary GNU tools (*note Installation::.).
  10965.  
  10966.    * Taking the address of a label may generate errors from the HP-UX
  10967.      PA assembler.  GAS for the PA does not have this problem.
  10968.  
  10969.    * Using floating point parameters for indirect calls to static
  10970.      functions will not work when using the HP assembler.  There simply
  10971.      is no way for GCC to specify what registers hold arguments for
  10972.      static functions when using the HP assembler.  GAS for the PA does
  10973.      not have this problem.
  10974.  
  10975.    * In extremely rare cases involving some very large functions you may
  10976.      receive errors from the HP linker complaining about an out of
  10977.      bounds unconditional branch offset.  This used to occur more often
  10978.      in previous versions of GNU CC, but is now exceptionally rare.  If
  10979.      you should run into it, you can work around by making your
  10980.      function smaller.
  10981.  
  10982.    * GNU CC compiled code sometimes emits warnings from the HP-UX
  10983.      assembler of the form:
  10984.  
  10985.           (warning) Use of GR3 when
  10986.             frame >= 8192 may cause conflict.
  10987.  
  10988.      These warnings are harmless and can be safely ignored.
  10989.  
  10990.    * The current version of the assembler (`/bin/as') for the RS/6000
  10991.      has certain problems that prevent the `-g' option in GCC from
  10992.      working.  Note that `Makefile.in' uses `-g' by default when
  10993.      compiling `libgcc2.c'.
  10994.  
  10995.      IBM has produced a fixed version of the assembler.  The upgraded
  10996.      assembler unfortunately was not included in any of the AIX 3.2
  10997.      update PTF releases (3.2.2, 3.2.3, or 3.2.3e).  Users of AIX 3.1
  10998.      should request PTF U403044 from IBM and users of AIX 3.2 should
  10999.      request PTF U416277.  See the file `README.RS6000' for more
  11000.      details on these updates.
  11001.  
  11002.      You can test for the presense of a fixed assembler by using the
  11003.      command
  11004.  
  11005.           as -u < /dev/null
  11006.  
  11007.      If the command exits normally, the assembler fix already is
  11008.      installed.  If the assembler complains that "-u" is an unknown
  11009.      flag, you need to order the fix.
  11010.  
  11011.    * On the IBM RS/6000, compiling code of the form
  11012.  
  11013.           extern int foo;
  11014.           
  11015.           ... foo ...
  11016.           
  11017.           static int foo;
  11018.  
  11019.      will cause the linker to report an undefined symbol `foo'.
  11020.      Although this behavior differs from most other systems, it is not a
  11021.      bug because redefining an `extern' variable as `static' is
  11022.      undefined in ANSI C.
  11023.  
  11024.    * AIX on the RS/6000 provides support (NLS) for environments outside
  11025.      of the United States.  Compilers and assemblers use NLS to support
  11026.      locale-specific representations of various objects including
  11027.      floating-point numbers ("." vs "," for separating decimal
  11028.      fractions).  There have been problems reported where the library
  11029.      linked with GCC does not produce the same floating-point formats
  11030.      that the assembler accepts.  If you have this problem, set the
  11031.      LANG environment variable to "C" or "En_US".
  11032.  
  11033.    * Even if you specify `-fdollars-in-identifiers', you cannot
  11034.      successfully use `$' in identifiers on the RS/6000 due to a
  11035.      restriction in the IBM assembler.  GAS supports these identifiers.
  11036.  
  11037.    * On the RS/6000, XLC version 1.3.0.0 will miscompile `jump.c'.  XLC
  11038.      version 1.3.0.1 or later fixes this problem.  You can obtain
  11039.      XLC-1.3.0.2 by requesting PTF 421749 from IBM.
  11040.  
  11041.    * There is an assembler bug in versions of DG/UX prior to 5.4.2.01
  11042.      that occurs when the `fldcr' instruction is used.  GNU CC uses
  11043.      `fldcr' on the 88100 to serialize volatile memory references.  Use
  11044.      the option `-mno-serialize-volatile' if your version of the
  11045.      assembler has this bug.
  11046.  
  11047.    * On VMS, GAS versions 1.38.1 and earlier may cause spurious warning
  11048.      messages from the linker.  These warning messages complain of
  11049.      mismatched psect attributes.  You can ignore them.  *Note VMS
  11050.      Install::.
  11051.  
  11052.    * On NewsOS version 3, if you include both of the files `stddef.h'
  11053.      and `sys/types.h', you get an error because there are two typedefs
  11054.      of `size_t'.  You should change `sys/types.h' by adding these
  11055.      lines around the definition of `size_t':
  11056.  
  11057.           #ifndef _SIZE_T
  11058.           #define _SIZE_T
  11059.           ACTUAL TYPEDEF HERE
  11060.           #endif
  11061.  
  11062.    * On the Alliant, the system's own convention for returning
  11063.      structures and unions is unusual, and is not compatible with GNU
  11064.      CC no matter what options are used.
  11065.  
  11066.    * On the IBM RT PC, the MetaWare HighC compiler (hc) uses a different
  11067.      convention for structure and union returning.  Use the option
  11068.      `-mhc-struct-return' to tell GNU CC to use a convention compatible
  11069.      with it.
  11070.  
  11071.    * On Ultrix, the Fortran compiler expects registers 2 through 5 to
  11072.      be saved by function calls.  However, the C compiler uses
  11073.      conventions compatible with BSD Unix: registers 2 through 5 may be
  11074.      clobbered by function calls.
  11075.  
  11076.      GNU CC uses the same convention as the Ultrix C compiler.  You can
  11077.      use these options to produce code compatible with the Fortran
  11078.      compiler:
  11079.  
  11080.           -fcall-saved-r2 -fcall-saved-r3 -fcall-saved-r4 -fcall-saved-r5
  11081.  
  11082.    * On the WE32k, you may find that programs compiled with GNU CC do
  11083.      not work with the standard shared C library.  You may need to link
  11084.      with the ordinary C compiler.  If you do so, you must specify the
  11085.      following options:
  11086.  
  11087.           -L/usr/local/lib/gcc-lib/we32k-att-sysv/2.7.1 -lgcc -lc_s
  11088.  
  11089.      The first specifies where to find the library `libgcc.a' specified
  11090.      with the `-lgcc' option.
  11091.  
  11092.      GNU CC does linking by invoking `ld', just as `cc' does, and there
  11093.      is no reason why it *should* matter which compilation program you
  11094.      use to invoke `ld'.  If someone tracks this problem down, it can
  11095.      probably be fixed easily.
  11096.  
  11097.    * On the Alpha, you may get assembler errors about invalid syntax as
  11098.      a result of floating point constants.  This is due to a bug in the
  11099.      C library functions `ecvt', `fcvt' and `gcvt'.  Given valid
  11100.      floating point numbers, they sometimes print `NaN'.
  11101.  
  11102.    * On Irix 4.0.5F (and perhaps in some other versions), an assembler
  11103.      bug sometimes reorders instructions incorrectly when optimization
  11104.      is turned on.  If you think this may be happening to you, try
  11105.      using the GNU assembler; GAS version 2.1 supports ECOFF on Irix.
  11106.  
  11107.      Or use the `-noasmopt' option when you compile GNU CC with itself,
  11108.      and then again when you compile your program.  (This is a temporary
  11109.      kludge to turn off assembler optimization on Irix.)  If this
  11110.      proves to be what you need, edit the assembler spec in the file
  11111.      `specs' so that it unconditionally passes `-O0' to the assembler,
  11112.      and never passes `-O2' or `-O3'.
  11113.  
  11114. 
  11115. File: !gcc.docs.gccuser,  Node: External Bugs,  Next: Incompatibilities,  Prev: Interoperation,  Up: Trouble
  11116.  
  11117. Problems Compiling Certain Programs
  11118. ===================================
  11119.  
  11120.    Certain programs have problems compiling.
  11121.  
  11122.    * Parse errors may occur compiling X11 on a Decstation running
  11123.      Ultrix 4.2 because of problems in DEC's versions of the X11 header
  11124.      files `X11/Xlib.h' and `X11/Xutil.h'.  People recommend adding
  11125.      `-I/usr/include/mit' to use the MIT versions of the header files,
  11126.      using the `-traditional' switch to turn off ANSI C, or fixing the
  11127.      header files by adding this:
  11128.  
  11129.           #ifdef __STDC__
  11130.           #define NeedFunctionPrototypes 0
  11131.           #endif
  11132.  
  11133.    * If you have trouble compiling Perl on a SunOS 4 system, it may be
  11134.      because Perl specifies `-I/usr/ucbinclude'.  This accesses the
  11135.      unfixed header files.  Perl specifies the options
  11136.  
  11137.           -traditional -Dvolatile=__volatile__
  11138.           -I/usr/include/sun -I/usr/ucbinclude
  11139.           -fpcc-struct-return
  11140.  
  11141.      most of which are unnecessary with GCC 2.4.5 and newer versions.
  11142.      You can make a properly working Perl by setting `ccflags' to
  11143.      `-fwritable-strings' (implied by the `-traditional' in the
  11144.      original options) and `cppflags' to empty in `config.sh', then
  11145.      typing `./doSH; make depend; make'.
  11146.  
  11147.    * On various 386 Unix systems derived from System V, including SCO,
  11148.      ISC, and ESIX, you may get error messages about running out of
  11149.      virtual memory while compiling certain programs.
  11150.  
  11151.      You can prevent this problem by linking GNU CC with the GNU malloc
  11152.      (which thus replaces the malloc that comes with the system).  GNU
  11153.      malloc is available as a separate package, and also in the file
  11154.      `src/gmalloc.c' in the GNU Emacs 19 distribution.
  11155.  
  11156.      If you have installed GNU malloc as a separate library package,
  11157.      use this option when you relink GNU CC:
  11158.  
  11159.           MALLOC=/usr/local/lib/libgmalloc.a
  11160.  
  11161.      Alternatively, if you have compiled `gmalloc.c' from Emacs 19, copy
  11162.      the object file to `gmalloc.o' and use this option when you relink
  11163.      GNU CC:
  11164.  
  11165.           MALLOC=gmalloc.o
  11166.  
  11167. 
  11168. File: !gcc.docs.gccuser,  Node: Incompatibilities,  Next: Fixed Headers,  Prev: External Bugs,  Up: Trouble
  11169.  
  11170. Incompatibilities of GNU CC
  11171. ===========================
  11172.  
  11173.    There are several noteworthy incompatibilities between GNU C and most
  11174. existing (non-ANSI) versions of C.  The `-traditional' option
  11175. eliminates many of these incompatibilities, *but not all*, by telling
  11176. GNU C to behave like the other C compilers.
  11177.  
  11178.    * GNU CC normally makes string constants read-only.  If several
  11179.      identical-looking string constants are used, GNU CC stores only one
  11180.      copy of the string.
  11181.  
  11182.      One consequence is that you cannot call `mktemp' with a string
  11183.      constant argument.  The function `mktemp' always alters the string
  11184.      its argument points to.
  11185.  
  11186.      Another consequence is that `sscanf' does not work on some systems
  11187.      when passed a string constant as its format control string or
  11188.      input.  This is because `sscanf' incorrectly tries to write into
  11189.      the string constant.  Likewise `fscanf' and `scanf'.
  11190.  
  11191.      The best solution to these problems is to change the program to use
  11192.      `char'-array variables with initialization strings for these
  11193.      purposes instead of string constants.  But if this is not possible,
  11194.      you can use the `-fwritable-strings' flag, which directs GNU CC to
  11195.      handle string constants the same way most C compilers do.
  11196.      `-traditional' also has this effect, among others.
  11197.  
  11198.    * `-2147483648' is positive.
  11199.  
  11200.      This is because 2147483648 cannot fit in the type `int', so
  11201.      (following the ANSI C rules) its data type is `unsigned long int'.
  11202.      Negating this value yields 2147483648 again.
  11203.  
  11204.    * GNU CC does not substitute macro arguments when they appear inside
  11205.      of string constants.  For example, the following macro in GNU CC
  11206.  
  11207.           #define foo(a) "a"
  11208.  
  11209.      will produce output `"a"' regardless of what the argument A is.
  11210.  
  11211.      The `-traditional' option directs GNU CC to handle such cases
  11212.      (among others) in the old-fashioned (non-ANSI) fashion.
  11213.  
  11214.    * When you use `setjmp' and `longjmp', the only automatic variables
  11215.      guaranteed to remain valid are those declared `volatile'.  This is
  11216.      a consequence of automatic register allocation.  Consider this
  11217.      function:
  11218.  
  11219.           jmp_buf j;
  11220.           
  11221.           foo ()
  11222.           {
  11223.             int a, b;
  11224.           
  11225.             a = fun1 ();
  11226.             if (setjmp (j))
  11227.               return a;
  11228.           
  11229.             a = fun2 ();
  11230.             /* `longjmp (j)' may occur in `fun3'. */
  11231.             return a + fun3 ();
  11232.           }
  11233.  
  11234.      Here `a' may or may not be restored to its first value when the
  11235.      `longjmp' occurs.  If `a' is allocated in a register, then its
  11236.      first value is restored; otherwise, it keeps the last value stored
  11237.      in it.
  11238.  
  11239.      If you use the `-W' option with the `-O' option, you will get a
  11240.      warning when GNU CC thinks such a problem might be possible.
  11241.  
  11242.      The `-traditional' option directs GNU C to put variables in the
  11243.      stack by default, rather than in registers, in functions that call
  11244.      `setjmp'.  This results in the behavior found in traditional C
  11245.      compilers.
  11246.  
  11247.    * Programs that use preprocessing directives in the middle of macro
  11248.      arguments do not work with GNU CC.  For example, a program like
  11249.      this will not work:
  11250.  
  11251.           foobar (
  11252.           #define luser
  11253.                   hack)
  11254.  
  11255.      ANSI C does not permit such a construct.  It would make sense to
  11256.      support it when `-traditional' is used, but it is too much work to
  11257.      implement.
  11258.  
  11259.    * Declarations of external variables and functions within a block
  11260.      apply only to the block containing the declaration.  In other
  11261.      words, they have the same scope as any other declaration in the
  11262.      same place.
  11263.  
  11264.      In some other C compilers, a `extern' declaration affects all the
  11265.      rest of the file even if it happens within a block.
  11266.  
  11267.      The `-traditional' option directs GNU C to treat all `extern'
  11268.      declarations as global, like traditional compilers.
  11269.  
  11270.    * In traditional C, you can combine `long', etc., with a typedef
  11271.      name, as shown here:
  11272.  
  11273.           typedef int foo;
  11274.           typedef long foo bar;
  11275.  
  11276.      In ANSI C, this is not allowed: `long' and other type modifiers
  11277.      require an explicit `int'.  Because this criterion is expressed by
  11278.      Bison grammar rules rather than C code, the `-traditional' flag
  11279.      cannot alter it.
  11280.  
  11281.    * PCC allows typedef names to be used as function parameters.  The
  11282.      difficulty described immediately above applies here too.
  11283.  
  11284.    * PCC allows whitespace in the middle of compound assignment
  11285.      operators such as `+='.  GNU CC, following the ANSI standard, does
  11286.      not allow this.  The difficulty described immediately above
  11287.      applies here too.
  11288.  
  11289.    * GNU CC complains about unterminated character constants inside of
  11290.      preprocessing conditionals that fail.  Some programs have English
  11291.      comments enclosed in conditionals that are guaranteed to fail; if
  11292.      these comments contain apostrophes, GNU CC will probably report an
  11293.      error.  For example, this code would produce an error:
  11294.  
  11295.           #if 0
  11296.           You can't expect this to work.
  11297.           #endif
  11298.  
  11299.      The best solution to such a problem is to put the text into an
  11300.      actual C comment delimited by `/*...*/'.  However, `-traditional'
  11301.      suppresses these error messages.
  11302.  
  11303.    * Many user programs contain the declaration `long time ();'.  In the
  11304.      past, the system header files on many systems did not actually
  11305.      declare `time', so it did not matter what type your program
  11306.      declared it to return.  But in systems with ANSI C headers, `time'
  11307.      is declared to return `time_t', and if that is not the same as
  11308.      `long', then `long time ();' is erroneous.
  11309.  
  11310.      The solution is to change your program to use `time_t' as the
  11311.      return type of `time'.
  11312.  
  11313.    * When compiling functions that return `float', PCC converts it to a
  11314.      double.  GNU CC actually returns a `float'.  If you are concerned
  11315.      with PCC compatibility, you should declare your functions to return
  11316.      `double'; you might as well say what you mean.
  11317.  
  11318.    * When compiling functions that return structures or unions, GNU CC
  11319.      output code normally uses a method different from that used on most
  11320.      versions of Unix.  As a result, code compiled with GNU CC cannot
  11321.      call a structure-returning function compiled with PCC, and vice
  11322.      versa.
  11323.  
  11324.      The method used by GNU CC is as follows: a structure or union
  11325.      which is 1, 2, 4 or 8 bytes long is returned like a scalar.  A
  11326.      structure or union with any other size is stored into an address
  11327.      supplied by the caller (usually in a special, fixed register, but
  11328.      on some machines it is passed on the stack).  The
  11329.      machine-description macros `STRUCT_VALUE' and
  11330.      `STRUCT_INCOMING_VALUE' tell GNU CC where to pass this address.
  11331.  
  11332.      By contrast, PCC on most target machines returns structures and
  11333.      unions of any size by copying the data into an area of static
  11334.      storage, and then returning the address of that storage as if it
  11335.      were a pointer value.  The caller must copy the data from that
  11336.      memory area to the place where the value is wanted.  GNU CC does
  11337.      not use this method because it is slower and nonreentrant.
  11338.  
  11339.      On some newer machines, PCC uses a reentrant convention for all
  11340.      structure and union returning.  GNU CC on most of these machines
  11341.      uses a compatible convention when returning structures and unions
  11342.      in memory, but still returns small structures and unions in
  11343.      registers.
  11344.  
  11345.      You can tell GNU CC to use a compatible convention for all
  11346.      structure and union returning with the option
  11347.      `-fpcc-struct-return'.
  11348.  
  11349.    * GNU C complains about program fragments such as `0x74ae-0x4000'
  11350.      which appear to be two hexadecimal constants separated by the minus
  11351.      operator.  Actually, this string is a single "preprocessing token".
  11352.      Each such token must correspond to one token in C.  Since this
  11353.      does not, GNU C prints an error message.  Although it may appear
  11354.      obvious that what is meant is an operator and two values, the ANSI
  11355.      C standard specifically requires that this be treated as erroneous.
  11356.  
  11357.      A "preprocessing token" is a "preprocessing number" if it begins
  11358.      with a digit and is followed by letters, underscores, digits,
  11359.      periods and `e+', `e-', `E+', or `E-' character sequences.
  11360.  
  11361.      To make the above program fragment valid, place whitespace in
  11362.      front of the minus sign.  This whitespace will end the
  11363.      preprocessing number.
  11364.  
  11365. 
  11366. File: !gcc.docs.gccuser,  Node: Fixed Headers,  Next: Standard Libraries,  Prev: Incompatibilities,  Up: Trouble
  11367.  
  11368. Fixed Header Files
  11369. ==================
  11370.  
  11371.    GNU CC needs to install corrected versions of some system header
  11372. files.  This is because most target systems have some header files that
  11373. won't work with GNU CC unless they are changed.  Some have bugs, some
  11374. are incompatible with ANSI C, and some depend on special features of
  11375. other compilers.
  11376.  
  11377.    Installing GNU CC automatically creates and installs the fixed header
  11378. files, by running a program called `fixincludes' (or for certain
  11379. targets an alternative such as `fixinc.svr4').  Normally, you don't
  11380. need to pay attention to this.  But there are cases where it doesn't do
  11381. the right thing automatically.
  11382.  
  11383.    * If you update the system's header files, such as by installing a
  11384.      new system version, the fixed header files of GNU CC are not
  11385.      automatically updated.  The easiest way to update them is to
  11386.      reinstall GNU CC.  (If you want to be clever, look in the makefile
  11387.      and you can find a shortcut.)
  11388.  
  11389.    * On some systems, in particular SunOS 4, header file directories
  11390.      contain machine-specific symbolic links in certain places.  This
  11391.      makes it possible to share most of the header files among hosts
  11392.      running the same version of SunOS 4 on different machine models.
  11393.  
  11394.      The programs that fix the header files do not understand this
  11395.      special way of using symbolic links; therefore, the directory of
  11396.      fixed header files is good only for the machine model used to
  11397.      build it.
  11398.  
  11399.      In SunOS 4, only programs that look inside the kernel will notice
  11400.      the difference between machine models.  Therefore, for most
  11401.      purposes, you need not be concerned about this.
  11402.  
  11403.      It is possible to make separate sets of fixed header files for the
  11404.      different machine models, and arrange a structure of symbolic
  11405.      links so as to use the proper set, but you'll have to do this by
  11406.      hand.
  11407.  
  11408.    * On Lynxos, GNU CC by default does not fix the header files.  This
  11409.      is because bugs in the shell cause the `fixincludes' script to
  11410.      fail.
  11411.  
  11412.      This means you will encounter problems due to bugs in the system
  11413.      header files.  It may be no comfort that they aren't GNU CC's
  11414.      fault, but it does mean that there's nothing for us to do about
  11415.      them.
  11416.  
  11417. 
  11418. File: !gcc.docs.gccuser,  Node: Standard Libraries,  Next: Disappointments,  Prev: Fixed Headers,  Up: Trouble
  11419.  
  11420. Standard Libraries
  11421. ==================
  11422.  
  11423.    GNU CC by itself attempts to be what the ISO/ANSI C standard calls a
  11424. "conforming freestanding implementation".  This means all ANSI C
  11425. language features are available, as well as the contents of `float.h',
  11426. `limits.h', `stdarg.h', and `stddef.h'.  The rest of the C library is
  11427. supplied by the vendor of the operating system.  If that C library
  11428. doesn't conform to the C standards, then your programs might get
  11429. warnings (especially when using `-Wall') that you don't expect.
  11430.  
  11431.    For example, the `sprintf' function on SunOS 4.1.3 returns `char *'
  11432. while the C standard says that `sprintf' returns an `int'.  The
  11433. `fixincludes' program could make the prototype for this function match
  11434. the Standard, but that would be wrong, since the function will still
  11435. return `char *'.
  11436.  
  11437.    If you need a Standard compliant library, then you need to find one,
  11438. as GNU CC does not provide one.  The GNU C library (called `glibc') has
  11439. been ported to a number of operating systems, and provides ANSI/ISO,
  11440. POSIX, BSD and SystemV compatibility.  You could also ask your operating
  11441. system vendor if newer libraries are available.
  11442.  
  11443. 
  11444. File: !gcc.docs.gccuser,  Node: Disappointments,  Next: C++ Misunderstandings,  Prev: Standard Libraries,  Up: Trouble
  11445.  
  11446. Disappointments and Misunderstandings
  11447. =====================================
  11448.  
  11449.    These problems are perhaps regrettable, but we don't know any
  11450. practical way around them.
  11451.  
  11452.    * Certain local variables aren't recognized by debuggers when you
  11453.      compile with optimization.
  11454.  
  11455.      This occurs because sometimes GNU CC optimizes the variable out of
  11456.      existence.  There is no way to tell the debugger how to compute the
  11457.      value such a variable "would have had", and it is not clear that
  11458.      would be desirable anyway.  So GNU CC simply does not mention the
  11459.      eliminated variable when it writes debugging information.
  11460.  
  11461.      You have to expect a certain amount of disagreement between the
  11462.      executable and your source code, when you use optimization.
  11463.  
  11464.    * Users often think it is a bug when GNU CC reports an error for code
  11465.      like this:
  11466.  
  11467.           int foo (struct mumble *);
  11468.           
  11469.           struct mumble { ... };
  11470.           
  11471.           int foo (struct mumble *x)
  11472.           { ... }
  11473.  
  11474.      This code really is erroneous, because the scope of `struct
  11475.      mumble' in the prototype is limited to the argument list
  11476.      containing it.  It does not refer to the `struct mumble' defined
  11477.      with file scope immediately below--they are two unrelated types
  11478.      with similar names in different scopes.
  11479.  
  11480.      But in the definition of `foo', the file-scope type is used
  11481.      because that is available to be inherited.  Thus, the definition
  11482.      and the prototype do not match, and you get an error.
  11483.  
  11484.      This behavior may seem silly, but it's what the ANSI standard
  11485.      specifies.  It is easy enough for you to make your code work by
  11486.      moving the definition of `struct mumble' above the prototype.
  11487.      It's not worth being incompatible with ANSI C just to avoid an
  11488.      error for the example shown above.
  11489.  
  11490.    * Accesses to bitfields even in volatile objects works by accessing
  11491.      larger objects, such as a byte or a word.  You cannot rely on what
  11492.      size of object is accessed in order to read or write the bitfield;
  11493.      it may even vary for a given bitfield according to the precise
  11494.      usage.
  11495.  
  11496.      If you care about controlling the amount of memory that is
  11497.      accessed, use volatile but do not use bitfields.
  11498.  
  11499.    * GNU CC comes with shell scripts to fix certain known problems in
  11500.      system header files.  They install corrected copies of various
  11501.      header files in a special directory where only GNU CC will
  11502.      normally look for them.  The scripts adapt to various systems by
  11503.      searching all the system header files for the problem cases that
  11504.      we know about.
  11505.  
  11506.      If new system header files are installed, nothing automatically
  11507.      arranges to update the corrected header files.  You will have to
  11508.      reinstall GNU CC to fix the new header files.  More specifically,
  11509.      go to the build directory and delete the files `stmp-fixinc' and
  11510.      `stmp-headers', and the subdirectory `include'; then do `make
  11511.      install' again.
  11512.  
  11513.    * On 68000 systems, you can get paradoxical results if you test the
  11514.      precise values of floating point numbers.  For example, you can
  11515.      find that a floating point value which is not a NaN is not equal
  11516.      to itself.  This results from the fact that the the floating point
  11517.      registers hold a few more bits of precision than fit in a `double'
  11518.      in memory.  Compiled code moves values between memory and floating
  11519.      point registers at its convenience, and moving them into memory
  11520.      truncates them.
  11521.  
  11522.      You can partially avoid this problem by using the `-ffloat-store'
  11523.      option (*note Optimize Options::.).
  11524.  
  11525.    * On the MIPS, variable argument functions using `varargs.h' cannot
  11526.      have a floating point value for the first argument.  The reason
  11527.      for this is that in the absence of a prototype in scope, if the
  11528.      first argument is a floating point, it is passed in a floating
  11529.      point register, rather than an integer register.
  11530.  
  11531.      If the code is rewritten to use the ANSI standard `stdarg.h'
  11532.      method of variable arguments, and the prototype is in scope at the
  11533.      time of the call, everything will work fine.
  11534.  
  11535. 
  11536. File: !gcc.docs.gccuser,  Node: C++ Misunderstandings,  Next: Protoize Caveats,  Prev: Disappointments,  Up: Trouble
  11537.  
  11538. Common Misunderstandings with GNU C++
  11539. =====================================
  11540.  
  11541.    C++ is a complex language and an evolving one, and its standard
  11542. definition (the ANSI C++ draft standard) is also evolving.  As a result,
  11543. your C++ compiler may occasionally surprise you, even when its behavior
  11544. is correct.  This section discusses some areas that frequently give
  11545. rise to questions of this sort.
  11546.  
  11547. * Menu:
  11548.  
  11549. * Static Definitions::  Static member declarations are not definitions
  11550. * Temporaries::         Temporaries may vanish before you expect
  11551.  
  11552. 
  11553. File: !gcc.docs.gccuser,  Node: Static Definitions,  Next: Temporaries,  Up: C++ Misunderstandings
  11554.  
  11555. Declare *and* Define Static Members
  11556. -----------------------------------
  11557.  
  11558.    When a class has static data members, it is not enough to *declare*
  11559. the static member; you must also *define* it.  For example:
  11560.  
  11561.      class Foo
  11562.      {
  11563.        ...
  11564.        void method();
  11565.        static int bar;
  11566.      };
  11567.  
  11568.    This declaration only establishes that the class `Foo' has an `int'
  11569. named `Foo::bar', and a member function named `Foo::method'.  But you
  11570. still need to define *both* `method' and `bar' elsewhere.  According to
  11571. the draft ANSI standard, you must supply an initializer in one (and
  11572. only one) source file, such as:
  11573.  
  11574.      int Foo::bar = 0;
  11575.  
  11576.    Other C++ compilers may not correctly implement the standard
  11577. behavior.  As a result, when you switch to `g++' from one of these
  11578. compilers, you may discover that a program that appeared to work
  11579. correctly in fact does not conform to the standard: `g++' reports as
  11580. undefined symbols any static data members that lack definitions.
  11581.  
  11582. 
  11583. File: !gcc.docs.gccuser,  Node: Temporaries,  Prev: Static Definitions,  Up: C++ Misunderstandings
  11584.  
  11585. Temporaries May Vanish Before You Expect
  11586. ----------------------------------------
  11587.  
  11588.    It is dangerous to use pointers or references to *portions* of a
  11589. temporary object.  The compiler may very well delete the object before
  11590. you expect it to, leaving a pointer to garbage.  The most common place
  11591. where this problem crops up is in classes like the libg++ `String'
  11592. class, that define a conversion function to type `char *' or `const
  11593. char *'.  However, any class that returns a pointer to some internal
  11594. structure is potentially subject to this problem.
  11595.  
  11596.    For example, a program may use a function `strfunc' that returns
  11597. `String' objects, and another function `charfunc' that operates on
  11598. pointers to `char':
  11599.  
  11600.      String strfunc ();
  11601.      void charfunc (const char *);
  11602.  
  11603. In this situation, it may seem natural to write
  11604. `charfunc (strfunc ());' based on the knowledge that class `String' has
  11605. an explicit conversion to `char' pointers.  However, what really
  11606. happens is akin to `charfunc (strfunc ().convert ());', where the
  11607. `convert' method is a function to do the same data conversion normally
  11608. performed by a cast.  Since the last use of the temporary `String'
  11609. object is the call to the conversion function, the compiler may delete
  11610. that object before actually calling `charfunc'.  The compiler has no
  11611. way of knowing that deleting the `String' object will invalidate the
  11612. pointer.  The pointer then points to garbage, so that by the time
  11613. `charfunc' is called, it gets an invalid argument.
  11614.  
  11615.    Code like this may run successfully under some other compilers,
  11616. especially those that delete temporaries relatively late.  However, the
  11617. GNU C++ behavior is also standard-conforming, so if your program depends
  11618. on late destruction of temporaries it is not portable.
  11619.  
  11620.    If you think this is surprising, you should be aware that the ANSI
  11621. C++ committee continues to debate the lifetime-of-temporaries problem.
  11622.  
  11623.    For now, at least, the safe way to write such code is to give the
  11624. temporary a name, which forces it to remain until the end of the scope
  11625. of the name.  For example:
  11626.  
  11627.      String& tmp = strfunc ();
  11628.      charfunc (tmp);
  11629.  
  11630. 
  11631. File: !gcc.docs.gccuser,  Node: Protoize Caveats,  Next: Non-bugs,  Prev: C++ Misunderstandings,  Up: Trouble
  11632.  
  11633. Caveats of using `protoize'
  11634. ===========================
  11635.  
  11636.    The conversion programs `protoize' and `unprotoize' can sometimes
  11637. change a source file in a way that won't work unless you rearrange it.
  11638.  
  11639.    * `protoize' can insert references to a type name or type tag before
  11640.      the definition, or in a file where they are not defined.
  11641.  
  11642.      If this happens, compiler error messages should show you where the
  11643.      new references are, so fixing the file by hand is straightforward.
  11644.  
  11645.    * There are some C constructs which `protoize' cannot figure out.
  11646.      For example, it can't determine argument types for declaring a
  11647.      pointer-to-function variable; this you must do by hand.  `protoize'
  11648.      inserts a comment containing `???' each time it finds such a
  11649.      variable; so you can find all such variables by searching for this
  11650.      string.  ANSI C does not require declaring the argument types of
  11651.      pointer-to-function types.
  11652.  
  11653.    * Using `unprotoize' can easily introduce bugs.  If the program
  11654.      relied on prototypes to bring about conversion of arguments, these
  11655.      conversions will not take place in the program without prototypes.
  11656.      One case in which you can be sure `unprotoize' is safe is when you
  11657.      are removing prototypes that were made with `protoize'; if the
  11658.      program worked before without any prototypes, it will work again
  11659.      without them.
  11660.  
  11661.      You can find all the places where this problem might occur by
  11662.      compiling the program with the `-Wconversion' option.  It prints a
  11663.      warning whenever an argument is converted.
  11664.  
  11665.    * Both conversion programs can be confused if there are macro calls
  11666.      in and around the text to be converted.  In other words, the
  11667.      standard syntax for a declaration or definition must not result
  11668.      from expanding a macro.  This problem is inherent in the design of
  11669.      C and cannot be fixed.  If only a few functions have confusing
  11670.      macro calls, you can easily convert them manually.
  11671.  
  11672.    * `protoize' cannot get the argument types for a function whose
  11673.      definition was not actually compiled due to preprocessing
  11674.      conditionals.  When this happens, `protoize' changes nothing in
  11675.      regard to such a function.  `protoize' tries to detect such
  11676.      instances and warn about them.
  11677.  
  11678.      You can generally work around this problem by using `protoize' step
  11679.      by step, each time specifying a different set of `-D' options for
  11680.      compilation, until all of the functions have been converted.
  11681.      There is no automatic way to verify that you have got them all,
  11682.      however.
  11683.  
  11684.    * Confusion may result if there is an occasion to convert a function
  11685.      declaration or definition in a region of source code where there
  11686.      is more than one formal parameter list present.  Thus, attempts to
  11687.      convert code containing multiple (conditionally compiled) versions
  11688.      of a single function header (in the same vicinity) may not produce
  11689.      the desired (or expected) results.
  11690.  
  11691.      If you plan on converting source files which contain such code, it
  11692.      is recommended that you first make sure that each conditionally
  11693.      compiled region of source code which contains an alternative
  11694.      function header also contains at least one additional follower
  11695.      token (past the final right parenthesis of the function header).
  11696.      This should circumvent the problem.
  11697.  
  11698.    * `unprotoize' can become confused when trying to convert a function
  11699.      definition or declaration which contains a declaration for a
  11700.      pointer-to-function formal argument which has the same name as the
  11701.      function being defined or declared.  We recommand you avoid such
  11702.      choices of formal parameter names.
  11703.  
  11704.    * You might also want to correct some of the indentation by hand and
  11705.      break long lines.  (The conversion programs don't write lines
  11706.      longer than eighty characters in any case.)
  11707.  
  11708. 
  11709. File: !gcc.docs.gccuser,  Node: Non-bugs,  Next: Warnings and Errors,  Prev: Protoize Caveats,  Up: Trouble
  11710.  
  11711. Certain Changes We Don't Want to Make
  11712. =====================================
  11713.  
  11714.    This section lists changes that people frequently request, but which
  11715. we do not make because we think GNU CC is better without them.
  11716.  
  11717.    * Checking the number and type of arguments to a function which has
  11718.      an old-fashioned definition and no prototype.
  11719.  
  11720.      Such a feature would work only occasionally--only for calls that
  11721.      appear in the same file as the called function, following the
  11722.      definition.  The only way to check all calls reliably is to add a
  11723.      prototype for the function.  But adding a prototype eliminates the
  11724.      motivation for this feature.  So the feature is not worthwhile.
  11725.  
  11726.    * Warning about using an expression whose type is signed as a shift
  11727.      count.
  11728.  
  11729.      Shift count operands are probably signed more often than unsigned.
  11730.      Warning about this would cause far more annoyance than good.
  11731.  
  11732.    * Warning about assigning a signed value to an unsigned variable.
  11733.  
  11734.      Such assignments must be very common; warning about them would
  11735.      cause more annoyance than good.
  11736.  
  11737.    * Warning about unreachable code.
  11738.  
  11739.      It's very common to have unreachable code in machine-generated
  11740.      programs.  For example, this happens normally in some files of GNU
  11741.      C itself.
  11742.  
  11743.    * Warning when a non-void function value is ignored.
  11744.  
  11745.      Coming as I do from a Lisp background, I balk at the idea that
  11746.      there is something dangerous about discarding a value.  There are
  11747.      functions that return values which some callers may find useful;
  11748.      it makes no sense to clutter the program with a cast to `void'
  11749.      whenever the value isn't useful.
  11750.  
  11751.    * Assuming (for optimization) that the address of an external symbol
  11752.      is never zero.
  11753.  
  11754.      This assumption is false on certain systems when `#pragma weak' is
  11755.      used.
  11756.  
  11757.    * Making `-fshort-enums' the default.
  11758.  
  11759.      This would cause storage layout to be incompatible with most other
  11760.      C compilers.  And it doesn't seem very important, given that you
  11761.      can get the same result in other ways.  The case where it matters
  11762.      most is when the enumeration-valued object is inside a structure,
  11763.      and in that case you can specify a field width explicitly.
  11764.  
  11765.    * Making bitfields unsigned by default on particular machines where
  11766.      "the ABI standard" says to do so.
  11767.  
  11768.      The ANSI C standard leaves it up to the implementation whether a
  11769.      bitfield declared plain `int' is signed or not.  This in effect
  11770.      creates two alternative dialects of C.
  11771.  
  11772.      The GNU C compiler supports both dialects; you can specify the
  11773.      signed dialect with `-fsigned-bitfields' and the unsigned dialect
  11774.      with `-funsigned-bitfields'.  However, this leaves open the
  11775.      question of which dialect to use by default.
  11776.  
  11777.      Currently, the preferred dialect makes plain bitfields signed,
  11778.      because this is simplest.  Since `int' is the same as `signed int'
  11779.      in every other context, it is cleanest for them to be the same in
  11780.      bitfields as well.
  11781.  
  11782.      Some computer manufacturers have published Application Binary
  11783.      Interface standards which specify that plain bitfields should be
  11784.      unsigned.  It is a mistake, however, to say anything about this
  11785.      issue in an ABI.  This is because the handling of plain bitfields
  11786.      distinguishes two dialects of C.  Both dialects are meaningful on
  11787.      every type of machine.  Whether a particular object file was
  11788.      compiled using signed bitfields or unsigned is of no concern to
  11789.      other object files, even if they access the same bitfields in the
  11790.      same data structures.
  11791.  
  11792.      A given program is written in one or the other of these two
  11793.      dialects.  The program stands a chance to work on most any machine
  11794.      if it is compiled with the proper dialect.  It is unlikely to work
  11795.      at all if compiled with the wrong dialect.
  11796.  
  11797.      Many users appreciate the GNU C compiler because it provides an
  11798.      environment that is uniform across machines.  These users would be
  11799.      inconvenienced if the compiler treated plain bitfields differently
  11800.      on certain machines.
  11801.  
  11802.      Occasionally users write programs intended only for a particular
  11803.      machine type.  On these occasions, the users would benefit if the
  11804.      GNU C compiler were to support by default the same dialect as the
  11805.      other compilers on that machine.  But such applications are rare.
  11806.      And users writing a program to run on more than one type of
  11807.      machine cannot possibly benefit from this kind of compatibility.
  11808.  
  11809.      This is why GNU CC does and will treat plain bitfields in the same
  11810.      fashion on all types of machines (by default).
  11811.  
  11812.      There are some arguments for making bitfields unsigned by default
  11813.      on all machines.  If, for example, this becomes a universal de
  11814.      facto standard, it would make sense for GNU CC to go along with
  11815.      it.  This is something to be considered in the future.
  11816.  
  11817.      (Of course, users strongly concerned about portability should
  11818.      indicate explicitly in each bitfield whether it is signed or not.
  11819.      In this way, they write programs which have the same meaning in
  11820.      both C dialects.)
  11821.  
  11822.    * Undefining `__STDC__' when `-ansi' is not used.
  11823.  
  11824.      Currently, GNU CC defines `__STDC__' as long as you don't use
  11825.      `-traditional'.  This provides good results in practice.
  11826.  
  11827.      Programmers normally use conditionals on `__STDC__' to ask whether
  11828.      it is safe to use certain features of ANSI C, such as function
  11829.      prototypes or ANSI token concatenation.  Since plain `gcc' supports
  11830.      all the features of ANSI C, the correct answer to these questions
  11831.      is "yes".
  11832.  
  11833.      Some users try to use `__STDC__' to check for the availability of
  11834.      certain library facilities.  This is actually incorrect usage in
  11835.      an ANSI C program, because the ANSI C standard says that a
  11836.      conforming freestanding implementation should define `__STDC__'
  11837.      even though it does not have the library facilities.  `gcc -ansi
  11838.      -pedantic' is a conforming freestanding implementation, and it is
  11839.      therefore required to define `__STDC__', even though it does not
  11840.      come with an ANSI C library.
  11841.  
  11842.      Sometimes people say that defining `__STDC__' in a compiler that
  11843.      does not completely conform to the ANSI C standard somehow
  11844.      violates the standard.  This is illogical.  The standard is a
  11845.      standard for compilers that claim to support ANSI C, such as `gcc
  11846.      -ansi'--not for other compilers such as plain `gcc'.  Whatever the
  11847.      ANSI C standard says is relevant to the design of plain `gcc'
  11848.      without `-ansi' only for pragmatic reasons, not as a requirement.
  11849.  
  11850.    * Undefining `__STDC__' in C++.
  11851.  
  11852.      Programs written to compile with C++-to-C translators get the
  11853.      value of `__STDC__' that goes with the C compiler that is
  11854.      subsequently used.  These programs must test `__STDC__' to
  11855.      determine what kind of C preprocessor that compiler uses: whether
  11856.      they should concatenate tokens in the ANSI C fashion or in the
  11857.      traditional fashion.
  11858.  
  11859.      These programs work properly with GNU C++ if `__STDC__' is defined.
  11860.      They would not work otherwise.
  11861.  
  11862.      In addition, many header files are written to provide prototypes
  11863.      in ANSI C but not in traditional C.  Many of these header files
  11864.      can work without change in C++ provided `__STDC__' is defined.  If
  11865.      `__STDC__' is not defined, they will all fail, and will all need
  11866.      to be changed to test explicitly for C++ as well.
  11867.  
  11868.    * Deleting "empty" loops.
  11869.  
  11870.      GNU CC does not delete "empty" loops because the most likely reason
  11871.      you would put one in a program is to have a delay.  Deleting them
  11872.      will not make real programs run any faster, so it would be
  11873.      pointless.
  11874.  
  11875.      It would be different if optimization of a nonempty loop could
  11876.      produce an empty one.  But this generally can't happen.
  11877.  
  11878.    * Making side effects happen in the same order as in some other
  11879.      compiler.
  11880.  
  11881.      It is never safe to depend on the order of evaluation of side
  11882.      effects.  For example, a function call like this may very well
  11883.      behave differently from one compiler to another:
  11884.  
  11885.           void func (int, int);
  11886.           
  11887.           int i = 2;
  11888.           func (i++, i++);
  11889.  
  11890.      There is no guarantee (in either the C or the C++ standard language
  11891.      definitions) that the increments will be evaluated in any
  11892.      particular order.  Either increment might happen first.  `func'
  11893.      might get the arguments `2, 3', or it might get `3, 2', or even
  11894.      `2, 2'.
  11895.  
  11896.    * Not allowing structures with volatile fields in registers.
  11897.  
  11898.      Strictly speaking, there is no prohibition in the ANSI C standard
  11899.      against allowing structures with volatile fields in registers, but
  11900.      it does not seem to make any sense and is probably not what you
  11901.      wanted to do.  So the compiler will give an error message in this
  11902.      case.
  11903.  
  11904. 
  11905. File: !gcc.docs.gccuser,  Node: Warnings and Errors,  Prev: Non-bugs,  Up: Trouble
  11906.  
  11907. Warning Messages and Error Messages
  11908. ===================================
  11909.  
  11910.    The GNU compiler can produce two kinds of diagnostics: errors and
  11911. warnings.  Each kind has a different purpose:
  11912.  
  11913.      *Errors* report problems that make it impossible to compile your
  11914.      program.  GNU CC reports errors with the source file name and line
  11915.      number where the problem is apparent.
  11916.  
  11917.      *Warnings* report other unusual conditions in your code that *may*
  11918.      indicate a problem, although compilation can (and does) proceed.
  11919.      Warning messages also report the source file name and line number,
  11920.      but include the text `warning:' to distinguish them from error
  11921.      messages.
  11922.  
  11923.    Warnings may indicate danger points where you should check to make
  11924. sure that your program really does what you intend; or the use of
  11925. obsolete features; or the use of nonstandard features of GNU C or C++.
  11926. Many warnings are issued only if you ask for them, with one of the `-W'
  11927. options (for instance, `-Wall' requests a variety of useful warnings).
  11928.  
  11929.    GNU CC always tries to compile your program if possible; it never
  11930. gratuitously rejects a program whose meaning is clear merely because
  11931. (for instance) it fails to conform to a standard.  In some cases,
  11932. however, the C and C++ standards specify that certain extensions are
  11933. forbidden, and a diagnostic *must* be issued by a conforming compiler.
  11934. The `-pedantic' option tells GNU CC to issue warnings in such cases;
  11935. `-pedantic-errors' says to make them errors instead.  This does not
  11936. mean that *all* non-ANSI constructs get warnings or errors.
  11937.  
  11938.    *Note Options to Request or Suppress Warnings: Warning Options, for
  11939. more detail on these and related command-line options.
  11940.  
  11941. 
  11942. File: !gcc.docs.gccuser,  Node: Bugs,  Next: Service,  Prev: Trouble,  Up: Top
  11943.  
  11944. Reporting Bugs
  11945. **************
  11946.  
  11947.    Your bug reports play an essential role in making GNU CC reliable.
  11948.  
  11949.    When you encounter a problem, the first thing to do is to see if it
  11950. is already known.  *Note Trouble::.  If it isn't known, then you should
  11951. report the problem.
  11952.  
  11953.    Reporting a bug may help you by bringing a solution to your problem,
  11954. or it may not.  (If it does not, look in the service directory; see
  11955. *Note Service::.)  In any case, the principal function of a bug report
  11956. is to help the entire community by making the next version of GNU CC
  11957. work better.  Bug reports are your contribution to the maintenance of
  11958. GNU CC.
  11959.  
  11960.    Since the maintainers are very overloaded, we cannot respond to every
  11961. bug report.  However, if the bug has not been fixed, we are likely to
  11962. send you a patch and ask you to tell us whether it works.
  11963.  
  11964.    In order for a bug report to serve its purpose, you must include the
  11965. information that makes for fixing the bug.
  11966.  
  11967. * Menu:
  11968.  
  11969. * Criteria:  Bug Criteria.   Have you really found a bug?
  11970. * Where: Bug Lists.         Where to send your bug report.
  11971. * Reporting: Bug Reporting.  How to report a bug effectively.
  11972. * Patches: Sending Patches.  How to send a patch for GNU CC.
  11973. * Known: Trouble.            Known problems.
  11974. * Help: Service.             Where to ask for help.
  11975.  
  11976. 
  11977. File: !gcc.docs.gccuser,  Node: Bug Criteria,  Next: Bug Lists,  Up: Bugs
  11978.  
  11979. Have You Found a Bug?
  11980. =====================
  11981.  
  11982.    If you are not sure whether you have found a bug, here are some
  11983. guidelines:
  11984.  
  11985.    * If the compiler gets a fatal signal, for any input whatever, that
  11986.      is a compiler bug.  Reliable compilers never crash.
  11987.  
  11988.    * If the compiler produces invalid assembly code, for any input
  11989.      whatever (except an `asm' statement), that is a compiler bug,
  11990.      unless the compiler reports errors (not just warnings) which would
  11991.      ordinarily prevent the assembler from being run.
  11992.  
  11993.    * If the compiler produces valid assembly code that does not
  11994.      correctly execute the input source code, that is a compiler bug.
  11995.  
  11996.      However, you must double-check to make sure, because you may have
  11997.      run into an incompatibility between GNU C and traditional C (*note
  11998.      Incompatibilities::.).  These incompatibilities might be considered
  11999.      bugs, but they are inescapable consequences of valuable features.
  12000.  
  12001.      Or you may have a program whose behavior is undefined, which
  12002.      happened by chance to give the desired results with another C or
  12003.      C++ compiler.
  12004.  
  12005.      For example, in many nonoptimizing compilers, you can write `x;'
  12006.      at the end of a function instead of `return x;', with the same
  12007.      results.  But the value of the function is undefined if `return'
  12008.      is omitted; it is not a bug when GNU CC produces different results.
  12009.  
  12010.      Problems often result from expressions with two increment
  12011.      operators, as in `f (*p++, *p++)'.  Your previous compiler might
  12012.      have interpreted that expression the way you intended; GNU CC might
  12013.      interpret it another way.  Neither compiler is wrong.  The bug is
  12014.      in your code.
  12015.  
  12016.      After you have localized the error to a single source line, it
  12017.      should be easy to check for these things.  If your program is
  12018.      correct and well defined, you have found a compiler bug.
  12019.  
  12020.    * If the compiler produces an error message for valid input, that is
  12021.      a compiler bug.
  12022.  
  12023.    * If the compiler does not produce an error message for invalid
  12024.      input, that is a compiler bug.  However, you should note that your
  12025.      idea of "invalid input" might be my idea of "an extension" or
  12026.      "support for traditional practice".
  12027.  
  12028.    * If you are an experienced user of C or C++ compilers, your
  12029.      suggestions for improvement of GNU CC or GNU C++ are welcome in
  12030.      any case.
  12031.  
  12032. 
  12033. File: !gcc.docs.gccuser,  Node: Bug Lists,  Next: Bug Reporting,  Prev: Bug Criteria,  Up: Bugs
  12034.  
  12035. Where to Report Bugs
  12036. ====================
  12037.  
  12038.    Send bug reports for GNU C to `bug-gcc@prep.ai.mit.edu'.
  12039.  
  12040.    Send bug reports for GNU C++ to `bug-g++@prep.ai.mit.edu'.  If your
  12041. bug involves the C++ class library libg++, send mail to
  12042. `bug-lib-g++@prep.ai.mit.edu'.  If you're not sure, you can send the
  12043. bug report to both lists.
  12044.  
  12045.    *Do not send bug reports to `help-gcc@prep.ai.mit.edu' or to the
  12046. newsgroup `gnu.gcc.help'.* Most users of GNU CC do not want to receive
  12047. bug reports.  Those that do, have asked to be on `bug-gcc' and/or
  12048. `bug-g++'.
  12049.  
  12050.    The mailing lists `bug-gcc' and `bug-g++' both have newsgroups which
  12051. serve as repeaters: `gnu.gcc.bug' and `gnu.g++.bug'.  Each mailing list
  12052. and its newsgroup carry exactly the same messages.
  12053.  
  12054.    Often people think of posting bug reports to the newsgroup instead of
  12055. mailing them.  This appears to work, but it has one problem which can be
  12056. crucial: a newsgroup posting does not contain a mail path back to the
  12057. sender.  Thus, if maintainers need more information, they may be unable
  12058. to reach you.  For this reason, you should always send bug reports by
  12059. mail to the proper mailing list.
  12060.  
  12061.    As a last resort, send bug reports on paper to:
  12062.  
  12063.      GNU Compiler Bugs
  12064.      Free Software Foundation
  12065.      59 Temple Place - Suite 330
  12066.      Boston, MA 02111-1307, USA
  12067.  
  12068. 
  12069. File: !gcc.docs.gccuser,  Node: Bug Reporting,  Next: Sending Patches,  Prev: Bug Lists,  Up: Bugs
  12070.  
  12071. How to Report Bugs
  12072. ==================
  12073.  
  12074.    The fundamental principle of reporting bugs usefully is this:
  12075. *report all the facts*.  If you are not sure whether to state a fact or
  12076. leave it out, state it!
  12077.  
  12078.    Often people omit facts because they think they know what causes the
  12079. problem and they conclude that some details don't matter.  Thus, you
  12080. might assume that the name of the variable you use in an example does
  12081. not matter.  Well, probably it doesn't, but one cannot be sure.
  12082. Perhaps the bug is a stray memory reference which happens to fetch from
  12083. the location where that name is stored in memory; perhaps, if the name
  12084. were different, the contents of that location would fool the compiler
  12085. into doing the right thing despite the bug.  Play it safe and give a
  12086. specific, complete example.  That is the easiest thing for you to do,
  12087. and the most helpful.
  12088.  
  12089.    Keep in mind that the purpose of a bug report is to enable someone to
  12090. fix the bug if it is not known.  It isn't very important what happens if
  12091. the bug is already known.  Therefore, always write your bug reports on
  12092. the assumption that the bug is not known.
  12093.  
  12094.    Sometimes people give a few sketchy facts and ask, "Does this ring a
  12095. bell?"  This cannot help us fix a bug, so it is basically useless.  We
  12096. respond by asking for enough details to enable us to investigate.  You
  12097. might as well expedite matters by sending them to begin with.
  12098.  
  12099.    Try to make your bug report self-contained.  If we have to ask you
  12100. for more information, it is best if you include all the previous
  12101. information in your response, as well as the information that was
  12102. missing.
  12103.  
  12104.    Please report each bug in a separate message.  This makes it easier
  12105. for us to track which bugs have been fixed and to forward your bugs
  12106. reports to the appropriate maintainer.
  12107.  
  12108.    Do not compress and encode any part of your bug report using programs
  12109. such as `uuencode'.  If you do so it will slow down the processing of
  12110. your bug.  If you must submit multiple large files, use `shar', which
  12111. allows us to read your message without having to run any decompression
  12112. programs.
  12113.  
  12114.    To enable someone to investigate the bug, you should include all
  12115. these things:
  12116.  
  12117.    * The version of GNU CC.  You can get this by running it with the
  12118.      `-v' option.
  12119.  
  12120.      Without this, we won't know whether there is any point in looking
  12121.      for the bug in the current version of GNU CC.
  12122.  
  12123.    * A complete input file that will reproduce the bug.  If the bug is
  12124.      in the C preprocessor, send a source file and any header files
  12125.      that it requires.  If the bug is in the compiler proper (`cc1'),
  12126.      run your source file through the C preprocessor by doing `gcc -E
  12127.      SOURCEFILE > OUTFILE', then include the contents of OUTFILE in the
  12128.      bug report.  (When you do this, use the same `-I', `-D' or `-U'
  12129.      options that you used in actual compilation.)
  12130.  
  12131.      A single statement is not enough of an example.  In order to
  12132.      compile it, it must be embedded in a complete file of compiler
  12133.      input; and the bug might depend on the details of how this is done.
  12134.  
  12135.      Without a real example one can compile, all anyone can do about
  12136.      your bug report is wish you luck.  It would be futile to try to
  12137.      guess how to provoke the bug.  For example, bugs in register
  12138.      allocation and reloading frequently depend on every little detail
  12139.      of the function they happen in.
  12140.  
  12141.      Even if the input file that fails comes from a GNU program, you
  12142.      should still send the complete test case.  Don't ask the GNU CC
  12143.      maintainers to do the extra work of obtaining the program in
  12144.      question--they are all overworked as it is.  Also, the problem may
  12145.      depend on what is in the header files on your system; it is
  12146.      unreliable for the GNU CC maintainers to try the problem with the
  12147.      header files available to them.  By sending CPP output, you can
  12148.      eliminate this source of uncertainty and save us a certain
  12149.      percentage of wild goose chases.
  12150.  
  12151.    * The command arguments you gave GNU CC or GNU C++ to compile that
  12152.      example and observe the bug.  For example, did you use `-O'?  To
  12153.      guarantee you won't omit something important, list all the options.
  12154.  
  12155.      If we were to try to guess the arguments, we would probably guess
  12156.      wrong and then we would not encounter the bug.
  12157.  
  12158.    * The type of machine you are using, and the operating system name
  12159.      and version number.
  12160.  
  12161.    * The operands you gave to the `configure' command when you installed
  12162.      the compiler.
  12163.  
  12164.    * A complete list of any modifications you have made to the compiler
  12165.      source.  (We don't promise to investigate the bug unless it
  12166.      happens in an unmodified compiler.  But if you've made
  12167.      modifications and don't tell us, then you are sending us on a wild
  12168.      goose chase.)
  12169.  
  12170.      Be precise about these changes.  A description in English is not
  12171.      enough--send a context diff for them.
  12172.  
  12173.      Adding files of your own (such as a machine description for a
  12174.      machine we don't support) is a modification of the compiler source.
  12175.  
  12176.    * Details of any other deviations from the standard procedure for
  12177.      installing GNU CC.
  12178.  
  12179.    * A description of what behavior you observe that you believe is
  12180.      incorrect.  For example, "The compiler gets a fatal signal," or,
  12181.      "The assembler instruction at line 208 in the output is incorrect."
  12182.  
  12183.      Of course, if the bug is that the compiler gets a fatal signal,
  12184.      then one can't miss it.  But if the bug is incorrect output, the
  12185.      maintainer might not notice unless it is glaringly wrong.  None of
  12186.      us has time to study all the assembler code from a 50-line C
  12187.      program just on the chance that one instruction might be wrong.
  12188.      We need *you* to do this part!
  12189.  
  12190.      Even if the problem you experience is a fatal signal, you should
  12191.      still say so explicitly.  Suppose something strange is going on,
  12192.      such as, your copy of the compiler is out of synch, or you have
  12193.      encountered a bug in the C library on your system.  (This has
  12194.      happened!)  Your copy might crash and the copy here would not.  If
  12195.      you said to expect a crash, then when the compiler here fails to
  12196.      crash, we would know that the bug was not happening.  If you don't
  12197.      say to expect a crash, then we would not know whether the bug was
  12198.      happening.  We would not be able to draw any conclusion from our
  12199.      observations.
  12200.  
  12201.      If the problem is a diagnostic when compiling GNU CC with some
  12202.      other compiler, say whether it is a warning or an error.
  12203.  
  12204.      Often the observed symptom is incorrect output when your program
  12205.      is run.  Sad to say, this is not enough information unless the
  12206.      program is short and simple.  None of us has time to study a large
  12207.      program to figure out how it would work if compiled correctly,
  12208.      much less which line of it was compiled wrong.  So you will have
  12209.      to do that.  Tell us which source line it is, and what incorrect
  12210.      result happens when that line is executed.  A person who
  12211.      understands the program can find this as easily as finding a bug
  12212.      in the program itself.
  12213.  
  12214.    * If you send examples of assembler code output from GNU CC or GNU
  12215.      C++, please use `-g' when you make them.  The debugging information
  12216.      includes source line numbers which are essential for correlating
  12217.      the output with the input.
  12218.  
  12219.    * If you wish to mention something in the GNU CC source, refer to it
  12220.      by context, not by line number.
  12221.  
  12222.      The line numbers in the development sources don't match those in
  12223.      your sources.  Your line numbers would convey no useful
  12224.      information to the maintainers.
  12225.  
  12226.    * Additional information from a debugger might enable someone to
  12227.      find a problem on a machine which he does not have available.
  12228.      However, you need to think when you collect this information if
  12229.      you want it to have any chance of being useful.
  12230.  
  12231.      For example, many people send just a backtrace, but that is never
  12232.      useful by itself.  A simple backtrace with arguments conveys little
  12233.      about GNU CC because the compiler is largely data-driven; the same
  12234.      functions are called over and over for different RTL insns, doing
  12235.      different things depending on the details of the insn.
  12236.  
  12237.      Most of the arguments listed in the backtrace are useless because
  12238.      they are pointers to RTL list structure.  The numeric values of the
  12239.      pointers, which the debugger prints in the backtrace, have no
  12240.      significance whatever; all that matters is the contents of the
  12241.      objects they point to (and most of the contents are other such
  12242.      pointers).
  12243.  
  12244.      In addition, most compiler passes consist of one or more loops that
  12245.      scan the RTL insn sequence.  The most vital piece of information
  12246.      about such a loop--which insn it has reached--is usually in a
  12247.      local variable, not in an argument.
  12248.  
  12249.      What you need to provide in addition to a backtrace are the values
  12250.      of the local variables for several stack frames up.  When a local
  12251.      variable or an argument is an RTX, first print its value and then
  12252.      use the GDB command `pr' to print the RTL expression that it points
  12253.      to.  (If GDB doesn't run on your machine, use your debugger to call
  12254.      the function `debug_rtx' with the RTX as an argument.)  In
  12255.      general, whenever a variable is a pointer, its value is no use
  12256.      without the data it points to.
  12257.  
  12258.    Here are some things that are not necessary:
  12259.  
  12260.    * A description of the envelope of the bug.
  12261.  
  12262.      Often people who encounter a bug spend a lot of time investigating
  12263.      which changes to the input file will make the bug go away and which
  12264.      changes will not affect it.
  12265.  
  12266.      This is often time consuming and not very useful, because the way
  12267.      we will find the bug is by running a single example under the
  12268.      debugger with breakpoints, not by pure deduction from a series of
  12269.      examples.  You might as well save your time for something else.
  12270.  
  12271.      Of course, if you can find a simpler example to report *instead* of
  12272.      the original one, that is a convenience.  Errors in the output
  12273.      will be easier to spot, running under the debugger will take less
  12274.      time, etc.  Most GNU CC bugs involve just one function, so the
  12275.      most straightforward way to simplify an example is to delete all
  12276.      the function definitions except the one where the bug occurs.
  12277.      Those earlier in the file may be replaced by external declarations
  12278.      if the crucial function depends on them.  (Exception: inline
  12279.      functions may affect compilation of functions defined later in the
  12280.      file.)
  12281.  
  12282.      However, simplification is not vital; if you don't want to do this,
  12283.      report the bug anyway and send the entire test case you used.
  12284.  
  12285.    * In particular, some people insert conditionals `#ifdef BUG' around
  12286.      a statement which, if removed, makes the bug not happen.  These
  12287.      are just clutter; we won't pay any attention to them anyway.
  12288.      Besides, you should send us cpp output, and that can't have
  12289.      conditionals.
  12290.  
  12291.    * A patch for the bug.
  12292.  
  12293.      A patch for the bug is useful if it is a good one.  But don't omit
  12294.      the necessary information, such as the test case, on the
  12295.      assumption that a patch is all we need.  We might see problems
  12296.      with your patch and decide to fix the problem another way, or we
  12297.      might not understand it at all.
  12298.  
  12299.      Sometimes with a program as complicated as GNU CC it is very hard
  12300.      to construct an example that will make the program follow a
  12301.      certain path through the code.  If you don't send the example, we
  12302.      won't be able to construct one, so we won't be able to verify that
  12303.      the bug is fixed.
  12304.  
  12305.      And if we can't understand what bug you are trying to fix, or why
  12306.      your patch should be an improvement, we won't install it.  A test
  12307.      case will help us to understand.
  12308.  
  12309.      *Note Sending Patches::, for guidelines on how to make it easy for
  12310.      us to understand and install your patches.
  12311.  
  12312.    * A guess about what the bug is or what it depends on.
  12313.  
  12314.      Such guesses are usually wrong.  Even I can't guess right about
  12315.      such things without first using the debugger to find the facts.
  12316.  
  12317.    * A core dump file.
  12318.  
  12319.      We have no way of examining a core dump for your type of machine
  12320.      unless we have an identical system--and if we do have one, we
  12321.      should be able to reproduce the crash ourselves.
  12322.  
  12323. 
  12324. File: !gcc.docs.gccuser,  Node: Sending Patches,  Prev: Bug Reporting,  Up: Bugs
  12325.  
  12326. Sending Patches for GNU CC
  12327. ==========================
  12328.  
  12329.    If you would like to write bug fixes or improvements for the GNU C
  12330. compiler, that is very helpful.  Send suggested fixes to the bug report
  12331. mailing list, `bug-gcc@prep.ai.mit.edu'.
  12332.  
  12333.    Please follow these guidelines so we can study your patches
  12334. efficiently.  If you don't follow these guidelines, your information
  12335. might still be useful, but using it will take extra work.  Maintaining
  12336. GNU C is a lot of work in the best of circumstances, and we can't keep
  12337. up unless you do your best to help.
  12338.  
  12339.    * Send an explanation with your changes of what problem they fix or
  12340.      what improvement they bring about.  For a bug fix, just include a
  12341.      copy of the bug report, and explain why the change fixes the bug.
  12342.  
  12343.      (Referring to a bug report is not as good as including it, because
  12344.      then we will have to look it up, and we have probably already
  12345.      deleted it if we've already fixed the bug.)
  12346.  
  12347.    * Always include a proper bug report for the problem you think you
  12348.      have fixed.  We need to convince ourselves that the change is
  12349.      right before installing it.  Even if it is right, we might have
  12350.      trouble judging it if we don't have a way to reproduce the problem.
  12351.  
  12352.    * Include all the comments that are appropriate to help people
  12353.      reading the source in the future understand why this change was
  12354.      needed.
  12355.  
  12356.    * Don't mix together changes made for different reasons.  Send them
  12357.      *individually*.
  12358.  
  12359.      If you make two changes for separate reasons, then we might not
  12360.      want to install them both.  We might want to install just one.  If
  12361.      you send them all jumbled together in a single set of diffs, we
  12362.      have to do extra work to disentangle them--to figure out which
  12363.      parts of the change serve which purpose.  If we don't have time
  12364.      for this, we might have to ignore your changes entirely.
  12365.  
  12366.      If you send each change as soon as you have written it, with its
  12367.      own explanation, then the two changes never get tangled up, and we
  12368.      can consider each one properly without any extra work to
  12369.      disentangle them.
  12370.  
  12371.      Ideally, each change you send should be impossible to subdivide
  12372.      into parts that we might want to consider separately, because each
  12373.      of its parts gets its motivation from the other parts.
  12374.  
  12375.    * Send each change as soon as that change is finished.  Sometimes
  12376.      people think they are helping us by accumulating many changes to
  12377.      send them all together.  As explained above, this is absolutely
  12378.      the worst thing you could do.
  12379.  
  12380.      Since you should send each change separately, you might as well
  12381.      send it right away.  That gives us the option of installing it
  12382.      immediately if it is important.
  12383.  
  12384.    * Use `diff -c' to make your diffs.  Diffs without context are hard
  12385.      for us to install reliably.  More than that, they make it hard for
  12386.      us to study the diffs to decide whether we want to install them.
  12387.      Unidiff format is better than contextless diffs, but not as easy
  12388.      to read as `-c' format.
  12389.  
  12390.      If you have GNU diff, use `diff -cp', which shows the name of the
  12391.      function that each change occurs in.
  12392.  
  12393.    * Write the change log entries for your changes.  We get lots of
  12394.      changes, and we don't have time to do all the change log writing
  12395.      ourselves.
  12396.  
  12397.      Read the `ChangeLog' file to see what sorts of information to put
  12398.      in, and to learn the style that we use.  The purpose of the change
  12399.      log is to show people where to find what was changed.  So you need
  12400.      to be specific about what functions you changed; in large
  12401.      functions, it's often helpful to indicate where within the
  12402.      function the change was.
  12403.  
  12404.      On the other hand, once you have shown people where to find the
  12405.      change, you need not explain its purpose.  Thus, if you add a new
  12406.      function, all you need to say about it is that it is new.  If you
  12407.      feel that the purpose needs explaining, it probably does--but the
  12408.      explanation will be much more useful if you put it in comments in
  12409.      the code.
  12410.  
  12411.      If you would like your name to appear in the header line for who
  12412.      made the change, send us the header line.
  12413.  
  12414.    * When you write the fix, keep in mind that we can't install a
  12415.      change that would break other systems.
  12416.  
  12417.      People often suggest fixing a problem by changing
  12418.      machine-independent files such as `toplev.c' to do something
  12419.      special that a particular system needs.  Sometimes it is totally
  12420.      obvious that such changes would break GNU CC for almost all users.
  12421.      We can't possibly make a change like that.  At best it might tell
  12422.      us how to write another patch that would solve the problem
  12423.      acceptably.
  12424.  
  12425.      Sometimes people send fixes that *might* be an improvement in
  12426.      general--but it is hard to be sure of this.  It's hard to install
  12427.      such changes because we have to study them very carefully.  Of
  12428.      course, a good explanation of the reasoning by which you concluded
  12429.      the change was correct can help convince us.
  12430.  
  12431.      The safest changes are changes to the configuration files for a
  12432.      particular machine.  These are safe because they can't create new
  12433.      bugs on other machines.
  12434.  
  12435.      Please help us keep up with the workload by designing the patch in
  12436.      a form that is good to install.
  12437.  
  12438. 
  12439. File: !gcc.docs.gccuser,  Node: Service,  Next: VMS,  Prev: Bugs,  Up: Top
  12440.  
  12441. How To Get Help with GNU CC
  12442. ***************************
  12443.  
  12444.    If you need help installing, using or changing GNU CC, there are two
  12445. ways to find it:
  12446.  
  12447.    * Send a message to a suitable network mailing list.  First try
  12448.      `bug-gcc@prep.ai.mit.edu', and if that brings no response, try
  12449.      `help-gcc@prep.ai.mit.edu'.
  12450.  
  12451.    * Look in the service directory for someone who might help you for a
  12452.      fee.  The service directory is found in the file named `SERVICE'
  12453.      in the GNU CC distribution.
  12454.  
  12455. 
  12456. File: !gcc.docs.gccuser,  Node: VMS,  Next: Index,  Prev: Service,  Up: Top
  12457.  
  12458. Using GNU CC on VMS
  12459. *******************
  12460.  
  12461.    Here is how to use GNU CC on VMS.
  12462.  
  12463. * Menu:
  12464.  
  12465. * Include Files and VMS::  Where the preprocessor looks for the include files.
  12466. * Global Declarations::    How to do globaldef, globalref and globalvalue with
  12467.                            GNU CC.
  12468. * VMS Misc::           Misc information.
  12469.  
  12470. 
  12471. File: !gcc.docs.gccuser,  Node: Include Files and VMS,  Next: Global Declarations,  Up: VMS
  12472.  
  12473. Include Files and VMS
  12474. =====================
  12475.  
  12476.    Due to the differences between the filesystems of Unix and VMS, GNU
  12477. CC attempts to translate file names in `#include' into names that VMS
  12478. will understand.  The basic strategy is to prepend a prefix to the
  12479. specification of the include file, convert the whole filename to a VMS
  12480. filename, and then try to open the file.  GNU CC tries various prefixes
  12481. one by one until one of them succeeds:
  12482.  
  12483.   1. The first prefix is the `GNU_CC_INCLUDE:' logical name: this is
  12484.      where GNU C header files are traditionally stored.  If you wish to
  12485.      store header files in non-standard locations, then you can assign
  12486.      the logical `GNU_CC_INCLUDE' to be a search list, where each
  12487.      element of the list is suitable for use with a rooted logical.
  12488.  
  12489.   2. The next prefix tried is `SYS$SYSROOT:[SYSLIB.]'.  This is where
  12490.      VAX-C header files are traditionally stored.
  12491.  
  12492.   3. If the include file specification by itself is a valid VMS
  12493.      filename, the preprocessor then uses this name with no prefix in
  12494.      an attempt to open the include file.
  12495.  
  12496.   4. If the file specification is not a valid VMS filename (i.e. does
  12497.      not contain a device or a directory specifier, and contains a `/'
  12498.      character), the preprocessor tries to convert it from Unix syntax
  12499.      to VMS syntax.
  12500.  
  12501.      Conversion works like this: the first directory name becomes a
  12502.      device, and the rest of the directories are converted into
  12503.      VMS-format directory names.  For example, the name `X11/foobar.h'
  12504.      is translated to `X11:[000000]foobar.h' or `X11:foobar.h',
  12505.      whichever one can be opened.  This strategy allows you to assign a
  12506.      logical name to point to the actual location of the header files.
  12507.  
  12508.   5. If none of these strategies succeeds, the `#include' fails.
  12509.  
  12510.    Include directives of the form:
  12511.  
  12512.      #include foobar
  12513.  
  12514. are a common source of incompatibility between VAX-C and GNU CC.  VAX-C
  12515. treats this much like a standard `#include <foobar.h>' directive.  That
  12516. is incompatible with the ANSI C behavior implemented by GNU CC: to
  12517. expand the name `foobar' as a macro.  Macro expansion should eventually
  12518. yield one of the two standard formats for `#include':
  12519.  
  12520.      #include "FILE"
  12521.      #include <FILE>
  12522.  
  12523.    If you have this problem, the best solution is to modify the source
  12524. to convert the `#include' directives to one of the two standard forms.
  12525. That will work with either compiler.  If you want a quick and dirty fix,
  12526. define the file names as macros with the proper expansion, like this:
  12527.  
  12528.      #define stdio <stdio.h>
  12529.  
  12530. This will work, as long as the name doesn't conflict with anything else
  12531. in the program.
  12532.  
  12533.    Another source of incompatibility is that VAX-C assumes that:
  12534.  
  12535.      #include "foobar"
  12536.  
  12537. is actually asking for the file `foobar.h'.  GNU CC does not make this
  12538. assumption, and instead takes what you ask for literally; it tries to
  12539. read the file `foobar'.  The best way to avoid this problem is to
  12540. always specify the desired file extension in your include directives.
  12541.  
  12542.    GNU CC for VMS is distributed with a set of include files that is
  12543. sufficient to compile most general purpose programs.  Even though the
  12544. GNU CC distribution does not contain header files to define constants
  12545. and structures for some VMS system-specific functions, there is no
  12546. reason why you cannot use GNU CC with any of these functions.  You first
  12547. may have to generate or create header files, either by using the public
  12548. domain utility `UNSDL' (which can be found on a DECUS tape), or by
  12549. extracting the relevant modules from one of the system macro libraries,
  12550. and using an editor to construct a C header file.
  12551.  
  12552.    A `#include' file name cannot contain a DECNET node name.  The
  12553. preprocessor reports an I/O error if you attempt to use a node name,
  12554. whether explicitly, or implicitly via a logical name.
  12555.  
  12556. 
  12557. File: !gcc.docs.gccuser,  Node: Global Declarations,  Next: VMS Misc,  Prev: Include Files and VMS,  Up: VMS
  12558.  
  12559. Global Declarations and VMS
  12560. ===========================
  12561.  
  12562.    GNU CC does not provide the `globalref', `globaldef' and
  12563. `globalvalue' keywords of VAX-C.  You can get the same effect with an
  12564. obscure feature of GAS, the GNU assembler.  (This requires GAS version
  12565. 1.39 or later.)  The following macros allow you to use this feature in
  12566. a fairly natural way:
  12567.  
  12568.      #ifdef __GNUC__
  12569.      #define GLOBALREF(TYPE,NAME)                      \
  12570.        TYPE NAME                                       \
  12571.        asm ("_$$PsectAttributes_GLOBALSYMBOL$$" #NAME)
  12572.      #define GLOBALDEF(TYPE,NAME,VALUE)                \
  12573.        TYPE NAME                                       \
  12574.        asm ("_$$PsectAttributes_GLOBALSYMBOL$$" #NAME) \
  12575.          = VALUE
  12576.      #define GLOBALVALUEREF(TYPE,NAME)                 \
  12577.        const TYPE NAME[1]                              \
  12578.        asm ("_$$PsectAttributes_GLOBALVALUE$$" #NAME)
  12579.      #define GLOBALVALUEDEF(TYPE,NAME,VALUE)           \
  12580.        const TYPE NAME[1]                              \
  12581.        asm ("_$$PsectAttributes_GLOBALVALUE$$" #NAME)  \
  12582.          = {VALUE}
  12583.      #else
  12584.      #define GLOBALREF(TYPE,NAME) \
  12585.        globalref TYPE NAME
  12586.      #define GLOBALDEF(TYPE,NAME,VALUE) \
  12587.        globaldef TYPE NAME = VALUE
  12588.      #define GLOBALVALUEDEF(TYPE,NAME,VALUE) \
  12589.        globalvalue TYPE NAME = VALUE
  12590.      #define GLOBALVALUEREF(TYPE,NAME) \
  12591.        globalvalue TYPE NAME
  12592.      #endif
  12593.  
  12594. (The `_$$PsectAttributes_GLOBALSYMBOL' prefix at the start of the name
  12595. is removed by the assembler, after it has modified the attributes of
  12596. the symbol).  These macros are provided in the VMS binaries
  12597. distribution in a header file `GNU_HACKS.H'.  An example of the usage
  12598. is:
  12599.  
  12600.      GLOBALREF (int, ijk);
  12601.      GLOBALDEF (int, jkl, 0);
  12602.  
  12603.    The macros `GLOBALREF' and `GLOBALDEF' cannot be used
  12604. straightforwardly for arrays, since there is no way to insert the array
  12605. dimension into the declaration at the right place.  However, you can
  12606. declare an array with these macros if you first define a typedef for the
  12607. array type, like this:
  12608.  
  12609.      typedef int intvector[10];
  12610.      GLOBALREF (intvector, foo);
  12611.  
  12612.    Array and structure initializers will also break the macros; you can
  12613. define the initializer to be a macro of its own, or you can expand the
  12614. `GLOBALDEF' macro by hand.  You may find a case where you wish to use
  12615. the `GLOBALDEF' macro with a large array, but you are not interested in
  12616. explicitly initializing each element of the array.  In such cases you
  12617. can use an initializer like: `{0,}', which will initialize the entire
  12618. array to `0'.
  12619.  
  12620.    A shortcoming of this implementation is that a variable declared with
  12621. `GLOBALVALUEREF' or `GLOBALVALUEDEF' is always an array.  For example,
  12622. the declaration:
  12623.  
  12624.      GLOBALVALUEREF(int, ijk);
  12625.  
  12626. declares the variable `ijk' as an array of type `int [1]'.  This is
  12627. done because a globalvalue is actually a constant; its "value" is what
  12628. the linker would normally consider an address.  That is not how an
  12629. integer value works in C, but it is how an array works.  So treating
  12630. the symbol as an array name gives consistent results--with the
  12631. exception that the value seems to have the wrong type.  *Don't try to
  12632. access an element of the array.*  It doesn't have any elements.  The
  12633. array "address" may not be the address of actual storage.
  12634.  
  12635.    The fact that the symbol is an array may lead to warnings where the
  12636. variable is used.  Insert type casts to avoid the warnings.  Here is an
  12637. example; it takes advantage of the ANSI C feature allowing macros that
  12638. expand to use the same name as the macro itself.
  12639.  
  12640.      GLOBALVALUEREF (int, ss$_normal);
  12641.      GLOBALVALUEDEF (int, xyzzy,123);
  12642.      #ifdef __GNUC__
  12643.      #define ss$_normal ((int) ss$_normal)
  12644.      #define xyzzy ((int) xyzzy)
  12645.      #endif
  12646.  
  12647.    Don't use `globaldef' or `globalref' with a variable whose type is
  12648. an enumeration type; this is not implemented.  Instead, make the
  12649. variable an integer, and use a `globalvaluedef' for each of the
  12650. enumeration values.  An example of this would be:
  12651.  
  12652.      #ifdef __GNUC__
  12653.      GLOBALDEF (int, color, 0);
  12654.      GLOBALVALUEDEF (int, RED, 0);
  12655.      GLOBALVALUEDEF (int, BLUE, 1);
  12656.      GLOBALVALUEDEF (int, GREEN, 3);
  12657.      #else
  12658.      enum globaldef color {RED, BLUE, GREEN = 3};
  12659.      #endif
  12660.  
  12661. 
  12662. File: !gcc.docs.gccuser,  Node: VMS Misc,  Prev: Global Declarations,  Up: VMS
  12663.  
  12664. Other VMS Issues
  12665. ================
  12666.  
  12667.    GNU CC automatically arranges for `main' to return 1 by default if
  12668. you fail to specify an explicit return value.  This will be interpreted
  12669. by VMS as a status code indicating a normal successful completion.
  12670. Version 1 of GNU CC did not provide this default.
  12671.  
  12672.    GNU CC on VMS works only with the GNU assembler, GAS.  You need
  12673. version 1.37 or later of GAS in order to produce value debugging
  12674. information for the VMS debugger.  Use the ordinary VMS linker with the
  12675. object files produced by GAS.
  12676.  
  12677.    Under previous versions of GNU CC, the generated code would
  12678. occasionally give strange results when linked to the sharable `VAXCRTL'
  12679. library.  Now this should work.
  12680.  
  12681.    A caveat for use of `const' global variables: the `const' modifier
  12682. must be specified in every external declaration of the variable in all
  12683. of the source files that use that variable.  Otherwise the linker will
  12684. issue warnings about conflicting attributes for the variable.  Your
  12685. program will still work despite the warnings, but the variable will be
  12686. placed in writable storage.
  12687.  
  12688.    Although the VMS linker does distinguish between upper and lower case
  12689. letters in global symbols, most VMS compilers convert all such symbols
  12690. into upper case and most run-time library routines also have upper case
  12691. names.  To be able to reliably call such routines, GNU CC (by means of
  12692. the assembler GAS) converts global symbols into upper case like other
  12693. VMS compilers.  However, since the usual practice in C is to distinguish
  12694. case, GNU CC (via GAS) tries to preserve usual C behavior by augmenting
  12695. each name that is not all lower case.  This means truncating the name
  12696. to at most 23 characters and then adding more characters at the end
  12697. which encode the case pattern of those 23.   Names which contain at
  12698. least one dollar sign are an exception; they are converted directly into
  12699. upper case without augmentation.
  12700.  
  12701.    Name augmentation yields bad results for programs that use
  12702. precompiled libraries (such as Xlib) which were generated by another
  12703. compiler.  You can use the compiler option `/NOCASE_HACK' to inhibit
  12704. augmentation; it makes external C functions and variables
  12705. case-independent as is usual on VMS.  Alternatively, you could write
  12706. all references to the functions and variables in such libraries using
  12707. lower case; this will work on VMS, but is not portable to other
  12708. systems.  The compiler option `/NAMES' also provides control over
  12709. global name handling.
  12710.  
  12711.    Function and variable names are handled somewhat differently with GNU
  12712. C++.  The GNU C++ compiler performs "name mangling" on function names,
  12713. which means that it adds information to the function name to describe
  12714. the data types of the arguments that the function takes.  One result of
  12715. this is that the name of a function can become very long.  Since the
  12716. VMS linker only recognizes the first 31 characters in a name, special
  12717. action is taken to ensure that each function and variable has a unique
  12718. name that can be represented in 31 characters.
  12719.  
  12720.    If the name (plus a name augmentation, if required) is less than 32
  12721. characters in length, then no special action is performed.  If the name
  12722. is longer than 31 characters, the assembler (GAS) will generate a hash
  12723. string based upon the function name, truncate the function name to 23
  12724. characters, and append the hash string to the truncated name.  If the
  12725. `/VERBOSE' compiler option is used, the assembler will print both the
  12726. full and truncated names of each symbol that is truncated.
  12727.  
  12728.    The `/NOCASE_HACK' compiler option should not be used when you are
  12729. compiling programs that use libg++.  libg++ has several instances of
  12730. objects (i.e.  `Filebuf' and `filebuf') which become indistinguishable
  12731. in a case-insensitive environment.  This leads to cases where you need
  12732. to inhibit augmentation selectively (if you were using libg++ and Xlib
  12733. in the same program, for example).  There is no special feature for
  12734. doing this, but you can get the result by defining a macro for each
  12735. mixed case symbol for which you wish to inhibit augmentation.  The
  12736. macro should expand into the lower case equivalent of itself.  For
  12737. example:
  12738.  
  12739.      #define StuDlyCapS studlycaps
  12740.  
  12741.    These macro definitions can be placed in a header file to minimize
  12742. the number of changes to your source code.
  12743.  
  12744. 
  12745. File: !gcc.docs.gccuser,  Node: Index,  Prev: VMS,  Up: Top
  12746.  
  12747. Index
  12748. *****
  12749.  
  12750. * Menu:
  12751.  
  12752. * $:                                    Dollar Signs.
  12753. * ':                                    Incompatibilities.
  12754. * //:                                   C++ Comments.
  12755. * <?:                                   Min and Max.
  12756. * >?:                                   Min and Max.
  12757. * ?: side effect:                       Conditionals.
  12758. * #pragma implementation, implied:      C++ Interface.
  12759. * #pragma, reason for not using:        Function Attributes.
  12760. * -lgcc, use with -nodefaultlibs:       Link Options.
  12761. * -lgcc, use with -nostdlib:            Link Options.
  12762. * -nodefaultlibs and unresolved references: Link Options.
  12763. * -nostdlib and unresolved references:  Link Options.
  12764. * ?: extensions <1>:                    Lvalues.
  12765. * ?: extensions:                        Conditionals.
  12766. * alias attribute:                      Function Attributes.
  12767. * aligned attribute <1>:                Variable Attributes.
  12768. * aligned attribute:                    Type Attributes.
  12769. * alloca and SunOs:                     Installation.
  12770. * alloca vs variable-length arrays:     Variable Length.
  12771. * alloca, for SunOs:                    Sun Install.
  12772. * alloca, for Unos:                     Configurations.
  12773. * asm constraints:                      Constraints.
  12774. * asm expressions:                      Extended Asm.
  12775. * constructor function attribute:       Function Attributes.
  12776. * const applied to function:            Function Attributes.
  12777. * const function attribute:             Function Attributes.
  12778. * destructor function attribute:        Function Attributes.
  12779. * float as function value type:         Incompatibilities.
  12780. * format function attribute:            Function Attributes.
  12781. * fscanf, and constant strings:         Incompatibilities.
  12782. * g++ 1.XX:                             Invoking G++.
  12783. * g++ older version:                    Invoking G++.
  12784. * g++, separate compiler:               Invoking G++.
  12785. * genflags, crash on Sun 4:             Installation Problems.
  12786. * goto in C++:                          Destructors and Goto.
  12787. * gprof:                                Debugging Options.
  12788. * inline automatic for C++ member fns:  Inline.
  12789. * long long data types:                 Long Long.
  12790. * longjmp and automatic variables:      C Dialect Options.
  12791. * longjmp incompatibilities:            Incompatibilities.
  12792. * longjmp warnings:                     Warning Options.
  12793. * main and the exit status:             VMS Misc.
  12794. * mktemp, and constant strings:         Incompatibilities.
  12795. * mode attribute:                       Variable Attributes.
  12796. * nocommon attribute:                   Variable Attributes.
  12797. * noreturn function attribute:          Function Attributes.
  12798. * packed attribute:                     Variable Attributes.
  12799. * prof:                                 Debugging Options.
  12800. * qsort, and global register variables: Global Reg Vars.
  12801. * return, in C++ function header:       Naming Results.
  12802. * scanf, and constant strings:          Incompatibilities.
  12803. * section function attribute:           Function Attributes.
  12804. * section variable attribute:           Variable Attributes.
  12805. * setjmp incompatibilities:             Incompatibilities.
  12806. * signature in C++, advantages:         C++ Signatures.
  12807. * sscanf, and constant strings:         Incompatibilities.
  12808. * tcov:                                 Debugging Options.
  12809. * volatile applied to function:         Function Attributes.
  12810. * weak attribute:                       Function Attributes.
  12811. * stdarg.h and RT PC:                   RT Options.
  12812. * varargs.h and RT PC:                  RT Options.
  12813. * VAXCRTL:                              VMS Misc.
  12814. * ! in constraint:                      Multi-Alternative.
  12815. * # in constraint:                      Modifiers.
  12816. * % in constraint:                      Modifiers.
  12817. * & in constraint:                      Modifiers.
  12818. * + in constraint:                      Modifiers.
  12819. * 0 in constraint:                      Simple Constraints.
  12820. * < in constraint:                      Simple Constraints.
  12821. * = in constraint:                      Modifiers.
  12822. * > in constraint:                      Simple Constraints.
  12823. * ? in constraint:                      Multi-Alternative.
  12824. * d in constraint:                      Simple Constraints.
  12825. * E in constraint:                      Simple Constraints.
  12826. * F in constraint:                      Simple Constraints.
  12827. * g in constraint:                      Simple Constraints.
  12828. * H in constraint:                      Simple Constraints.
  12829. * I in constraint:                      Simple Constraints.
  12830. * m in constraint:                      Simple Constraints.
  12831. * n in constraint:                      Simple Constraints.
  12832. * o in constraint:                      Simple Constraints.
  12833. * p in constraint:                      Simple Constraints.
  12834. * Q, in constraint:                     Simple Constraints.
  12835. * r in constraint:                      Simple Constraints.
  12836. * s in constraint:                      Simple Constraints.
  12837. * V in constraint:                      Simple Constraints.
  12838. * X in constraint:                      Simple Constraints.
  12839. * _ in variables in macros:             Naming Types.
  12840. * abort:                                C Dialect Options.
  12841. * abs:                                  C Dialect Options.
  12842. * address constraints:                  Simple Constraints.
  12843. * address of a label:                   Labels as Values.
  12844. * address_operand:                      Simple Constraints.
  12845. * alignment:                            Alignment.
  12846. * Alliant:                              Interoperation.
  12847. * alloca:                               C Dialect Options.
  12848. * alternate keywords:                   Alternate Keywords.
  12849. * AMD29K options:                       AMD29K Options.
  12850. * ANSI support:                         C Dialect Options.
  12851. * apostrophes:                          Incompatibilities.
  12852. * arguments in frame (88k):             M88K Options.
  12853. * ARM options:                          ARM Options.
  12854. * arrays of length zero:                Zero Length.
  12855. * arrays of variable length:            Variable Length.
  12856. * arrays, non-lvalue:                   Subscripting.
  12857. * assembler instructions:               Extended Asm.
  12858. * assembler names for identifiers:      Asm Labels.
  12859. * assembler syntax, 88k:                M88K Options.
  12860. * assembly code, invalid:               Bug Criteria.
  12861. * attribute of types:                   Type Attributes.
  12862. * attribute of variables:               Variable Attributes.
  12863. * autoincrement/decrement addressing:   Simple Constraints.
  12864. * automatic inline for C++ member fns:  Inline.
  12865. * backtrace for bug reports:            Bug Reporting.
  12866. * Bison parser generator:               Installation.
  12867. * bit shift overflow (88k):             M88K Options.
  12868. * bug criteria:                         Bug Criteria.
  12869. * bug report mailing lists:             Bug Lists.
  12870. * bugs:                                 Bugs.
  12871. * bugs, known:                          Trouble.
  12872. * builtin functions:                    C Dialect Options.
  12873. * byte writes (29k):                    AMD29K Options.
  12874. * C compilation options:                Invoking GCC.
  12875. * C intermediate output, nonexistent:   G++ and GCC.
  12876. * C language extensions:                C Extensions.
  12877. * C language, traditional:              C Dialect Options.
  12878. * C++:                                  G++ and GCC.
  12879. * c++:                                  Invoking G++.
  12880. * C++ comments:                         C++ Comments.
  12881. * C++ compilation options:              Invoking GCC.
  12882. * C++ interface and implementation headers: C++ Interface.
  12883. * C++ language extensions:              C++ Extensions.
  12884. * C++ member fns, automatically inline: Inline.
  12885. * C++ misunderstandings:                C++ Misunderstandings.
  12886. * C++ named return value:               Naming Results.
  12887. * C++ options, command line:            C++ Dialect Options.
  12888. * C++ pragmas, effect on inlining:      C++ Interface.
  12889. * C++ signatures:                       C++ Signatures.
  12890. * C++ source file suffixes:             Invoking G++.
  12891. * C++ static data, declaring and defining: Static Definitions.
  12892. * C++ subtype polymorphism:             C++ Signatures.
  12893. * C++ type abstraction:                 C++ Signatures.
  12894. * case labels in initializers:          Labeled Elements.
  12895. * case ranges:                          Case Ranges.
  12896. * case sensitivity and VMS:             VMS Misc.
  12897. * cast to a union:                      Cast to Union.
  12898. * casts as lvalues:                     Lvalues.
  12899. * code generation conventions:          Code Gen Options.
  12900. * command options:                      Invoking GCC.
  12901. * comments, C++ style:                  C++ Comments.
  12902. * compilation in a separate directory:  Other Dir.
  12903. * compiler bugs, reporting:             Bug Reporting.
  12904. * compiler compared to C++ preprocessor: G++ and GCC.
  12905. * compiler options, C++:                C++ Dialect Options.
  12906. * compiler version, specifying:         Target Options.
  12907. * COMPILER_PATH:                        Environment Variables.
  12908. * complex numbers:                      Complex.
  12909. * compound expressions as lvalues:      Lvalues.
  12910. * computed gotos:                       Labels as Values.
  12911. * conditional expressions as lvalues:   Lvalues.
  12912. * conditional expressions, extensions:  Conditionals.
  12913. * configurations supported by GNU CC:   Configurations.
  12914. * conflicting types:                    Disappointments.
  12915. * constants in constraints:             Simple Constraints.
  12916. * constraint modifier characters:       Modifiers.
  12917. * constraint, matching:                 Simple Constraints.
  12918. * constraints, asm:                     Constraints.
  12919. * constraints, machine specific:        Machine Constraints.
  12920. * constructing calls:                   Constructing Calls.
  12921. * constructor expressions:              Constructors.
  12922. * constructors vs goto:                 Destructors and Goto.
  12923. * constructors, automatic calls:        Collect2.
  12924. * contributors:                         Contributors.
  12925. * Convex options:                       Convex Options.
  12926. * core dump:                            Bug Criteria.
  12927. * cos:                                  C Dialect Options.
  12928. * CPLUS_INCLUDE_PATH:                   Environment Variables.
  12929. * cross compiling:                      Target Options.
  12930. * cross-compiler, installation:         Cross-Compiler.
  12931. * C_INCLUDE_PATH:                       Environment Variables.
  12932. * DBX:                                  Interoperation.
  12933. * deallocating variable length arrays:  Variable Length.
  12934. * debugging information options:        Debugging Options.
  12935. * debugging, 88k OCS:                   M88K Options.
  12936. * debug_rtx:                            Bug Reporting.
  12937. * declaration scope:                    Incompatibilities.
  12938. * declarations inside expressions:      Statement Exprs.
  12939. * declaring attributes of functions:    Function Attributes.
  12940. * declaring static data in C++:         Static Definitions.
  12941. * default implementation, signature member function: C++ Signatures.
  12942. * defining static data in C++:          Static Definitions.
  12943. * dependencies for make as output:      Environment Variables.
  12944. * dependencies, make:                   Preprocessor Options.
  12945. * DEPENDENCIES_OUTPUT:                  Environment Variables.
  12946. * destructors vs goto:                  Destructors and Goto.
  12947. * detecting -traditional:               C Dialect Options.
  12948. * dialect options:                      C Dialect Options.
  12949. * digits in constraint:                 Simple Constraints.
  12950. * directory options:                    Directory Options.
  12951. * divide instruction, 88k:              M88K Options.
  12952. * dollar signs in identifier names:     Dollar Signs.
  12953. * double-word arithmetic:               Long Long.
  12954. * downward funargs:                     Nested Functions.
  12955. * DW bit (29k):                         AMD29K Options.
  12956. * enumeration clash warnings:           Warning Options.
  12957. * environment variables:                Environment Variables.
  12958. * error messages:                       Warnings and Errors.
  12959. * escape sequences, traditional:        C Dialect Options.
  12960. * exclamation point:                    Multi-Alternative.
  12961. * exit:                                 C Dialect Options.
  12962. * exit status and VMS:                  VMS Misc.
  12963. * explicit register variables:          Explicit Reg Vars.
  12964. * expressions containing statements:    Statement Exprs.
  12965. * expressions, compound, as lvalues:    Lvalues.
  12966. * expressions, conditional, as lvalues: Lvalues.
  12967. * expressions, constructor:             Constructors.
  12968. * extended asm:                         Extended Asm.
  12969. * extensible constraints:               Simple Constraints.
  12970. * extensions, ?: <1>:                   Conditionals.
  12971. * extensions, ?::                       Lvalues.
  12972. * extensions, C language:               C Extensions.
  12973. * extensions, C++ language:             C++ Extensions.
  12974. * external declaration scope:           Incompatibilities.
  12975. * fabs:                                 C Dialect Options.
  12976. * fatal signal:                         Bug Criteria.
  12977. * ffs:                                  C Dialect Options.
  12978. * file name suffix:                     Overall Options.
  12979. * file names:                           Link Options.
  12980. * forwarding calls:                     Constructing Calls.
  12981. * function attributes:                  Function Attributes.
  12982. * function pointers, arithmetic:        Pointer Arith.
  12983. * function prototype declarations:      Function Prototypes.
  12984. * function, size of pointer to:         Pointer Arith.
  12985. * functions in arbitrary sections:      Function Attributes.
  12986. * functions that are passed arguments in registers on the 386: Function Attributes.
  12987. * functions that do not pop the argument stack on the 386: Function Attributes.
  12988. * functions that do pop the argument stack on the 386: Function Attributes.
  12989. * functions that have no side effects:  Function Attributes.
  12990. * functions that never return:          Function Attributes.
  12991. * functions that pop the argument stack on the 386: Function Attributes.
  12992. * functions with printf or scanf style arguments: Function Attributes.
  12993. * g++:                                  Invoking G++.
  12994. * G++:                                  G++ and GCC.
  12995. * GCC:                                  G++ and GCC.
  12996. * GCC_EXEC_PREFIX:                      Environment Variables.
  12997. * generalized lvalues:                  Lvalues.
  12998. * global offset table:                  Code Gen Options.
  12999. * global register after longjmp:        Global Reg Vars.
  13000. * global register variables:            Global Reg Vars.
  13001. * GLOBALDEF:                            Global Declarations.
  13002. * GLOBALREF:                            Global Declarations.
  13003. * GLOBALVALUEDEF:                       Global Declarations.
  13004. * GLOBALVALUEREF:                       Global Declarations.
  13005. * GNU CC command options:               Invoking GCC.
  13006. * goto with computed label:             Labels as Values.
  13007. * gp-relative references (MIPS):        MIPS Options.
  13008. * grouping options:                     Invoking GCC.
  13009. * hardware models and configurations, specifying: Submodel Options.
  13010. * header files and VMS:                 Include Files and VMS.
  13011. * HPPA Options:                         HPPA Options.
  13012. * i386 Options:                         i386 Options.
  13013. * IBM RS/6000 and PowerPC Options:      RS/6000 and PowerPC Options.
  13014. * IBM RT options:                       RT Options.
  13015. * IBM RT PC:                            Interoperation.
  13016. * identifier names, dollar signs in:    Dollar Signs.
  13017. * identifiers, names in assembler code: Asm Labels.
  13018. * identifying source, compiler (88k):   M88K Options.
  13019. * implicit argument: return value:      Naming Results.
  13020. * implied #pragma implementation:       C++ Interface.
  13021. * include files and VMS:                Include Files and VMS.
  13022. * incompatibilities of GNU CC:          Incompatibilities.
  13023. * increment operators:                  Bug Criteria.
  13024. * initializations in expressions:       Constructors.
  13025. * initializers with labeled elements:   Labeled Elements.
  13026. * initializers, non-constant:           Initializers.
  13027. * inline functions:                     Inline.
  13028. * inline functions, omission of:        Inline.
  13029. * inlining and C++ pragmas:             C++ Interface.
  13030. * installation trouble:                 Trouble.
  13031. * installing GNU CC:                    Installation.
  13032. * installing GNU CC on the Sun:         Sun Install.
  13033. * installing GNU CC on VMS:             VMS Install.
  13034. * integrating function code:            Inline.
  13035. * Intel 386 Options:                    i386 Options.
  13036. * interface and implementation headers, C++: C++ Interface.
  13037. * intermediate C version, nonexistent:  G++ and GCC.
  13038. * introduction:                         Top.
  13039. * invalid assembly code:                Bug Criteria.
  13040. * invalid input:                        Bug Criteria.
  13041. * invoking g++:                         Invoking G++.
  13042. * kernel and user registers (29k):      AMD29K Options.
  13043. * keywords, alternate:                  Alternate Keywords.
  13044. * known causes of trouble:              Trouble.
  13045. * labeled elements in initializers:     Labeled Elements.
  13046. * labels as values:                     Labels as Values.
  13047. * labs:                                 C Dialect Options.
  13048. * language dialect options:             C Dialect Options.
  13049. * large bit shifts (88k):               M88K Options.
  13050. * length-zero arrays:                   Zero Length.
  13051. * Libraries:                            Link Options.
  13052. * LIBRARY_PATH:                         Environment Variables.
  13053. * link options:                         Link Options.
  13054. * load address instruction:             Simple Constraints.
  13055. * local labels:                         Local Labels.
  13056. * local variables in macros:            Naming Types.
  13057. * local variables, specifying registers: Local Reg Vars.
  13058. * longjmp:                              Global Reg Vars.
  13059. * lvalues, generalized:                 Lvalues.
  13060. * M680x0 options:                       M680x0 Options.
  13061. * M88k options:                         M88K Options.
  13062. * machine dependent options:            Submodel Options.
  13063. * machine specific constraints:         Machine Constraints.
  13064. * macro with variable arguments:        Macro Varargs.
  13065. * macros containing asm:                Extended Asm.
  13066. * macros, inline alternative:           Inline.
  13067. * macros, local labels:                 Local Labels.
  13068. * macros, local variables in:           Naming Types.
  13069. * macros, statements in expressions:    Statement Exprs.
  13070. * macros, types of arguments:           Typeof.
  13071. * make:                                 Preprocessor Options.
  13072. * matching constraint:                  Simple Constraints.
  13073. * maximum operator:                     Min and Max.
  13074. * member fns, automatically inline:     Inline.
  13075. * memcmp:                               C Dialect Options.
  13076. * memcpy:                               C Dialect Options.
  13077. * memory model (29k):                   AMD29K Options.
  13078. * memory references in constraints:     Simple Constraints.
  13079. * messages, warning:                    Warning Options.
  13080. * messages, warning and error:          Warnings and Errors.
  13081. * middle-operands, omitted:             Conditionals.
  13082. * minimum operator:                     Min and Max.
  13083. * MIPS options:                         MIPS Options.
  13084. * misunderstandings in C++:             C++ Misunderstandings.
  13085. * modifiers in constraints:             Modifiers.
  13086. * multiple alternative constraints:     Multi-Alternative.
  13087. * multiprecision arithmetic:            Long Long.
  13088. * name augmentation:                    VMS Misc.
  13089. * named return value in C++:            Naming Results.
  13090. * names used in assembler code:         Asm Labels.
  13091. * naming convention, implementation headers: C++ Interface.
  13092. * naming types:                         Naming Types.
  13093. * nested functions:                     Nested Functions.
  13094. * newline vs string constants:          C Dialect Options.
  13095. * non-constant initializers:            Initializers.
  13096. * non-static inline function:           Inline.
  13097. * OBJC_INCLUDE_PATH:                    Environment Variables.
  13098. * Objective C:                          G++ and GCC.
  13099. * obstack_free:                         Configurations.
  13100. * OCS (88k):                            M88K Options.
  13101. * offsettable address:                  Simple Constraints.
  13102. * old-style function definitions:       Function Prototypes.
  13103. * omitted middle-operands:              Conditionals.
  13104. * open coding:                          Inline.
  13105. * operand constraints, asm:             Constraints.
  13106. * optimize options:                     Optimize Options.
  13107. * options to control warnings:          Warning Options.
  13108. * options, C++:                         C++ Dialect Options.
  13109. * options, code generation:             Code Gen Options.
  13110. * options, debugging:                   Debugging Options.
  13111. * options, dialect:                     C Dialect Options.
  13112. * options, directory search:            Directory Options.
  13113. * options, GNU CC command:              Invoking GCC.
  13114. * options, grouping:                    Invoking GCC.
  13115. * options, linking:                     Link Options.
  13116. * options, optimization:                Optimize Options.
  13117. * options, order:                       Invoking GCC.
  13118. * options, preprocessor:                Preprocessor Options.
  13119. * order of evaluation, side effects:    Non-bugs.
  13120. * order of options:                     Invoking GCC.
  13121. * other directory, compilation in:      Other Dir.
  13122. * output file option:                   Overall Options.
  13123. * overloaded virtual fn, warning:       Warning Options.
  13124. * parameter forward declaration:        Variable Length.
  13125. * parser generator, Bison:              Installation.
  13126. * PIC:                                  Code Gen Options.
  13127. * pointer arguments:                    Function Attributes.
  13128. * portions of temporary objects, pointers to: Temporaries.
  13129. * pragma, reason for not using:         Function Attributes.
  13130. * pragmas in C++, effect on inlining:   C++ Interface.
  13131. * pragmas, interface and implementation: C++ Interface.
  13132. * preprocessing numbers:                Incompatibilities.
  13133. * preprocessing tokens:                 Incompatibilities.
  13134. * preprocessor options:                 Preprocessor Options.
  13135. * processor selection (29k):            AMD29K Options.
  13136. * promotion of formal parameters:       Function Prototypes.
  13137. * push address instruction:             Simple Constraints.
  13138. * question mark:                        Multi-Alternative.
  13139. * r0-relative references (88k):         M88K Options.
  13140. * ranges in case statements:            Case Ranges.
  13141. * read-only strings:                    Incompatibilities.
  13142. * register positions in frame (88k):    M88K Options.
  13143. * register variable after longjmp:      Global Reg Vars.
  13144. * registers:                            Extended Asm.
  13145. * registers for local variables:        Local Reg Vars.
  13146. * registers in constraints:             Simple Constraints.
  13147. * registers, global allocation:         Explicit Reg Vars.
  13148. * registers, global variables in:       Global Reg Vars.
  13149. * reordering, warning:                  Warning Options.
  13150. * reporting bugs:                       Bugs.
  13151. * rest argument (in macro):             Macro Varargs.
  13152. * return value of main:                 VMS Misc.
  13153. * return value, named, in C++:          Naming Results.
  13154. * RS/6000 and PowerPC Options:          RS/6000 and PowerPC Options.
  13155. * RT options:                           RT Options.
  13156. * RT PC:                                Interoperation.
  13157. * run-time options:                     Code Gen Options.
  13158. * scope of a variable length array:     Variable Length.
  13159. * scope of declaration:                 Disappointments.
  13160. * scope of external declarations:       Incompatibilities.
  13161. * search path:                          Directory Options.
  13162. * second include path:                  Preprocessor Options.
  13163. * separate directory, compilation in:   Other Dir.
  13164. * sequential consistency on 88k:        M88K Options.
  13165. * setjmp:                               Global Reg Vars.
  13166. * shared strings:                       Incompatibilities.
  13167. * shared VMS run time system:           VMS Misc.
  13168. * side effect in ?::                    Conditionals.
  13169. * side effects, macro argument:         Statement Exprs.
  13170. * side effects, order of evaluation:    Non-bugs.
  13171. * signature:                            C++ Signatures.
  13172. * signature member function default implementation: C++ Signatures.
  13173. * signatures, C++:                      C++ Signatures.
  13174. * simple constraints:                   Simple Constraints.
  13175. * sin:                                  C Dialect Options.
  13176. * sizeof:                               Typeof.
  13177. * smaller data references (88k):        M88K Options.
  13178. * smaller data references (MIPS):       MIPS Options.
  13179. * SPARC options:                        SPARC Options.
  13180. * specified registers:                  Explicit Reg Vars.
  13181. * specifying compiler version and target machine: Target Options.
  13182. * specifying hardware config:           Submodel Options.
  13183. * specifying machine version:           Target Options.
  13184. * specifying registers for local variables: Local Reg Vars.
  13185. * sqrt:                                 C Dialect Options.
  13186. * stack checks (29k):                   AMD29K Options.
  13187. * stage1:                               Installation.
  13188. * start files:                          Tools and Libraries.
  13189. * statements inside expressions:        Statement Exprs.
  13190. * static data in C++, declaring and defining: Static Definitions.
  13191. * storem bug (29k):                     AMD29K Options.
  13192. * strcmp:                               C Dialect Options.
  13193. * strcpy:                               C Dialect Options.
  13194. * string constants:                     Incompatibilities.
  13195. * string constants vs newline:          C Dialect Options.
  13196. * strlen:                               C Dialect Options.
  13197. * structure passing (88k):              M88K Options.
  13198. * structures:                           Incompatibilities.
  13199. * structures, constructor expression:   Constructors.
  13200. * submodel options:                     Submodel Options.
  13201. * subscripting:                         Subscripting.
  13202. * subscripting and function values:     Subscripting.
  13203. * subtype polymorphism, C++:            C++ Signatures.
  13204. * suffixes for C++ source:              Invoking G++.
  13205. * Sun installation:                     Sun Install.
  13206. * suppressing warnings:                 Warning Options.
  13207. * surprises in C++:                     C++ Misunderstandings.
  13208. * SVr4:                                 M88K Options.
  13209. * syntax checking:                      Warning Options.
  13210. * synthesized methods, warning:         Warning Options.
  13211. * target machine, specifying:           Target Options.
  13212. * target options:                       Target Options.
  13213. * template debugging:                   Warning Options.
  13214. * template instantiation:               Template Instantiation.
  13215. * temporaries, lifetime of:             Temporaries.
  13216. * thunks:                               Nested Functions.
  13217. * TMPDIR:                               Environment Variables.
  13218. * traditional C language:               C Dialect Options.
  13219. * type abstraction, C++:                C++ Signatures.
  13220. * type alignment:                       Alignment.
  13221. * type attributes:                      Type Attributes.
  13222. * typedef names as function parameters: Incompatibilities.
  13223. * typeof:                               Typeof.
  13224. * Ultrix calling convention:            Interoperation.
  13225. * undefined behavior:                   Bug Criteria.
  13226. * undefined function value:             Bug Criteria.
  13227. * underscores in variables in macros:   Naming Types.
  13228. * underscores, avoiding (88k):          M88K Options.
  13229. * union, casting to a:                  Cast to Union.
  13230. * unions:                               Incompatibilities.
  13231. * unresolved references and -nodefaultlibs: Link Options.
  13232. * unresolved references and -nostdlib:  Link Options.
  13233. * value after longjmp:                  Global Reg Vars.
  13234. * variable alignment:                   Alignment.
  13235. * variable attributes:                  Variable Attributes.
  13236. * variable number of arguments:         Macro Varargs.
  13237. * variable-length array scope:          Variable Length.
  13238. * variable-length arrays:               Variable Length.
  13239. * variables in specified registers:     Explicit Reg Vars.
  13240. * variables, local, in macros:          Naming Types.
  13241. * Vax calling convention:               Interoperation.
  13242. * VAX options:                          VAX Options.
  13243. * VMS and case sensitivity:             VMS Misc.
  13244. * VMS and include files:                Include Files and VMS.
  13245. * VMS installation:                     VMS Install.
  13246. * void pointers, arithmetic:            Pointer Arith.
  13247. * void, size of pointer to:             Pointer Arith.
  13248. * warning for enumeration conversions:  Warning Options.
  13249. * warning for overloaded virtual fn:    Warning Options.
  13250. * warning for reordering of member initializers: Warning Options.
  13251. * warning for synthesized methods:      Warning Options.
  13252. * warning messages:                     Warning Options.
  13253. * warnings vs errors:                   Warnings and Errors.
  13254. * whitespace:                           Incompatibilities.
  13255. * zero division on 88k:                 M88K Options.
  13256. * zero-length arrays:                   Zero Length.
  13257. * __builtin_apply:                      Constructing Calls.
  13258. * __builtin_apply_args:                 Constructing Calls.
  13259. * __builtin_return:                     Constructing Calls.
  13260. * __main:                               Collect2.
  13261.  
  13262.  
  13263. 
  13264. Tag Table:
  13265. Node: Top1373
  13266. Node: Copying2523
  13267. Node: Contributors21714
  13268. Node: Funding26869
  13269. Node: Look and Feel29375
  13270. Node: G++ and GCC36750
  13271. Node: Invoking GCC38976
  13272. Node: Option Summary42364
  13273. Node: Overall Options52824
  13274. Node: Invoking G++57396
  13275. Node: C Dialect Options59279
  13276. Node: C++ Dialect Options69388
  13277. Node: Warning Options80133
  13278. Node: Debugging Options95077
  13279. Node: Optimize Options104667
  13280. Node: Preprocessor Options115207
  13281. Node: Assembler Options121679
  13282. Node: Link Options122055
  13283. Node: Directory Options127257
  13284. Node: Target Options130758
  13285. Node: Submodel Options134424
  13286. Node: M680x0 Options135623
  13287. Node: VAX Options139141
  13288. Node: SPARC Options139685
  13289. Node: Convex Options146114
  13290. Node: AMD29K Options148304
  13291. Node: ARM Options151344
  13292. Node: M88K Options152770
  13293. Node: RS/6000 and PowerPC Options160726
  13294. Node: RT Options171645
  13295. Node: MIPS Options173358
  13296. Node: i386 Options180802
  13297. Node: HPPA Options186250
  13298. Node: Intel 960 Options189355
  13299. Node: DEC Alpha Options191974
  13300. Node: Clipper Options193655
  13301. Node: H8/300 Options194063
  13302. Node: System V Options194517
  13303. Node: Code Gen Options195212
  13304. Node: Environment Variables203730
  13305. Node: Running Protoize207945
  13306. Node: Installation214183
  13307. Node: Configurations234934
  13308. Node: Other Dir270854
  13309. Node: Cross-Compiler272579
  13310. Node: Steps of Cross274419
  13311. Node: Configure Cross275546
  13312. Node: Tools and Libraries276192
  13313. Node: Cross Runtime278644
  13314. Node: Cross Headers282734
  13315. Node: Build Cross284728
  13316. Node: Sun Install286613
  13317. Node: VMS Install287754
  13318. Node: Collect2297692
  13319. Node: Header Dirs300410
  13320. Node: C Extensions301833
  13321. Node: Statement Exprs305174
  13322. Node: Local Labels307077
  13323. Node: Labels as Values309148
  13324. Node: Nested Functions311022
  13325. Node: Constructing Calls314887
  13326. Node: Naming Types316953
  13327. Node: Typeof318056
  13328. Node: Lvalues319930
  13329. Node: Conditionals322379
  13330. Node: Long Long323279
  13331. Node: Complex324732
  13332. Node: Zero Length326603
  13333. Node: Variable Length327286
  13334. Node: Macro Varargs329820
  13335. Node: Subscripting331932
  13336. Node: Pointer Arith332424
  13337. Node: Initializers332998
  13338. Node: Constructors333472
  13339. Node: Labeled Elements335175
  13340. Node: Case Ranges337813
  13341. Node: Cast to Union338503
  13342. Node: Function Attributes339590
  13343. Node: Function Prototypes348862
  13344. Node: C++ Comments350670
  13345. Node: Dollar Signs351215
  13346. Node: Character Escapes352004
  13347. Node: Alignment352294
  13348. Node: Variable Attributes353775
  13349. Node: Type Attributes361692
  13350. Node: Inline368220
  13351. Node: Extended Asm372106
  13352. Node: Constraints382648
  13353. Node: Simple Constraints383500
  13354. Node: Multi-Alternative389426
  13355. Node: Modifiers391146
  13356. Node: Machine Constraints392884
  13357. Node: Asm Labels401518
  13358. Node: Explicit Reg Vars402845
  13359. Node: Global Reg Vars404102
  13360. Node: Local Reg Vars408676
  13361. Node: Alternate Keywords410277
  13362. Node: Incomplete Enums411688
  13363. Node: Function Names412453
  13364. Node: C++ Extensions413713
  13365. Node: Naming Results414959
  13366. Node: Min and Max418282
  13367. Node: Destructors and Goto419741
  13368. Node: C++ Interface420300
  13369. Node: Template Instantiation425532
  13370. Node: C++ Signatures431273
  13371. Node: Trouble435626
  13372. Node: Actual Bugs437346
  13373. Node: Installation Problems438624
  13374. Node: Cross-Compiler Problems452419
  13375. Node: Interoperation453957
  13376. Node: External Bugs467330
  13377. Node: Incompatibilities469471
  13378. Node: Fixed Headers478030
  13379. Node: Standard Libraries480381
  13380. Node: Disappointments481637
  13381. Node: C++ Misunderstandings485871
  13382. Node: Static Definitions486527
  13383. Node: Temporaries487590
  13384. Node: Protoize Caveats489803
  13385. Node: Non-bugs493768
  13386. Node: Warnings and Errors502737
  13387. Node: Bugs504516
  13388. Node: Bug Criteria505885
  13389. Node: Bug Lists508324
  13390. Node: Bug Reporting509726
  13391. Node: Sending Patches522153
  13392. Node: Service527549
  13393. Node: VMS528119
  13394. Node: Include Files and VMS528515
  13395. Node: Global Declarations532414
  13396. Node: VMS Misc536732
  13397. Node: Index541067
  13398. 
  13399. End Tag Table
  13400.