home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD1.bin / gnu / info / gcc.info-10 (.txt) < prev    next >
GNU Info File  |  1994-12-22  |  42KB  |  729 lines

  1. This is Info file gcc.info, produced by Makeinfo-1.55 from the input
  2. file gcc.texi.
  3.    This file documents the use and the internals of the GNU compiler.
  4.    Published by the Free Software Foundation 675 Massachusetts Avenue
  5. Cambridge, MA 02139 USA
  6.    Copyright (C) 1988, 1989, 1992, 1993, 1994 Free Software Foundation,
  7.    Permission is granted to make and distribute verbatim copies of this
  8. manual provided the copyright notice and this permission notice are
  9. preserved on all copies.
  10.    Permission is granted to copy and distribute modified versions of
  11. this manual under the conditions for verbatim copying, provided also
  12. that the sections entitled "GNU General Public License," "Funding for
  13. Free Software," and "Protect Your Freedom--Fight `Look And Feel'" are
  14. included exactly as in the original, and provided that the entire
  15. resulting derived work is distributed under the terms of a permission
  16. notice identical to this one.
  17.    Permission is granted to copy and distribute translations of this
  18. manual into another language, under the above conditions for modified
  19. versions, except that the sections entitled "GNU General Public
  20. License," "Funding for Free Software," and "Protect Your Freedom--Fight
  21. `Look And Feel'", and this permission notice, may be included in
  22. translations approved by the Free Software Foundation instead of in the
  23. original English.
  24. File: gcc.info,  Node: External Bugs,  Next: Incompatibilities,  Prev: Interoperation,  Up: Trouble
  25. Problems Compiling Certain Programs
  26. ===================================
  27.    Certain programs have problems compiling.
  28.    * Parse errors may occur compiling X11 on a Decstation running
  29.      Ultrix 4.2 because of problems in DEC's versions of the X11 header
  30.      files `X11/Xlib.h' and `X11/Xutil.h'.  People recommend adding
  31.      `-I/usr/include/mit' to use the MIT versions of the header files,
  32.      using the `-traditional' switch to turn off ANSI C, or fixing the
  33.      header files by adding this:
  34.           #ifdef __STDC__
  35.           #define NeedFunctionPrototypes 0
  36.           #endif
  37.    * If you have trouble compiling Perl on a SunOS 4 system, it may be
  38.      because Perl specifies `-I/usr/ucbinclude'.  This accesses the
  39.      unfixed header files.  Perl specifies the options
  40.           -traditional -Dvolatile=__volatile__
  41.           -I/usr/include/sun -I/usr/ucbinclude
  42.           -fpcc-struct-return
  43.      most of which are unnecessary with GCC 2.4.5 and newer versions.
  44.      You can make a properly working Perl by setting `ccflags' to
  45.      `-fwritable-strings' (implied by the `-traditional' in the
  46.      original options) and `cppflags' to empty in `config.sh', then
  47.      typing `./doSH; make depend; make'.
  48.    * On various 386 Unix systems derived from System V, including SCO,
  49.      ISC, and ESIX, you may get error messages about running out of
  50.      virtual memory while compiling certain programs.
  51.      You can prevent this problem by linking GNU CC with the GNU malloc
  52.      (which thus replaces the malloc that comes with the system).  GNU
  53.      malloc is available as a separate package, and also in the file
  54.      `src/gmalloc.c' in the GNU Emacs 19 distribution.
  55.      If you have installed GNU malloc as a separate library package,
  56.      use this option when you relink GNU CC:
  57.           MALLOC=/usr/local/lib/libgmalloc.a
  58.      Alternatively, if you have compiled `gmalloc.c' from Emacs 19, copy
  59.      the object file to `gmalloc.o' and use this option when you relink
  60.      GNU CC:
  61.           MALLOC=gmalloc.o
  62. File: gcc.info,  Node: Incompatibilities,  Next: Fixed Headers,  Prev: External Bugs,  Up: Trouble
  63. Incompatibilities of GNU CC
  64. ===========================
  65.    There are several noteworthy incompatibilities between GNU C and most
  66. existing (non-ANSI) versions of C.  The `-traditional' option
  67. eliminates many of these incompatibilities, *but not all*, by telling
  68. GNU C to behave like the other C compilers.
  69.    * GNU CC normally makes string constants read-only.  If several
  70.      identical-looking string constants are used, GNU CC stores only one
  71.      copy of the string.
  72.      One consequence is that you cannot call `mktemp' with a string
  73.      constant argument.  The function `mktemp' always alters the string
  74.      its argument points to.
  75.      Another consequence is that `sscanf' does not work on some systems
  76.      when passed a string constant as its format control string or
  77.      input.  This is because `sscanf' incorrectly tries to write into
  78.      the string constant.  Likewise `fscanf' and `scanf'.
  79.      The best solution to these problems is to change the program to use
  80.      `char'-array variables with initialization strings for these
  81.      purposes instead of string constants.  But if this is not possible,
  82.      you can use the `-fwritable-strings' flag, which directs GNU CC to
  83.      handle string constants the same way most C compilers do.
  84.      `-traditional' also has this effect, among others.
  85.    * `-2147483648' is positive.
  86.      This is because 2147483648 cannot fit in the type `int', so
  87.      (following the ANSI C rules) its data type is `unsigned long int'.
  88.      Negating this value yields 2147483648 again.
  89.    * GNU CC does not substitute macro arguments when they appear inside
  90.      of string constants.  For example, the following macro in GNU CC
  91.           #define foo(a) "a"
  92.      will produce output `"a"' regardless of what the argument A is.
  93.      The `-traditional' option directs GNU CC to handle such cases
  94.      (among others) in the old-fashioned (non-ANSI) fashion.
  95.    * When you use `setjmp' and `longjmp', the only automatic variables
  96.      guaranteed to remain valid are those declared `volatile'.  This is
  97.      a consequence of automatic register allocation.  Consider this
  98.      function:
  99.           jmp_buf j;
  100.           
  101.           foo ()
  102.           {
  103.             int a, b;
  104.           
  105.             a = fun1 ();
  106.             if (setjmp (j))
  107.               return a;
  108.           
  109.             a = fun2 ();
  110.             /* `longjmp (j)' may occur in `fun3'. */
  111.             return a + fun3 ();
  112.           }
  113.      Here `a' may or may not be restored to its first value when the
  114.      `longjmp' occurs.  If `a' is allocated in a register, then its
  115.      first value is restored; otherwise, it keeps the last value stored
  116.      in it.
  117.      If you use the `-W' option with the `-O' option, you will get a
  118.      warning when GNU CC thinks such a problem might be possible.
  119.      The `-traditional' option directs GNU C to put variables in the
  120.      stack by default, rather than in registers, in functions that call
  121.      `setjmp'.  This results in the behavior found in traditional C
  122.      compilers.
  123.    * Programs that use preprocessor directives in the middle of macro
  124.      arguments do not work with GNU CC.  For example, a program like
  125.      this will not work:
  126.           foobar (
  127.           #define luser
  128.                   hack)
  129.      ANSI C does not permit such a construct.  It would make sense to
  130.      support it when `-traditional' is used, but it is too much work to
  131.      implement.
  132.    * Declarations of external variables and functions within a block
  133.      apply only to the block containing the declaration.  In other
  134.      words, they have the same scope as any other declaration in the
  135.      same place.
  136.      In some other C compilers, a `extern' declaration affects all the
  137.      rest of the file even if it happens within a block.
  138.      The `-traditional' option directs GNU C to treat all `extern'
  139.      declarations as global, like traditional compilers.
  140.    * In traditional C, you can combine `long', etc., with a typedef
  141.      name, as shown here:
  142.           typedef int foo;
  143.           typedef long foo bar;
  144.      In ANSI C, this is not allowed: `long' and other type modifiers
  145.      require an explicit `int'.  Because this criterion is expressed by
  146.      Bison grammar rules rather than C code, the `-traditional' flag
  147.      cannot alter it.
  148.    * PCC allows typedef names to be used as function parameters.  The
  149.      difficulty described immediately above applies here too.
  150.    * PCC allows whitespace in the middle of compound assignment
  151.      operators such as `+='.  GNU CC, following the ANSI standard, does
  152.      not allow this.  The difficulty described immediately above
  153.      applies here too.
  154.    * GN