OSDN Git Service

(__objc_send_message_in_list): When setting a new entry in
[pf3gnuchains/gcc-fork.git] / gcc / extend.texi
index 6d310ae..f28e079 100644 (file)
@@ -1,4 +1,4 @@
-@c Copyright (C) 1988,89,92,93,94,96,98,99,2000 Free Software Foundation, Inc.
+@c Copyright (C) 1988,1989,1992,1993,1994,1996,1998,1999,2000,2001 Free Software Foundation, Inc.
 @c This is part of the GCC manual.
 @c For copying conditions, see the file gcc.texi.
 
@@ -7,7 +7,7 @@
 @cindex extensions, C language
 @cindex C language extensions
 
-GNU C provides several language features not found in ANSI standard C.
+GNU C provides several language features not found in ISO standard C.
 (The @samp{-pedantic} option directs GNU CC to print a warning message if
 any of these features is used.)  To test for the availability of these
 features in conditional compilation, check for a predefined macro
@@ -17,6 +17,9 @@ These extensions are available in C and Objective C.  Most of them are
 also available in C++.  @xref{C++ Extensions,,Extensions to the
 C++ Language}, for extensions that apply @emph{only} to C++.
 
+Some features that are in ISO C99 but not C89 or C++ are also, as
+extensions, accepted by GCC in C89 mode and in C++.
+
 @c The only difference between the two versions of this menu is that the
 @c version for clear INTERNALS has an extra node, "Constraints" (which
 @c appears in a separate chapter in the other version of the manual).
@@ -36,17 +39,21 @@ C++ Language}, for extensions that apply @emph{only} to C++.
 * Hex Floats::          Hexadecimal floating-point constants.
 * Zero Length::         Zero-length arrays.
 * Variable Length::     Arrays whose length is computed at run time.
-* Macro Varargs::      Macros with variable number of arguments.
+* Variadic Macros::    Macros with a variable number of arguments.
+* Escaped Newlines::    Slightly looser rules for escaped newlines.
+* Multi-line Strings::  String literals with embedded newlines.
 * Subscripting::        Any array can be subscripted, even if not an lvalue.
 * Pointer Arith::       Arithmetic on @code{void}-pointers and function pointers.
 * Initializers::        Non-constant initializers.
-* Constructors::        Constructor expressions give structures, unions
+* Compound Literals::   Compound literals give structures, unions
                          or arrays as values.
-* Labeled Elements::   Labeling elements of initializers.
+* Designated Inits::   Labeling elements of initializers.
 * Cast to Union::       Casting to union type from any member of the union.
 * Case Ranges::                `case 1 ... 9' and such.
+* Mixed Declarations:: Mixing declarations and code.
 * Function Attributes:: Declaring that functions have no side effects,
                          or that they can never return.
+* Attribute Syntax::    Formal syntax for attributes.
 * Function Prototypes:: Prototype declarations and old-style definitions.
 * C++ Comments::        C++ comments are recognized.
 * Dollar Signs::        Dollar sign is allowed in identifiers.
@@ -65,7 +72,6 @@ C++ Language}, for extensions that apply @emph{only} to C++.
                         function.
 * Return Address::      Getting the return or frame address of a function.
 * Other Builtins::      Other built-in functions.
-* Deprecated Features:: Things might disappear from g++.
 @end menu
 @end ifset
 @ifclear INTERNALS
@@ -84,17 +90,21 @@ C++ Language}, for extensions that apply @emph{only} to C++.
 * Hex Floats::          Hexadecimal floating-point constants.
 * Zero Length::         Zero-length arrays.
 * Variable Length::     Arrays whose length is computed at run time.
-* Macro Varargs::      Macros with variable number of arguments.
+* Variadic Macros::    Macros with a variable number of arguments.
+* Escaped Newlines::    Slightly looser rules for escaped newlines.
+* Multi-line Strings::  String literals with embedded newlines.
 * Subscripting::        Any array can be subscripted, even if not an lvalue.
 * Pointer Arith::       Arithmetic on @code{void}-pointers and function pointers.
 * Initializers::        Non-constant initializers.
-* Constructors::        Constructor expressions give structures, unions
+* Compound Literals::   Compound literals give structures, unions
                          or arrays as values.
-* Labeled Elements::   Labeling elements of initializers.
+* Designated Inits::   Labeling elements of initializers.
 * Cast to Union::       Casting to union type from any member of the union.
 * Case Ranges::                `case 1 ... 9' and such.
+* Mixed Declarations:: Mixing declarations and code.
 * Function Attributes:: Declaring that functions have no side effects,
                          or that they can never return.
+* Attribute Syntax::    Formal syntax for attributes.
 * Function Prototypes:: Prototype declarations and old-style definitions.
 * C++ Comments::        C++ comments are recognized.
 * Dollar Signs::        Dollar sign is allowed in identifiers.
@@ -113,7 +123,6 @@ C++ Language}, for extensions that apply @emph{only} to C++.
 * Function Names::     Printable strings which are the name of the current
                         function.
 * Return Address::      Getting the return or frame address of a function.
-* Deprecated Features:: Things might disappear from g++.
 * Other Builtins::      Other built-in functions.
 @end menu
 @end ifclear
@@ -182,6 +191,39 @@ If you don't know the type of the operand, you can still do this, but you
 must use @code{typeof} (@pxref{Typeof}) or type naming (@pxref{Naming
 Types}).
 
+Statement expressions are not supported fully in G++, and their fate
+there is unclear.  (It is possible that they will become fully supported
+at some point, or that they will be deprecated, or that the bugs that
+are present will continue to exist indefinitely.)  Presently, statement
+expressions do not work well as default arguments.
+
+In addition, there are semantic issues with statement-expressions in
+C++.  If you try to use statement-expressions instead of inline
+functions in C++, you may be surprised at the way object destruction is
+handled.  For example:
+
+@example
+#define foo(a)  (@{int b = (a); b + 3; @})
+@end example
+
+@noindent
+does not work the same way as:
+
+@example
+inline int foo(int a) @{ int b = a; return b + 3; @}
+@end example
+
+@noindent
+In particular, if the expression passed into @code{foo} involves the
+creation of temporaries, the destructors for those temporaries will be
+run earlier in the case of the macro than in the case of the function.
+
+These considerations mean that it is probably a bad idea to use
+statement-expressions of this form in header files that are designed to
+work with C++.  (Note that some versions of the GNU C Library contained
+header files using statement-expression that lead to precisely this
+bug.)
+
 @node Local Labels
 @section Locally Declared Labels
 @cindex local labels
@@ -296,7 +338,7 @@ Another use of label values is in an interpreter for threaded code.
 The labels within the interpreter function can be stored in the
 threaded code for super-fast dispatching.
 
-You may not use this mechanism to jump to code in a different function. 
+You may not use this mechanism to jump to code in a different function.
 If you do that, totally unpredictable things will happen.  The best way to
 avoid this is to store the label address only in automatic variables and
 never pass it as an argument.
@@ -385,7 +427,7 @@ safe.
 
 GNU CC implements taking the address of a nested function using a
 technique called @dfn{trampolines}.   A paper describing them is
-available as @samp{http://master.debian.org/~karlheg/Usenix88-lexic.pdf}.
+available as @uref{http://people.debian.org/~karlheg/Usenix88-lexic.pdf}.
 
 A nested function can jump to a label inherited from a containing
 function, provided the label was explicitly declared in the containing
@@ -547,8 +589,8 @@ typeof (x[0](1))
 @end example
 
 @noindent
-This assumes that @code{x} is an array of functions; the type described
-is that of the values of the functions.
+This assumes that @code{x} is an array of pointers to functions;
+the type described is that of the values of the functions.
 
 Here is an example with a typename as the argument:
 
@@ -559,7 +601,7 @@ typeof (int *)
 @noindent
 Here the type described is that of pointers to @code{int}.
 
-If you are writing a header file that must work when included in ANSI C
+If you are writing a header file that must work when included in ISO C
 programs, write @code{__typeof__} instead of @code{typeof}.
 @xref{Alternate Keywords}.
 
@@ -744,9 +786,12 @@ effects of recomputing it.
 @cindex @code{long long} data types
 @cindex double-word arithmetic
 @cindex multiprecision arithmetic
+@cindex @code{LL} integer suffix
+@cindex @code{ULL} integer suffix
 
-GNU C supports data types for integers that are twice as long as
-@code{int}.  Simply write @code{long long int} for a signed integer, or
+ISO C99 supports data types for integers that are at least 64 bits wide,
+and as an extension GCC supports them in C89 mode and in C++.
+Simply write @code{long long int} for a signed integer, or
 @code{unsigned long long int} for an unsigned integer.  To make an
 integer constant of type @code{long long int}, add the suffix @code{LL}
 to the integer.  To make an integer constant of type @code{unsigned long
@@ -771,30 +816,48 @@ Likewise, if the function expects @code{long long int} and you pass
 @node Complex
 @section Complex Numbers
 @cindex complex numbers
+@cindex @code{_Complex} keyword
+@cindex @code{__complex__} keyword
 
-GNU C supports complex data types.  You can declare both complex integer
-types and complex floating types, using the keyword @code{__complex__}.
+ISO C99 supports complex floating data types, and as an extension GCC
+supports them in C89 mode and in C++, and supports complex integer data
+types which are not part of ISO C99.  You can declare complex types
+using the keyword @code{_Complex}.  As an extension, the older GNU
+keyword @code{__complex__} is also supported.
 
-For example, @samp{__complex__ double x;} declares @code{x} as a
+For example, @samp{_Complex double x;} declares @code{x} as a
 variable whose real part and imaginary part are both of type
-@code{double}.  @samp{__complex__ short int y;} declares @code{y} to
+@code{double}.  @samp{_Complex short int y;} declares @code{y} to
 have real and imaginary parts of type @code{short int}; this is not
 likely to be useful, but it shows that the set of complex types is
 complete.
 
 To write a constant with a complex data type, use the suffix @samp{i} or
 @samp{j} (either one; they are equivalent).  For example, @code{2.5fi}
-has type @code{__complex__ float} and @code{3i} has type
-@code{__complex__ int}.  Such a constant always has a pure imaginary
+has type @code{_Complex float} and @code{3i} has type
+@code{_Complex int}.  Such a constant always has a pure imaginary
 value, but you can form any complex value you like by adding one to a
-real constant.
+real constant.  This is a GNU extension; if you have an ISO C99
+conforming C library (such as GNU libc), and want to construct complex
+constants of floating type, you should include @code{<complex.h>} and
+use the macros @code{I} or @code{_Complex_I} instead.
 
+@cindex @code{__real__} keyword
+@cindex @code{__imag__} keyword
 To extract the real part of a complex-valued expression @var{exp}, write
 @code{__real__ @var{exp}}.  Likewise, use @code{__imag__} to
-extract the imaginary part.
+extract the imaginary part.  This is a GNU extension; for values of
+floating type, you should use the ISO C99 functions @code{crealf},
+@code{creal}, @code{creall}, @code{cimagf}, @code{cimag} and
+@code{cimagl}, declared in @code{<complex.h>} and also provided as
+builtin functions by GCC.
 
+@cindex complex conjugation
 The operator @samp{~} performs complex conjugation when used on a value
-with a complex type.
+with a complex type.  This is a GNU extension; for values of
+floating type, you should use the ISO C99 functions @code{conjf},
+@code{conj} and @code{conjl}, declared in @code{<complex.h>} and also
+provided as builtin functions by GCC.
 
 GNU CC can allocate complex automatic variables in a noncontiguous
 fashion; it's even possible for the real part to be in a register while
@@ -813,12 +876,14 @@ them as a single variable with a complex type.
 @section Hex Floats
 @cindex hex floats
 
-GNU CC recognizes floating-point numbers writen not only in the usual
+ISO C99 supports floating-point numbers written not only in the usual
 decimal notation, such as @code{1.55e1}, but also numbers such as
-@code{0x1.fp3} written in hexadecimal format.  In that format the
+@code{0x1.fp3} written in hexadecimal format.  As a GNU extension, GCC
+supports this in C89 mode (except in some cases when strictly
+conforming) and in C++.  In that format the
 @code{0x} hex introducer and the @code{p} or @code{P} exponent field are
 mandatory.  The exponent is a decimal number that indicates the power of
-2 by which the significand part will be multiplied.  Thus @code{0x1.f} is
+2 by which the significant part will be multiplied.  Thus @code{0x1.f} is
 1 15/16, @code{p3} multiplies it by 8, and the value of @code{0x1.fp3}
 is the same as @code{1.55e1}.
 
@@ -833,9 +898,10 @@ extension for floating-point constants of type @code{float}.
 @cindex arrays of length zero
 @cindex zero-length arrays
 @cindex length-zero arrays
+@cindex flexible array members
 
-Zero-length arrays are allowed in GNU C.  They are very useful as the last
-element of a structure which is really a header for a variable-length
+Zero-length arrays are allowed in GNU C.  They are very useful as the
+last element of a structure which is really a header for a variable-length
 object:
 
 @example
@@ -844,22 +910,91 @@ struct line @{
   char contents[0];
 @};
 
-@{
-  struct line *thisline = (struct line *)
-    malloc (sizeof (struct line) + this_length);
-  thisline->length = this_length;
-@}
+struct line *thisline = (struct line *)
+  malloc (sizeof (struct line) + this_length);
+thisline->length = this_length;
 @end example
 
-In standard C, you would have to give @code{contents} a length of 1, which
+In ISO C89, you would have to give @code{contents} a length of 1, which
 means either you waste space or complicate the argument to @code{malloc}.
 
+In ISO C99, you would use a @dfn{flexible array member}, which is
+slightly different in syntax and semantics:
+
+@itemize @bullet
+@item
+Flexible array members are written as @code{contents[]} without
+the @code{0}.
+
+@item
+Flexible array members have incomplete type, and so the @code{sizeof}
+operator may not be applied.  As a quirk of the original implementation
+of zero-length arrays, @code{sizeof} evaluates to zero.
+
+@item
+Flexible array members may only appear as the last member of a
+@code{struct} that is otherwise non-empty.  GCC currently allows
+zero-length arrays anywhere.  You may encounter problems, however,
+defining structures containing only a zero-length array.  Such usage
+is deprecated, and we recommend using zero-length arrays only in
+places in which flexible array members would be allowed.
+@end itemize
+
+GCC versions before 3.0 allowed zero-length arrays to be statically
+initialized.  In addition to those cases that were useful, it also
+allowed initializations in situations that would corrupt later data.
+Non-empty initialization of zero-length arrays is now deprecated.
+
+Instead GCC allows static initialization of flexible array members.
+This is equivalent to defining a new structure containing the original
+structure followed by an array of sufficient size to contain the data.
+I.e. in the following, @code{f1} is constructed as if it were declared
+like @code{f2}.
+
+@example
+struct f1 @{
+  int x; int y[];
+@} f1 = @{ 1, @{ 2, 3, 4 @} @};
+
+struct f2 @{
+  struct f1 f1; int data[3];
+@} f2 = @{ @{ 1 @}, @{ 2, 3, 4 @} @};
+@end example
+
+@noindent
+The convenience of this extension is that @code{f1} has the desired
+type, eliminating the need to consistently refer to @code{f2.f1}.
+
+This has symmetry with normal static arrays, in that an array of
+unknown size is also written with @code{[]}.
+
+Of course, this extension only makes sense if the extra data comes at
+the end of a top-level object, as otherwise we would be overwriting
+data at subsequent offsets.  To avoid undue complication and confusion
+with initialization of deeply nested arrays, we simply disallow any
+non-empty initialization except when the structure is the top-level
+object.  For example:
+
+@example
+struct foo @{ int x; int y[]; @};
+struct bar @{ struct foo z; @};
+
+struct foo a = @{ 1, @{ 2, 3, 4 @} @};        // Legal.
+struct bar b = @{ @{ 1, @{ 2, 3, 4 @} @} @};    // Illegal.
+struct bar c = @{ @{ 1, @{ @} @} @};            // Legal.
+struct foo d[1] = @{ @{ 1 @{ 2, 3, 4 @} @} @};  // Illegal.
+@end example
+
 @node Variable Length
 @section Arrays of Variable Length
 @cindex variable-length arrays
 @cindex arrays of variable length
+@cindex VLAs
 
-Variable-length automatic arrays are allowed in GNU C.  These arrays are
+Variable-length automatic arrays are allowed in ISO C99, and as an
+extension GCC accepts them in C89 mode and in C++.  (However, GCC's
+implementation of variable-length arrays does not yet conform in detail
+to the ISO C99 standard.)  These arrays are
 declared like any other automatic arrays, but with a length that is not
 a constant expression.  The storage is allocated at the point of
 declaration and deallocated when the brace-level is exited.  For
@@ -930,68 +1065,101 @@ You can write any number of such parameter forward declarations in the
 parameter list.  They can be separated by commas or semicolons, but the
 last one must end with a semicolon, which is followed by the ``real''
 parameter declarations.  Each forward declaration must match a ``real''
-declaration in parameter name and data type.
+declaration in parameter name and data type.  ISO C99 does not support
+parameter forward declarations.
 
-@node Macro Varargs
-@section Macros with Variable Numbers of Arguments
+@node Variadic Macros
+@section Macros with a Variable Number of Arguments.
 @cindex variable number of arguments
 @cindex macro with variable arguments
 @cindex rest argument (in macro)
+@cindex variadic macros
 
-In GNU C, a macro can accept a variable number of arguments, much as a
-function can.  The syntax for defining the macro looks much like that
-used for a function.  Here is an example:
+In the ISO C standard of 1999, a macro can be declared to accept a
+variable number of arguments much as a function can.  The syntax for
+defining the macro is similar to that of a function.  Here is an
+example:
 
 @example
-#define eprintf(format, args...)  \
- fprintf (stderr, format , ## args)
+#define debug(format, ...) fprintf (stderr, format, __VA_ARGS__)
 @end example
 
-Here @code{args} is a @dfn{rest argument}: it takes in zero or more
-arguments, as many as the call contains.  All of them plus the commas
-between them form the value of @code{args}, which is substituted into
-the macro body where @code{args} is used.  Thus, we have this expansion:
+Here @samp{@dots{}} is a @dfn{variable argument}.  In the invocation of
+such a macro, it represents the zero or more tokens until the closing
+parenthesis that ends the invocation, including any commas.  This set of
+tokens replaces the identifier @code{__VA_ARGS__} in the macro body
+wherever it appears.  See the CPP manual for more information.
+
+GCC has long supported variadic macros, and used a different syntax that
+allowed you to give a name to the variable arguments just like any other
+argument.  Here is an example:
 
 @example
-eprintf ("%s:%d: ", input_file_name, line_number)
-@expansion{}
-fprintf (stderr, "%s:%d: " , input_file_name, line_number)
+#define debug(format, args...) fprintf (stderr, format, args)
 @end example
 
-@noindent
-Note that the comma after the string constant comes from the definition
-of @code{eprintf}, whereas the last comma comes from the value of
-@code{args}.
+This is in all ways equivalent to the ISO C example above, but arguably
+more readable and descriptive.
 
-The reason for using @samp{##} is to handle the case when @code{args}
-matches no arguments at all.  In this case, @code{args} has an empty
-value.  In this case, the second comma in the definition becomes an
-embarrassment: if it got through to the expansion of the macro, we would
-get something like this:
+GNU CPP has two further variadic macro extensions, and permits them to
+be used with either of the above forms of macro definition.
+
+In standard C, you are not allowed to leave the variable argument out
+entirely; but you are allowed to pass an empty argument.  For example,
+this invocation is invalid in ISO C, because there is no comma after
+the string:
 
 @example
-fprintf (stderr, "success!\n" , )
+debug ("A message")
 @end example
 
-@noindent
-which is invalid C syntax.  @samp{##} gets rid of the comma, so we get
-the following instead:
+GNU CPP permits you to completely omit the variable arguments in this
+way.  In the above examples, the compiler would complain, though since
+the expansion of the macro still has the extra comma after the format
+string.
+
+To help solve this problem, CPP behaves specially for variable arguments
+used with the token paste operator, @samp{##}.  If instead you write
 
 @example
-fprintf (stderr, "success!\n")
+#define debug(format, ...) fprintf (stderr, format, ## __VA_ARGS__)
 @end example
 
-This is a special feature of the GNU C preprocessor: @samp{##} before a
-rest argument that is empty discards the preceding sequence of
-non-whitespace characters from the macro definition.  (If another macro
-argument precedes, none of it is discarded.)
-
-It might be better to discard the last preprocessor token instead of the
-last preceding sequence of non-whitespace characters; in fact, we may
-someday change this feature to do so.  We advise you to write the macro
-definition so that the preceding sequence of non-whitespace characters
-is just a single token, so that the meaning will not change if we change
-the definition of this feature.
+and if the variable arguments are omitted or empty, the @samp{##}
+operator causes the preprocessor to remove the comma before it.  If you
+do provide some variable arguments in your macro invocation, GNU CPP
+does not complain about the paste operation and instead places the
+variable arguments after the comma.  Just like any other pasted macro
+argument, these arguments are not macro expanded.
+
+@node Escaped Newlines
+@section Slightly Looser Rules for Escaped Newlines
+@cindex escaped newlines
+@cindex newlines (escaped)
+
+Recently, the non-traditional preprocessor has relaxed its treatment of
+escaped newlines.  Previously, the newline had to immediately follow a
+backslash.  The current implementation allows whitespace in the form of
+spaces, horizontal and vertical tabs, and form feeds between the
+backslash and the subsequent newline.  The preprocessor issues a
+warning, but treats it as a valid escaped newline and combines the two
+lines to form a single logical line.  This works within comments and
+tokens, including multi-line strings, as well as between tokens.
+Comments are @emph{not} treated as whitespace for the purposes of this
+relaxation, since they have not yet been replaced with spaces.
+
+@node Multi-line Strings
+@section String Literals with Embedded Newlines
+@cindex multi-line string literals
+
+As an extension, GNU CPP permits string literals to cross multiple lines
+without escaping the embedded newlines.  Each embedded newline is
+replaced with a single @samp{\n} character in the resulting string
+literal, regardless of what form the newline took originally.
+
+CPP currently allows such strings in directives as well (other than the
+@samp{#include} family).  This is deprecated and will eventually be
+removed.
 
 @node Subscripting
 @section Non-Lvalue Arrays May Have Subscripts
@@ -1000,8 +1168,10 @@ the definition of this feature.
 
 @cindex subscripting and function values
 Subscripting is allowed on arrays that are not lvalues, even though the
-unary @samp{&} operator is not.  For example, this is valid in GNU C though
-not valid in other C dialects:
+unary @samp{&} operator is not.  (In ISO C99, both are allowed (though
+the array may not be used after the next sequence point), but this ISO
+C99 feature is not yet fully supported in GCC.)  For example,
+this is valid in GNU C though not valid in C89:
 
 @example
 @group
@@ -1038,7 +1208,7 @@ are used.
 @cindex initializers, non-constant
 @cindex non-constant initializers
 
-As in standard C++, the elements of an aggregate initializer for an
+As in standard C++ and ISO C99, the elements of an aggregate initializer for an
 automatic variable are not required to be constant expressions in GNU C.
 Here is an example of an initializer with run-time varying elements:
 
@@ -1050,17 +1220,21 @@ foo (float f, float g)
 @}
 @end example
 
-@node Constructors
-@section Constructor Expressions
+@node Compound Literals
+@section Compound Literals
 @cindex constructor expressions
 @cindex initializations in expressions
 @cindex structures, constructor expression
 @cindex expressions, constructor
+@cindex compound literals
+@c The GNU C name for what C99 calls compound literals was "constructor expressions".
 
-GNU C supports constructor expressions.  A constructor looks like
+ISO C99 supports compound literals.  A compound literal looks like
 a cast containing an initializer.  Its value is an object of the
 type specified in the cast, containing the elements specified in
-the initializer.
+the initializer.  (GCC does not yet implement the full ISO C99 semantics
+for compound literals.)  As an extension, GCC supports compound literals
+in C89 mode and in C++.
 
 Usually, the specified type is a structure.  Assume that
 @code{struct foo} and @code{structure} are declared as shown:
@@ -1070,7 +1244,7 @@ struct foo @{int a; char b[2];@} structure;
 @end example
 
 @noindent
-Here is an example of constructing a @code{struct foo} with a constructor:
+Here is an example of constructing a @code{struct foo} with a compound literal:
 
 @example
 structure = ((struct foo) @{x + y, 'a', 0@});
@@ -1086,50 +1260,55 @@ This is equivalent to writing the following:
 @}
 @end example
 
-You can also construct an array.  If all the elements of the constructor
+You can also construct an array.  If all the elements of the compound literal
 are (made up of) simple constant expressions, suitable for use in
-initializers, then the constructor is an lvalue and can be coerced to a
+initializers, then the compound literal is an lvalue and can be coerced to a
 pointer to its first element, as shown here:
 
 @example
 char **foo = (char *[]) @{ "x", "y", "z" @};
 @end example
 
-Array constructors whose elements are not simple constants are
-not very useful, because the constructor is not an lvalue.  There
-are only two valid ways to use it: to subscript it, or initialize
+Array compound literals whose elements are not simple constants are
+not very useful, because the compound literal is not an lvalue; ISO C99
+specifies that it is, being a temporary object with automatic storage
+duration associated with the enclosing block, but GCC does not yet
+implement this.  There are currently only two valid ways to use it with
+GCC: to subscript it, or initialize
 an array variable with it.  The former is probably slower than a
 @code{switch} statement, while the latter does the same thing an
 ordinary C initializer would do.  Here is an example of
-subscripting an array constructor:
+subscripting an array compound literal:
 
 @example
 output = ((int[]) @{ 2, x, 28 @}) [input];
 @end example
 
-Constructor expressions for scalar types and union types are is
-also allowed, but then the constructor expression is equivalent
+Compound literals for scalar types and union types are is
+also allowed, but then the compound literal is equivalent
 to a cast.
 
-@node Labeled Elements
-@section Labeled Elements in Initializers
+@node Designated Inits
+@section Designated Initializers
 @cindex initializers with labeled elements
 @cindex labeled elements in initializers
 @cindex case labels in initializers
+@cindex designated initializers
 
-Standard C requires the elements of an initializer to appear in a fixed
+Standard C89 requires the elements of an initializer to appear in a fixed
 order, the same as the order of the elements in the array or structure
 being initialized.
 
-In GNU C you can give the elements in any order, specifying the array
-indices or structure field names they apply to.  This extension is not
+In ISO C99 you can give the elements in any order, specifying the array
+indices or structure field names they apply to, and GNU C allows this as
+an extension in C89 mode as well.  This extension is not
 implemented in GNU C++.
 
-To specify an array index, write @samp{[@var{index}]} or
+To specify an array index, write
 @samp{[@var{index}] =} before the element value.  For example,
 
 @example
-int a[6] = @{ [4] 29, [2] = 15 @};
+int a[6] = @{ [4] 29, [2] = 15 @};
 @end example
 
 @noindent
@@ -1143,19 +1322,28 @@ int a[6] = @{ 0, 0, 15, 0, 29, 0 @};
 The index values must be constant expressions, even if the array being
 initialized is automatic.
 
+An alternative syntax for this which has been obsolete since GCC 2.5 but
+GCC still accepts is to write @samp{[@var{index}]} before the element
+value, with no @samp{=}.
+
 To initialize a range of elements to the same value, write
-@samp{[@var{first} ... @var{last}] = @var{value}}.  For example,
+@samp{[@var{first} ... @var{last}] = @var{value}}.  This is a GNU
+extension.  For example,
 
 @example
 int widths[] = @{ [0 ... 9] = 1, [10 ... 99] = 2, [100] = 3 @};
 @end example
 
 @noindent
+If the value in it has side-effects, the side-effects will happen only once,
+not for each initialized field by the range initializer.
+
+@noindent
 Note that the length of the array is the highest value specified
 plus one.
 
 In a structure initializer, specify the name of a field to initialize
-with @samp{@var{fieldname}:} before the element value.  For example,
+with @samp{.@var{fieldname} =} before the element value.  For example,
 given the following structure,
 
 @example
@@ -1166,7 +1354,7 @@ struct point @{ int x, y; @};
 the following initialization
 
 @example
-struct point p = @{ y: yvalue, x: xvalue @};
+struct point p = @{ .y = yvalue, .x = xvalue @};
 @end example
 
 @noindent
@@ -1176,21 +1364,23 @@ is equivalent to
 struct point p = @{ xvalue, yvalue @};
 @end example
 
-Another syntax which has the same meaning is @samp{.@var{fieldname} =}.,
-as shown here:
+Another syntax which has the same meaning, obsolete since GCC 2.5, is
+@samp{@var{fieldname}:}, as shown here:
 
 @example
-struct point p = @{ .y = yvalue, .x = xvalue @};
+struct point p = @{ y: yvalue, x: xvalue @};
 @end example
 
-You can also use an element label (with either the colon syntax or the
-period-equal syntax) when initializing a union, to specify which element
-of the union should be used.  For example,
+@cindex designators
+The @samp{[@var{index}]} or @samp{.@var{fieldname}} is known as a
+@dfn{designator}.  You can also use a designator (or the obsolete colon
+syntax) when initializing a union, to specify which element of the union
+should be used.  For example,
 
 @example
 union foo @{ int i; double d; @};
 
-union foo f = @{ d: 4 @};
+union foo f = @{ .d = 4 @};
 @end example
 
 @noindent
@@ -1201,7 +1391,7 @@ an integer.  (@xref{Cast to Union}.)
 
 You can combine this technique of naming elements with ordinary C
 initialization of successive elements.  Each initializer element that
-does not have a label applies to the next consecutive element of the
+does not have a designator applies to the next consecutive element of the
 array or structure.  For example,
 
 @example
@@ -1225,6 +1415,23 @@ int whitespace[256]
       ['\f'] = 1, ['\n'] = 1, ['\r'] = 1 @};
 @end example
 
+@cindex designator lists
+You can also write a series of @samp{.@var{fieldname}} and
+@samp{[@var{index}]} designators before an @samp{=} to specify a
+nested subobject to initialize; the list is taken relative to the
+subobject corresponding to the closest surrounding brace pair.  For
+example, with the @samp{struct point} declaration above:
+
+@example
+struct point ptarray[10] = @{ [2].y = yv2, [2].x = xv2, [0].x = xv0 @};
+@end example
+
+@noindent
+If the same field is initialized multiple times, it will have value from
+the last initialization.  If any such overridden initialization has
+side-effect, it is unspecified whether the side-effect happens or not.
+Currently, gcc will discard them and issue a warning.
+
 @node Case Ranges
 @section Case Ranges
 @cindex case ranges
@@ -1271,7 +1478,7 @@ A cast to union type is similar to other casts, except that the type
 specified is a union type.  You can specify the type either with
 @code{union @var{tag}} or with a typedef name.  A cast to union is actually
 a constructor though, not a cast, and hence does not yield an lvalue like
-normal casts.  (@xref{Constructors}.)
+normal casts.  (@xref{Compound Literals}.)
 
 The types that may be cast to the union type are those of the members
 of the union.  Thus, given the following union and variables:
@@ -1303,6 +1510,26 @@ void hack (union foo);
 hack ((union foo) x);
 @end example
 
+@node Mixed Declarations
+@section Mixed Declarations and Code
+@cindex mixed declarations and code
+@cindex declarations, mixed with code
+@cindex code, mixed with declarations
+
+ISO C99 and ISO C++ allow declarations and code to be freely mixed
+within compound statements.  As an extension, GCC also allows this in
+C89 mode.  For example, you could do:
+
+@example
+int i;
+@dots{}
+i++;
+int j = i + 2;
+@end example
+
+Each identifier is visible from where it is declared until the end of
+the enclosing block.
+
 @node Function Attributes
 @section Declaring Attributes of Functions
 @cindex function attributes
@@ -1310,10 +1537,10 @@ hack ((union foo) x);
 @cindex functions that never return
 @cindex functions that have no side effects
 @cindex functions in arbitrary sections
-@cindex functions that bahave like malloc
+@cindex functions that behave like malloc
 @cindex @code{volatile} applied to function
 @cindex @code{const} applied to function
-@cindex functions with @code{printf}, @code{scanf} or @code{strftime} style arguments
+@cindex functions with @code{printf}, @code{scanf}, @code{strftime} or @code{strfmon} style arguments
 @cindex functions that are passed arguments in registers on the 386
 @cindex functions that pop the argument stack on the 386
 @cindex functions that do not pop the argument stack on the 386
@@ -1324,11 +1551,13 @@ carefully.
 
 The keyword @code{__attribute__} allows you to specify special
 attributes when making a declaration.  This keyword is followed by an
-attribute specification inside double parentheses.  Ten attributes,
-@code{noreturn}, @code{const}, @code{format},
-@code{no_instrument_function}, @code{section}, @code{constructor},
-@code{destructor}, @code{unused}, @code{weak} and @code{malloc} are
-currently defined for functions.  Other attributes, including
+attribute specification inside double parentheses.  Fourteen attributes,
+@code{noreturn}, @code{pure}, @code{const}, @code{format},
+@code{format_arg}, @code{no_instrument_function}, @code{section},
+@code{constructor}, @code{destructor}, @code{unused}, @code{weak},
+@code{malloc}, @code{alias} and @code{no_check_memory_usage} are
+currently defined for functions.  Several other attributes are defined
+for functions on particular target systems.  Other attributes, including
 @code{section} are supported for variables declarations (@pxref{Variable
 Attributes}) and for types (@pxref{Type Attributes}).
 
@@ -1337,6 +1566,9 @@ each keyword.  This allows you to use them in header files without
 being concerned about a possible macro of the same name.  For example,
 you may use @code{__noreturn__} instead of @code{noreturn}.
 
+@xref{Attribute Syntax}, for details of the exact syntax for using
+attributes.
+
 @table @code
 @cindex @code{noreturn} function attribute
 @item noreturn
@@ -1382,7 +1614,7 @@ volatile voidfn fatal;
 @cindex @code{pure} function attribute
 @item pure
 Many functions have no effects except the return value and their
-return value and depends only on the parameters and/or global variables.
+return value depends only on the parameters and/or global variables.
 Such a function can be subject
 to common subexpression elimination and loop optimization just as an
 arithmetic operator would be.  These functions should be declared
@@ -1399,7 +1631,7 @@ fewer times than the program says.
 Some of common examples of pure functions are @code{strlen} or @code{memcmp}.
 Interesting non-pure functions are functions with infinite loops or those
 depending on volatile memory or other system resource, that may change between
-two consetuctive calls (such as @code{feof} in multithreding environment).
+two consecutive calls (such as @code{feof} in a multithreading environment).
 
 The attribute @code{pure} is not implemented in GNU C versions earlier
 than 2.96.
@@ -1408,7 +1640,7 @@ than 2.96.
 Many functions do not examine any values except their arguments, and
 have no effects except the return value.  Basically this is just slightly
 more strict class than the "pure" attribute above, since function is not
-alloved to read global memory.
+allowed to read global memory.
 
 @cindex pointer arguments
 Note that a function that has pointer arguments and examines the data
@@ -1435,8 +1667,9 @@ specifies that the @samp{const} must be attached to the return value.
 @item format (@var{archetype}, @var{string-index}, @var{first-to-check})
 @cindex @code{format} function attribute
 The @code{format} attribute specifies that a function takes @code{printf},
-@code{scanf}, or @code{strftime} style arguments which should be type-checked
-against a format string.  For example, the declaration:
+@code{scanf}, @code{strftime} or @code{strfmon} style arguments which
+should be type-checked against a format string.  For example, the
+declaration:
 
 @smallexample
 extern int
@@ -1450,14 +1683,16 @@ for consistency with the @code{printf} style format string argument
 @code{my_format}.
 
 The parameter @var{archetype} determines how the format string is
-interpreted, and should be either @code{printf}, @code{scanf}, or
-@code{strftime}.  The
+interpreted, and should be @code{printf}, @code{scanf}, @code{strftime}
+or @code{strfmon}.  (You can also use @code{__printf__},
+@code{__scanf__}, @code{__strftime__} or @code{__strfmon__}.)  The
 parameter @var{string-index} specifies which argument is the format
 string argument (starting from 1), while @var{first-to-check} is the
 number of the first argument to check against the format string.  For
 functions where the arguments are not available to be checked (such as
 @code{vprintf}), specify the third parameter as zero.  In this case the
-compiler only checks the format string for consistency.
+compiler only checks the format string for consistency.  For
+@code{strftime} formats, the third parameter is required to be zero.
 
 In the example above, the format string (@code{my_format}) is the second
 argument of the function @code{my_print}, and the arguments to check
@@ -1466,19 +1701,28 @@ attribute are 2 and 3.
 
 The @code{format} attribute allows you to identify your own functions
 which take format strings as arguments, so that GNU CC can check the
-calls to these functions for errors.  The compiler always checks formats
-for the ANSI library functions @code{printf}, @code{fprintf},
+calls to these functions for errors.  The compiler always (unless
+@samp{-ffreestanding} is used) checks formats
+for the standard library functions @code{printf}, @code{fprintf},
 @code{sprintf}, @code{scanf}, @code{fscanf}, @code{sscanf}, @code{strftime},
 @code{vprintf}, @code{vfprintf} and @code{vsprintf} whenever such
 warnings are requested (using @samp{-Wformat}), so there is no need to
-modify the header file @file{stdio.h}.
+modify the header file @file{stdio.h}.  In C99 mode, the functions
+@code{snprintf}, @code{vsnprintf}, @code{vscanf}, @code{vfscanf} and
+@code{vsscanf} are also checked.  Except in strictly conforming C
+standard modes, the X/Open function @code{strfmon} is also checked.
+@xref{C Dialect Options,,Options Controlling C Dialect}.
 
 @item format_arg (@var{string-index})
 @cindex @code{format_arg} function attribute
-The @code{format_arg} attribute specifies that a function takes
-@code{printf} or @code{scanf} style arguments, modifies it (for example,
-to translate it into another language), and passes it to a @code{printf}
-or @code{scanf} style function.  For example, the declaration:
+The @code{format_arg} attribute specifies that a function takes a format
+string for a @code{printf}, @code{scanf}, @code{strftime} or
+@code{strfmon} style function and modifies it (for example, to translate
+it into another language), so the result can be passed to a
+@code{printf}, @code{scanf}, @code{strftime} or @code{strfmon} style
+function (with the remaining arguments to the format function the same
+as they would have been for the unmodified string).  For example, the
+declaration:
 
 @smallexample
 extern char *
@@ -1487,20 +1731,28 @@ my_dgettext (char *my_domain, const char *my_format)
 @end smallexample
 
 @noindent
-causes the compiler to check the arguments in calls to
-@code{my_dgettext} whose result is passed to a @code{printf},
-@code{scanf}, or @code{strftime} type function for consistency with the
-@code{printf} style format string argument @code{my_format}.
+causes the compiler to check the arguments in calls to a @code{printf},
+@code{scanf}, @code{strftime} or @code{strfmon} type function, whose
+format string argument is a call to the @code{my_dgettext} function, for
+consistency with the format string argument @code{my_format}.  If the
+@code{format_arg} attribute had not been specified, all the compiler
+could tell in such calls to format functions would be that the format
+string argument is not constant; this would generate a warning when
+@code{-Wformat-nonliteral} is used, but the calls could not be checked
+without the attribute.
 
 The parameter @var{string-index} specifies which argument is the format
 string argument (starting from 1).
 
 The @code{format-arg} attribute allows you to identify your own
 functions which modify format strings, so that GNU CC can check the
-calls to @code{printf}, @code{scanf}, or @code{strftime} function whose
-operands are a call to one of your own function.  The compiler always
-treats @code{gettext}, @code{dgettext}, and @code{dcgettext} in this
-manner.
+calls to @code{printf}, @code{scanf}, @code{strftime} or @code{strfmon}
+type function whose operands are a call to one of your own function.
+The compiler always treats @code{gettext}, @code{dgettext}, and
+@code{dcgettext} in this manner except when strict ISO C support is
+requested by @samp{-ansi} or an appropriate @samp{-std} option, or
+@samp{-ffreestanding} is used.  @xref{C Dialect Options,,Options
+Controlling C Dialect}.
 
 @item no_instrument_function
 @cindex @code{no_instrument_function} function attribute
@@ -1683,6 +1935,27 @@ function is an interrupt handler.  The compiler will generate function
 entry and exit sequences suitable for use in an interrupt handler when this
 attribute is present.
 
+@item interrupt
+@cindex interrupt handler functions
+Use this option on the ARM, AVR and M32R/D ports to indicate that the
+specified function is an interrupt handler.  The compiler will generate
+function entry and exit sequences suitable for use in an interrupt
+handler when this attribute is present.
+
+Note, interrupt handlers for the H8/300 and H8/300H processors can be
+specified via the @code{interrupt_handler} attribute.
+
+Note, on the AVR interrupts will be enabled inside the function.
+
+Note, for the ARM you can specify the kind of interrupt to be handled by
+adding an optional parameter to the interrupt attribute like this:
+
+@smallexample
+void f () __attribute__ ((interrupt ("IRQ")));
+@end smallexample
+
+Permissible values for this parameter are: IRQ, FIQ, SWI, ABORT and UNDEF.
+
 @item eightbit_data
 @cindex eight bit data on the H8/300 and H8/300H
 Use this option on the H8/300 and H8/300H to indicate that the specified
@@ -1702,19 +1975,6 @@ The compiler will generate more efficient code for loads and stores
 on data in the tiny data section.  Note the tiny data area is limited to
 slightly under 32kbytes of data.
 
-@item interrupt
-@cindex interrupt handlers on the M32R/D
-Use this option on the M32R/D to indicate that the specified
-function is an interrupt handler.  The compiler will generate function
-entry and exit sequences suitable for use in an interrupt handler when this
-attribute is present.
-
-Interrupt handler functions on the AVR processors
-Use this option on the AVR to indicate that the specified
-function is an interrupt handler.  The compiler will generate function
-entry and exit sequences suitable for use in an interrupt handler when this
-attribute is present. Interrupts will be enabled inside function.
-
 @item signal
 @cindex signal handler functions on the AVR processors
 Use this option on the AVR to indicate that the specified
@@ -1723,10 +1983,10 @@ entry and exit sequences suitable for use in an signal handler when this
 attribute is present. Interrupts will be disabled inside function.
 
 @item naked
-@cindex function without a prologue/epilogue code on the AVR processors
-Use this option on the AVR to indicate that the specified
-function don't have a prologue/epilogue.  The compiler don't generate
-function entry and exit sequences.
+@cindex function without a prologue/epilogue code
+Use this option on the ARM or AVR ports to indicate that the specified
+function do not need prologue/epilogue sequences generated by the
+compiler.  It is up to the programmer to provide these sequences.
 
 @item model (@var{model-name})
 @cindex function addressability on the M32R/D
@@ -1739,11 +1999,11 @@ Small model objects live in the lower 16MB of memory (so that their
 addresses can be loaded with the @code{ld24} instruction), and are
 callable with the @code{bl} instruction.
 
-Medium model objects may live anywhere in the 32 bit address space (the
+Medium model objects may live anywhere in the 32-bit address space (the
 compiler will generate @code{seth/add3} instructions to load their addresses),
 and are callable with the @code{bl} instruction.
 
-Large model objects may live anywhere in the 32 bit address space (the
+Large model objects may live anywhere in the 32-bit address space (the
 compiler will generate @code{seth/add3} instructions to load their addresses),
 and may not be reachable with the @code{bl} instruction (the compiler will
 generate the much slower @code{seth/add3/jl} instruction sequence).
@@ -1756,9 +2016,10 @@ attribute declaration with another attribute declaration.
 
 @cindex @code{#pragma}, reason for not using
 @cindex pragma, reason for not using
-Some people object to the @code{__attribute__} feature, suggesting that ANSI C's
-@code{#pragma} should be used instead.  There are two reasons for not
-doing this.
+Some people object to the @code{__attribute__} feature, suggesting that
+ISO C's @code{#pragma} should be used instead.  At the time
+@code{__attribute__} was designed, there were two reasons for not doing
+this.
 
 @enumerate
 @item
@@ -1769,9 +2030,197 @@ There is no telling what the same @code{#pragma} might mean in another
 compiler.
 @end enumerate
 
-These two reasons apply to almost any application that might be proposed
-for @code{#pragma}.  It is basically a mistake to use @code{#pragma} for
-@emph{anything}.
+These two reasons applied to almost any application that might have been
+proposed for @code{#pragma}.  It was basically a mistake to use
+@code{#pragma} for @emph{anything}.
+
+The ISO C99 standard includes @code{_Pragma}, which now allows pragmas
+to be generated from macros.  In addition, a @code{#pragma GCC}
+namespace is now in use for GCC-specific pragmas.  However, it has been
+found convenient to use @code{__attribute__} to achieve a natural
+attachment of attributes to their corresponding declarations, whereas
+@code{#pragma GCC} is of use for constructs that do not naturally form
+part of the grammar.  @xref{Other Directives,,Miscellaneous
+Preprocessing Directives, cpp, The C Preprocessor}.
+
+@node Attribute Syntax
+@section Attribute Syntax
+@cindex attribute syntax
+
+This section describes the syntax with which @code{__attribute__} may be
+used, and the constructs to which attribute specifiers bind, for the C
+language.  Some details may vary for C++ and Objective C.  Because of
+infelicities in the grammar for attributes, some forms described here
+may not be successfully parsed in all cases.
+
+@xref{Function Attributes}, for details of the semantics of attributes
+applying to functions.  @xref{Variable Attributes}, for details of the
+semantics of attributes applying to variables.  @xref{Type Attributes},
+for details of the semantics of attributes applying to structure, union
+and enumerated types.
+
+An @dfn{attribute specifier} is of the form
+@code{__attribute__ ((@var{attribute-list}))}.  An @dfn{attribute list}
+is a possibly empty comma-separated sequence of @dfn{attributes}, where
+each attribute is one of the following:
+
+@itemize @bullet
+@item
+Empty.  Empty attributes are ignored.
+
+@item
+A word (which may be an identifier such as @code{unused}, or a reserved
+word such as @code{const}).
+
+@item
+A word, followed by, in parentheses, parameters for the attribute.
+These parameters take one of the following forms:
+
+@itemize @bullet
+@item
+An identifier.  For example, @code{mode} attributes use this form.
+
+@item
+An identifier followed by a comma and a non-empty comma-separated list
+of expressions.  For example, @code{format} attributes use this form.
+
+@item
+A possibly empty comma-separated list of expressions.  For example,
+@code{format_arg} attributes use this form with the list being a single
+integer constant expression, and @code{alias} attributes use this form
+with the list being a single string constant.
+@end itemize
+@end itemize
+
+An @dfn{attribute specifier list} is a sequence of one or more attribute
+specifiers, not separated by any other tokens.
+
+An attribute specifier list may appear after the colon following a
+label, other than a @code{case} or @code{default} label.  The only
+attribute it makes sense to use after a label is @code{unused}.  This
+feature is intended for code generated by programs which contains labels
+that may be unused but which is compiled with @option{-Wall}.  It would
+not normally be appropriate to use in it human-written code, though it
+could be useful in cases where the code that jumps to the label is
+contained within an @code{#ifdef} conditional.
+
+An attribute specifier list may appear as part of a @code{struct},
+@code{union} or @code{enum} specifier.  It may go either immediately
+after the @code{struct}, @code{union} or @code{enum} keyword, or after
+the closing brace.  It is ignored if the content of the structure, union
+or enumerated type is not defined in the specifier in which the
+attribute specifier list is used---that is, in usages such as
+@code{struct __attribute__((foo)) bar} with no following opening brace.
+Where attribute specifiers follow the closing brace, they are considered
+to relate to the structure, union or enumerated type defined, not to any
+enclosing declaration the type specifier appears in, and the type
+defined is not complete until after the attribute specifiers.
+@c Otherwise, there would be the following problems: a shift/reduce
+@c conflict between attributes binding the the struct/union/enum and
+@c binding to the list of specifiers/qualifiers; and "aligned"
+@c attributes could use sizeof for the structure, but the size could be
+@c changed later by "packed" attributes.
+
+Otherwise, an attribute specifier appears as part of a declaration,
+counting declarations of unnamed parameters and type names, and relates
+to that declaration (which may be nested in another declaration, for
+example in the case of a parameter declaration).  In future, attribute
+specifiers in some places may however apply to a particular declarator
+within a declaration instead; these cases are noted below.  Where an
+attribute specifier is applied to a parameter declared as a function or
+an array, it should apply to the function or array rather than the
+pointer to which the parameter is implicitly converted, but this is not
+yet correctly implemented.
+
+Any list of specifiers and qualifiers at the start of a declaration may
+contain attribute specifiers, whether or not such a list may in that
+context contain storage class specifiers.  (Some attributes, however,
+are essentially in the nature of storage class specifiers, and only make
+sense where storage class specifiers may be used; for example,
+@code{section}.)  There is one necessary limitation to this syntax: the
+first old-style parameter declaration in a function definition cannot
+begin with an attribute specifier, because such an attribute applies to
+the function instead by syntax described below (which, however, is not
+yet implemented in this case).  In some other cases, attribute
+specifiers are permitted by this grammar but not yet supported by the
+compiler.  All attribute specifiers in this place relate to the
+declaration as a whole.  In the obsolencent usage where a type of
+@code{int} is implied by the absence of type specifiers, such a list of
+specifiers and qualifiers may be an attribute specifier list with no
+other specifiers or qualifiers.
+
+An attribute specifier list may appear immediately before a declarator
+(other than the first) in a comma-separated list of declarators in a
+declaration of more than one identifier using a single list of
+specifiers and qualifiers.  At present, such attribute specifiers apply
+not only to the identifier before whose declarator they appear, but to
+all subsequent identifiers declared in that declaration, but in future
+they may apply only to that single identifier.  For example, in
+@code{__attribute__((noreturn)) void d0 (void),
+__attribute__((format(printf, 1, 2))) d1 (const char *, ...), d2
+(void)}, the @code{noreturn} attribute applies to all the functions
+declared; the @code{format} attribute should only apply to @code{d1},
+but at present applies to @code{d2} as well (and so causes an error).
+
+An attribute specifier list may appear immediately before the comma,
+@code{=} or semicolon terminating the declaration of an identifier other
+than a function definition.  At present, such attribute specifiers apply
+to the declared object or function, but in future they may attach to the
+outermost adjacent declarator.  In simple cases there is no difference,
+but, for example, in @code{void (****f)(void)
+__attribute__((noreturn));}, at present the @code{noreturn} attribute
+applies to @code{f}, which causes a warning since @code{f} is not a
+function, but in future it may apply to the function @code{****f}.  The
+precise semantics of what attributes in such cases will apply to are not
+yet specified.  Where an assembler name for an object or function is
+specified (@pxref{Asm Labels}), at present the attribute must follow the
+@code{asm} specification; in future, attributes before the @code{asm}
+specification may apply to the adjacent declarator, and those after it
+to the declared object or function.
+
+An attribute specifier list may, in future, be permitted to appear after
+the declarator in a function definition (before any old-style parameter
+declarations or the function body).
+
+An attribute specifier list may appear at the start of a nested
+declarator.  At present, there are some limitations in this usage: the
+attributes apply to the identifer declared, and to all subsequent
+identifiers declared in that declaration (if it includes a
+comma-separated list of declarators), rather than to a specific
+declarator.  When attribute specifiers follow the @code{*} of a pointer
+declarator, they must presently follow any type qualifiers present, and
+cannot be mixed with them.  The following describes intended future
+semantics which make this syntax more useful only.  It will make the
+most sense if you are familiar with the formal specification of
+declarators in the ISO C standard.
+
+Consider (as in C99 subclause 6.7.5 paragraph 4) a declaration @code{T
+D1}, where @code{T} contains declaration specifiers that specify a type
+@var{Type} (such as @code{int}) and @code{D1} is a declarator that
+contains an identifier @var{ident}.  The type specified for @var{ident}
+for derived declarators whose type does not include an attribute
+specifier is as in the ISO C standard.
+
+If @code{D1} has the form @code{( @var{attribute-specifier-list} D )},
+and the declaration @code{T D} specifies the type
+``@var{derived-declarator-type-list} @var{Type}'' for @var{ident}, then
+@code{T D1} specifies the type ``@var{derived-declarator-type-list}
+@var{attribute-specifier-list} @var{Type}'' for @var{ident}.
+
+If @code{D1} has the form @code{*
+@var{type-qualifier-and-attribute-specifier-list} D}, and the
+declaration @code{T D} specifies the type
+``@var{derived-declarator-type-list} @var{Type}'' for @var{ident}, then
+@code{T D1} specifies the type ``@var{derived-declarator-type-list}
+@var{type-qualifier-and-attribute-specifier-list} @var{Type}'' for
+@var{ident}.
+
+For example, @code{void (__attribute__((noreturn)) ****f)();} specifies
+the type ``pointer to pointer to pointer to pointer to non-returning
+function returning @code{void}''.  As another example, @code{char
+*__attribute__((aligned(8))) *f;} specifies the type ``pointer to
+8-byte-aligned pointer to @code{char}''.  Note again that this describes
+intended future semantics, not current implementation.
 
 @node Function Prototypes
 @section Prototypes and Old-Style Function Definitions
@@ -1779,7 +2228,7 @@ for @code{#pragma}.  It is basically a mistake to use @code{#pragma} for
 @cindex old-style function definitions
 @cindex promotion of formal parameters
 
-GNU C extends ANSI C to allow a function prototype to override a later
+GNU C extends ISO C to allow a function prototype to override a later
 old-style non-prototype definition.  Consider the following example:
 
 @example
@@ -1802,13 +2251,13 @@ isroot (x)   /* ??? lossage here ??? */
 @}
 @end example
 
-Suppose the type @code{uid_t} happens to be @code{short}.  ANSI C does
+Suppose the type @code{uid_t} happens to be @code{short}.  ISO C does
 not allow this example, because subword arguments in old-style
 non-prototype definitions are promoted.  Therefore in this example the
 function definition's argument is really an @code{int}, which does not
 match the prototype argument type of @code{short}.
 
-This restriction of ANSI C makes it hard to write code that is portable
+This restriction of ISO C makes it hard to write code that is portable
 to traditional C compilers, because the programmer does not know
 whether the @code{uid_t} type is @code{short}, @code{int}, or
 @code{long}.  Therefore, in cases like these GNU C allows a prototype
@@ -1841,7 +2290,8 @@ In GNU C, you may use C++ style comments, which start with @samp{//} and
 continue until the end of the line.  Many other C implementations allow
 such comments, and they are likely to be in a future C standard.
 However, C++ style comments are not recognized if you specify
-@w{@samp{-ansi}} or @w{@samp{-traditional}}, since they are incompatible
+@w{@samp{-ansi}}, a @option{-std} option specifying a version of ISO C
+before C99, or @w{@samp{-traditional}}, since they are incompatible
 with traditional constructs like @code{dividend//*comment*/divisor}.
 
 @node Dollar Signs
@@ -1911,15 +2361,20 @@ attributes of variables or structure fields.  This keyword is followed
 by an attribute specification inside double parentheses.  Eight
 attributes are currently defined for variables: @code{aligned},
 @code{mode}, @code{nocommon}, @code{packed}, @code{section},
-@code{transparent_union}, @code{unused}, and @code{weak}.  Other
+@code{transparent_union}, @code{unused}, and @code{weak}.  Some other
+attributes are defined for variables on particular target systems.  Other
 attributes are available for functions (@pxref{Function Attributes}) and
-for types (@pxref{Type Attributes}).
+for types (@pxref{Type Attributes}).  Other front-ends might define more
+attributes (@pxref{C++ Extensions,,Extensions to the C++ Language}).
 
 You may also specify attributes with @samp{__} preceding and following
 each keyword.  This allows you to use them in header files without
 being concerned about a possible macro of the same name.  For example,
 you may use @code{__aligned__} instead of @code{aligned}.
 
+@xref{Attribute Syntax}, for details of the exact syntax for using
+attributes.
+
 @table @code
 @cindex @code{aligned} attribute
 @item aligned (@var{alignment})
@@ -2073,10 +2528,10 @@ section, consider using the facilities of the linker instead.
 
 @item shared
 @cindex @code{shared} variable attribute
-On Windows NT, in addition to nputting variable definitions in a named 
-section, the section can also be shared among all running copies of an 
-executable or DLL. For example, this small program defines shared data 
-by putting it in a named section "shared" and marking the section 
+On Windows NT, in addition to putting variable definitions in a named
+section, the section can also be shared among all running copies of an
+executable or DLL. For example, this small program defines shared data
+by putting it in a named section "shared" and marking the section
 shareable:
 
 @smallexample
@@ -2092,7 +2547,7 @@ main()
 
 @noindent
 You may only use the @code{shared} attribute along with @code{section}
-attribute with a fully initialized global definition because of the way 
+attribute with a fully initialized global definition because of the way
 linkers work.  See @code{section} attribute for more information.
 
 The @code{shared} attribute is only available on Windows NT.
@@ -2122,7 +2577,7 @@ or @code{large}, representing each of the code models.
 Small model objects live in the lower 16MB of memory (so that their
 addresses can be loaded with the @code{ld24} instruction).
 
-Medium and large model objects may live anywhere in the 32 bit address space
+Medium and large model objects may live anywhere in the 32-bit address space
 (the compiler will generate @code{seth/add3} instructions to load their
 addresses).
 
@@ -2140,9 +2595,9 @@ packed))}.
 The keyword @code{__attribute__} allows you to specify special
 attributes of @code{struct} and @code{union} types when you define such
 types.  This keyword is followed by an attribute specification inside
-double parentheses.  Three attributes are currently defined for types:
-@code{aligned}, @code{packed}, and @code{transparent_union}.  Other
-attributes are defined for functions (@pxref{Function Attributes}) and
+double parentheses.  Four attributes are currently defined for types:
+@code{aligned}, @code{packed}, @code{transparent_union}, and @code{unused}.
+Other attributes are defined for functions (@pxref{Function Attributes}) and
 for variables (@pxref{Variable Attributes}).
 
 You may also specify any one of these attributes with @samp{__}
@@ -2160,6 +2615,9 @@ brace of a definition.
 You may also specify attributes between the enum, struct or union
 tag and the name of the type rather than after the closing brace.
 
+@xref{Attribute Syntax}, for details of the exact syntax for using
+attributes.
+
 @table @code
 @cindex @code{aligned} attribute
 @item aligned (@var{alignment})
@@ -2181,7 +2639,7 @@ store) instructions when copying one variable of type @code{struct S} to
 another, thus improving run-time efficiency.
 
 Note that the alignment of any given @code{struct} or @code{union} type
-is required by the ANSI C standard to be at least a perfect multiple of
+is required by the ISO C standard to be at least a perfect multiple of
 the lowest common multiple of the alignments of all of the members of
 the @code{struct} or @code{union} in question.  This means that you @emph{can}
 effectively adjust the alignment of a @code{struct} or @code{union}
@@ -2346,6 +2804,10 @@ inlining, depending on the particular case.  Inlining of functions is an
 optimization and it really ``works'' only in optimizing compilation.  If
 you don't use @samp{-O}, no function is really inline.
 
+Inline functions are included in the ISO C99 standard, but there are
+currently substantial differences between what GCC implements and what
+the ISO C99 standard requires.
+
 To declare a function inline, use the @code{inline} keyword in its
 declaration, like this:
 
@@ -2357,10 +2819,10 @@ inc (int *a)
 @}
 @end example
 
-(If you are writing a header file to be included in ANSI C programs, write
+(If you are writing a header file to be included in ISO C programs, write
 @code{__inline__} instead of @code{inline}.  @xref{Alternate Keywords}.)
 You can also make all ``simple enough'' functions inline with the option
-@samp{-finline-functions}. 
+@samp{-finline-functions}.
 
 Note that certain usages in a function definition can make it unsuitable
 for inline substitution.  Among these usages are: use of varargs, use of
@@ -2417,6 +2879,12 @@ The definition in the header file will cause most calls to the function
 to be inlined.  If any uses of the function remain, they will refer to
 the single copy in the library.
 
+For future compatibility with when GCC implements ISO C99 semantics for
+inline functions, it is best to use @code{static inline} only.  (The
+existing semantics will remain available when @option{-std=gnu89} is
+specified, but eventually the default will be @option{-std=gnu99} and
+that will implement the C99 semantics, though it does not do so yet.)
+
 GNU C does not inline any functions when not optimizing.  It is not
 clear whether it is better to inline or not, in this case, but we found
 that a correct implementation when not optimizing was difficult.  So we
@@ -2558,20 +3026,26 @@ effect.  But it is valid no matter what the machine.
 If your assembler instruction modifies memory in an unpredictable
 fashion, add @samp{memory} to the list of clobbered registers.  This
 will cause GNU CC to not keep memory values cached in registers across
-the assembler instruction.
+the assembler instruction.  You will also want to add the
+@code{volatile} keyword if the memory affected is not listed in the
+inputs or outputs of the @code{asm}, as the @samp{memory} clobber does
+not count as a side-effect of the @code{asm}.
 
 You can put multiple assembler instructions together in a single
-@code{asm} template, separated either with newlines (written as
-@samp{\n}) or with semicolons if the assembler allows such semicolons.
-The GNU assembler allows semicolons and most Unix assemblers seem to do
-so.  The input operands are guaranteed not to use any of the clobbered
+@code{asm} template, separated by the characters normally used in assembly
+code for the system.  A combination that works in most places is a newline
+to break the line, plus a tab character to move to the instruction field
+(written as @samp{\n\t}).  Sometimes semicolons can be used, if the
+assembler allows semicolons as a line-breaking character.  Note that some
+assembler dialects use semicolons to start a comment.
+The input operands are guaranteed not to use any of the clobbered
 registers, and neither will the output operands' addresses, so you can
 read and write the clobbered registers as many times as you like.  Here
 is an example of multiple instructions in a template; it assumes the
 subroutine @code{_foo} accepts arguments in registers 9 and 10:
 
 @example
-asm ("movl %0,r9;movl %1,r10;call _foo"
+asm ("movl %0,r9\n\tmovl %1,r10\n\tcall _foo"
      : /* no outputs */
      : "g" (from), "g" (to)
      : "r9", "r10");
@@ -2589,7 +3063,7 @@ instruction, you must include a branch and a label in the @code{asm}
 construct, as follows:
 
 @example
-asm ("clr %0;frob %1;beq 0f;mov #1,%0;0:"
+asm ("clr %0\n\tfrob %1\n\tbeq 0f\n\tmov #1,%0\n0:"
      : "g" (result)
      : "g" (input));
 @end example
@@ -2651,23 +3125,38 @@ the @code{asm}.  For example:
 @noindent
 If you write an @code{asm} instruction with no outputs, GNU CC will know
 the instruction has side-effects and will not delete the instruction or
-move it outside of loops.  If the side-effects of your instruction are
-not purely external, but will affect variables in your program in ways
-other than reading the inputs and clobbering the specified registers or
-memory, you should write the @code{volatile} keyword to prevent future
-versions of GNU CC from moving the instruction around within a core
-region.
-
-An @code{asm} instruction without any operands or clobbers (and ``old
-style'' @code{asm}) will not be deleted or moved significantly,
-regardless, unless it is unreachable, the same wasy as if you had
-written a @code{volatile} keyword.
+move it outside of loops.
+
+The @code{volatile} keyword indicates that the instruction has
+important side-effects.  GCC will not delete a volatile @code{asm} if
+it is reachable.  (The instruction can still be deleted if GCC can
+prove that control-flow will never reach the location of the
+instruction.)  In addition, GCC will not reschedule instructions
+across a volatile @code{asm} instruction.  For example:
+
+@example
+*(volatile int *)addr = foo;
+asm volatile ("eieio" : : );
+@end example
+
+@noindent 
+Assume @code{addr} contains the address of a memory mapped device
+register.  The PowerPC @code{eieio} instruction (Enforce In-order
+Execution of I/O) tells the cpu to make sure that the store to that
+device register happens before it issues any other I/O.
 
 Note that even a volatile @code{asm} instruction can be moved in ways
 that appear insignificant to the compiler, such as across jump
 instructions.  You can't expect a sequence of volatile @code{asm}
 instructions to remain perfectly consecutive.  If you want consecutive
-output, use a single @code{asm}.
+output, use a single @code{asm}.  Also, GCC will perform some
+optimizations across a volatile @code{asm} instruction; GCC does not
+``forget everything'' when it encounters a volatile @code{asm}
+instruction the way some other compilers do.
+
+An @code{asm} instruction without any operands or clobbers (an ``old
+style'' @code{asm}) will be treated identically to a volatile
+@code{asm} instruction.
 
 It is a natural idea to look for a way to give access to the condition
 code left by the assembler instruction.  However, when we attempted to
@@ -2678,7 +3167,11 @@ instructions would alter the condition code before there was time to
 test it.  This problem doesn't arise for ordinary ``test'' and
 ``compare'' instructions because they don't have any output operands.
 
-If you are writing a header file that should be includable in ANSI C
+For reasons similar to those described above, it is not possible to give
+an assembler instruction access to the condition code left by previous
+instructions.
+
+If you are writing a header file that should be includable in ISO C
 programs, write @code{__asm__} instead of @code{asm}.  @xref{Alternate
 Keywords}.
 
@@ -2801,6 +3294,13 @@ On systems where an underscore is normally prepended to the name of a C
 function or variable, this feature allows you to define names for the
 linker that do not start with an underscore.
 
+It does not make sense to use this feature with a non-static local
+variable since such variables do not have assembler names.  If you are
+trying to put the variable in a particular register, see @ref{Explicit
+Reg Vars}.  GCC presently accepts such code with a warning, but will
+probably be changed to issue an error, rather than a warning, in the
+future.
+
 You cannot use @code{asm} in this way in a function @emph{definition}; but
 you can get the same effect by writing a declaration for the function
 before its definition and putting @code{asm} there, like this:
@@ -3003,15 +3503,20 @@ be deleted or moved or simplified.
 @cindex alternate keywords
 @cindex keywords, alternate
 
-The option @samp{-traditional} disables certain keywords; @samp{-ansi}
-disables certain others.  This causes trouble when you want to use GNU C
-extensions, or ANSI C features, in a general-purpose header file that
-should be usable by all programs, including ANSI C programs and traditional
-ones.  The keywords @code{asm}, @code{typeof} and @code{inline} cannot be
-used since they won't work in a program compiled with @samp{-ansi}, while
-the keywords @code{const}, @code{volatile}, @code{signed}, @code{typeof}
-and @code{inline} won't work in a program compiled with
-@samp{-traditional}.@refill
+The option @option{-traditional} disables certain keywords;
+@option{-ansi} and the various @option{-std} options disable certain
+others.  This causes trouble when you want to use GNU C extensions, or
+ISO C features, in a general-purpose header file that should be usable
+by all programs, including ISO C programs and traditional ones.  The
+keywords @code{asm}, @code{typeof} and @code{inline} cannot be used
+since they won't work in a program compiled with @option{-ansi}
+(although @code{inline} can be used in a program compiled with
+@option{-std=c99}), while the keywords @code{const}, @code{volatile},
+@code{signed}, @code{typeof} and @code{inline} won't work in a program
+compiled with @option{-traditional}.  The ISO C99 keyword
+@code{restrict} is only available when @option{-std=gnu99} (which will
+eventually be the default) or @option{-std=c99} (or the equivalent
+@option{-std=iso9899:1999}) is used.@refill
 
 The way to solve these problems is to put @samp{__} at the beginning and
 end of each problematical keyword.  For example, use @code{__asm__}
@@ -3054,6 +3559,9 @@ This extension is not supported by GNU C++.
 
 @node Function Names
 @section Function Names as Strings
+@cindex @code{__FUNCTION__} identifier
+@cindex @code{__PRETTY_FUNCTION__} identifier
+@cindex @code{__func__} identifier
 
 GNU CC predefines two magic identifiers to hold the name of the current
 function. The identifier @code{__FUNCTION__} holds the name of the function
@@ -3110,7 +3618,7 @@ meaning inside a function, since the preprocessor does not do anything
 special with the identifier @code{__FUNCTION__}.
 
 GNU CC also supports the magic word @code{__func__}, defined by the
-ISO standard C-99:
+ISO standard C99:
 
 @display
 The identifier @code{__func__} is implicitly declared by the translator
@@ -3179,6 +3687,67 @@ function as well.
 
 @node Other Builtins
 @section Other built-in functions provided by GNU CC
+@cindex builtin functions
+@findex __builtin_isgreater
+@findex __builtin_isgreaterequal
+@findex __builtin_isless
+@findex __builtin_islessequal
+@findex __builtin_islessgreater
+@findex __builtin_isunordered
+@findex abort
+@findex abs
+@findex alloca
+@findex bcmp
+@findex bzero
+@findex cimag
+@findex cimagf
+@findex cimagl
+@findex conj
+@findex conjf
+@findex conjl
+@findex cos
+@findex cosf
+@findex cosl
+@findex creal
+@findex crealf
+@findex creall
+@findex exit
+@findex _exit
+@findex _Exit
+@findex fabs
+@findex fabsf
+@findex fabsl
+@findex ffs
+@findex fprintf
+@findex fputs
+@findex imaxabs
+@findex index
+@findex labs
+@findex llabs
+@findex memcmp
+@findex memcpy
+@findex memset
+@findex printf
+@findex rindex
+@findex sin
+@findex sinf
+@findex sinl
+@findex sqrt
+@findex sqrtf
+@findex sqrtl
+@findex strcat
+@findex strchr
+@findex strcmp
+@findex strcpy
+@findex strcspn
+@findex strlen
+@findex strncat
+@findex strncmp
+@findex strncpy
+@findex strpbrk
+@findex strrchr
+@findex strspn
+@findex strstr
 
 GNU CC provides a large number of built-in functions other than the ones
 mentioned above.  Some of these are for internal use in the processing
@@ -3189,15 +3758,53 @@ recommend general use of these functions.
 The remaining functions are provided for optimization purposes.
 
 GNU CC includes builtin versions of many of the functions in the
-standard C library.  These will always be treated as having the same
-meaning as the C library function even if you specify the
-@samp{-fno-builtin} (@pxref{C Dialect Options}) option.  These functions
-correspond to the C library functions @code{abort}, @code{abs},
-@code{alloca}, @code{cos}, @code{cosf}, @code{cosl}, @code{exit},
-@code{_exit}, @code{fabs}, @code{fabsf}, @code{fabsl}, @code{ffs},
-@code{labs}, @code{memcmp}, @code{memcpy}, @code{memset}, @code{sin},
-@code{sinf}, @code{sinl}, @code{sqrt}, @code{sqrtf}, @code{sqrtl},
-@code{strcmp}, @code{strcpy}, and @code{strlen}.
+standard C library.  The versions prefixed with @code{__builtin_} will
+always be treated as having the same meaning as the C library function
+even if you specify the @samp{-fno-builtin} (@pxref{C Dialect Options})
+option.  Many of these functions are only optimized in certain cases; if
+not optimized in a particular case, a call to the library function will
+be emitted.
+
+The functions @code{abort}, @code{exit}, @code{_Exit} and @code{_exit}
+are recognized and presumed not to return, but otherwise are not built
+in.  @code{_exit} is not recognized in strict ISO C mode (@samp{-ansi},
+@samp{-std=c89} or @samp{-std=c99}).  @code{_Exit} is not recognized in
+strict C89 mode (@samp{-ansi} or @samp{-std=c89}).
+
+Outside strict ISO C mode, the functions @code{alloca}, @code{bcmp},
+@code{bzero}, @code{index}, @code{rindex} and @code{ffs} may be handled
+as builtins.  Corresponding versions @code{__builtin_alloca},
+@code{__builtin_bcmp}, @code{__builtin_bzero}, @code{__builtin_index},
+@code{__builtin_rindex} and @code{__builtin_ffs} are also recognized in
+strict ISO C mode.
+
+The ISO C99 functions @code{conj}, @code{conjf}, @code{conjl},
+@code{creal}, @code{crealf}, @code{creall}, @code{cimag}, @code{cimagf},
+@code{cimagl}, @code{llabs} and @code{imaxabs} are handled as builtins
+except in strict ISO C89 mode.  There are also builtin versions of the ISO C99
+functions @code{cosf}, @code{cosl}, @code{fabsf}, @code{fabsl},
+@code{sinf}, @code{sinl}, @code{sqrtf}, and @code{sqrtl}, that are
+recognized in any mode since ISO C89 reserves these names for the
+purpose to which ISO C99 puts them.  All these functions have
+corresponding versions prefixed with @code{__builtin_}.
+
+The following ISO C89 functions are recognized as builtins unless
+@samp{-fno-builtin} is specified: @code{abs}, @code{cos}, @code{fabs},
+@code{fprintf}, @code{fputs}, @code{labs}, @code{memcmp}, @code{memcpy},
+@code{memset}, @code{printf}, @code{sin}, @code{sqrt}, @code{strcat},
+@code{strchr}, @code{strcmp}, @code{strcpy}, @code{strcspn},
+@code{strlen}, @code{strncat}, @code{strncmp}, @code{strncpy},
+@code{strpbrk}, @code{strrchr}, @code{strspn}, and @code{strstr}.  All
+of these functions have corresponding versions prefixed with
+@code{__builtin_}, except that the version for @code{sqrt} is called
+@code{__builtin_fsqrt}.
+
+GNU CC provides builtin versions of the ISO C99 floating point
+comparison macros (that avoid raising exceptions for unordered
+operands): @code{__builtin_isgreater}, @code{__builtin_isgreaterequal},
+@code{__builtin_isless}, @code{__builtin_islessequal},
+@code{__builtin_islessgreater}, and @code{__builtin_isunordered}.
+
 
 @table @code
 @findex __builtin_constant_p
@@ -3226,13 +3833,13 @@ You may use this builtin function in either a macro or an inline
 function.  However, if you use it in an inlined function and pass an
 argument of the function as the argument to the builtin, GNU CC will
 never return 1 when you call the inline function with a string constant
-or constructor expression (@pxref{Constructors}) and will not return 1
+or compound literal (@pxref{Compound Literals}) and will not return 1
 when you pass a constant numeric value to the inline function unless you
 specify the @samp{-O} option.
 
 @findex __builtin_expect
 @item __builtin_expect(@var{exp}, @var{c})
-You may use @code{__builtin_expect} to provide the compiler with 
+You may use @code{__builtin_expect} to provide the compiler with
 branch prediction information.  In general, you should prefer to
 use actual profile feedback for this (@samp{-fprofile-arcs}), as
 programmers are notoriously bad at predicting how their programs
@@ -3263,30 +3870,6 @@ if (__builtin_expect (ptr != NULL, 1))
 when testing pointer or floating-point values.
 @end table
 
-@node Deprecated Features
-@section Deprecated Features
-
-In the past, the GNU C++ compiler was extended to experiment with new
-features, at a time when the C++ language was still evolving. Now that
-the C++ standard is complete, some of those features are superseded by
-superior alternatives. Using the old features might cause a warning in
-some cases that the feature will be dropped in the future. In other
-cases, the feature might be gone already.
-
-While the list below is not exhaustive, it documents some of the options
-that are now deprecated:
-
-@table @code
-@item -fexternal-templates
-@itemx -falt-external-templates
-These are two of the many ways for g++ to implement template
-instantiation. @xref{Template Instantiation}. The C++ standard clearly
-defines how template definitions have to be organized across
-implementation units. g++ has an implicit instantiation mechanism that
-should work just fine for standard-conforming code.
-
-@end table
-
 @node C++ Extensions
 @chapter Extensions to the C++ Language
 @cindex extensions, C++ language
@@ -3301,131 +3884,22 @@ test specifically for GNU C++ (@pxref{Standard Predefined,,Standard
 Predefined Macros,cpp.info,The C Preprocessor}).
 
 @menu
-* Naming Results::      Giving a name to C++ function return values.
 * Min and Max::                C++ Minimum and maximum operators.
 * Volatiles::          What constitutes an access to a volatile object.
-* Restricted Pointers:: C9X restricted pointers and references.
+* Restricted Pointers:: C99 restricted pointers and references.
+* Vague Linkage::       Where G++ puts inlines, vtables and such.
 * C++ Interface::       You can use a single C++ header file for both
-                         declarations and definitions.
+                        declarations and definitions.
 * Template Instantiation:: Methods for ensuring that exactly one copy of
-                         each needed template instantiation is emitted.
+                        each needed template instantiation is emitted.
 * Bound member functions:: You can extract a function pointer to the
                         method denoted by a @samp{->*} or @samp{.*} expression.
+* C++ Attributes::      Variable, function, and type attributes for C++ only.
+* Java Exceptions::     Tweaking exception handling to work with Java.
+* Deprecated Features:: Things might disappear from g++.
+* Backwards Compatibility:: Compatibilities with earlier definitions of C++.
 @end menu
 
-@node Naming Results
-@section Named Return Values in C++
-
-@cindex @code{return}, in C++ function header
-@cindex return value, named, in C++
-@cindex named return value in C++
-@cindex C++ named return value
-GNU C++ extends the function-definition syntax to allow you to specify a
-name for the result of a function outside the body of the definition, in
-C++ programs:
-
-@example
-@group
-@var{type}
-@var{functionname} (@var{args}) return @var{resultname};
-@{
-  @dots{}
-  @var{body}
-  @dots{}
-@}
-@end group
-@end example
-
-You can use this feature to avoid an extra constructor call when
-a function result has a class type.  For example, consider a function
-@code{m}, declared as @w{@samp{X v = m ();}}, whose result is of class
-@code{X}:
-
-@example
-X
-m ()
-@{
-  X b;
-  b.a = 23;
-  return b;
-@}
-@end example
-
-@cindex implicit argument: return value
-Although @code{m} appears to have no arguments, in fact it has one implicit
-argument: the address of the return value.  At invocation, the address
-of enough space to hold @code{v} is sent in as the implicit argument.
-Then @code{b} is constructed and its @code{a} field is set to the value
-23.  Finally, a copy constructor (a constructor of the form @samp{X(X&)})
-is applied to @code{b}, with the (implicit) return value location as the
-target, so that @code{v} is now bound to the return value.
-
-But this is wasteful.  The local @code{b} is declared just to hold
-something that will be copied right out.  While a compiler that
-combined an ``elision'' algorithm with interprocedural data flow
-analysis could conceivably eliminate all of this, it is much more
-practical to allow you to assist the compiler in generating
-efficient code by manipulating the return value explicitly,
-thus avoiding the local variable and copy constructor altogether.
-
-Using the extended GNU C++ function-definition syntax, you can avoid the
-temporary allocation and copying by naming @code{r} as your return value
-at the outset, and assigning to its @code{a} field directly:
-
-@example
-X
-m () return r;
-@{
-  r.a = 23;
-@}
-@end example
-
-@noindent
-The declaration of @code{r} is a standard, proper declaration, whose effects
-are executed @strong{before} any of the body of @code{m}.
-
-Functions of this type impose no additional restrictions; in particular,
-you can execute @code{return} statements, or return implicitly by
-reaching the end of the function body (``falling off the edge'').
-Cases like
-
-@example
-X
-m () return r (23);
-@{
-  return;
-@}
-@end example
-
-@noindent
-(or even @w{@samp{X m () return r (23); @{ @}}}) are unambiguous, since
-the return value @code{r} has been initialized in either case.  The
-following code may be hard to read, but also works predictably:
-
-@example
-X
-m () return r;
-@{
-  X b;
-  return b;
-@}
-@end example
-
-The return value slot denoted by @code{r} is initialized at the outset,
-but the statement @samp{return b;} overrides this value.  The compiler
-deals with this by destroying @code{r} (calling the destructor if there
-is one, or doing nothing if there is not), and then reinitializing
-@code{r} with @code{b}.
-
-This extension is provided primarily to help people who use overloaded
-operators, where there is a great need to control not just the
-arguments, but the return values of functions.  For classes where the
-copy constructor incurs a heavy performance penalty (especially in the
-common case where there is a quick default constructor), this is a major
-savings.  The disadvantage of this extension is that you do not control
-when the default constructor for the return value is called: it is
-always called at the beginning.
-
 @node Min and Max
 @section Minimum and Maximum Operators in C++
 
@@ -3480,13 +3954,13 @@ works correctly.
 
 Both the C and C++ standard have the concept of volatile objects. These
 are normally accessed by pointers and used for accessing hardware. The
-standards encourage compilers to refrain from optimizations on
+standards encourage compilers to refrain from optimizations
 concerning accesses to volatile objects that it might perform on
 non-volatile objects. The C standard leaves it implementation defined
 as to what constitutes a volatile access. The C++ standard omits to
 specify this, except to say that C++ should behave in a similar manner
 to C with respect to volatiles, where possible. The minimum either
-standard specifies is that at a sequence point all previous access to
+standard specifies is that at a sequence point all previous accesses to
 volatile objects have stabilized and no subsequent accesses have
 occurred. Thus an implementation is free to reorder and combine
 volatile accesses which occur between sequence points, but cannot do so
@@ -3558,9 +4032,9 @@ an rvalue.
 @cindex restricted references
 @cindex restricted this pointer
 
-As with gcc, g++ understands the C9X proposal of restricted pointers,
+As with gcc, g++ understands the C99 feature of restricted pointers,
 specified with the @code{__restrict__}, or @code{__restrict} type
-qualifier. Because you cannot compile C++ by specifying the -flang-isoc9x
+qualifier. Because you cannot compile C++ by specifying the -std=c99
 language flag, @code{restrict} is not a keyword in C++.
 
 In addition to allowing restricted pointers, you can specify restricted
@@ -3601,6 +4075,83 @@ ignored in function definition matching. This means you only need to
 specify @code{__restrict__} in a function definition, rather than
 in a function prototype as well.
 
+@node Vague Linkage
+@section Vague Linkage
+@cindex vague linkage
+
+There are several constructs in C++ which require space in the object
+file but are not clearly tied to a single translation unit.  We say that
+these constructs have ``vague linkage''.  Typically such constructs are
+emitted wherever they are needed, though sometimes we can be more
+clever.
+
+@table @asis
+@item Inline Functions
+Inline functions are typically defined in a header file which can be
+included in many different compilations.  Hopefully they can usually be
+inlined, but sometimes an out-of-line copy is necessary, if the address
+of the function is taken or if inlining fails.  In general, we emit an
+out-of-line copy in all translation units where one is needed.  As an
+exception, we only emit inline virtual functions with the vtable, since
+it will always require a copy.
+
+Local static variables and string constants used in an inline function
+are also considered to have vague linkage, since they must be shared
+between all inlined and out-of-line instances of the function.
+
+@item VTables
+@cindex vtable
+C++ virtual functions are implemented in most compilers using a lookup
+table, known as a vtable.  The vtable contains pointers to the virtual
+functions provided by a class, and each object of the class contains a
+pointer to its vtable (or vtables, in some multiple-inheritance
+situations).  If the class declares any non-inline, non-pure virtual
+functions, the first one is chosen as the ``key method'' for the class,
+and the vtable is only emitted in the translation unit where the key
+method is defined.
+
+@emph{Note:} If the chosen key method is later defined as inline, the
+vtable will still be emitted in every translation unit which defines it.
+Make sure that any inline virtuals are declared inline in the class
+body, even if they are not defined there.
+
+@item type_info objects
+@cindex type_info
+@cindex RTTI
+C++ requires information about types to be written out in order to
+implement @samp{dynamic_cast}, @samp{typeid} and exception handling.
+For polymorphic classes (classes with virtual functions), the type_info
+object is written out along with the vtable so that @samp{dynamic_cast}
+can determine the dynamic type of a class object at runtime.  For all
+other types, we write out the type_info object when it is used: when
+applying @samp{typeid} to an expression, throwing an object, or
+referring to a type in a catch clause or exception specification.
+
+@item Template Instantiations
+Most everything in this section also applies to template instantiations,
+but there are other options as well.
+@xref{Template Instantiation,,Where's the Template?}.
+
+@end table
+
+When used with GNU ld version 2.8 or later on an ELF system such as
+Linux/GNU or Solaris 2, or on Microsoft Windows, duplicate copies of
+these constructs will be discarded at link time.  This is known as
+COMDAT support.
+
+On targets that don't support COMDAT, but do support weak symbols, GCC
+will use them.  This way one copy will override all the others, but
+the unused copies will still take up space in the executable.
+
+For targets which do not support either COMDAT or weak symbols,
+most entities with vague linkage will be emitted as local symbols to
+avoid duplicate definition errors from the linker.  This will not happen
+for local statics in inlines, however, as having multiple copies will
+almost certainly break things.
+
+@xref{C++ Interface,,Declarations and Definitions in One Header}, for
+another way to control placement of these constructs.
+
 @node C++ Interface
 @section Declarations and Definitions in One Header
 
@@ -3836,12 +4387,16 @@ other files) without having to specify them as well.
 
 g++ has extended the template instantiation syntax outlined in the
 Working Paper to allow forward declaration of explicit instantiations
-and instantiation of the compiler support data for a template class
-(i.e. the vtable) without instantiating any of its members:
+(with @code{extern}), instantiation of the compiler support data for a
+template class (i.e. the vtable) without instantiating any of its
+members (with @code{inline}), and instantiation of only the static data
+members of a template class, without the support data or member
+functions (with (@code{static}):
 
 @example
 extern template int max (int, int);
 inline template class Foo<int>;
+static template class Foo<int>;
 @end example
 
 @item
@@ -3929,3 +4484,143 @@ fptr p1 = (fptr)(&A::foo);
 
 You must specify @samp{-Wno-pmf-conversions} to use this extension.
 
+@node C++ Attributes
+@section C++-Specific Variable, Function, and Type Attributes
+
+Some attributes only make sense for C++ programs.
+
+@table @code
+@item init_priority (@var{priority})
+@cindex init_priority attribute
+
+
+In Standard C++, objects defined at namespace scope are guaranteed to be
+initialized in an order in strict accordance with that of their definitions
+@emph{in a given translation unit}.  No guarantee is made for initializations
+across translation units.  However, GNU C++ allows users to control the
+order of initialization of objects defined at namespace scope with the
+@code{init_priority} attribute by specifying a relative @var{priority},
+a constant integral expression currently bounded between 101 and 65535
+inclusive.  Lower numbers indicate a higher priority.
+
+In the following example, @code{A} would normally be created before
+@code{B}, but the @code{init_priority} attribute has reversed that order:
+
+@example
+Some_Class  A  __attribute__ ((init_priority (2000)));
+Some_Class  B  __attribute__ ((init_priority (543)));
+@end example
+
+@noindent
+Note that the particular values of @var{priority} do not matter; only their
+relative ordering.
+
+@item java_interface
+@cindex java_interface attribute
+
+This type attribute informs C++ that the class is a Java interface.  It may
+only be applied to classes declared within an @code{extern "Java"} block.
+Calls to methods declared in this interface will be dispatched using GCJ's
+interface table mechanism, instead of regular virtual table dispatch.
+
+@end table
+
+@node Java Exceptions
+@section Java Exceptions
+
+The Java language uses a slightly different exception handling model
+from C++.  Normally, GNU C++ will automatically detect when you are
+writing C++ code that uses Java exceptions, and handle them
+appropriately.  However, if C++ code only needs to execute destructors
+when Java exceptions are thrown through it, GCC will guess incorrectly.
+Sample problematic code:
+
+@example
+  struct S @{ ~S(); @};
+  extern void bar();    // is implemented in Java and may throw exceptions
+  void foo()
+  @{
+    S s;
+    bar();
+  @}
+@end example
+
+@noindent
+The usual effect of an incorrect guess is a link failure, complaining of
+a missing routine called @samp{__gxx_personality_v0}.
+
+You can inform the compiler that Java exceptions are to be used in a
+translation unit, irrespective of what it might think, by writing
+@samp{@w{#pragma GCC java_exceptions}} at the head of the file.  This
+@samp{#pragma} must appear before any functions that throw or catch
+exceptions, or run destructors when exceptions are thrown through them.
+
+You cannot mix Java and C++ exceptions in the same translation unit.  It
+is believed to be safe to throw a C++ exception from one file through
+another file compiled for the for the Java exception model, or vice
+versa, but there may be bugs in this area.
+
+@node Deprecated Features
+@section Deprecated Features
+
+In the past, the GNU C++ compiler was extended to experiment with new
+features, at a time when the C++ language was still evolving. Now that
+the C++ standard is complete, some of those features are superseded by
+superior alternatives. Using the old features might cause a warning in
+some cases that the feature will be dropped in the future. In other
+cases, the feature might be gone already.
+
+While the list below is not exhaustive, it documents some of the options
+that are now deprecated:
+
+@table @code
+@item -fexternal-templates
+@itemx -falt-external-templates
+These are two of the many ways for g++ to implement template
+instantiation. @xref{Template Instantiation}. The C++ standard clearly
+defines how template definitions have to be organized across
+implementation units. g++ has an implicit instantiation mechanism that
+should work just fine for standard-conforming code.
+
+@item -fstrict-prototype
+@itemx -fno-strict-prototype
+Previously it was possible to use an empty prototype parameter list to
+indicate an unspecified number of parameters (like C), rather than no
+parameters, as C++ demands. This feature has been removed, except where
+it is required for backwards compatibility @xref{Backwards Compatibility}.
+@end table
+
+The named return value extension has been deprecated, and will be
+removed from g++ at some point.
+
+The use of initializer lists with new expressions has been deprecated,
+and will be removed from g++ at some point.
+
+@node Backwards Compatibility
+@section Backwards Compatibility
+@cindex Backwards Compatibility
+@cindex ARM [Annotated C++ Reference Manual]
+
+Now that there is a definitive ISO standard C++, g++ has a specification
+to adhere to. The C++ language evolved over time, and features that
+used to be acceptable in previous drafts of the standard, such as the ARM
+[Annotated C++ Reference Manual], are no longer accepted. In order to allow
+compilation of C++ written to such drafts, g++ contains some backwards
+compatibilities. @emph{All such backwards compatibility features are
+liable to disappear in future versions of g++.} They should be considered
+deprecated @xref{Deprecated Features}.
+
+@table @code
+@item For scope
+If a variable is declared at for scope, it used to remain in scope until
+the end of the scope which contained the for statement (rather than just
+within the for scope). g++ retains this, but issues a warning, if such a
+variable is accessed outside the for scope.
+
+@item implicit C language
+Old C system header files did not contain an @code{extern "C" @{...@}}
+scope to set the language. On such systems, all header files are
+implicitly scoped inside a C language scope. Also, an empty prototype
+@code{()} will be treated as an unspecified number of arguments, rather
+than no arguments, as C++ demands.
+@end table